diff options
author | Jacob Smith <jake.smith@hdfgroup.org> | 2018-12-12 19:39:14 (GMT) |
---|---|---|
committer | Jacob Smith <jake.smith@hdfgroup.org> | 2018-12-12 23:26:08 (GMT) |
commit | ea7332525010ef75e27ce5800cf65dd91ba43576 (patch) | |
tree | 19f440d677555c016dacc4a2cd28aaa80961e350 | |
parent | 496de6922fb13aa11a5c5efe56a3f8de157a77ad (diff) | |
parent | 6f52793adcd5a14aa63731e3c33c9737b5a04d16 (diff) | |
download | hdf5-ea7332525010ef75e27ce5800cf65dd91ba43576.zip hdf5-ea7332525010ef75e27ce5800cf65dd91ba43576.tar.gz hdf5-ea7332525010ef75e27ce5800cf65dd91ba43576.tar.bz2 |
Merge branch 'develop' into dset_ohdr_minimize
495 files changed, 39247 insertions, 19291 deletions
diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 622f0cf..464477b 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -125,7 +125,7 @@ else () endif () configure_file ( ${HDF_RESOURCES_DIR}/libhdf5.settings.cmake.in - ${HDF5_BINARY_DIR}/libhdf5.settings @ONLY + ${HDF5_BINARY_DIR}/libhdf5.settings ESCAPE_QUOTES @ONLY ) install ( FILES ${HDF5_BINARY_DIR}/libhdf5.settings @@ -215,6 +215,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) if (HDF5_PACK_INSTALL_DOCS) set (release_files ${release_files} + ${HDF5_SOURCE_DIR}/release_docs/INSTALL_Warnings.txt ${HDF5_SOURCE_DIR}/release_docs/INSTALL_CMake.txt ${HDF5_SOURCE_DIR}/release_docs/HISTORY-1_8.txt ${HDF5_SOURCE_DIR}/release_docs/INSTALL diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cdb31c..e2fb000 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,9 @@ endif () # dependencies of the HDF5 libs may be 'incomplete', add additional # dependencies to this variable so that external projects pick them up # +#option (HDF5_EXTERNAL_LIB_PREFIX "Use prefix for custom library naming." "") +set (HDF5_EXTERNAL_LIB_PREFIX "" CACHE STRING "Use prefix for custom library naming.") +mark_as_advanced (HDF5_EXTERNAL_LIB_PREFIX) # HDF5_EXTERNAL_LIB_PREFIX : # If the parent project needs to install hdf libraries, but avoid # name conflicts with system versions, then a prefix may be added @@ -548,11 +551,11 @@ else () endif () include (${HDF_RESOURCES_DIR}/HDFCompilerFlags.cmake) +set (CMAKE_MODULE_PATH ${HDF_RESOURCES_DIR} ${HDF_RESOURCES_EXT_DIR} ${CMAKE_MODULE_PATH}) #----------------------------------------------------------------------------- # Option to Enable MPI Parallel #----------------------------------------------------------------------------- -set (CMAKE_MODULE_PATH ${HDF_RESOURCES_DIR} ${HDF_RESOURCES_EXT_DIR} ${CMAKE_MODULE_PATH}) option (HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF) if (HDF5_ENABLE_PARALLEL) find_package(MPI REQUIRED) @@ -586,7 +589,7 @@ if (HDF5_ENABLE_PARALLEL) set (LARGE_PARALLEL_IO OFF) endif () else () - message (STATUS "Parallel libraries not found") + message (FATAL_ERROR "Parallel libraries not found") endif () endif () @@ -620,6 +623,26 @@ if (HDF5_USE_18_API_DEFAULT) endif () #----------------------------------------------------------------------------- +# Option to use 1.10.x API +#----------------------------------------------------------------------------- +option (HDF5_USE_110_API_DEFAULT "Use the HDF5 1.10.x API by default" OFF) +set (H5_USE_110_API_DEFAULT 0) +if (HDF5_USE_110_API_DEFAULT) + set (H5_USE_110_API_DEFAULT 1) + set (DEFAULT_API_VERSION "v110") +endif () + +#----------------------------------------------------------------------------- +# Option to use 1.12.x API +#----------------------------------------------------------------------------- +option (HDF5_USE_112_API_DEFAULT "Use the HDF5 1.12.x API by default" ON) +set (H5_USE_112_API_DEFAULT 0) +if (HDF5_USE_112_API_DEFAULT) + set (H5_USE_112_API_DEFAULT 1) + set (DEFAULT_API_VERSION "v112") +endif () + +#----------------------------------------------------------------------------- # Include user macros #----------------------------------------------------------------------------- include (UserMacros.cmake) @@ -890,4 +913,10 @@ endif () #----------------------------------------------------------------------------- configure_file (${HDF_RESOURCES_DIR}/H5pubconf.h.in ${HDF5_BINARY_DIR}/H5pubconf.h @ONLY) +#----------------------------------------------------------------------------- +# Options for use by cross compiling and toolchains +#----------------------------------------------------------------------------- +option (HDF5_USE_PREGEN "Use pre-generated Files" OFF) +option (HDF5_BATCH_H5DETECT "Use a batch command for running h5detect" OFF) + include (CMakeInstallation.cmake) @@ -3,7 +3,7 @@ HDF5 (Hierarchical Data Format 5) Software Library and Utilities ----------------------------------------------------------------------------- HDF5 (Hierarchical Data Format 5) Software Library and Utilities -Copyright (c) 2006, The HDF Group. +Copyright (c) 2006-2018, The HDF Group. NCSA HDF5 (Hierarchical Data Format 5) Software Library and Utilities Copyright (c) 1998-2006, The Board of Trustees of the University of Illinois. @@ -21,27 +21,27 @@ provided that the following conditions are met: this list of conditions, and the following disclaimer in the documentation and/or materials provided with the distribution. -3. In addition, redistributions of modified forms of the source or binary - code must carry prominent notices stating that the original code was - changed and the date of the change. - -4. All publications or advertising materials mentioning features or use of - this software are asked, but not required, to acknowledge that it was - developed by The HDF Group and by the National Center for Supercomputing - Applications at the University of Illinois at Urbana-Champaign and - credit the contributors. - -5. Neither the name of The HDF Group, the name of the University, nor the +3. Neither the name of The HDF Group, the name of the University, nor the name of any Contributor may be used to endorse or promote products derived from this software without specific prior written permission from The HDF Group, the University, or the Contributor, respectively. DISCLAIMER: THIS SOFTWARE IS PROVIDED BY THE HDF GROUP AND THE CONTRIBUTORS -"AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. In no -event shall The HDF Group or the Contributors be liable for any damages -suffered by the users arising out of the use of this software, even if -advised of the possibility of such damage. +"AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO +EVENT SHALL THE HDF GROUP OR THE CONTRIBUTORS BE LIABLE FOR ANY DAMAGES +SUFFERED BY THE USERS ARISING OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +You are under no obligation whatsoever to provide any bug fixes, patches, or +upgrades to the features, functionality or performance of the source code +("Enhancements") to anyone; however, if you choose to make your Enhancements +available either publicly, or directly to The HDF Group, without imposing a +separate written license agreement for such Enhancements, then you hereby +grant the following license: a non-exclusive, royalty-free perpetual license +to install, use, modify, prepare derivative works, incorporate into other +computer software, distribute, and sublicense such enhancements or derivative +works thereof, in binary and source code form. ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- @@ -55,9 +55,9 @@ http://support.hdfgroup.org/ftp/HDF5/releases/COPYING_LBNL_HDF5. ----------------------------------------------------------------------------- Contributors: National Center for Supercomputing Applications (NCSA) at -the University of Illinois, Fortner Software, Unidata Program Center (netCDF), -The Independent JPEG Group (JPEG), Jean-loup Gailly and Mark Adler (gzip), -and Digital Equipment Corporation (DEC). +the University of Illinois, Fortner Software, Unidata Program Center +(netCDF), The Independent JPEG Group (JPEG), Jean-loup Gailly and Mark Adler +(gzip), and Digital Equipment Corporation (DEC). ----------------------------------------------------------------------------- @@ -98,8 +98,9 @@ and/or accompanying materials: ----------------------------------------------------------------------------- HDF5 is available with the SZIP compression library but SZIP is not part -of HDF5 and has separate copyright and license terms. See “Szip Compression -in HDF Products” (https://support.hdfgroup.org/doc_resource/SZIP/) for further details. +of HDF5 and has separate copyright and license terms. See SZIP Compression +in HDF Products (www.hdfgroup.org/doc_resource/SZIP/) for further details. ----------------------------------------------------------------------------- + @@ -92,6 +92,13 @@ ./bin/timekeeper _DO_NOT_DISTRIBUTE_ ./bin/trace ./bin/yodconfigure +./bin/batch/knl_ctestP.sl +./bin/batch/knl_ctestS.sl +./bin/batch/knl_ctestSP.sl +./bin/batch/knl_H5detect.sl.in.cmake +./bin/batch/sbatch_ctestS.sl +./bin/batch/sbatch_ctestP.sl +./bin/batch/sbatch_ctestSP.sl ./bin/pkgscrpts/h5rmflags _DO_NOT_DISTRIBUTE_ ./bin/pkgscrpts/makeHDF5BinaryTarfiles.pl _DO_NOT_DISTRIBUTE_ ./bin/pkgscrpts/makeInternalREADME.pl _DO_NOT_DISTRIBUTE_ @@ -445,6 +452,7 @@ ./release_docs/INSTALL_CMake.txt ./release_docs/INSTALL_Cygwin.txt ./release_docs/INSTALL_parallel +./release_docs/INSTALL_Warnings.txt ./release_docs/INSTALL_Windows.txt ./release_docs/RELEASE.txt ./release_docs/USING_HDF5_CMake.txt @@ -494,7 +502,6 @@ ./src/H5Bmodule.h ./src/H5Bpkg.h ./src/H5Bprivate.h -./src/H5Bpublic.h ./src/H5B2.c ./src/H5B2cache.c ./src/H5B2dbg.c @@ -505,7 +512,6 @@ ./src/H5B2module.h ./src/H5B2pkg.h ./src/H5B2private.h -./src/H5B2public.h ./src/H5B2stat.c ./src/H5B2test.c ./src/H5C.c @@ -525,8 +531,8 @@ ./src/H5CS.c ./src/H5CSprivate.h ./src/H5CX.c -./src/H5CXprivate.h ./src/H5CXmodule.h +./src/H5CXprivate.h ./src/H5D.c ./src/H5Dbtree.c ./src/H5Dbtree2.c @@ -575,6 +581,7 @@ ./src/H5EAsblock.c ./src/H5EAstat.c ./src/H5EAtest.c +./src/H5ESpublic.h ./src/H5F.c ./src/H5Faccum.c ./src/H5Fcwfs.c @@ -649,7 +656,6 @@ ./src/H5FSmodule.h ./src/H5FSpkg.h ./src/H5FSprivate.h -./src/H5FSpublic.h ./src/H5FSsection.c ./src/H5FSstat.c ./src/H5FStest.c @@ -689,7 +695,6 @@ ./src/H5HFmodule.h ./src/H5HFpkg.h ./src/H5HFprivate.h -./src/H5HFpublic.h ./src/H5HFsection.c ./src/H5HFspace.c ./src/H5HFstat.c @@ -701,7 +706,6 @@ ./src/H5HGmodule.h ./src/H5HGpkg.h ./src/H5HGprivate.h -./src/H5HGpublic.h ./src/H5HGquery.c ./src/H5HL.c ./src/H5HLcache.c @@ -712,7 +716,6 @@ ./src/H5HLpkg.h ./src/H5HLprfx.c ./src/H5HLprivate.h -./src/H5HLpublic.h ./src/H5HP.c ./src/H5HPprivate.h ./src/H5I.c @@ -885,6 +888,17 @@ ./src/H5Tvlen.c ./src/H5TS.c ./src/H5TSprivate.h +./src/H5VL.c +./src/H5VLcallback.c +./src/H5VLint.c +./src/H5VLmodule.h +./src/H5VLnative.c +./src/H5VLnative.h +./src/H5VLpassthru.c +./src/H5VLpassthru.h +./src/H5VLpkg.h +./src/H5VLprivate.h +./src/H5VLpublic.h ./src/H5VM.c ./src/H5VMprivate.h ./src/H5WB.c @@ -950,6 +964,7 @@ ./test/dtypes.c ./test/dtransform.c ./test/earray.c +./test/echo_vol.c ./test/efc.c ./test/enc_dec_plist.c ./test/enc_dec_plist_cross_platform.c @@ -1129,10 +1144,10 @@ ./test/use_disable_mdc_flushes.c ./test/use.h ./test/vfd.c +./test/vol.c ./test/test_filters_le.h5 ./test/test_filters_be.h5 ./test/gen_filters.c -./test/chunk_info.c ./test/vds.c ./test/vds_swmr.h ./test/vds_swmr_gen.c @@ -1248,6 +1263,7 @@ ./testpar/t_cache_image.c ./testpar/t_chunk_alloc.c ./testpar/t_coll_chunk.c +./testpar/t_coll_md_read.c ./testpar/t_dset.c ./testpar/t_file.c ./testpar/t_file_image.c @@ -2604,6 +2620,7 @@ ./tools/test/perform/build_h5perf_alone.sh ./tools/test/perform/build_h5perf_serial_alone.sh ./tools/test/perform/chunk.c +./tools/test/perform/chunk_cache.c ./tools/test/perform/direct_write_perf.c ./tools/test/perform/gen_report.pl ./tools/test/perform/iopipe.c @@ -3147,6 +3164,10 @@ ./java/lib/ext/slf4j-simple-1.7.25.jar # CMake-specific Files +./config/toolchain/crayle.cmake +./config/toolchain/GCC.cmake +./config/toolchain/intel.cmake + ./config/cmake/cacheinit.cmake ./config/cmake/CMakeFindJavaCommon.cmake ./config/cmake/ConversionTests.c @@ -3176,6 +3197,7 @@ ./config/cmake/UseJavaSymlinks.cmake ./config/cmake/userblockTest.cmake ./config/cmake/vfdTest.cmake +./config/cmake/wait_H5Tinit.cmake ./config/cmake_ext_mod/ConfigureChecks.cmake ./config/cmake_ext_mod/CTestCustom.cmake diff --git a/Makefile.am b/Makefile.am index e3e5e3d..d58b1b4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -186,6 +186,15 @@ check-vfd: fi; \ done +# Run tests with different Virtual Object Layer Connectors. +# Currently, only invoke check-vol in the test directory. +check-vol: + for d in src test; do \ + if test $$d != .; then \ + (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ + fi; \ + done + # Automake wants to make config.status depend on configure. This # makes sense, but config.status can't always be regenerated # properly, which can cause builds to fail. @@ -1,4 +1,4 @@ -HDF5 version 1.11.2 currently under development +HDF5 version 1.11.4 currently under development ------------------------------------------------------------------------------ Please refer to the release_docs/INSTALL file for installation instructions. diff --git a/bin/batch/knl_H5detect.sl.in.cmake b/bin/batch/knl_H5detect.sl.in.cmake new file mode 100644 index 0000000..39a3ef3 --- /dev/null +++ b/bin/batch/knl_H5detect.sl.in.cmake @@ -0,0 +1,20 @@ +#!/bin/bash + +#SBATCH -p knl -C quad +#SBATCH --nodes=1 +#SBATCH -t 00:10:00 +#SBATCH --mail-type=BEGIN,END,FAIL +#SBATCH --mail-user=<username>@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=knl_h5detect + + +# Inputs: Build directory, output file name, executable file name (username/email if available). +PROGNAME=H5detect +OUTPUT=H5Tinit.c + +CMD="@HDF5_BINARY_DIR@/bin/${PROGNAME} @HDF5_GENERATED_SOURCE_DIR@/${OUTPUT}" +echo "Run $CMD" +srun -n 1 $CMD +echo "Done running $CMD" + diff --git a/bin/batch/knl_ctestP.sl b/bin/batch/knl_ctestP.sl new file mode 100644 index 0000000..3a03fe2 --- /dev/null +++ b/bin/batch/knl_ctestP.sl @@ -0,0 +1,18 @@ +#!/bin/bash + +#SBATCH -p knl -C quad,flat +#SBATCH --nodes=1 +#SBATCH -t 00:30:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=<username>@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestS + +cd build +#run parallel tests except t_cache_image test +CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM -E t_cache_image -C Release -T test" + +echo "Run $CMD. Test output will be in build/ctestP.out" +$CMD >& ctestP.out +echo "Done running $CMD" + diff --git a/bin/batch/knl_ctestS.sl b/bin/batch/knl_ctestS.sl new file mode 100644 index 0000000..5b77c5b --- /dev/null +++ b/bin/batch/knl_ctestS.sl @@ -0,0 +1,17 @@ +#!/bin/bash + +#SBATCH -p knl -C quad,flat +#SBATCH --nodes=1 +#SBATCH -t 00:30:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=<username>@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestS + +cd build +CMD="ctest . -E TEST_PAR|H5DIFF|PERFORM -C Release -j 32 -T test" + +echo "Run $CMD. Test output will be in build/ctestS.out" +$CMD >& ctestS.out +echo "Done running $CMD" + diff --git a/bin/batch/knl_ctestSP.sl b/bin/batch/knl_ctestSP.sl new file mode 100644 index 0000000..56da347 --- /dev/null +++ b/bin/batch/knl_ctestSP.sl @@ -0,0 +1,28 @@ +#!/bin/bash + +#SBATCH -p knl -C quad,flat +#SBATCH --nodes=1 +#SBATCH -t 01:00:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=<username>@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestS + +module load cmake +module load craype-hugepages4M + +cd build +CMD="ctest . -E TEST_PAR|H5DIFF|PERFORM -C Release -j 32 -T test" + +echo "Run $CMD. Test output will be in build/ctestS.out" +$CMD >& ctestS.out +echo "Done running $CMD" + + +#run parallel tests except t_cache_image test +CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM -E t_cache_image -C Release -T test" + +echo "Run $CMD. Test output will be in build/ctestP.out" +$CMD >& ctestP.out +echo "Done running $CMD" + diff --git a/bin/batch/sbatch_ctestP.sl b/bin/batch/sbatch_ctestP.sl new file mode 100644 index 0000000..e967dce --- /dev/null +++ b/bin/batch/sbatch_ctestP.sl @@ -0,0 +1,17 @@ +#!/bin/bash + +#SBATCH --nodes=1 +#SBATCH -t 00:30:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=<username>@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestS + + +cd build +CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM -E t_cache_image -C Release -T test" + +echo "Run $CMD. Test output will be in build/ctestP.out" +$CMD >& ctestP.out +echo "Done running $CMD" + diff --git a/bin/batch/sbatch_ctestS.sl b/bin/batch/sbatch_ctestS.sl new file mode 100644 index 0000000..a103356 --- /dev/null +++ b/bin/batch/sbatch_ctestS.sl @@ -0,0 +1,16 @@ +#!/bin/bash + +#SBATCH --nodes=1 +#SBATCH -t 00:30:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=<username>@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestS + + +cd build +CMD="ctest . -E TEST_PAR|H5DIFF|PERFORM -C Release -j 32 -T test" + +echo "Run $CMD. Test output will be in build/ctestS.out" +$CMD >& ctestS.out +echo "Done running $CMD" diff --git a/bin/batch/sbatch_ctestSP.sl b/bin/batch/sbatch_ctestSP.sl new file mode 100644 index 0000000..5d79d9b --- /dev/null +++ b/bin/batch/sbatch_ctestSP.sl @@ -0,0 +1,25 @@ +#!/bin/bash + +#SBATCH --nodes=1 +#SBATCH -t 01:00:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=<username>@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestS + + +cd build +CMD="ctest . -E TEST_PAR|H5DIFF|PERFORM -C Release -j 32 -T test" + +echo "Run $CMD. Test output will be in build/ctestS.out" +$CMD >& ctestS.out +echo "Done running $CMD" + + +#run parallel tests except t_cache_image test +CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM -E t_cache_image -C Release -T test" + +echo "Run $CMD. Test output will be in build/ctestP.out" +$CMD >& ctestP.out +echo "Done running $CMD" + diff --git a/bin/make_err b/bin/make_err index bfe8861..623c1b6 100755 --- a/bin/make_err +++ b/bin/make_err @@ -244,8 +244,8 @@ sub create_init ($) { print HEADER "/* Major error codes */\n"; print HEADER "/*********************/\n\n"; foreach $name (keys %major) { - print HEADER " "x(0*$indent),"assert(${name}_g==(-1));\n"; - print HEADER " "x(0*$indent),"if((msg = H5E_create_msg(cls, H5E_MAJOR, \"${major{$name}}\"))==NULL)\n"; + print HEADER " "x(0*$indent),"HDassert(${name}_g==(-1));\n"; + print HEADER " "x(0*$indent),"if((msg = H5E__create_msg(cls, H5E_MAJOR, \"${major{$name}}\"))==NULL)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, \"error message initialization failed\")\n"; print HEADER " "x(0*$indent),"if((${name}_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, \"can't register error message\")\n"; @@ -260,8 +260,8 @@ sub create_init ($) { # Iterate over all the minor errors in each section for $name ( @{$section_list{$sect_name}}) { - print HEADER " "x(0*$indent),"assert(${name}_g==(-1));\n"; - print HEADER " "x(0*$indent),"if((msg = H5E_create_msg(cls, H5E_MINOR, \"${minor{$name}}\"))==NULL)\n"; + print HEADER " "x(0*$indent),"HDassert(${name}_g==(-1));\n"; + print HEADER " "x(0*$indent),"if((msg = H5E__create_msg(cls, H5E_MINOR, \"${minor{$name}}\"))==NULL)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, \"error message initialization failed\")\n"; print HEADER " "x(0*$indent),"if((${name}_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, \"can't register error message\")\n"; diff --git a/bin/make_vers b/bin/make_vers index 7e7fba1..4de2dbd 100755 --- a/bin/make_vers +++ b/bin/make_vers @@ -7,8 +7,8 @@ require 5.003; # is added (like support for 1.4, etc), the min_sup_idx parameter will # need to be decremented. - QAK) -# Max. library "index" (0 = v1.0, 1 = 1.2, etc) -$max_idx = 5; +# Max. library "index" (0 = v1.0, 1 = 1.2, 2 = 1.4, 3 = 1.6, 4 = 1.8, 5 = 1.10, 6 = 1.12, etc) +$max_idx = 6; # Min. supported previous library version "index" (0 = v1.0, 1 = 1.2, etc) $min_sup_idx = 3; @@ -478,7 +478,7 @@ for $file (@ARGV) { } } close SOURCE; - + # Create header files print "Generating '", $prefix, "H5version.h'\n"; create_public($prefix); diff --git a/bin/makehelp b/bin/makehelp index d6fbda2..4707397 100755 --- a/bin/makehelp +++ b/bin/makehelp @@ -40,6 +40,7 @@ make distclean: remove all files generated by make, make check, or make check-p: Only run parallel tests make check-s: Only run serial tests make check-vfd: Run tests with each virtual file driver +make check-vol: Run tests with each virtual object layer connector HDF5 uses Automake, so any standard Automake targets not listed here should also work. diff --git a/bin/release b/bin/release index afdbb51..e43be17 100755 --- a/bin/release +++ b/bin/release @@ -225,7 +225,7 @@ tar2cmakezip() # step 3: add SZIP.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/SZip.tar.gz $cmziptmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmziptmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.10.8-Source.tar.gz $cmziptmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.10.10-Source.tar.gz $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5options.cmake $cmziptmpsubdir @@ -320,7 +320,7 @@ tar2cmaketgz() # step 3: add SZIP.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/SZip.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.10.8-Source.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.10.10-Source.tar.gz $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5options.cmake $cmgztmpsubdir diff --git a/bin/snapshot b/bin/snapshot index 5c78fc8..5900728 100755 --- a/bin/snapshot +++ b/bin/snapshot @@ -132,6 +132,7 @@ DISPLAYUSAGE() Usage: $PROGNAME [all] [checkout] [ftp <URL> [diff] [test] [srcdir] [release] [help] [clean] [distclean] [echo] [deploy <dir>] [deploydir <dir>] [zlib <zlib_path>] [releasedir <dir>] [srcdirname <dir>] [check-vfd] + [check-vol] [exec <command>] [module-load <module-list>] [op-configure <option>] [--<option>] all: Run all commands (checkout, test & release) @@ -169,6 +170,8 @@ Usage: $PROGNAME [all] [checkout] [ftp <URL> [diff] [test] [srcdir] [release] [h [Default is $ReleaseDir_default] check-vfd: Run make check-vfd instead of just make check. + check-vol: + Run make check-vol instead of just make check. exttest <testscript>; Run testscript; exec <command>: @@ -422,6 +425,9 @@ while [ $# -gt 0 ] ; do check-vfd) CHECKVAL=check-vfd ;; + check-vol) + CHECKVAL=check-vol + ;; module-load) shift if [ $# -lt 1 ]; then @@ -46,6 +46,7 @@ $Source = ""; "H5E_direction_t" => "Ed", "H5E_error_t" => "Ee", "H5E_type_t" => "Et", + "H5ES_status_t" => "Es", "H5F_close_degree_t" => "Fd", "H5F_fspace_strategy_t" => "Ff", "H5F_file_space_type_t" => "Ff", @@ -67,6 +68,7 @@ $Source = ""; "unsigned" => "Iu", "unsigned int" => "Iu", "uint32_t" => "Iu", + "uint64_t" => "UL", "H5I_type_t" => "It", "H5G_link_t" => "Ll", #Same as H5L_type_t now "H5L_type_t" => "Ll", @@ -95,6 +97,23 @@ $Source = ""; "H5T_str_t" => "Tz", "unsigned long" => "Ul", "unsigned long long" => "UL", + "H5VL_attr_get_t" => "Va", + "H5VL_attr_specific_t" => "Vb", + "H5VL_class_value_t" => "VC", + "H5VL_dataset_get_t" => "Vc", + "H5VL_dataset_specific_t" => "Vd", + "H5VL_datatype_get_t" => "Ve", + "H5VL_datatype_specific_t" => "Vf", + "H5VL_file_get_t" => "Vg", + "H5VL_file_specific_t" => "Vh", + "H5VL_group_get_t" => "Vi", + "H5VL_group_specific_t" => "Vj", + "H5VL_link_create_type_t" => "Vk", + "H5VL_link_get_t" => "Vl", + "H5VL_link_specific_t" => "Vm", + "H5VL_object_get_t" => "Vn", + "H5VL_object_specific_t" => "Vo", + "H5VL_request_specific_t" => "Vr", "void" => "x", "FILE" => "x", "H5A_operator_t" => "x", @@ -124,6 +143,7 @@ $Source = ""; "H5G_iterate_t" => "x", "H5G_info_t" => "x", "H5I_free_t" => "x", + "H5I_iterate_func_t" => "x", "H5I_search_func_t" => "x", "H5L_class_t" => "x", "H5L_elink_traverse_t" => "x", @@ -147,6 +167,10 @@ $Source = ""; "H5T_cdata_t" => "x", "H5T_conv_t" => "x", "H5T_conv_except_func_t" => "x", + "H5VL_t" => "x", + "H5VL_class_t" => "x", + "H5VL_loc_params_t" => "x", + "H5VL_request_notify_t" => "x", "H5Z_func_t" => "x", "H5Z_filter_func_t" => "x", "va_list" => "x", @@ -295,7 +319,7 @@ sub rewrite_func ($$$$$) { # Ignored due to NO TRACE comment. } elsif ($body =~ s/((\n[ \t]*)H5TRACE\d+\s*\(.*?\);)\n/"$2$trace"/es) { # Replaced an H5TRACE macro. - } elsif ($body=~s/((\n[ \t]*)FUNC_ENTER\w*\s*(\(.*?\))?;??)\n/"$1$2$trace"/es) { + } elsif ($body=~s/((\n[ \t]*)FUNC_ENTER\w*[ \t]*(\(.*?\))?;??)\n/"$1$2$trace"/es) { # Added an H5TRACE macro after a FUNC_ENTER macro. } else { errmesg $file, $name, "unable to insert tracing information"; diff --git a/c++/examples/run-c++-ex.sh.in b/c++/examples/run-c++-ex.sh.in index f0d3e93..d975924 100644 --- a/c++/examples/run-c++-ex.sh.in +++ b/c++/examples/run-c++-ex.sh.in @@ -32,7 +32,7 @@ EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-@prefix@}" +prefix="${prefix:-../../..}" AR="@AR@" RANLIB="@RANLIB@" H5TOOL="h5c++" # The tool name diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 07d7e84..719c1ba 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -192,16 +192,17 @@ H5File::H5File(const H5File& original) : Group() //-------------------------------------------------------------------------- bool H5File::isHdf5(const char* name) { - // Calls C routine H5Fis_hdf5 to determine whether the file is in + // Calls C routine H5Fis_accessible to determine whether the file is in // HDF5 format. It returns positive value, 0, or negative value - htri_t ret_value = H5Fis_hdf5(name); + htri_t ret_value = H5Fis_accessible(name, H5P_DEFAULT); + if (ret_value > 0) return true; else if (ret_value == 0) return false; - else // Raise exception when H5Fis_hdf5 returns a negative value + else // Raise exception when H5Fis_accessible returns a negative value { - throw FileIException("H5File::isHdf5", "H5Fis_hdf5 returned negative value"); + throw FileIException("H5File::isHdf5", "H5Fis_accessible returned negative value"); } } @@ -218,6 +219,46 @@ bool H5File::isHdf5(const H5std_string& name) } //-------------------------------------------------------------------------- +// Function: H5File::isAccessible (static) +///\brief Determines whether a file can be accessed as HDF5. (Static) +///\param name - IN: Name of the file +///\param access_plist - IN: File access property list. Default to +/// FileAccPropList::DEFAULT +///\return true if the file can be accessed as HDF5, and false, otherwise +///\exception H5::FileIException +// September 2018 +//-------------------------------------------------------------------------- +bool H5File::isAccessible(const char* name, const FileAccPropList& access_plist) +{ + // Calls C routine H5Fis_accessible to determine whether the file is in + // HDF5 format. It returns positive value, 0, or negative value + hid_t access_plist_id = access_plist.getId(); + htri_t ret_value = H5Fis_accessible(name, access_plist_id); + if (ret_value > 0) + return true; + else if (ret_value == 0) + return false; + else // Raise exception when H5Fis_accessible returns a negative value + { + throw FileIException("H5File::isAccessible", "H5Fis_accessible returned negative value"); + } +} + +//-------------------------------------------------------------------------- +// Function: H5File::isAccessible (static) +///\brief This is an overloaded member function, provided for convenience. +/// It takes an \c H5std_string for \a name. (Static) +///\param name - IN: Name of the file - \c H5std_string +///\param access_plist - IN: File access property list. Default to +/// FileAccPropList::DEFAULT +// September 2018 +//-------------------------------------------------------------------------- +bool H5File::isAccessible(const H5std_string& name, const FileAccPropList& access_plist) +{ + return(isAccessible(name.c_str(), access_plist)); +} + +//-------------------------------------------------------------------------- // Function: openFile ///\brief Opens an HDF5 file ///\param name - IN: Name of the file diff --git a/c++/src/H5File.h b/c++/src/H5File.h index 473428a..332685e 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -73,6 +73,10 @@ class H5_DLLCPP H5File : public Group { static bool isHdf5(const char* name); static bool isHdf5(const H5std_string& name); + // Determines if a file, specified by its name, can be accessed as HDF5 + static bool isAccessible(const char* name, const FileAccPropList& access_plist = FileAccPropList::DEFAULT); + static bool isAccessible(const H5std_string& name, const FileAccPropList& access_plist = FileAccPropList::DEFAULT); + // Reopens this file. void reOpen(); // added for better name diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index a041273..20a0a99 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -176,6 +176,7 @@ H5I_type_t IdComponent::getHDFObjType() const /// \li \c H5I_ATTR /// \li \c H5I_REFERENCE (DEPRECATED) /// \li \c H5I_VFL +/// \li \c H5I_VOL /// \li \c H5I_GENPROP_CLS /// \li \c H5I_GENPROP_LST /// \li \c H5I_ERROR_CLASS @@ -229,6 +230,7 @@ bool IdComponent::isValid(hid_t an_id) /// \li \c H5I_ATTR /// \li \c H5I_REFERENCE (DEPRECATED) /// \li \c H5I_VFL +/// \li \c H5I_VOL /// \li \c H5I_GENPROP_CLS /// \li \c H5I_GENPROP_LST /// \li \c H5I_ERROR_CLASS diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 1918d27..99f722c 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -151,6 +151,7 @@ PropList::PropList(const hid_t plist_id) : IdComponent() case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am index 949325a..eb50209 100644 --- a/c++/src/Makefile.am +++ b/c++/src/Makefile.am @@ -32,15 +32,15 @@ bin_SCRIPTS=h5c++ # Source files for the library libhdf5_cpp_la_SOURCES=H5Exception.cpp H5IdComponent.cpp \ - H5DataSpace.cpp H5PropList.cpp H5Library.cpp \ - H5FaccProp.cpp H5FcreatProp.cpp H5LcreatProp.cpp \ - H5LaccProp.cpp H5DaccProp.cpp H5DxferProp.cpp \ + H5DataSpace.cpp H5PropList.cpp H5Library.cpp \ + H5FaccProp.cpp H5FcreatProp.cpp H5LcreatProp.cpp \ + H5LaccProp.cpp H5DaccProp.cpp H5DxferProp.cpp \ H5DcreatProp.cpp H5Location.cpp H5AbstractDs.cpp \ H5Attribute.cpp H5Object.cpp H5OcreatProp.cpp \ - H5DataType.cpp H5AtomType.cpp H5PredType.cpp \ + H5DataType.cpp H5AtomType.cpp H5PredType.cpp \ H5EnumType.cpp H5IntType.cpp H5FloatType.cpp \ H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp \ - H5CompType.cpp H5DataSet.cpp H5CommonFG.cpp H5Group.cpp \ + H5CompType.cpp H5DataSet.cpp H5CommonFG.cpp H5Group.cpp \ H5File.cpp # HDF5 C++ library depends on HDF5 Library. diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index 037d4cb..697fb77 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.11.2" +PROJECT_NUMBER = "1.11.4" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index bdf6d80..4734755 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -1712,7 +1712,7 @@ static void test_attr_dense_create(FileCreatPropList& fcpl, // Close property list dcpl.close(); - // H5O_is_attr_dense_test - un-usable + // H5O__is_attr_dense_test - un-usable // Add attributes, until just before converting to dense storage char attr_name[NAME_BUF_SIZE]; @@ -1727,7 +1727,7 @@ static void test_attr_dense_create(FileCreatPropList& fcpl, attr.write(PredType::NATIVE_UINT, &attr_num); } // end for - // H5O_is_attr_dense_test - un-usable + // H5O__is_attr_dense_test - un-usable { // Add one more attribute, to push into "dense" storage @@ -1815,8 +1815,8 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl, ds_space.close(); // Check on dataset's attribute storage status. - // NOTE: Wrappers not available yet (H5O_is_attr_empty_test - // and H5O_is_attr_dense_test) + // NOTE: Wrappers not available yet (H5O__is_attr_empty_test + // and H5O__is_attr_dense_test) // Close dataset dataset.close(); diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index f8d7089..6e990c9 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -857,11 +857,6 @@ void test_links() { hid_t fapl_id, fapl2_id; /* File access property lists */ unsigned new_format; /* Whether to use the new format or not */ - const char *envval; - - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; fapl_id = h5_fileaccess(); diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c index 321d879..c2748b2 100644 --- a/config/cmake/ConversionTests.c +++ b/config/cmake/ConversionTests.c @@ -9,7 +9,7 @@ * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -+ + #if defined(__has_attribute) #if __has_attribute(no_sanitize) #define HDF_NO_UBSAN __attribute__((no_sanitize("undefined"))) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index ccfe581..2ddb740 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -669,6 +669,12 @@ /* Define using v1.8 public API symbols by default */ #cmakedefine H5_USE_18_API_DEFAULT @H5_USE_18_API_DEFAULT@ +/* Define using v1.10 public API symbols by default */ +#cmakedefine H5_USE_110_API_DEFAULT @H5_USE_110_API_DEFAULT@ + +/* Define using v1.12 public API symbols by default */ +#cmakedefine H5_USE_112_API_DEFAULT @H5_USE_112_API_DEFAULT@ + /* Define if a memory checking tool will be used on the library, to cause library to be very picky about memory operations and also disable the internal free list manager code. */ diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in index 1f4f479..ba79ef2 100644 --- a/config/cmake/HDF518_Examples.cmake.in +++ b/config/cmake/HDF518_Examples.cmake.in @@ -48,7 +48,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=${ ################################################################## if(NOT DEFINED INSTALLDIR) - set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") + set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@") endif() if(NOT DEFINED CTEST_SOURCE_NAME) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 1f66bad..157befd 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -31,69 +31,53 @@ endif () # The provided CMake Fortran macros don't provide a general compile/run function # so this one is used. #----------------------------------------------------------------------------- -macro (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN) -# -# if (NOT DEFINED ${RUN_RESULT_VAR}) - message (STATUS "Detecting Fortran ${FUNCTION}") - if (CMAKE_REQUIRED_LIBRARIES) - set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else () - set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) - endif () +macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 RETURN_VAR) + message (STATUS "Detecting Fortran ${FUNCTION_NAME}") file (WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 - "${CODE}" + "${SOURCE_CODE}" ) TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 - CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" - RUN_OUTPUT_VARIABLE OUTPUT + LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}" ) - set(${RETURN} ${OUTPUT}) - - #message ( "Test result1 ${RETURN} ") - #message ( "Test result3 ${RESULT} ") - #message ( "Test result2 ${CMAKE_MATCH_0} ") - #message ( "Test result4 ${CMAKE_MATCH_1} ") - #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - #message ( "Test result2 ${COMPILE_RESULT_VAR} ") - #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - #message ( "Test result1 ${RUN_RESULT_VAR} ") - #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - if (${COMPILE_RESULT_VAR}) + set(${RETURN_VAR} ${RUN_RESULT_VAR}) if (${RUN_RESULT_VAR} MATCHES 0) - message (STATUS "Testing Fortran ${FUNCTION} - OK") + message (STATUS "Testing Fortran ${FUNCTION_NAME} - OK") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n" - "${OUTPUT}\n\n" + "Determining if the Fortran ${FUNCTION_NAME} exists passed\n" ) else () - message (STATUS "Testing Fortran ${FUNCTION} - Fail") + message (STATUS "Testing Fortran ${FUNCTION_NAME} - Fail") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n" - "${OUTPUT}\n\n") + "Determining if the Fortran ${FUNCTION_NAME} exists failed: ${RUN_RESULT_VAR}\n" + ) endif () + else () + message (STATUS "Compiling Fortran ${FUNCTION_NAME} - Fail") + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Fortran ${FUNCTION_NAME} compiles failed: ${COMPILE_RESULT_VAR}\n" + ) + set(${RETURN_VAR} ${COMPILE_RESULT_VAR}) endif () -# endif () endmacro () # Read source line beginning at the line matching Input:"START" and ending at the line matching Input:"END" -macro (READ_SOURCE START END RETURN) - file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" CODE) - string (REGEX MATCH "${START}[\\\t\\\n\\\r[].+]*${END}" CODE ${CODE}) - set (RETURN "${CODE}") +macro (READ_SOURCE SOURCE_START SOURCE_END RETURN_VAR) + file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" SOURCE_CODE) + string (REGEX MATCH "${SOURCE_START}[\\\t\\\n\\\r[].+]*${SOURCE_END}" SOURCE_CODE ${SOURCE_CODE}) + set (RETURN_VAR "${SOURCE_CODE}") endmacro () #----------------------------------------------------------------------------- # Check to see C_LONG_DOUBLE is available -READ_SOURCE("PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" "END PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" CODE) +READ_SOURCE("PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" "END PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" SOURCE_CODE) CHECK_FORTRAN_FEATURE(c_long_double - "${CODE}" + "${SOURCE_CODE}" FORTRAN_HAVE_C_LONG_DOUBLE ) @@ -105,9 +89,9 @@ endif () # Check to see C_LONG_DOUBLE is different from C_DOUBLE -READ_SOURCE("MODULE type_mod" "END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE" CODE) +READ_SOURCE("MODULE type_mod" "END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE" SOURCE_CODE) CHECK_FORTRAN_FEATURE(c_long_double - "${CODE}" + "${SOURCE_CODE}" FORTRAN_C_LONG_DOUBLE_IS_UNIQUE ) if (${FORTRAN_C_LONG_DOUBLE_IS_UNIQUE}) @@ -133,12 +117,12 @@ endif () # Determine the available KINDs for REALs and INTEGERs #----------------------------------------------------------------------------- -READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" CODE) +READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" SOURCE_CODE) FORTRAN_RUN ("REAL and INTEGER KINDs" - "${CODE}" - XX - YY - PROG_OUTPUT + "${SOURCE_CODE}" + XX + YY + PROG_RESULT ) # dnl The output from the above program will be: # dnl -- LINE 1 -- valid integer kinds (comma seperated list) @@ -197,15 +181,18 @@ foreach (KIND ${VAR} ) USE ISO_C_BINDING IMPLICIT NONE INTEGER (KIND=${KIND}) a - WRITE(*,'(I0)') ${FC_SIZEOF_A} + OPEN(8,FILE='pac_validIntKinds.out',FORM='formatted') + WRITE(8,'(I0)') ${FC_SIZEOF_A} + CLOSE(8) END " ) FORTRAN_RUN("INTEGER KIND SIZEOF" ${PROG_SRC} - XX - YY - PROG_OUTPUT1 + XX + YY + PROG_RESULT1 ) + file (READ "${CMAKE_BINARY_DIR}/pac_validIntKinds.out" PROG_OUTPUT1) string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") set (pack_int_sizeof "${pack_int_sizeof} ${PROG_OUTPUT1},") endforeach () @@ -241,15 +228,18 @@ foreach (KIND ${VAR} ) USE ISO_C_BINDING IMPLICIT NONE REAL (KIND=${KIND}) a - WRITE(*,'(I0)') ${FC_SIZEOF_A} + OPEN(8,FILE='pac_validRealKinds.out',FORM='formatted') + WRITE(8,'(I0)') ${FC_SIZEOF_A} + CLOSE(8) END " ) FORTRAN_RUN ("REAL KIND SIZEOF" ${PROG_SRC} - XX - YY - PROG_OUTPUT1 + XX + YY + PROG_RESULT1 ) + file (READ "${CMAKE_BINARY_DIR}/pac_validRealKinds.out" PROG_OUTPUT1) string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") set (pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT1},") endforeach () @@ -288,18 +278,21 @@ FORTRAN_RUN ("SIZEOF NATIVE KINDs" INTEGER a REAL b DOUBLE PRECISION c - WRITE(*,*) ${FC_SIZEOF_A} - WRITE(*,*) kind(a) - WRITE(*,*) ${FC_SIZEOF_B} - WRITE(*,*) kind(b) - WRITE(*,*) ${FC_SIZEOF_C} - WRITE(*,*) kind(c) + OPEN(8,FILE='pac_sizeof_native_kinds.out',FORM='formatted') + WRITE(8,*) ${FC_SIZEOF_A} + WRITE(8,*) kind(a) + WRITE(8,*) ${FC_SIZEOF_B} + WRITE(8,*) kind(b) + WRITE(8,*) ${FC_SIZEOF_C} + WRITE(8,*) kind(c) + CLOSE(8) END " - XX - YY - PROG_OUTPUT -) + XX + YY + PROG_RESULT + ) + file (READ "${CMAKE_BINARY_DIR}/pac_sizeof_native_kinds.out" PROG_OUTPUT) # dnl The output from the above program will be: # dnl -- LINE 1 -- sizeof INTEGER # dnl -- LINE 2 -- kind of INTEGER @@ -372,8 +365,8 @@ ENABLE_LANGUAGE (C) # The provided CMake C macros don't provide a general compile/run function # so this one is used. #----------------------------------------------------------------------------- -macro (C_RUN FUNCTION CODE RETURN) - message (STATUS "Detecting C ${FUNCTION}") +macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR) + message (STATUS "Detecting C ${FUNCTION_NAME}") if (CMAKE_REQUIRED_LIBRARIES) set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") @@ -382,16 +375,16 @@ macro (C_RUN FUNCTION CODE RETURN) endif () file (WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c - ${CODE} + ${SOURCE_CODE} ) TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" - RUN_OUTPUT_VARIABLE OUTPUT + RUN_OUTPUT_VARIABLE OUTPUT_VAR ) - set (${RETURN} ${OUTPUT}) + set (${RETURN_VAR} ${OUTPUT_VAR}) #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") #message ( "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ") @@ -401,21 +394,21 @@ macro (C_RUN FUNCTION CODE RETURN) if (${COMPILE_RESULT_VAR}) if (${RUN_RESULT_VAR} MATCHES 1) - set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION}") - message (STATUS "Testing C ${FUNCTION} - OK") + set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}") + message (STATUS "Testing C ${FUNCTION_NAME} - OK") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the C ${FUNCTION} exists passed with the following output:\n" - "${OUTPUT}\n\n" + "Determining if the C ${FUNCTION_NAME} exists passed with the following output:\n" + "${OUTPUT_VAR}\n\n" ) else () - message (STATUS "Testing C ${FUNCTION} - Fail") - set (${RUN_RESULT_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION}") + message (STATUS "Testing C ${FUNCTION_NAME} - Fail") + set (${RUN_RESULT_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION_NAME}") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the C ${FUNCTION} exists failed with the following output:\n" - "${OUTPUT}\n\n") + "Determining if the C ${FUNCTION_NAME} exists failed with the following output:\n" + "${OUTPUT_VAR}\n\n") endif () else () - message (FATAL_ERROR "Compilation of C ${FUNCTION} - Failed") + message (FATAL_ERROR "Compilation of C ${FUNCTION_NAME} - Failed") endif () endmacro () diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index eb57685..d30f2ab 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -48,7 +48,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=${ ################################################################## if(NOT DEFINED INSTALLDIR) - set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") + set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@") endif() if(NOT DEFINED CTEST_SOURCE_NAME) @@ -70,7 +70,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDN #TAR_SOURCE - name of tarfile #if(NOT DEFINED TAR_SOURCE) -# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.5-Source") +# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.10-Source") #endif() ############################################################################################################### diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 214afa0..93ebc3c 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -9,6 +9,8 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # + +message (STATUS "Warnings Configuration:") #----------------------------------------------------------------------------- # Compiler specific flags : Shouldn't there be compiler tests for these #----------------------------------------------------------------------------- @@ -22,7 +24,7 @@ if (CMAKE_COMPILER_IS_GNUCC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common") endif () else () - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstdarg-opt") endif () endif () @@ -34,7 +36,7 @@ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common") endif () else () - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstdarg-opt") endif () endif () @@ -45,6 +47,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF) if (HDF5_DISABLE_COMPILER_WARNINGS) + message (STATUS "....Compiler warnings are suppressed") # MSVC uses /w to suppress warnings. It also complains if another # warning level is given, so remove it. if (MSVC) @@ -79,83 +82,80 @@ endif () # break into groups (from the config/gnu-flags file) #----------------------------------------------------------------------------- if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) - if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - set (CMAKE_C_FLAGS_5 "${CMAKE_C_FLAGS_5} -Wcast-qual") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs") - else () + if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=%none -DBSD_COMP") + else () + # General flags + # + # Note that some of the flags listed here really should be developer + # flags (listed in a separate variable, below) but we put them here + # because they are not raised by the current code and we'd like to + # know if they do start showing up. + # + # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) + # warnings that are emitted. If you need it, add it at configure time. + if (CMAKE_C_COMPILER_ID STREQUAL "Intel") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcheck -Wall") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcomment -Wdeprecated -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wreturn-type -Wstrict-prototypes -Wuninitialized") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wunknown-pragmas -Wunused-function -Wunused-variable") + # this is just a failsafe + set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions") + if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0) + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wsign-compare -Wtrigraphs -Wwrite-strings") + endif() + elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wc++-compat -Wcast-align") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings") + # gcc automatically inlines based on the optimization level + # this is just a failsafe + set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions") + endif () endif () #----------------------------------------------------------------------------- # Option to allow the user to enable developer warnings + # Developer warnings (suggestions from gcc, not code problems) #----------------------------------------------------------------------------- option (HDF5_ENABLE_DEV_WARNINGS "Enable HDF5 developer group warnings" OFF) if (HDF5_ENABLE_DEV_WARNINGS) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Winline -Waggregate-return") + message (STATUS "....HDF5 developer group warnings are enabled") + if (CMAKE_C_COMPILER_ID STREQUAL "Intel") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Wreorder -Wport -Wstrict-aliasing") + elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn") + endif () else () - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -Wno-inline -Wno-aggregate-return") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wno-inline -Wno-aggregate-return -Wno-missing-format-attribute -Wno-missing-noreturn") + endif () endif () - # Append warning flags - # Don't use the '-Wtraditional' flag, we're way past having K&R C code - # set (H5_CFLAGS "${H5_CFLAGS} -Wtraditional") - # Don't use the '-Wtraditional-conversion' flag, there's too many warnings - # from GCC's assert macro - # set (H5_CFLAGS "${H5_CFLAGS} -Wtraditional-conversion") - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #set (H5_CFLAGS "${H5_CFLAGS} -Wfloat-equal -Wmissing-format-attribute -Wpadded") - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wfloat-equal -Wmissing-format-attribute") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU") + # Append warning flags that only gcc 4.3+ knows about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2048 -Wvla") - # Append warning flags from gcc-3.2* case - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wpacked -Wdisabled-optimization") - if (HDF5_ENABLE_DEV_WARNINGS) - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wmissing-noreturn") - else () - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wno-missing-noreturn") + # Append more extra warning flags that only gcc 4.4+ know about + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") endif () - # Enable more format checking flags, beyond the basic -Wformat included - # in -Wall - set (H5_CFLAGS1_5 "${H5_CFLAGS1_5} -Wformat=2") - - # Append warning flags from gcc-3.3* case - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wendif-labels") - - # Append warning flags from gcc-3.4* case - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch") - - # Append more extra warning flags that only gcc4.0+ know about - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros") - - # Append more extra warning flags that only gcc 4.1+ know about - set (H5_CFLAGS2_5 "${H5_CFLAGS2_5} -Wunsafe-loop-optimizations") - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wc++-compat") - - # Append more extra warning flags that only gcc 4.2+ know about - set (H5_CFLAGS2_5 "${H5_CFLAGS2_5} -Wstrict-overflow") - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-strict-overflow") - - # Append more extra warning flags that only gcc 4.3+ know about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wlogical-op -Wlarger-than=2048 -Wvla") - - # Append more extra warning flags that only gcc 4.4+ know about - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") - # Append more extra warning flags that only gcc 4.5+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) - set (H5_CFLAGS2_5 "${H5_CFLAGS2_5} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants") - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wjump-misses-init -Wunsuffixed-float-constants") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants") endif () # Append more extra warning flags that only gcc 4.6+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdouble-promotion -Wtrampolines") if (HDF5_ENABLE_DEV_WARNINGS) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=const") @@ -164,14 +164,8 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) endif () endif () - # The "unreachable code" warning appears to be reliable now... - # (this warning was removed in gcc 4.5+) - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wunreachable-code") - endif () - # Append more extra warning flags that only gcc 4.7+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wstack-usage=8192 -Wvector-operation-performance") if (HDF5_ENABLE_DEV_WARNINGS) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn") @@ -181,7 +175,7 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) endif () # Append more extra warning flags that only gcc 4.8+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) if (HDF5_ENABLE_DEV_WARNINGS) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=format") else () @@ -190,19 +184,17 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) endif () # Append more extra warning flags that only gcc 4.9+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdate-time -Wopenmp-simd") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdate-time") endif () - # (There was no release of gcc 5.0) - # Append more extra warning flags that only gcc 5.1+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1) set (H5_CFLAGS3 "${H5_CFLAGS3} -Warray-bounds=2 -Wc99-c11-compat") endif () # Append more extra warning flags that only gcc 6.x+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) set (H5_CFLAGS4 "${H5_CFLAGS4} -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa") endif () @@ -213,6 +205,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" OFF) if (HDF5_ENABLE_ALL_WARNINGS) + message (STATUS "....All Warnings are enabled") if (MSVC) if (HDF5_ENABLE_DEV_WARNINGS) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") @@ -231,7 +224,7 @@ if (HDF5_ENABLE_ALL_WARNINGS) endif () else () if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic ${H5_CFLAGS1} ${H5_CFLAGS2}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2}") endif () endif () endif () @@ -241,6 +234,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_GROUPZERO_WARNINGS "Enable group zero warnings" OFF) if (HDF5_ENABLE_GROUPZERO_WARNINGS) + message (STATUS "....Group Zero warnings are enabled") if (MSVC) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W1") @@ -250,7 +244,7 @@ if (HDF5_ENABLE_GROUPZERO_WARNINGS) endif () else () if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS0}") endif () endif () endif () @@ -260,6 +254,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_GROUPONE_WARNINGS "Enable group one warnings" OFF) if (HDF5_ENABLE_GROUPONE_WARNINGS) + message (STATUS "....Group One warnings are enabled") if (MSVC) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W2") @@ -277,6 +272,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_GROUPTWO_WARNINGS "Enable group two warnings" OFF) if (HDF5_ENABLE_GROUPTWO_WARNINGS) + message (STATUS "....Group Two warnings are enabled") if (MSVC) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") @@ -294,6 +290,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_GROUPTHREE_WARNINGS "Enable group three warnings" OFF) if (HDF5_ENABLE_GROUPTHREE_WARNINGS) + message (STATUS "....Group Three warnings are enabled") if (MSVC) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") @@ -311,6 +308,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_GROUPFOUR_WARNINGS "Enable group four warnings" OFF) if (HDF5_ENABLE_GROUPFOUR_WARNINGS) + message (STATUS "....Group Four warnings are enabled") if (NOT MSVC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS4}") endif () diff --git a/config/cmake/UserMacros/Windows_MT.cmake b/config/cmake/UserMacros/Windows_MT.cmake index b6cc513..78d8277 100644 --- a/config/cmake/UserMacros/Windows_MT.cmake +++ b/config/cmake/UserMacros/Windows_MT.cmake @@ -14,7 +14,8 @@ ######################################################## # To use this option, copy both the macro and option code -# into the root UserMacros.cmake file. +# into the root UserMacros.cmake file. Then enable the option, +# using the command line add "-DBUILD_STATIC_CRT_LIBS:BOOL=ON" # OR add an include to the root UserMacros.cmake file: # INCLUDE(path_to_file/WINDOWS_MT.cmake) diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index 670196b..9534b1e 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -36,10 +36,6 @@ if (NOT SITE_OS_NAME) message (STATUS "Dashboard script uname output: ${osname}-${osrel}-${cpu}\n")
set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}")
- if (SITE_BUILDNAME_SUFFIX)
- set (CTEST_BUILD_NAME "${SITE_BUILDNAME_SUFFIX}-${CTEST_BUILD_NAME}")
- endif ()
- set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS}")
else ()
## machine name provided
## --------------------------
@@ -48,11 +44,11 @@ else () else ()
set (CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_COMPILER_NAME}")
endif ()
- if (SITE_BUILDNAME_SUFFIX)
- set (CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${SITE_BUILDNAME_SUFFIX}")
- endif ()
- set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}")
endif ()
+if (SITE_BUILDNAME_SUFFIX) + set (CTEST_BUILD_NAME "${SITE_BUILDNAME_SUFFIX}-${CTEST_BUILD_NAME}") +endif () +set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") #-----------------------------------------------------------------------------
# MAC machines need special option
@@ -158,7 +154,12 @@ endif () # Use multiple CPU cores to build
include (ProcessorCount)
ProcessorCount (N)
-if (NOT N EQUAL 0)
+if (NOT N EQUAL 0) + if (MAX_PROC_COUNT) + if (N GREATER MAX_PROC_COUNT) + set (N ${MAX_PROC_COUNT}) + endif () + endif () if (NOT WIN32)
set (CTEST_BUILD_FLAGS -j${N})
endif ()
@@ -189,10 +190,10 @@ endforeach () #-----------------------------------------------------------------------------
# Initialize the CTEST commands
#------------------------------
-if(CMAKE_GENERATOR_TOOLSET)
- set(CTEST_CONFIGURE_TOOLSET "-T${CMAKE_GENERATOR_TOOLSET}")
+if (CMAKE_GENERATOR_TOOLSET)
+ set (CTEST_CONFIGURE_TOOLSET "-T${CMAKE_GENERATOR_TOOLSET}")
else ()
- set(CTEST_CONFIGURE_TOOLSET "")
+ set (CTEST_CONFIGURE_TOOLSET "")
endif()
if (LOCAL_MEMCHECK_TEST)
find_program (CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
@@ -263,40 +264,67 @@ message (STATUS "Dashboard script configuration:\n${vars}\n") if (NOT LOCAL_SKIP_TEST)
if (NOT LOCAL_MEMCHECK_TEST)
- ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res)
- if (LOCAL_SUBMIT)
- ctest_submit (PARTS Test)
- endif ()
- if (${res} LESS 0 OR ${res} GREATER 0)
- file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n")
- endif ()
- else ()
- ctest_memcheck (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args})
- if (LOCAL_SUBMIT)
- ctest_submit (PARTS MemCheck)
- endif ()
- endif ()
- if (LOCAL_COVERAGE_TEST)
- ctest_coverage (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND)
- if (LOCAL_SUBMIT)
- ctest_submit (PARTS Coverage)
- endif ()
- endif ()
- endif ()
-
- if (NOT LOCAL_MEMCHECK_TEST AND NOT LOCAL_NO_PACKAGE AND NOT LOCAL_SKIP_BUILD)
- ##-----------------------------------------------
- ## Package the product
- ##-----------------------------------------------
- execute_process (COMMAND cpack -C ${CTEST_CONFIGURATION_TYPE} -V
- WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY}
- RESULT_VARIABLE cpackResult
- OUTPUT_VARIABLE cpackLog
- ERROR_VARIABLE cpackLog.err
- )
- file (WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}")
- if (cpackResult GREATER 0)
- file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed packaging: ${cpackResult}:${cpackLog.err} \n")
- endif ()
- endif ()
-#-----------------------------------------------------------------------------
+ if (NOT LOCAL_BATCH_TEST) + ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) + else () + file(STRINGS ${CTEST_BINARY_DIRECTORY}/Testing/TAG TAG_CONTENTS REGEX "^2([0-9]+)[-]([0-9]+)$") + execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${CTEST_SOURCE_DIRECTORY}/bin/batch/${LOCAL_BATCH_SCRIPT_NAME}) + message(STATUS "Check for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") + execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) + while(result) + ctest_sleep(60) + execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) + endwhile(result) + if (LOCAL_BATCH_SCRIPT_PARALLEL_NAME) + if (LOCAL_SUBMIT) + ctest_submit (PARTS Test) + endif () + message(STATUS "Found ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml for serial tests. Renaming to SerialTest.xml") + file (RENAME ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/SerialTest.xml) + unset(result CACHE) + execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${CTEST_SOURCE_DIRECTORY}/bin/batch/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}) + message(STATUS "Check for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") + execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) + while(result) + ctest_sleep(60) + execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) + endwhile(result) + message(STATUS "Found ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml for parallel tests.") + endif() + endif () + if (LOCAL_SUBMIT) + ctest_submit (PARTS Test) + endif () + if (${res} LESS 0 OR ${res} GREATER 0) + file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n") + endif () + else () + ctest_memcheck (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args}) + if (LOCAL_SUBMIT) + ctest_submit (PARTS MemCheck) + endif () + endif () + if (LOCAL_COVERAGE_TEST) + ctest_coverage (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) + if (LOCAL_SUBMIT) + ctest_submit (PARTS Coverage) + endif () + endif () + endif () + + if (NOT LOCAL_MEMCHECK_TEST AND NOT LOCAL_NO_PACKAGE AND NOT LOCAL_SKIP_BUILD) + ##----------------------------------------------- + ## Package the product + ##----------------------------------------------- + execute_process (COMMAND cpack -C ${CTEST_CONFIGURATION_TYPE} -V + WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} + RESULT_VARIABLE cpackResult + OUTPUT_VARIABLE cpackLog + ERROR_VARIABLE cpackLog.err + ) + file (WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}") + if (cpackResult GREATER 0) + file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed packaging: ${cpackResult}:${cpackLog.err} \n") + endif () + endif () +#----------------------------------------------------------------------------- diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 7eaf80a..dd3b17c 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -9,92 +9,92 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -#############################################################################################
-### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ###
-### BUILD_GENERATOR required [Unix, VS2017, VS201764, VS2015, VS201564, VS2013, VS201364] ###
-### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201764 -C Release -VV -O hdf5.log ###
-#############################################################################################
-
-cmake_minimum_required (VERSION 3.10)
-############################################################################
-# Usage:
-# ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log
-# where valid options for OPTION are:
-# BUILD_GENERATOR - The cmake build generator:
-# Unix * Unix Makefiles
+############################################################################################# +### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ### +### BUILD_GENERATOR required [Unix, VS2017, VS201764, VS2015, VS201564, VS2013, VS201364] ### +### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201764 -C Release -VV -O hdf5.log ### +############################################################################################# + +cmake_minimum_required (VERSION 3.10) +############################################################################ +# Usage: +# ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log +# where valid options for OPTION are: +# BUILD_GENERATOR - The cmake build generator: +# Unix * Unix Makefiles # VS2017 * Visual Studio 15 2017 # VS201764 * Visual Studio 15 2017 Win64 -# VS2015 * Visual Studio 14 2015
-# VS201564 * Visual Studio 14 2015 Win64
-# VS2013 * Visual Studio 12 2013
-# VS201364 * Visual Studio 12 2013 Win64
-#
-# INSTALLDIR - root folder where hdf5 is installed
-# CTEST_CONFIGURATION_TYPE - Release, Debug, etc
-# CTEST_SOURCE_NAME - source folder
-##############################################################################
-
-set (CTEST_SOURCE_VERSION "1.11.2")
-set (CTEST_SOURCE_VERSEXT "")
-
-##############################################################################
-# handle input parameters to script.
-#BUILD_GENERATOR - which CMake generator to use, required
-#INSTALLDIR - HDF5-1.10.0 root folder
-#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo
-#CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0
-if (DEFINED CTEST_SCRIPT_ARG)
- # transform ctest script arguments of the form
- # script.ctest,var1=value1,var2=value2
- # to variables with the respective names set to the respective values
- string (REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}")
- foreach (current_var ${script_args})
- if ("${current_var}" MATCHES "^([^=]+)=(.+)$")
- set ("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
- endif ()
- endforeach ()
-endif ()
-
-# build generator must be defined
-if (NOT DEFINED BUILD_GENERATOR)
- message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364")
-endif ()
-
-###################################################################
-### Following Line is one of [Release, RelWithDebInfo, Debug] #####
+# VS2015 * Visual Studio 14 2015 +# VS201564 * Visual Studio 14 2015 Win64 +# VS2013 * Visual Studio 12 2013 +# VS201364 * Visual Studio 12 2013 Win64 +# +# INSTALLDIR - root folder where hdf5 is installed +# CTEST_CONFIGURATION_TYPE - Release, Debug, etc +# CTEST_SOURCE_NAME - source folder +############################################################################## + +set (CTEST_SOURCE_VERSION "1.11.4") +set (CTEST_SOURCE_VERSEXT "") + +############################################################################## +# handle input parameters to script. +#BUILD_GENERATOR - which CMake generator to use, required +#INSTALLDIR - HDF5-1.10.0 root folder +#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo +#CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0 +if (DEFINED CTEST_SCRIPT_ARG) + # transform ctest script arguments of the form + # script.ctest,var1=value1,var2=value2 + # to variables with the respective names set to the respective values + string (REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}") + foreach (current_var ${script_args}) + if ("${current_var}" MATCHES "^([^=]+)=(.+)$") + set ("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") + endif () + endforeach () +endif () + +# build generator must be defined +if (NOT DEFINED BUILD_GENERATOR) + message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364") +endif () + +################################################################### +### Following Line is one of [Release, RelWithDebInfo, Debug] ##### ### (default use command line -C value) -set (CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}")
-###################################################################
-
-if (NOT DEFINED INSTALLDIR)
- if (WIN32)
- set (INSTALLDIR "C:/Program Files/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}")
- else ()
- set (INSTALLDIR "${CTEST_SCRIPT_DIRECTORY}/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}")
- endif ()
-endif ()
-if (NOT DEFINED CTEST_CONFIGURATION_TYPE)
- set (CTEST_CONFIGURATION_TYPE "Release")
-endif ()
-if (NOT DEFINED CTEST_SOURCE_NAME)
- set (CTEST_SOURCE_NAME "hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}")
-endif ()
-
-set (CTEST_BINARY_NAME "build")
-set (CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}")
-if (WIN32)
- set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}")
- set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}")
-else ()
- set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}")
- set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}")
-endif ()
-
-###################################################################
-######### Following describes compiler ############
-if (WIN32)
- set (SITE_OS_NAME "Windows")
- set (SITE_OS_VERSION "WIN7")
+set (CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") +################################################################### + +if (NOT DEFINED INSTALLDIR) + if (WIN32) + set (INSTALLDIR "C:/Program Files/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") + else () + set (INSTALLDIR "${CTEST_SCRIPT_DIRECTORY}/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") + endif () +endif () +if (NOT DEFINED CTEST_CONFIGURATION_TYPE) + set (CTEST_CONFIGURATION_TYPE "Release") +endif () +if (NOT DEFINED CTEST_SOURCE_NAME) + set (CTEST_SOURCE_NAME "hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") +endif () + +set (CTEST_BINARY_NAME "build") +set (CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}") +if (WIN32) + set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") + set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") +else () + set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") + set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") +endif () + +################################################################### +######### Following describes compiler ############ +if (WIN32) + set (SITE_OS_NAME "Windows") + set (SITE_OS_VERSION "WIN7") if (${BUILD_GENERATOR} STREQUAL "VS201764") set (CTEST_CMAKE_GENERATOR "Visual Studio 15 2017 Win64") set (SITE_OS_BITS "64") @@ -138,103 +138,103 @@ if (WIN32) else () message (FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364") endif () -## Set the following to unique id your computer ##
- set (CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX")
-else ()
- set (CTEST_CMAKE_GENERATOR "Unix Makefiles")
-## Set the following to unique id your computer ##
- if (APPLE)
- set (CTEST_SITE "MAC.XXXX")
- else ()
- set (CTEST_SITE "LINUX.XXXX")
- endif ()
- if (APPLE)
- execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE)
- execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE)
- set (ENV{CC} "${XCODE_CC}")
- set (ENV{CXX} "${XCODE_CXX}")
- set (CTEST_USE_LAUNCHERS 1)
- set (RR_WARNINGS_COMMON "-Wno-format-nonliteral -Wno-cast-align -Wno-unused -Wno-unused-variable -Wno-unused-function -Wno-self-assign -Wno-unused-parameter -Wno-sign-compare")
- set (RR_WARNINGS_C "${RR_WARNINGS_COMMON} -Wno-deprecated-declarations -Wno-uninitialized")
- set (RR_WARNINGS_CXX "${RR_WARNINGS_COMMON} -Woverloaded-virtual -Wshadow -Wwrite-strings -Wc++11-compat")
- set (RR_FLAGS_COMMON "-g -O0 -fstack-protector-all -D_FORTIFY_SOURCE=2")
- set (RR_FLAGS_C "${RR_FLAGS_COMMON}")
- set (RR_FLAGS_CXX "${RR_FLAGS_COMMON}")
- set (ENV{CFLAGS} "${RR_WARNINGS_C} ${RR_FLAGS_C}")
- set (ENV{CXXFLAGS} "${RR_WARNINGS_CXX} ${RR_FLAGS_CXX}")
- endif ()
-endif ()
-###################################################################
-
-###################################################################
-######### Following is for submission to CDash ############
-###################################################################
-set (MODEL "Experimental")
-###################################################################
-
-###################################################################
-##### Following controls CDash submission #####
-#set (LOCAL_SUBMIT "TRUE")
-##### Following controls test process #####
-#set (LOCAL_SKIP_TEST "TRUE")
-#set (LOCAL_MEMCHECK_TEST "TRUE")
-#set (LOCAL_COVERAGE_TEST "TRUE")
-##### Following controls cpack command #####
-#set (LOCAL_NO_PACKAGE "TRUE")
-##### Following controls source update #####
-#set (LOCAL_UPDATE "TRUE")
-set (REPOSITORY_URL "https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git")
-set (REPOSITORY_BRANCH "develop")
-
-#uncomment to use a compressed source file: *.tar on linux or mac *.zip on windows
-#set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}")
-###################################################################
-
-
-###################################################################
-
-if (WIN32)
- set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}")
- include (${CTEST_SCRIPT_DIRECTORY}\\HDF5options.cmake)
- include (${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake)
- if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe")
- file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi")
- file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip")
- file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
-else ()
- set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}")
- include (${CTEST_SCRIPT_DIRECTORY}/HDF5options.cmake)
- include (${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake)
- if (APPLE)
- if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg")
- file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz")
- file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh")
- file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- else ()
- if (CYGWIN)
- if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh")
- file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz")
- file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- else ()
- if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh")
- file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz")
- file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- endif ()
- endif ()
-endif ()
+## Set the following to unique id your computer ## + set (CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX") +else () + set (CTEST_CMAKE_GENERATOR "Unix Makefiles") +## Set the following to unique id your computer ## + if (APPLE) + set (CTEST_SITE "MAC.XXXX") + else () + set (CTEST_SITE "LINUX.XXXX") + endif () + if (APPLE) + execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) + set (ENV{CC} "${XCODE_CC}") + set (ENV{CXX} "${XCODE_CXX}") + set (CTEST_USE_LAUNCHERS 1) + set (RR_WARNINGS_COMMON "-Wno-format-nonliteral -Wno-cast-align -Wno-unused -Wno-unused-variable -Wno-unused-function -Wno-self-assign -Wno-unused-parameter -Wno-sign-compare") + set (RR_WARNINGS_C "${RR_WARNINGS_COMMON} -Wno-deprecated-declarations -Wno-uninitialized") + set (RR_WARNINGS_CXX "${RR_WARNINGS_COMMON} -Woverloaded-virtual -Wshadow -Wwrite-strings -Wc++11-compat") + set (RR_FLAGS_COMMON "-g -O0 -fstack-protector-all -D_FORTIFY_SOURCE=2") + set (RR_FLAGS_C "${RR_FLAGS_COMMON}") + set (RR_FLAGS_CXX "${RR_FLAGS_COMMON}") + set (ENV{CFLAGS} "${RR_WARNINGS_C} ${RR_FLAGS_C}") + set (ENV{CXXFLAGS} "${RR_WARNINGS_CXX} ${RR_FLAGS_CXX}") + endif () +endif () +################################################################### + +################################################################### +######### Following is for submission to CDash ############ +################################################################### +set (MODEL "Experimental") +################################################################### + +################################################################### +##### Following controls CDash submission ##### +#set (LOCAL_SUBMIT "TRUE") +##### Following controls test process ##### +#set (LOCAL_SKIP_TEST "TRUE") +#set (LOCAL_MEMCHECK_TEST "TRUE") +#set (LOCAL_COVERAGE_TEST "TRUE") +##### Following controls cpack command ##### +#set (LOCAL_NO_PACKAGE "TRUE") +##### Following controls source update ##### +#set (LOCAL_UPDATE "TRUE") +set (REPOSITORY_URL "https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git") +set (REPOSITORY_BRANCH "develop") + +#uncomment to use a compressed source file: *.tar on linux or mac *.zip on windows +#set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}") +################################################################### + + +################################################################### + +if (WIN32) + set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}") + include (${CTEST_SCRIPT_DIRECTORY}\\HDF5options.cmake) + include (${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake) + if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe") + file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi") + file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip") + file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () +else () + set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") + include (${CTEST_SCRIPT_DIRECTORY}/HDF5options.cmake) + include (${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) + if (APPLE) + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + else () + if (CYGWIN) + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + else () + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + endif () + endif () +endif () diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 82ab04a..6d1a57a 100755 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -17,8 +17,12 @@ ### uncomment/comment and change the following lines for other configuration options ############################################################################################# +#### maximum parallel processor count for build and test #### +#set (MAX_PROC_COUNT 8) + +############################################################################################# #### alternate toolsets #### -#set(CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 17.0") +#set (CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 17.0") ############################################################################################# #### Only build static libraries #### @@ -50,29 +54,54 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTA #### ext libraries #### ### ext libs from tgz -set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=${CTEST_SCRIPT_DIRECTORY}") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=${CTEST_SCRIPT_DIRECTORY}") ### ext libs from git -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=GIT") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=GIT") ### ext libs on system -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include") -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include") ### disable ext zlib building -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF") ### disable ext szip building -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") + +#### package examples #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.10.9-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") + +############################################################################################# +### enable parallel builds + +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") + +############################################################################################# +### enable thread-safety builds + +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=ON") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_HL_LIB:BOOL=OFF") ############################################################################################# ### disable test program builds -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") ############################################################################################# ### disable packaging -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_NO_PACKAGES:BOOL=ON") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_NO_PACKAGES:BOOL=ON") ### Create install package with external libraries (szip, zlib) -set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") + +############################################################################################# +### use a toolchain file + +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/intel.cmake") ############################################################################################# diff --git a/config/cmake/wait_H5Tinit.cmake b/config/cmake/wait_H5Tinit.cmake new file mode 100644 index 0000000..c0b4d06 --- /dev/null +++ b/config/cmake/wait_H5Tinit.cmake @@ -0,0 +1,11 @@ +cmake_minimum_required (VERSION 3.10) + +message(STATUS "Check for existence of ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") +execute_process(COMMAND ls ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c RESULT_VARIABLE H5TI_result OUTPUT_QUIET ERROR_QUIET) +while(H5TI_result) + ctest_sleep(30) + message(STATUS "Checking again for existence of ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") + execute_process(COMMAND ls ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c RESULT_VARIABLE H5TI_result OUTPUT_QUIET ERROR_QUIET) +endwhile(H5TI_result) +file (TOUCH "${HDF5_BINARY_DIR}/H5Tinit_created") +message(STATUS "Found ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 9be30f7..40f1440 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -142,10 +142,6 @@ endif () macro (HDF_FUNCTION_TEST OTHER_TEST) if (NOT DEFINED ${HDF_PREFIX}_${OTHER_TEST}) set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") - set (OTHER_TEST_ADD_LIBRARIES) - if (CMAKE_REQUIRED_LIBRARIES) - set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - endif () foreach (def HAVE_SYS_TIME_H @@ -168,8 +164,8 @@ macro (HDF_FUNCTION_TEST OTHER_TEST) TRY_COMPILE (${OTHER_TEST} ${CMAKE_BINARY_DIR} ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${OTHER_TEST_ADD_LIBRARIES}" + COMPILE_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS}" + LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}" OUTPUT_VARIABLE OUTPUT ) if (${OTHER_TEST}) @@ -277,13 +273,12 @@ if (NOT WINDOWS) set (HDF_EXTRA_C_FLAGS -D_GNU_SOURCE) option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON) - if (HDF_ENABLE_LARGE_FILE) + if (HDF_ENABLE_LARGE_FILE AND NOT DEFINED TEST_LFS_WORKS_RUN) set (msg "Performing TEST_LFS_WORKS") TRY_RUN (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE ${CMAKE_BINARY_DIR} ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DTEST_LFS_WORKS - OUTPUT_VARIABLE OUTPUT + COMPILE_DEFINITIONS "-DTEST_LFS_WORKS" ) # The LARGEFILE definitions were from the transition period @@ -300,14 +295,14 @@ if (NOT WINDOWS) set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Test TEST_LFS_WORKS Run failed with the following output and exit code:\n ${OUTPUT}\n" + "Test TEST_LFS_WORKS Run failed with the following exit code:\n ${TEST_LFS_WORKS_RUN}\n" ) endif () else () set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Test TEST_LFS_WORKS Compile failed with the following output:\n ${OUTPUT}\n" + "Test TEST_LFS_WORKS Compile failed\n" ) endif () endif () @@ -568,36 +563,27 @@ endif () if (WINDOWS) if (NOT HDF_NO_IOEO_TEST) message (STATUS "Checking for InitOnceExecuteOnce:") - if (NOT DEFINED ${${HDF_PREFIX}_HAVE_IOEO}) + if (NOT DEFINED ${HDF_PREFIX}_HAVE_IOEO) if (LARGEFILE) set (CMAKE_REQUIRED_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" ) endif () - set (MACRO_CHECK_FUNCTION_DEFINITIONS - "-DHAVE_IOEO ${CMAKE_REQUIRED_FLAGS}") - if (CMAKE_REQUIRED_LIBRARIES) - set (CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else () - set (CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) - endif () + set (MACRO_CHECK_FUNCTION_DEFINITIONS "-DHAVE_IOEO ${CMAKE_REQUIRED_FLAGS}") if (CMAKE_REQUIRED_INCLUDES) - set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES - "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") else () set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) endif () TRY_RUN(HAVE_IOEO_EXITCODE HAVE_IOEO_COMPILED - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} - "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" - "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" - COMPILE_OUTPUT_VARIABLE OUTPUT) + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_EXT_DIR}/HDFTests.c + COMPILE_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${MACRO_CHECK_FUNCTION_DEFINITIONS}" + LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}" + CMAKE_FLAGS "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES} -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}" + COMPILE_OUTPUT_VARIABLE OUTPUT + ) # if it did not compile make the return value fail code of 1 if (NOT HAVE_IOEO_COMPILED) set (HAVE_IOEO_EXITCODE 1) @@ -648,8 +634,8 @@ if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES " TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE ${CMAKE_BINARY_DIR} ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS} - OUTPUT_VARIABLE OUTPUT + COMPILE_DEFINITIONS "${CURRENT_TEST_DEFINITIONS}" + RUN_OUTPUT_VARIABLE OUTPUT ) if (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) if (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) @@ -661,7 +647,7 @@ if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES " endif () else () file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed with the following output:\n ${OUTPUT}\n" + "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed\n" ) endif () diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake index 54e408b..2eda66c 100644 --- a/config/cmake_ext_mod/HDFLibMacros.cmake +++ b/config/cmake_ext_mod/HDFLibMacros.cmake @@ -30,6 +30,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (JPEG @@ -47,6 +48,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (JPEG @@ -64,6 +66,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) endif () externalproject_get_property (JPEG BINARY_DIR SOURCE_DIR) @@ -72,14 +75,14 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) # Create imported target jpeg-static add_library(jpeg-static STATIC IMPORTED) HDF_IMPORT_SET_LIB_OPTIONS (jpeg-static "jpeg" STATIC "") - add_dependencies (JPEG jpeg-static) + add_dependencies (jpeg-static JPEG) set (JPEG_STATIC_LIBRARY "jpeg-static") set (JPEG_LIBRARIES ${JPEG_STATIC_LIBRARY}) if (BUILD_SHARED_LIBS) # Create imported target jpeg-shared add_library(jpeg-shared SHARED IMPORTED) HDF_IMPORT_SET_LIB_OPTIONS (jpeg-shared "jpeg" SHARED "") - add_dependencies (JPEG jpeg-shared) + add_dependencies (jpeg-shared JPEG) set (JPEG_SHARED_LIBRARY "jpeg-shared") set (JPEG_LIBRARIES ${JPEG_LIBRARIES} ${JPEG_SHARED_LIBRARY}) endif () @@ -121,6 +124,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (SZIP @@ -139,6 +143,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (SZIP @@ -157,6 +162,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) endif () externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR) @@ -165,14 +171,14 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) # Create imported target szip-static add_library(szip-static STATIC IMPORTED) HDF_IMPORT_SET_LIB_OPTIONS (szip-static "szip" STATIC "") - add_dependencies (SZIP szip-static) + add_dependencies (szip-static SZIP) set (SZIP_STATIC_LIBRARY "szip-static") set (SZIP_LIBRARIES ${SZIP_STATIC_LIBRARY}) if (BUILD_SHARED_LIBS) # Create imported target szip-shared add_library(szip-shared SHARED IMPORTED) HDF_IMPORT_SET_LIB_OPTIONS (szip-shared "szip" SHARED "") - add_dependencies (SZIP szip-shared) + add_dependencies (szip-shared SZIP) set (SZIP_SHARED_LIBRARY "szip-shared") set (SZIP_LIBRARIES ${SZIP_LIBRARIES} ${SZIP_SHARED_LIBRARY}) endif () @@ -213,6 +219,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (ZLIB @@ -230,6 +237,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (ZLIB @@ -247,6 +255,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) endif () externalproject_get_property (ZLIB BINARY_DIR SOURCE_DIR) @@ -260,14 +269,14 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) # Create imported target zlib-static add_library(zlib-static STATIC IMPORTED) HDF_IMPORT_SET_LIB_OPTIONS (zlib-static ${ZLIB_LIB_NAME} STATIC "") - add_dependencies (ZLIB zlib-static) + add_dependencies (zlib-static ZLIB) set (ZLIB_STATIC_LIBRARY "zlib-static") set (ZLIB_LIBRARIES ${ZLIB_STATIC_LIBRARY}) if (BUILD_SHARED_LIBS) # Create imported target zlib-shared add_library(zlib-shared SHARED IMPORTED) HDF_IMPORT_SET_LIB_OPTIONS (zlib-shared ${ZLIB_LIB_NAME} SHARED "") - add_dependencies (ZLIB zlib-shared) + add_dependencies (zlib-shared ZLIB) set (ZLIB_SHARED_LIBRARY "zlib-shared") set (ZLIB_LIBRARIES ${ZLIB_LIBRARIES} ${ZLIB_SHARED_LIBRARY}) endif () diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 791fe2e..147ae2f 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -280,7 +280,7 @@ macro (HDF_README_PROPERTIES target_fortran) endif () elseif (APPLE) set (BINARY_EXAMPLE_ENDING "tar.gz") - set (BINARY_INSTALL_ENDING "dmg") + set (BINARY_INSTALL_ENDING "sh") # if packaging changes - use dmg set (BINARY_PLATFORM "${BINARY_PLATFORM} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using ${CMAKE_C_COMPILER_ID} C ${CMAKE_C_COMPILER_VERSION}") else () @@ -358,6 +358,21 @@ macro (HDF_DIR_PATHS package_prefix) endif () endif () + set (CMAKE_SKIP_BUILD_RPATH FALSE) + set (CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) + set (CMAKE_BUILD_WITH_INSTALL_RPATH ON) + if (APPLE) + set (CMAKE_INSTALL_NAME_DIR "@rpath") + set (CMAKE_INSTALL_RPATH + "@executable_path/../${${package_prefix}_INSTALL_LIB_DIR}" + "@executable_path/" + "@loader_path/../${${package_prefix}_INSTALL_LIB_DIR}" + "@loader_path/" + ) + else () + set (CMAKE_INSTALL_RPATH "\$ORIGIN/../${${package_prefix}_INSTALL_LIB_DIR}:\$ORIGIN/") + endif () + if (DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}") set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH}) endif () @@ -380,13 +395,14 @@ macro (HDF_DIR_PATHS package_prefix) set (CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all fortran modules." ) - if (WIN32) - set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE}) + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(_isMultiConfig) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}) set (CMAKE_PDB_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all pdb files." ) else () - set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE}) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) endif () else () # if we are externally configured, but the project uses old cmake scripts diff --git a/config/commence.am b/config/commence.am index 5fe21a6..5d88a88 100644 --- a/config/commence.am +++ b/config/commence.am @@ -97,7 +97,8 @@ CHECK_CLEANFILES=*.chkexe *.chklog *.clog *.clog2 # exists. .PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \ build-tests check-clean check-install check-p check-s check-vfd \ - install-doc lib progs tests uninstall-doc _exec_check-s _test help + check-vol install-doc lib progs tests uninstall-doc _exec_check-s \ + _test help help: @$(top_srcdir)/bin/makehelp diff --git a/config/conclude.am b/config/conclude.am index 4bdbb0b..4655565 100644 --- a/config/conclude.am +++ b/config/conclude.am @@ -266,3 +266,15 @@ check-vfd: $(LIB) $(PROGS) $(chk_TESTS) HDF5_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \ fi; \ done + +# Run test with different Virtual Object Layer Connector +check-vol: $(LIB) $(PROGS) $(chk_TESTS) + @for vol in $(VOL_LIST) dummy; do \ + if test "$$vol" != dummy; then \ + echo "============================"; \ + echo "Testing VOL Connector: \"$$vol\""; \ + echo "============================"; \ + $(MAKE) $(AM_MAKEFLAGS) check-clean || exit 1; \ + HDF5_VOL_CONNECTOR="$$vol" $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \ + fi; \ + done diff --git a/config/toolchain/GCC.cmake b/config/toolchain/GCC.cmake new file mode 100644 index 0000000..ddb1641 --- /dev/null +++ b/config/toolchain/GCC.cmake @@ -0,0 +1,10 @@ +# Uncomment the following to use cross-compiling +#set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_COMPILER_VENDOR "GCC") + +set(CMAKE_C_COMPILER cc) +set(CMAKE_CXX_COMPILER c++) +set(CMAKE_Fortran_COMPILER gfortran) + +# the following is used if cross-compiling +set(CMAKE_CROSSCOMPILING_EMULATOR "") diff --git a/config/toolchain/crayle.cmake b/config/toolchain/crayle.cmake new file mode 100644 index 0000000..a83147b --- /dev/null +++ b/config/toolchain/crayle.cmake @@ -0,0 +1,20 @@ +# Uncomment the following to use cross-compiling +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_COMPILER_VENDOR "CrayLinuxEnvironment") + +set(CMAKE_C_COMPILER cc) +set(CMAKE_Fortran_COMPILER ftn) + +# the following is used if cross-compiling +set(CMAKE_CROSSCOMPILING_EMULATOR "") + +# option to use pre-generated H5Tinit.c file +set(HDF5_USE_PREGEN OFF) +# directory where H5Tinit.c file will be found +#set(HDF5_USE_PREGEN_DIR "/lscratch1/lknox/HDF5_1_10_4/CMake-hdf5-1.10.4") + +# option to generate H5Tinit.c by running H5detect on knl compute node during build +set(HDF5_BATCH_H5DETECT ON) +set(HDF5_BATCH_CMD "sbatch") +set(HDF5_BATCH_H5DETECT_SCRIPT "knl_H5detect.sl") +set(MPIEXEC_EXECUTABLE "srun") diff --git a/config/toolchain/intel.cmake b/config/toolchain/intel.cmake new file mode 100644 index 0000000..f1a5734 --- /dev/null +++ b/config/toolchain/intel.cmake @@ -0,0 +1,10 @@ +# Uncomment the following to use cross-compiling +#set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_COMPILER_VENDOR "intel") + +set(CMAKE_C_COMPILER icc) +set(CMAKE_CXX_COMPILER icpc) +set(CMAKE_Fortran_COMPILER ifort) + +# the following is used if cross-compiling +set(CMAKE_CROSSCOMPILING_EMULATOR "") diff --git a/configure.ac b/configure.ac index ff0f284..0a1370f 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.11.2], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.11.4], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADERS([src/H5config.h]) @@ -1261,8 +1261,8 @@ AC_ARG_WITH([dmalloc], [Use dmalloc memory debugging aid [default=no]])],, [withval=no]) -case $withval in - yes) +case "X-$withval" in + X-yes) HAVE_DMALLOC="yes" AC_CHECK_HEADERS([dmalloc.h],, [unset HAVE_DMALLOC]) if test "x$HAVE_DMALLOC" = "xyes"; then @@ -1272,7 +1272,7 @@ case $withval in AC_MSG_ERROR([couldn't find dmalloc library]) fi ;; - no) + X-|X-no|X-none) HAVE_DMALLOC="no" AC_MSG_CHECKING([for dmalloc library]) AC_MSG_RESULT([suppressed]) @@ -1340,8 +1340,8 @@ AC_ARG_WITH([zlib], filter [default=yes]])],, [withval=yes]) -case $withval in - yes) +case "X-$withval" in + X-yes) HAVE_ZLIB="yes" AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"], [unset HAVE_ZLIB]) if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then @@ -1355,7 +1355,7 @@ case $withval in AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"]) fi ;; - no) + X-|X-no|X-none) HAVE_ZLIB="no" AC_MSG_CHECKING([for zlib]) AC_MSG_RESULT([suppressed]) @@ -1434,8 +1434,8 @@ AC_ARG_WITH([szlib], filter [default=no]])],, [withval=no]) -case $withval in - yes) +case "X-$withval" in + X-yes) HAVE_SZLIB="yes" AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], [unset HAVE_SZLIB]) if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then @@ -1445,7 +1445,7 @@ case $withval in AC_MSG_ERROR([couldn't find szlib library]) fi ;; - no) + X-|X-no|X-none) HAVE_SZLIB="no" AC_MSG_CHECKING([for szlib]) AC_MSG_RESULT([suppressed]) @@ -3191,10 +3191,10 @@ esac AC_SUBST([DEFAULT_API_VERSION]) AC_MSG_CHECKING([which version of public symbols to use by default]) AC_ARG_WITH([default-api-version], - [AS_HELP_STRING([--with-default-api-version=(v16|v18|v110)], + [AS_HELP_STRING([--with-default-api-version=(v16|v18|v110|v112)], [Specify default release version of public symbols - [default=v110]])],, - [withval=v110]) + [default=v112]])],, + [withval=v112]) if test "X$withval" = "Xv16"; then AC_MSG_RESULT([v16]) @@ -3209,6 +3209,13 @@ elif test "X$withval" = "Xv18"; then elif test "X$withval" = "Xv110"; then AC_MSG_RESULT([v110]) DEFAULT_API_VERSION=v110 + AC_DEFINE([USE_110_API_DEFAULT], [1], + [Define using v1.10 public API symbols by default]) +elif test "X$withval" = "Xv112"; then + AC_MSG_RESULT([v112]) + DEFAULT_API_VERSION=v112 + AC_DEFINE([USE_112_API_DEFAULT], [1], + [Define using v1.12 public API symbols by default]) else AC_MSG_ERROR([invalid version of public symbols given]) fi @@ -3218,7 +3225,7 @@ fi ## if the user insists on doing this via the --enable-unsupported configure ## flag, we'll let them. if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then - if test "X${DEFAULT_API_VERSION}" != "Xv110" -a "X${DEPRECATED_SYMBOLS}" = "Xno" ; then + if test "X${DEFAULT_API_VERSION}" != "Xv112" -a "X${DEPRECATED_SYMBOLS}" = "Xno" ; then AC_MSG_ERROR([Removing old public API symbols not allowed when using them as default public API symbols. Use --enable-unsupported to override this error.]) fi fi diff --git a/examples/Makefile.am b/examples/Makefile.am index 8c6540f..554ee44 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -32,25 +32,25 @@ INSTALL_TOP_FILES = README # it would try to compile them instead of using the h5cc script. # Use the boilerplate in config/examples.am instead. EXAMPLE_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \ - h5_crtgrpd h5_subset h5_cmprss h5_rdwt h5_crtgrpar h5_extend \ - h5_crtatt h5_crtgrp h5_crtdat \ - h5_group h5_select h5_attribute h5_mount h5_reference h5_drivers \ - h5_ref2reg h5_extlink h5_elink_unix2win h5_shared_mesg h5_vds h5_vds-exc \ - h5_vds-exclim h5_vds-eiger h5_vds-simpleIO h5_vds-percival \ - h5_vds-percival-unlim h5_vds-percival-unlim-maxmin + h5_crtgrpd h5_subset h5_cmprss h5_rdwt h5_crtgrpar h5_extend \ + h5_crtatt h5_crtgrp h5_crtdat \ + h5_group h5_select h5_attribute h5_mount h5_reference h5_drivers \ + h5_ref2reg h5_extlink h5_elink_unix2win h5_shared_mesg h5_vds h5_vds-exc \ + h5_vds-exclim h5_vds-eiger h5_vds-simpleIO h5_vds-percival \ + h5_vds-percival-unlim h5_vds-percival-unlim-maxmin TEST_SCRIPT=testh5cc.sh TEST_EXAMPLES_SCRIPT=$(INSTALL_SCRIPT_FILES) # Install files # List all file that should be installed in examples directory INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c \ - h5_crtgrpd.c h5_subset.c h5_cmprss.c h5_rdwt.c h5_crtgrpar.c \ - h5_extend.c h5_crtatt.c h5_crtgrp.c h5_crtdat.c \ - h5_compound.c h5_group.c h5_select.c h5_attribute.c h5_mount.c \ - h5_reference.c h5_drivers.c h5_extlink.c h5_elink_unix2win.c \ - h5_ref2reg.c h5_shared_mesg.c ph5example.c h5_vds.c h5_vds-exc.c \ - h5_vds-exclim.c h5_vds-eiger.c h5_vds-simpleIO.c h5_vds-percival.c \ - h5_vds-percival-unlim.c h5_vds-percival-unlim-maxmin.c + h5_crtgrpd.c h5_subset.c h5_cmprss.c h5_rdwt.c h5_crtgrpar.c \ + h5_extend.c h5_crtatt.c h5_crtgrp.c h5_crtdat.c \ + h5_compound.c h5_group.c h5_select.c h5_attribute.c h5_mount.c \ + h5_reference.c h5_drivers.c h5_extlink.c h5_elink_unix2win.c \ + h5_ref2reg.c h5_shared_mesg.c ph5example.c h5_vds.c h5_vds-exc.c \ + h5_vds-exclim.c h5_vds-eiger.c h5_vds-simpleIO.c h5_vds-percival.c \ + h5_vds-percival-unlim.c h5_vds-percival-unlim-maxmin.c diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c index 1a07656..229e465 100644 --- a/examples/h5_extlink.c +++ b/examples/h5_extlink.c @@ -208,7 +208,7 @@ static void extlink_prefix_example(void) * that a path was supplied in the udata. */ static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group, - const void *udata, size_t udata_size, hid_t lapl_id); + const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id); static void soft_link_example(void) { @@ -277,7 +277,7 @@ static void soft_link_example(void) */ static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group, - const void *udata, size_t udata_size, hid_t lapl_id) + const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id) { const char *target = (const char *) udata; hid_t ret_value; diff --git a/examples/run-c-ex.sh.in b/examples/run-c-ex.sh.in index 4d5d594..209cdd7 100644 --- a/examples/run-c-ex.sh.in +++ b/examples/run-c-ex.sh.in @@ -31,7 +31,7 @@ EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-@prefix@}" +prefix="${prefix:-../../..}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/fortran/examples/run-fortran-ex.sh.in b/fortran/examples/run-fortran-ex.sh.in index cace1ae..da0c357 100644 --- a/fortran/examples/run-fortran-ex.sh.in +++ b/fortran/examples/run-fortran-ex.sh.in @@ -32,7 +32,7 @@ EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-@prefix@}" +prefix="${prefix:-../../..}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/fortran/src/H5Aff.F90 b/fortran/src/H5Aff.F90 index 827b803..a728f2d 100644 --- a/fortran/src/H5Aff.F90 +++ b/fortran/src/H5Aff.F90 @@ -76,6 +76,9 @@ MODULE H5A USE H5GLOBAL + PRIVATE h5awrite_char_scalar, h5awrite_ptr + PRIVATE h5aread_char_scalar, h5aread_ptr + INTERFACE h5awrite_f MODULE PROCEDURE h5awrite_char_scalar ! This is the preferred way to call h5awrite diff --git a/fortran/src/H5Dff.F90 b/fortran/src/H5Dff.F90 index 3915f72..77f0a15 100644 --- a/fortran/src/H5Dff.F90 +++ b/fortran/src/H5Dff.F90 @@ -90,6 +90,15 @@ MODULE H5D USE, INTRINSIC :: ISO_C_BINDING USE H5GLOBAL + PRIVATE h5dread_vl_integer, h5dread_vl_real, h5dread_vl_string + PRIVATE h5dwrite_vl_integer, h5dwrite_vl_real, h5dwrite_vl_string + PRIVATE h5dwrite_reference_obj, h5dwrite_reference_dsetreg, h5dwrite_char_scalar, h5dwrite_ptr + PRIVATE h5dread_reference_obj, h5dread_reference_dsetreg, h5dread_char_scalar, h5dread_ptr + PRIVATE h5dfill_integer, h5dfill_c_float, h5dfill_c_double, h5dfill_char +#if H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE!=0 + PRIVATE h5dfill_c_long_double +#endif + INTERFACE h5dextend_f MODULE PROCEDURE h5dset_extent_f END INTERFACE diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c index 2d5f6ed..a4e786e 100644 --- a/fortran/src/H5Ff.c +++ b/fortran/src/H5Ff.c @@ -402,52 +402,6 @@ h5fget_access_plist_c (hid_t_f *file_id, hid_t_f *access_id) return ret_value; } -/****if* H5Ff/h5fis_hdf5_c - * NAME - * h5fis_hdf5_c - * PURPOSE - * Call H5Fis_hdf5 to determone if the file is an HDF5 file - * INPUTS - * name - name of the file - * namelen - name length - * OUTPUTS - * flag - 0 if file is not HDF5 file , positive if a file - * is an HDF5 file, and negative on failure. - * RETURNS - * 0 on success, -1 on failure - * AUTHOR - * Elena Pourmal - * Tuesday, August 3, 1999 - * HISTORY - * - * SOURCE -*/ -int_f -h5fis_hdf5_c (_fcd name, int_f *namelen, int_f *flag) -/******/ -{ - int ret_value = -1; - char *c_name; - int_f c_namelen; - htri_t status; - - /* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, (size_t)c_namelen); - if (c_name == NULL) return ret_value; - - /* - * Call H5Fopen function. - */ - status = H5Fis_hdf5(c_name); - *flag = (int_f)status; - if (status >= 0) ret_value = 0; - - HDfree(c_name); - return ret_value; -} /****if* H5Ff/h5fclose_c * NAME * h5fclose_c diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90 index 358e421..9c8b941 100644 --- a/fortran/src/H5Fff.F90 +++ b/fortran/src/H5Fff.F90 @@ -45,6 +45,18 @@ MODULE H5F ! Number of objects opened in H5open_f INTEGER(SIZE_T) :: H5OPEN_NUM_OBJ + INTERFACE + INTEGER(C_INT) FUNCTION h5fis_accessible(name, & + access_prp_default) BIND(C,NAME='H5Fis_accessible') + IMPORT :: C_CHAR + IMPORT :: HID_T + IMPORT :: C_INT + IMPLICIT NONE + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name + INTEGER(HID_T), INTENT(IN), VALUE :: access_prp_default + END FUNCTION h5fis_accessible + END INTERFACE + CONTAINS !****s* H5F/h5fcreate_f ! @@ -486,6 +498,63 @@ CONTAINS END SUBROUTINE h5fget_access_plist_f +!****s* H5F/h5fis_accessible_f +! +! NAME +! h5fis_accessible_f +! +! PURPOSE +! Determines whether a file can be accessed as HDF5. +! +! INPUTS +! name - name of the file to check +! OUTPUTS +! status - indicates if file is and HDF5 file +! hdferr - Returns 0 if successful and -1 if fails +! OPTIONAL PARAMETERS +! access_prp - file access property list identifier +! AUTHOR +! Dana Robinson +! September 2018 +! +! HISTORY +! Explicit Fortran interfaces were added for +! called C functions (it is needed for Windows +! port). February 28, 2001 +! +! SOURCE + SUBROUTINE h5fis_accessible_f(name, status, hdferr, access_prp) + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the file + LOGICAL, INTENT(OUT) :: status ! Indicates if file + ! is an HDF5 file + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: access_prp + ! File access property list + ! identifier +!***** + INTEGER(HID_T) :: access_prp_default + CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name + INTEGER(C_INT) :: flag ! "TRUE/FALSE/ERROR" flag from C routine + + access_prp_default = H5P_DEFAULT_F + IF (PRESENT(access_prp)) access_prp_default = access_prp + + c_name = TRIM(name)//C_NULL_CHAR + + flag = H5Fis_accessible(c_name, access_prp_default) + + hdferr = 0 + IF(flag.LT.0) hdferr = -1 + + status = .TRUE. + IF (flag .EQ. 0) status = .FALSE. + + END SUBROUTINE h5fis_accessible_f + +! XXX (VOL_MERGE): This function should probably be marked as +! deprecated since H5Fis_hdf5() is deprecated. + !****s* H5F/h5fis_hdf5_f ! ! NAME @@ -503,6 +572,12 @@ CONTAINS ! Elena Pourmal ! August 12, 1999 ! +! NOTES +! The underlying HDF5 C API call (H5Fis_hdf5) has been deprecated +! in favor of the VOL-capable H5Fis_accessible(). New code should +! use h5fis_accessible_f() instead of this function in case this +! function is deprecated in the future. +! ! HISTORY ! Explicit Fortran interfaces were added for ! called C functions (it is needed for Windows @@ -516,26 +591,23 @@ CONTAINS ! is an HDF5 file INTEGER, INTENT(OUT) :: hdferr ! Error code !***** - INTEGER :: namelen ! Length of the name character string - INTEGER :: flag ! "TRUE/FALSE" flag from C routine - ! to define status value. + INTEGER(HID_T) :: access_prp_default + CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name + INTEGER(C_INT) :: flag ! "TRUE/FALSE/ERROR" flag from C routine + ! to define status value. - INTERFACE - INTEGER FUNCTION h5fis_hdf5_c(name, namelen, flag) BIND(C,NAME='h5fis_hdf5_c') - IMPORT :: C_CHAR - IMPLICIT NONE - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name - INTEGER :: namelen - INTEGER :: flag - END FUNCTION h5fis_hdf5_c - END INTERFACE + c_name = TRIM(name)//C_NULL_CHAR + + flag = H5Fis_accessible(c_name, H5P_DEFAULT_F) + + hdferr = 0 + IF(flag.LT.0) hdferr = -1 - namelen = LEN_TRIM(name) - hdferr = h5fis_hdf5_c(name, namelen, flag) status = .TRUE. IF (flag .EQ. 0) status = .FALSE. END SUBROUTINE h5fis_hdf5_f + !****s* H5F/h5fclose_f ! ! NAME diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index afb9136..455c72e 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -42,6 +42,14 @@ MODULE H5P USE H5GLOBAL USE H5fortkit + PRIVATE h5pset_fapl_multi_l, h5pset_fapl_multi_s + PRIVATE h5pset_fill_value_integer, h5pset_fill_value_char, h5pset_fill_value_ptr + PRIVATE h5pget_fill_value_integer, h5pget_fill_value_char, h5pget_fill_value_ptr + PRIVATE h5pset_integer, h5pset_char, h5pset_ptr + PRIVATE h5pget_integer, h5pget_char, h5pget_ptr + PRIVATE h5pregister_integer, h5pregister_ptr + PRIVATE h5pinsert_integer, h5pinsert_char, h5pinsert_ptr + INTERFACE h5pset_fapl_multi_f MODULE PROCEDURE h5pset_fapl_multi_l MODULE PROCEDURE h5pset_fapl_multi_s diff --git a/fortran/src/H5Rff.F90 b/fortran/src/H5Rff.F90 index f5a9c6e..6c2ba28 100644 --- a/fortran/src/H5Rff.F90 +++ b/fortran/src/H5Rff.F90 @@ -56,6 +56,12 @@ MODULE H5R ! END TYPE ! + PRIVATE h5rget_object_type_obj_f + PRIVATE h5rget_region_region_f, h5rget_region_ptr_f + PRIVATE h5rcreate_object_f, h5rcreate_region_f, h5rcreate_ptr_f + PRIVATE h5rdereference_object_f, h5rdereference_region_f, h5rdereference_ptr_f + PRIVATE h5rget_name_object_f, h5rget_name_region_f, h5rget_name_ptr_f + INTERFACE h5rget_object_type_f MODULE PROCEDURE h5rget_object_type_obj_f diff --git a/fortran/src/H5Tff.F90 b/fortran/src/H5Tff.F90 index b63c61d..46c8f39 100644 --- a/fortran/src/H5Tff.F90 +++ b/fortran/src/H5Tff.F90 @@ -41,6 +41,8 @@ MODULE H5T USE H5GLOBAL IMPLICIT NONE + PRIVATE h5tenum_insert_f03, h5tenum_insert_f90 + !****t* H5T/hvl_t ! Fortran2003 Derived Type: TYPE hvl_t diff --git a/fortran/src/H5_buildiface.F90 b/fortran/src/H5_buildiface.F90 index d4ebdd3..f793b7f 100644 --- a/fortran/src/H5_buildiface.F90 +++ b/fortran/src/H5_buildiface.F90 @@ -135,162 +135,268 @@ PROGRAM H5_buildiface WRITE(11,'(A)') "MODULE H5_GEN" - WRITE(11,'(A)') ' USE, INTRINSIC :: ISO_C_BINDING' - WRITE(11,'(A)') ' USE H5GLOBAL' + WRITE(11,'(2X,A)') 'USE, INTRINSIC :: ISO_C_BINDING' + WRITE(11,'(2X,A)') 'USE H5GLOBAL' + + WRITE(11,'(2X,A)') 'USE H5A' + WRITE(11,'(2X,A)') 'USE H5D' + WRITE(11,'(2X,A)') 'USE H5P' + WRITE(11,'(2X,A)') 'IMPLICIT NONE' + +!****************************** +! DECLARE PRIVATE INTERFACES +!****************************** + + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5awrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO i = 1, num_ikinds + j = ikind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5awrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO k = 2, 8 + WRITE(11,'(2X,A)') "PRIVATE h5awrite_ckind_rank"//chr_rank(k) + ENDDO + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5aread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO i = 1, num_ikinds + j = ikind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5aread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO k = 2, 8 + WRITE(11,'(2X,A)') "PRIVATE h5aread_ckind_rank"//chr_rank(k) + ENDDO + + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5dwrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO i = 1, num_ikinds + j = ikind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5dwrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO k = 2, 8 + WRITE(11,'(2X,A)') "PRIVATE h5dwrite_ckind_rank"//chr_rank(k) + END DO + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5dread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO i = 1, num_ikinds + j = ikind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5dread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO k = 2, 8 + WRITE(11,'(2X,A)') "PRIVATE h5dread_ckind_rank"//chr_rank(k) + ENDDO + + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + WRITE(11,'(2X,A)') "PRIVATE h5pset_fill_value_kind_"//TRIM(ADJUSTL(chr2)) + END DO + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + WRITE(11,'(2X,A)') "PRIVATE h5pget_fill_value_kind_"//TRIM(ADJUSTL(chr2)) + END DO + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + WRITE(11,'(2X,A)') "PRIVATE h5pset_kind_"//TRIM(ADJUSTL(chr2)) + END DO + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + WRITE(11,'(2X,A)') "PRIVATE h5pget_kind_"//TRIM(ADJUSTL(chr2)) + END DO + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + WRITE(11,'(2X,A)') "PRIVATE h5pregister_kind_"//TRIM(ADJUSTL(chr2)) + END DO + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + WRITE(11,'(2X,A)') "PRIVATE h5pinsert_kind_"//TRIM(ADJUSTL(chr2)) + END DO - WRITE(11,'(A)') ' USE H5A' - WRITE(11,'(A)') ' USE H5D' - WRITE(11,'(A)') ' USE H5P' - WRITE(11,'(A)') ' IMPLICIT NONE' !*************** ! H5A INTERFACES !*************** ! ! H5Awrite_f ! - WRITE(11,'(A)') " INTERFACE h5awrite_f" + WRITE(11,'(2X,A)') "INTERFACE h5awrite_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5awrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5awrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO i = 1, num_ikinds j = ikind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5awrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5awrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO k = 2, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5awrite_ckind_rank"//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5awrite_ckind_rank"//chr_rank(k) ENDDO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" ! H5Aread_f - WRITE(11,'(A)') " INTERFACE h5aread_f" + WRITE(11,'(2X,A)') "INTERFACE h5aread_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5aread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5aread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO i = 1, num_ikinds j = ikind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5aread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5aread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO k = 2, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5aread_ckind_rank"//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5aread_ckind_rank"//chr_rank(k) ENDDO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" !*************** ! H5D INTERFACES !*************** ! ! H5Dwrite_f - WRITE(11,'(A)') " INTERFACE h5dwrite_f" + WRITE(11,'(2X,A)') "INTERFACE h5dwrite_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5dwrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dwrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO i = 1, num_ikinds j = ikind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5dwrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dwrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO k = 2, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5dwrite_ckind_rank"//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dwrite_ckind_rank"//chr_rank(k) END DO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" ! H5Dread_f - WRITE(11,'(A)') " INTERFACE h5dread_f" + WRITE(11,'(2X,A)') "INTERFACE h5dread_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5dread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO i = 1, num_ikinds j = ikind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5dread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO k = 2, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5dread_ckind_rank"//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dread_ckind_rank"//chr_rank(k) ENDDO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" !*************** ! H5P INTERFACES !*************** ! ! H5Pset_fill_value_f - WRITE(11,'(A)') " INTERFACE h5pset_fill_value_f" + WRITE(11,'(2X,A)') "INTERFACE h5pset_fill_value_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j - WRITE(11,'(A)') " MODULE PROCEDURE h5pset_fill_value_kind_"//TRIM(ADJUSTL(chr2)) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pset_fill_value_kind_"//TRIM(ADJUSTL(chr2)) END DO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" ! H5Pget_fill_value_f - WRITE(11,'(A)') " INTERFACE h5pget_fill_value_f" + WRITE(11,'(2X,A)') "INTERFACE h5pget_fill_value_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j - WRITE(11,'(A)') " MODULE PROCEDURE h5pget_fill_value_kind_"//TRIM(ADJUSTL(chr2)) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pget_fill_value_kind_"//TRIM(ADJUSTL(chr2)) END DO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" ! H5Pset_f - WRITE(11,'(A)') " INTERFACE h5pset_f" + WRITE(11,'(2X,A)') "INTERFACE h5pset_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j - WRITE(11,'(A)') " MODULE PROCEDURE h5pset_kind_"//TRIM(ADJUSTL(chr2)) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pset_kind_"//TRIM(ADJUSTL(chr2)) END DO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" ! H5Pget_f - WRITE(11,'(A)') " INTERFACE h5pget_f" + WRITE(11,'(2X,A)') "INTERFACE h5pget_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j - WRITE(11,'(A)') " MODULE PROCEDURE h5pget_kind_"//TRIM(ADJUSTL(chr2)) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pget_kind_"//TRIM(ADJUSTL(chr2)) END DO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" ! H5Pregister_f - WRITE(11,'(A)') " INTERFACE h5pregister_f" + WRITE(11,'(2X,A)') "INTERFACE h5pregister_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j - WRITE(11,'(A)') " MODULE PROCEDURE h5pregister_kind_"//TRIM(ADJUSTL(chr2)) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pregister_kind_"//TRIM(ADJUSTL(chr2)) END DO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" ! H5Pinsert_f - WRITE(11,'(A)') " INTERFACE h5pinsert_f" + WRITE(11,'(2X,A)') "INTERFACE h5pinsert_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j - WRITE(11,'(A)') " MODULE PROCEDURE h5pinsert_kind_"//TRIM(ADJUSTL(chr2)) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pinsert_kind_"//TRIM(ADJUSTL(chr2)) END DO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" WRITE(11,'(A)') 'CONTAINS' diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index b8d5355..3dd3c8c 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -12,16 +12,19 @@ ! fortran/src/H5config_f.inc. Generated from fortran/src/H5config_f.inc.in by configure ! Define if we have parallel support -#cmakedefine H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@ +#cmakedefine01 H5_HAVE_PARALLEL +#if H5_HAVE_PARALLEL == 0 +#undef H5_HAVE_PARALLEL +#endif ! Define if the intrinsic function STORAGE_SIZE exists -#cmakedefine H5_FORTRAN_HAVE_STORAGE_SIZE @H5_FORTRAN_HAVE_STORAGE_SIZE@ +#define H5_FORTRAN_HAVE_STORAGE_SIZE @H5_FORTRAN_HAVE_STORAGE_SIZE@ ! Define if the intrinsic function SIZEOF exists -#cmakedefine H5_FORTRAN_HAVE_SIZEOF @H5_FORTRAN_HAVE_SIZEOF@ +#define H5_FORTRAN_HAVE_SIZEOF @H5_FORTRAN_HAVE_SIZEOF@ ! Define if the intrinsic function C_SIZEOF exists -#cmakedefine H5_FORTRAN_HAVE_C_SIZEOF @H5_FORTRAN_HAVE_C_SIZEOF@ +#define H5_FORTRAN_HAVE_C_SIZEOF @H5_FORTRAN_HAVE_C_SIZEOF@ ! Define if the intrinsic C_LONG_DOUBLE exists #define H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@ @@ -30,41 +33,40 @@ #define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ ! Define if the intrinsic module ISO_FORTRAN_ENV exists -#cmakedefine H5_HAVE_ISO_FORTRAN_ENV @H5_HAVE_ISO_FORTRAN_ENV@ - +#define H5_HAVE_ISO_FORTRAN_ENV @H5_HAVE_ISO_FORTRAN_ENV@ ! should this be ${HDF_PREFIX} instead of H5 MSB -#cmakedefine H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@ +#define H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@ ! should this be ${HDF_PREFIX} instead of H5 MSB -#cmakedefine H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ +#define H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ ! Define the maximum decimal precision for reals -#cmakedefine H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ +#define H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ ! If C has quad precision -#cmakedefine H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@ +#define H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@ ! Define if INTEGER*16 is available #define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @H5_HAVE_Fortran_INTEGER_SIZEOF_16@ ! Maximum decimal precision for C -#cmakedefine H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ +#define H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ ! number of valid REAL KINDs -#cmakedefine H5_H5CONFIG_F_NUM_RKIND @H5_H5CONFIG_F_NUM_RKIND@ +#define H5_H5CONFIG_F_NUM_RKIND @H5_H5CONFIG_F_NUM_RKIND@ ! valid REAL KINDs (need to have a matching C counter-part) -#cmakedefine H5_H5CONFIG_F_RKIND @H5_H5CONFIG_F_RKIND@ +#define H5_H5CONFIG_F_RKIND @H5_H5CONFIG_F_RKIND@ ! valid REAL KINDs (need to have a matching C counter-part) -#cmakedefine H5_H5CONFIG_F_RKIND_SIZEOF @H5_H5CONFIG_F_RKIND_SIZEOF@ +#define H5_H5CONFIG_F_RKIND_SIZEOF @H5_H5CONFIG_F_RKIND_SIZEOF@ ! number of valid INTEGER KINDs -#cmakedefine H5_H5CONFIG_F_NUM_IKIND @H5_H5CONFIG_F_NUM_IKIND@ +#define H5_H5CONFIG_F_NUM_IKIND @H5_H5CONFIG_F_NUM_IKIND@ ! valid INTEGER KINDs (need to have a matching C counter-part) -#cmakedefine H5_H5CONFIG_F_IKIND @H5_H5CONFIG_F_IKIND@ +#define H5_H5CONFIG_F_IKIND @H5_H5CONFIG_F_IKIND@ ! Fortran compiler id -#cmakedefine H5_Fortran_COMPILER_ID @Fortran_COMPILER_ID@ +#define H5_Fortran_COMPILER_ID @CMAKE_Fortran_COMPILER_ID@ diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 46ef8ef..0884eb6 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -78,7 +78,6 @@ typedef struct H5O_info_t_f { */ H5_FCDLL int_f h5fcreate_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *crt_prp, hid_t_f *acc_prp, hid_t_f *file_id); H5_FCDLL int_f h5fopen_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hid_t_f *file_id); -H5_FCDLL int_f h5fis_hdf5_c(_fcd name, int_f *namelen, int_f *flag); H5_FCDLL int_f h5fclose_c(hid_t_f *file_id); H5_FCDLL int_f h5fmount_c(hid_t_f *loc_id, _fcd dsetname, int_f *namelen, hid_t_f *file_id, hid_t_f *acc_prp); H5_FCDLL int_f h5funmount_c(hid_t_f *loc_id, _fcd dsetname, int_f *namelen); diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 3a5a91f..2edba5a 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -94,6 +94,7 @@ H5F_mp_H5FOPEN_F H5F_mp_H5FREOPEN_F H5F_mp_H5FGET_CREATE_PLIST_F H5F_mp_H5FGET_ACCESS_PLIST_F +H5F_mp_H5FIS_ACCESSIBLE_F H5F_mp_H5FIS_HDF5_F H5F_mp_H5FGET_NAME_F H5F_mp_H5FGET_FILESIZE_F diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90 index 72920f2..d51803b 100644 --- a/fortran/test/tH5F.F90 +++ b/fortran/test/tH5F.F90 @@ -30,8 +30,6 @@ ! access the dataset from the second file as a member of a group ! in the first file. - - MODULE TH5F CONTAINS @@ -234,7 +232,24 @@ CONTAINS CALL check("h5fclose_f",error,total_error) ! - !test whether files are in hdf5 format + !test whether files are accessible as HDF5 (new, VOL-safe, way) + ! + CALL h5fis_accessible_f(fix_filename1, status, error) + CALL check("h5fis_accessible_f",error,total_error) + IF ( .NOT. status ) THEN + write(*,*) "File ", fix_filename1, " is not accessible as hdf5" + stop + END IF + + CALL h5fis_accessible_f(fix_filename2, status, error) + CALL check("h5fis_accessible_f",error,total_error) + IF ( .NOT. status ) THEN + write(*,*) "File ", fix_filename2, " is not accessible as hdf5" + stop + END IF + + ! + !test whether files are in hdf5 format (old way) ! CALL h5fis_hdf5_f(fix_filename1, status, error) CALL check("h5fis_hdf5_f",error,total_error) diff --git a/hl/c++/examples/run-hlc++-ex.sh.in b/hl/c++/examples/run-hlc++-ex.sh.in index 9539724..eb688a1 100644 --- a/hl/c++/examples/run-hlc++-ex.sh.in +++ b/hl/c++/examples/run-hlc++-ex.sh.in @@ -31,7 +31,7 @@ EXIT_SUCCESS=0 EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-@prefix@}" +prefix="${prefix:-../../../..}" AR="@AR@" RANLIB="@RANLIB@" H5TOOL="h5c++" # The tool name diff --git a/hl/examples/run-hlc-ex.sh.in b/hl/examples/run-hlc-ex.sh.in index b12955f..f51b165 100644 --- a/hl/examples/run-hlc-ex.sh.in +++ b/hl/examples/run-hlc-ex.sh.in @@ -31,7 +31,7 @@ EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-@prefix@}" +prefix="${prefix:-../../../..}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/hl/fortran/examples/run-hlfortran-ex.sh.in b/hl/fortran/examples/run-hlfortran-ex.sh.in index c8f41f8..5f12ef0 100644 --- a/hl/fortran/examples/run-hlfortran-ex.sh.in +++ b/hl/fortran/examples/run-hlfortran-ex.sh.in @@ -32,7 +32,7 @@ EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-@prefix@}" +prefix="${prefix:-../../../..}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/hl/fortran/test/Makefile.am b/hl/fortran/test/Makefile.am index ba672aa..0552aaa 100644 --- a/hl/fortran/test/Makefile.am +++ b/hl/fortran/test/Makefile.am @@ -58,18 +58,6 @@ clean-local: $(RM) *.$(F9XMODEXT); \ fi -install-data-local: - @if test -n "$(F9XMODEXT)" && test "X$(F9XMODEXT)" != "Xo"; then \ - $(CP) $(top_builddir)/$(subdir)/*.$(F9XMODEXT) $(DESTDIR)$(includedir)/. ; \ - fi - -uninstall-local: - @if test -n "$(F9XMODEXT)" -a "X$(F9XMODEXT)" != "Xo"; then \ - if test -f "$(includedir)/hdf5.$(F9XMODEXT)" -o -f "$(DESTDIR)$(includedir)/HDF5.$(F9XMODEXT)"; then \ - set -x; $(RM) $(includedir)/*.$(F9XMODEXT); \ - fi; \ - fi - # Mark this directory as part of the Fortran API (this affects output # from tests in conclude.am) FORTRAN_API=yes diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index e339f11..bf0f6ff 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -21,7 +21,6 @@ set (HL_HEADERS ${HDF5_HL_SRC_SOURCE_DIR}/H5DOpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5DSpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5IMpublic.h - ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h ${HDF5_HL_SRC_SOURCE_DIR}/H5LTpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5PTpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5TBpublic.h @@ -29,7 +28,11 @@ set (HL_HEADERS ${HDF5_HL_SRC_SOURCE_DIR}/hdf5_hl.h ) -add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS}) +set (HL_PRIVATE_HEADERS + ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h +) + +add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) target_include_directories(${HDF5_HL_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" @@ -42,7 +45,7 @@ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF set (install_targets ${HDF5_HL_LIB_TARGET}) if (BUILD_SHARED_LIBS) - add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS}) + add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) target_include_directories(${HDF5_HL_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index d86cc98..067992f 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -241,7 +241,7 @@ herr_t H5DSattach_scale(hid_t did, if (has_dimlist == 0) { - dims[0] = (hsize_t)rank; + dims[0] = (hsize_t)rank; /* space for the attribute */ if((sid = H5Screate_simple(1, dims, NULL)) < 0) @@ -556,9 +556,9 @@ out: * * Date: December 20, 2004 * -* Comments: +* Comments: * -* Modifications: Function didn't delete DIMENSION_LIST attribute, when +* Modifications: Function didn't delete DIMENSION_LIST attribute, when * all dimension scales were detached from a dataset; added. * 2010/05/13 EIP * @@ -706,24 +706,24 @@ herr_t H5DSdetach_scale(hid_t did, /* same object, reset */ if(dsid_oi.fileno == tmp_oi.fileno && dsid_oi.addr == tmp_oi.addr) { - /* If there are more than one reference in the VL element + /* If there are more than one reference in the VL element and the reference we found is not the last one, copy the last one to replace the found one since the order - of the references doesn't matter according to the spec; - reduce the size of the VL element by 1; - if the length of the element becomes 0, free the pointer + of the references doesn't matter according to the spec; + reduce the size of the VL element by 1; + if the length of the element becomes 0, free the pointer and reset to NULL */ size_t len = buf[idx].len; - if(j < len - 1) - ((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1]; + if(j < len - 1) + ((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1]; len = --buf[idx].len; if(len == 0) { - HDfree(buf[idx].p); + HDfree(buf[idx].p); buf[idx].p = NULL; } - /* Since a reference to a dim. scale can be inserted only once, + /* Since a reference to a dim. scale can be inserted only once, we do not need to continue the search if it is found */ found_ds = 1; break; @@ -736,16 +736,16 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* Write the attribute, but check first, if we have any scales left, - because if not, we should delete the attribute according to the spec */ + because if not, we should delete the attribute according to the spec */ for(i = 0; i < rank; i++) { if(buf[i].len > 0) { have_ds = 1; - break; + break; } } - if(have_ds) { + if(have_ds) { if(H5Awrite(aid, tid, buf) < 0) - goto out; + goto out; } else { if(H5Adelete(did, DIMENSION_LIST) < 0) @@ -1123,7 +1123,7 @@ htri_t H5DSis_attached(hid_t did, if (dsbuf == NULL) goto out; - if (H5Aread(aid,ntid,dsbuf) < 0) + if (H5Aread(aid,ntid,dsbuf) < 0) goto out; /*------------------------------------------------------------------------- @@ -1445,7 +1445,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) if (H5I_DATASET != it) return FAIL; - if (label == NULL) + if (label == NULL) return FAIL; /* get dataset space */ @@ -1502,7 +1502,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) goto out; for (i = 0; i < (unsigned int) rank; i++) - u.const_buf[i] = NULL; + u.const_buf[i] = NULL; /* store the label information in the required index */ u.const_buf[idx] = label; @@ -1532,7 +1532,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) else { - + if ((aid = H5Aopen(did, DIMENSION_LABELS, H5P_DEFAULT)) < 0) goto out; @@ -1541,7 +1541,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) /* allocate and initialize */ u.buf = (char **) HDmalloc((size_t) rank * sizeof(char *)); - + if (u.buf == NULL) goto out; @@ -1626,7 +1626,7 @@ out: * Comments: * * Modifications: -* JIRA HDFFV-7673: Added a check to see if the label name exists, +* JIRA HDFFV-7673: Added a check to see if the label name exists, * if not then returns zero. July 30, 2011. MSB * *------------------------------------------------------------------------- @@ -1714,26 +1714,26 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) if (buf[idx] != NULL) { /* get the real string length */ - nbytes = strlen(buf[idx]); + nbytes = HDstrlen(buf[idx]); - /* compute the string length which will fit into the user's buffer */ - copy_len = MIN(size-1, nbytes); + /* compute the string length which will fit into the user's buffer */ + copy_len = MIN(size-1, nbytes); - /* copy all/some of the name */ - if (label) - { - memcpy(label, buf[idx], copy_len); - - /* terminate the string */ - label[copy_len] = '\0'; - } + /* copy all/some of the name */ + if (label) + { + HDmemcpy(label, buf[idx], copy_len); + + /* terminate the string */ + label[copy_len] = '\0'; + } } /* free all the ptr's from the H5Aread() */ for (i = 0; i < rank; i++) { if (buf[i]) - HDfree(buf[i]); + HDfree(buf[i]); } /* close */ @@ -1867,7 +1867,7 @@ ssize_t H5DSget_scale_name(hid_t did, /* copy all/some of the name */ if (name) { - memcpy(name, buf, copy_len); + HDmemcpy(name, buf, copy_len); /* terminate the string */ name[copy_len]='\0'; @@ -1951,33 +1951,33 @@ htri_t H5DSis_scale(hid_t did) if((tid = H5Aget_type(aid)) < 0) goto out; - /* check to make sure attribute is a string */ - if(H5T_STRING != H5Tget_class(tid)) - goto out; + /* check to make sure attribute is a string */ + if(H5T_STRING != H5Tget_class(tid)) + goto out; - /* check to make sure string is null-terminated */ - if(H5T_STR_NULLTERM != H5Tget_strpad(tid)) - goto out; + /* check to make sure string is null-terminated */ + if(H5T_STR_NULLTERM != H5Tget_strpad(tid)) + goto out; - /* allocate buffer large enough to hold string */ - if((storage_size = H5Aget_storage_size(aid)) == 0) - goto out; + /* allocate buffer large enough to hold string */ + if((storage_size = H5Aget_storage_size(aid)) == 0) + goto out; - buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1); - if(buf == NULL) - goto out; + buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1); + if(buf == NULL) + goto out; - /* Read the attribute */ + /* Read the attribute */ if(H5Aread(aid, tid, buf) < 0) - goto out; + goto out; - /* compare strings */ + /* compare strings */ if(HDstrncmp(buf, DIMENSION_SCALE_CLASS, MIN(HDstrlen(DIMENSION_SCALE_CLASS),HDstrlen(buf)))==0) is_ds = 1; else is_ds = 0; - HDfree(buf); + HDfree(buf); if(H5Tclose(tid) < 0) goto out; @@ -2236,8 +2236,8 @@ out: static hid_t H5DS_get_REFLIST_type(void) { - hid_t ntid_t = -1; - + hid_t ntid_t = -1; + /* Build native type that corresponds to compound datatype used to store ds_list_t structure in the REFERENCE_LIST attribute */ @@ -2257,5 +2257,5 @@ out: H5Tclose(ntid_t); } H5E_END_TRY; return FAIL; -} +} diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 49dc72f..95178fc 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -186,11 +186,11 @@ int main(void) if(nerrors) goto error; - printf("All dimension scales tests passed.\n"); + HDprintf("All dimension scales tests passed.\n"); return 0; error: - printf("***** %d DIMENSION SCALES TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S"); + HDprintf("***** %d DIMENSION SCALES TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S"); return 1; } @@ -1110,7 +1110,7 @@ herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *sc if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) { if(H5DSis_attached(did, dsid, idx) == 1) { if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) > 0) { - name_out = (char*)HDmalloc(((size_t)name_len+1) * sizeof (char)); + name_out = (char*)HDmalloc(((size_t)name_len+1) * sizeof (char)); if(name_out != NULL) { if(H5DSget_scale_name(dsid, name_out, (size_t)name_len+1) >= 0) { if(HDstrncmp(scalename, name_out, (size_t)name_len)==0) { @@ -1156,7 +1156,7 @@ static int test_detachscales(void) sprintf(dname,"D%d", i); if(H5LTmake_dataset_int(fid, dname, rank3, dims, buf) < 0) goto out; - } + } /* create datasets and make them dim. scales */ for (i=0; i < 4; i++) { @@ -1164,11 +1164,11 @@ static int test_detachscales(void) if(H5LTmake_dataset_int(fid, dname, rank1, dims, buf) < 0) goto out; } - /* attach scales to the first dataset; first dimension will have + /* attach scales to the first dataset; first dimension will have two scales attached */ if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) { for (i=0; i<4; i++) { - sprintf(dname, "DS%d", i); + HDsprintf(dname, "DS%d", i); if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSattach_scale(did, dsid, (unsigned int) i%3) < 0) @@ -1185,7 +1185,7 @@ static int test_detachscales(void) /* attach scales to the second dataset */ if((did = H5Dopen2(fid, "D1", H5P_DEFAULT)) >= 0) { for (i=0; i<3; i++) { - sprintf(dname, "DS%d", i); + HDsprintf(dname, "DS%d", i); if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSattach_scale(did, dsid, (unsigned int) i) < 0) @@ -1206,20 +1206,20 @@ static int test_detachscales(void) goto out; for (i=0; i<2; i++) { - sprintf(dname, "D%d", i); + HDsprintf(dname, "D%d", i); if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSdetach_scale(did, dsid, (unsigned int)0) < 0) goto out; if(H5Dclose(did) < 0) goto out; - } + } /* Check that attribute "REFERENCE_LIST" doesn't exist anymore */ if(H5Aexists(dsid, REFERENCE_LIST)!= 0) goto out; if(H5Dclose(dsid) < 0) goto out; - /* Check that DS3 is the only dim. scale attached to the first + /* Check that DS3 is the only dim. scale attached to the first dimension of D0 */ if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) < 0) goto out; @@ -1232,11 +1232,11 @@ static int test_detachscales(void) if(H5Dclose(dsid) < 0) goto out; - /* Detach the rest of the scales DS3, DS1, DS2 from D0 and make + /* Detach the rest of the scales DS3, DS1, DS2 from D0 and make sure that attribute "DIMENSION_LIST" doesn't exist anymore */ if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) { for (i=1; i<4; i++) { - sprintf(dname, "DS%d", i); + HDsprintf(dname, "DS%d", i); if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSdetach_scale(did, dsid, (unsigned int) i%3) < 0) @@ -1253,7 +1253,7 @@ static int test_detachscales(void) else goto out; - + PASSED(); H5Fclose(fid); @@ -2873,10 +2873,10 @@ static int test_simple(void) if((sid = H5Screate_simple(rank,dims,NULL)) < 0) goto out; for(i = 0; i < 5; i++) { - sprintf(dname,"dset_%d",i); + HDsprintf(dname,"dset_%d",i); if((did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - sprintf(sname,"ds_%d",i); + HDsprintf(sname,"ds_%d",i); if((dsid = H5Dcreate2(gid, sname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5DSset_scale(dsid,"scale") < 0) @@ -2893,11 +2893,11 @@ static int test_simple(void) */ for(i = 0; i < 5; i++) { - sprintf(dname, "dset_%d", i); + HDsprintf(dname, "dset_%d", i); if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0) goto out; for(j = 0; j < 5; j++) { - sprintf(sname, "ds_%d", j); + HDsprintf(sname, "ds_%d", j); if((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0) goto out; if(H5DSattach_scale(did, dsid, DIM0) < 0) @@ -2915,7 +2915,7 @@ static int test_simple(void) */ for(i = 0; i < 5; i++) { - sprintf(dname, "dset_%d", i); + HDsprintf(dname, "dset_%d", i); if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0) goto out; for(j = 0; j < 5; j++) { @@ -2938,7 +2938,7 @@ static int test_simple(void) */ for(i=0; i<5; i++) { - sprintf(dname,"dset_%d",i); + HDsprintf(dname,"dset_%d",i); if((did = H5Dopen2(gid,dname, H5P_DEFAULT)) < 0) goto out; for(j=0; j<5; j++) { @@ -3541,7 +3541,7 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor for(i=0; i<nelmts; i++) { if(buf[i] != data[i]) { - printf("read and write buffers differ\n"); + HDprintf("read and write buffers differ\n"); goto out; } } @@ -5014,7 +5014,7 @@ static int test_errors2(void) goto out; if ((label_len=H5DSget_label(did,0,NULL,0)) < 0) goto out; - if ( label_len != strlen("label") ) + if ( label_len != HDstrlen("label") ) goto out; if (H5DSget_label(did,0,lbuf,sizeof(lbuf)) < 0) goto out; @@ -5134,83 +5134,83 @@ static int test_attach_detach(void) if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; - - if((sid = H5Screate_simple(1, dims, dims)) < 0) + + if((sid = H5Screate_simple(1, dims, dims)) < 0) goto out; if((dsid = H5Dcreate2(gid, DS_3_NAME, H5T_IEEE_F32BE, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) goto out; - if(H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; - if(H5Pclose(dcpl_id) < 0) + if(H5Pclose(dcpl_id) < 0) goto out; - if(H5DSset_scale(dsid, DS_3_NAME) < 0) + if(H5DSset_scale(dsid, DS_3_NAME) < 0) goto out; /* Create a variable that uses this dimension scale. */ - if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) + if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) goto out; if((var1_id = H5Dcreate2(gid, DS_31_NAME, H5T_NATIVE_FLOAT, sid, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if(H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; - if(H5DSattach_scale(var1_id, dsid, 0) < 0) + if(H5DSattach_scale(var1_id, dsid, 0) < 0) goto out; /* Create another variable that uses this dimension scale. */ - if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; - if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) + if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) goto out; - if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) + if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) goto out; if((var2_id = H5Dcreate2(gid, DS_32_NAME, H5T_NATIVE_FLOAT, sid, - H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) + H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) goto out; - if(H5Pclose(dcpl_id) < 0) + if(H5Pclose(dcpl_id) < 0) goto out; - if(H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; /* Create 3rd variable that uses this dimension scale. */ - if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; - if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) + if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) goto out; - if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) + if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) goto out; if((var3_id = H5Dcreate2(gid, DS_33_NAME, H5T_NATIVE_FLOAT, sid, - H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) + H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) goto out; - if(H5Pclose(dcpl_id) < 0) + if(H5Pclose(dcpl_id) < 0) goto out; - if(H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; - + /* Attached var2 scale */ - if(H5DSattach_scale(var2_id, dsid, 0) < 0) + if(H5DSattach_scale(var2_id, dsid, 0) < 0) goto out; /* Detach the var2 scale */ - if(H5DSdetach_scale(var2_id, dsid, 0) < 0) + if(H5DSdetach_scale(var2_id, dsid, 0) < 0) goto out; /* Check if in correct state of detached and attached */ @@ -5220,7 +5220,7 @@ static int test_attach_detach(void) goto out; /* Detach the var1 scale */ - if(H5DSdetach_scale(var1_id, dsid, 0) < 0) + if(H5DSdetach_scale(var1_id, dsid, 0) < 0) goto out; /* Check if in correct state of detached and attached */ @@ -5231,10 +5231,10 @@ static int test_attach_detach(void) /* Attach the DS again and remove them in the opposite order */ - if(H5DSattach_scale(var1_id, dsid, 0) < 0) + if(H5DSattach_scale(var1_id, dsid, 0) < 0) goto out; - if(H5DSattach_scale(var2_id, dsid, 0) < 0) + if(H5DSattach_scale(var2_id, dsid, 0) < 0) goto out; /* Detach the var1 scale */ @@ -5262,13 +5262,13 @@ static int test_attach_detach(void) * Attach Three DS and remove the middle one first *****************************************************/ - if(H5DSattach_scale(var1_id, dsid, 0) < 0) + if(H5DSattach_scale(var1_id, dsid, 0) < 0) goto out; - if(H5DSattach_scale(var2_id, dsid, 0) < 0) + if(H5DSattach_scale(var2_id, dsid, 0) < 0) goto out; - if(H5DSattach_scale(var3_id, dsid, 0) < 0) + if(H5DSattach_scale(var3_id, dsid, 0) < 0) goto out; @@ -5314,15 +5314,15 @@ static int test_attach_detach(void) *------------------------------------------------------------------------- */ - if(H5Dclose(var1_id) < 0) + if(H5Dclose(var1_id) < 0) goto out; - if(H5Dclose(var2_id) < 0) + if(H5Dclose(var2_id) < 0) goto out; - if(H5Dclose(var3_id) < 0) + if(H5Dclose(var3_id) < 0) goto out; - if(H5Dclose(dsid) < 0) + if(H5Dclose(dsid) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; if(H5Fclose(fid) < 0) goto out; diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 763fdb5..51ab72b 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1050,7 +1050,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) HDfree( dims_out ); return -1; } - + for (i = 0; i < rank_out; i++) { if ( dims_out[i] != 5 ) { HDfree( dims_out ); @@ -1152,7 +1152,7 @@ static int test_fps(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) goto out; if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { @@ -1228,7 +1228,7 @@ static int test_strings(void) goto out; } if(HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE 13;\n STRPAD H5T_STR_NULLTERM;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1260,7 +1260,7 @@ static int test_strings(void) goto out; } if(HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1270,13 +1270,13 @@ static int test_strings(void) str_len = str_len + 10; if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) goto out; - + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { HDfree(dt_str); goto out; } if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len-1)) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1292,10 +1292,10 @@ static int test_strings(void) goto out; } /* check the truncated string */ - if(strlen(dt_str) != str_len-1) goto out; - str_len = strlen(dt_str); + if(HDstrlen(dt_str) != str_len-1) goto out; + str_len = HDstrlen(dt_str); if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len)) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1352,7 +1352,7 @@ static int test_opaques(void) goto out; } if(HDstrcmp(dt_str, "H5T_OPAQUE {\n OPQ_SIZE 19;\n OPQ_TAG \"This is a tag for opaque type\";\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1428,7 +1428,7 @@ static int test_enums(void) } if(HDstrcmp(dt_str, "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1469,16 +1469,16 @@ static int test_variables(void) if(H5Tis_variable_str(dtype)) goto out; - + if(H5Tclose(dtype)<0) goto out; - + if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_VLEN { H5T_STD_I32BE } }", H5LT_DDL))<0) goto out; - + if(H5Tis_variable_str(dtype)) goto out; - + if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) @@ -1488,15 +1488,15 @@ static int test_variables(void) goto out; } if(HDstrcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } HDfree(dt_str); - + if(H5Tclose(dtype)<0) goto out; - + PASSED(); return 0; @@ -1547,7 +1547,7 @@ static int test_arrays(void) goto out; } if(HDstrcmp(dt_str, "H5T_ARRAY {\n [5][7][13] H5T_ARRAY {\n [17][19] H5T_COMPOUND {\n H5T_STD_I8BE \"arr_compound_1\" : 0;\n H5T_STD_I32BE \"arr_compound_2\" : 1;\n }\n }\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1603,7 +1603,7 @@ static int test_compounds(void) goto out; } if(HDstrcmp(dt_str, "H5T_COMPOUND {\n H5T_STD_I16BE \"one_field\" : 2;\n H5T_STD_U8LE \"two_field\" : 6;\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1637,7 +1637,7 @@ out: } /*------------------------------------------------------------------------- -* subroutine for test_text_dtype(): test_compound_bug(). Test case for +* subroutine for test_text_dtype(): test_compound_bug(). Test case for * issue 7701. *------------------------------------------------------------------------- */ @@ -1770,7 +1770,7 @@ static int test_complicated_compound(void) /* Open input file */ fp = HDfopen(filename, "r"); if(fp == NULL) { - printf( "Could not find file %s. Try set $srcdir \n", filename); + HDprintf( "Could not find file %s. Try set $srcdir \n", filename); goto out; } @@ -1881,9 +1881,9 @@ static int test_valid_path(void) hid_t file_id, group; htri_t path_valid; const char *data_string_in = "test"; - + TESTING("H5LTpath_valid"); - + /* Create a new file using default properties. */ /************************************************************** @@ -1908,11 +1908,11 @@ static int test_valid_path(void) * | * | * | --- Gcyc (soft link to /G1) - * / \ - * / \ - * G5 \ + * / \ + * / \ + * G5 \ * (soft link G6 (external link /G1 in FILENAME4) - * to /G2) + * to /G2) * ****************************************************************/ @@ -1941,7 +1941,7 @@ static int test_valid_path(void) */ if(H5LTmake_dataset_string(group, "/G2/DS4", data_string_in)<0) goto out; - + /* * Create a soft link */ @@ -2023,9 +2023,9 @@ static int test_valid_path(void) * | * | * | - * G1 + * G1 * / \ - * / \ + * / \ * DS1 G2 * (dangled soft link to /G1/G20) * @@ -2056,13 +2056,13 @@ static int test_valid_path(void) goto out; H5Fclose(file_id); - + /* Open input file */ if((file_id = H5Fopen(FILE_NAME3,H5F_ACC_RDONLY, H5P_DEFAULT))<0) goto out; /************************************** - * CHECK ABSOLUTE PATHS + * CHECK ABSOLUTE PATHS **************************************/ if( (path_valid = H5LTpath_valid(file_id, "/", TRUE)) != TRUE) { @@ -2076,7 +2076,7 @@ static int test_valid_path(void) if( (path_valid = H5LTpath_valid(file_id, "/G1", TRUE)) != TRUE) { goto out; } - + if((path_valid = H5LTpath_valid(file_id, "/G1/DS1", TRUE)) != TRUE) goto out; @@ -2094,7 +2094,7 @@ static int test_valid_path(void) if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", TRUE)) != TRUE) goto out; - + if( (path_valid = H5LTpath_valid(file_id, "/G2", TRUE)) != TRUE) goto out; @@ -2114,14 +2114,14 @@ static int test_valid_path(void) /* check soft links */ if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G5/DS4", TRUE)) != TRUE) goto out; - + /************************************** - * CHECK RELATIVE PATHS + * CHECK RELATIVE PATHS ***************************************/ if( (group = H5Gopen2(file_id, "/", H5P_DEFAULT)) < 0) goto out; - + if( (path_valid = H5LTpath_valid(group, "/", TRUE)) != TRUE) { goto out; } @@ -2156,22 +2156,22 @@ static int test_valid_path(void) goto out; if( (path_valid = H5LTpath_valid(group, "G2/G5", TRUE)) != TRUE) - goto out; + goto out; /* Check the "./" case */ if( (path_valid = H5LTpath_valid(group, "./DS3", TRUE)) != TRUE) goto out; if( (path_valid = H5LTpath_valid(group, "./G2/G5", TRUE)) != TRUE) - goto out; + goto out; /* Should fail, does not exist */ if( (path_valid = H5LTpath_valid(group, "./G2/G20", FALSE)) == TRUE) - goto out; + goto out; /* Should fail, does not exist */ if( (path_valid = H5LTpath_valid(group, "./G2/G20", TRUE)) == TRUE) - goto out; + goto out; if(H5Gclose(group)<0) goto out; @@ -2220,7 +2220,7 @@ static int test_valid_path(void) PASSED(); return 0; - out: + out: H5_FAILED(); return -1; } diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index 453db12..6668c22 100644 --- a/hl/tools/gif2h5/decompress.c +++ b/hl/tools/gif2h5/decompress.c @@ -261,7 +261,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) * chain puts its associated output code on the output queue. */ while (CurCode > DataMask) { - if (OutCount > 1024) { + if (OutCount >= 1024) { /*return error message*/ } diff --git a/hl/tools/h5watch/swmr_check_compat_vfd.c b/hl/tools/h5watch/swmr_check_compat_vfd.c index 7d11a73..26f76cb 100644 --- a/hl/tools/h5watch/swmr_check_compat_vfd.c +++ b/hl/tools/h5watch/swmr_check_compat_vfd.c @@ -48,7 +48,7 @@ main(void) driver = HDgetenv("HDF5_DRIVER"); - if(H5FD_supports_swmr_test(driver)) + if(H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS; else return EXIT_FAILURE; diff --git a/java/examples/datasets/JavaDatasetExample.sh.in b/java/examples/datasets/JavaDatasetExample.sh.in index cb16d45..f5c63cd 100644 --- a/java/examples/datasets/JavaDatasetExample.sh.in +++ b/java/examples/datasets/JavaDatasetExample.sh.in @@ -52,12 +52,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$HDFLIB_HOME/slf4j-api-1.7.25.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar $top_builddir/src/.libs/libhdf5.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " +LIST_JAR_TESTFILES=" +$HDFLIB_HOME/slf4j-api-1.7.25.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar +" LIST_DATA_FILES=" $HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Alloc.txt $HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Checksum.txt @@ -83,6 +85,7 @@ $HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Soint.txt # copy files from source dirs to test dir # COPY_LIBFILES="$LIST_LIBRARY_FILES" +COPY_JARTESTFILES="$LIST_JAR_TESTFILES" COPY_LIBFILES_TO_BLDLIBDIR() { @@ -110,6 +113,30 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi fi done + # copy jar files. Used -f to make sure get a new copy + for tstfile in $COPY_JARTESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done } CLEAN_LIBFILES_AND_BLDLIBDIR() @@ -117,11 +144,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar` + SDIR=$HDFLIB_HOME INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDLIBDIR + for tstfile in $COPY_JARTESTFILES + do + $RM $BLDLIBDIR/tstfile + done fi } @@ -215,14 +245,9 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then fi case $os_name in - Darwin) - DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH - export DYLD_LIBRARY_PATH - LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - ;; *) LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH - ;; + ;; esac export LD_LIBRARY_PATH diff --git a/java/examples/datatypes/JavaDatatypeExample.sh.in b/java/examples/datatypes/JavaDatatypeExample.sh.in index 033442a..447512a 100644 --- a/java/examples/datatypes/JavaDatatypeExample.sh.in +++ b/java/examples/datatypes/JavaDatatypeExample.sh.in @@ -49,12 +49,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$HDFLIB_HOME/slf4j-api-1.7.25.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar $top_builddir/src/.libs/libhdf5.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " +LIST_JAR_TESTFILES=" +$HDFLIB_HOME/slf4j-api-1.7.25.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar +" LIST_DATA_FILES=" $HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Array.txt $HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt @@ -80,6 +82,7 @@ $HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_VLString.txt # copy files from source dirs to test dir # COPY_LIBFILES="$LIST_LIBRARY_FILES" +COPY_JARTESTFILES="$LIST_JAR_TESTFILES" COPY_LIBFILES_TO_BLDLIBDIR() { @@ -107,6 +110,30 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi fi done + # copy jar files. Used -f to make sure get a new copy + for tstfile in $COPY_JARTESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done } CLEAN_LIBFILES_AND_BLDLIBDIR() @@ -114,11 +141,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar` + SDIR=$HDFLIB_HOME INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDLIBDIR + for tstfile in $COPY_JARTESTFILES + do + $RM $BLDLIBDIR/tstfile + done fi } @@ -211,11 +241,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then fi case $os_name in - Darwin) - DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH - export DYLD_LIBRARY_PATH - LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - ;; *) LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH ;; diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in index 36df02e..9d4673f 100644 --- a/java/examples/groups/JavaGroupExample.sh.in +++ b/java/examples/groups/JavaGroupExample.sh.in @@ -34,13 +34,13 @@ nerrors=0 # where the libs exist HDFLIB_HOME="$top_srcdir/java/lib" BLDLIBDIR="$top_builddir/hdf5/lib" -BLDREFDIR="./groups" +BLDITERDIR="./groups" BLDDIR="." HDFTEST_HOME="$top_srcdir/java/examples/groups" JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar TESTJARFILE=jar@PACKAGE_TARNAME@groups.jar test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR -test -d $BLDREFDIR || mkdir -p $BLDREFDIR +test -d $BLDITERDIR || mkdir -p $BLDITERDIR ###################################################################### # library files @@ -51,13 +51,15 @@ test -d $BLDREFDIR || mkdir -p $BLDREFDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$HDFLIB_HOME/slf4j-api-1.7.25.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar $top_builddir/src/.libs/libhdf5.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " -LIST_REF_FILES=" +LIST_JAR_TESTFILES=" +$HDFLIB_HOME/slf4j-api-1.7.25.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar +" +LIST_ITER_FILES=" $HDFTEST_HOME/h5ex_g_iterate.h5 $HDFTEST_HOME/h5ex_g_visit.h5 " @@ -75,6 +77,7 @@ $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Visit.txt # copy files from source dirs to test dir # COPY_LIBFILES="$LIST_LIBRARY_FILES" +COPY_JARTESTFILES="$LIST_JAR_TESTFILES" COPY_LIBFILES_TO_BLDLIBDIR() { @@ -102,6 +105,30 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi fi done + # copy jar files. Used -f to make sure get a new copy + for tstfile in $COPY_JARTESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done } CLEAN_LIBFILES_AND_BLDLIBDIR() @@ -109,11 +136,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar` + SDIR=$HDFLIB_HOME INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDLIBDIR + for tstfile in $COPY_JARTESTFILES + do + $RM $BLDLIBDIR/tstfile + done fi } @@ -152,6 +182,7 @@ CLEAN_DATAFILES_AND_BLDDIR() $RM $BLDDIR/examples.groups.H5Ex_G_*.txt $RM $BLDDIR/H5Ex_G_*.out $RM $BLDDIR/H5Ex_G_*.h5 + $RM $BLDDIR/h5ex_g_*.h5 SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` @@ -161,12 +192,12 @@ CLEAN_DATAFILES_AND_BLDDIR() fi } -COPY_REFFILES="$LIST_REF_FILES" +COPY_ITERFILES="$LIST_ITER_FILES" -COPY_REFFILES_TO_BLDREFDIR() +COPY_ITERFILES_TO_BLDITERDIR() { # copy test files. Used -f to make sure get a new copy - for tstfile in $COPY_REFFILES + for tstfile in $COPY_ITERFILES do # ignore '#' comment echo $tstfile | tr -d ' ' | grep '^#' > /dev/null @@ -177,9 +208,9 @@ COPY_REFFILES_TO_BLDREFDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $BLDREFDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDITERDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $CP -f $tstfile $BLDREFDIR + $CP -f $tstfile $BLDITERDIR if [ $? -ne 0 ]; then echo "Error: FAILED to copy $tstfile ." @@ -191,16 +222,16 @@ COPY_REFFILES_TO_BLDREFDIR() done } -CLEAN_REFFILES_AND_BLDREFDIR() +CLEAN_ITERFILES_AND_BLDITERDIR() { # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail SDIR=`$DIRNAME $HDFTEST_HOME/h5ex_g_iterate.h5` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $BLDREFDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDITERDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDREFDIR + $RM $BLDITERDIR fi } @@ -223,7 +254,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@ # prepare for test COPY_LIBFILES_TO_BLDLIBDIR COPY_DATAFILES_TO_BLDDIR -COPY_REFFILES_TO_BLDREFDIR +COPY_ITERFILES_TO_BLDITERDIR CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE"" @@ -257,11 +288,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then fi case $os_name in - Darwin) - DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH - export DYLD_LIBRARY_PATH - LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - ;; *) LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH ;; @@ -340,9 +366,9 @@ else fi # Clean up temporary files/directories +CLEAN_ITERFILES_AND_BLDITERDIR CLEAN_LIBFILES_AND_BLDLIBDIR CLEAN_DATAFILES_AND_BLDDIR -CLEAN_REFFILES_AND_BLDREFDIR # Report test results and exit if test $nerrors -eq 0 ; then diff --git a/java/examples/intro/JavaIntroExample.sh.in b/java/examples/intro/JavaIntroExample.sh.in index 077146d..1886485 100644 --- a/java/examples/intro/JavaIntroExample.sh.in +++ b/java/examples/intro/JavaIntroExample.sh.in @@ -49,12 +49,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$HDFLIB_HOME/slf4j-api-1.7.25.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar $top_builddir/src/.libs/libhdf5.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " +LIST_JAR_TESTFILES=" +$HDFLIB_HOME/slf4j-api-1.7.25.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar +" LIST_DATA_FILES=" $HDFTEST_HOME/../testfiles/examples.intro.H5_CreateDataset.txt $HDFTEST_HOME/../testfiles/examples.intro.H5_CreateAttribute.txt @@ -69,6 +71,7 @@ $HDFTEST_HOME/../testfiles/examples.intro.H5_ReadWrite.txt # copy files from source dirs to test dir # COPY_LIBFILES="$LIST_LIBRARY_FILES" +COPY_JARTESTFILES="$LIST_JAR_TESTFILES" COPY_LIBFILES_TO_BLDLIBDIR() { @@ -96,6 +99,30 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi fi done + # copy jar files. Used -f to make sure get a new copy + for tstfile in $COPY_JARTESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done } CLEAN_LIBFILES_AND_BLDLIBDIR() @@ -103,11 +130,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar` + SDIR=$HDFLIB_HOME INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDLIBDIR + for tstfile in $COPY_JARTESTFILES + do + $RM $BLDLIBDIR/tstfile + done fi } @@ -200,11 +230,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then fi case $os_name in - Darwin) - DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH - export DYLD_LIBRARY_PATH - LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - ;; *) LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH ;; diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index f58623e..f9f9b65 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -214,7 +214,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * exception handlers to print out the HDF-5 error stack. * <hr> * - * @version HDF5 1.11.2 <BR> + * @version HDF5 1.11.4 <BR> * <b>See also: <a href ="./hdf.hdf5lib.HDFArray.html"> hdf.hdf5lib.HDFArray</a> </b><BR> * <a href ="./hdf.hdf5lib.HDF5Constants.html"> hdf.hdf5lib.HDF5Constants</a><BR> * <a href ="./hdf.hdf5lib.HDF5CDataTypes.html"> hdf.hdf5lib.HDF5CDataTypes</a><BR> @@ -237,7 +237,7 @@ public class H5 implements java.io.Serializable { * * Make sure to update the versions number when a different library is used. */ - public final static int LIB_VERSION[] = { 1, 11, 2 }; + public final static int LIB_VERSION[] = { 1, 11, 4 }; public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib"; diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 7eddac0..b530f4b 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -190,6 +190,7 @@ public class HDF5Constants { public static final long H5E_UNSUPPORTED = H5E_UNSUPPORTED(); public static final long H5E_VERSION = H5E_VERSION(); public static final long H5E_VFL = H5E_VFL(); + public static final long H5E_VOL = H5E_VOL(); public static final long H5E_WALK_DOWNWARD = H5E_WALK_DOWNWARD(); public static final long H5E_WALK_UPWARD = H5E_WALK_UPWARD(); public static final long H5E_WRITEERROR = H5E_WRITEERROR(); @@ -317,6 +318,7 @@ public class HDF5Constants { public static final int H5I_REFERENCE = H5I_REFERENCE(); public static final int H5I_UNINIT = H5I_UNINIT(); public static final int H5I_VFL = H5I_VFL(); + public static final int H5I_VOL = H5I_VOL(); public static final int H5L_TYPE_ERROR = H5L_TYPE_ERROR(); public static final int H5L_TYPE_HARD = H5L_TYPE_HARD(); @@ -980,6 +982,8 @@ public class HDF5Constants { private static native final long H5E_VFL(); + private static native final long H5E_VOL(); + private static native final long H5E_WALK_DOWNWARD(); private static native final long H5E_WALK_UPWARD(); @@ -1224,6 +1228,8 @@ public class HDF5Constants { private static native final int H5I_VFL(); + private static native final int H5I_VOL(); + private static native final int H5L_TYPE_ERROR(); private static native final int H5L_TYPE_HARD(); diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html index 9c19442..edb1b76 100644 --- a/java/src/hdf/overview.html +++ b/java/src/hdf/overview.html @@ -6,18 +6,19 @@ The <b>Java HD5 Interface (JHI5)</b> is a Java package (<a href="../../hdf-java-html/javadocs/hdf/hdf5lib/package-summary.html">hdf.hdf5lib</a>) that ``wraps around'' the HDF5 library. -<p />There are a large number of functions in the HDF5 +<p>There are a large number of functions in the HDF5 library (version 1.10). Some of the functions are not supported in JHI5. Most of the unsupported functions have C function pointers, which is not currently -implemented in JHI5. +implemented in JHI5.</p> -<center><table BORDER=1 COLS=1 WIDTH="71%" BGCOLOR="#dbeaf5" > +<table style="width:71%;text-align:center;background-color:#dbeaf5" border="1"> +<caption>Java HDF5 Interface (JHI5)</caption> <tr> -<td> -<center>Note: The JHI5 does not support HDF4 or earlier.</center> +<td style="text-align:center;"> +Note: The JHI5 does not support HDF4 or earlier. </td> </tr> -</table></center> +</table> <p>The JHI5 may be used by any Java application that needs to access HDF5 files. It is extremely important to emphasize that <i>this package is not @@ -91,6 +92,6 @@ and the HDF5 library. <h3> <a NAME="DOWNLOAD"></a>To Obtain</h3> -The JHI5 is included with the <a href="http://www.hdfgroup.org/HDF5/index.html">HDF5</a> library. +The JHI5 is included with the <a href="https://portal.hdfgroup.org/display/support/Downloads">HDF5</a> library. </body> diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index a0228e1..7b95e0b 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -50,22 +50,10 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JAVA_JNI_CHDRS}) target_include_directories(${HDF5_JAVA_JNI_LIB_TARGET} PRIVATE ${HDF5_BINARY_DIR} ${HDF5_JAVA_JNI_SOURCE_DIR}) TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED) -target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) +target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_JAVA_JNI_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED "JAVA") -if (WIN32) - get_filename_component (HDF5_JAVA_JNI_DLL_NAME ${HDF5_JAVA_JNI_LIB_TARGET} NAME_WE) - set (HDF5_JAVA_JNI_DLL_NAME "${HDF5_JAVA_JNI_DLL_NAME}$<$<CONFIG:Debug>:_D>") - # message (STATUS "HDF5_JAVA_JNI_DLL_NAME: ${HDF5_JAVA_JNI_DLL_NAME}") - if (BUILD_TESTING) - add_custom_target (HDF5_JAVA_JNI-Test-Copy ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} - COMMENT "Copying ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" - ) - add_dependencies (HDF5_JAVA_JNI-Test-Copy ${HDF5_JAVA_JNI_LIB_TARGET}) - endif () -endif () #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index c99745d..fdec61a 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -344,6 +344,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5E_1VERSION(JNIEnv *env, jclass cls) { return H5 JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1VFL(JNIEnv *env, jclass cls) { return H5E_VFL; } JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5E_1VOL(JNIEnv *env, jclass cls) { return H5E_VOL; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1DOWNWARD(JNIEnv *env, jclass cls) { return H5E_WALK_DOWNWARD; } JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1UPWARD(JNIEnv *env, jclass cls) { return H5E_WALK_UPWARD; } @@ -605,6 +607,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5I_1REFERENCE(JNIEnv *env, jclass cls) { return JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1VFL(JNIEnv *env, jclass cls) { return H5I_VFL; } JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5I_1VOL(JNIEnv *env, jclass cls) { return H5I_VOL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1INVALID_1HID(JNIEnv *env, jclass cls) { return H5I_INVALID_HID; } JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1GENPROP_1CLS(JNIEnv *env, jclass cls) { return H5I_GENPROP_CLS; } diff --git a/java/src/jni/h5Imp.c b/java/src/jni/h5Imp.c index 2eeb075..1ad6b17 100644 --- a/java/src/jni/h5Imp.c +++ b/java/src/jni/h5Imp.c @@ -36,7 +36,6 @@ extern "C" { #include "h5Imp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index c0dc182..aba2240 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -29,7 +29,11 @@ extern "C" { #include "h5aImp.h" extern JavaVM *jvm; -extern jobject visit_callback; + +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; #ifdef __cplusplus #define CBENVPTR (cbenv) @@ -53,7 +57,8 @@ static herr_t H5AwriteVL_asstr (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjec static herr_t H5AwriteVL_str (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf); static herr_t H5AreadVL_asstr (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf); static herr_t H5AreadVL_str (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf); -static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *op_data); + +static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data); /* @@ -1138,7 +1143,7 @@ Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist static herr_t H5A_iterate_cb - (hid_t g_id, const char *name, const H5A_info_t *info, void *op_data) { + (hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data) { JNIEnv *cbenv; jint status = -1; jclass cls; @@ -1147,6 +1152,9 @@ H5A_iterate_cb jmethodID constructor; jvalue args[4]; jobject cb_info_t = NULL; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); @@ -1195,14 +1203,14 @@ Java_hdf_hdf5lib_H5_H5Aiterate hsize_t start_idx = (hsize_t)idx; herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); } /* end if */ else { - status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)op_data); + status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper); if (status < 0) h5libraryError(env); @@ -1224,9 +1232,9 @@ Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name const char *lName; hsize_t start_idx = (hsize_t)idx; herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); @@ -1234,7 +1242,7 @@ Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Aiterate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)op_data, (hid_t)access_id); + status = H5Aiterate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index cea6bb4..652c873 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -30,7 +30,11 @@ extern "C" { #include "h5dImp.h" extern JavaVM *jvm; -extern jobject visit_callback; + +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; #ifdef __cplusplus #ifdef _WINDOWS @@ -1105,7 +1109,7 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); if (utf8) { - strncpy(&c_buf[i * str_len], utf8, str_len); + HDstrncpy(&c_buf[i * str_len], utf8, str_len); } /* end if */ ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8); @@ -1888,7 +1892,7 @@ Java_hdf_hdf5lib_H5_H5Dset_1extent static herr_t H5D_iterate_cb - (void* elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *op_data) { + (void* elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *cb_data) { JNIEnv *cbenv; jint status; jclass cls; @@ -1896,6 +1900,9 @@ H5D_iterate_cb jbyteArray elemArray; jlongArray pointArray; jsize size; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { JVMPTR->DetachCurrentThread(JVMPAR); @@ -1958,9 +1965,9 @@ Java_hdf_hdf5lib_H5_H5Diterate herr_t status = -1; jboolean isCopy; jbyte *buffP; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Diterate: op_data is NULL"); @@ -1977,7 +1984,7 @@ Java_hdf_hdf5lib_H5_H5Diterate h5JNIFatalError(env, "H5Diterate: buf not pinned"); } /* end if */ else { - status = H5Diterate((void*)buffP, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void*)op_data); + status = H5Diterate((void*)buffP, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void*)&wrapper); if (status < 0) { ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT); diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c index 10a02b0..9c80461 100644 --- a/java/src/jni/h5eImp.c +++ b/java/src/jni/h5eImp.c @@ -40,7 +40,11 @@ extern "C" { #include "h5eImp.h" extern JavaVM *jvm; -extern jobject visit_callback; + +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; #ifdef __cplusplus #define CBENVPTR (cbenv) @@ -60,7 +64,7 @@ extern jobject visit_callback; /* Local Prototypes */ /********************/ -static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *op_data); +static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *cb_data); /* * Class: hdf_hdf5lib_H5 @@ -475,7 +479,7 @@ Java_hdf_hdf5lib_H5_H5Eget_1num static herr_t H5E_walk_cb - (int nindx, const H5E_error2_t *info, void *op_data) + (int nindx, const H5E_error2_t *info, void *cb_data) { JNIEnv *cbenv; jint status = -1; @@ -485,6 +489,9 @@ H5E_walk_cb jmethodID constructor; jvalue args[7]; jobject cb_info_t = NULL; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); @@ -532,13 +539,14 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ewalk2 (JNIEnv *env, jclass cls, jlong stk_id, jlong direction, jobject callback_op, jobject op_data) { + cb_wrapper wrapper = {callback_op, op_data}; + ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Ewalk2: op_data or callback_op is NULL"); } /* end if */ - else if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void*)op_data) < 0) + else if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void*)&wrapper) < 0) h5libraryError(env); } /* end iJava_hdf_hdf5lib_H5_H5Ewalk2f */ diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c index 8cf5252..9d68290 100644 --- a/java/src/jni/h5fImp.c +++ b/java/src/jni/h5fImp.c @@ -29,7 +29,6 @@ extern "C" { #include "h5util.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 @@ -541,7 +540,7 @@ Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass cls, jlong file_id) { if (H5Fstart_swmr_write((hid_t)file_id) < 0) h5libraryError(env); @@ -554,7 +553,7 @@ Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass cls, jlong file_id) { if (H5Fstart_mdc_logging((hid_t)file_id) < 0) h5libraryError(env); @@ -580,7 +579,7 @@ Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status - (JNIEnv *env, jclass cls, jlong file_id, jbooleanArray mdc_logging_status) + (JNIEnv *env, jclass cls, jlong file_id, jbooleanArray mdc_logging_status) { hbool_t is_enabled; hbool_t is_currently_logging; diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c index 41ec382..42c042a 100644 --- a/java/src/jni/h5gImp.c +++ b/java/src/jni/h5gImp.c @@ -30,7 +30,6 @@ extern "C" { #include "h5gImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5iImp.c b/java/src/jni/h5iImp.c index 47574ca..b8bd1cd 100644 --- a/java/src/jni/h5iImp.c +++ b/java/src/jni/h5iImp.c @@ -28,7 +28,6 @@ extern "C" { #include "h5iImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c index f1734fd..e1ec3bd 100644 --- a/java/src/jni/h5lImp.c +++ b/java/src/jni/h5lImp.c @@ -28,13 +28,17 @@ extern "C" { #include "h5lImp.h" extern JavaVM *jvm; -extern jobject visit_callback; + +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; /********************/ /* Local Prototypes */ /********************/ -static herr_t H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info_t *info, void *op_data); +static herr_t H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info_t *info, void *cb_data); /* * Class: hdf_hdf5lib_H5 @@ -541,7 +545,7 @@ Java_hdf_hdf5lib_H5_H5Lmove static herr_t H5L_iterate_cb - (hid_t g_id, const char *name, const H5L_info_t *info, void *op_data) + (hid_t g_id, const char *name, const H5L_info_t *info, void *cb_data) { JNIEnv *cbenv; jint status; @@ -551,6 +555,9 @@ H5L_iterate_cb jmethodID constructor; jvalue args[5]; jobject cb_info_t = NULL; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); @@ -600,15 +607,15 @@ Java_hdf_hdf5lib_H5_H5Lvisit jobject callback_op, jobject op_data) { herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Lvisit: op_data or callback_op is NULL"); } /* end if */ else { - status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data); + status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper); if (status < 0) h5libraryError(env); } /* end else */ @@ -628,9 +635,9 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name { herr_t status = -1; const char *lName; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Lvisit_by_name: op_data or callback_op is NULL"); @@ -638,7 +645,7 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Lvisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data, (hid_t)access_id); + status = H5Lvisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); @@ -662,15 +669,15 @@ Java_hdf_hdf5lib_H5_H5Literate { hsize_t start_idx = (hsize_t)idx; herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Literate: op_data or callback_op is NULL"); } /* end if */ else { - status = H5Literate((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data); + status = H5Literate((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper); if (status < 0) h5libraryError(env); @@ -694,7 +701,7 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name const char *lName; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; + cb_wrapper wrapper = {callback_op, op_data}; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); @@ -702,7 +709,7 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Literate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data, (hid_t)access_id); + status = H5Literate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c index 6093e46..1de505a 100644 --- a/java/src/jni/h5oImp.c +++ b/java/src/jni/h5oImp.c @@ -27,13 +27,17 @@ extern "C" { #include "h5oImp.h" extern JavaVM *jvm; -extern jobject visit_callback; + +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; /********************/ /* Local Prototypes */ /********************/ -static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info_t *info, void *op_data); +static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info_t *info, void *cb_data); /* * Class: hdf_hdf5lib_H5 @@ -330,7 +334,7 @@ Java_hdf_hdf5lib_H5_H5Olink static herr_t H5O_iterate_cb - (hid_t g_id, const char *name, const H5O_info_t *info, void *op_data) + (hid_t g_id, const char *name, const H5O_info_t *info, void *cb_data) { JNIEnv *cbenv; jint status = -1; @@ -343,6 +347,9 @@ H5O_iterate_cb jobject ihinfobuf1; jobject ihinfobuf2; jobject cb_info_t = NULL; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { /* printf("JNI H5O_iterate_cb error: AttachCurrentThread failed\n"); */ @@ -448,9 +455,9 @@ Java_hdf_hdf5lib_H5_H5Ovisit jobject callback_op, jobject op_data, jint fields) { herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Ovisit: op_data is NULL"); @@ -459,7 +466,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit h5nullArgument(env, "H5Ovisit: callback_op is NULL"); } /* end if */ else { - status = H5Ovisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields); + status = H5Ovisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)&wrapper, (unsigned)fields); if (status < 0) h5libraryError(env); @@ -480,9 +487,9 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name { herr_t status = -1; const char *lName; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Ovisit_by_name: op_data is NULL"); @@ -495,7 +502,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Ovisit_by_name2((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields, (hid_t)access_id); + status = H5Ovisit_by_name2((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)&wrapper, (unsigned)fields, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index 3ff7436..52008ce 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -27,7 +27,6 @@ extern "C" { #include "h5pImp.h" extern JavaVM *jvm; -extern jobject visit_callback; extern jobject copy_callback; extern jobject close_callback; extern jobject create_callback; @@ -36,6 +35,11 @@ extern jobject get_callback; extern jobject set_callback; extern jobject delete_callback; +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; + /********************/ /* Local Prototypes */ /********************/ @@ -52,7 +56,7 @@ static herr_t H5P_prp_get_func_cb(hid_t prop_id, const char *name, size_t size, static herr_t H5P_prp_set_func_cb(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P_prp_delete_func_cb(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P_iterate_cb(hid_t prop_id, const char *name, void *op_data); +static herr_t H5P_iterate_cb(hid_t prop_id, const char *name, void *cb_data); /* * Class: hdf_hdf5lib_H5 @@ -3877,7 +3881,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); if (utf8) { - member_name[i] = (char*)HDmalloc(strlen(utf8) + 1); + member_name[i] = (char*)HDmalloc(HDstrlen(utf8) + 1); if (member_name[i]) { strcpy(member_name[i], utf8); } /* end if */ @@ -4185,7 +4189,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config h5JNIFatalError(env, "H5Pset_mdc_config: out of memory trace_file_name"); return; } /* end if */ - strncpy(cacheinfo.trace_file_name, str, 1025); + HDstrncpy(cacheinfo.trace_file_name, str, 1025); ENVPTR->ReleaseStringUTFChars(ENVPAR j_str, str); if(ENVPTR->ExceptionOccurred(ENVONLY)) { h5JNIFatalError(env, "H5Pset_mdc_config: loading trace_file_name failed"); @@ -5042,7 +5046,7 @@ H5P_cls_copy_cb } /* end if */ JVMPTR->DetachCurrentThread(JVMPAR); return (herr_t)status; -} /* end H5P_cls_ccopy_cb */ +} /* end H5P_cls_copy_cb */ static herr_t H5P_cls_close_cb @@ -5158,13 +5162,16 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options static herr_t H5D_append_cb - (hid_t dataset_id, hsize_t *cur_dims, void *op_data) + (hid_t dataset_id, hsize_t *cur_dims, void *cb_data) { JNIEnv *cbenv; jint status = -1; jclass cls; jmethodID mid; jlongArray cur_dimsArray; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { JVMPTR->DetachCurrentThread(JVMPAR); @@ -5199,9 +5206,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1append_1flush (JNIEnv *env, jclass clss, jlong plist_id, jint ndims, jlongArray boundary, jobject callback_op, jobject op_data) { herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Pset_append_flush: op_data is NULL"); @@ -5210,7 +5217,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1append_1flush h5nullArgument(env, "H5Pset_append_flush: callback_op is NULL"); } /* end if */ else { - status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t*)boundary, (H5D_append_cb_t)H5D_append_cb, (void*)op_data); + status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t*)boundary, (H5D_append_cb_t)H5D_append_cb, (void*)&wrapper); if (status < 0) h5libraryError(env); @@ -5603,13 +5610,16 @@ Java_hdf_hdf5lib_H5_H5Pinsert2 static herr_t H5P_iterate_cb - (hid_t prop_id, const char *name, void *op_data) + (hid_t prop_id, const char *name, void *cb_data) { JNIEnv *cbenv; jint status = -1; jclass cls; jmethodID mid; jstring str; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; /* fprintf(stderr, "\nJNI H5P_iterate_cb entered\n"); fflush(stderr); */ if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { @@ -5656,9 +5666,9 @@ Java_hdf_hdf5lib_H5_H5Piterate herr_t status = -1; jint *theArray = NULL; jboolean isCopy; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Piterate: op_data is NULL"); @@ -5668,7 +5678,7 @@ Java_hdf_hdf5lib_H5_H5Piterate } /* end else if */ else { if (idx == NULL) { - status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void*)op_data); + status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void*)&wrapper); } /* end if */ else { theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR idx, &isCopy); @@ -5676,7 +5686,7 @@ Java_hdf_hdf5lib_H5_H5Piterate h5JNIFatalError(env, "H5Piterate: idx not pinned"); } /* end if */ else - status = H5Piterate((hid_t)prop_id, (int*)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void*)op_data); + status = H5Piterate((hid_t)prop_id, (int*)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void*)&wrapper); } /* end else */ if (status < 0) { diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c index ffd5b7a..d551120 100644 --- a/java/src/jni/h5plImp.c +++ b/java/src/jni/h5plImp.c @@ -27,7 +27,6 @@ extern "C" { #include "h5plImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c index b250550..5f2b86d 100644 --- a/java/src/jni/h5rImp.c +++ b/java/src/jni/h5rImp.c @@ -27,7 +27,6 @@ extern "C" { #include "h5rImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c index 10f69eb..65cdd7b 100644 --- a/java/src/jni/h5sImp.c +++ b/java/src/jni/h5sImp.c @@ -27,7 +27,6 @@ extern "C" { #include "h5sImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 @@ -572,7 +571,7 @@ Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple h5JNIFatalError(env, "H5Pset_simple_extent: dims not pinned"); return -1; } /* end if */ - sa = lp = (hsize_t *) malloc((size_t)rank * sizeof(hsize_t)); + sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)); if (sa == NULL) { ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); h5JNIFatalError(env, "H5Sset_simple_extent: dims not converted to hsize_t"); @@ -1018,7 +1017,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist h5JNIFatalError(env, "H5Sget_select_hyper_blocklist: buf not pinned"); } /* end if */ else { - ba = (hsize_t *) malloc((size_t)nb * 2 * (size_t)rank * sizeof(hsize_t)); + ba = (hsize_t *) HDmalloc((size_t)nb * 2 * (size_t)rank * sizeof(hsize_t)); if (ba == NULL) { ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT); h5JNIFatalError(env, "H5Screate-simple: buffer not converted to hsize_t"); @@ -1136,7 +1135,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds return -1; } /* end if */ rank = (int) ENVPTR->GetArrayLength(ENVPAR start); - strt = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t)); + strt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); if (strt == NULL) { ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); h5JNIFatalError(env, "H5Sget_select_bounds: start not converted to hsize_t"); diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c index 7b4af56..307f1a5 100644 --- a/java/src/jni/h5tImp.c +++ b/java/src/jni/h5tImp.c @@ -30,7 +30,6 @@ extern "C" { #include "h5tImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 33dca7f..fd34ba1 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -33,7 +33,6 @@ hsize_t H5TOOLS_BUFSIZE = (32 * 1024 * 1024); /* 32 MB */ int H5TOOLS_TEXT_BLOCK = 16; /* Number of elements on a line in a text export file */ JavaVM *jvm; -jobject visit_callback; jobject copy_callback; jobject close_callback; jobject create_callback; @@ -1769,7 +1768,7 @@ h5str_render_bin_output if (H5Tis_variable_str(tid)) { s = *(char**) mem; if (s != NULL) - size = strlen(s); + size = HDstrlen(s); } else { s = (char *) mem; @@ -2130,11 +2129,11 @@ render_bin_output_region_data_points ret_value = -1; HDfree(dims1); - } /* end if((dims1 = (hsize_t *) malloc(sizeof(hsize_t) * ndims)) != NULL) */ + } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ else ret_value = -1; HDfree(region_buf); - } /* end if((region_buf = malloc(type_size * (size_t)npoints)) != NULL) */ + } /* end if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) */ else ret_value = -1; @@ -2437,7 +2436,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex H5Tclose(p_type); n = ENVPTR->GetArrayLength(ENVPAR buf); - rdata = (char *)malloc((size_t)n * size); + rdata = (char *)HDmalloc((size_t)n * size); if (rdata == NULL) { h5JNIFatalError(env, "H5AreadComplex: failed to allocate buff for read"); } /* end if */ @@ -2953,7 +2952,7 @@ obj_info_all if (retVal < 0) { *(datainfo->otype+datainfo->count) = -1; *(datainfo->ltype+datainfo->count) = -1; - *(datainfo->objname+datainfo->count) = (char *)HDmalloc(strlen(name)+1); + *(datainfo->objname+datainfo->count) = (char *)HDmalloc(HDstrlen(name)+1); HDstrcpy(*(datainfo->objname+datainfo->count), name); *(datainfo->objno+datainfo->count) = (unsigned long)-1; } /* end if */ diff --git a/java/test/TestH5.java b/java/test/TestH5.java index b922583..54603ca 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -162,7 +162,7 @@ public class TestH5 { */ @Test public void testH5get_libversion() { - int libversion[] = { 1, 11, 2 }; + int libversion[] = { 1, 11, 4 }; try { H5.H5get_libversion(libversion); @@ -184,7 +184,7 @@ public class TestH5 { */ @Test public void testH5check_version() { - int majnum = 1, minnum = 11, relnum = 2; + int majnum = 1, minnum = 11, relnum = 4; try { H5.H5check_version(majnum, minnum, relnum); diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index 656069a..fd015c0 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -37,6 +37,7 @@ import org.junit.rules.TestName; public class TestH5E { @Rule public TestName testname = new TestName(); + long hdf_java_classid = -1; long current_stackid = -1; @@ -75,7 +76,7 @@ public class TestH5E { public void testH5Eget_msg_major() { try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (HDF5LibraryException hdferr) { long errnum = hdferr.getMajorErrorNumber(); @@ -89,7 +90,7 @@ public class TestH5E { fail("H5.H5Eget_msg(Throwable): " + err); } assertNotNull("H5.H5Eget_msg: " + msg, msg); - assertEquals("H5.H5Eget_msg: ", "Object atom", msg); + assertEquals("H5.H5Eget_msg: ", "File accessibility", msg); assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR, error_msg_type[0]); } catch (Throwable err) { @@ -101,7 +102,7 @@ public class TestH5E { @Test public void testH5Eget_msg_minor() { try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (HDF5LibraryException hdferr) { long errnum = hdferr.getMinorErrorNumber(); @@ -115,7 +116,7 @@ public class TestH5E { fail("H5.H5Eget_msg: " + err); } assertNotNull("H5.H5Eget_msg: " + msg, msg); - assertEquals("H5.H5Eget_msg: ", "Unable to find atom information (already closed?)", msg); + assertEquals("H5.H5Eget_msg: ", "Unable to open file", msg); assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MINOR, error_msg_type[0]); } catch (Throwable err) { @@ -126,6 +127,10 @@ public class TestH5E { @Test public void testH5Epop() { + + long num_msg = -1; + long saved_num_msg = -1; + try { H5.H5Eset_current_stack(current_stackid); } @@ -135,12 +140,12 @@ public class TestH5E { } try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } - // save current stack contents + // Save current stack contents try { current_stackid = H5.H5Eget_current_stack(); } @@ -149,7 +154,6 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - long num_msg = -1; try { num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -168,8 +172,9 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Epop #:" + num_msg, num_msg > 0); + saved_num_msg = num_msg; try { H5.H5Epop(current_stackid, 1); } @@ -186,7 +191,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop", num_msg == 3); + assertTrue("H5.H5Epop", num_msg == saved_num_msg - 1); } @Test @@ -293,12 +298,12 @@ public class TestH5E { fail("testH5Ewalk:H5Eset_current_stack " + err); } try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } - // save current stack contents + // Save current stack contents try { current_stackid = H5.H5Eget_current_stack(); } @@ -314,7 +319,7 @@ public class TestH5E { err.printStackTrace(); fail("testH5Ewalk:H5Eget_num " + err); } - assertTrue("testH5Ewalk #:" + num_msg, num_msg == 4); + assertTrue("testH5Ewalk #:" + num_msg, num_msg > 0); try { H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data); @@ -324,7 +329,8 @@ public class TestH5E { fail("testH5Ewalk:H5Ewalk2 " + err); } assertFalse("testH5Ewalk:H5Ewalk2 ",((H5E_walk_data)walk_data).walkdata.isEmpty()); - assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size()==4); + assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size() > 0); } } + diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index 5324d3a..591793f 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -29,6 +29,8 @@ import org.junit.rules.TestName; public class TestH5Edefault { @Rule public TestName testname = new TestName(); + public static final int ERRSTACK_CNT = 6; + @Before public void H5Eset_default_stack() { assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); @@ -56,7 +58,7 @@ public class TestH5Edefault { @Test public void testH5Eprint() { try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } @@ -73,17 +75,18 @@ public class TestH5Edefault { public void testH5Eget_current_stack() { long num_msg = -1; long num_msg_default = -1; + long saved_num_msg = -1; long stack_id = -1; long stack_id_default = HDF5Constants.H5E_DEFAULT; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { //default stack id will be different after exception stack_id_default = HDF5Constants.H5E_DEFAULT; //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have messages on the error stack try { num_msg_default = H5.H5Eget_num(stack_id_default); } @@ -91,9 +94,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default > 0); + saved_num_msg = num_msg_default; - //Save a copy of the current stack and clears the current stack + // Save a copy of the current stack and clear the current stack try { stack_id = H5.H5Eget_current_stack(); } @@ -104,7 +108,7 @@ public class TestH5Edefault { assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id < 0); assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id == stack_id_default); - // Verify we have the correct number of messages + // Verify the default stack is empty try { num_msg_default = H5.H5Eget_num(stack_id_default); } @@ -114,7 +118,7 @@ public class TestH5Edefault { } assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 0); - //Verify the copy has the correct number of messages + // Verify the copy has the same number of messages as the original try { num_msg = H5.H5Eget_num(stack_id); } @@ -122,7 +126,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); try { H5.H5Eclose_stack(stack_id); @@ -137,15 +141,16 @@ public class TestH5Edefault { public void testH5Eget_current_stack_pop() { long num_msg = -1; long num_msg_default = -1; + long saved_num_msg = -1; long stack_id = -1; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify there are error messages on the stack and save it try { num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -153,9 +158,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default > 0); + saved_num_msg = num_msg_default; - //Save a copy of the current stack and clears the current stack + // Save a copy of the current stack and clear the current stack try { stack_id = H5.H5Eget_current_stack(); } @@ -166,7 +172,7 @@ public class TestH5Edefault { assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id < 0); assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id == HDF5Constants.H5E_DEFAULT); - // Verify we have the correct number of messages + // Verify the stack is empty try { num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -176,7 +182,7 @@ public class TestH5Edefault { } assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 0); - //Verify the copy has the correct number of messages + // Verify the copy has the correct number of messages try { num_msg = H5.H5Eget_num(stack_id); } @@ -184,17 +190,17 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); - //Generate errors on default stack + // Generate errors on default stack try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have a nonzero number of messages and save it try { num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -202,9 +208,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default > 0); + saved_num_msg = num_msg; - //Remove one message from the current stack + // Remove one message from the current stack try { H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -213,9 +220,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == 3); + assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == saved_num_msg - 1); - //Verify the copy still has the correct number of messages + // Verify the copy still has the old number of messages try { num_msg = H5.H5Eget_num(stack_id); } @@ -223,7 +230,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); } @Test(expected = IllegalArgumentException.class) @@ -278,14 +285,17 @@ public class TestH5Edefault { public void testH5Eset_current_stack() { long num_msg = -1; long stack_id = -1; + long saved_num_msg = -1; + + // Generate errors on the default stack try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have a nonzero number of messages and save it try { num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -293,9 +303,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg > 0); + saved_num_msg = num_msg; - //Save a copy of the current stack + // Save a copy of the current stack try { stack_id = H5.H5Eget_current_stack(); } @@ -306,7 +317,7 @@ public class TestH5Edefault { assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id, stack_id < 0); assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id, stack_id == HDF5Constants.H5E_DEFAULT); - //Verify the copy has the correct number of messages + // Verify the copy has the same number of messages as the original stack try { num_msg = H5.H5Eget_num(stack_id); } @@ -314,17 +325,17 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); - //Generate errors on default stack + // Generate errors on default stack (again, in the same way) try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have the same number of messages as before try { num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -332,9 +343,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); - //Remove one message from the current stack + // Remove one message from the current stack try { H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -343,9 +354,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == 3); + assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == saved_num_msg - 1); - //Verify the copy still has the correct number of messages + // Verify the copy still has the correct number of messages try { num_msg = H5.H5Eget_num(stack_id); } @@ -353,8 +364,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); + // Se the current stack to be the default and try that again try { H5.H5Eset_current_stack(stack_id); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -363,7 +375,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == saved_num_msg); } @Test(expected = IllegalArgumentException.class) @@ -374,8 +386,9 @@ public class TestH5Edefault { @Test public void testH5Epop() throws Throwable { long num_msg = -1; + long saved_num_msg = -1; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } @@ -386,7 +399,8 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop before #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Epop before #:" + num_msg, num_msg > 0); + saved_num_msg = num_msg; try { H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -395,7 +409,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop after #:" + num_msg, num_msg == 3); + assertTrue("H5.H5Epop after #:" + num_msg, num_msg == saved_num_msg - 1); } @Test(expected = IllegalArgumentException.class) @@ -416,7 +430,7 @@ public class TestH5Edefault { @Test public void testH5EprintInt() { try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } @@ -460,7 +474,7 @@ public class TestH5Edefault { public void testH5Eclear2_with_msg() { long num_msg = -1; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } @@ -471,7 +485,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eclear2_with_msg: " + err); } - assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg > 0); try { H5.H5Eclear2(HDF5Constants.H5E_DEFAULT); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -523,7 +537,7 @@ public class TestH5Edefault { public void testH5Eget_num_with_msg() { long num_msg = -1; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } @@ -538,3 +552,4 @@ public class TestH5Edefault { } } + diff --git a/java/test/TestH5Z.java b/java/test/TestH5Z.java index 31adf22..f3049ed 100644 --- a/java/test/TestH5Z.java +++ b/java/test/TestH5Z.java @@ -41,8 +41,8 @@ public class TestH5Z { @Test public void testH5Zfilter_avail() { try { - int filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); - assertTrue("H5.H5Zfilter_avail_DEFLATE", filter_found > 0); + int filter_found; + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_FLETCHER32); assertTrue("H5.H5Zfilter_avail_FLETCHER32", filter_found > 0); filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_NBIT); @@ -51,8 +51,12 @@ public class TestH5Z { assertTrue("H5.H5Zfilter_avail_SCALEOFFSET", filter_found > 0); filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SHUFFLE); assertTrue("H5.H5Zfilter_avail_SHUFFLE", filter_found > 0); -// filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP); -// assertTrue("H5.H5Zfilter_avail_SZIP", filter_found > 0); + + // Just make sure H5Zfilter_avail() doesn't fail with szip/zlib + // since there is no way for us to determine if they should be present + // or not. + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP); } catch (Throwable err) { err.printStackTrace(); @@ -63,9 +67,8 @@ public class TestH5Z { @Test public void testH5Zget_filter_info() { try { - int filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); - assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); - assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + int filter_flag; + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_FLETCHER32); assertTrue("H5.H5Zget_filter_info_FLETCHER32_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); assertTrue("H5.H5Zget_filter_info_FLETCHER32_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); @@ -78,9 +81,19 @@ public class TestH5Z { filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SHUFFLE); assertTrue("H5.H5Zget_filter_info_DECODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); assertTrue("H5.H5Zget_filter_info_ENCODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); -// filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP); -// assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); -// assertTrue("H5.H5Zget_filter_info_ENCODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + + if(1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE)) { + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); + assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + } + + if(1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP)) { + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP); + // Decode should always be available, but we have no way of determining + // if encode is so don't assert on that. + assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + } } catch (Throwable err) { err.printStackTrace(); @@ -96,3 +109,4 @@ public class TestH5Z { H5.H5Zunregister(HDF5Constants.H5Z_FILTER_SHUFFLE); } } + diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 5d69bee..350fb7b 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -59,11 +59,13 @@ LIST_LIBRARY_FILES=" $top_builddir/src/.libs/libhdf5.* $top_builddir/java/src/jni/.libs/libhdf5_java.* " -LIST_JAR_FILES=" +LIST_JAR_TESTFILES=" $HDFLIB_HOME/hamcrest-core.jar $HDFLIB_HOME/junit.jar $HDFLIB_HOME/slf4j-api-1.7.25.jar $HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar +" +LIST_JAR_FILES=" $top_builddir/java/src/$JARFILE " LIST_DATA_FILES=" @@ -109,6 +111,7 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5Giterate.txt # copy files from source dirs to test dir # COPY_LIBFILES="$LIST_LIBRARY_FILES" +COPY_JARTESTFILES="$LIST_JAR_TESTFILES" COPY_JARFILES="$LIST_JAR_FILES" COPY_LIBFILES_TO_BLDLIBDIR() @@ -138,6 +141,29 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi done # copy jar files. Used -f to make sure get a new copy + for tstfile in $COPY_JARTESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done for tstfile in $COPY_JARFILES do # ignore '#' comment @@ -172,7 +198,10 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDLIBDIR + for tstfile in $COPY_JARTESTFILES + do + $RM $BLDLIBDIR/tstfile + done fi } @@ -281,11 +310,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then fi case $os_name in - Darwin) - DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH - export DYLD_LIBRARY_PATH - LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - ;; *) LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH ;; @@ -986,53 +1010,48 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Z.txt JUnit-TestH5Z.out |sed 's/^/ /' fi -if test "X-$BUILD_MODE" = "X-production" ; then - if test $USE_FILTER_SZIP = "yes"; then - echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E" - TESTING JUnit-TestH5E - ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E > JUnit-TestH5E.ext) - - # Extract file name, line number, version and thread IDs because they may be different - sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ - -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ - JUnit-TestH5E.ext > JUnit-TestH5E.out - - if diff JUnit-TestH5E.out JUnit-TestH5E.txt > /dev/null; then - echo " PASSED JUnit-TestH5E" - else - echo "**FAILED** JUnit-TestH5E" - echo " Expected result differs from actual result" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF JUnit-TestH5E.txt JUnit-TestH5E.out |sed 's/^/ /' - fi - fi +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E" +TESTING JUnit-TestH5E +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E > JUnit-TestH5E.ext) - if test $USE_FILTER_SZIP = "yes"; then - echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault" - TESTING JUnit-TestH5Edefault - ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault > JUnit-TestH5Edefault.ext) - - # Extract file name, line number, version and thread IDs because they may be different - sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ - -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ - JUnit-TestH5Edefault.ext > JUnit-TestH5Edefault.out - - if diff JUnit-TestH5Edefault.out JUnit-TestH5Edefault.txt > /dev/null; then - echo " PASSED JUnit-TestH5Edefault" - else - echo "**FAILED** JUnit-TestH5Edefault" - echo " Expected result differs from actual result" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF JUnit-TestH5Edefault.txt JUnit-TestH5Edefault.out |sed 's/^/ /' - fi - fi +# Extract file name, line number, version and thread IDs because they may be different +sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + JUnit-TestH5E.ext > JUnit-TestH5E.out + +if diff JUnit-TestH5E.out JUnit-TestH5E.txt > /dev/null; then + echo " PASSED JUnit-TestH5E" +else + echo "**FAILED** JUnit-TestH5E" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF JUnit-TestH5E.txt JUnit-TestH5E.out |sed 's/^/ /' fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault" +TESTING JUnit-TestH5Edefault +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault > JUnit-TestH5Edefault.ext) + +# Extract file name, line number, version and thread IDs because they may be different +sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + JUnit-TestH5Edefault.ext > JUnit-TestH5Edefault.out + +if diff JUnit-TestH5Edefault.out JUnit-TestH5Edefault.txt > /dev/null; then + echo " PASSED JUnit-TestH5Edefault" +else + echo "**FAILED** JUnit-TestH5Edefault" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF JUnit-TestH5Edefault.txt JUnit-TestH5Edefault.out |sed 's/^/ /' +fi + if test $USE_FILTER_SZIP = "yes"; then echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Giterate" TESTING JUnit-TestH5Giterate diff --git a/java/test/testfiles/JUnit-TestH5Edefault.txt b/java/test/testfiles/JUnit-TestH5Edefault.txt index 62497f9..71d1431 100644 --- a/java/test/testfiles/JUnit-TestH5Edefault.txt +++ b/java/test/testfiles/JUnit-TestH5Edefault.txt @@ -34,27 +34,39 @@ OK (28 tests) HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): unable to open file - major: File accessibilty + major: File accessibility minor: Unable to open file - #001: (file name) line (number) in H5F__open(): unable to open file - major: File accessibilty + #001: (file name) line (number) in H5VL_file_open(): open failed + major: Virtual Object Layer + minor: Unable to initialize object + #002: (file name) line (number) in H5VL_native_file_open(): unable to open file + major: File accessibility + minor: Unable to open file + #003: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 + major: File accessibility + minor: Unable to open file + #004: (file name) line (number) in H5FD_open(): open failed + major: Virtual File Layer + minor: Unable to initialize object + #005: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2 + major: File accessibility minor: Unable to open file - #002: (file name) line (number) in H5F_open(): unable to retrieve VFL class - major: File accessibilty - minor: Can't get value - #003: (file name) line (number) in H5FD_get_class(): can't find object for ID - major: Object atom - minor: Unable to find atom information (already closed?) HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): unable to open file - major: File accessibilty + major: File accessibility + minor: Unable to open file + #001: (file name) line (number) in H5VL_file_open(): open failed + major: Virtual Object Layer + minor: Unable to initialize object + #002: (file name) line (number) in H5VL_native_file_open(): unable to open file + major: File accessibility + minor: Unable to open file + #003: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 + major: File accessibility minor: Unable to open file - #001: (file name) line (number) in H5F__open(): unable to open file - major: File accessibilty + #004: (file name) line (number) in H5FD_open(): open failed + major: Virtual File Layer + minor: Unable to initialize object + #005: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2 + major: File accessibility minor: Unable to open file - #002: (file name) line (number) in H5F_open(): unable to retrieve VFL class - major: File accessibilty - minor: Can't get value - #003: (file name) line (number) in H5FD_get_class(): can't find object for ID - major: Object atom - minor: Unable to find atom information (already closed?) diff --git a/release_docs/INSTALL b/release_docs/INSTALL index baad559..5c54698 100644 --- a/release_docs/INSTALL +++ b/release_docs/INSTALL @@ -2,11 +2,11 @@ Instructions for the Installation of HDF5 Software ================================================== -This file provides instructions for installing the HDF5 software. +This file provides instructions for installing the HDF5 software. For help with installing, questions can be posted to the HDF Forum or sent to the HDF Helpdesk: - HDF Forum: https://forum.hdfgroup.org/ + HDF Forum: https://forum.hdfgroup.org/ HDF Helpdesk: https://portal.hdfgroup.org/display/support/The+HDF+Help+Desk CONTENTS @@ -52,8 +52,8 @@ CONTENTS 1. Obtaining HDF5 The latest supported public release of HDF5 is available from - https://www.hdfgroup.org/downloads/hdf5/. For Unix and UNIX-like - platforms, it is available in tar format compressed with gzip. + https://www.hdfgroup.org/downloads/hdf5/. For Unix and UNIX-like + platforms, it is available in tar format compressed with gzip. For Microsoft Windows, it is in ZIP format. @@ -77,14 +77,14 @@ CONTENTS $ tar zxf hdf5-X.Y.Z.tar.gz <configure_flags> above refers to the configure flags appropriate - to your installation. For example, to install HDF5 with the - Fortran and C++ interfaces and with SZIP compression, the + to your installation. For example, to install HDF5 with the + Fortran and C++ interfaces and with SZIP compression, the configure line might read as follows: - + $ ./configure --prefix=/usr/local/hdf5 --enable-fortran \ --enable-cxx --with-szlib=PATH_TO_SZIP - In this case, PATH_TO_SZIP would be replaced with the path to the + In this case, PATH_TO_SZIP would be replaced with the path to the installed location of the SZIP library. 2.1. Windows @@ -101,7 +101,7 @@ CONTENTS 3. HDF5 dependencies 3.1. Zlib - The HDF5 library includes a predefined compression filter that + The HDF5 library includes a predefined compression filter that uses the "deflate" method for chunked datasets. If zlib-1.1.2 or later is found, HDF5 will use it. Otherwise, HDF5's predefined compression method will degenerate to a no-op; the compression @@ -122,17 +122,17 @@ CONTENTS include the Szip library with the encoder enabled. These can be found here: - https://www.hdfgroup.org/downloads/hdf5/ + https://www.hdfgroup.org/downloads/hdf5/ To configure the HDF5 library with the Szip compression filter, use the '--with-szlib=/PATH_TO_SZIP' flag. For more information, see section 4.3.7, "Specifying other libraries and headers." Please notice that if HDF5 configure cannot find a valid Szip library, - configure will not fail; in this case, the compression filter will + configure will not fail; in this case, the compression filter will not be available to the applications. - To check if Szip compression was successfully configured in, + To check if Szip compression was successfully configured in, check the "I/O filters (external):" line in the configure output, summary section, printed to the standard output. @@ -188,7 +188,7 @@ CONTENTS detects various features of the host system and creates the Makefiles. On most systems it should be sufficient to say: - $ ./configure + $ ./configure Or $ sh configure @@ -218,15 +218,15 @@ CONTENTS before the library and executables are built. HDF5 can be installed into a different location than the prefix - specified at configure time; see section 4.6, "Installing HDF5," + specified at configure time; see section 4.6, "Installing HDF5," for more details. 4.3.2. Using an alternate C compiler By default, configure will look for the C compiler by trying `gcc' and `cc'. However, if the environment variable "CC" is set - then its value is used as the C compiler. For instance, one would - use the following line to specify the native C compiler on a system - that also has the GNU gcc compiler (users of csh and derivatives + then its value is used as the C compiler. For instance, one would + use the following line to specify the native C compiler on a system + that also has the GNU gcc compiler (users of csh and derivatives will need to prefix the commands below with `env'): $ CC=cc ./configure @@ -257,7 +257,7 @@ CONTENTS $ ./configure --enable-fortran $ ./configure --enable-cxx $ ./configure --enable-java - + Configuration will halt if a working Fortran 90 or 95 compiler or C++ compiler is not found. Currently, the Fortran configure tests for these compilers in order: f90, pgf90, f95. To use an @@ -267,7 +267,7 @@ CONTENTS 4.3.5. Specifying other programs - The build system has been tuned for use with GNU make but also + The build system has been tuned for use with GNU make but also works with other versions of make. If the `make' command runs a non-GNU version but a GNU version is available under a different name (perhaps `gmake'), then HDF5 can be configured to use it by @@ -286,8 +286,8 @@ CONTENTS during `make install' (described below) with a BSD-compatible install program detected automatically by configure. If none is found, the shell script bin/install-sh is used. Configure does not - check that the install script actually works; if a bad install is - detected on your system (e.g., on the ASCI blue machine as of + check that the install script actually works; if a bad install is + detected on your system (e.g., on the ASCI blue machine as of March 2, 1999) you have two choices: 1. Copy the bin/install-sh program to your $HOME/bin @@ -310,11 +310,11 @@ CONTENTS LDFLAGS=-L/home/robb/lib \ ./configure - HDF5 uses the zlib library to support the HDF5 deflate - data compression filter. Configure searches the standard places - (plus those specified above with the CPPFLAGS and LDFLAGS variables) - for the zlib headers and library. The search can be disabled by - specifying `--without-zlib' or alternate directories can be specified + HDF5 uses the zlib library to support the HDF5 deflate + data compression filter. Configure searches the standard places + (plus those specified above with the CPPFLAGS and LDFLAGS variables) + for the zlib headers and library. The search can be disabled by + specifying `--without-zlib' or alternate directories can be specified with `--with-zlib=INCDIR,LIBDIR' or through the CPPFLAGS and LDFLAGS variables: @@ -324,8 +324,8 @@ CONTENTS LDFLAGS=-L/usr/unsup/lib \ ./configure - HDF5 includes Szip as a predefined compression method (see 3.2). - To enable Szip compression, the HDF5 library must be configured + HDF5 includes Szip as a predefined compression method (see 3.2). + To enable Szip compression, the HDF5 library must be configured and built using the Szip library: $ ./configure --with-szlib=/Szip_Install_Directory @@ -350,10 +350,10 @@ CONTENTS The library can be compiled to provide symbolic debugging support so it can be debugged with gdb, dbx, ddd, etc., or it can be compiled with various optimizations. To compile for symbolic - debugging (the default for snapshots), say - `--enable-build-mode=production'; to compile with optimizations - (the default for supported public releases), - say `--enable-build-mode=production'. On some systems the + debugging (the default for snapshots), say + `--enable-build-mode=production'; to compile with optimizations + (the default for supported public releases), + say `--enable-build-mode=production'. On some systems the library can also be compiled for profiling with gprof by saying `--enable-production=profile'. @@ -362,13 +362,13 @@ CONTENTS $ ./configure --enable-production=profile #for use with gprof Regardless of whether support for symbolic debugging is enabled, - the library can also perform runtime debugging of certain packages - (such as type conversion execution times and extensive invariant - condition checking). To enable this debugging, supply a - comma-separated list of package names to the `--enable-internal-debug' - switch. + the library can also perform runtime debugging of certain packages + (such as type conversion execution times and extensive invariant + condition checking). To enable this debugging, supply a + comma-separated list of package names to the `--enable-internal-debug' + switch. - Debugging can be disabled by saying `--disable-internal-debug'. + Debugging can be disabled by saying `--disable-internal-debug'. The default debugging level for snapshots is a subset of the available packages; the default for supported releases is no debugging (debugging can incur a significant runtime penalty). @@ -378,10 +378,10 @@ CONTENTS $ ./configure --enable-internal-debug=all #debug all packages $ ./configure --disable-internal-debug #no debugging - HDF5 can also print a trace of all API function calls, their + HDF5 can also print a trace of all API function calls, their arguments, and the return values. To enable or disable the ability to trace the API say `--enable-trace' (the default for - snapthots) or `--disable-trace' (the default for public releases). + snapthots) or `--disable-trace' (the default for public releases). The tracing must also be enabled at runtime to see any output. 4.3.9. Parallel versus serial library @@ -389,25 +389,39 @@ CONTENTS parallelism on a distributed multi-processor system. Read the file INSTALL_parallel for detailed information. + The threadsafe, C++ and Java interfaces are not compatible + with the parallel option. + Unless --enable-unsupported has been specified on the configure line, + the following options must be disabled: + --enable-threadsafe, --enable-cxx, --enable-java + + 4.3.10. Threadsafe capability The HDF5 library can be configured to be thread-safe (on a very large scale) with the `--enable-threadsafe' flag to the configure script. Some platforms may also require the '-with-pthread=INC,LIB' (or '--with-pthread=DIR') flag to the configure script. - For further information, see: + For further information, see: https://portal.hdfgroup.org/display/knowledge/Questions+about+thread-safety+and+concurrent+access + The high-level, C++, Fortran and Java interfaces are not compatible + with the thread-safety option because the lock is not hoisted + into the higher-level API calls. + Unless --enable-unsupported has been specified on the configure line, + the following options must be disabled: + --enable-hl, --enable-cxx, --enable-fortran, --enable-java + 4.3.11. Backward compatibility The 1.10 version of the HDF5 library can be configured to operate - identically to the v1.8 library with the + identically to the v1.8 library with the --with-default-api-version=v18 - configure flag, or identically to the v1.6 library with the + configure flag, or identically to the v1.6 library with the --with-default-api-version=v16 configure flag. This allows existing code to be compiled with the - v1.10 library without requiring immediate changes to the application - source code. For additional configuration options and other details, + v1.10 library without requiring immediate changes to the application + source code. For additional configuration options and other details, see "API Compatibility Macros": https://portal.hdfgroup.org/display/HDF5/API+Compatibility+Macros @@ -487,7 +501,7 @@ CONTENTS $ make install prefix=NEW_DIR - where NEW_DIR is the new directory where you wish to install HDF5. + where NEW_DIR is the new directory where you wish to install HDF5. If you do not use the deploy script, you should run h5redeploy in NEW_DIR/bin directory. This utility will fix the h5cc, h5fc and h5c++ scripts to reflect the new NEW_DIR location. @@ -510,7 +524,7 @@ CONTENTS The configuration information: ./src/H5pubconf.h - + The support programs that are useful are: ./tools/h5ls/h5ls (list file contents) ./tools/h5dump/h5dump (dump file contents) @@ -518,12 +532,12 @@ CONTENTS ./tools/misc/h5debug (low-level file debugging) ./tools/h5import/h5import (imports data to HDF5 file) ./tools/h5diff/h5diff (compares two HDF5 files) - ./tools/gifconv/h52gif (HDF5 to GIF converter) + ./tools/gifconv/h52gif (HDF5 to GIF converter) ./tools/gifconv/gif2h5 (GIF to HDF5 converter) 5. Using the Library - + For information on using HDF5 see the documentation, tutorials and examples found here: diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 708e713..edd876a 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -12,6 +12,7 @@ Section IV: Further considerations Section V: Options for building HDF5 Libraries with CMake command line Section VI: CMake option defaults for HDF5 Section VII: User Defined Options for HDF5 Libraries with CMake +Section VIII: User Defined Compile Flags for HDF5 Libraries with CMake ************************************************************************ @@ -274,9 +275,14 @@ IV. Further considerations packages there. Add the following CMake options: -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include + -DZLIB_USE_EXTERNAL:BOOL=OFF -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include + -DSZIP_USE_EXTERNAL:BOOL=OFF where "some_location" is the full path to the extlibs folder. + Also the appropriate environment variable must be set; + set(ENV{ZLIB_ROOT} "some_location") + set(ENV{SZIP_ROOT} "some_location") B. Use source packages from an GIT server by adding the following CMake options: @@ -318,6 +324,34 @@ IV. Further considerations -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF \ -DCMAKE_BUILD_TYPE:STRING=Release .. + 6. CMake uses a toolchain of utilities to compile, link libraries and + create archives, and other tasks to drive the build. The toolchain + utilities available are determined by the languages enabled. In normal + builds, CMake automatically determines the toolchain for host builds + based on system introspection and defaults. In cross-compiling + scenarios, a toolchain file may be specified with information about + compiler and utility paths. + Variables and Properties + Several variables relate to the language components of a toolchain which + are enabled. CMAKE_<LANG>_COMPILER is the full path to the compiler used + for <LANG>. CMAKE_<LANG>_COMPILER_ID is the identifier used by CMake for + the compiler and CMAKE_<LANG>_COMPILER_VERSION is the version of the compiler. + + The CMAKE_<LANG>_FLAGS variables and the configuration-specific equivalents + contain flags that will be added to the compile command when compiling a + file of a particular language. + + As the linker is invoked by the compiler driver, CMake needs a way to + determine which compiler to use to invoke the linker. This is calculated + by the LANGUAGE of source files in the target, and in the case of static + libraries, the language of the dependent libraries. The choice CMake makes + may be overridden with the LINKER_LANGUAGE target property. + + See the CMake help for more information on using toolchain files. + + To use a toolchain file with the supplied cmake scripts, see the + HDF5options.cmake file under the toolchain section. + Notes: CMake and HDF5 1. Using CMake for building and using HDF5 is under active development. @@ -491,7 +525,7 @@ These five steps are described in detail below. Release and build the solution. 3.2.1 The external libraries (zlib and szip) can be configured - to allow building the libraries by downloading from an GIT repository. + to allow building the libraries by downloading from a GIT repository. The option is 'HDF5_ALLOW_EXTERNAL_SUPPORT'; by adding the following configuration option: -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="GIT" @@ -508,7 +542,7 @@ These five steps are described in detail below. adding the following configuration option: -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ" - The options to control the SVN URL (config/cmake/cacheinit.cmake + The options to control the TGZ URL (config/cmake/cacheinit.cmake file) are: ZLIB_TGZ_NAME:STRING="zlib_src.ext" SZIP_TGZ_NAME:STRING="szip_src.ext" @@ -590,6 +624,7 @@ HDF5_BUILD_TOOLS "Build HDF5 Tools" ON ---------------- HDF5 Advanced Options --------------------- ALLOW_UNSUPPORTED "Allow unsupported combinations of configure options" OFF +HDF5_EXTERNAL_LIB_PREFIX "Use prefix for custom library naming." "" HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" OFF HDF5_ENABLE_CODESTACK "Enable the function stack tracing (for developer debugging)." OFF @@ -618,6 +653,8 @@ HDF_TEST_EXPRESS "Control testing framework (0-3)" HDF5_TEST_VFD "Execute tests with different VFDs" OFF HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF HDF5_USE_18_API_DEFAULT "Use the HDF5 1.8.x API by default" OFF +HDF5_USE_110_API_DEFAULT "Use the HDF5 1.10.x API by default" OFF +HDF5_USE_112_API_DEFAULT "Use the HDF5 1.12.x API by default" ON HDF5_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON HDF5_WANT_DCONV_EXCEPTION "exception handling functions is checked during data conversions" ON @@ -649,6 +686,20 @@ NOTE: flag is not available on windows and some modern linux systems will ignore the flag. + ---------------- Unsupported Library Options --------------------- + The threadsafe, C++ and Java interfaces are not compatible + with the HDF5_ENABLE_PARALLEL option. + Unless ALLOW_UNSUPPORTED has been specified, + the following options must be disabled: + HDF5_ENABLE_THREADSAFE, HDF5_BUILD_CPP_LIB, HDF5_BUILD_JAVA + + The high-level, C++, Fortran and Java interfaces are not compatible + with the HDF5_ENABLE_THREADSAFE option because the lock is not hoisted + into the higher-level API calls. + Unless ALLOW_UNSUPPORTED has been specified, + the following options must be disabled: + HDF5_BUILD_HL_LIB, HDF5_BUILD_CPP_LIB, HDF5_BUILD_FORTRAN, HDF5_BUILD_JAVA + ======================================================================== VII. User Defined Options for HDF5 Libraries with CMake @@ -663,6 +714,30 @@ Copy the contents of the file, both macro and option, into the UserMacros.cmake file. Then enable the option to the CMake configuration, build and test process. + +======================================================================== +VIII. User Defined Compile Flags for HDF5 Libraries with CMake +======================================================================== + +Custom compiler flags can be added by defining the CMAKE_C_FLAGS and +CMAKE_CXX_FLAGS variables. +Using a cmake script: + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") +Defined on the configure line: + cmake -G "Visual Studio 12 2013" -DCMAKE_C_FLAGS:STRING=-O2 .. + +Debug symbols are enabled with configuration selections Debug or RelWithDebInfo. +The difference between Debug and RelWithDebInfo configurations is that +RelWithDebInfo optimizes the code similar to Release. It produces fully optimized +code, but also creates the symbol table and the debug metadata to give the +debugger input to map the execution back to the original code. +RelwithDebInfo configuration should not affect the performance when the code +is run without a debugger attached. + +The HDF5_ENABLE_COVERAGE option will add "-g -O0 -fprofile-arcs -ftest-coverage" +to CMAKE_C_FLAGS. + + ======================================================================== For further assistance, send email to help@hdfgroup.org ======================================================================== diff --git a/release_docs/INSTALL_Cygwin.txt b/release_docs/INSTALL_Cygwin.txt index ddffcf1..74f494c 100644 --- a/release_docs/INSTALL_Cygwin.txt +++ b/release_docs/INSTALL_Cygwin.txt @@ -66,12 +66,11 @@ Preconditions: 2.2.2 Szip The HDF5 library has a predefined compression filter that uses the extended-Rice lossless compression algorithm for chunked - datatsets. For more information about Szip compression and - license terms see - http://hdfgroup.org/HDF5/doc_resource/SZIP/index.html. + datatsets. For more information on Szip compression, license terms, + and obtaining the Szip source code, see: + + https://portal.hdfgroup.org/display/HDF5/Szip+Compression+in+HDF+Products - The latest supported public release of SZIP is available from - ftp://ftp.hdfgroup.org/lib-external/szip/2.1. 2.3 Additional Utilities @@ -266,4 +265,5 @@ Build, Test and Install HDF5 on Cygwin ----------------------------------------------------------------------- -Need Further assistance, email help@hdfgroup.org + HDF Forum: https://forum.hdfgroup.org/ + HDF Helpdesk: https://portal.hdfgroup.org/display/support/The+HDF+Help+Desk diff --git a/release_docs/INSTALL_Warnings.txt b/release_docs/INSTALL_Warnings.txt new file mode 100644 index 0000000..5fde45f --- /dev/null +++ b/release_docs/INSTALL_Warnings.txt @@ -0,0 +1,474 @@ +*********************************************************************** +* COMPILER WARNINGS OPTIONS +*********************************************************************** + + Table of Contents + +Section I: Managing Warnings +Section II: Default Warnings +Section III: All Warnings +Section IV: Group 0 Warnings +Section V: Group 1 Warnings +Section VI: Group 2 Warnings +Section VII: Group 3 Warnings +Section VIII: Group 4 Warnings +Section IX: Disable Warnings + +************************************************************************ + + +======================================================================== +I. Managing Warnings +======================================================================== +Compiler warnings are managed by setting the compiler flags variables. + +Autotools uses the H5_CFLAGS and H5_CXXFLAGS, both variables set the flags nearly + identical, along with H5_FCFLAGS for Fortran. Autotools uses the type + and version of the compiler to determine which warning flags are used. + However, there is an option, enable-developer-warnings, to enable extra + flags for developers. + +CMake uses the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS, both sets are nearly + identical, along with CMAKE_Fortran_FLAGS for Fortran. CMake has a + minimum set of flags for GNU type compilers and for MSVC compilers. In + addition, CMake breaks the list of flags into groups. The groups for + GNU are roughly associated with the version of the compiler, while + the MSVC groups are associated with the warning levels for the + Microsoft compilers. The CMake option for enabling extra developer + warnings is HDF5_ENABLE_DEV_WARNINGS. + +Custom settings can be used by setting; + Environment variables H5_CFLAGS and H5_CXXFLAGS for Autotools + CMake defines CMAKE_C_FLAGS and CMAKE_CXX_FLAGS for CMake + + +======================================================================== +II. Default Warnings +======================================================================== + +-------------------------------------------------- +Autotools UNIX warnings added to H5_CFLAGS +-------------------------------------------------- + -std=c99 + + the following warning switches should not raise warnings by the current code + -pedantic + -Wall + -Wextra + -Wbad-function-cast + -Wc++-compat + -Wcast-align + -Wcast-qual + -Wconversion + -Wdeclaration-after-statement + -Wdisabled-optimization + -Wfloat-equal + -Wformat=2 + -Winit-self + -Winvalid-pch + -Wmissing-declarations + -Wmissing-include-dirs + -Wmissing-prototypes + -Wnested-externs + -Wold-style-definition + -Wpacked + -Wpointer-arith + -Wredundant-decls + -Wshadow + -Wstrict-prototypes + -Wswitch-default + -Wswitch-enum + -Wundef + -Wunused-macros + -Wunsafe-loop-optimizations + -Wwrite-strings + + enable-developer-warnings=ON + -Winline + -Waggregate-return + -Wmissing-format-attribute + -Wmissing-noreturn + enable-developer-warnings=OFF + -Wno-inline + -Wno-aggregate-return + -Wno-missing-format-attribute + -Wno-missing-noreturn + +IF GCC <= 4.3 + -Wno-long-long + -Wvolatile-register-var + -Wstrict-overflow + +IF GCC <= 4.4 + -Wno-long-long + -Wvolatile-register-var + -Wstrict-overflow + -Wlogical-op + -Wvla + +IF GCC <= 4.5 + -Wno-long-long + -Wvolatile-register-var + -Wstrict-overflow + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + +IF GCC <= 4.6 + -Wno-long-long + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-aliasing + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + +IF GCC <= 4.7 + -Wno-long-long + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-aliasing + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + -Wdouble-promotion + -Wtrampolines + enable-developer-warnings=ON: + -Wsuggest-attribute=const + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + +IF GCC <= 4.8 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + -Wdouble-promotion + -Wtrampolines + -Wstack-usage=8192 + -Wvector-operation-performance + enable-developer-warnings=ON: + -Wsuggest-attribute=const + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + +IF GCC <= 4.9 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-overflow=5 + -Wjump-misses-init + -Wdouble-promotion + -Wtrampolines + -Wstack-usage=8192 + -Wvector-operation-performance + enable-developer-warnings=ON: + -Wsuggest-attribute=const + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + -Wsuggest-attribute=format + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + -Wno-suggest-attribute=format + +IF GCC < 5 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + -Wdouble-promotion + -Wtrampolines + -Wstack-usage=8192 + -Wvector-operation-performance + -Wdate-time + enable-developer-warnings=ON: + -Wsuggest-attribute=const + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + -Wsuggest-attribute=format + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + -Wno-suggest-attribute=format + +IF GCC < 6 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + -Wdouble-promotion + -Wtrampolines + -Wstack-usage=8192 + -Wvector-operation-performance + -Wdate-time + -Warray-bounds=2 + -Wc99-c11-compat + enable-developer-warnings=ON: + -Wsuggest-attribute=const + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + -Wsuggest-attribute=format + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + -Wno-suggest-attribute=format + +IF GCC < 7 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + -Wdouble-promotion + -Wtrampolines + -Wstack-usage=8192 + -Wvector-operation-performance + -Wdate-time + -Warray-bounds=2 + -Wc99-c11-compat + -Wnull-dereference + -Wunused-const-variable + -Wduplicated-cond -Whsa + enable-developer-warnings=ON: + -Wsuggest-attribute=const + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + -Wsuggest-attribute=format + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + -Wno-suggest-attribute=format + + +-------------------------------------------- +CMake warnings added to CMAKE_C_FLAGS +-------------------------------------------- + +IF GNU GCC + -pedantic + -Wall + -Wextra + -Wbad-function-cast + -Wc++-compat + -Wcast-align + -Wcast-qual + -Wconversion + -Wdeclaration-after-statement + -Wdisabled-optimization + -Wfloat-equal + -Wformat=2 + -Winit-self + -Winvalid-pch + -Wmissing-declarations + -Wmissing-include-dirs + -Wmissing-prototypes + -Wnested-externs + -Wold-style-definition + -Wpacked + -Wpointer-arith + -Wredundant-decls + -Wshadow + -Wstrict-prototypes + -Wswitch-default + -Wswitch-enum + -Wundef + -Wunused-macros + -Wunsafe-loop-optimizations + -Wwrite-strings + + -fmessage-length=0 + HDF5_ENABLE_DEV_WARNINGS=ON + -Winline + -Waggregate-return + HDF5_ENABLE_DEV_WARNINGS=OFF + -Wno-unused-parameter + -Wno-inline + -Wno-aggregate-return + + +======================================================================== +III. All Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_DEV_WARNINGS:BOOL=OFF + For Visual Studio: + /W3 + +HDF5_ENABLE_ALL_WARNINGS:BOOL=ON + For Visual Studio: + /Wall + /wd4668 + + For GNU GCC + Group 0 flags + Group 1 flags + Group 2 flags + + +======================================================================== +IV. Group 0 Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_GROUPZERO_WARNINGS:BOOL=OFF + +HDF5_ENABLE_GROUPZERO_WARNINGS:BOOL=ON + For Visual Studio + /W1 + + For GNU GCC + Default Warnings + + +======================================================================== +V. Group 1 Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_GROUPONE_WARNINGS:BOOL=OFF + +HDF5_ENABLE_GROUPONE_WARNINGS:BOOL=ON + For Visual Studio + /W2 + + For GNU GCC + IF GCC >= 4.3 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + IF GCC >= 4.4 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + IF GCC >= 4.5 + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + + +======================================================================== +VI. Group 2 Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_GROUPTWO_WARNINGS:BOOL=OFF + +HDF5_ENABLE_GROUPTWO_WARNINGS:BOOL=ON + For Visual Studio + /W3 + + For GNU GCC + IF GCC >= 4.6 + -Wdouble-promotion + -Wtrampolines + enable-developer-warnings=ON: + -Wsuggest-attribute=const + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + IF GCC >= 4.7 + -Wstack-usage=8192 + -Wvector-operation-performance + enable-developer-warnings=ON: + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + enable-developer-warnings=OFF: + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + IF GCC >= 4.8 + enable-developer-warnings=ON: + -Wsuggest-attribute=format + enable-developer-warnings=OFF: + -Wno-suggest-attribute=format + IF GCC >= 4.8 + -Wdate-time + + +======================================================================== +VII. Group 3 Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_GROUPTHREE_WARNINGS:BOOL=OFF + +HDF5_ENABLE_GROUPTHREE_WARNINGS:BOOL=ON + For Visual Studio + /W4 + + For GNU GCC + IF GCC >= 5.1 + -Warray-bounds=2 + -Wc99-c11-compat + + +======================================================================== +VIII. Group 4 Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_GROUPFOUR_WARNINGS:BOOL=OFF + +HDF5_ENABLE_GROUPFOUR_WARNINGS:BOOL=ON + For GNU GCC + IF GCC >= 6.0 + -Wnull-dereference + -Wunused-const-variable + -Wduplicated-cond + -Whsa + + +======================================================================== +IX. Disable Warnings in CMake +======================================================================== + +Default: HDF5_DISABLE_COMPILER_WARNINGS:BOOL=OFF + +HDF5_DISABLE_COMPILER_WARNINGS:BOOL=ON + For Visual Studio + HDF5_WARNINGS_BLOCKED:BOOL=ON + /W0 + + For GNU GCC + -w + + +======================================================================== +For further assistance, send email to help@hdfgroup.org +======================================================================== + diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 96a91b1..c5c8300 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.11.2 currently under development +HDF5 version 1.11.4 currently under development ================================================================================ @@ -34,6 +34,7 @@ CONTENTS - New Features - Support for new platforms and languages +- Bug Fixes since HDF5-1.10.3 - Bug Fixes since HDF5-1.10.2 - Supported Platforms - Tested Configuration Features Summary @@ -47,6 +48,44 @@ New Features Configuration: ------------- + - Add toolchain and cross-compile support + + Added info on using a toolchain file to INSTALL_CMAKE.txt. A + toolchain file is also used in cross-compiling, which requires + CMAKE_CROSSCOMPILING_EMULATOR to be set. To help with cross-compiling + the fortran configure process, the HDF5UseFortran.cmake file macros + were improved. Fixed a Fortran configure file issue that incorrectly + used #cmakedefine instead of #define. + + (ADB - 2018/10/04, HDFFV-10594) + + - Add warning flags for Intel compilers + + Identified Intel compiler specific warnings flags that should be used + instead of GNU flags. + + (ADB - 2018/10/04, TRILABS-21) + + - Add default rpath to targets + + Default rpaths should be set in shared executables and + libraries to allow the use of loading dependent libraries + without requiring LD_LIBRARY_PATH to be set. The default + path should be relative using @rpath on osx and $ORIGIN + on linux. Windows is not affected. + + (ADB - 2018/09/26, HDFFV-10594) + + - Add missing USE_110_API_DEFAULT option. + + Option USE_110_API_DEFAULT sets the default version of + versioned APIs. The bin/makevers perl script did not set + the maxidx variable correctly when the 1.10 branch was + created. This caused the versioning process to always use + the latest version of any API. + + (ADB - 2018/08/17, HDFFV-10552) + - Added configuration checks for the following MPI functions: MPI_Mprobe - Used for the Parallel Compression feature @@ -71,9 +110,15 @@ New Features (ADB - 2018/07/16) + Library: -------- - - + - Allow pre-generated H5Tinit.c and H5make_libsettings.c to be used. + + Rather than always running H5detect and generating H5Tinit.c and + H5make_libsettings.c, supply a location for those files. + + (ADB - 2018/09/18, HDFFV-10332) Parallel Library: @@ -136,11 +181,88 @@ New Features Java Library: ---------------- + + Tools: + ------ + - + + High-Level APIs: + --------------- + - + + C Packet Table API + ------------------ + - + + Internal header file + -------------------- + - + + Documentation + ------------- + - + +Support for new platforms, languages and compilers. +======================================= + - + +Bug Fixes since HDF5-1.10.3 release +================================== + + Library + ------- + - Allow H5detect and H5make_libsettings to take a file as an argument. + + Rather than only writing to stdout, add a command argument to name + the file that H5detect and H5make_libsettings will use for output. + Without an argument, stdout is still used, so backwards compatibility + is maintained. + + (ADB - 2018/09/05, HDFFV-9059) + + - A bug was discovered in the parallel library where an application + would hang if a collective read/write of a chunked dataset occurred + when collective metadata reads were enabled and some of the ranks + had no selection in the dataset's dataspace. The ranks which had no + selection in the dataset's dataspace called H5D__chunk_addrmap() to + retrieve the lowest chunk address in the dataset. This is because we + require reads/writes to be performed in strictly non-decreasing order + of chunk address in the file. + + When the chunk index used was a version 1 or 2 B-tree, these + non-participating ranks would issue a collective MPI_Bcast() call + that the participating ranks would not issue, causing the hang. Since + the non-participating ranks are not actually reading/writing anything, + the H5D__chunk_addrmap() call can be safely removed and the address used + for the read/write can be set to an arbitrary number (0 was chosen). + + (JTH - 2018/08/25, HDFFV-10501) + + Java Library: + ---------------- + - JNI native library dependencies + + The build for the hdf5_java native library used the wrong + hdf5 target library for CMake builds. Correcting the hdf5_java + library to build with the shared hdf5 library required testing + paths to change also. + + (ADB - 2018/08/31, HDFFV-10568) + - Java iterator callbacks + + Change global callback object to a small stack structure in order + to fix a runtime crash. This crash was discovered when iterating + through a file with nested group members. The global variable + visit_callback is overwritten when recursion starts. When recursion + completes, visit_callback will be pointing to the wrong callback method. + + (ADB - 2018/08/15, HDFFV-10536) + - Java HDFLibraryException class Change parent class from Exception to RuntimeException. - (ADB - 2018/07/30, HDFFV10534) + (ADB - 2018/07/30, HDFFV-10534) - JNI Read and Write @@ -148,32 +270,51 @@ New Features to correct dataset and attribute reads. New write functions, H5DwriteVL and H5AwriteVL, are under construction. - (ADB - 2018/06/02, HDFFV10519) + (ADB - 2018/06/02, HDFFV-10519) - Tools: - ------ + Configuration + ------------- - - High-Level APIs: - --------------- + Performance + ------------- - - C Packet Table API - ------------------ + Fortran + -------- + - Made Fortran specific subroutines PRIVATE in generic procedures. + + Effected generic procedures were functions in H5A, H5D, H5P, H5R and H5T. + + (MSB, 2018/12/04, HDFFV-10511) + + Tools + ----- - - Internal header file - -------------------- + High-Level APIs: + ------ + - + + Fortran High-Level APIs: + ------ - Documentation ------------- - -Support for new platforms, languages and compilers. -======================================= + F90 APIs + -------- - + C++ APIs + -------- + - + + Testing + ------- + Bug Fixes since HDF5-1.10.2 release ================================== @@ -205,6 +346,39 @@ Bug Fixes since HDF5-1.10.2 release (JTH - 2018/08/02, HDFFV-10512) + - User's patches: CVEs + + The following patches have been applied: + + CVE-2018-11202 - NULL pointer dereference was discovered in + H5S_hyper_make_spans in H5Shyper.c (HDFFV-10476) + https://security-tracker.debian.org/tracker/CVE-2018-11202 + https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-11202 + + CVE-2018-11203 - A division by zero was discovered in + H5D__btree_decode_key in H5Dbtree.c (HDFFV-10477) + https://security-tracker.debian.org/tracker/CVE-2018-11203 + https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-11203 + + CVE-2018-11204 - A NULL pointer dereference was discovered in + H5O__chunk_deserialize in H5Ocache.c (HDFFV-10478) + https://security-tracker.debian.org/tracker/CVE-2018-11204 + https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-11204 + + CVE-2018-11206 - An out of bound read was discovered in + H5O_fill_new_decode and H5O_fill_old_decode in H5Ofill.c + (HDFFV-10480) + https://security-tracker.debian.org/tracker/CVE-2018-11206 + https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-11206 + + CVE-2018-11207 - A division by zero was discovered in + H5D__chunk_init in H5Dchunk.c (HDFFV-10481) + https://security-tracker.debian.org/tracker/CVE-2018-11207 + https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-11207 + + (BMR - 2018/7/22, PR#s: 1134 and 1139, + HDFFV-10476, HDFFV-10477, HDFFV-10478, HDFFV-10480, HDFFV-10481) + - H5Adelete H5Adelete failed when deleting the last "large" attribute that @@ -298,19 +472,6 @@ Bug Fixes since HDF5-1.10.2 release (LRK - 2018/07/18, HDFFV-10475) - - The --enable-debug/production configure flags are listed as 'deprecated' - when they should really be listed as 'removed'. - - In the autotools overhaul several years ago, we removed these flags and - implemented a new --enable-build-mode= flag. This was done because we - changed the semantics of the modes and didn't want users to silently - be exposed to them. The newer system is also more flexible and us to - add other modes (like 'clean'). - - The --enable-debug/production flags are now listed as removed. - - (DER - 2018/05/31, HDFFV-10505) - - Moved the location of gcc attribute. The gcc attribute(no_sanitize), named as the macro HDF_NO_UBSAN, @@ -420,15 +581,14 @@ Supported Platforms Windows 7 Visual Studio 2015 w/ Intel Fortran 16 (cmake) - Windows 7 x64 Visual Studio 2012 w/ Intel Fortran 15 (cmake) - Visual Studio 2013 w/ Intel Fortran 15 (cmake) + Windows 7 x64 Visual Studio 2013 Visual Studio 2015 w/ Intel Fortran 16 (cmake) - Visual Studio 2015 w/ Intel C, Fortran 2017 (cmake) + Visual Studio 2015 w/ Intel C, Fortran 2018 (cmake) Visual Studio 2015 w/ MSMPI 8 (cmake) - Windows 10 Visual Studio 2015 w/ Intel Fortran 16 (cmake) + Windows 10 Visual Studio 2015 w/ Intel Fortran 18 (cmake) - Windows 10 x64 Visual Studio 2015 w/ Intel Fortran 16 (cmake) + Windows 10 x64 Visual Studio 2015 w/ Intel Fortran 18 (cmake) Visual Studio 2017 w/ Intel Fortran 18 (cmake) Mac OS X Yosemite 10.10.5 Apple clang/clang++ version 6.1 from Xcode 7.0 diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt index 6f744d9..d5fae39 100644 --- a/release_docs/USING_CMake_Examples.txt +++ b/release_docs/USING_CMake_Examples.txt @@ -46,7 +46,7 @@ Default installation process: Copy HDF5_Examples.cmake to this directory. The default source folder is defined as "HDF5Examples". It can be changed with the CTEST_SOURCE_NAME script option. - The default installation folder is defined as "@CMAKE_INSTALL_PREFIX@". + The default installation folder is defined for the platform. It can be changed with the INSTALLDIR script option. (Note: Windows has issues with spaces and paths -The path will need to be set correctly.) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3c5526f..cd81ba5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -32,7 +32,6 @@ set (H5A_SOURCES ) set (H5A_HDRS - ${HDF5_SRC_DIR}/H5Apkg.h ${HDF5_SRC_DIR}/H5Apublic.h ) IDE_GENERATED_PROPERTIES ("H5A" "${H5A_HDRS}" "${H5A_SOURCES}" ) @@ -46,7 +45,6 @@ set (H5AC_SOURCES ) set (H5AC_HDRS - ${HDF5_SRC_DIR}/H5ACpkg.h ${HDF5_SRC_DIR}/H5ACpublic.h ) IDE_GENERATED_PROPERTIES ("H5AC" "${H5AC_HDRS}" "${H5AC_SOURCES}" ) @@ -57,8 +55,6 @@ set (H5B_SOURCES ${HDF5_SRC_DIR}/H5Bdbg.c ) set (H5B_HDRS - ${HDF5_SRC_DIR}/H5Bpkg.h - ${HDF5_SRC_DIR}/H5Bpublic.h ) IDE_GENERATED_PROPERTIES ("H5B" "${H5B_HDRS}" "${H5B_SOURCES}" ) @@ -75,8 +71,6 @@ set (H5B2_SOURCES ${HDF5_SRC_DIR}/H5B2test.c ) set (H5B2_HDRS - ${HDF5_SRC_DIR}/H5B2pkg.h - ${HDF5_SRC_DIR}/H5B2public.h ) IDE_GENERATED_PROPERTIES ("H5B2" "${H5B2_HDRS}" "${H5B2_SOURCES}" ) @@ -94,7 +88,6 @@ set (H5C_SOURCES ${HDF5_SRC_DIR}/H5Ctest.c ) set (H5C_HDRS - ${HDF5_SRC_DIR}/H5Cpkg.h ${HDF5_SRC_DIR}/H5Cpublic.h ) IDE_GENERATED_PROPERTIES ("H5C" "${H5C_HDRS}" "${H5C_SOURCES}" ) @@ -143,7 +136,6 @@ set (H5D_SOURCES ) set (H5D_HDRS - ${HDF5_SRC_DIR}/H5Dpkg.h ${HDF5_SRC_DIR}/H5Dpublic.h ) IDE_GENERATED_PROPERTIES ("H5D" "${H5D_HDRS}" "${H5D_SOURCES}" ) @@ -155,12 +147,8 @@ set (H5E_SOURCES ) set (H5E_HDRS - #${HDF5_SRC_DIR}/H5Edefin.h - #${HDF5_SRC_DIR}/H5Einit.h - ${HDF5_SRC_DIR}/H5Epkg.h - #${HDF5_SRC_DIR}/H5Epubgen.h + ${HDF5_SRC_DIR}/H5Epubgen.h ${HDF5_SRC_DIR}/H5Epublic.h - #${HDF5_SRC_DIR}/H5Eterm.h ) IDE_GENERATED_PROPERTIES ("H5E" "${H5E_HDRS}" "${H5E_SOURCES}" ) @@ -179,11 +167,18 @@ set (H5EA_SOURCES ${HDF5_SRC_DIR}/H5EAtest.c ) set (H5EA_HDRS - ${HDF5_SRC_DIR}/H5EApkg.h ) IDE_GENERATED_PROPERTIES ("H5EA" "${H5EA_HDRS}" "${H5EA_SOURCES}" ) +set (H5ES_SOURCES +) +set (H5ES_HDRS + ${HDF5_SRC_DIR}/H5ESpublic.h +) +IDE_GENERATED_PROPERTIES ("H5ES" "${H5ES_HDRS}" "${H5ES_SOURCES}" ) + + set (H5F_SOURCES ${HDF5_SRC_DIR}/H5F.c ${HDF5_SRC_DIR}/H5Faccum.c @@ -205,7 +200,6 @@ set (H5F_SOURCES ) set (H5F_HDRS - ${HDF5_SRC_DIR}/H5Fpkg.h ${HDF5_SRC_DIR}/H5Fpublic.h ) IDE_GENERATED_PROPERTIES ("H5F" "${H5F_HDRS}" "${H5F_SOURCES}" ) @@ -223,7 +217,6 @@ set (H5FA_SOURCES ${HDF5_SRC_DIR}/H5FAtest.c ) set (H5FA_HDRS - ${HDF5_SRC_DIR}/H5FApkg.h ) IDE_GENERATED_PROPERTIES ("H5FA" "${H5FA_HDRS}" "${H5FA_SOURCES}" ) @@ -253,7 +246,6 @@ set (H5FD_HDRS ${HDF5_SRC_DIR}/H5FDmpi.h ${HDF5_SRC_DIR}/H5FDmpio.h ${HDF5_SRC_DIR}/H5FDmulti.h - ${HDF5_SRC_DIR}/H5FDpkg.h ${HDF5_SRC_DIR}/H5FDpublic.h ${HDF5_SRC_DIR}/H5FDsec2.h ${HDF5_SRC_DIR}/H5FDstdio.h @@ -289,8 +281,6 @@ set (H5FS_SOURCES ) set (H5FS_HDRS - ${HDF5_SRC_DIR}/H5FSpkg.h - ${HDF5_SRC_DIR}/H5FSpublic.h ) IDE_GENERATED_PROPERTIES ("H5FS" "${H5FS_HDRS}" "${H5FS_SOURCES}" ) @@ -316,7 +306,6 @@ set (H5G_SOURCES ) set (H5G_HDRS - ${HDF5_SRC_DIR}/H5Gpkg.h ${HDF5_SRC_DIR}/H5Gpublic.h ) IDE_GENERATED_PROPERTIES ("H5G" "${H5G_HDRS}" "${H5G_SOURCES}" ) @@ -341,8 +330,6 @@ set (H5HF_SOURCES ) set (H5HF_HDRS - ${HDF5_SRC_DIR}/H5HFpkg.h - ${HDF5_SRC_DIR}/H5HFpublic.h ) IDE_GENERATED_PROPERTIES ("H5HF" "${H5HF_HDRS}" "${H5HF_SOURCES}" ) @@ -354,8 +341,6 @@ set (H5HG_SOURCES ) set (H5HG_HDRS - ${HDF5_SRC_DIR}/H5HGpkg.h - ${HDF5_SRC_DIR}/H5HGpublic.h ) IDE_GENERATED_PROPERTIES ("H5HG" "${H5HG_HDRS}" "${H5HG_SOURCES}" ) @@ -369,8 +354,6 @@ set (H5HL_SOURCES ) set (H5HL_HDRS - ${HDF5_SRC_DIR}/H5HLpkg.h - ${HDF5_SRC_DIR}/H5HLpublic.h ) IDE_GENERATED_PROPERTIES ("H5HL" "${H5HL_HDRS}" "${H5HL_SOURCES}" ) @@ -388,7 +371,6 @@ set (H5I_SOURCES ${HDF5_SRC_DIR}/H5Itest.c ) set (H5I_HDRS - ${HDF5_SRC_DIR}/H5Ipkg.h ${HDF5_SRC_DIR}/H5Ipublic.h ) IDE_GENERATED_PROPERTIES ("H5I" "${H5I_HDRS}" "${H5I_SOURCES}" ) @@ -399,7 +381,6 @@ set (H5L_SOURCES ${HDF5_SRC_DIR}/H5Lexternal.c ) set (H5L_HDRS - ${HDF5_SRC_DIR}/H5Lpkg.h ${HDF5_SRC_DIR}/H5Lpublic.h ) IDE_GENERATED_PROPERTIES ("H5L" "${H5L_HDRS}" "${H5L_SOURCES}" ) @@ -432,7 +413,6 @@ set (H5MP_SOURCES ) set (H5MP_HDRS - ${HDF5_SRC_DIR}/H5MPpkg.h ) IDE_GENERATED_PROPERTIES ("H5MP" "${H5MP_HDRS}" "${H5MP_SOURCES}" ) @@ -477,9 +457,7 @@ set (H5O_SOURCES ) set (H5O_HDRS - ${HDF5_SRC_DIR}/H5Opkg.h ${HDF5_SRC_DIR}/H5Opublic.h - ${HDF5_SRC_DIR}/H5Oshared.h ) IDE_GENERATED_PROPERTIES ("H5O" "${H5O_HDRS}" "${H5O_SOURCES}" ) @@ -505,7 +483,6 @@ set (H5P_SOURCES ) set (H5P_HDRS - ${HDF5_SRC_DIR}/H5Ppkg.h ${HDF5_SRC_DIR}/H5Ppublic.h ) IDE_GENERATED_PROPERTIES ("H5P" "${H5P_HDRS}" "${H5P_SOURCES}" ) @@ -515,7 +492,6 @@ set (H5PB_SOURCES ) set (H5PB_HDRS - ${HDF5_SRC_DIR}/H5PBpkg.h ) IDE_GENERATED_PROPERTIES ("H5PB" "${H5PB_HDRS}" "${H5PB_SOURCES}" ) @@ -528,7 +504,6 @@ set (H5PL_SOURCES set (H5PL_HDRS ${HDF5_SRC_DIR}/H5PLextern.h - ${HDF5_SRC_DIR}/H5PLpkg.h ${HDF5_SRC_DIR}/H5PLpublic.h ) IDE_GENERATED_PROPERTIES ("H5PL" "${H5PL_HDRS}" "${H5PL_SOURCES}" ) @@ -540,7 +515,6 @@ set (H5R_SOURCES ${HDF5_SRC_DIR}/H5Rint.c ) set (H5R_HDRS - ${HDF5_SRC_DIR}/H5Rpkg.h ${HDF5_SRC_DIR}/H5Rpublic.h ) IDE_GENERATED_PROPERTIES ("H5R" "${H5R_HDRS}" "${H5R_SOURCES}" ) @@ -567,7 +541,6 @@ set (H5S_SOURCES ) set (H5S_HDRS - ${HDF5_SRC_DIR}/H5Spkg.h ${HDF5_SRC_DIR}/H5Spublic.h ) IDE_GENERATED_PROPERTIES ("H5S" "${H5S_HDRS}" "${H5S_SOURCES}" ) @@ -590,7 +563,6 @@ set (H5SM_SOURCES ) set (H5SM_HDRS - ${HDF5_SRC_DIR}/H5SMpkg.h ) IDE_GENERATED_PROPERTIES ("H5SM" "${H5SM_HDRS}" "${H5SM_SOURCES}" ) @@ -630,7 +602,6 @@ set (H5T_SOURCES ) set (H5T_HDRS - ${HDF5_SRC_DIR}/H5Tpkg.h ${HDF5_SRC_DIR}/H5Tpublic.h ) IDE_GENERATED_PROPERTIES ("H5T" "${H5T_HDRS}" "${H5T_SOURCES}" ) @@ -652,6 +623,20 @@ set (H5UC_HDRS IDE_GENERATED_PROPERTIES ("H5UC" "${H5UC_HDRS}" "${H5UC_SOURCES}" ) +set (H5VL_SOURCES + ${HDF5_SRC_DIR}/H5VL.c + ${HDF5_SRC_DIR}/H5VLcallback.c + ${HDF5_SRC_DIR}/H5VLint.c + ${HDF5_SRC_DIR}/H5VLnative.c + ${HDF5_SRC_DIR}/H5VLpassthru.c +) +set (H5VL_HDRS + ${HDF5_SRC_DIR}/H5VLnative.h + ${HDF5_SRC_DIR}/H5VLpassthru.h + ${HDF5_SRC_DIR}/H5VLpublic.h +) +IDE_GENERATED_PROPERTIES ("H5VL" "${H5VL_HDRS}" "${H5VL_SOURCES}" ) + set (H5VM_SOURCES ${HDF5_SRC_DIR}/H5VM.c ) @@ -685,7 +670,6 @@ endif () set (H5Z_HDRS - ${HDF5_SRC_DIR}/H5Zpkg.h ${HDF5_SRC_DIR}/H5Zpublic.h ) IDE_GENERATED_PROPERTIES ("H5Z" "${H5Z_HDRS}" "${H5Z_SOURCES}" ) @@ -731,6 +715,7 @@ set (common_SRCS ${H5ST_SOURCES} ${H5T_SOURCES} ${H5TS_SOURCES} + ${H5VL_SOURCES} ${H5VM_SOURCES} ${H5WB_SOURCES} ${H5Z_SOURCES} @@ -746,6 +731,7 @@ set (H5_PUBLIC_HEADERS ${H5D_HDRS} ${H5E_HDRS} ${H5EA_HDRS} + ${H5ES_HDRS} ${H5F_HDRS} ${H5FA_HDRS} ${H5FD_HDRS} @@ -767,54 +753,132 @@ set (H5_PUBLIC_HEADERS ${H5S_HDRS} ${H5SM_HDRS} ${H5T_HDRS} + ${H5VL_HDRS} ${H5Z_HDRS} ) set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5private.h + + ${HDF5_SRC_DIR}/H5Apkg.h ${HDF5_SRC_DIR}/H5Aprivate.h + + ${HDF5_SRC_DIR}/H5ACpkg.h ${HDF5_SRC_DIR}/H5ACprivate.h - ${HDF5_SRC_DIR}/H5B2private.h + + ${HDF5_SRC_DIR}/H5Bpkg.h ${HDF5_SRC_DIR}/H5Bprivate.h + + ${HDF5_SRC_DIR}/H5B2pkg.h + ${HDF5_SRC_DIR}/H5B2private.h + + ${HDF5_SRC_DIR}/H5Cpkg.h ${HDF5_SRC_DIR}/H5Cprivate.h + ${HDF5_SRC_DIR}/H5CSprivate.h + ${HDF5_SRC_DIR}/H5CXprivate.h + + ${HDF5_SRC_DIR}/H5Dpkg.h ${HDF5_SRC_DIR}/H5Dprivate.h + + ${HDF5_SRC_DIR}/H5Edefin.h + ${HDF5_SRC_DIR}/H5Einit.h + ${HDF5_SRC_DIR}/H5Epkg.h ${HDF5_SRC_DIR}/H5Eprivate.h + ${HDF5_SRC_DIR}/H5Eterm.h + + ${HDF5_SRC_DIR}/H5EApkg.h ${HDF5_SRC_DIR}/H5EAprivate.h + + ${HDF5_SRC_DIR}/H5Fpkg.h + ${HDF5_SRC_DIR}/H5Fprivate.h + + ${HDF5_SRC_DIR}/H5FApkg.h ${HDF5_SRC_DIR}/H5FAprivate.h + + ${HDF5_SRC_DIR}/H5FDpkg.h ${HDF5_SRC_DIR}/H5FDprivate.h - ${HDF5_SRC_DIR}/H5Fprivate.h + ${HDF5_SRC_DIR}/H5FLprivate.h + ${HDF5_SRC_DIR}/H5FOprivate.h - ${HDF5_SRC_DIR}/H5MFprivate.h - ${HDF5_SRC_DIR}/H5MMprivate.h - ${HDF5_SRC_DIR}/H5Cprivate.h + + ${HDF5_SRC_DIR}/H5FSpkg.h ${HDF5_SRC_DIR}/H5FSprivate.h + + ${HDF5_SRC_DIR}/H5Gpkg.h ${HDF5_SRC_DIR}/H5Gprivate.h + + ${HDF5_SRC_DIR}/H5HFpkg.h ${HDF5_SRC_DIR}/H5HFprivate.h + + ${HDF5_SRC_DIR}/H5HGpkg.h ${HDF5_SRC_DIR}/H5HGprivate.h + + ${HDF5_SRC_DIR}/H5HLpkg.h ${HDF5_SRC_DIR}/H5HLprivate.h + ${HDF5_SRC_DIR}/H5HPprivate.h + + ${HDF5_SRC_DIR}/H5Ipkg.h ${HDF5_SRC_DIR}/H5Iprivate.h + + ${HDF5_SRC_DIR}/H5Lpkg.h ${HDF5_SRC_DIR}/H5Lprivate.h + + ${HDF5_SRC_DIR}/H5MFprivate.h + + ${HDF5_SRC_DIR}/H5MMprivate.h + + ${HDF5_SRC_DIR}/H5MPpkg.h ${HDF5_SRC_DIR}/H5MPprivate.h + + ${HDF5_SRC_DIR}/H5Opkg.h ${HDF5_SRC_DIR}/H5Oprivate.h + ${HDF5_SRC_DIR}/H5Oshared.h + + ${HDF5_SRC_DIR}/H5Ppkg.h ${HDF5_SRC_DIR}/H5Pprivate.h + ${HDF5_SRC_DIR}/H5PBprivate.h + ${HDF5_SRC_DIR}/H5PBpkg.h + + ${HDF5_SRC_DIR}/H5PLpkg.h ${HDF5_SRC_DIR}/H5PLprivate.h - ${HDF5_SRC_DIR}/H5UCprivate.h + + ${HDF5_SRC_DIR}/H5Rpkg.h ${HDF5_SRC_DIR}/H5Rprivate.h + ${HDF5_SRC_DIR}/H5RSprivate.h + + ${HDF5_SRC_DIR}/H5Spkg.h + ${HDF5_SRC_DIR}/H5Sprivate.h + ${HDF5_SRC_DIR}/H5SLprivate.h + + ${HDF5_SRC_DIR}/H5SMpkg.h ${HDF5_SRC_DIR}/H5SMprivate.h - ${HDF5_SRC_DIR}/H5Sprivate.h + ${HDF5_SRC_DIR}/H5STprivate.h + + ${HDF5_SRC_DIR}/H5Tpkg.h ${HDF5_SRC_DIR}/H5Tprivate.h + ${HDF5_SRC_DIR}/H5TSprivate.h + + ${HDF5_SRC_DIR}/H5UCprivate.h + + ${HDF5_SRC_DIR}/H5VLpkg.h + ${HDF5_SRC_DIR}/H5VLprivate.h + ${HDF5_SRC_DIR}/H5VMprivate.h + ${HDF5_SRC_DIR}/H5WBprivate.h + + ${HDF5_SRC_DIR}/H5Zpkg.h ${HDF5_SRC_DIR}/H5Zprivate.h + ${HDF5_SRC_DIR}/H5win32defs.h ) @@ -827,6 +891,12 @@ set (H5_GENERATED_HEADERS ${HDF5_SRC_DIR}/H5overflow.h ) +set (H5_PUBLIC_GENERATED_HEADERS + ${HDF5_SRC_DIR}/H5Epubgen.h + ${HDF5_SRC_DIR}/H5version.h + ${HDF5_SRC_DIR}/H5overflow.h +) + option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON) if (HDF5_GENERATE_HEADERS) set_source_files_properties(${H5_GENERATED_HEADERS} PROPERTIES GENERATED TRUE) @@ -853,38 +923,99 @@ endif () # Setup the H5detect utility which generates H5Tinit with platform # specific type checks inside #----------------------------------------------------------------------------- -add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) -target_include_directories(H5detect PRIVATE "${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") -target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) -TARGET_C_PROPERTIES (H5detect STATIC) -target_link_libraries (H5detect - PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<PLATFORM_ID:Windows>:ws2_32.lib> - INTERFACE $<$<PLATFORM_ID:Emscripten>:"-O0"> -) +if (HDF5_USE_PREGEN) + set (HDF5_GENERATED_SOURCE_DIR ${HDF5_USE_PREGEN_DIR}) +else () + set (HDF5_GENERATED_SOURCE_DIR ${HDF5_BINARY_DIR}) +endif () -add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5Tinit.c - COMMAND $<TARGET_FILE:H5detect> - ARGS > ${HDF5_BINARY_DIR}/H5Tinit.c - DEPENDS H5detect -) +if (BUILD_SHARED_LIBS) + file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") +endif () + +if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) + add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) + target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) + TARGET_C_PROPERTIES (H5detect STATIC) + target_link_libraries (H5detect + PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<PLATFORM_ID:Windows>:ws2_32.lib> + PRIVATE $<$<PLATFORM_ID:Emscripten>:"-O0"> + ) + + if (HDF5_BATCH_H5DETECT) + configure_file ( + ${HDF5_SOURCE_DIR}/bin/batch/${HDF5_BATCH_H5DETECT_SCRIPT}.in.cmake + ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} ESCAPE_QUOTES @ONLY + ) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + COMMAND ${HDF5_BATCH_CMD} + ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} + COMMAND ${CMAKE_COMMAND} + ARGS -E echo "Executed batch command to create H5Tinit.c" + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) + add_custom_target (gen_H5Tinit + COMMAND ${CMAKE_COMMAND} -P ${HDF5_SOURCE_DIR}/config/cmake/wait_H5Tinit.cmake + ) + if (BUILD_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" + DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit_created + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) + endif () + else () + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5detect> + ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) + if (BUILD_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" + DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) + endif () + endif () + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) +endif () add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) -target_include_directories(H5make_libsettings PRIVATE "${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5make_libsettings STATIC) target_link_libraries (H5make_libsettings PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<PLATFORM_ID:Windows>:ws2_32.lib> - INTERFACE $<$<PLATFORM_ID:Emscripten>:"-O0"> + PRIVATE $<$<PLATFORM_ID:Emscripten>:"-O0"> ) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c - COMMAND $<TARGET_FILE:H5make_libsettings> - ARGS > ${HDF5_BINARY_DIR}/H5lib_settings.c + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5make_libsettings> + ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) +set_source_files_properties (${HDF5_BINARY_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE) +if (BUILD_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_BINARY_DIR}/H5lib_settings.c" "${HDF5_BINARY_DIR}/shared/H5lib_settings.c" + DEPENDS ${HDF5_BINARY_DIR}/H5lib_settings.c + ) + set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) +endif () ## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" #all_packages="AC,B2,CX,D,F,HL,I,O,S,ST,T,Z" @@ -893,8 +1024,9 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) #----------------------------------------------------------------------------- # Add H5Tinit source to build - generated by H5detect/CMake at configure time #----------------------------------------------------------------------------- -set (gen_SRCS ${HDF5_BINARY_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) +set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) +add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${gen_SRCS}) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" @@ -917,26 +1049,14 @@ target_link_libraries (${HDF5_LIB_TARGET} set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC 0) set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) +add_dependencies (${HDF5_LIB_TARGET} gen_${HDF5_LIB_TARGET}) set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/shared/H5Tinit.c - COMMAND $<TARGET_FILE:H5detect> - ARGS > ${HDF5_BINARY_DIR}/shared/H5Tinit.c - DEPENDS H5detect - WORKING_DIRECTORY ${HDF5_BINARY_DIR}/shared - ) - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - COMMAND $<TARGET_FILE:H5make_libsettings> - ARGS > ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - DEPENDS H5make_libsettings - WORKING_DIRECTORY ${HDF5_BINARY_DIR} - ) - set (shared_gen_SRCS ${HDF5_BINARY_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) + set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) + + add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${shared_gen_SRCS}) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" @@ -961,6 +1081,7 @@ if (BUILD_SHARED_LIBS) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED "LIB") set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES FOLDER libraries) + add_dependencies (${HDF5_LIBSH_TARGET} gen_${HDF5_LIBSH_TARGET}) set (install_targets ${install_targets} ${HDF5_LIBSH_TARGET}) endif () @@ -972,7 +1093,7 @@ if (NOT HDF5_INSTALL_NO_DEVELOPMENT) install ( FILES ${H5_PUBLIC_HEADERS} - ${H5_GENERATED_HEADERS} + ${H5_PUBLIC_GENERATED_HEADERS} ${HDF5_BINARY_DIR}/H5pubconf.h DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} @@ -138,7 +138,7 @@ H5_init_library(void) if (mpi_initialized && !mpi_finalized) { int key_val; - if(MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(MPI_NULL_COPY_FN, + if(MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(MPI_COMM_NULL_COPY_FN, (MPI_Comm_delete_attr_function *)H5_mpi_delete_cb, &key_val, NULL))) HMPI_GOTO_ERROR(FAIL, "MPI_Comm_create_keyval failed", mpi_code) @@ -173,6 +173,7 @@ H5_init_library(void) H5_debug_g.pkg[H5_PKG_S].name = "s"; H5_debug_g.pkg[H5_PKG_T].name = "t"; H5_debug_g.pkg[H5_PKG_V].name = "v"; + H5_debug_g.pkg[H5_PKG_VL].name = "vl"; H5_debug_g.pkg[H5_PKG_Z].name = "z"; /* @@ -213,6 +214,8 @@ H5_init_library(void) */ if(H5E_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize error interface") + if(H5VL_init() < 0) + HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize vol interface") if(H5P_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize property list interface") if(H5T_init() < 0) @@ -262,7 +265,7 @@ H5_term_library(void) /* Don't do anything if the library is already closed */ if(!(H5_INIT_GLOBAL)) - goto done; + goto done; /* Indicate that the library is being shut down */ H5_TERM_GLOBAL = TRUE; @@ -344,6 +347,7 @@ H5_term_library(void) pending += DOWN(AC); pending += DOWN(Z); pending += DOWN(FD); + pending += DOWN(VL); pending += DOWN(PL); /* Don't shut down the error code until other APIs which use it are shut down */ if(pending == 0) @@ -379,18 +383,18 @@ H5_term_library(void) * down if any of the below code involves using the instrumentation code. */ if(H5_MPEinit_g) { - int mpi_initialized; - int mpi_finalized; - int mpe_code; + int mpi_initialized; + int mpi_finalized; + int mpe_code; - MPI_Initialized(&mpi_initialized); - MPI_Finalized(&mpi_finalized); + MPI_Initialized(&mpi_initialized); + MPI_Finalized(&mpi_finalized); if (mpi_initialized && !mpi_finalized) { - mpe_code = MPE_Finish_log("h5log"); - HDassert(mpe_code >=0); - } /* end if */ - H5_MPEinit_g = FALSE; /* turn it off no matter what */ + mpe_code = MPE_Finish_log("h5log"); + HDassert(mpe_code >=0); + } /* end if */ + H5_MPEinit_g = FALSE; /* turn it off no matter what */ } /* end if */ #endif @@ -16,22 +16,22 @@ /****************/ #include "H5Amodule.h" /* This source code file is part of the H5A module */ -#define H5O_FRIEND /*suppress error about including H5Opkg */ +#define H5O_FRIEND /* Suppress error about including H5Opkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Sprivate.h" /* Dataspace functions */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Sprivate.h" /* Dataspace functions */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -123,7 +123,7 @@ H5A__init_package(void) * Create attribute ID type. */ if(H5I_register_type(H5I_ATTR_CLS) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to initialize interface") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to initialize interface") /* Mark "top" of interface as initialized, too */ H5A_top_package_initialize_s = TRUE; @@ -216,76 +216,98 @@ H5A_term_package(void) /*-------------------------------------------------------------------------- - NAME - H5Acreate2 - PURPOSE - Creates an attribute on an object - USAGE - hid_t H5Acreate2(loc_id, attr_name, type_id, space_id, acpl_id, - aapl_id) - hid_t loc_id; IN: Object (dataset or group) to be attached to - const char *attr_name; IN: Name of attribute to locate and open - hid_t type_id; IN: ID of datatype for attribute - hid_t space_id; IN: ID of dataspace for attribute - hid_t acpl_id; IN: ID of creation property list (currently not used) - hid_t aapl_id; IN: Attribute access property list - RETURNS - Non-negative on success/Negative on failure - - DESCRIPTION - This function creates an attribute which is attached to the object - specified with 'loc_id'. The name specified with 'attr_name' for - each attribute for an object must be unique for that object. The 'type_id' - and 'space_id' are created with the H5T and H5S interfaces respectively. - The 'aapl_id' property list is currently unused, but will be used in the - future for optional attribute access properties. The attribute ID returned - from this function must be released with H5Aclose or resource leaks will - develop. - ---------------------------------------------------------------------------*/ + * Function: H5Acreate2 + * + * Purpose: Creates an attribute on an object + * + * Usage: + * hid_t H5Acreate2(loc_id, attr_name, type_id, space_id, acpl_id, + * aapl_id) + * + * Description: This function creates an attribute which is attached to the + * object specified with 'loc_id'. The name specified with + * 'attr_name' for each attribute for an object must be unique + * for that object. The 'type_id' and 'space_id' are created + * with the H5T and H5S interfaces respectively. The 'aapl_id' + * property list is currently unused, but will be used in the + * future for optional attribute access properties. The + * attribute ID returned from this function must be released + * with H5Aclose or resource leaks will develop. + * + * Parameters: + * hid_t loc_id; IN: Object (dataset or group) to be attached to + * const char *attr_name; IN: Name of attribute to locate and open + * hid_t type_id; IN: ID of datatype for attribute + * hid_t space_id; IN: ID of dataspace for attribute + * hid_t acpl_id; IN: ID of creation property list (currently not used) + * hid_t aapl_id; IN: Attribute access property list + * + * Return: Success: An ID for the created attribute + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id) { - H5A_t *attr = NULL; /* Attribute created */ - H5G_loc_t loc; /* Object location */ - H5T_t *type; /* Datatype to use for attribute */ - H5S_t *space; /* Dataspace to use for attribute */ - hid_t ret_value; /* Return value */ + void *attr = NULL; /* Attribute created */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE6("i", "i*siiii", loc_id, attr_name, type_id, space_id, acpl_id, aapl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file") - if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type") - if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") + if(!attr_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be NULL") + if(!*attr_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be an empty string") + + /* Get correct property list */ + if(H5P_DEFAULT == acpl_id) + acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT; /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Go do the real work for attaching the attribute to the object */ - if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") + /* Get the property list structure for the acpl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set creation properties */ + if(H5P_set(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id") + if(H5P_set(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Create the attribute */ + if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ - if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ - if(ret_value < 0 && attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + if(H5I_INVALID_HID == ret_value) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Acreate2() */ @@ -308,7 +330,7 @@ done: hid_t aapl_id; IN: Attribute access property list hid_t lapl_id; IN: Link access property list RETURNS - Non-negative on success/Negative on failure + Non-negative on success/H5I_INVALID_HID on failure DESCRIPTION This function creates an attribute which is attached to the object @@ -326,31 +348,27 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id) { - H5A_t *attr = NULL; /* Attribute created */ - H5G_loc_t loc; /* Object location */ - H5T_t *type; /* Datatype to use for attribute */ - H5S_t *space; /* Dataspace to use for attribute */ - hid_t ret_value; /* Return value */ + void *attr = NULL; /* attr token from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE8("i", "i*s*siiiii", loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name") if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type") - if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no attribute name") + + /* Get correct property list */ + if(H5P_DEFAULT == acpl_id) + acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT; /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0) @@ -358,22 +376,43 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(H5P_DEFAULT != lapl_id) { if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID") H5CX_set_lapl(lapl_id); - } /* end if */ + } + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") + + /* Set creation properties */ + if(H5P_set(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id") + if(H5P_set(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") + + /* Set up location struct */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") - /* Create the attribute on the object */ - if(NULL == (attr = H5A__create_by_name(&loc, obj_name, attr_name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") + /* Create the attribute */ + if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ - if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ - if(ret_value < 0 && attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + if(H5I_INVALID_HID == ret_value) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Acreate_by_name() */ @@ -390,7 +429,7 @@ done: const char *attr_name; IN: Name of attribute to locate and open hid_t aapl_id; IN: Attribute access property list RETURNS - ID of attribute on success, negative on failure + ID of attribute on success, H5I_INVALID_HID on failure DESCRIPTION This function opens an existing attribute for access. The attribute @@ -401,38 +440,47 @@ done: hid_t H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { - H5G_loc_t loc; /* Object location */ - H5A_t *attr = NULL; /* Attribute opened */ - hid_t ret_value; + void *attr = NULL; /* attr token from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, attr_name, aapl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") + if(!attr_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*attr_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Read in attribute from object header */ - if(NULL == (attr = H5A__open(&loc, attr_name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to load attribute info from object header for attribute: '%s'", attr_name) + /* 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, H5I_INVALID_HID, "invalid location identifier") + + /* Open the attribute */ + if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name) /* Register the attribute and get an ID for it */ - if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ - if(ret_value < 0) - if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + if(H5I_INVALID_HID == ret_value) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Aopen() */ @@ -451,7 +499,7 @@ done: hid_t aapl_id; IN: Attribute access property list hid_t lapl_id; IN: Link access property list RETURNS - ID of attribute on success, negative on failure + ID of attribute on success, H5I_INVALID_HID on failure DESCRIPTION This function opens an existing attribute for access. The attribute @@ -463,49 +511,61 @@ hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ - H5A_t *attr = NULL; /* Attribute opened */ - hid_t ret_value; + void *attr = NULL; /* attr token from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "i*s*sii", loc_id, obj_name, attr_name, aapl_id, lapl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name") if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no attribute name") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Set lapl_id and add to context */ if(H5P_DEFAULT != lapl_id) { if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID") H5CX_set_lapl(lapl_id); - } /* end if */ + } + else + lapl_id = H5P_LINK_ACCESS_DEFAULT; + + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") - /* Open the attribute on the object header */ - if(NULL == (attr = H5A__open_by_name(&loc, obj_name, attr_name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + /* Open the attribute */ + if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute") /* Register the attribute and get an ID for it */ - if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ - if(ret_value < 0) - if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + if(H5I_INVALID_HID == ret_value) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) -} /* H5Aopen_by_name() */ +} /* end H5Aopen_by_name() */ /*-------------------------------------------------------------------------- @@ -524,7 +584,7 @@ done: hid_t aapl_id; IN: Attribute access property list hid_t lapl_id; IN: Link access property list RETURNS - ID of attribute on success, negative on failure + ID of attribute on success, H5I_INVALID_HID on failure DESCRIPTION This function opens an existing attribute for access. The attribute @@ -536,49 +596,64 @@ hid_t H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t aapl_id, hid_t lapl_id) { - H5A_t *attr = NULL; /* Attribute opened */ - H5G_loc_t loc; /* Object location */ - hid_t ret_value; /* Return value */ + void *attr = NULL; /* Attribute opened */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE7("i", "i*sIiIohii", loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Set lapl_id and add to context */ if(H5P_DEFAULT != lapl_id) { if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID") H5CX_set_lapl(lapl_id); - } /* end if */ - - /* Open the attribute in the object header */ - if(NULL == (attr = H5A__open_by_idx(&loc, obj_name, idx_type, order, n))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") + } + else + lapl_id = H5P_LINK_ACCESS_DEFAULT; + + /* Fill in location struct parameters */ + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = obj_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Open the attribute */ + if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ - if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ - if(ret_value < 0) - if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + if(H5I_INVALID_HID == ret_value) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Aopen_by_idx() */ @@ -603,27 +678,26 @@ done: herr_t H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) { - H5A_t *attr; /* Attribute object for ID */ - H5T_t *mem_type; /* Memory datatype */ - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* Attribute object for ID */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ii*x", attr_id, dtype_id, buf); - /* check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + /* Check arguments */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") - if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) + if(H5I_DATATYPE != H5I_get_type(dtype_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(NULL == buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(attr_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") - /* Go write the actual data to the attribute */ - if((ret_value = H5A__write(attr, mem_type, buf)) < 0) + /* Write the attribute data */ + if((ret_value = H5VL_attr_write(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") done: @@ -650,23 +724,22 @@ done: herr_t H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) { - H5A_t *attr; /* Attribute object for ID */ - H5T_t *mem_type; /* Memory datatype */ - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* Attribute object for ID */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ii*x", attr_id, dtype_id, buf); - /* check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + /* Check arguments */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") - if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) + if(H5I_DATATYPE != H5I_get_type(dtype_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(NULL == buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL") - /* Go write the actual data to the attribute */ - if((ret_value = H5A__read(attr, mem_type, buf)) < 0) + /* Read the attribute data */ + if((ret_value = H5VL_attr_read(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") done: @@ -683,7 +756,7 @@ done: hid_t H5Aget_space (attr_id) hid_t attr_id; IN: Attribute to get dataspace of RETURNS - A dataspace ID on success, negative on failure + A dataspace ID on success, H5I_INVALID_HID on failure DESCRIPTION This function retrieves a copy of the dataspace for an attribute. @@ -693,18 +766,20 @@ done: hid_t H5Aget_space(hid_t attr_id) { - H5A_t *attr; /* Attribute object for ID */ - hid_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", attr_id); - /* check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + /* Check arguments */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") + + /* Get the dataspace */ + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute") - if((ret_value = H5A_get_space(attr)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute") done: FUNC_LEAVE_API(ret_value) } /* H5Aget_space() */ @@ -719,7 +794,7 @@ done: hid_t H5Aget_type (attr_id) hid_t attr_id; IN: Attribute to get datatype of RETURNS - A datatype ID on success, negative on failure + A datatype ID on success, H5I_INVALID_HID on failure DESCRIPTION This function retrieves a copy of the datatype for an attribute. @@ -729,18 +804,19 @@ done: hid_t H5Aget_type(hid_t attr_id) { - H5A_t *attr; /* Attribute object for ID */ - hid_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", attr_id); - /* check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + /* Check arguments */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") - if((ret_value = H5A__get_type(attr)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute") + /* Get the datatype */ + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute") done: FUNC_LEAVE_API(ret_value) @@ -757,7 +833,7 @@ done: hid_t attr_id; IN: Attribute to get name of RETURNS This function returns the ID of a copy of the attribute's creation - property list, or negative on failure. + property list, or H5I_INVALID_HID on failure. ERRORS @@ -769,20 +845,21 @@ done: hid_t H5Aget_create_plist(hid_t attr_id) { - H5A_t *attr; /* Attribute object for ID */ - hid_t ret_value; + H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", attr_id); HDassert(H5P_LST_ATTRIBUTE_CREATE_ID_g != -1); - /* Get attribute and default attribute creation property list*/ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + /* Check arguments */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") - if((ret_value = H5A__get_create_plist(attr)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for attr") + /* Get the acpl */ + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_ACPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get creation property list for attribute") done: FUNC_LEAVE_API(ret_value) @@ -813,21 +890,26 @@ done: ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) { - H5A_t *my_attr; /* Attribute object for ID */ - ssize_t ret_value; + H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */ + H5VL_loc_params_t loc_params; + ssize_t ret_value = -1; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "iz*s", attr_id, buf_size, buf); /* check arguments */ - if(NULL == (my_attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an attribute") if(!buf && buf_size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "buf cannot be NULL if buf_size is non-zero") + + /* Set location struct parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(attr_id); - /* Call private function in turn */ - if(0 > (ret_value = H5A__get_name(my_attr, buf_size, buf))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name") + /* Get the attribute name */ + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, buf_size, buf, &ret_value) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name") done: FUNC_LEAVE_API(ret_value) @@ -856,8 +938,8 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ - H5A_t *attr = NULL; /* Attribute object for name */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -866,39 +948,35 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Check args */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Open the attribute on the object header */ - if(NULL == (attr = H5A__open_by_idx(&loc, obj_name, idx_type, order, n))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + /* Get the object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Get the length of the name */ - ret_value = (ssize_t)HDstrlen(attr->shared->name); + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = obj_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); - /* Copy the name into the user's buffer, if given */ - if(name) { - HDstrncpy(name, attr->shared->name, MIN((size_t)(ret_value + 1), size)); - if((size_t)ret_value >= size) - name[size - 1]='\0'; - } /* end if */ + /* Get the name */ + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, size, name, &ret_value) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get name") done: - /* Release resources */ - if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") - FUNC_LEAVE_API(ret_value) } /* end H5Aget_name_by_idx() */ @@ -923,18 +1001,19 @@ done: hsize_t H5Aget_storage_size(hid_t attr_id) { - H5A_t *attr; /* Attribute object for ID */ + H5VL_object_t *vol_obj; hsize_t ret_value; /* Return value */ FUNC_ENTER_API(0) H5TRACE1("h", "i", attr_id); - /* Check args */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + /* Check arguments */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute") - /* Set return value */ - ret_value = attr->shared->data_size; + /* Get the storage size */ + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, 0, "unable to get acpl") done: FUNC_LEAVE_API(ret_value) @@ -957,19 +1036,23 @@ done: herr_t H5Aget_info(hid_t attr_id, H5A_info_t *ainfo) { - H5A_t *attr; /* Attribute object for name */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", attr_id, ainfo); - /* Check args */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + /* Check arguments */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(attr_id); + /* Get the attribute information */ - if(H5A__get_info(attr, ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: FUNC_LEAVE_API(ret_value) @@ -993,8 +1076,8 @@ herr_t H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5A_info_t *ainfo, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ - H5A_t *attr = NULL; /* Attribute object for name */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1002,13 +1085,11 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* Check args */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") if(NULL == ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") @@ -1016,19 +1097,20 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Open the attribute on the object header */ - if(NULL == (attr = H5A__open_by_name(&loc, obj_name, attr_name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ - if(H5A__get_info(attr, ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo, attr_name) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: - /* Release resources */ - if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") - FUNC_LEAVE_API(ret_value) } /* end H5Aget_info_by_name() */ @@ -1051,8 +1133,8 @@ herr_t H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5A_info_t *ainfo, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ - H5A_t *attr = NULL; /* Attribute object for name */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1061,15 +1143,13 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Check args */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(NULL == ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") @@ -1077,30 +1157,33 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Open the attribute on the object header */ - if(NULL == (attr = H5A__open_by_idx(&loc, obj_name, idx_type, order, n))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = obj_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ - if(H5A__get_info(attr, ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: - /* Release resources */ - if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") - FUNC_LEAVE_API(ret_value) } /* end H5Aget_info_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5Arename + * Function: H5Arename * * Purpose: Rename an attribute * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * October 23, 2002 @@ -1117,23 +1200,28 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) /* check arguments */ if(!old_name || !new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil") if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_name, new_name)) { - H5G_loc_t loc; /* Object location */ - - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; - /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") + 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") + + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") - /* Call private attribute rename routine */ - if(H5A__rename(&loc, old_name, new_name) < 0) + /* Rename the attribute */ + if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ @@ -1143,12 +1231,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Arename_by_name + * Function: H5Arename_by_name * * Purpose: Rename an attribute * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * February 20, 2007 @@ -1167,27 +1254,34 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, /* check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!old_attr_name || !*old_attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name") if(!new_attr_name || !*new_attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name") /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_attr_name, new_attr_name)) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Call private attribute rename routine */ - if(H5A__rename_by_name(loc, obj_name, old_attr_name, new_attr_name) < 0) + /* Rename the attribute */ + if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ @@ -1241,6 +1335,8 @@ herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data) { + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1248,14 +1344,21 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, /* check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); - /* Call attribute iteration routine */ - if((ret_value = H5A__iterate(loc_id, idx_type, order, idx, op, op_data)) < 0) + /* get the loc object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Iterate over attributes */ + if((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); done: @@ -1311,8 +1414,9 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, obj_name, idx_type, order, idx, op, @@ -1320,23 +1424,30 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call attribute iteration by name routine */ - if((ret_value = H5A__iterate_by_name(&loc, obj_name, idx_type, order, idx, op, op_data)) < 0) - HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + + /* get the loc object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Iterate over attributes */ + if((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) + HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed"); done: FUNC_LEAVE_API(ret_value) @@ -1360,26 +1471,35 @@ done: herr_t H5Adelete(hid_t loc_id, const char *name) { - H5G_loc_t loc; /* Object location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*s", loc_id, name); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") - /* Delete the attribute from the location */ - if(H5A__delete(&loc, name) < 0) + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + /* Delete the attribute */ + if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1407,28 +1527,37 @@ herr_t H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*s*si", loc_id, obj_name, attr_name, lapl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Delete the attribute from the location */ - if(H5A__delete_by_name(&loc, obj_name, attr_name) < 0) + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + /* Delete the attribute */ + if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1464,7 +1593,8 @@ herr_t H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1472,22 +1602,32 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Delete the attribute from the location */ - if(H5A__delete_by_idx(&loc, obj_name, idx_type, order, n) < 0) + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = obj_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + /* Delete the attribute through the VOL */ + if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1495,21 +1635,17 @@ done: } /* H5Adelete_by_idx() */ -/*-------------------------------------------------------------------------- - NAME - H5Aclose - PURPOSE - Close an attribute ID - USAGE - herr_t H5Aclose (attr_id) - hid_t attr_id; IN: Attribute to release access to - RETURNS - Non-negative on success/Negative on failure - - DESCRIPTION - This function releases an attribute from use. Further use of the - attribute ID will result in undefined behavior. ---------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------- + * Function: H5Aclose + * + * Purpose: Closes access to an attribute and releases resources used by + * it. It is illegal to subsequently use that same dataset + * ID in calls to other attribute functions. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ herr_t H5Aclose(hid_t attr_id) { @@ -1518,7 +1654,7 @@ H5Aclose(hid_t attr_id) FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", attr_id); - /* check arguments */ + /* Check arguments */ if(NULL == H5I_object_verify(attr_id, H5I_ATTR)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") @@ -1548,22 +1684,28 @@ done: htri_t H5Aexists(hid_t obj_id, const char *attr_name) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("t", "i*s", obj_id, attr_name); - /* check arguments */ - if (H5I_ATTR == H5I_get_type(obj_id)) + /* Check arguments */ + if(H5I_ATTR == H5I_get_type(obj_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if (H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if (!attr_name || !*attr_name) + if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + /* get the object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(obj_id); + /* Check if the attribute exists */ - if((ret_value = H5A__exists(&loc, attr_name)) < 0) + if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: @@ -1588,27 +1730,36 @@ htri_t H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("t", "i*s*si", loc_id, obj_name, attr_name, lapl_id); /* check arguments */ - if (H5I_ATTR == H5I_get_type(loc_id)) + if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if (H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if (!obj_name || !*obj_name) + if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") - if (!attr_name || !*attr_name) + if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - if ((ret_value = H5A__exists_by_name(loc, obj_name, attr_name)) < 0) + /* get the object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Check existence of attribute */ + if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: @@ -2620,7 +2620,7 @@ done: * * Purpose: Sets the metadata tag property in the provided property list. * - * Return: SUCCEED on success, FAIL otherwise. + * Return: void * * Programmer: Mike McGreevy * December 1, 2009 @@ -2773,7 +2773,7 @@ H5AC_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flag HDassert(f->shared); /* Call cache level function to expunge entries with specified tag and type id */ - if(H5C_expunge_tag_type_metadata(f, tag, type_id, flags)<0) + if(H5C_expunge_tag_type_metadata(f, tag, type_id, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cannot expunge tagged type entries") done: @@ -2924,16 +2924,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5AC_set_ring + * Function: H5AC_set_ring * - * Purpose: Routine to set the ring on a DXPL (for passing through - * to the metadata cache). + * Purpose: Routine to set the ring on a DXPL (for passing through + * to the metadata cache). * - * Return: Success: Non-negative - * Failure: Negative + * Return: void * - * Programmer: Quincey Koziol - * Tuesday, September 8, 2015 + * Programmer: Quincey Koziol + * Tuesday, September 8, 2015 * *------------------------------------------------------------------------- */ @@ -2942,6 +2941,8 @@ H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Note: orig_ring can be NULL so don't check it with HDassert() */ + /* Get the current ring value and return that (if orig_ring is NOT null) */ if(orig_ring) *orig_ring = H5CX_get_ring(); diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 99cc0e9..0e8620d 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -435,7 +435,7 @@ H5_DLL herr_t H5AC_get_mdc_image_info(H5AC_t *cache_ptr, haddr_t *image_addr, /* Tag & Ring routines */ H5_DLL void H5AC_tag(haddr_t metadata_tag, haddr_t *prev_tag); H5_DLL herr_t H5AC_flush_tagged_metadata(H5F_t *f, haddr_t metadata_tag); -H5_DLL herr_t H5AC_evict_tagged_metadata(H5F_t * f, haddr_t metadata_tag, hbool_t match_global); +H5_DLL herr_t H5AC_evict_tagged_metadata(H5F_t *f, haddr_t metadata_tag, hbool_t match_global); H5_DLL herr_t H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag); H5_DLL herr_t H5AC_ignore_tags(const H5F_t *f); H5_DLL herr_t H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked); diff --git a/src/H5Adense.c b/src/H5Adense.c index 3701022..5bed82d 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -164,11 +164,11 @@ typedef struct H5A_bt2_ud_rmbi_t { /*------------------------------------------------------------------------- - * Function: H5A__dense_create + * Function: H5A__dense_create * - * Purpose: Creates dense attribute storage structures for an object + * Purpose: Creates dense attribute storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -188,9 +188,7 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); @@ -286,11 +284,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_fnd_cb + * Function: H5A__dense_fnd_cb * - * Purpose: Callback when an attribute is located in an index + * Purpose: Callback when an attribute is located in an index * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -305,9 +303,7 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) FUNC_ENTER_STATIC_NOERR - /* - * Check arguments. - */ + /* Check arguments */ HDassert(attr); HDassert(user_attr); @@ -320,11 +316,11 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) /*------------------------------------------------------------------------- - * Function: H5A__dense_open + * Function: H5A__dense_open * - * Purpose: Open an attribute in dense storage structures for an object + * Purpose: Open an attribute in dense storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -345,9 +341,7 @@ H5A__dense_open(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(name); @@ -411,11 +405,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_insert + * Function: H5A__dense_insert * - * Purpose: Insert an attribute into dense storage structures for an object + * Purpose: Insert an attribute into dense storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -439,9 +433,7 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(attr); @@ -570,13 +562,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_write_bt2_cb2 + * Function: H5A__dense_write_bt2_cb2 * - * Purpose: v2 B-tree 'modify' callback to update the record for a creation - * order index + * Purpose: v2 B-tree 'modify' callback to update the record for a creation + * order index * - * Return: Success: 0 - * Failure: 1 + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, February 20, 2007 @@ -591,9 +582,7 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed) FUNC_ENTER_STATIC_NOERR - /* - * Check arguments. - */ + /* Check arguments */ HDassert(record); HDassert(new_heap_id); @@ -608,12 +597,11 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed) /*------------------------------------------------------------------------- - * Function: H5A__dense_write_bt2_cb + * Function: H5A__dense_write_bt2_cb * - * Purpose: v2 B-tree 'modify' callback to update the data for an attribute + * Purpose: v2 B-tree 'modify' callback to update the data for an attribute * - * Return: Success: 0 - * Failure: 1 + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 5, 2006 @@ -632,9 +620,7 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed) FUNC_ENTER_STATIC - /* - * Check arguments. - */ + /* Check arguments */ HDassert(record); HDassert(op_data); @@ -722,11 +708,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_write + * Function: H5A__dense_write * - * Purpose: Modify an attribute in dense storage structures for an object + * Purpose: Modify an attribute in dense storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -747,9 +733,7 @@ H5A__dense_write(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(H5F_addr_defined(ainfo->fheap_addr)); @@ -820,12 +804,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_copy_fh_cb + * Function: H5A__dense_copy_fh_cb * - * Purpose: Callback for fractal heap operator, to make copy of attribute + * Purpose: Callback for fractal heap operator, to make copy of attribute * for calling routine * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -864,11 +848,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_rename + * Function: H5A__dense_rename * - * Purpose: Rename an attribute in dense storage structures for an object + * Purpose: Rename an attribute in dense storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -892,9 +876,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(old_name); @@ -996,7 +978,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count") } /* end if */ else if(shared_mesg < 0) - HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared") + HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared") /* Delete old attribute from dense storage */ if(H5A__dense_remove(f, ainfo, old_name) < 0) @@ -1018,11 +1000,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_iterate_bt2_cb + * Function: H5A__dense_iterate_bt2_cb * - * Purpose: v2 B-tree callback for dense attribute storage iterator + * Purpose: v2 B-tree callback for dense attribute storage iterator * - * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP + * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1030,7 +1012,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +static int H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) { const H5A_dense_bt2_name_rec_t *record = (const H5A_dense_bt2_name_rec_t *)_record; /* Record from B-tree */ @@ -1114,11 +1096,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_iterate + * Function: H5A__dense_iterate * - * Purpose: Iterate over attributes in dense storage structures for an object + * Purpose: Iterate over attributes in dense storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1140,9 +1122,7 @@ H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo, FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(H5F_addr_defined(ainfo->fheap_addr)); @@ -1251,11 +1231,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_remove_bt2_cb + * Function: H5A__dense_remove_bt2_cb * - * Purpose: v2 B-tree callback for dense attribute storage record removal + * Purpose: v2 B-tree callback for dense attribute storage record removal * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1315,11 +1295,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_remove + * Function: H5A__dense_remove * - * Purpose: Remove an attribute from the dense storage of an object + * Purpose: Remove an attribute from the dense storage of an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1340,9 +1320,7 @@ H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(name && *name); @@ -1398,18 +1376,18 @@ done: if(bt2_name && H5B2_close(bt2_name) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") if(attr_copy) - H5O__msg_free_real(H5O_MSG_ATTR, attr_copy); + H5O_msg_free_real(H5O_MSG_ATTR, attr_copy); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_remove() */ /*------------------------------------------------------------------------- - * Function: H5A__dense_remove_by_idx_bt2_cb + * Function: H5A__dense_remove_by_idx_bt2_cb * - * Purpose: v2 B-tree callback for dense attribute storage record removal by index + * Purpose: v2 B-tree callback for dense attribute storage record removal by index * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1530,12 +1508,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_remove_by_idx + * Function: H5A__dense_remove_by_idx * - * Purpose: Remove an attribute from the dense storage of an object, - * according to the order within an index + * Purpose: Remove an attribute from the dense storage of an object, + * according to the order within an index * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1556,9 +1534,7 @@ H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); @@ -1660,12 +1636,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_exists + * Function: H5A__dense_exists * - * Purpose: Check if an attribute exists in dense storage structures for + * Purpose: Check if an attribute exists in dense storage structures for * an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1685,9 +1661,7 @@ H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(name); @@ -1749,11 +1723,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_delete_bt2_cb + * Function: H5A__dense_delete_bt2_cb * - * Purpose: v2 B-tree callback for dense attribute storage deletion + * Purpose: v2 B-tree callback for dense attribute storage deletion * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1806,18 +1780,18 @@ H5A__dense_delete_bt2_cb(const void *_record, void *_bt2_udata) done: /* Release resources */ if(attr) - H5O__msg_free_real(H5O_MSG_ATTR, attr); + H5O_msg_free_real(H5O_MSG_ATTR, attr); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_delete_bt2_cb() */ /*------------------------------------------------------------------------- - * Function: H5A__dense_delete + * Function: H5A__dense_delete * - * Purpose: Delete all dense storage structures for attributes on an object + * Purpose: Delete all dense storage structures for attributes on an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1834,9 +1808,7 @@ H5A__dense_delete(H5F_t *f, H5O_ainfo_t *ainfo) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 9b592b0..b43e41d 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -36,13 +36,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Opkg.h" /* Object headers */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Opkg.h" /* Object headers */ +#include "H5VLprivate.h" /* Virtual object layer */ /****************/ @@ -95,7 +96,7 @@ hid_t space_id; IN: ID of dataspace for attribute hid_t acpl_id; IN: ID of creation property list (currently not used) RETURNS - Non-negative on success/Negative on failure + Non-negative on success/H5I_INVALID_HID on failure DESCRIPTION This function creates an attribute which is attached to the object @@ -111,50 +112,65 @@ --------------------------------------------------------------------------*/ hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, - hid_t acpl_id) + hid_t acpl_id) { - H5A_t *attr = NULL; /* Attribute created */ - H5G_loc_t loc; /* Object location */ - H5T_t *type; /* Datatype to use for attribute */ - H5S_t *space; /* Dataspace to use for attribute */ - hid_t ret_value; /* Return value */ + void *attr = NULL; /* attr token from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist; /* Property list pointer */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, acpl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type") - if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read") - /* Go do the real work for attaching the attribute to the dataset */ - if(NULL == (attr = H5A__create(&loc, name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") + /* Get correct property list */ + if(H5P_DEFAULT == acpl_id) + acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT; + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") + + /* Set creation properties */ + if(H5P_set(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id") + if(H5P_set(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Create the attribute */ + if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ - if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: - /* Cleanup on failure */ - if(ret_value < 0 && attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + /* Clean up on failure */ + if(H5I_INVALID_HID == ret_value) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) -} /* H5Acreate1() */ +} /* end H5Acreate1() */ /*-------------------------------------------------------------------------- @@ -167,7 +183,7 @@ done: hid_t loc_id; IN: Object (dataset or group) to be attached to const char *name; IN: Name of attribute to locate and open RETURNS - ID of attribute on success, negative on failure + ID of attribute on success, H5I_INVALID_HID on failure DESCRIPTION This function opens an existing attribute for access. The attribute @@ -182,34 +198,41 @@ done: hid_t H5Aopen_name(hid_t loc_id, const char *name) { - H5G_loc_t loc; /* Object location */ - H5A_t *attr = NULL; /* Attribute opened */ - hid_t ret_value; + void *attr = NULL; /* attr token from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") - /* Open the attribute on the object header */ - if(NULL == (attr = H5A__open_by_name(&loc, ".", name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute: '%s'", name) + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Open the attribute */ + if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ - if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: - /* Cleanup on failure */ - if(ret_value < 0) - if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + /* Clean up on failure */ + if(H5I_INVALID_HID == ret_value) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Aopen_name() */ @@ -225,7 +248,7 @@ done: hid_t loc_id; IN: Object that attribute is attached to unsigned idx; IN: Index (0-based) attribute to open RETURNS - ID of attribute on success, negative on failure + ID of attribute on success, H5I_INVALID_HID on failure DESCRIPTION This function opens an existing attribute for access. The attribute @@ -240,32 +263,44 @@ done: hid_t H5Aopen_idx(hid_t loc_id, unsigned idx) { - H5G_loc_t loc; /* Object location */ - H5A_t *attr = NULL; /* Attribute opened */ - hid_t ret_value; + void *attr = NULL; /* attr token from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "iIu", loc_id, idx); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - - /* Open the attribute in the object header */ - if(NULL == (attr = H5A__open_by_idx(&loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)idx))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = "."; + loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_CRT_ORDER; + loc_params.loc_data.loc_by_idx.order = H5_ITER_INC; + loc_params.loc_data.loc_by_idx.n = (hsize_t)idx; + loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Open the attribute */ + if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ - if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: - /* Cleanup on failure */ - if(ret_value < 0) - if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + /* Clean up on failure */ + if(H5I_INVALID_HID == ret_value) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Aopen_idx() */ @@ -292,56 +327,26 @@ done: int H5Aget_num_attrs(hid_t loc_id) { - H5O_loc_t *loc; /* Object location for attribute */ - void *obj; - int ret_value; + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + H5O_info_t oinfo; + int ret_value = -1; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", loc_id); - /* check arguments */ - if(H5I_BADID == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad location ID") - if(H5I_FILE == H5I_get_type(loc_id) || H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(NULL == (obj = H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADATOM, FAIL, "illegal object atom") - switch(H5I_get_type (loc_id)) { - case H5I_DATASET: - if(NULL == (loc = H5D_oloc((H5D_t*)obj))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object") - break; - - case H5I_DATATYPE: - if(NULL == (loc = H5T_oloc((H5T_t*)obj))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "target datatype is not committed") - break; - - case H5I_GROUP: - if(NULL == (loc = H5G_oloc((H5G_t*)obj))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object") - break; - - case H5I_UNINIT: - case H5I_BADID: - case H5I_FILE: - case H5I_DATASPACE: - case H5I_ATTR: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "inappropriate attribute target") - } /*lint !e788 All appropriate cases are covered */ - - /* Look up the # of attributes for the object */ - if((ret_value = H5A__get_num_attrs(loc)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object") + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + + /* Get the number of attributes for the object */ + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, &oinfo, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object") + + H5_CHECKED_ASSIGN(ret_value, int, oinfo.num_attrs, hsize_t); done: FUNC_LEAVE_API(ret_value) @@ -388,18 +393,23 @@ done: herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data) { - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + herr_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5_ITER_ERROR) H5TRACE4("e", "i*Iux*x", loc_id, attr_num, op, op_data); /* check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "location is not valid for an attribute") + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier") /* Call attribute iteration routine */ - if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0) - HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); + if((ret_value = H5VL_attr_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_ATTR_ITERATE_OLD, loc_id, attr_num, op, op_data)) < 0) + HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes"); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Aint.c b/src/H5Aint.c index 55560c7..6502fa4 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -42,6 +42,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object headers */ #include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -87,9 +88,6 @@ typedef struct { /* Local Prototypes */ /********************/ -static H5A_t *H5A__create_common(const H5G_loc_t *loc, const char *name, - const H5T_t *type, const H5S_t *space, hid_t acpl_id); -static herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr); static herr_t H5A__compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/); static herr_t H5A__dense_build_table_cb(const H5A_t *attr, void *_udata); @@ -127,7 +125,7 @@ H5FL_SEQ_DEFINE(H5A_t_ptr); /*------------------------------------------------------------------------- - * Function: H5A__create_common + * Function: H5A__create * * Purpose: This is the guts of creating an attribute. * @@ -138,8 +136,8 @@ H5FL_SEQ_DEFINE(H5A_t_ptr); * *------------------------------------------------------------------------- */ -static H5A_t * -H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type, +H5A_t * +H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, const H5S_t *space, hid_t acpl_id) { H5A_t *attr = NULL; /* Attribute created */ @@ -148,11 +146,11 @@ H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type, htri_t exists; /* Whether attribute exists */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_STATIC_TAG(loc->oloc->addr) + FUNC_ENTER_PACKAGE_TAG(loc->oloc->addr) /* Check args */ HDassert(loc); - HDassert(name); + HDassert(attr_name); HDassert(type); HDassert(space); @@ -161,7 +159,7 @@ H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type, * name, but it's going to be hard to unwind all the special cases on * failure, so just check first, for now - QAK) */ - if((exists = H5O__attr_exists(loc->oloc, name)) < 0) + if((exists = H5O__attr_exists(loc->oloc, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes") else if(exists > 0) HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists") @@ -196,7 +194,7 @@ H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type, } /* end else */ /* Copy the attribute name */ - attr->shared->name = H5MM_xstrdup(name); + attr->shared->name = H5MM_xstrdup(attr_name); /* Copy datatype */ if(NULL == (attr->shared->dt = H5T_copy(type, H5T_COPY_ALL))) @@ -234,15 +232,15 @@ H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type, * SOHM table */ if(H5SM_try_share(attr->oloc.file, NULL, 0, H5O_DTYPE_ID, attr->shared->dt, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share datatype failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share datatype failed") if(H5SM_try_share(attr->oloc.file, NULL, 0, H5O_SDSPACE_ID, attr->shared->ds, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share dataspace failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share dataspace failed") /* Check whether datatype is committed & increment ref count * (to maintain ref. count incr/decr similarity with "shared message" * type of datatype sharing) */ - if(H5T_committed(attr->shared->dt)) + if(H5T_is_named(attr->shared->dt)) /* Increment the reference count on the shared datatype */ if(H5T_link(attr->shared->dt, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, NULL, "unable to adjust shared datatype link count") @@ -285,45 +283,6 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* H5A__create_common() */ - - -/*------------------------------------------------------------------------- - * Function: H5A__create - * - * Purpose: Entry point for creating attribute on an object - * - * Note: This routine is needed so that there's a non-API routine for - * creating attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Attribute structure on success, NULL on Failure. - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -H5A_t * -H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, - const H5S_t *space, hid_t acpl_id) -{ - H5A_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check args */ - HDassert(loc); - HDassert(name); - HDassert(type); - HDassert(space); - - /* Go do the real work for attaching the attribute to the object */ - if(NULL == (ret_value = H5A__create_common(loc, name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, NULL, "unable to create attribute") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) } /* H5A__create() */ @@ -350,7 +309,7 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -368,8 +327,8 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr loc_found = TRUE; /* Go do the real work for attaching the attribute to the object */ - if(NULL == (attr = H5A__create_common(&obj_loc, attr_name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") + if(NULL == (attr = H5A__create(&obj_loc, attr_name, type, space, acpl_id))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") /* Set return value */ ret_value = attr; @@ -384,7 +343,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__create_by_name() */ @@ -406,12 +365,12 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -446,15 +405,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__open - * - * Purpose: Open an attribute in an object header + * Function: H5A__open * - * Note: This routine is needed so that there's a non-API routine for - * creating attributes that can set up VOL / SWMR info - * (which need a DXPL). + * Purpose: Open an attribute in an object header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 9, 2017 @@ -467,7 +422,7 @@ H5A__open(const H5G_loc_t *loc, const char *attr_name) H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -490,7 +445,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open() */ @@ -517,7 +472,7 @@ H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -554,16 +509,16 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5A__open_by_name + * Function: H5A__open_by_name * - * Purpose: Open an attribute in an object header, according to it's name + * Purpose: Open an attribute in an object header, according to it's name * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 11, 2006 @@ -580,7 +535,7 @@ H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_n H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -618,7 +573,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_name() */ @@ -652,7 +607,7 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf) size_t buf_size; /* desired buffer size */ herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_VOL_TAG(attr->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr) HDassert(attr); HDassert(mem_type); @@ -721,7 +676,7 @@ done: if(bkg_buf) bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__read() */ @@ -756,7 +711,7 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf) size_t buf_size; /* desired buffer size */ herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_VOL_TAG(attr->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr) HDassert(attr); HDassert(mem_type); @@ -835,7 +790,7 @@ done: if(bkg_buf) bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__write() */ @@ -939,7 +894,7 @@ H5A__get_type(H5A_t *attr) H5T_t *dt = NULL; hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(attr); @@ -963,14 +918,25 @@ H5A__get_type(H5A_t *attr) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to lock transient datatype") /* Atomize */ - if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype") + if (H5T_is_named(dt)) { + /* If this is a committed datatype, we need to recreate the + * two level IDs, where the VOL object is a copy of the + * returned datatype + */ + if ((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + } + else { + if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype") + } done: - if(H5I_INVALID_HID == ret_value && dt && (H5T_close(dt) < 0)) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") + if(H5I_INVALID_HID == ret_value) + if(dt && H5T_close(dt) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_type() */ @@ -1062,21 +1028,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__copy + * Function: H5A__copy * - * Purpose: Copies attribute OLD_ATTR. + * Purpose: Copies attribute OLD_ATTR. * - * Return: Success: Pointer to a new copy of the OLD_ATTR argument. + * Return: Success: Pointer to a new copy of the OLD_ATTR argument. * - * Failure: NULL + * Failure: NULL * * Programmer: Robb Matzke * Thursday, December 4, 1997 * - * Modification:Raymond Lu - * 4 June 2008 - * Changed some attribute information to be shared. - * *------------------------------------------------------------------------- */ H5A_t * @@ -1129,18 +1091,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__free + * Function: H5A__free * - * Purpose: Frees all memory associated with an attribute, but does not + * Purpose: Frees all memory associated with an attribute, but does not * free the H5A_t structure (which should be done in H5T_close). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, November 15, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1159,12 +1119,12 @@ H5A__free(H5A_t *attr) } if(attr->shared->dt) { if(H5T_close_real(attr->shared->dt) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info") attr->shared->dt = NULL; } if(attr->shared->ds) { if(H5S_close(attr->shared->ds) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info") attr->shared->ds = NULL; } if(attr->shared->data) @@ -1176,43 +1136,43 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__close_cb - * - * Purpose: Frees an attribute and all associated memory. + * Function: H5A__close_cb * - * Return: Non-negative on success/Negative on failure + * Purpose: Called when the ref count reaches zero on the attribute's ID * - * Programmer: Quincey Koziol - * Sunday, February 18, 1997 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5A__close_cb(H5A_t *attr) +H5A__close_cb(H5VL_object_t *attr_vol_obj) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(attr); - HDassert(attr->shared); + HDassert(attr_vol_obj); + + /* Close the attribute */ + if((ret_value = H5VL_attr_close(attr_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute") - /* Call the actual close routine */ - if(H5A__close(attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "problem closing attribute") + /* Free the VOL object */ + if(H5VL_free_object(attr_vol_obj) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__close_cb() */ /*------------------------------------------------------------------------- - * Function: H5A__close + * Function: H5A__close * - * Purpose: Frees an attribute and all associated memory. + * Purpose: Frees an attribute and all associated memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Monday, December 8, 1997 @@ -1355,45 +1315,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__exists - * - * Purpose: Private version of H5Aexists - * - * Note: This routine is needed so that there's a non-API routine for - * detecting attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: TRUE/FALSE - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -htri_t -H5A__exists(const H5G_loc_t *loc, const char *name) -{ - htri_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check if the attribute exists */ - if((ret_value = H5O__attr_exists(loc->oloc, name)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__exists() */ - - -/*------------------------------------------------------------------------- - * Function: H5A__exists_by_name + * Function: H5A__exists_by_name * - * Purpose: Private version of H5Aexists_by_name + * Purpose: Private version of H5Aexists_by_name * - * Return: Success: TRUE/FALSE - * Failure: Negative + * Return: TRUE/FALSE/FAIL * * Programmer: Quincey Koziol * Thursday, November 1, 2007 @@ -1409,7 +1335,7 @@ H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name) hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1430,7 +1356,7 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__exists_by_name() */ @@ -1501,11 +1427,10 @@ done: * Purpose: Builds a table containing a sorted list of attributes for * an object * - * Note: Used for building table of attributes in non-native iteration + * Note: Used for building table of attributes in non-native iteration * order for an index * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Dec 18, 2006 @@ -1604,17 +1529,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_build_table + * Function: H5A__dense_build_table * * Purpose: Builds a table containing a sorted list of attributes for * an object * - * Note: Used for building table of attributes in non-native iteration + * Note: Used for building table of attributes in non-native iteration * order for an index. Uses the "name" index to retrieve records, - * but the 'idx_type' index for sorting them. + * but the 'idx_type' index for sorting them. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Dec 11, 2006 @@ -1861,13 +1785,12 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type, /*------------------------------------------------------------------------- - * Function: H5A__attr_iterate_table + * Function: H5A__attr_iterate_table * * Purpose: Iterate over table containing a list of attributes for an object, * making appropriate callbacks * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Dec 18, 2006 @@ -1944,12 +1867,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__attr_release_table + * Function: H5A__attr_release_table * - * Purpose: Release table containing a list of attributes for an object + * Purpose: Release table containing a list of attributes for an object * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Dec 11, 2006 @@ -1991,8 +1913,8 @@ done: * Purpose: Retrieves the "attribute info" message for an object. Also * sets the number of attributes correctly, if it isn't set up yet. * - * Return: Success: TRUE/FALSE whether message was found & retrieved - * Failure: FAIL if error occurred + * Return: Success: TRUE/FALSE whether message was found & retrieved + * Failure: FAIL if error occurred * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -2056,8 +1978,7 @@ done: * Chooses the oldest version possible, unless the * file's low bound indicates otherwise. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -2190,14 +2111,14 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s if(H5T_set_loc(attr_dst->shared->dt, file_dst, H5T_LOC_DISK) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "cannot mark datatype on disk") - if(!H5T_committed(attr_src->shared->dt)) { + if(!H5T_is_named(attr_src->shared->dt)) { /* If the datatype is not named, it may have been shared in the * source file's heap. Un-share it for now. We'll try to shared * it in the destination file below. */ if(H5O_msg_reset_share(H5O_DTYPE_ID, attr_dst->shared->dt) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to reset datatype sharing") - } /* end if */ + } /* Copy the dataspace for the attribute. Make sure the maximal dimension is also copied. * Otherwise the comparison in the test may complain about it. SLU 2011/4/12 */ @@ -2215,9 +2136,9 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s * committed or sharing is disabled. */ if(H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_DTYPE_ID, attr_dst->shared->dt, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute datatype") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute datatype") if(H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_SDSPACE_ID, attr_dst->shared->ds, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute dataspace") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute dataspace") /* Compute the sizes of the datatype and dataspace. This is their raw * size unless they're shared. @@ -2404,7 +2325,7 @@ done: * an object may have a reference attribute that points to the * object itself. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Peter Cao * March 6, 2005 @@ -2432,7 +2353,7 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, HDassert(file_src); HDassert(file_dst); - if(H5T_committed(attr_src->shared->dt)) { + if (H5T_is_named(attr_src->shared->dt)) { H5O_loc_t *src_oloc_dt; /* Pointer to source datatype's object location */ H5O_loc_t *dst_oloc_dt; /* Pointer to dest. datatype's object location */ @@ -2452,7 +2373,7 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, /* Update shared message info from named datatype info */ H5T_update_shared(attr_dst->shared->dt); - } /* end if */ + } /* Try to share both the datatype and dataset. This does nothing if the * datatype is committed or sharing is disabled. @@ -2555,8 +2476,7 @@ done: * * Purpose: Copy all dense attributes from SRC to DST. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Peter Cao * xcao@hdfgroup.org @@ -2599,45 +2519,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__rename - * - * Purpose: Private version of H5Arename - * - * Note: This routine is needed so that there's a non-API routine for - * renaming attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5A__rename(const H5G_loc_t *loc, const char *old_name, const char *new_name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Call object header attribute rename routine */ - if(H5O__attr_rename(loc->oloc, old_name, new_name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__rename() */ - - -/*------------------------------------------------------------------------- - * Function: H5A__rename_by_name + * Function: H5A__rename_by_name * * Purpose: Private version of H5Arename_by_name * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * February 20, 2007 @@ -2654,73 +2540,40 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL - - /* Set up opened group location to fill in */ - obj_loc.oloc = &obj_oloc; - obj_loc.path = &obj_path; - H5G_loc_reset(&obj_loc); - - /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") - loc_found = TRUE; + FUNC_ENTER_PACKAGE - /* Call attribute rename routine */ - if(H5O__attr_rename(obj_loc.oloc, old_attr_name, new_attr_name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") + /* Avoid thrashing things if the names are the same */ + if(HDstrcmp(old_attr_name, new_attr_name)) { + /* Set up opened group location to fill in */ + obj_loc.oloc = &obj_oloc; + obj_loc.path = &obj_path; + H5G_loc_reset(&obj_loc); + + /* Find the object's location */ + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") + loc_found = TRUE; + + /* Call attribute rename routine */ + if(H5O__attr_rename(obj_loc.oloc, old_attr_name, new_attr_name) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") + } /* end if */ done: /* Release resources */ if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__rename_by_name() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5A__get_num_attrs - * - * Purpose: Private version of deprecated H5Aget_num_attrs - * - * Note: This routine is needed so that there's a non-API routine for - * querying the attribute count that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -int -H5A__get_num_attrs(const H5O_loc_t *loc) -{ - int ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Look up the # of attributes for the object */ - if((ret_value = H5O__attr_count(loc)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__get_num_attrs() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - /*------------------------------------------------------------------------- - * Function: H5A__iterate_common + * Function: H5A__iterate_common * * Purpose: Internal common version of H5Aiterate * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 @@ -2751,52 +2604,76 @@ H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, /*------------------------------------------------------------------------- - * Function: H5A__iterate + * Function: H5A__iterate * * Purpose: Private version of H5Aiterate2 * - * Note: This routine is needed so that there's a non-API routine for - * iterating over attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, +H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data) { + H5G_loc_t obj_loc; /* Location used to open group */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ + hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ + hid_t obj_loc_id = H5I_INVALID_HID; /* ID for object located */ H5A_attr_iter_op_t attr_op; /* Attribute operator */ + void *temp_obj = NULL; + H5I_type_t obj_type; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_APP2; attr_op.u.app_op2 = op; + /* Set up opened group location to fill in */ + obj_loc.oloc = &obj_oloc; + obj_loc.path = &obj_path; + H5G_loc_reset(&obj_loc); + + /* Find the object's location */ + if(H5G_loc_find(loc, obj_name, &obj_loc) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found"); + loc_found = TRUE; + + /* Open the object */ + if(NULL == (temp_obj = H5O_open_by_loc(&obj_loc, &obj_type))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object"); + + /* Get an ID for the object */ + if((obj_loc_id = H5VL_wrap_register(obj_type, temp_obj, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype"); + /* Call internal attribute iteration routine */ - if((ret_value = H5A__iterate_common(loc_id, idx_type, order, idx, &attr_op, op_data)) < 0) + if((ret_value = H5A__iterate_common(obj_loc_id, idx_type, order, idx, &attr_op, op_data)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__iterate() */ + /* Release resources */ + if(obj_loc_id != H5I_INVALID_HID) { + if(H5I_dec_app_ref(obj_loc_id) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object"); + } /* end if */ + else if(loc_found && H5G_loc_free(&obj_loc) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location"); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5A__iterate() */ #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5A__iterate_old + * Function: H5A__iterate_old * * Purpose: Private version of H5Aiterate1 * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 @@ -2811,7 +2688,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, hsize_t idx; /* Index of attribute to start iterating at */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE_NOERR /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_APP; @@ -2822,124 +2699,23 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, /* Call internal attribute iteration routine */ if((ret_value = H5A__iterate_common(loc_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, &idx, &attr_op, op_data)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") + HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); /* Translate hsize_t index value to legacy unsigned index value*/ if(attr_num) *attr_num = (unsigned)idx; -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate_old() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- - * Function: H5A__iterate_by_name - * - * Purpose: Private version of H5Aiterate_by_name - * - * Note: This routine is needed so that there's a non-API routine for - * iterating over attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, - void *op_data) -{ - H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ - hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ - hid_t obj_loc_id = (-1); /* ID for object located */ - H5A_attr_iter_op_t attr_op; /* Attribute operator */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Set up opened group location to fill in */ - obj_loc.oloc = &obj_oloc; - obj_loc.path = &obj_path; - H5G_loc_reset(&obj_loc); - - /* Find the object's location */ - if(H5G_loc_find(loc, obj_name, &obj_loc/*out*/) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") - loc_found = TRUE; - - /* Open the object */ - if((obj_loc_id = H5O__open_by_loc(&obj_loc, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object") - - /* Build attribute operator info */ - attr_op.op_type = H5A_ATTR_OP_APP2; - attr_op.u.app_op2 = op; - - /* Call attribute iteration routine */ - if((ret_value = H5A__iterate_common(obj_loc_id, idx_type, order, idx, &attr_op, op_data)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") - -done: - /* Release resources */ - if(obj_loc_id > 0) { - if(H5I_dec_app_ref(obj_loc_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") - } /* end if */ - else if(loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__iterate_by_name() */ - - -/*------------------------------------------------------------------------- - * Function: H5A__delete - * - * Purpose: Private version of H5Adelete - * - * Note: This routine is needed so that there's a non-API routine for - * deleting attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5A__delete(const H5G_loc_t *loc, const char *name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Call object header attribute delete attribute routine */ - if(H5O__attr_remove(loc->oloc, name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__delete() */ - - -/*------------------------------------------------------------------------- * Function: H5A__delete_by_name * * Purpose: Private version of H5Adelete_by_name * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 @@ -2955,7 +2731,7 @@ H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2976,7 +2752,7 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__delete_by_name() */ @@ -2985,8 +2761,7 @@ done: * * Purpose: Private version of H5Adelete_by_idx * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 @@ -3003,7 +2778,7 @@ H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ty hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -3024,6 +2799,6 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__delete_by_idx() */ diff --git a/src/H5Apkg.h b/src/H5Apkg.h index af16b55..cfe9dae 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -155,6 +155,21 @@ typedef struct { H5A_t **attrs; /* Pointer to array of attribute pointers */ } H5A_attr_table_t; +/* Types for optional attribute VOL operations */ +typedef enum H5VL_attr_optional_t { + H5VL_ATTR_ITERATE_OLD /* H5Aiterate (deprecated routine) */ + /* (This enum value should have an + * "#ifndefH5_NO_DEPRECATED_SYMBOLS" + * around it, but the compiler + * complains about an empty enum + * when deprecated symbols are + * disabled currently. When + * another enum value is added, + * please put the #ifdef around + * this symbol. QAK - 2018/12/06 + */ +} H5VL_attr_optional_t; + /*****************************/ /* Package Private Variables */ @@ -191,37 +206,28 @@ H5_DLL H5A_t *H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name); H5_DLL H5A_t *H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n); +H5_DLL herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr); H5_DLL H5A_t *H5A__copy(H5A_t *new_attr, const H5A_t *old_attr); H5_DLL hid_t H5A__get_type(H5A_t *attr); H5_DLL herr_t H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo); H5_DLL hid_t H5A__get_create_plist(H5A_t* attr); H5_DLL herr_t H5A__free(H5A_t *attr); H5_DLL herr_t H5A__close(H5A_t *attr); -H5_DLL herr_t H5A__close_cb(H5A_t *attr); +H5_DLL herr_t H5A__close_cb(H5VL_object_t *attr_vol_obj); H5_DLL htri_t H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo); H5_DLL herr_t H5A__set_version(const H5F_t *f, H5A_t *attr); -H5_DLL herr_t H5A__rename(const H5G_loc_t *loc, const char *old_name, - const char *new_name); H5_DLL herr_t H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_name, const char *new_attr_name); -#ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL int H5A__get_num_attrs(const H5O_loc_t *loc); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ -H5_DLL herr_t H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, +H5_DLL herr_t H5A__iterate(const H5G_loc_t *loc, const char *obj_name,H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data); -H5_DLL herr_t H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, - void *op_data); #ifndef H5_NO_DEPRECATED_SYMBOLS H5_DLL herr_t H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data); #endif /* H5_NO_DEPRECATED_SYMBOLS */ -H5_DLL herr_t H5A__delete(const H5G_loc_t *loc, const char *name); H5_DLL herr_t H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name); H5_DLL herr_t H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n); -H5_DLL htri_t H5A__exists(const H5G_loc_t *loc, const char *name); H5_DLL htri_t H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name); H5_DLL herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf); H5_DLL herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf); diff --git a/src/H5Atest.c b/src/H5Atest.c index 31fbe8e..6fc1cbf 100644 --- a/src/H5Atest.c +++ b/src/H5Atest.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Atest.c - * Dec 18 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5Atest.c * - * Purpose: Attribute testing routines. + * Purpose: Attribute testing routines. * *------------------------------------------------------------------------- */ @@ -27,19 +25,20 @@ /****************/ #include "H5Amodule.h" /* This source code file is part of the H5A module */ -#define H5A_TESTING /*suppress warning about H5A testing funcs*/ +#define H5A_TESTING /* Suppress warning about H5A testing funcs */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5SMprivate.h" /* Shared object header messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5SMprivate.h" /* Shared object header messages */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -78,12 +77,11 @@ /*------------------------------------------------------------------------- - * Function: H5A__is_shared_test + * Function: H5A__is_shared_test * * Purpose: Check if an attribute is shared * - * Return: Success: Non-negative - * Failure: Negative + * Return: TRUE/FALSE/FAIL * * Programmer: Quincey Koziol * Dec 19, 2006 @@ -99,7 +97,7 @@ H5A__is_shared_test(hid_t attr_id) FUNC_ENTER_PACKAGE /* Check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (attr = (H5A_t *)H5VL_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") /* Check if attribute is shared */ @@ -111,12 +109,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__get_shared_rc_test + * Function: H5A__get_shared_rc_test * * Purpose: Retrieve the refcount for a shared attribute * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Dec 19, 2006 @@ -127,13 +124,13 @@ herr_t H5A__get_shared_rc_test(hid_t attr_id, hsize_t *ref_count) { H5A_t *attr; /* Attribute object for ID */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (attr = (H5A_t *)H5VL_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") /* Push API context */ @@ -471,12 +471,12 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, * Create the new B-tree node. */ if(H5B_create(f, shared->type, udata, &split_bt_ud->addr/*out*/) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree") cache_udata.f = f; cache_udata.type = shared->type; cache_udata.rc_shared = bt_ud->bt->rc_shared; if(NULL == (split_bt_ud->bt = (H5B_t *)H5AC_protect(f, H5AC_BT, split_bt_ud->addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree") split_bt_ud->bt->level = bt_ud->bt->level; /* @@ -220,7 +220,7 @@ H5B2_open(H5F_t *f, haddr_t addr, void *ctx_udata) /* Look up the B-tree header */ if(NULL == (hdr = H5B2__hdr_protect(f, addr, ctx_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header") /* Check for pending heap deletion */ if(hdr->pending_delete) diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index e9b6810..68669e8 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -523,8 +523,7 @@ done: *------------------------------------------------------------------------- */ H5B2_hdr_t * -H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, - unsigned flags) +H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, unsigned flags) { H5B2_hdr_cache_ud_t udata; /* User data for cache callbacks */ H5B2_hdr_t *hdr = NULL; /* v2 B-tree header */ diff --git a/src/H5B2private.h b/src/H5B2private.h index 83a5272..0b64381 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -25,9 +25,6 @@ #ifndef _H5B2private_H #define _H5B2private_H -/* Include package's public header */ -#include "H5B2public.h" - /* Private headers needed by this file */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Fprivate.h" /* File access */ diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index 5cad81b..c491783 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -80,7 +80,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Get shared info for B-tree */ if(NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); HDassert(shared); @@ -91,7 +91,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, cache_udata.type = type; cache_udata.rc_shared = rc_shared; if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") /* * Print the values. diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index e203b87..5aa3628 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -27,7 +27,6 @@ #ifndef _H5Bprivate_H #define _H5Bprivate_H -#include "H5Bpublic.h" /*API prototypes */ /* Private headers needed by this file */ #include "H5private.h" /* Generic Functions */ @@ -1284,7 +1284,7 @@ H5C_insert_entry(H5F_t * f, insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 ); flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 ); - /* Get the ring type from the DXPL */ + /* Get the ring type from the API context */ ring = H5CX_get_ring(); entry_ptr = (H5C_cache_entry_t *)thing; @@ -2331,10 +2331,10 @@ H5C_protect(H5F_t * f, haddr_t tag; /* Tag value */ /* The entry is already in the cache, but make sure that the tag value - is still legal. This will ensure that had - the entry NOT been in the cache, tagging was still set up correctly - and it would have received a legal tag value after getting loaded - from disk. */ + * is still legal. This will ensure that had the entry NOT been in the + * cache, tagging was still set up correctly and it would have received + * a legal tag value after getting loaded from disk. + */ /* Get the tag */ tag = H5CX_get_tag(); @@ -2389,10 +2389,10 @@ H5C_protect(H5F_t * f, else empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; - /* try to free up if necceary and if evictions are permitted. Note - * that if evictions are enabled, we will call H5C__make_space_in_cache() - * regardless if the min_free_space requirement is not met. - */ + /* try to free up if necceary and if evictions are permitted. Note + * that if evictions are enabled, we will call H5C__make_space_in_cache() + * regardless if the min_free_space requirement is not met. + */ if ( ( cache_ptr->evictions_enabled ) && ( ( (cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size) @@ -2438,10 +2438,10 @@ H5C_protect(H5F_t * f, * * Second, when writes are not permitted it is also possible * for the cache to grow without bound. - * - * Third, the user may choose to disable evictions -- causing - * the cache to grow without bound until evictions are - * re-enabled. + * + * Third, the user may choose to disable evictions -- causing + * the cache to grow without bound until evictions are + * re-enabled. * * Finally, we usually don't check to see if the cache is * oversized at the end of an unprotect. As a result, it is @@ -4287,11 +4287,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5C__autoadjust__ageout(H5F_t * f, - double hit_rate, - enum H5C_resize_status * status_ptr, - size_t * new_max_cache_size_ptr, - hbool_t write_permitted) +H5C__autoadjust__ageout(H5F_t * f, double hit_rate, enum H5C_resize_status * status_ptr, + size_t * new_max_cache_size_ptr, hbool_t write_permitted) { H5C_t * cache_ptr = f->shared->cache; size_t test_size; @@ -53,7 +53,7 @@ * each thread individually. The association of contexts to threads will * be handled by the pthread library. * - * In order for this macro to work, H5E_get_my_stack() must be preceeded + * In order for this macro to work, H5E__get_my_stack() must be preceeded * by "H5CX_node_t *ctx =". */ #define H5CX_get_my_context() H5CX__get_context() @@ -125,7 +125,6 @@ (*head)->ctx.H5_GLUE(PROP_FIELD,_set) = TRUE; \ } /* end if */ \ } -#endif /* H5_HAVE_PARALLEL */ /* Macro for the duplicated code to test and set properties for a property list */ #define H5CX_SET_PROP(PROP_NAME, PROP_FIELD) \ @@ -140,6 +139,7 @@ if(H5P_set((*head)->ctx.dxpl, PROP_NAME, &(*head)->ctx.PROP_FIELD) < 0) \ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, NULL, "error setting filter mask xfer property") \ } /* end if */ +#endif /* H5_HAVE_PARALLEL */ /******************/ @@ -267,6 +267,10 @@ typedef struct H5CX_t { /* Cached LAPL properties */ size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */ hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */ + + /* Cached VOL properties */ + void *vol_wrap_ctx; /* VOL plugin's "wrap context" for creating IDs */ + hbool_t vol_wrap_ctx_valid; /* Whether VOL plugin's "wrap context" for creating IDs is valid */ } H5CX_t; /* Typedef for nodes on the API context stack */ @@ -320,7 +324,9 @@ typedef struct H5CX_lapl_cache_t { /********************/ /* Local Prototypes */ /********************/ +#ifdef H5_HAVE_THREADSAFE static H5CX_node_t **H5CX__get_context(void); +#endif /* H5_HAVE_THREADSAFE */ static void H5CX__push_common(H5CX_node_t *cnode); static H5CX_node_t *H5CX__pop_common(void); @@ -862,7 +868,7 @@ done: * * Purpose: Sanity checks and sets up collective operations. * - * Note: Should be called for all API routines that modify file + * Note: Should be called for all API routines that modify file * file metadata but don't pass in an access property list. * * Return: Non-negative on success / Negative on failure @@ -916,6 +922,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5CX_set_vol_wrap_ctx + * + * Purpose: Sets the VOL object wrapping context for an operation. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Quincey Koziol + * October 14, 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_set_vol_wrap_ctx(void *vol_wrap_ctx) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(head && *head); + + /* Set the API context value */ + (*head)->ctx.vol_wrap_ctx = vol_wrap_ctx; + + /* Mark the value as valid */ + (*head)->ctx.vol_wrap_ctx_valid = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_set_vol_wrap_ctx() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_get_dxpl * * Purpose: Retrieves the DXPL ID for the current API call context. @@ -968,6 +1008,42 @@ H5CX_get_lapl(void) /*------------------------------------------------------------------------- + * Function: H5CX_get_vol_wrap_ctx + * + * Purpose: Retrieves the VOL object wrapping context for an operation. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Quincey Koziol + * October 14, 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_vol_wrap_ctx(void **vol_wrap_ctx) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_wrap_ctx); + HDassert(head && *head); + + /* Check for value that was set */ + if((*head)->ctx.vol_wrap_ctx_valid) + /* Get the value */ + *vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx; + else + *vol_wrap_ctx = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_vol_wrap_ctx() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_get_tag * * Purpose: Retrieves the object tag for the current API call context. @@ -2470,7 +2546,11 @@ H5CX__pop_common(void) H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ H5CX_node_t *ret_value = NULL; /* Return value */ +#ifdef H5_HAVE_PARALLEL FUNC_ENTER_STATIC +#else + FUNC_ENTER_STATIC_NOERR +#endif /* Sanity check */ HDassert(head && *head); @@ -2495,7 +2575,9 @@ H5CX__pop_common(void) ret_value = (*head); (*head) = (*head)->next; +#ifdef H5_HAVE_PARALLEL done: +#endif /* H5_HAVE_PARALLEL */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX__pop_common() */ diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index 44a4067..57ca5cd 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -63,10 +63,12 @@ H5_DLL void H5CX_set_lapl(hid_t lapl_id); H5_DLL herr_t H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t loc_id, hbool_t is_collective); H5_DLL herr_t H5CX_set_loc(hid_t loc_id); +H5_DLL herr_t H5CX_set_vol_wrap_ctx(void *wrap_ctx); /* "Getter" routines for API context info */ H5_DLL hid_t H5CX_get_dxpl(void); H5_DLL hid_t H5CX_get_lapl(void); +H5_DLL herr_t H5CX_get_vol_wrap_ctx(void **wrap_ctx); H5_DLL haddr_t H5CX_get_tag(void); H5_DLL H5AC_ring_t H5CX_get_ring(void); #ifdef H5_HAVE_PARALLEL diff --git a/src/H5Cimage.c b/src/H5Cimage.c index 26b6506..bdab1a3 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -1139,22 +1139,22 @@ H5C__load_cache_image(H5F_t *f) */ if(H5F_addr_defined(cache_ptr->image_addr)) { /* Sanity checks */ - HDassert(cache_ptr->image_len > 0); + HDassert(cache_ptr->image_len > 0); HDassert(cache_ptr->image_buffer == NULL); - /* Allocate space for the image */ + /* Allocate space for the image */ if(NULL == (cache_ptr->image_buffer = H5MM_malloc(cache_ptr->image_len + 1))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for cache image buffer") - /* Load the image from file */ - if(H5C__read_cache_image(f, cache_ptr) < 0) + /* Load the image from file */ + if(H5C__read_cache_image(f, cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, "Can't read metadata cache image block") - /* Reconstruct cache contents, from image */ - if(H5C__reconstruct_cache_contents(f, cache_ptr) < 0) + /* Reconstruct cache contents, from image */ + if(H5C__reconstruct_cache_contents(f, cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "Can't reconstruct cache contents from image block") - /* Free the image buffer */ + /* Free the image buffer */ cache_ptr->image_buffer = H5MM_xfree(cache_ptr->image_buffer); /* Update stats -- must do this now, as we are about diff --git a/src/H5Cquery.c b/src/H5Cquery.c index 6c927b0..e4f3133 100644 --- a/src/H5Cquery.c +++ b/src/H5Cquery.c @@ -472,11 +472,11 @@ H5C_get_mdc_image_info(H5C_t * cache_ptr, haddr_t *image_addr, hsize_t *image_le if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry") - if(image_addr == NULL || image_len == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad image_addr or image_len on entry") - *image_addr = cache_ptr->image_addr; - *image_len = cache_ptr->image_len; + if(image_addr) + *image_addr = cache_ptr->image_addr; + if(image_len) + *image_len = cache_ptr->image_len; done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Ctag.c b/src/H5Ctag.c index 66aedd9..0f08ede 100644 --- a/src/H5Ctag.c +++ b/src/H5Ctag.c @@ -471,7 +471,7 @@ H5C__evict_tagged_entries_cb(H5C_cache_entry_t *entry, void *_ctx) if(H5C__flush_single_entry(ctx->f, entry, H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Entry eviction failed.") ctx->evicted_entries_last_pass = TRUE; - } /* end else-if */ + } else ctx->skipped_pf_dirty_entries = TRUE; diff --git a/src/H5Ctest.c b/src/H5Ctest.c index 2cd0a5d..340071a 100644 --- a/src/H5Ctest.c +++ b/src/H5Ctest.c @@ -40,6 +40,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* Files */ #include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -142,8 +143,8 @@ H5C__verify_cork_tag_test(hid_t fid, haddr_t tag, hbool_t status) FUNC_ENTER_PACKAGE /* Get file pointer */ - if(NULL == (f = (H5F_t *)H5I_object_verify(fid, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + if(NULL == (f = (H5F_t *)H5VL_object_verify(fid, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Get cache pointer */ cache = f->shared->cache; @@ -21,12 +21,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -73,31 +74,28 @@ H5FL_BLK_EXTERN(type_conv); /*------------------------------------------------------------------------- - * Function: H5Dcreate2 + * Function: H5Dcreate2 * - * Purpose: Creates a new dataset named NAME at LOC_ID, opens the - * dataset for access, and associates with that dataset constant - * and initial persistent properties including the type of each - * datapoint as stored in the file (TYPE_ID), the size of the - * dataset (SPACE_ID), and other initial miscellaneous - * properties (DCPL_ID). + * Purpose: Creates a new dataset named NAME at LOC_ID, opens the + * dataset for access, and associates with that dataset constant + * and initial persistent properties including the type of each + * datapoint as stored in the file (TYPE_ID), the size of the + * dataset (SPACE_ID), and other initial miscellaneous + * properties (DCPL_ID). * - * All arguments are copied into the dataset, so the caller is - * allowed to derive new types, dataspaces, and creation - * parameters from the old ones and reuse them in calls to - * create other datasets. + * All arguments are copied into the dataset, so the caller is + * allowed to derive new types, dataspaces, and creation + * parameters from the old ones and reuse them in calls to + * create other datasets. * - * Return: Success: The object ID of the new dataset. At this - * point, the dataset is ready to receive its - * raw data. Attempting to read raw data from - * the dataset will probably return the fill - * value. The dataset should be closed when the - * caller is no longer interested in it. + * Return: Success: The object ID of the new dataset. At this + * point, the dataset is ready to receive its + * raw data. Attempting to read raw data from + * the dataset will probably return the fill + * value. The dataset should be closed when the + * caller is no longer interested in it. * - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Thursday, April 5, 2007 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -105,88 +103,106 @@ hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id) { - H5G_loc_t loc; /* Object location to insert dataset into */ - H5D_t *dset = NULL; /* New dataset's info */ - const H5S_t *space; /* Dataspace for dataset */ - hid_t ret_value; /* Return value */ + void *dset = NULL; /* New dataset's info */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist = NULL; /* Property list pointer */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE7("i", "i*siiiii", loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if(H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID") - if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") - /* Get correct property list */ + /* Get link creation property list */ if(H5P_DEFAULT == lcpl_id) lcpl_id = H5P_LINK_CREATE_DEFAULT; else if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "lcpl_id is not a link creation property list") - /* Get correct property list */ + /* Get dataset creation property list */ if(H5P_DEFAULT == dcpl_id) dcpl_id = H5P_DATASET_CREATE_DEFAULT; else if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "dcpl_id is not a dataset create property list ID") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Create the new dataset & get its ID */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") - if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") + /* Get the property list structure for the dcpl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Set creation properties */ + if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id") + if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") + if(H5P_set(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for lcpl id") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Create the dataset */ + if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") + + /* Get an atom for the dataset */ + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle") done: - if(ret_value < 0) - if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") + if(H5I_INVALID_HID == ret_value) + if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate2() */ /*------------------------------------------------------------------------- - * Function: H5Dcreate_anon + * Function: H5Dcreate_anon * - * Purpose: Creates a new dataset named NAME at LOC_ID, opens the - * dataset for access, and associates with that dataset constant - * and initial persistent properties including the type of each - * datapoint as stored in the file (TYPE_ID), the size of the - * dataset (SPACE_ID), and other initial miscellaneous - * properties (DCPL_ID). + * Purpose: Creates a new dataset named NAME at LOC_ID, opens the + * dataset for access, and associates with that dataset constant + * and initial persistent properties including the type of each + * datapoint as stored in the file (TYPE_ID), the size of the + * dataset (SPACE_ID), and other initial miscellaneous + * properties (DCPL_ID). * - * All arguments are copied into the dataset, so the caller is - * allowed to derive new types, dataspaces, and creation - * parameters from the old ones and reuse them in calls to - * create other datasets. + * All arguments are copied into the dataset, so the caller is + * allowed to derive new types, dataspaces, and creation + * parameters from the old ones and reuse them in calls to + * create other datasets. * * The resulting ID should be linked into the file with * H5Olink or it will be deleted when closed. * - * Return: Success: The object ID of the new dataset. At this - * point, the dataset is ready to receive its - * raw data. Attempting to read raw data from - * the dataset will probably return the fill - * value. The dataset should be linked into - * the group hierarchy before being closed or - * it will be deleted. The dataset should be - * closed when the caller is no longer interested - * in it. - * - * Failure: FAIL + * Return: Success: The object ID of the new dataset. At this + * point, the dataset is ready to receive its + * raw data. Attempting to read raw data from + * the dataset will probably return the fill + * value. The dataset should be linked into + * the group hierarchy before being closed or + * it will be deleted. The dataset should be + * closed when the caller is no longer interested + * in it. * - * Programmer: James Laird - * Tuesday, January 24, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -194,111 +210,118 @@ hid_t H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id) { - H5G_loc_t loc; /* Object location to insert dataset into */ - H5D_t *dset = NULL; /* New dataset's info */ - const H5S_t *space; /* Dataspace for dataset */ - hid_t ret_value; /* Return value */ + void *dset = NULL; /* dset token from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist; /* Property list pointer */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "iiiii", loc_id, type_id, space_id, dcpl_id, dapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if(H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID") - if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID") if(H5P_DEFAULT == dcpl_id) dcpl_id = H5P_DATASET_CREATE_DEFAULT; else if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* build and open the new dataset */ - if(NULL == (dset = H5D__create_anon(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") + /* 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") - /* Register the new dataset to get an ID for it */ - if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") -done: - /* Release the dataset's object header, if it was created */ - if(dset) { - H5O_loc_t *oloc; /* Object location for dataset */ + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id") + if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") - /* Get the new dataset's object location */ - if(NULL == (oloc = H5D_oloc(dset))) - HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get object location of dataset") + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); - /* Decrement refcount on dataset's object header in memory */ - if(H5O_dec_rc_by_loc(oloc) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") - } /* end if */ + /* Create the dataset */ + if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, NULL, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") + /* Get an atom for the dataset */ + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") + +done: /* Cleanup on failure */ - if(ret_value < 0) - if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") + if(H5I_INVALID_HID == ret_value) + if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate_anon() */ /*------------------------------------------------------------------------- - * Function: H5Dopen2 + * Function: H5Dopen2 * - * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns - * its ID. The dataset should be close when the caller is no - * longer interested in it. + * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns + * its ID. The dataset should be close when the caller is no + * longer interested in it. * * Takes a dataset access property list * - * Return: Success: A new dataset ID - * Failure: FAIL + * Return: Success: Object ID of the dataset * - * Programmer: James Laird - * Thursday, July 27, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) { - H5D_t *dset = NULL; - H5G_loc_t loc; /* Object location of group */ - hid_t ret_value; + void *dset = NULL; /* dset token from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, dapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Set the location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + /* Open the dataset */ - if(NULL == (dset = H5D__open_name(&loc, name, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") + if(NULL == (dset = H5VL_dataset_open(vol_obj, &loc_params, name, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Register an atom for the dataset */ - if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't register dataset atom") + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: - if(ret_value < 0) - if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") + if(H5I_INVALID_HID == ret_value) + if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ @@ -307,14 +330,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Dclose * - * Purpose: Closes access to a dataset (DATASET_ID) and releases - * resources used by it. It is illegal to subsequently use that - * same dataset ID in calls to other dataset functions. + * Purpose: Closes access to a dataset and releases resources used by + * it. It is illegal to subsequently use that same dataset + * ID in calls to other dataset functions. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -327,11 +347,10 @@ H5Dclose(hid_t dset_id) H5TRACE1("e", "i", dset_id); /* Check args */ - if(NULL == H5I_object_verify(dset_id, H5I_DATASET)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(H5I_DATASET != H5I_get_type(dset_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset ID") - /* - * Decrement the counter on the dataset. It will be freed if the count + /* Decrement the counter on the dataset. It will be freed if the count * reaches zero. */ if(H5I_dec_app_ref_always_close(dset_id) < 0) @@ -343,36 +362,34 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_space - * - * Purpose: Returns a copy of the file dataspace for a dataset. + * Function: H5Dget_space * - * Return: Success: ID for a copy of the dataspace. The data - * space should be released by calling - * H5Sclose(). + * Purpose: Returns a copy of the file dataspace for a dataset. * - * Failure: FAIL + * Return: Success: ID for a copy of the dataspace. The data + * space should be released by calling + * H5Sclose(). * - * Programmer: Robb Matzke - * Wednesday, January 28, 1998 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Dget_space(hid_t dset_id) { - H5D_t *dset = NULL; - hid_t ret_value; + H5VL_object_t *vol_obj = NULL; /* Dataset structure */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") - if((ret_value = H5D__get_space(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to get dataspace") + /* Get the dataspace */ + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace") done: FUNC_LEAVE_API(ret_value) @@ -380,35 +397,30 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_space_status - * - * Purpose: Returns the status of dataspace allocation. + * Function: H5Dget_space_status * - * Return: - * Success: Non-negative + * Purpose: Returns the status of dataspace allocation. * - * Failture: Negative - * - * Programmer: Raymond Lu + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) { - H5D_t *dset = NULL; - herr_t ret_value = SUCCEED; + H5VL_object_t *vol_obj = NULL; /* Dataset structure */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*Ds", dset_id, allocation); - /* Check arguments */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + /* Check args */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") - /* Read dataspace address and return */ - if(H5D__get_space_status(dset, allocation) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status") + /* Get dataspace status */ + if((ret_value = H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE_STATUS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, allocation)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status") done: FUNC_LEAVE_API(ret_value) @@ -416,36 +428,34 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_type + * Function: H5Dget_type * - * Purpose: Returns a copy of the file datatype for a dataset. + * Purpose: Returns a copy of the file datatype for a dataset. * - * Return: Success: ID for a copy of the datatype. The data - * type should be released by calling - * H5Tclose(). + * Return: Success: ID for a copy of the datatype. The data + * type should be released by calling + * H5Tclose(). * - * Failure: FAIL - * - * Programmer: Robb Matzke - * Tuesday, February 3, 1998 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Dget_type(hid_t dset_id) { - H5D_t *dset; /* Dataset */ - hid_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* Dataset structure */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") - if((ret_value = H5D__get_type(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get dataspace") + /* get the datatype */ + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") done: FUNC_LEAVE_API(ret_value) @@ -453,15 +463,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_create_plist + * Function: H5Dget_create_plist * - * Purpose: Returns a copy of the dataset creation property list. + * Purpose: Returns a copy of the dataset creation property list. * - * Return: Success: ID for a copy of the dataset creation - * property list. The template should be - * released by calling H5P_close(). + * Return: Success: ID for a copy of the dataset creation + * property list. The template should be + * released by calling H5P_close(). * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Tuesday, February 3, 1998 @@ -471,18 +481,19 @@ done: hid_t H5Dget_create_plist(hid_t dset_id) { - H5D_t *dataset; /* Dataset structure */ - hid_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* Dataset structure */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ - if(NULL == (dataset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") - if((ret_value = H5D__get_create_plist(dataset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "Can't get creation plist") + /* Get the dataset creation property list */ + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties") done: FUNC_LEAVE_API(ret_value) @@ -490,32 +501,32 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_access_plist + * Function: H5Dget_access_plist * - * Purpose: Returns a copy of the dataset creation property list. + * Purpose: Returns a copy of the dataset access property list. * * Description: H5Dget_access_plist returns the dataset access property - * list identifier of the specified dataset. + * list identifier of the specified dataset. * - * The chunk cache parameters in the returned property lists will be - * those used by the dataset. If the properties in the file access - * property list were used to determine the dataset’s chunk cache - * configuration, then those properties will be present in the - * returned dataset access property list. If the dataset does not - * use a chunked layout, then the chunk cache properties will be set - * to the default. The chunk cache properties in the returned list - * are considered to be “set”, and any use of this list will override - * the corresponding properties in the file’s file access property - * list. + * The chunk cache parameters in the returned property lists will be + * those used by the dataset. If the properties in the file access + * property list were used to determine the dataset’s chunk cache + * configuration, then those properties will be present in the + * returned dataset access property list. If the dataset does not + * use a chunked layout, then the chunk cache properties will be set + * to the default. The chunk cache properties in the returned list + * are considered to be “set”, and any use of this list will override + * the corresponding properties in the file’s file access property + * list. * - * All link access properties in the returned list will be set to the - * default values. + * All link access properties in the returned list will be set to the + * default values. * - * Return: Success: ID for a copy of the dataset access - * property list. The template should be - * released by calling H5Pclose(). + * Return: Success: ID for a copy of the dataset access + * property list. The template should be + * released by calling H5Pclose(). * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Neil Fortner * Wednesday, October 29, 2008 @@ -525,18 +536,19 @@ done: hid_t H5Dget_access_plist(hid_t dset_id) { - H5D_t *dset; /* Dataset structure */ - hid_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* Dataset structure */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ - if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") - if((ret_value = H5D_get_access_plist(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get access plist") + /* Get the dataset access property list */ + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties") done: FUNC_LEAVE_API(ret_value) @@ -544,39 +556,36 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_storage_size + * Function: H5Dget_storage_size * - * Purpose: Returns the amount of storage that is required for the - * dataset. For chunked datasets this is the number of allocated - * chunks times the chunk size. + * Purpose: Returns the amount of storage that is required for the + * dataset. For chunked datasets this is the number of allocated + * chunks times the chunk size. * - * Return: Success: The amount of storage space allocated for the - * dataset, not counting meta data. The return - * value may be zero if no data has been stored. + * Return: Success: The amount of storage space allocated for the + * dataset, not counting meta data. The return + * value may be zero if no data has been stored. * - * Failure: Zero - * - * Programmer: Robb Matzke - * Wednesday, April 21, 1999 + * Failure: Zero * *------------------------------------------------------------------------- */ hsize_t H5Dget_storage_size(hid_t dset_id) { - H5D_t *dset; /* Dataset to query */ - hsize_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_API(0) H5TRACE1("h", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataset") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier") - /* Set return value */ - if(H5D__get_storage_size(dset, &ret_value) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of dataset's storage") + /* Get the storage size */ + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size") done: FUNC_LEAVE_API(ret_value) @@ -584,34 +593,32 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_offset - * - * Purpose: Returns the address of dataset in file. + * Function: H5Dget_offset * - * Return: Success: the address of dataset + * Purpose: Returns the address of dataset in file. * - * Failure: HADDR_UNDEF + * Return: Success: The address of dataset * - * Programmer: Raymond Lu - * November 6, 2002 + * Failure: HADDR_UNDEF (can also be a valid return value!) * *------------------------------------------------------------------------- */ haddr_t H5Dget_offset(hid_t dset_id) { - H5D_t *dset; /* Dataset to query */ - haddr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_API(HADDR_UNDEF) H5TRACE1("a", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a dataset") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier") - /* Set return value */ - ret_value = H5D__get_offset(dset); + /* Get the offset */ + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset") done: FUNC_LEAVE_API(ret_value) @@ -740,7 +747,7 @@ H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf) /* Check args */ if(H5I_DATATYPE != H5I_get_type(type_id) || buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace") if(!(H5S_has_extent(space))) @@ -793,8 +800,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size) { H5D_vlen_bufsize_t vlen_bufsize = {0, 0, 0, 0, 0, 0}; - H5D_t *dset; /* Dataset for operation */ - H5S_t *fspace = NULL; /* Dataset's dataspace */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ H5S_t *mspace = NULL; /* Memory dataspace */ char bogus; /* bogus value to pass to H5Diterate() */ H5S_t *space; /* Dataspace for iteration */ @@ -809,8 +815,8 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, if(H5I_DATASET != H5I_get_type(dataset_id) || H5I_DATATYPE != H5I_get_type(type_id) || size == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") - if(NULL == (dset = (H5D_t *)H5I_object(dataset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + 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))) @@ -819,17 +825,19 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set") /* Save the dataset */ - vlen_bufsize.dset = dset; + vlen_bufsize.dset_vol_obj = vol_obj; + vlen_bufsize.fspace_id = H5I_INVALID_HID; + vlen_bufsize.mspace_id = H5I_INVALID_HID; /* Get a copy of the dataset's dataspace */ - if(NULL == (fspace = H5S_copy(dset->shared->space, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to get dataspace") - vlen_bufsize.fspace = fspace; + 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") - vlen_bufsize.mspace = mspace; + if((vlen_bufsize.mspace_id = H5I_register(H5I_DATASPACE, mspace, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") /* Grab the temporary buffers required */ if(NULL == (vlen_bufsize.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, (size_t)1))) @@ -845,9 +853,9 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, vlen_bufsize.size = 0; /* Call H5S_select_iterate with args, etc. */ - dset_op.op_type = H5S_SEL_ITER_OP_APP; - dset_op.u.app_op.op = H5D__vlen_get_buf_size; - dset_op.u.app_op.type_id = type_id; + dset_op.op_type = H5S_SEL_ITER_OP_APP; + dset_op.u.app_op.op = H5D__vlen_get_buf_size; + dset_op.u.app_op.type_id = type_id; ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize); @@ -856,10 +864,14 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, *size = vlen_bufsize.size; done: - if(fspace && H5S_close(fspace) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") - if(mspace && H5S_close(mspace) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + if(ret_value < 0) + if(mspace && H5S_close(mspace) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + + if(vlen_bufsize.fspace_id && H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") + if(vlen_bufsize.mspace_id && H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") if(vlen_bufsize.fl_tbuf != NULL) vlen_bufsize.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf); if(vlen_bufsize.vl_tbuf != NULL) @@ -870,40 +882,37 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dset_extent + * Function: H5Dset_extent * - * Purpose: Modifies the dimensions of a dataset. - * Can change to a smaller dimension. + * Purpose: Modifies the dimensions of a dataset. + * Can change to a smaller dimension. * - * Return: Non-negative on success, negative on failure - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * April 9, 2002 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]) { - H5D_t *dset; /* Dataset for this operation */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", dset_id, size); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") if(!size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size array cannot be NULL") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Private function */ - if(H5D__set_extent(dset, size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extend dataset") + /* Set the extent */ + if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent") done: FUNC_LEAVE_API(ret_value) @@ -915,33 +924,33 @@ done: * * Purpose: Flushes all buffers associated with a dataset. * - * Return: Non-negative on success, negative on failure - * - * Programmer: Mike McGreevy - * May 19, 2010 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Dflush(hid_t dset_id) { - H5D_t *dset; /* Dataset for this operation */ - herr_t ret_value = SUCCEED; /* return value */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Flush dataset information cached in memory */ - if(H5D__flush(dset, dset_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush cached dataset info") + /* Flush dataset information cached in memory + * XXX: Note that we need to pass the ID to the VOL since the H5F_flush_cb_t + * callback needs it and that's in the public API. + */ + if((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset") done: FUNC_LEAVE_API(ret_value) @@ -953,32 +962,29 @@ done: * * Purpose: Refreshes all buffers associated with a dataset. * - * Return: Non-negative on success, negative on failure - * - * Programmer: Mike McGreevy - * July 21, 2010 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Drefresh(hid_t dset_id) { - H5D_t *dset; /* Dataset to refresh */ - herr_t ret_value = SUCCEED; /* return value */ - + H5VL_object_t *vol_obj; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call private function to refresh the dataset object */ - if((H5D__refresh(dset_id, dset)) < 0) + /* Refresh the dataset object */ + if((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset") done: @@ -990,12 +996,13 @@ done: * Function: H5Dformat_convert (Internal) * * Purpose: For chunked: - * Convert the chunk indexing type to version 1 B-tree if not - * For compact/contiguous: - * Downgrade layout version to 3 if greater than 3 - * For virtual: no conversion + * Convert the chunk indexing type to version 1 B-tree if not + * For compact/contiguous: + * Downgrade layout version to 3 if greater than 3 + * For virtual: + * No conversion * - * Return: Non-negative on success, negative on failure + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi * Feb 2015 @@ -1005,47 +1012,23 @@ done: herr_t H5Dformat_convert(hid_t dset_id) { - H5D_t *dset; /* Dataset to refresh */ - herr_t ret_value = SUCCEED; /* return value */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") - switch(dset->shared->layout.type) { - case H5D_CHUNKED: - /* Convert the chunk indexing type to version 1 B-tree if not */ - if(dset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE) - if((H5D__format_convert(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade chunk indexing type for dataset") - break; - - case H5D_CONTIGUOUS: - case H5D_COMPACT: - /* Downgrade the layout version to 3 if greater than 3 */ - if(dset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT) - if((H5D__format_convert(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade layout version for dataset") - break; - - case H5D_VIRTUAL: - /* Nothing to do even though layout is version 4 */ - break; - - case H5D_LAYOUT_ERROR: - case H5D_NLAYOUTS: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type") - - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type") - } /* end switch */ + /* Convert the dataset */ + if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_FORMAT_CONVERT) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format") done: FUNC_LEAVE_API(ret_value) @@ -1065,25 +1048,23 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type) +H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type) { - H5D_t *dset; /* Dataset to refresh */ - herr_t ret_value = SUCCEED; /* return value */ - + H5VL_object_t *vol_obj; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Dk", did, idx_type); + H5TRACE2("e", "i*Dk", dset_id, idx_type); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") - - /* Should be a chunked dataset */ - if(dset->shared->layout.type != H5D_CHUNKED) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not chunked") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") + if(NULL == idx_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL") /* Get the chunk indexing type */ - if(idx_type) - *idx_type = dset->shared->layout.u.chunk.idx_type; + if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type") done: FUNC_LEAVE_API(ret_value) @@ -1095,7 +1076,10 @@ done: * * Purpose: Returns the size of an allocated chunk. * - * Return: Non-negative on success, negative on failure + * Intended for use with the H5D(O)read_chunk API call so + * the caller can construct an appropriate buffer. + * + * Return: SUCCEED/FAIL * * Programmer: Matthew Strong (GE Healthcare) * 20 October 2016 @@ -1105,25 +1089,22 @@ done: herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_nbytes) { - H5D_t *dset = NULL; - herr_t ret_value = SUCCEED; + H5VL_object_t *vol_obj; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*h*h", dset_id, offset, chunk_nbytes); /* Check arguments */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") - if( NULL == offset ) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") - if( NULL == chunk_nbytes ) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") - - if(H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") - - /* Call private function */ - if(H5D__get_chunk_storage_size(dset, offset, chunk_nbytes) < 0) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") + if(NULL == offset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset parameter cannot be NULL") + if(NULL == chunk_nbytes) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL") + + /* Get the dataset creation property list */ + if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") done: diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 8abfe27..b61aed4 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -685,13 +685,12 @@ H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key /* decode */ UINT32DECODE(raw, key->nbytes); UINT32DECODE(raw, key->filter_mask); - for(u = 0; u < layout->ndims; u++) - { - if (layout->dim[u] == 0) + for(u = 0; u < layout->ndims; u++) { + if(layout->dim[u] == 0) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u) /* Retrieve coordinate offset */ - UINT64DECODE(raw, tmp_offset); + UINT64DECODE(raw, tmp_offset); HDassert(0 == (tmp_offset % layout->dim[u])); /* Convert to a scaled offset */ @@ -943,7 +942,7 @@ H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info) /* Create the v1 B-tree for the chunk index */ if(H5B_create(idx_info->f, H5B_BTREE, &udata, &(idx_info->storage->idx_addr)/*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index d60e79e..b32f395 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -1547,7 +1547,7 @@ H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer") /* Close v2 B-tree */ - if(H5B2_close(idx_info->storage->u.btree2.bt2) < 0) + if(H5B2_close(idx_info->storage->u.btree2.bt2) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree") idx_info->storage->u.btree2.bt2 = NULL; } /* end if */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 4906f3c..91f3b91 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -495,7 +495,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters, hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); @@ -551,7 +551,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters, /* Get the new file address / chunk size after flushing */ if(H5D__chunk_lookup(dset, scaled, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") - } /* end if */ + } /* Make sure the address of the chunk is returned. */ if(!H5F_addr_defined(udata.chunk_block.offset)) @@ -565,7 +565,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters, *filters = udata.filter_mask; done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__chunk_direct_read() */ @@ -590,7 +590,7 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage H5D_chunk_ud_t udata; /* User data for querying chunk info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); @@ -648,8 +648,8 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage /* Get the new file address / chunk size after flushing */ if(H5D__chunk_lookup(dset, scaled, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") - } /* end if */ - } /* end if */ + } + } /* Make sure the address of the chunk is returned. */ if(!H5F_addr_defined(udata.chunk_block.offset)) @@ -663,7 +663,7 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage *storage_size = dset->shared->layout.u.chunk.size; done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5D__get_chunk_storage_size */ @@ -695,6 +695,9 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, /* Compute the # of chunks in dataset dimensions */ for(u = 0, layout->nchunks = 1, layout->max_nchunks = 1; u < ndims; u++) { + /* Sanity check */ + HDassert(layout->dim[u] > 0); + /* Round up to the next integer # of chunks, to accommodate partial chunks */ layout->chunks[u] = ((curr_dims[u] + layout->dim[u]) - 1) / layout->dim[u]; if(H5S_UNLIMITED == max_dims[u]) @@ -949,7 +952,10 @@ H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id) /* Initial scaled dimension sizes */ if(dset->shared->layout.u.chunk.dim[u] == 0) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u) - rdcc->scaled_dims[u] = dset->shared->curr_dims[u] / dset->shared->layout.u.chunk.dim[u]; + + /* Round up to the next integer # of chunks, to accommodate partial chunks */ + rdcc->scaled_dims[u] = (dset->shared->curr_dims[u] + dset->shared->layout.u.chunk.dim[u] - 1) / + dset->shared->layout.u.chunk.dim[u]; if( !(scaled_power2up = H5VM_power2up(rdcc->scaled_dims[u])) ) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") @@ -1300,11 +1306,9 @@ done: HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") if(file_type && (H5T_close_real(file_type) < 0)) HDONE_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Can't free temporary datatype") - if(file_space_normalized == TRUE) { - /* (Casting away const OK -QAK) */ - if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0) + if(file_space_normalized == TRUE) + if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0) /* (Casting away const OK -QAK) */ HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't denormalize selection") - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_io_init() */ @@ -1503,7 +1507,8 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file selection") /* Move selection back to have correct offset in chunk */ - H5S_SELECT_ADJUST_U(fm->single_space, coords); + if(H5S_SELECT_ADJUST_U(fm->single_space, coords) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection") #ifdef H5_HAVE_PARALLEL /* store chunk selection information */ @@ -1615,7 +1620,10 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t } /* end if */ /* Move selection back to have correct offset in chunk */ - H5S_SELECT_ADJUST_U(tmp_fchunk, coords); + if(H5S_SELECT_ADJUST_U(tmp_fchunk, coords) < 0) { + (void)H5S_close(tmp_fchunk); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection") + } /* Add temporary chunk to the list of chunks */ @@ -1814,7 +1822,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) } /* end for */ /* Adjust the selection */ - if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0) /*lint !e772 The chunk_adjust array will always be initialized */ + if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection") /* Get the next chunk node in the skip list */ @@ -2782,8 +2790,8 @@ done: /*------------------------------------------------------------------------- * Function: H5D__chunk_hash_val * - * Purpose: To calculate an index based on the dataset's scaled coordinates and - * sizes of the faster dimensions. + * Purpose: To calculate an index based on the dataset's scaled + * coordinates and sizes of the faster dimensions. * * Return: Hash value index * @@ -2797,6 +2805,7 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled) hsize_t val; /* Intermediate value */ unsigned ndims = shared->ndims; /* Rank of dataset */ unsigned ret = 0; /* Value to return */ + unsigned u; /* Local index variable */ FUNC_ENTER_STATIC_NOERR @@ -2807,17 +2816,11 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled) /* If the fastest changing dimension doesn't have enough entropy, use * other dimensions too */ - if(ndims > 1 && shared->cache.chunk.scaled_dims[ndims - 1] <= shared->cache.chunk.nslots) { - unsigned u; /* Local index variable */ - - val = scaled[0]; - for(u = 1; u < ndims; u++) { - val <<= shared->cache.chunk.scaled_encode_bits[u]; - val ^= scaled[u]; - } /* end for */ - } /* end if */ - else - val = scaled[ndims - 1]; + val = scaled[0]; + for(u = 1; u < ndims; u++) { + val <<= shared->cache.chunk.scaled_encode_bits[u]; + val ^= scaled[u]; + } /* end for */ /* Modulo value against the number of array slots */ ret = (unsigned)(val % shared->cache.chunk.nslots); @@ -3183,8 +3186,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, - hbool_t flush) +H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush) { H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); herr_t ret_value = SUCCEED; /* Return value */ @@ -4199,13 +4201,14 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ while(!carry) { hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ - /* Look up this chunk */ - if(H5D__chunk_lookup(dset, scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + /* Look up this chunk */ + if(H5D__chunk_lookup(dset, scaled, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") #ifndef NDEBUG /* None of the chunks should be allocated */ - if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type) - HDassert(!H5F_addr_defined(udata.chunk_block.offset)); + if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type) { + HDassert(!H5F_addr_defined(udata.chunk_block.offset)); + } /* Make sure the chunk is really in the dataset and outside the * original dimensions */ @@ -4233,7 +4236,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ /* Check to make sure the buffer is large enough. It is * possible (though ill-advised) for the filter to shrink the - * buffer. */ + * buffer. + */ if(fb_info.fill_buf_size < orig_chunk_size) { if(NULL == (fb_info.fill_buf = H5D__chunk_mem_realloc(fb_info.fill_buf, orig_chunk_size, pline))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory reallocation failed for raw data chunk") @@ -4467,10 +4471,6 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]) HGOTO_DONE(SUCCEED) } /* end if */ - /* - * Initialize structures needed to lock chunks into cache - */ - /* Set up chunked I/O info object, for operations on chunks (in callback). * Note that we only need to set chunk_offset once, as the array's address * will never change. */ @@ -6517,31 +6517,31 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded") } /* end block */ - if(old_chunk && H5F_addr_defined(old_chunk->offset)) { - /* Sanity check */ + if(old_chunk && H5F_addr_defined(old_chunk->offset)) { + /* Sanity check */ HDassert(!H5F_addr_defined(new_chunk->offset) || H5F_addr_eq(new_chunk->offset, old_chunk->offset)); /* Check for chunk being same size */ - if(new_chunk->length != old_chunk->length) { - /* Release previous chunk */ - /* Only free the old location if not doing SWMR writes - otherwise + if(new_chunk->length != old_chunk->length) { + /* Release previous chunk */ + /* Only free the old location if not doing SWMR writes - otherwise * we must keep the old chunk around in case a reader has an * outdated version of the B-tree node */ - if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) - if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") - alloc_chunk = TRUE; - } /* end if */ + if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) + if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") + alloc_chunk = TRUE; + } /* end if */ else { - /* Don't need to reallocate chunk, but send its address back up */ + /* Don't need to reallocate chunk, but send its address back up */ if(!H5F_addr_defined(new_chunk->offset)) new_chunk->offset = old_chunk->offset; - } /* end else */ - } /* end if */ + } /* end else */ + } /* end if */ else { HDassert(!H5F_addr_defined(new_chunk->offset)); - alloc_chunk = TRUE; + alloc_chunk = TRUE; } /* end else */ } /* end if */ else { @@ -6646,7 +6646,7 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for raw data chunk") /* Read the non-filtered edge chunk */ - if(H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0) + if (H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk") /* Pass the chunk through the pipeline */ diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c index 347e34c..d11a5d8 100644 --- a/src/H5Ddbg.c +++ b/src/H5Ddbg.c @@ -21,11 +21,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -60,17 +61,12 @@ /*------------------------------------------------------------------------- - * Function: H5Ddebug + * Function: H5Ddebug * - * Purpose: Prints various information about a dataset. This function is - * not to be documented in the API at this time. + * Purpose: Prints various information about a dataset. This function is + * not to be documented in the API at this time. * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: Robb Matzke - * Wednesday, April 28, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -84,14 +80,14 @@ H5Ddebug(hid_t dset_id) H5TRACE1("e", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (dset = (H5D_t *)H5VL_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") /* Print B-tree information */ if(H5D_CHUNKED == dset->shared->layout.type) - (void)H5D__chunk_dump_index(dset, stdout); + (void)H5D__chunk_dump_index(dset, stdout); else if(H5D_CONTIGUOUS == dset->shared->layout.type) - HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr); + HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 0f1bfee..76827b4 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -40,6 +40,7 @@ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -80,28 +81,28 @@ #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5Dcreate1 + * Function: H5Dcreate1 * - * Purpose: Creates a new dataset named NAME at LOC_ID, opens the - * dataset for access, and associates with that dataset constant - * and initial persistent properties including the type of each - * datapoint as stored in the file (TYPE_ID), the size of the - * dataset (SPACE_ID), and other initial miscellaneous - * properties (DCPL_ID). + * Purpose: Creates a new dataset named NAME at LOC_ID, opens the + * dataset for access, and associates with that dataset constant + * and initial persistent properties including the type of each + * datapoint as stored in the file (TYPE_ID), the size of the + * dataset (SPACE_ID), and other initial miscellaneous + * properties (DCPL_ID). * - * All arguments are copied into the dataset, so the caller is - * allowed to derive new types, dataspaces, and creation - * parameters from the old ones and reuse them in calls to - * create other datasets. + * All arguments are copied into the dataset, so the caller is + * allowed to derive new types, data spaces, and creation + * parameters from the old ones and reuse them in calls to + * create other datasets. * - * Return: Success: The object ID of the new dataset. At this - * point, the dataset is ready to receive its - * raw data. Attempting to read raw data from - * the dataset will probably return the fill - * value. The dataset should be closed when - * the caller is no longer interested in it. + * Return: Success: The object ID of the new dataset. At this + * point, the dataset is ready to receive its + * raw data. Attempting to read raw data from + * the dataset will probably return the fill + * value. The dataset should be closed when + * the caller is no longer interested in it. * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Wednesday, December 3, 1997 @@ -112,62 +113,81 @@ hid_t H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id) { - H5G_loc_t loc; /* Object location to insert dataset into */ - H5D_t *dset = NULL; /* New dataset's info */ - const H5S_t *space; /* Dataspace for dataset */ - hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */ - hid_t ret_value; /* Return value */ - - FUNC_ENTER_API(FAIL) + void *dset = NULL; /* dset token from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist; /* Property list pointer */ + 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) H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, dcpl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID") - if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") + if(H5P_DEFAULT == dcpl_id) dcpl_id = H5P_DATASET_CREATE_DEFAULT; else if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Build and open the new dataset */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id") + if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") + if(H5P_set(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for lcpl id") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Create the dataset through the VOL */ + if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") - /* Register the new dataset to get an ID for it */ - if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") + /* Get an atom for the dataset */ + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: - if(ret_value < 0) - if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") + if (H5I_INVALID_HID == ret_value) + if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate1() */ /*------------------------------------------------------------------------- - * Function: H5Dopen1 + * Function: H5Dopen1 * - * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns - * its ID. The dataset should be close when the caller is no - * longer interested in it. + * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns + * its ID. The dataset should be close when the caller is no + * longer interested in it. * - * Note: Deprecated in favor of H5Dopen2 + * Note: Deprecated in favor of H5Dopen2 * - * Return: Success: A new dataset ID - * Failure: FAIL + * Return: Success: A new dataset ID + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Thursday, December 4, 1997 @@ -177,46 +197,55 @@ done: hid_t H5Dopen1(hid_t loc_id, const char *name) { - H5D_t *dset = NULL; - H5G_loc_t loc; /* Object location of group */ - hid_t ret_value; /* Return value */ + void *dset = NULL; /* dset token from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if (!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if (!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the dataset */ - if(NULL == (dset = H5D__open_name(&loc, name, H5P_DATASET_ACCESS_DEFAULT))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") + if(NULL == (dset = H5VL_dataset_open(vol_obj, &loc_params, name, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") - /* Register an atom for the dataset */ - if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't register dataset atom") + /* Get an atom for the dataset */ + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: - if(ret_value < 0) - if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") + if(H5I_INVALID_HID == ret_value) + if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen1() */ /*------------------------------------------------------------------------- - * Function: H5Dextend + * Function: H5Dextend * - * Purpose: This function makes sure that the dataset is at least of size - * SIZE. The dimensionality of SIZE is the same as the data - * space of the dataset being changed. + * Purpose: This function makes sure that the dataset is at least of size + * SIZE. The dimensionality of SIZE is the same as the data + * space of the dataset being changed. * - * Note: Deprecated in favor of H5Dset_extent + * Note: Deprecated in favor of H5Dset_extent * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Friday, January 30, 1998 @@ -226,37 +255,62 @@ done: herr_t H5Dextend(hid_t dset_id, const hsize_t size[]) { - H5D_t *dset; /* Pointer to dataset to modify */ - hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Dataset structure */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + H5S_t *ds = NULL; /* Dataspace struct */ + int ndims; /* Dataset/space rank */ + hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */ + int i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", dset_id, size); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") if(!size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") - - /* Make certain that the dataset dimensions don't decrease */ - /* (Shrinking dimensions is possible with H5Dset_extent, but not H5Dextend) */ - if(H5S_get_simple_extent_dims(dset->shared->space, dset_dims, NULL) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") + + /* Get the dataspace pointer for the dataset */ + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataspace") + if(H5I_INVALID_HID == sid) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "received an invalid dataspace from the dataset") + if(NULL == (ds = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get dataspace structure from ID") + + /* Get the dataset's current extent */ + if(H5S_get_simple_extent_dims(ds, dset_dims, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions") - for(u = 0; u < dset->shared->ndims; u++) - if(size[u] > dset_dims[u]) - dset_dims[u] = size[u]; + + /* Get the dataset dimensions */ + ndims = H5S_GET_EXTENT_NDIMS(ds); + + /* Make certain that the dataset dimensions don't decrease in any dimension. + * + * (Shrinking dimensions is possible with H5Dset_extent, but not H5Dextend) + * + * XXX (VOL_MERGE): I feel like we should fail here instead of just silently + * not doing what we're supposed to do. + */ + for(i = 0; i < ndims; i++) + if(size[i] > dset_dims[i]) + dset_dims[i] = size[i]; /* Set up collective metadata if appropriate */ if(H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Increase size */ - if(H5D__set_extent(dset, dset_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset") + if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to extend dataset") done: + /* Close the dataspace */ + if(sid != H5I_INVALID_HID && H5I_dec_app_ref(sid) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close dataspace") + FUNC_LEAVE_API(ret_value) } /* end H5Dextend() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Dfill.c b/src/H5Dfill.c index e42e551..619f699 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -174,7 +174,7 @@ done: --------------------------------------------------------------------------*/ herr_t H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, - const H5T_t *buf_type, const H5S_t *space) + const H5T_t *buf_type, const H5S_t *space) { H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */ hbool_t mem_iter_init = FALSE; /* Whether the memory selection iterator has been initialized */ diff --git a/src/H5Dint.c b/src/H5Dint.c index c378326..b980223 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -21,16 +21,17 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -49,22 +50,21 @@ /* General stuff */ static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type); -static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, - const H5T_t *type); +static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type); static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id); -static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, - const char *prefix_type, char **file_prefix); +static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type, char **file_prefix); static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id); static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); -static herr_t H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size); static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id); -static herr_t H5D__close_cb(H5D_t *dataset); +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__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); + + /*********************/ /* Package Variables */ /*********************/ @@ -285,6 +285,43 @@ H5D_term_package(void) /*------------------------------------------------------------------------- + * Function: H5D__close_cb + * + * Purpose: Called when the ref count reaches zero on the dataset's ID + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__close_cb(H5VL_object_t *dset_vol_obj) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(dset_vol_obj); + + /* Close the dataset */ + if(H5VL_dataset_close(dset_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset"); + +done: + /* XXX: (MSC) Weird thing for datasets and filters: + * Always decrement the ref count on the VOL for datasets, since + * the ID is removed even if the close fails. + */ + + /* Free the VOL object */ + if(H5VL_free_object(dset_vol_obj) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object"); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__close_cb() */ + + +/*------------------------------------------------------------------------- * Function: H5D__create_named * * Purpose: Internal routine to create a new dataset. @@ -302,7 +339,7 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, H5D_obj_create_t dcrt_info; /* Information for dataset creation */ H5D_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -333,52 +370,11 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, ret_value = (H5D_t *)ocrt_info.new_obj; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__create_named() */ /*------------------------------------------------------------------------- - * Function: H5D__create_anon - * - * Purpose: Internal routine to create a new anonymous dataset. - * - * Note: This routine is needed so that there's a non-API routine for - * creating datasets that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new dataset object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 9, 2017 - * - *------------------------------------------------------------------------- - */ -H5D_t * -H5D__create_anon(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, - hid_t dapl_id) -{ - H5D_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(file); - HDassert(type_id != H5P_DEFAULT); - HDassert(space); - HDassert(dcpl_id != H5P_DEFAULT); - HDassert(dapl_id != H5P_DEFAULT); - - /* Build and open the dataset */ - if(NULL == (ret_value = H5D__create(file, type_id, space, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5D__create_anon() */ - - -/*------------------------------------------------------------------------- * Function: H5D__get_space_status * * Purpose: Returns the status of dataspace allocation. @@ -393,7 +389,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation) { herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(dset); @@ -426,7 +422,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation) HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed") /* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */ - if(H5D__get_storage_size_real(dset, &space_allocated) < 0) + if(H5D__get_storage_size(dset, &space_allocated) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage") /* Decide on how much of the space is allocated */ @@ -447,7 +443,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation) } /* end else */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__get_space_status() */ @@ -550,7 +546,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy datatype") /* Convert a datatype (if committed) to a transient type if the committed datatype's file - location is different from the file location where the dataset will be created */ + * location is different from the file location where the dataset will be created. + */ if(H5T_convert_committed_datatype(dset->shared->type, file) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info") @@ -565,7 +562,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) /* Get a datatype ID for the dataset's datatype */ if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type") - } /* end if */ + } /* Not a custom datatype, just use it directly */ else { if(H5I_inc_ref(type_id, FALSE) < 0) @@ -574,7 +571,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) /* Use existing datatype */ dset->shared->type_id = type_id; dset->shared->type = (H5T_t *)type; /* (Cast away const OK - QAK) */ - } /* end else */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -614,7 +611,7 @@ H5D__cache_dataspace_info(const H5D_t *dset) if( !(scaled_power2up = H5VM_power2up(dset->shared->curr_dims[u])) ) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") dset->shared->curr_power2up[u] = scaled_power2up; - } /* end for */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -969,7 +966,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert fill value to dataset type") fill_prop->fill_defined = TRUE; - } /* end if */ + } else if(fill_status == H5D_FILL_VALUE_UNDEFINED) fill_prop->fill_defined = FALSE; else @@ -1155,7 +1152,7 @@ H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type */ if(HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0) prefix = HDgetenv("HDF5_VDS_PREFIX"); - else if (HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0) + else if(HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0) prefix = HDgetenv("HDF5_EXTFILE_PREFIX"); else HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "prefix name is not sensible") @@ -1219,7 +1216,8 @@ H5D_t * H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t dapl_id) { - const H5T_t *type; /* Datatype for dataset */ + const H5T_t *type = NULL; /* Datatype for dataset (VOL pointer) */ + H5T_t *dt = NULL; /* Datatype for dataset (non-VOL pointer) */ H5D_t *new_dset = NULL; H5P_genplist_t *dc_plist = NULL; /* New Property list */ hbool_t has_vl_type = FALSE; /* Flag to indicate a VL-type for dataset */ @@ -1240,8 +1238,10 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id)); /* Get the dataset's datatype */ - if(NULL == (type = (const H5T_t *)H5I_object(type_id))) + if(NULL == (dt = (const H5T_t *)H5I_object(type_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") + /* If this is a named datatype, get the pointer via the VOL plugin */ + type = (const H5T_t *)H5T_get_actual_type(dt); /* Check if the datatype is "sensible" for use in a dataset */ if(H5T_is_sensible(type) != TRUE) @@ -1454,7 +1454,7 @@ H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id) hbool_t loc_found = FALSE; /* Location at 'name' found */ H5D_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(loc); @@ -1488,7 +1488,7 @@ done: if(loc_found && H5G_loc_free(&dset_loc) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__open_name() */ @@ -1607,7 +1607,7 @@ done: dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix); dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); - } /* end if */ + } H5O_loc_free(&(dataset->oloc)); H5G_name_free(&(dataset->path)); @@ -1868,36 +1868,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__close_cb - * - * Purpose: Callback routine for closing a dataset ID. Closes the dataset - * object that was attached to the ID. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D__close_cb(H5D_t *dataset) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* check args */ - HDassert(dataset && dataset->oloc.file && dataset->shared); - HDassert(dataset->shared->fo_count > 0); - - /* Call actual dataset close routine */ - if(H5D_close(dataset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close dataset"); - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5D__close_cb() */ - - -/*------------------------------------------------------------------------- * Function: H5D_close * * Purpose: Insures that all data has been saved to the file, closes the @@ -2033,8 +2003,7 @@ H5D_close(H5D_t *dataset) if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object") - /* - * Release datatype, dataspace and creation property list -- there isn't + /* Release datatype, dataspace and creation property list -- there isn't * much we can do if one of these fails, so we just continue. */ free_failed |= (H5I_dec_ref(dataset->shared->type_id) < 0) || @@ -2068,6 +2037,7 @@ H5D_close(H5D_t *dataset) */ dataset->oloc.file = NULL; dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); + } /* end if */ else { /* Decrement the ref. count for this object in the top file */ @@ -2105,7 +2075,7 @@ done: * Function: H5D_mult_refresh_close * * Purpose: Closing down the needed information when the dataset has - * multiple opens. (From H5O_refresh_metadata_close()) + * multiple opens. (From H5O__refresh_metadata_close()) * * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- @@ -2118,11 +2088,13 @@ H5D_mult_refresh_close(hid_t dset_id) FUNC_ENTER_NOAPI(FAIL) - if(NULL == (dataset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (dataset = (H5D_t *)H5VL_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") /* check args */ - HDassert(dataset && dataset->oloc.file && dataset->shared); + HDassert(dataset); + HDassert(dataset->oloc.file); + HDassert(dataset->shared); HDassert(dataset->shared->fo_count > 0); if(dataset->shared->fo_count > 1) { @@ -2255,12 +2227,12 @@ H5D_oloc(H5D_t *dataset) *------------------------------------------------------------------------- */ H5G_name_t * -H5D_nameof(H5D_t *dataset) +H5D_nameof(const H5D_t *dataset) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(dataset ? &(dataset->path) : (H5G_name_t *)NULL) + FUNC_LEAVE_NOAPI(dataset ? (H5G_name_t *)&(dataset->path) : (H5G_name_t *)NULL) } /* end H5D_nameof() */ @@ -2527,7 +2499,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__get_storage_size_real + * Function: H5D__get_storage_size * * Purpose: Determines how much space has been reserved to store the raw * data of a dataset. @@ -2535,8 +2507,8 @@ done: * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ -static herr_t -H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size) +herr_t +H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2578,46 +2550,19 @@ H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size) done: FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5D__get_storage_size_real() */ +} /* end H5D__get_storage_size() */ /*------------------------------------------------------------------------- - * Function: H5D__get_storage_size + * Function: H5D__get_offset * - * Purpose: Determines how much space has been reserved to store the raw - * data of a dataset. + * Purpose: Private function for H5D__get_offset. Returns the address + * of dataset in file. * - * Note: This routine is needed so that there's a non-API routine for - * creating attributes that can set up VOL / SWMR info - * (which need a DXPL). + * Return: Success: The address of dataset * - * Return: Non-negative on success, negative on failure - *------------------------------------------------------------------------- - */ -herr_t -H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */ - if(H5D__get_storage_size_real(dset, storage_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5D__get_storage_size() */ - - -/*------------------------------------------------------------------------- - * Function: H5D__get_offset + * Failure: HADDR_UNDEF (but also a valid value) * - * Purpose: Private function for H5D__get_offset. Returns the address - * of dataset in file. - * - * Return: Success: the address of dataset - * Failure: HADDR_UNDEF *------------------------------------------------------------------------- */ haddr_t @@ -2637,7 +2582,8 @@ H5D__get_offset(const H5D_t *dset) case H5D_CONTIGUOUS: /* If dataspace hasn't been allocated or dataset is stored in - * an external file, the value will be HADDR_UNDEF. */ + * an external file, the value will be HADDR_UNDEF. + */ if(dset->shared->dcpl_cache.efl.nused == 0 || H5F_addr_defined(dset->shared->layout.storage.u.contig.addr)) /* Return the absolute dataset offset from the beginning of file. */ ret_value = dset->shared->layout.storage.u.contig.addr + H5F_BASE_ADDR(dset->oloc.file); @@ -2647,7 +2593,7 @@ H5D__get_offset(const H5D_t *dset) case H5D_NLAYOUTS: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "unknown dataset layout type") - } /*lint !e788 All appropriate cases are covered */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -2754,7 +2700,9 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ATTR_UNUSED ndim, const hsize_t *point, void *op_data) { H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)op_data; + H5VL_object_t *vol_obj = vlen_bufsize->dset_vol_obj; H5T_t *dt; /* Datatype for operation */ + H5S_t *fspace; /* File dataspace for operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2771,11 +2719,13 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf") /* Select point to read in */ - if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0) + if(NULL == (fspace = (H5S_t *)H5I_object_verify(vlen_bufsize->fspace_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + if(H5S_select_elements(fspace, H5S_SELECT_SET, (size_t)1, point) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point") /* Read in the point (with the custom VL memory allocator) */ - if(H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace, vlen_bufsize->fl_tbuf) < 0) + if(H5VL_dataset_read(vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") done: @@ -2845,13 +2795,13 @@ done: herr_t H5D__set_extent(H5D_t *dset, const hsize_t *size) { - hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */ - htri_t changed; /* Whether the dataspace changed size */ - size_t u, v; /* Local index variable */ + hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */ + htri_t changed; /* Whether the dataspace changed size */ + size_t u, v; /* Local index variable */ unsigned dim_idx; /* Dimension index */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ HDassert(dset); @@ -2985,7 +2935,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) if(H5D__alloc_storage(&io_info, H5D_ALLOC_EXTEND, FALSE, curr_dims) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset storage") - } /* end if */ + } /*------------------------------------------------------------------------- * Remove chunk information in the case of chunked datasets * This removal takes place only in case we are shrinking the dateset @@ -3012,7 +2962,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) } /* end if */ done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__set_extent() */ @@ -3098,7 +3048,7 @@ H5D__flush(H5D_t *dset, hid_t dset_id) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(dset); @@ -3113,7 +3063,7 @@ H5D__flush(H5D_t *dset, hid_t dset_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset and object flush callback") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__flush() */ @@ -3138,7 +3088,7 @@ H5D__format_convert(H5D_t *dataset) hbool_t add_new_layout = FALSE; /* Indicate that the new layout message is added */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dataset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr) /* Check args */ HDassert(dataset); @@ -3264,7 +3214,7 @@ done: if(newlayout != NULL) newlayout = (H5O_layout_t *)H5MM_xfree(newlayout); - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__format_convert() */ @@ -3391,44 +3341,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__get_create_plist - * - * Purpose: Internal routine to retrieve a dataset's creation property list. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: ID for a copy of the dataset creation property - * list. The property list ID should be released - * by calling H5Pclose(). - * - * Failure: FAIL - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -hid_t -H5D__get_create_plist(const H5D_t *dset) -{ - hid_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(dset); - - /* Retrieve the DCPL */ - if((ret_value = H5D_get_create_plist(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset's creation property list") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5D__get_create_plist() */ - - -/*------------------------------------------------------------------------- * Function: H5D_get_create_plist * * Purpose: Private function for H5Dget_create_plist @@ -3629,7 +3541,7 @@ H5D_get_access_plist(const H5D_t *dset) if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_ACCESS_ID_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") if((new_dapl_id = H5P_copy_plist(old_plist, TRUE)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy dataset access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy dataset access property list") if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") @@ -3687,7 +3599,7 @@ H5D__get_space(const H5D_t *dset) H5S_t *space = NULL; hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* If the layout is virtual, update the extent */ if(dset->shared->layout.type == H5D_VIRTUAL) @@ -3708,7 +3620,7 @@ done: if(H5S_close(space) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__get_space() */ @@ -3746,8 +3658,18 @@ H5D__get_type(const H5D_t *dset) if(H5T_lock(dt, FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to lock transient datatype") - if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") + /* Create an atom */ + if(H5T_is_named(dt)) { + /* If this is a committed datatype, we need to recreate the + * two-level IDs, where the VOL object is a copy of the + * returned datatype. + */ + if((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") + } /* end if */ + else + if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") done: if(ret_value < 0) @@ -3773,7 +3695,7 @@ H5D__refresh(hid_t dset_id, H5D_t *dset) hbool_t virt_dsets_held = FALSE; /* Whether virtual datasets' files are held open */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(dset); @@ -3801,6 +3723,6 @@ done: if(H5D__virtual_release_source_dset_files(head) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't release VDS source files held open") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__refresh() */ diff --git a/src/H5Dio.c b/src/H5Dio.c index 5fea91f..f977b0e 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -21,14 +21,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dpkg.h" /* Dataset functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Sprivate.h" /* Dataspace */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Dataset functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Sprivate.h" /* Dataspace */ #ifdef H5_HAVE_PARALLEL /* Remove this if H5R_DATASET_REGION is no longer used in this file */ @@ -50,8 +50,7 @@ /* Local Prototypes */ /********************/ -static herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, - hsize_t *offset_copy/*out*/); +/* Setup/teardown routines */ static herr_t H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info, H5D_storage_t *store, H5D_io_info_t *io_info); static herr_t H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, @@ -83,14 +82,17 @@ H5FL_DEFINE(H5D_chunk_map_t); /*------------------------------------------------------------------------- * Function: H5D__get_offset_copy * - * Purpose: Gets a copy of the user's offset array that is guaraneteed - * to be suitable for use by the library. + * Purpose: Copies an offset buffer and performs bounds checks on the + * values. + * + * This helper function ensures that the offset buffer given + * by the user is suitable for use with the rest of the library. * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy) { unsigned u; @@ -102,7 +104,6 @@ H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_c HDassert(offset); HDassert(offset_copy); - /* The library's chunking code requires the offset to terminate with a zero. * So transfer the offset array to an internal offset array that we * can properly terminate (handled via the calloc call). @@ -127,14 +128,13 @@ done: } /* end H5D__get_offset_copy() */ - /*------------------------------------------------------------------------- - * Function: H5Dread + * Function: H5Dread * * Purpose: Reads (part of) a DSET from the file into application * memory BUF. The part of the dataset to read is defined with - * MEM_SPACE_ID and FILE_SPACE_ID. The data points are + * MEM_SPACE_ID and FILE_SPACE_ID. The data points are * converted from their file type to the MEM_TYPE_ID specified. * Additional miscellaneous data transfer properties can be * passed to this function with the PLIST_ID argument. @@ -152,7 +152,7 @@ done: * The PLIST_ID can be the constant H5P_DEFAULT in which * case the default data transfer properties are used. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Thursday, December 4, 1997 @@ -163,26 +163,22 @@ herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf/*out*/) { - H5D_t *dset = NULL; - const H5S_t *mem_space = NULL; - const H5S_t *file_space = NULL; + H5VL_object_t *vol_obj = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiiiix", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); + /* Check arguments */ + if (mem_space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid memory dataspace ID") + if (file_space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file dataspace ID") + /* Get dataset pointer */ - if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") - if (NULL == dset->oloc.file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") - - /* Get validated dataspace pointers */ - if (H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id") - if (H5S_get_validated_dataspace(file_space_id, &file_space) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id") /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) @@ -194,8 +190,8 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Read raw data */ - if (H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0) + /* Read the data */ + if ((ret_value = H5VL_dataset_read(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") done: @@ -219,20 +215,15 @@ herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, void *buf) { - H5D_t *dset = NULL; - hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf); /* Check arguments */ - if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") - if (NULL == dset->oloc.file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") - if (H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") if (!buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL") if (!offset) @@ -250,14 +241,8 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Copy the user's offset array so we can be sure it's terminated properly. - * (we don't want to mess with the user's buffer). - */ - if (H5D__get_offset_copy(dset, offset, offset_copy) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array") - /* Read the raw chunk */ - if (H5D__chunk_direct_read(dset, offset_copy, filters, buf) < 0) + if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_READ, offset, filters, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") done: @@ -289,7 +274,7 @@ done: * The PLIST_ID can be the constant H5P_DEFAULT in which * case the default data transfer properties are used. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Thursday, December 4, 1997 @@ -298,28 +283,24 @@ done: */ herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t dxpl_id, const void *buf) + hid_t file_space_id, hid_t dxpl_id, const void *buf) { - H5D_t *dset = NULL; - const H5S_t *mem_space = NULL; - const H5S_t *file_space = NULL; - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); - /* Get dataset pointer and ensure it's associated with a file */ - if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") - if (NULL == dset->oloc.file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + /* Check arguments */ + if (mem_space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid memory dataspace ID") + if (file_space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file dataspace ID") - /* Get validated dataspace pointers */ - if (H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id") - if (H5S_get_validated_dataspace(file_space_id, &file_space) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id") + /* Get dataset pointer */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) @@ -332,7 +313,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5CX_set_dxpl(dxpl_id); /* Write the data */ - if (H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0) + if ((ret_value = H5VL_dataset_write(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") done: @@ -356,21 +337,16 @@ herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, size_t data_size, const void *buf) { - H5D_t *dset = NULL; - hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ - uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; + uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiIu*hz*x", dset_id, dxpl_id, filters, offset, data_size, buf); /* Check arguments */ - if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset ID") - if (NULL == dset->oloc.file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") - if (H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") if (!buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL") if (!offset) @@ -393,14 +369,8 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Copy the user's offset array so we can be sure it's terminated properly. - * (we don't want to mess with the user's buffer). - */ - if (H5D__get_offset_copy(dset, offset, offset_copy) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array") - /* Write chunk */ - if (H5D__chunk_direct_write(dset, filters, offset_copy, data_size_32, buf) < 0) + if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") done: @@ -449,7 +419,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, char fake_char; /* Temporary variable for NULL buffer pointers */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dataset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr) /* check args */ HDassert(dataset && dataset->oloc.file); @@ -616,7 +586,7 @@ done: if(H5S_close(projected_mem_space) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down projected memory dataspace") - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__read() */ @@ -981,8 +951,7 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write, type_info->dst_type_id = mem_type_id; } /* end else */ - /* - * Locate the type conversion function and dataspace conversion + /* Locate the type conversion function and dataspace conversion * functions, and set up the element numbering information. If a data * type conversion is necessary then register datatype atoms. Data type * conversion is necessary if the user has set the `need_bkg' to a high @@ -1249,7 +1218,7 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__ioinfo_adjust() */ -#endif /*H5_HAVE_PARALLEL*/ +#endif /* H5_HAVE_PARALLEL */ /*------------------------------------------------------------------------- diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index c8afb8e..494d2c8 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -25,7 +25,6 @@ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5HLprivate.h" /* Local heaps */ -#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -506,7 +505,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) if(H5D__alloc_storage(&io_info, H5D_ALLOC_CREATE, FALSE, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") - } /* end if */ + } /* Update external storage message, if it's used */ if(dset->shared->dcpl_cache.efl.nused > 0) { @@ -557,6 +556,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update external file list message") } /* end if */ + /* Create layout message */ /* (Don't make layout message constant unless allocation time is early and non-filtered, since space may not be allocated) */ /* (Note: this is relying on H5D__alloc_storage not calling H5O_msg_write during dataset creation) */ if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 5ebdc06..2c06800 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -479,8 +479,7 @@ H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries, MPI_Comm_size(comm, &mpi_size); MPI_Comm_rank(comm, &mpi_rank); - /* - * Determine the size of the end result array by collecting the number + /* Determine the size of the end result array by collecting the number * of entries contributed by each processor into a single total. */ if (MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_array_num_entries, &gathered_array_num_entries, 1, MPI_INT, MPI_SUM, comm))) @@ -925,7 +924,6 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ hbool_t chunk_final_ftype_is_derived = FALSE; H5D_storage_t ctg_store; /* Storage info for "fake" contiguous dataset */ size_t total_chunks; - haddr_t *total_chunk_addr_array = NULL; MPI_Datatype *chunk_mtype = NULL; MPI_Datatype *chunk_ftype = NULL; MPI_Aint *chunk_disp_array = NULL; @@ -1146,20 +1144,7 @@ if(H5DEBUG(D)) mpi_buf_count = (hsize_t)1; } /* end if */ else { /* no selection at all for this process */ - /* Allocate chunking information */ - if(NULL == (total_chunk_addr_array = (haddr_t *)H5MM_malloc(sizeof(haddr_t) * total_chunks))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate total chunk address arraybuffer") - - /* Retrieve chunk address map */ - if(H5D__chunk_addrmap(io_info, total_chunk_addr_array) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") - - /* Get chunk with lowest address */ - ctg_store.contig.dset_addr = HADDR_MAX; - for(u = 0; u < total_chunks; u++) - if(total_chunk_addr_array[u] < ctg_store.contig.dset_addr) - ctg_store.contig.dset_addr = total_chunk_addr_array[u]; - HDassert(ctg_store.contig.dset_addr != HADDR_MAX); + ctg_store.contig.dset_addr = 0; /* Set the MPI datatype */ chunk_final_ftype = MPI_BYTE; @@ -1187,8 +1172,6 @@ if(H5DEBUG(D)) HDfprintf(H5DEBUG(D),"before freeing memory inside H5D_link_collective_io ret_value = %d\n", ret_value); #endif /* Release resources */ - if(total_chunk_addr_array) - H5MM_xfree(total_chunk_addr_array); if(chunk_addr_info_array) H5MM_xfree(chunk_addr_info_array); if(chunk_mtype) diff --git a/src/H5Doh.c b/src/H5Doh.c index f8ce69f..017bab7 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -29,6 +29,7 @@ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Object headers */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -47,7 +48,7 @@ static void *H5O__dset_get_copy_file_udata(void); static void H5O__dset_free_copy_file_udata(void *); static htri_t H5O__dset_isa(const H5O_t *loc); -static hid_t H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref); +static void *H5O__dset_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type); static void *H5O__dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc); static H5O_loc_t *H5O__dset_get_oloc(hid_t obj_id); static herr_t H5O__dset_bh_info(const H5O_loc_t *loc, H5O_t *oh, @@ -189,15 +190,15 @@ H5O__dset_isa(const H5O_t *oh) /* Datatype */ if((exists = H5O_msg_exists_oh(oh, H5O_DTYPE_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") else if(!exists) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE) /* Layout */ if((exists = H5O_msg_exists_oh(oh, H5O_SDSPACE_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") else if(!exists) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE) done: FUNC_LEAVE_NOAPI(ret_value) @@ -217,17 +218,19 @@ done: * *------------------------------------------------------------------------- */ -static hid_t -H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref) +static void * +H5O__dset_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) { - H5D_t *dset = NULL; /* Dataset opened */ - hid_t dapl_id; /* dapl to use to open this dataset */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5D_t *dset = NULL; /* Dataset opened */ + hid_t dapl_id; /* dapl to use to open this dataset */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC HDassert(obj_loc); + *opened_type = H5I_DATASET; + /* Get the LAPL (which is a superclass of DAPLs) from the API context, but * if it's the default link access property list or a custom link access * property list but not a dataset access property list, use the default @@ -242,9 +245,9 @@ H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref) /* Check class of LAPL from API context */ if((is_lapl = H5P_isa_class(dapl_id, H5P_LINK_ACCESS)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get LAPL status") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get LAPL status") if((is_dapl = H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get DAPL status") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get DAPL status") /* Switch to default DAPL if not an actual DAPL in the API context */ if(!is_dapl && is_lapl) @@ -253,16 +256,14 @@ H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref) /* Open the dataset */ if(NULL == (dset = H5D_open(obj_loc, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open dataset") - /* Register an ID for the dataset */ - if((ret_value = H5I_register(H5I_DATASET, dset, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") + ret_value = (void *)dset; done: - if(ret_value < 0) + if(NULL == ret_value) if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataset") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__dset_open() */ @@ -339,7 +340,7 @@ H5O__dset_get_oloc(hid_t obj_id) FUNC_ENTER_STATIC /* Get the dataset */ - if(NULL == (dset = (H5D_t *)H5I_object(obj_id))) + if(NULL == (dset = (H5D_t *)H5VL_object(obj_id))) HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID") /* Get the dataset's object header location */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index b887b87..30652a5 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -110,6 +110,15 @@ typedef struct H5D_type_info_t { hbool_t bkg_buf_allocated; /* Whether the background buffer was allocated */ } H5D_type_info_t; +/* Types for dataset optional VOL operations */ +typedef enum H5VL_dataset_optional_t { + H5VL_DATASET_FORMAT_CONVERT, /* H5Dformat_convert (internal) */ + H5VL_DATASET_GET_CHUNK_INDEX_TYPE, /* H5Dget_chunk_index_type */ + H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, /* H5Dget_chunk_storage_size */ + H5VL_DATASET_CHUNK_READ, /* H5Dchunk_read */ + H5VL_DATASET_CHUNK_WRITE, /* H5Dchunk_write */ +} H5VL_dataset_optional_t; + /* Forward declaration of structs used below */ struct H5D_io_info_t; struct H5D_chunk_map_t; @@ -510,12 +519,12 @@ typedef struct H5D_fill_buf_info_t { /* Internal data structure for computing variable-length dataset's total size */ typedef struct { - H5D_t *dset; /* Dataset for operation */ - H5S_t *fspace; /* Dataset's dataspace for operation */ - H5S_t *mspace; /* Memory dataspace for operation */ - void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */ - void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */ - hsize_t size; /* Accumulated number of bytes for the selection */ + 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 */ } H5D_vlen_bufsize_t; @@ -555,27 +564,21 @@ H5_DLL H5D_t *H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, H5_DLL H5D_t *H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, const H5S_t *space, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id); -H5_DLL H5D_t *H5D__create_anon(H5F_t *file, hid_t type_id, const H5S_t *space, - hid_t dcpl_id, hid_t dapl_id); H5_DLL H5D_t *H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id); H5_DLL hid_t H5D__get_space(const H5D_t *dset); H5_DLL hid_t H5D__get_type(const H5D_t *dset); H5_DLL herr_t H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation); -H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, - hbool_t full_overwrite, hsize_t old_dim[]); +H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hbool_t full_overwrite, hsize_t old_dim[]); H5_DLL herr_t H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size); -H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, - hsize_t *storage_size); +H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage_size); H5_DLL haddr_t H5D__get_offset(const H5D_t *dset); H5_DLL void *H5D__vlen_get_buf_size_alloc(size_t size, void *info); -H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim, - const hsize_t *point, void *op_data); +H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *op_data); H5_DLL herr_t H5D__check_filters(H5D_t *dataset); H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size); H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset); H5_DLL herr_t H5D__flush_real(H5D_t *dataset); H5_DLL herr_t H5D__flush(H5D_t *dset, hid_t dset_id); -H5_DLL hid_t H5D__get_create_plist(const H5D_t *dset); H5_DLL herr_t H5D__mark(const H5D_t *dataset, unsigned flags); H5_DLL herr_t H5D__refresh(hid_t dset_id, H5D_t *dataset); @@ -663,6 +666,7 @@ H5_DLL herr_t H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t *layout, hsize_t *btree_size); H5_DLL herr_t H5D__chunk_dump_index(H5D_t *dset, FILE *stream); H5_DLL herr_t H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *store); +H5_DLL herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy); H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, uint32_t data_size, const void *buf); H5_DLL herr_t H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index e136c80..aaa3db2 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -159,7 +159,7 @@ H5_DLL herr_t H5D_close(H5D_t *dataset); H5_DLL herr_t H5D_mult_refresh_close(hid_t dset_id); H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset); H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset); -H5_DLL H5G_name_t *H5D_nameof(H5D_t *dataset); +H5_DLL H5G_name_t *H5D_nameof(const H5D_t *dataset); H5_DLL H5T_t *H5D_typeof(const H5D_t *dset); H5_DLL herr_t H5D_flush_all(const H5F_t *f); H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset); diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c index 5856ede..266f5f5 100644 --- a/src/H5Dscatgath.c +++ b/src/H5Dscatgath.c @@ -559,11 +559,9 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform") - } /* end if */ + } - /* - * Scatter the data into memory. - */ + /* Scatter the data into memory */ if(H5D__scatter_mem(type_info->tconv_buf, mem_space, mem_iter, smine_nelmts, buf/*out*/) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed") } /* end else */ @@ -691,9 +689,9 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in if(H5CX_get_data_transform(&data_transform) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info") - if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform") - } /* end if */ + if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform") + } /* * Perform datatype conversion. diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c index 321d258..4510a03 100644 --- a/src/H5Dsingle.c +++ b/src/H5Dsingle.c @@ -244,10 +244,10 @@ H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata } /* end if */ if(dset) - if(dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0) - /* Mark the layout dirty so that the address of the single chunk will be flushed later */ - if(H5D__mark(dset, H5D_MARK_LAYOUT) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty") + if(dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0) + /* Mark the layout dirty so that the address of the single chunk will be flushed later */ + if(H5D__mark(dset, H5D_MARK_LAYOUT) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dtest.c b/src/H5Dtest.c index c2b6199..916ec72 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -28,10 +28,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -88,7 +89,7 @@ H5D__layout_version_test(hid_t did, unsigned *version) FUNC_ENTER_PACKAGE /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") if(version) @@ -127,7 +128,7 @@ H5D__layout_contig_size_test(hid_t did, hsize_t *size) FUNC_ENTER_PACKAGE /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") if(size) { @@ -168,7 +169,7 @@ H5D__layout_compact_dirty_test(hid_t did, hbool_t *dirty) FUNC_ENTER_PACKAGE /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") if(dirty) { @@ -211,7 +212,7 @@ H5D__layout_type_test(hid_t did, H5D_layout_t *layout_type) HDassert(layout_type); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") if(layout_type) @@ -250,7 +251,7 @@ H5D__layout_idx_type_test(hid_t did, H5D_chunk_index_t *idx_type) FUNC_ENTER_PACKAGE /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") if(dset->shared->layout.type != H5D_CHUNKED) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not chunked") @@ -291,7 +292,7 @@ H5D__current_cache_size_test(hid_t did, size_t *nbytes_used, int *nused) FUNC_ENTER_PACKAGE /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") if(nbytes_used) { diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 7f1ac86..c0d49d8 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -58,7 +58,7 @@ #include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property Lists */ #include "H5Sprivate.h" /* Dataspaces */ - +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ /* Local Macros */ @@ -2961,8 +2961,9 @@ done: static herr_t H5D__virtual_refresh_source_dset(H5D_t **dset) { - hid_t dset_id; /* Temporary dataset identifier */ - herr_t ret_value = SUCCEED; /* Return value */ + hid_t temp_id = H5I_INVALID_HID; /* Temporary dataset identifier */ + H5VL_object_t *vol_obj = NULL; /* VOL object stored with the ID */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -2970,20 +2971,26 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) HDassert(dset && *dset); /* Get a temporary identifier for this source dataset */ - if((dset_id = H5I_register(H5I_DATASET, *dset, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register source dataset ID") + if((temp_id = H5VL_wrap_register(H5I_DATASET, *dset, FALSE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID") /* Refresh source dataset */ - if(H5D__refresh(dset_id, *dset) < 0) + if(H5D__refresh(temp_id, *dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset") /* Discard the identifier & replace the dataset */ - if(NULL == (*dset = (H5D_t *)H5I_remove(dset_id))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_remove(temp_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID") + if(NULL == (*dset = (H5D_t *)H5VL_object_data(vol_obj))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve library object from VOL object") + vol_obj->data = NULL; done: + if(vol_obj && H5VL_free_object(vol_obj) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object") + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__virtual_refresh_source_dsets() */ +} /* end H5D__virtual_refresh_source_dset() */ /*------------------------------------------------------------------------- @@ -49,11 +49,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Epkg.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Epkg.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ /****************/ /* Local Macros */ @@ -78,18 +79,17 @@ /* Local Prototypes */ /********************/ /* Static function declarations */ -static herr_t H5E_set_default_auto(H5E_t *stk); -static H5E_cls_t *H5E_register_class(const char *cls_name, const char *lib_name, - const char *version); -static herr_t H5E_unregister_class(H5E_cls_t *cls); -static ssize_t H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size); -static int H5E_close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata); -static herr_t H5E_close_msg(H5E_msg_t *err); -static H5E_msg_t *H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg); -static H5E_t *H5E_get_current_stack(void); -static herr_t H5E_set_current_stack(H5E_t *estack); -static herr_t H5E_close_stack(H5E_t *err_stack); -static ssize_t H5E_get_num(const H5E_t *err_stack); +static herr_t H5E__set_default_auto(H5E_t *stk); +static H5E_cls_t *H5E__register_class(const char *cls_name, const char *lib_name, const char *version); +static herr_t H5E__unregister_class(H5E_cls_t *cls); +static ssize_t H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size); +static int H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata); +static herr_t H5E__close_msg(H5E_msg_t *err); +static H5E_msg_t *H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg); +static H5E_t *H5E__get_current_stack(void); +static herr_t H5E__set_current_stack(H5E_t *estack); +static herr_t H5E__close_stack(H5E_t *err_stack); +static ssize_t H5E__get_num(const H5E_t *err_stack); /*********************/ @@ -123,7 +123,7 @@ static const H5I_class_t H5I_ERRCLS_CLS[1] = {{ H5I_ERROR_CLASS, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5E_unregister_class /* Callback routine for closing objects of this class */ + (H5I_free_t)H5E__unregister_class /* Callback routine for closing objects of this class */ }}; /* Error message ID class */ @@ -131,7 +131,7 @@ static const H5I_class_t H5I_ERRMSG_CLS[1] = {{ H5I_ERROR_MSG, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5E_close_msg /* Callback routine for closing objects of this class */ + (H5I_free_t)H5E__close_msg /* Callback routine for closing objects of this class */ }}; /* Error stack ID class */ @@ -139,19 +139,17 @@ static const H5I_class_t H5I_ERRSTK_CLS[1] = {{ H5I_ERROR_STACK, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5E_close_stack /* Callback routine for closing objects of this class */ + (H5I_free_t)H5E__close_stack /* Callback routine for closing objects of this class */ }}; /*------------------------------------------------------------------------- - * Function: H5E_init + * Function: H5E_init * - * Purpose: Initialize the interface from some other layer. + * Purpose: Initialize the interface from some other layer. * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, June 29, 2004 @@ -176,7 +174,7 @@ done: * * Purpose: Initialize interface-specific information * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -207,13 +205,13 @@ H5E__init_package(void) #ifndef H5_HAVE_THREADSAFE H5E_stack_g[0].nused = 0; - H5E_set_default_auto(H5E_stack_g); + H5E__set_default_auto(H5E_stack_g); #endif /* H5_HAVE_THREADSAFE */ /* Allocate the HDF5 error class */ HDassert(H5E_ERR_CLS_g == (-1)); HDsnprintf(lib_vers, sizeof(lib_vers), "%u.%u.%u%s", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, (HDstrlen(H5_VERS_SUBRELEASE) > 0 ? "-"H5_VERS_SUBRELEASE : "")); - if(NULL == (cls = H5E_register_class(H5E_CLS_NAME, H5E_CLS_LIB_NAME, lib_vers))) + if(NULL == (cls = H5E__register_class(H5E_CLS_NAME, H5E_CLS_LIB_NAME, lib_vers))) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "class initialization failed") if((H5E_ERR_CLS_g = H5I_register(H5I_ERROR_CLASS, cls, FALSE)) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error class") @@ -227,14 +225,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_term_package + * Function: H5E_term_package * - * Purpose: Terminates the H5E interface + * Purpose: Terminates the H5E interface * - * Return: Success: Positive if anything is done that might - * affect other interfaces; zero otherwise. + * Return: Success: Positive if anything is done that might + * affect other interfaces; zero otherwise. * - * Failure: Negative. + * Failure: Negative * * Programmer: Raymond Lu * Tuesday, July 22, 2003 @@ -262,8 +260,8 @@ H5E_term_package(void) (void)H5I_clear_type(H5I_ERROR_STACK, FALSE, FALSE); /* Clear all the error classes */ - if(ncls > 0) { - (void)H5I_clear_type(H5I_ERROR_CLASS, FALSE, FALSE); + if(ncls > 0) { + (void)H5I_clear_type(H5I_ERROR_CLASS, FALSE, FALSE); /* Reset the HDF5 error class, if its been closed */ if(H5I_nmembers(H5I_ERROR_CLASS) == 0) @@ -271,8 +269,8 @@ H5E_term_package(void) } /* end if */ /* Clear all the error messages */ - if(nmsg > 0) { - (void)H5I_clear_type(H5I_ERROR_MSG, FALSE, FALSE); + if(nmsg > 0) { + (void)H5I_clear_type(H5I_ERROR_MSG, FALSE, FALSE); /* Reset the HDF5 error messages, if they've been closed */ if(H5I_nmembers(H5I_ERROR_MSG) == 0) { @@ -282,17 +280,17 @@ H5E_term_package(void) } /* end if */ n++; /*H5I*/ - } /* end if */ + } /* end if */ else { - /* Destroy the error class, message, and stack id groups */ - n += (H5I_dec_type_ref(H5I_ERROR_STACK) > 0); - n += (H5I_dec_type_ref(H5I_ERROR_CLASS) > 0); - n += (H5I_dec_type_ref(H5I_ERROR_MSG) > 0); + /* Destroy the error class, message, and stack id groups */ + n += (H5I_dec_type_ref(H5I_ERROR_STACK) > 0); + n += (H5I_dec_type_ref(H5I_ERROR_CLASS) > 0); + n += (H5I_dec_type_ref(H5I_ERROR_MSG) > 0); - /* Mark closed */ + /* Mark closed */ if(0 == n) H5_PKG_INIT_VAR = FALSE; - } /* end else */ + } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) @@ -300,12 +298,12 @@ H5E_term_package(void) /*-------------------------------------------------------------------------- - * Function: H5E_set_default_auto + * Function: H5E__set_default_auto * * Purpose: Initialize "automatic" error stack reporting info to library * default * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, November 1, 2007 @@ -313,9 +311,9 @@ H5E_term_package(void) *-------------------------------------------------------------------------- */ static herr_t -H5E_set_default_auto(H5E_t *stk) +H5E__set_default_auto(H5E_t *stk) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #ifndef H5_NO_DEPRECATED_SYMBOLS #ifdef H5_USE_16_API_DEFAULT @@ -334,19 +332,19 @@ H5E_set_default_auto(H5E_t *stk) stk->auto_data = NULL; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_set_default_auto() */ +} /* end H5E__set_default_auto() */ #ifdef H5_HAVE_THREADSAFE /*------------------------------------------------------------------------- - * Function: H5E_get_stack + * Function: H5E__get_stack * - * Purpose: Support function for H5E_get_my_stack() to initialize and + * Purpose: Support function for H5E__get_my_stack() to initialize and * acquire per-thread error stack. * - * Return: Success: error stack (H5E_t *) + * Return: Success: Pointer to an error stack struct (H5E_t *) * - * Failure: NULL + * Failure: NULL * * Programmer: Chee Wai LEE * April 24, 2000 @@ -354,11 +352,11 @@ H5E_set_default_auto(H5E_t *stk) *------------------------------------------------------------------------- */ H5E_t * -H5E_get_stack(void) +H5E__get_stack(void) { H5E_t *estack = NULL; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR estack = (H5E_t *)H5TS_get_thread_local_value(H5TS_errstk_key_g); @@ -377,7 +375,7 @@ H5E_get_stack(void) /* Set the thread-specific info */ estack->nused = 0; - H5E_set_default_auto(estack); + H5E__set_default_auto(estack); /* (It's not necessary to release this in this API, it is * released by the "key destructor" set up in the H5TS @@ -388,16 +386,16 @@ H5E_get_stack(void) /* Set return value */ FUNC_LEAVE_NOAPI(estack) -} /* end H5E_get_stack() */ +} /* end H5E__get_stack() */ #endif /* H5_HAVE_THREADSAFE */ /*------------------------------------------------------------------------- - * Function: H5E_free_class + * Function: H5E_free_class * - * Purpose: Private function to free an error class. + * Purpose: Private function to free an error class. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, January 22, 2009 @@ -423,11 +421,12 @@ H5E_free_class(H5E_cls_t *cls) /*------------------------------------------------------------------------- - * Function: H5Eregister_class + * Function: H5Eregister_class * - * Purpose: Registers an error class. + * Purpose: Registers an error class. * - * Return: Non-negative value as class ID on success/Negative on failure + * Return: Success: An ID for the error class + * Failure: H5I_INVALID_HID * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -438,22 +437,22 @@ hid_t H5Eregister_class(const char *cls_name, const char *lib_name, const char *version) { H5E_cls_t *cls; /* Pointer to error class */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "*s*s*s", cls_name, lib_name, version); /* Check arguments */ if(cls_name == NULL || lib_name == NULL || version == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid string") /* Create the new error class object */ - if(NULL == (cls = H5E_register_class(cls_name, lib_name, version))) - HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, FAIL, "can't create error class") + if(NULL == (cls = H5E__register_class(cls_name, lib_name, version))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error class") /* Register the new error class to get an ID for it */ if((ret_value = H5I_register(H5I_ERROR_CLASS, cls, TRUE)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error class") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register error class") done: FUNC_LEAVE_API(ret_value) @@ -461,11 +460,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_register_class + * Function: H5E__register_class * - * Purpose: Private function to register an error class. + * Purpose: Private function to register an error class. * - * Return: Non-negative value as class ID on success/Negative on failure + * Return: Success: Pointer to an error class struct + * Failure: NULL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -473,12 +473,12 @@ done: *------------------------------------------------------------------------- */ static H5E_cls_t * -H5E_register_class(const char *cls_name, const char *lib_name, const char *version) +H5E__register_class(const char *cls_name, const char *lib_name, const char *version) { H5E_cls_t *cls = NULL; /* Pointer to error class */ H5E_cls_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(cls_name); @@ -506,15 +506,15 @@ done: HDONE_ERROR(H5E_ERROR, H5E_CANTRELEASE, NULL, "unable to free error class") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_register_class() */ +} /* end H5E__register_class() */ /*------------------------------------------------------------------------- - * Function: H5Eunregister_class + * Function: H5Eunregister_class * - * Purpose: Closes an error class. + * Purpose: Closes an error class. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -546,11 +546,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_unregister_class + * Function: H5E__unregister_class * - * Purpose: Private function to close an error class. + * Purpose: Private function to close an error class. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -558,17 +558,17 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_unregister_class(H5E_cls_t *cls) +H5E__unregister_class(H5E_cls_t *cls) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(cls); /* Iterate over all the messages and delete those in this error class */ - if(H5I_iterate(H5I_ERROR_MSG, H5E_close_msg_cb, cls, FALSE) < 0) + if(H5I_iterate(H5I_ERROR_MSG, H5E__close_msg_cb, cls, FALSE) < 0) HGOTO_ERROR(H5E_ERROR, H5E_BADITER, FAIL, "unable to free all messages in this error class") /* Free error class structure */ @@ -577,16 +577,16 @@ H5E_unregister_class(H5E_cls_t *cls) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_unregister_class() */ +} /* end H5E__unregister_class() */ /*------------------------------------------------------------------------- - * Function: H5Eget_class_name + * Function: H5Eget_class_name * - * Purpose: Retrieves error class name. + * Purpose: Retrieves error class name. * - * Return: Non-negative for name length if succeeds(zero means no name); - * otherwise returns negative value. + * Return: Success: Name length (zero means no name) + * Failure: -1 * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -597,18 +597,18 @@ ssize_t H5Eget_class_name(hid_t class_id, char *name, size_t size) { H5E_cls_t *cls; /* Pointer to error class */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*sz", class_id, name, size); /* Get the error class */ if(NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error class ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a error class ID") /* Retrieve the class name */ - if((ret_value = H5E_get_class_name(cls, name, size)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get error class name") + if((ret_value = H5E__get_class_name(cls, name, size)) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get error class name") done: FUNC_LEAVE_API(ret_value) @@ -616,12 +616,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_get_class_name + * Function: H5E__get_class_name * - * Purpose: Private function to retrieve error class name. + * Purpose: Private function to retrieve error class name. * - * Return: Non-negative for name length if succeeds(zero means no name); - * otherwise returns negative value. + * Return: Success: Name length (zero means no name) + * Failure: -1 * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -629,11 +629,11 @@ done: *------------------------------------------------------------------------- */ static ssize_t -H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size) +H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size) { - ssize_t len = 0; /* Length of error class's name */ + ssize_t len = -1; /* Length of error class's name */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(cls); @@ -650,16 +650,17 @@ H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size) /* Return the full length */ FUNC_LEAVE_NOAPI(len) -} /* end H5E_get_class_name() */ +} /* end H5E__get_class_name() */ /*------------------------------------------------------------------------- - * Function: H5E_close_msg_cb + * Function: H5E__close_msg_cb * * Purpose: H5I_iterate callback function to close error messages in the * error class. * - * Return: Non-negative value on success/Negative on failure + * Return: Success: H5_ITER_CONT (0) + * Failure: H5_ITER_ERROR (-1) * * Programmer: Raymond Lu * July 14, 2003 @@ -667,36 +668,36 @@ H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size) *------------------------------------------------------------------------- */ static int -H5E_close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata) +H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata) { H5E_msg_t *err_msg = (H5E_msg_t*)obj_ptr; H5E_cls_t *cls = (H5E_cls_t*)udata; - herr_t ret_value = SUCCEED; /* Return value */ + int ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(err_msg); /* Close the message if it is in the class being closed */ if(err_msg->cls == cls) { - if(H5E_close_msg(err_msg) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, FAIL, "unable to close error message") + if(H5E__close_msg(err_msg) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, H5_ITER_ERROR, "unable to close error message") if(NULL == H5I_remove(obj_id)) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREMOVE, FAIL, "unable to remove error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREMOVE, H5_ITER_ERROR, "unable to remove error message") } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_close_msg_cb() */ +} /* end H5E__close_msg_cb() */ /*------------------------------------------------------------------------- - * Function: H5Eclose_msg + * Function: H5Eclose_msg * - * Purpose: Closes a major or minor error. + * Purpose: Closes a major or minor error. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -725,11 +726,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_close_msg + * Function: H5E__close_msg * - * Purpose: Private function to close an error messge. + * Purpose: Private function to close an error messge. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -737,9 +738,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_close_msg(H5E_msg_t *err) +H5E__close_msg(H5E_msg_t *err) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(err); @@ -750,15 +751,16 @@ H5E_close_msg(H5E_msg_t *err) err = H5FL_FREE(H5E_msg_t, err); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_close_msg() */ +} /* end H5E__close_msg() */ /*------------------------------------------------------------------------- - * Function: H5Ecreate_msg + * Function: H5Ecreate_msg * - * Purpose: Creates a major or minor error, returns an ID. + * Purpose: Creates a major or minor error, returns an ID. * - * Return: Non-negative value on success/Negative on failure + * Return: Success: An error ID + * Failure: H5I_INVALID_HID * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -770,39 +772,40 @@ H5Ecreate_msg(hid_t class_id, H5E_type_t msg_type, const char *msg_str) { H5E_cls_t *cls; /* Pointer to error class */ H5E_msg_t *msg; /* Pointer to new error message */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "iEt*s", class_id, msg_type, msg_str); /* Check arguments */ if(msg_type != H5E_MAJOR && msg_type != H5E_MINOR) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid message type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "not a valid message type") if(msg_str == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "message is NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "message is NULL") /* Get the error class */ if(NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error class ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an error class ID") /* Create the new error message object */ - if(NULL == (msg = H5E_create_msg(cls, msg_type, msg_str))) - HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, FAIL, "can't create error message") + if(NULL == (msg = H5E__create_msg(cls, msg_type, msg_str))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error message") /* Register the new error class to get an ID for it */ if((ret_value = H5I_register(H5I_ERROR_MSG, msg, TRUE)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register error message") done: FUNC_LEAVE_API(ret_value) } /* end H5Ecreate_msg() */ /*------------------------------------------------------------------------- - * Function: H5E_create_msg + * Function: H5E__create_msg * - * Purpose: Private function to create a major or minor error. + * Purpose: Private function to create a major or minor error. * - * Return: Non-negative value on success/Negative on failure + * Return: Success: Pointer to a message struct + * Failure: NULL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -810,12 +813,12 @@ done: *------------------------------------------------------------------------- */ static H5E_msg_t * -H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) +H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) { H5E_msg_t *msg = NULL; /* Pointer to new error message */ H5E_msg_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(cls); @@ -837,20 +840,20 @@ H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) done: if(!ret_value) - if(msg && H5E_close_msg(msg) < 0) + if(msg && H5E__close_msg(msg) < 0) HDONE_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, NULL, "unable to close error message") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_create_msg() */ +} /* end H5E__create_msg() */ /*------------------------------------------------------------------------- - * Function: H5Eget_msg + * Function: H5Eget_msg * - * Purpose: Retrieves an error message. + * Purpose: Retrieves an error message. * - * Return: Non-negative for message length if succeeds(zero means no message); - * otherwise returns negative value. + * Return: Success: Message length (zero means no message) + * Failure: -1 * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -861,18 +864,18 @@ ssize_t H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg_str, size_t size) { H5E_msg_t *msg; /* Pointer to error message */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE4("Zs", "i*Et*sz", msg_id, type, msg_str, size); /* Get the message object */ if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(msg_id, H5I_ERROR_MSG))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error message ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a error message ID") /* Get the message's text */ - if((ret_value = H5E_get_msg(msg, type, msg_str, size)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get error message text") + if((ret_value = H5E__get_msg(msg, type, msg_str, size)) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get error message text") done: FUNC_LEAVE_API(ret_value) @@ -880,11 +883,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ecreate_stack + * Function: H5Ecreate_stack * - * Purpose: Creates a new, empty, error stack. + * Purpose: Creates a new, empty, error stack. * - * Return: Non-negative value as stack ID on success/Negative on failure + * Return: Success: An error stack ID + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * Thursday, November 1, 2007 @@ -895,21 +899,21 @@ hid_t H5Ecreate_stack(void) { H5E_t *stk; /* Error stack */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE0("i",""); /* Allocate a new error stack */ if(NULL == (stk = H5FL_CALLOC(H5E_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") /* Set the "automatic" error reporting info to the library default */ - H5E_set_default_auto(stk); + H5E__set_default_auto(stk); /* Register the stack */ if((ret_value = H5I_register(H5I_ERROR_STACK, stk, TRUE)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't create error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't create error stack") done: FUNC_LEAVE_API(ret_value) @@ -917,12 +921,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eget_current_stack + * Function: H5Eget_current_stack * - * Purpose: Registers current error stack, returns object handle for it, + * Purpose: Registers current error stack, returns object handle for it, * clears it. * - * Return: Non-negative value as stack ID on success/Negative on failure + * Return: Success: An error stack ID + * Failure: H5I_INVALID_HID * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -933,19 +938,19 @@ hid_t H5Eget_current_stack(void) { H5E_t *stk; /* Error stack */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ /* Don't clear the error stack! :-) */ - FUNC_ENTER_API_NOCLEAR(FAIL) + FUNC_ENTER_API_NOCLEAR(H5I_INVALID_HID) H5TRACE0("i",""); /* Get the current stack */ - if(NULL == (stk = H5E_get_current_stack())) - HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, FAIL, "can't create error stack") + if(NULL == (stk = H5E__get_current_stack())) + HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error stack") /* Register the stack */ if((ret_value = H5I_register(H5I_ERROR_STACK, stk, TRUE)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't create error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't create error stack") done: FUNC_LEAVE_API(ret_value) @@ -953,11 +958,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_get_current_stack + * Function: H5E__get_current_stack * - * Purpose: Private function to register an error stack. + * Purpose: Private function to register an error stack. * - * Return: Non-negative value as class ID on success/Negative on failure + * Return: Success: Pointer to an error class struct + * Failure: NULL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -965,17 +971,17 @@ done: *------------------------------------------------------------------------- */ static H5E_t * -H5E_get_current_stack(void) +H5E__get_current_stack(void) { H5E_t *current_stack; /* Pointer to the current error stack */ H5E_t *estack_copy = NULL; /* Pointer to new error stack to return */ unsigned u; /* Local index variable */ H5E_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get a pointer to the current error stack */ - if(NULL == (current_stack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (current_stack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get current error stack") /* Allocate a new error stack */ @@ -1026,24 +1032,19 @@ done: estack_copy = H5FL_FREE(H5E_t, estack_copy); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_get_current_stack() */ +} /* end H5E__get_current_stack() */ /*------------------------------------------------------------------------- - * Function: H5Eset_current_stack + * Function: H5Eset_current_stack * - * Purpose: Replaces current stack with specified stack. This closes the - * stack ID also. + * Purpose: Replaces current stack with specified stack. This closes the + * stack ID also. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 15, 2003 - * - * Modification: - * Raymond Lu - * 7 September 2010 - * Also closes the stack to avoid potential problem (bug 1799) * *------------------------------------------------------------------------- */ @@ -1061,7 +1062,7 @@ H5Eset_current_stack(hid_t err_stack) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") /* Set the current error stack */ - if(H5E_set_current_stack(estack) < 0) + if(H5E__set_current_stack(estack) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "unable to set error stack") /* @@ -1078,11 +1079,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_set_current_stack + * Function: H5E__set_current_stack * - * Purpose: Private function to replace an error stack. + * Purpose: Private function to replace an error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 15, 2003 @@ -1090,19 +1091,19 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_set_current_stack(H5E_t *estack) +H5E__set_current_stack(H5E_t *estack) { H5E_t *current_stack; /* Default error stack */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(estack); /* Get a pointer to the current error stack */ - if(NULL == (current_stack = H5E_get_my_stack ())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (current_stack = H5E__get_my_stack ())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Empty current error stack */ @@ -1138,15 +1139,15 @@ H5E_set_current_stack(H5E_t *estack) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_set_current_stack() */ +} /* end H5E__set_current_stack() */ /*------------------------------------------------------------------------- - * Function: H5Eclose_stack + * Function: H5Eclose_stack * - * Purpose: Closes an error stack. + * Purpose: Closes an error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -1180,11 +1181,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_close_stack + * Function: H5E__close_stack * - * Purpose: Private function to close an error stack. + * Purpose: Private function to close an error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -1192,9 +1193,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_close_stack(H5E_t *estack) +H5E__close_stack(H5E_t *estack) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(estack); @@ -1206,15 +1207,16 @@ H5E_close_stack(H5E_t *estack) estack = H5FL_FREE(H5E_t, estack); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_close_stack() */ +} /* end H5E__close_stack() */ /*------------------------------------------------------------------------- - * Function: H5Eget_num + * Function: H5Eget_num * - * Purpose: Retrieves the number of error message. + * Purpose: Retrieves the number of error messages. * - * Return: Non-negative value on success/Negative on failure + * Return: Success: The number of errors + * Failure: -1 * * Programmer: Raymond Lu * Friday, July 15, 2003 @@ -1228,13 +1230,13 @@ H5Eget_num(hid_t error_stack_id) ssize_t ret_value; /* Return value */ /* Don't clear the error stack! :-) */ - FUNC_ENTER_API_NOCLEAR(FAIL) + FUNC_ENTER_API_NOCLEAR((-1)) H5TRACE1("Zs", "i", error_stack_id); /* Need to check for errors */ if(error_stack_id == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get current error stack") } /* end if */ else { /* Only clear the error stack if it's not the default stack */ @@ -1242,12 +1244,12 @@ H5Eget_num(hid_t error_stack_id) /* Get the error stack to operate on */ if(NULL == (estack = (H5E_t *)H5I_object_verify(error_stack_id, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an error stack ID") } /* end else */ /* Get the number of errors on stack */ - if((ret_value = H5E_get_num(estack)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get number of errors") + if((ret_value = H5E__get_num(estack)) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get number of errors") done: FUNC_LEAVE_API(ret_value) @@ -1255,11 +1257,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_get_num + * Function: H5E__get_num * - * Purpose: Private function to retrieve number of errors in error stack. + * Purpose: Private function to retrieve number of errors in error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: Success: The number of errors + * Failure: -1 (can't fail at this time) * * Programmer: Raymond Lu * Friday, July 15, 2003 @@ -1267,22 +1270,22 @@ done: *------------------------------------------------------------------------- */ static ssize_t -H5E_get_num(const H5E_t *estack) +H5E__get_num(const H5E_t *estack) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(estack); FUNC_LEAVE_NOAPI((ssize_t)estack->nused) -} /* end H5E_get_num() */ +} /* end H5E__get_num() */ /*------------------------------------------------------------------------- - * Function: H5Epop + * Function: H5Epop * - * Purpose: Deletes some error messages from the top of error stack. + * Purpose: Deletes some error messages from the top of error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 16, 2003 @@ -1301,7 +1304,7 @@ H5Epop(hid_t err_stack, size_t count) /* Need to check for errors */ if(err_stack == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ else { @@ -1318,7 +1321,7 @@ H5Epop(hid_t err_stack, size_t count) count = estack->nused; /* Pop the errors off the stack */ - if(H5E_pop(estack, count) < 0) + if(H5E__pop(estack, count) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "can't pop errors from stack") done: @@ -1327,22 +1330,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Epush2 + * Function: H5Epush2 * - * Purpose: Pushes a new error record onto error stack for the current - * thread. The error has major and minor IDs MAJ_ID and - * MIN_ID, the name of a function where the error was detected, - * the name of the file where the error was detected, the - * line within that file, and an error description string. The - * function name, file name, and error description strings must - * be statically allocated. + * Purpose: Pushes a new error record onto error stack for the current + * thread. The error has major and minor IDs MAJ_ID and + * MIN_ID, the name of a function where the error was detected, + * the name of the file where the error was detected, the + * line within that file, and an error description string. The + * function name, file name, and error description strings must + * be statically allocated. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, October 18, 1999 * - * Notes: Basically a new public API wrapper around the H5E__push_stack + * Notes: Basically a new public API wrapper around the H5E__push_stack * function. * *------------------------------------------------------------------------- @@ -1435,11 +1438,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eclear2 + * Function: H5Eclear2 * - * Purpose: Clears the error stack for the specified error stack. + * Purpose: Clears the error stack for the specified error stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Wednesday, July 16, 2003 @@ -1477,14 +1480,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eprint2 + * Function: H5Eprint2 * - * Purpose: Prints the error stack in some default way. This is just a - * convenience function for H5Ewalk() with a function that - * prints error messages. Users are encouraged to write there - * own more specific error handlers. + * Purpose: Prints the error stack in some default way. This is just a + * convenience function for H5Ewalk() with a function that + * prints error messages. Users are encouraged to write there + * own more specific error handlers. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -1503,7 +1506,7 @@ H5Eprint2(hid_t err_stack, FILE *stream) /* Need to check for errors */ if(err_stack == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ else { @@ -1515,7 +1518,7 @@ H5Eprint2(hid_t err_stack, FILE *stream) } /* end else */ /* Print error stack */ - if(H5E_print(estack, stream, FALSE) < 0) + if(H5E__print(estack, stream, FALSE) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") done: @@ -1524,12 +1527,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ewalk2 + * Function: H5Ewalk2 * - * Purpose: Walks the error stack for the current thread and calls some - * function for each error along the way. + * Purpose: Walks the error stack for the current thread and calls some + * function for each error along the way. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -1549,7 +1552,7 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi /* Need to check for errors */ if(err_stack == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ else { @@ -1563,7 +1566,7 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi /* Walk the error stack */ op.vers = 2; op.u.func2 = stack_func; - if(H5E_walk(estack, direction, &op, client_data) < 0) + if(H5E__walk(estack, direction, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") done: @@ -1572,23 +1575,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eget_auto2 + * Function: H5Eget_auto2 * - * Purpose: Returns the current settings for the automatic error stack - * traversal function and its data for specific error stack. - * Either (or both) arguments may be null in which case the - * value is not returned. + * Purpose: Returns the current settings for the automatic error stack + * traversal function and its data for specific error stack. + * Either (or both) arguments may be null in which case the + * value is not returned. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Saturday, February 28, 1998 * - * Modification:Raymond Lu - * 4 October 2010 - * If the printing function isn't the default H5Eprint1 or 2, - * and H5Eset_auto1 has been called to set the old style - * printing function, a call to H5Eget_auto2 should fail. *------------------------------------------------------------------------- */ herr_t @@ -1602,7 +1600,7 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data) H5TRACE3("e", "i*x**x", estack_id, func, client_data); if(estack_id == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ else @@ -1610,7 +1608,7 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") /* Get the automatic error reporting information */ - if(H5E_get_auto(estack, &op, client_data) < 0) + if(H5E__get_auto(estack, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -1628,28 +1626,25 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eset_auto2 + * Function: H5Eset_auto2 * - * Purpose: Turns on or off automatic printing of errors for certain + * Purpose: Turns on or off automatic printing of errors for certain * error stack. When turned on (non-null FUNC pointer) any * API function which returns an error indication will first * call FUNC passing it CLIENT_DATA as an argument. * - * The default values before this function is called are - * H5Eprint2() with client data being the standard error stream, - * stderr. + * The default values before this function is called are + * H5Eprint2() with client data being the standard error stream, + * stderr. * - * Automatic stack traversal is always in the H5E_WALK_DOWNWARD - * direction. + * Automatic stack traversal is always in the H5E_WALK_DOWNWARD + * direction. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 * - * Modification:Raymond Lu - * 4 October 2010 - * If the FUNC is H5Eprint2, put the IS_DEFAULT flag on. *------------------------------------------------------------------------- */ herr_t @@ -1664,7 +1659,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) H5TRACE3("e", "ix*x", estack_id, func, client_data); if(estack_id == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ else @@ -1673,7 +1668,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) #ifndef H5_NO_DEPRECATED_SYMBOLS /* Get the automatic error reporting information */ - if(H5E_get_auto(estack, &op, NULL) < 0) + if(H5E__get_auto(estack, &op, NULL) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") /* Set the automatic error reporting information */ @@ -1688,7 +1683,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) /* Set the automatic error reporting function */ op.func2 = func; - if(H5E_set_auto(estack, &op, client_data) < 0) + if(H5E__set_auto(estack, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") done: @@ -1697,14 +1692,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eauto_is_v2 + * Function: H5Eauto_is_v2 * - * Purpose: Determines if the error auto reporting function for an + * Purpose: Determines if the error auto reporting function for an * error stack conforms to the H5E_auto_stack_t typedef * or the H5E_auto_t typedef. The IS_STACK parameter is set * to 1 for the first case and 0 for the latter case. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, September 8, 2004 @@ -1721,7 +1716,7 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack) H5TRACE2("e", "i*Iu", estack_id, is_stack); if(estack_id == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ else diff --git a/src/H5EApkg.h b/src/H5EApkg.h index fb9afc0..0adcde2 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -469,8 +469,8 @@ H5_DLL herr_t H5EA__dblock_debug(H5F_t *f, haddr_t addr, /* Testing routines */ #ifdef H5EA_TESTING -H5_DLL herr_t H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam); -H5_DLL int H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2); +H5_DLL herr_t H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam); +H5_DLL int H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2); #endif /* H5EA_TESTING */ #endif /* _H5EApkg_H */ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index 3da7996..7c02e16 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -401,7 +401,7 @@ END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */ /*------------------------------------------------------------------------- - * Function: H5EA_get_cparam_test + * Function: H5EA__get_cparam_test * * Purpose: Retrieve the parameters used to create the extensible array * @@ -413,9 +413,9 @@ END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, NOERR, +BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, -H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)) +H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)) /* Check arguments. */ HDassert(ea); @@ -429,11 +429,11 @@ H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)) cparam->data_blk_min_elmts = ea->hdr->cparam.data_blk_min_elmts; cparam->max_dblk_page_nelmts_bits = ea->hdr->cparam.max_dblk_page_nelmts_bits; -END_FUNC(PRIV) /* end H5EA_get_cparam_test() */ +END_FUNC(PKG) /* end H5EA__get_cparam_test() */ /*------------------------------------------------------------------------- - * Function: H5EA_cmp_cparam_test + * Function: H5EA__cmp_cparam_test * * Purpose: Compare the parameters used to create the extensible array * @@ -445,9 +445,9 @@ END_FUNC(PRIV) /* end H5EA_get_cparam_test() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERRCATCH, +BEGIN_FUNC(PKG, ERRCATCH, int, 0, -, -H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2)) +H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2)) /* Check arguments. */ HDassert(cparam1); @@ -481,5 +481,5 @@ H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2) CATCH -END_FUNC(PRIV) /* end H5EA_cmp_cparam_test() */ +END_FUNC(PKG) /* end H5EA__cmp_cparam_test() */ diff --git a/src/H5B2public.h b/src/H5ESpublic.h index 6e0b964..e3b1b56 100644 --- a/src/H5B2public.h +++ b/src/H5ESpublic.h @@ -1,9 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * + * 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. * @@ -11,22 +10,11 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/*------------------------------------------------------------------------- - * - * Created: H5B2public.h - * Jan 31 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> - * - * Purpose: Public declarations for the v2 B-tree package. - * - *------------------------------------------------------------------------- - */ - -#ifndef _H5B2public_H -#define _H5B2public_H +#ifndef _H5ESpublic_H +#define _H5ESpublic_H /* Public headers needed by this file */ -#include "H5public.h" +#include "H5public.h" /* Generic Functions */ /*****************/ /* Public Macros */ @@ -36,9 +24,22 @@ /* Public Typedefs */ /*******************/ -/**********************************/ -/* Public API Function Prototypes */ -/**********************************/ +/* Asynchronous operation status */ +typedef enum H5ES_status_t { + H5ES_STATUS_IN_PROGRESS, /* Operation has not yet completed */ + H5ES_STATUS_SUCCEED, /* Operation has completed, successfully */ + H5ES_STATUS_FAIL, /* Operation has completed, but failed */ + H5ES_STATUS_CANCELED /* Operation has not completed and was canceled */ +} H5ES_status_t; + + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ #ifdef __cplusplus extern "C" { @@ -48,5 +49,5 @@ extern "C" { } #endif -#endif /* _H5B2public_H */ +#endif /* _H5ESpublic_H */ diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index fc3eb9c..4462303 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -35,11 +35,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Epkg.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Epkg.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -80,12 +80,12 @@ #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5Eget_major + * Function: H5Eget_major * - * Purpose: Retrieves a major error message. + * Purpose: Retrieves a major error message. * - * Return: Returns message if succeeds. - * otherwise returns NULL. + * Return: Success: Pointer to the message + * Failure: NULL * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -106,21 +106,21 @@ H5Eget_major(H5E_major_t maj) /* Get the message object */ if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(maj, H5I_ERROR_MSG))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID") /* Get the size & type of the message's text */ - if((size = H5E_get_msg(msg, &type, NULL, (size_t)0)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") + if((size = H5E__get_msg(msg, &type, NULL, (size_t)0)) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") if(type != H5E_MAJOR) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a major one") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a major one") /* Application will free this */ size++; msg_str = (char *)H5MM_malloc((size_t)size); /* Get the text for the message */ - if(H5E_get_msg(msg, NULL, msg_str, (size_t)size) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") + if(H5E__get_msg(msg, NULL, msg_str, (size_t)size) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") ret_value = msg_str; @@ -133,12 +133,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eget_minor + * Function: H5Eget_minor * - * Purpose: Retrieves a minor error message. + * Purpose: Retrieves a minor error message. * - * Return: Returns message if succeeds. - * otherwise returns NULL. + * Return: Success: Pointer to the message + * Failure: NULL * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -159,21 +159,21 @@ H5Eget_minor(H5E_minor_t min) /* Get the message object */ if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(min, H5I_ERROR_MSG))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID") /* Get the size & type of the message's text */ - if((size = H5E_get_msg(msg, &type, NULL, (size_t)0)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") + if((size = H5E__get_msg(msg, &type, NULL, (size_t)0)) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") if(type != H5E_MINOR) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a minor one") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a minor one") /* Application will free this */ size++; msg_str = (char *)H5MM_malloc((size_t)size); /* Get the text for the message */ - if(H5E_get_msg(msg, NULL, msg_str, (size_t)size) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") + if(H5E__get_msg(msg, NULL, msg_str, (size_t)size) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") ret_value = msg_str; @@ -186,19 +186,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5Epush1 + * Function: H5Epush1 * - * Purpose: This function definition is for backward compatibility only. + * Purpose: This function definition is for backward compatibility only. * It doesn't have error stack and error class as parameters. * The old definition of major and minor is casted as HID_T * in H5Epublic.h * - * Notes: Basically a public API wrapper around the H5E_push2 + * Notes: Basically a public API wrapper around the H5E_push2 * function. For backward compatibility, it maintains the * same parameter as the old function, in contrary to * H5Epush2. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Tuesday, Sep 16, 2003 @@ -225,12 +225,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eclear1 + * Function: H5Eclear1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatibility. * Clears the error stack for the specified error stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Wednesday, July 16, 2003 @@ -256,15 +256,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eprint1 + * Function: H5Eprint1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatibility. * Prints the error stack in some default way. This is just a - * convenience function for H5Ewalk() with a function that - * prints error messages. Users are encouraged to write there - * own more specific error handlers. + * convenience function for H5Ewalk() with a function that + * prints error messages. Users are encouraged to write there + * own more specific error handlers. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Sep 16, 2003 @@ -281,11 +281,11 @@ H5Eprint1(FILE *stream) FUNC_ENTER_API_NOCLEAR(FAIL) /*NO TRACE*/ - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Print error stack */ - if(H5E_print(estack, stream, TRUE) < 0) + if(H5E__print(estack, stream, TRUE) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") done: @@ -294,13 +294,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ewalk1 + * Function: H5Ewalk1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatibility. * Walks the error stack for the current thread and calls some - * function for each error along the way. + * function for each error along the way. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Sep 16, 2003 @@ -318,13 +318,13 @@ H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client_data) FUNC_ENTER_API_NOCLEAR(FAIL) /*NO TRACE*/ - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Walk the error stack */ walk_op.vers = 1; walk_op.u.func1 = func; - if(H5E_walk(estack, direction, &walk_op, client_data) < 0) + if(H5E__walk(estack, direction, &walk_op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") done: @@ -333,24 +333,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eget_auto1 + * Function: H5Eget_auto1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatibility. * Returns the current settings for the automatic error stack - * traversal function and its data for specific error stack. - * Either (or both) arguments may be null in which case the - * value is not returned. + * traversal function and its data for specific error stack. + * Either (or both) arguments may be null in which case the + * value is not returned. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Sep 16, 2003 * - * Modification:Raymond Lu - * 4 October 2010 - * If the printing function isn't the default H5Eprint1 or 2, - * and H5Eset_auto2 has been called to set the new style - * printing function, a call to H5Eget_auto1 should fail. *------------------------------------------------------------------------- */ herr_t @@ -364,11 +359,11 @@ H5Eget_auto1(H5E_auto1_t *func, void **client_data) H5TRACE2("e", "*x**x", func, client_data); /* Retrieve default error stack */ - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Get the automatic error reporting information */ - if(H5E_get_auto(estack, &auto_op, client_data) < 0) + if(H5E__get_auto(estack, &auto_op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") /* Fail if the printing function isn't the default(user-set) and set through H5Eset_auto2 */ @@ -384,29 +379,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eset_auto1 + * Function: H5Eset_auto1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatibility. * Turns on or off automatic printing of errors for certain * error stack. When turned on (non-null FUNC pointer) any * API function which returns an error indication will first * call FUNC passing it CLIENT_DATA as an argument. * - * The default values before this function is called are - * H5Eprint1() with client data being the standard error stream, - * stderr. + * The default values before this function is called are + * H5Eprint1() with client data being the standard error stream, + * stderr. * - * Automatic stack traversal is always in the H5E_WALK_DOWNWARD - * direction. + * Automatic stack traversal is always in the H5E_WALK_DOWNWARD + * direction. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Sep 16, 2003 * - * Modification:Raymond Lu - * 4 October 2010 - * If the FUNC is H5Eprint2, put the IS_DEFAULT flag on. *------------------------------------------------------------------------- */ herr_t @@ -420,11 +412,11 @@ H5Eset_auto1(H5E_auto1_t func, void *client_data) FUNC_ENTER_API_NOCLEAR(FAIL) H5TRACE2("e", "x*x", func, client_data); - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Get the automatic error reporting information */ - if(H5E_get_auto(estack, &auto_op, NULL) < 0) + if(H5E__get_auto(estack, &auto_op, NULL) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") /* Set the automatic error reporting information */ @@ -435,7 +427,7 @@ H5Eset_auto1(H5E_auto1_t func, void *client_data) auto_op.is_default = TRUE; auto_op.func1 = func; - if(H5E_set_auto(estack, &auto_op, client_data) < 0) + if(H5E__set_auto(estack, &auto_op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") done: diff --git a/src/H5Eint.c b/src/H5Eint.c index 15953af..540c9b1 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -32,11 +32,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Epkg.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Epkg.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -64,12 +64,12 @@ typedef struct H5E_print_t { /* Local Prototypes */ /********************/ #ifndef H5_NO_DEPRECATED_SYMBOLS -static herr_t H5E_walk1_cb(int n, H5E_error1_t *err_desc, +static herr_t H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data); #endif /* H5_NO_DEPRECATED_SYMBOLS */ -static herr_t H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, +static herr_t H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data); -static herr_t H5E_clear_entries(H5E_t *estack, size_t nentries); +static herr_t H5E__clear_entries(H5E_t *estack, size_t nentries); /*********************/ @@ -108,18 +108,18 @@ hid_t H5E_ERR_CLS_g = FAIL; * variables used for MPI error reporting */ char H5E_mpi_error_str[MPI_MAX_ERROR_STRING]; -int H5E_mpi_error_str_len; +int H5E_mpi_error_str_len; #endif /* H5_HAVE_PARALLEL */ /*------------------------------------------------------------------------- - * Function: H5E_get_msg + * Function: H5E__get_msg * - * Purpose: Private function to retrieve an error message. + * Purpose: Private function to retrieve an error message. * - * Return: Non-negative for name length if succeeds(zero means no name); - * otherwise returns negative value. + * Return: Success: Message length (zero means no message) + * Failure: -1 * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -127,11 +127,11 @@ int H5E_mpi_error_str_len; *------------------------------------------------------------------------- */ ssize_t -H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) +H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) { ssize_t len = -1; /* Length of error message */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ HDassert(msg); @@ -152,37 +152,37 @@ H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) /* Set the return value to the full length of the message */ FUNC_LEAVE_NOAPI(len) -} /* end H5E_get_msg() */ +} /* end H5E__get_msg() */ #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5E_walk1_cb + * Function: H5E__walk1_cb * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatibility. * This is a default error stack traversal callback function - * that prints error messages to the specified output stream. - * This function is for backward compatibility with v1.6. - * It is not meant to be called directly but rather as an - * argument to the H5Ewalk() function. This function is called - * also by H5Eprint(). Application writers are encouraged to - * use this function as a model for their own error stack - * walking functions. + * that prints error messages to the specified output stream. + * This function is for backward compatibility with v1.6. + * It is not meant to be called directly but rather as an + * argument to the H5Ewalk() function. This function is called + * also by H5Eprint(). Application writers are encouraged to + * use this function as a model for their own error stack + * walking functions. * - * N is a counter for how many times this function has been - * called for this particular traversal of the stack. It always - * begins at zero for the first error on the stack (either the - * top or bottom error, or even both, depending on the traversal - * direction and the size of the stack). + * N is a counter for how many times this function has been + * called for this particular traversal of the stack. It always + * begins at zero for the first error on the stack (either the + * top or bottom error, or even both, depending on the traversal + * direction and the size of the stack). * - * ERR_DESC is an error description. It contains all the - * information about a particular error. + * ERR_DESC is an error description. It contains all the + * information about a particular error. * - * CLIENT_DATA is the same pointer that was passed as the - * CLIENT_DATA argument of H5Ewalk(). It is expected to be a - * file pointer (or stderr if null). + * CLIENT_DATA is the same pointer that was passed as the + * CLIENT_DATA argument of H5Ewalk(). It is expected to be a + * file pointer (or stderr if null). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Thursday, May 11, 2006 @@ -190,7 +190,7 @@ H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) *------------------------------------------------------------------------- */ static herr_t -H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) +H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) { H5E_print_t *eprint = (H5E_print_t *)client_data; FILE *stream; /* I/O stream to print output to */ @@ -202,7 +202,7 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(err_desc); @@ -239,7 +239,7 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) if(cls_ptr->lib_vers) eprint->cls.lib_vers = cls_ptr->lib_vers; - fprintf(stream, "%s-DIAG: Error detected in %s (%s) ", + HDfprintf(stream, "%s-DIAG: Error detected in %s (%s) ", (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"), (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"), (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)")); @@ -249,22 +249,22 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) { int mpi_rank, mpi_initialized, mpi_finalized; - MPI_Initialized(&mpi_initialized); + MPI_Initialized(&mpi_initialized); MPI_Finalized(&mpi_finalized); if(mpi_initialized && !mpi_finalized) { - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - fprintf(stream, "MPI-process %d", mpi_rank); - } /* end if */ + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + HDfprintf(stream, "MPI-process %d", mpi_rank); + } /* end if */ else - fprintf(stream, "thread 0"); + HDfprintf(stream, "thread 0"); } /* end block */ #elif defined(H5_HAVE_THREADSAFE) - fprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); + HDfprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); #else - fprintf(stream, "thread 0"); + HDfprintf(stream, "thread 0"); #endif - fprintf(stream, ":\n"); + HDfprintf(stream, ":\n"); } /* end if */ /* Check for "real" error description - used to format output more nicely */ @@ -272,44 +272,44 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) have_desc=0; /* Print error message */ - fprintf(stream, "%*s#%03d: %s line %u in %s()%s%s\n", + HDfprintf(stream, "%*s#%03d: %s line %u in %s()%s%s\n", H5E_INDENT, "", n, err_desc->file_name, err_desc->line, err_desc->func_name, (have_desc ? ": " : ""), (have_desc ? err_desc->desc : "")); - fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); - fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); + HDfprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); + HDfprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_walk1_cb() */ +} /* end H5E__walk1_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- - * Function: H5E_walk2_cb + * Function: H5E__walk2_cb * - * Purpose: This is a default error stack traversal callback function - * that prints error messages to the specified output stream. - * It is not meant to be called directly but rather as an - * argument to the H5Ewalk2() function. This function is - * called also by H5Eprint2(). Application writers are - * encouraged to use this function as a model for their own - * error stack walking functions. + * Purpose: This is a default error stack traversal callback function + * that prints error messages to the specified output stream. + * It is not meant to be called directly but rather as an + * argument to the H5Ewalk2() function. This function is + * called also by H5Eprint2(). Application writers are + * encouraged to use this function as a model for their own + * error stack walking functions. * - * N is a counter for how many times this function has been - * called for this particular traversal of the stack. It always - * begins at zero for the first error on the stack (either the - * top or bottom error, or even both, depending on the traversal - * direction and the size of the stack). + * N is a counter for how many times this function has been + * called for this particular traversal of the stack. It always + * begins at zero for the first error on the stack (either the + * top or bottom error, or even both, depending on the traversal + * direction and the size of the stack). * - * ERR_DESC is an error description. It contains all the - * information about a particular error. + * ERR_DESC is an error description. It contains all the + * information about a particular error. * - * CLIENT_DATA is the same pointer that was passed as the - * CLIENT_DATA argument of H5Ewalk(). It is expected to be a - * file pointer (or stderr if null). + * CLIENT_DATA is the same pointer that was passed as the + * CLIENT_DATA argument of H5Ewalk(). It is expected to be a + * file pointer (or stderr if null). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, December 12, 1997 @@ -317,7 +317,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) +H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) { H5E_print_t *eprint = (H5E_print_t *)client_data; FILE *stream; /* I/O stream to print output to */ @@ -329,7 +329,7 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(err_desc); @@ -371,7 +371,7 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) if(cls_ptr->lib_vers) eprint->cls.lib_vers = cls_ptr->lib_vers; - fprintf(stream, "%s-DIAG: Error detected in %s (%s) ", + HDfprintf(stream, "%s-DIAG: Error detected in %s (%s) ", (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"), (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"), (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)")); @@ -381,22 +381,22 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) { int mpi_rank, mpi_initialized, mpi_finalized; - MPI_Initialized(&mpi_initialized); + MPI_Initialized(&mpi_initialized); MPI_Finalized(&mpi_finalized); if(mpi_initialized && !mpi_finalized) { - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - fprintf(stream, "MPI-process %d", mpi_rank); - } /* end if */ + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + HDfprintf(stream, "MPI-process %d", mpi_rank); + } /* end if */ else - fprintf(stream, "thread 0"); + HDfprintf(stream, "thread 0"); } /* end block */ #elif defined(H5_HAVE_THREADSAFE) - fprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); + HDfprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); #else - fprintf(stream, "thread 0"); + HDfprintf(stream, "thread 0"); #endif - fprintf(stream, ":\n"); + HDfprintf(stream, ":\n"); } /* end if */ /* Check for "real" error description - used to format output more nicely */ @@ -404,28 +404,28 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) have_desc = 0; /* Print error message */ - fprintf(stream, "%*s#%03u: %s line %u in %s()%s%s\n", + HDfprintf(stream, "%*s#%03u: %s line %u in %s()%s%s\n", H5E_INDENT, "", n, err_desc->file_name, err_desc->line, err_desc->func_name, (have_desc ? ": " : ""), (have_desc ? err_desc->desc : "")); - fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); - fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); + HDfprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); + HDfprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_walk2_cb() */ +} /* end H5E__walk2_cb() */ /*------------------------------------------------------------------------- - * Function: H5E_print + * Function: H5E__print * - * Purpose: Private function to print the error stack in some default + * Purpose: Private function to print the error stack in some default * way. This is just a convenience function for H5Ewalk() and * H5Ewalk2() with a function that prints error messages. * Users are encouraged to write there own more specific error * handlers. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -433,13 +433,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) +H5E__print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) { H5E_print_t eprint; /* Callback information to pass to H5E_walk() */ H5E_walk_op_t walk_op; /* Error stack walking callback */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(estack); @@ -457,8 +457,8 @@ H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) if(bk_compatible) { #ifndef H5_NO_DEPRECATED_SYMBOLS walk_op.vers = 1; - walk_op.u.func1 = H5E_walk1_cb; - if(H5E_walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0) + walk_op.u.func1 = H5E__walk1_cb; + if(H5E__walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") #else /* H5_NO_DEPRECATED_SYMBOLS */ HDassert(0 && "version 1 error stack print without deprecated symbols!"); @@ -466,40 +466,40 @@ H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) } /* end if */ else { walk_op.vers = 2; - walk_op.u.func2 = H5E_walk2_cb; - if(H5E_walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0) + walk_op.u.func2 = H5E__walk2_cb; + if(H5E__walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_print() */ +} /* end H5E__print() */ /*------------------------------------------------------------------------- - * Function: H5E_walk + * Function: H5E__walk * - * Purpose: Private function for H5Ewalk. + * Purpose: Private function for H5Ewalk. * Walks the error stack, calling the specified function for - * each error on the stack. The DIRECTION argument determines - * whether the stack is walked from the inside out or the - * outside in. The value H5E_WALK_UPWARD means begin with the - * most specific error and end at the API; H5E_WALK_DOWNWARD - * means to start at the API and end at the inner-most function - * where the error was first detected. - * - * The function pointed to by STACK_FUNC will be called for - * each error record in the error stack. It's arguments will - * include an index number (beginning at zero regardless of - * stack traversal direction), an error stack entry, and the - * CLIENT_DATA pointer passed to H5E_print. - * - * The function FUNC is also provided for backward compatibility. - * When BK_COMPATIBLE is set to be TRUE, FUNC is used to be - * compatible with older library. If BK_COMPATIBLE is FALSE, - * STACK_FUNC is used. - * - * Return: Non-negative on success/Negative on failure + * each error on the stack. The DIRECTION argument determines + * whether the stack is walked from the inside out or the + * outside in. The value H5E_WALK_UPWARD means begin with the + * most specific error and end at the API; H5E_WALK_DOWNWARD + * means to start at the API and end at the inner-most function + * where the error was first detected. + * + * The function pointed to by STACK_FUNC will be called for + * each error record in the error stack. It's arguments will + * include an index number (beginning at zero regardless of + * stack traversal direction), an error stack entry, and the + * CLIENT_DATA pointer passed to H5E_print. + * + * The function FUNC is also provided for backward compatibility. + * When BK_COMPATIBLE is set to be TRUE, FUNC is used to be + * compatible with older library. If BK_COMPATIBLE is FALSE, + * STACK_FUNC is used. + * + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, December 12, 1997 @@ -507,14 +507,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op, +H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op, void *client_data) { int i; /* Local index variable */ herr_t status; /* Status from callback function */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(estack); @@ -587,18 +587,18 @@ H5E_walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_walk() */ +} /* end H5E__walk() */ /*------------------------------------------------------------------------- - * Function: H5E_get_auto + * Function: H5E__get_auto * - * Purpose: Private function to return the current settings for the + * Purpose: Private function to return the current settings for the * automatic error stack traversal function and its data * for specific error stack. Either (or both) arguments may * be null in which case the value is not returned. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * July 18, 2003 @@ -606,9 +606,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) +H5E__get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(estack); @@ -619,26 +619,26 @@ H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) *client_data = estack->auto_data; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_get_auto2() */ +} /* end H5E__get_auto() */ /*------------------------------------------------------------------------- - * Function: H5E_set_auto + * Function: H5E__set_auto * - * Purpose: Private function to turn on or off automatic printing of + * Purpose: Private function to turn on or off automatic printing of * errors for certain error stack. When turned on (non-null * FUNC pointer) any API function which returns an error * indication will first call FUNC passing it CLIENT_DATA * as an argument. * - * The default values before this function is called are - * H5Eprint2() with client data being the standard error stream, - * stderr. + * The default values before this function is called are + * H5Eprint2() with client data being the standard error stream, + * stderr. * - * Automatic stack traversal is always in the H5E_WALK_DOWNWARD - * direction. + * Automatic stack traversal is always in the H5E_WALK_DOWNWARD + * direction. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -646,9 +646,9 @@ H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) *------------------------------------------------------------------------- */ herr_t -H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) +H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(estack); @@ -657,15 +657,15 @@ H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) estack->auto_data = client_data; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_set_auto() */ +} /* end H5E__set_auto() */ /*------------------------------------------------------------------------- - * Function: H5E_printf_stack + * Function: H5E_printf_stack * - * Purpose: Printf-like wrapper around H5E__push_stack. + * Purpose: Printf-like wrapper around H5E__push_stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, August 12, 2008 @@ -758,19 +758,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5E__push_stack + * Function: H5E__push_stack * - * Purpose: Pushes a new error record onto error stack for the current - * thread. The error has major and minor IDs MAJ_ID and - * MIN_ID, the name of a function where the error was detected, - * the name of the file where the error was detected, the - * line within that file, and an error description string. The - * function name, file name, and error description strings must - * be statically allocated (the FUNC_ENTER() macro takes care of - * the function name and file name automatically, but the - * programmer is responsible for the description string). + * Purpose: Pushes a new error record onto error stack for the current + * thread. The error has major and minor IDs MAJ_ID and + * MIN_ID, the name of a function where the error was detected, + * the name of the file where the error was detected, the + * line within that file, and an error description string. The + * function name, file name, and error description strings must + * be statically allocated (the FUNC_ENTER() macro takes care of + * the function name and file name automatically, but the + * programmer is responsible for the description string). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, December 12, 1997 @@ -799,7 +799,7 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line /* Check for 'default' error stack */ if(estack == NULL) - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_DONE(FAIL) /* @@ -845,12 +845,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_clear_entries + * Function: H5E__clear_entries * - * Purpose: Private function to clear the error stack entries for the + * Purpose: Private function to clear the error stack entries for the * specified error stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, August 6, 2003 @@ -858,13 +858,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_clear_entries(H5E_t *estack, size_t nentries) +H5E__clear_entries(H5E_t *estack, size_t nentries) { H5E_error2_t *error; /* Pointer to error stack entry to clear */ unsigned u; /* Local index variable */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(estack); @@ -897,16 +897,16 @@ H5E_clear_entries(H5E_t *estack, size_t nentries) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_clear_entries() */ +} /* end H5E__clear_entries() */ /*------------------------------------------------------------------------- - * Function: H5E_clear_stack + * Function: H5E_clear_stack * - * Purpose: Private function to clear the error stack for the + * Purpose: Private function to clear the error stack for the * specified error stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Wednesday, July 16, 2003 @@ -922,13 +922,13 @@ H5E_clear_stack(H5E_t *estack) /* Check for 'default' error stack */ if(estack == NULL) - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Empty the error stack */ HDassert(estack); if(estack->nused) - if(H5E_clear_entries(estack, estack->nused) < 0) + if(H5E__clear_entries(estack, estack->nused) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack") done: @@ -937,12 +937,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_pop + * Function: H5E__pop * - * Purpose: Private function to delete some error messages from the top + * Purpose: Private function to delete some error messages from the top * of error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 16, 2003 @@ -950,33 +950,33 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_pop(H5E_t *estack, size_t count) +H5E__pop(H5E_t *estack, size_t count) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(estack); HDassert(estack->nused >= count); /* Remove the entries from the error stack */ - if(H5E_clear_entries(estack, count) < 0) + if(H5E__clear_entries(estack, count) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "can't remove errors from stack") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_pop() */ +} /* end H5E__pop() */ /*------------------------------------------------------------------------- - * Function: H5E_dump_api_stack + * Function: H5E_dump_api_stack * - * Purpose: Private function to dump the error stack during an error in + * Purpose: Private function to dump the error stack during an error in * an API function if a callback function is defined for the * current error stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, August 6, 2003 @@ -992,7 +992,7 @@ H5E_dump_api_stack(hbool_t is_api) /* Only dump the error stack during an API call */ if(is_api) { - H5E_t *estack = H5E_get_my_stack(); + H5E_t *estack = H5E__get_my_stack(); HDassert(estack); diff --git a/src/H5Epkg.h b/src/H5Epkg.h index fcde1ca..ac98496 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -49,15 +49,15 @@ * each thread individually. The association of stacks to threads will * be handled by the pthread library. * - * In order for this macro to work, H5E_get_my_stack() must be preceeded + * In order for this macro to work, H5E__get_my_stack() must be preceeded * by "H5E_t *estack =". */ -#define H5E_get_my_stack() H5E_get_stack() +#define H5E__get_my_stack() H5E__get_stack() #else /* H5_HAVE_THREADSAFE */ /* * The current error stack. */ -#define H5E_get_my_stack() (H5E_stack_g + 0) +#define H5E__get_my_stack() (H5E_stack_g + 0) #endif /* H5_HAVE_THREADSAFE */ @@ -132,20 +132,20 @@ H5_DLLVAR H5E_t H5E_stack_g[1]; /******************************/ H5_DLL herr_t H5E__term_deprec_interface(void); #ifdef H5_HAVE_THREADSAFE -H5_DLL H5E_t *H5E_get_stack(void); +H5_DLL H5E_t *H5E__get_stack(void); #endif /* H5_HAVE_THREADSAFE */ H5_DLL herr_t H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc); -H5_DLL ssize_t H5E_get_msg(const H5E_msg_t *msg_ptr, H5E_type_t *type, +H5_DLL ssize_t H5E__get_msg(const H5E_msg_t *msg_ptr, H5E_type_t *type, char *msg, size_t size); -H5_DLL herr_t H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compat); -H5_DLL herr_t H5E_walk(const H5E_t *estack, H5E_direction_t direction, +H5_DLL herr_t H5E__print(const H5E_t *estack, FILE *stream, hbool_t bk_compat); +H5_DLL herr_t H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op, void *client_data); -H5_DLL herr_t H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, +H5_DLL herr_t H5E__get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data); -H5_DLL herr_t H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, +H5_DLL herr_t H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data); -H5_DLL herr_t H5E_pop(H5E_t *err_stack, size_t count); +H5_DLL herr_t H5E__pop(H5E_t *err_stack, size_t count); #endif /* _H5Epkg_H */ @@ -21,30 +21,46 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Aprivate.h" /* Attributes */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5Tprivate.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Tprivate.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ /* Local Macros */ /****************/ + /******************/ /* Local Typedefs */ /******************/ +/* User data for traversal routine to get ID counts */ +typedef struct { + size_t obj_count; /* Number of objects counted so far */ + unsigned types; /* Types of objects to be counted */ +} H5F_trav_obj_cnt_t; + +/* User data for traversal routine to get ID lists */ +typedef struct { + size_t max_objs; /* Maximum # of IDs to record */ + hid_t *oid_list; /* Array of recorded IDs*/ + size_t obj_count; /* Number of objects counted so far */ +} H5F_trav_obj_ids_t; + /********************/ /* Package Typedefs */ @@ -55,6 +71,14 @@ /* Local Prototypes */ /********************/ +static herr_t H5F__close_cb(H5VL_object_t *file_vol_obj); + +/* Callback for getting object counts in a file */ +static int H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key); + +/* Callback for getting IDs for open objects in a file */ +static int H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void *key); + /*********************/ /* Package Variables */ @@ -73,13 +97,18 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Local Variables */ /*******************/ +/* Declare a free list to manage the H5VL_t struct */ +H5FL_EXTERN(H5VL_t); + +/* Declare a free list to manage the H5VL_object_t struct */ +H5FL_EXTERN(H5VL_object_t); /* File ID class */ static const H5I_class_t H5I_FILE_CLS[1] = {{ - H5I_FILE, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ + H5I_FILE, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ }}; @@ -113,16 +142,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_term_package + * Function: H5F_term_package * - * Purpose: Terminate this interface: free all memory and reset global - * variables to their initial values. Release all ID groups - * associated with this interface. + * Purpose: Terminate this interface: free all memory and reset global + * variables to their initial values. Release all ID groups + * associated with this interface. + * + * Return: Success: Positive if anything was done that might + * have affected other interfaces; + * zero otherwise. + * + * Failure: Never fails * - * Return: Success: Positive if anything was done that might - * have affected other interfaces; - * zero otherwise. - * Failure: Never fails. *------------------------------------------------------------------------- */ int @@ -155,35 +186,75 @@ H5F_term_package(void) /*------------------------------------------------------------------------- - * Function: H5Fget_create_plist + * Function: H5F__close_cb + * + * Purpose: Closes a file or causes the close operation to be pended. + * This function is called from the API and gets called + * by H5Fclose->H5I_dec_ref->H5F__close_cb when H5I_dec_ref() + * decrements the file ID reference count to zero. The file ID + * is removed from the H5I_FILE group by H5I_dec_ref() just + * before H5F__close_cb() is called. If there are open object + * headers then the close is pended by moving the file to the + * H5I_FILE_CLOSING ID group (the f->closing contains the ID + * assigned to file). + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5F__close_cb(H5VL_object_t *file_vol_obj) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(file_vol_obj); + + /* Close the file */ + if(H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + + /* Free the VOL object */ + if(H5VL_free_object(file_vol_obj) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__close_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5Fget_create_plist * - * Purpose: Get an atom for a copy of the file-creation property list for - * this file. This function returns an atom with a copy of the - * properties used to create a file. + * Purpose: Get an atom for a copy of the file-creation property list for + * this file. This function returns an atom with a copy of the + * properties used to create a file. + * + * Return: Success: Object ID for a copy of the file creation + * property list. + * + * Failure: H5I_INVALID_HID * - * Return: Success: template ID - * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5Fget_create_plist(hid_t file_id) { - H5F_t *file; /* File info */ - H5P_genplist_t *plist; /* Property list */ - hid_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* File info */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); /* check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") - if(NULL == (plist = (H5P_genplist_t *)H5I_object(file->shared->fcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") - /* Create the property list object to return */ - if((ret_value = H5P_copy_plist(plist, TRUE)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to copy file creation properties") + /* Retrieve the file creation property list */ + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_FCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties") done: FUNC_LEAVE_API(ret_value) @@ -191,37 +262,39 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_access_plist + * Function: H5Fget_access_plist * - * Purpose: Returns a copy of the file access property list of the - * specified file. + * Purpose: Returns a copy of the file access property list of the + * specified file. * * NOTE: Make sure that, if you are going to overwrite * information in the copied property list that was * previously opened and assigned to the property list, then * you must close it before overwriting the values. * - * Return: Success: Object ID for a copy of the file access - * property list. - * Failure: FAIL + * Return: Success: Object ID for a copy of the file access + * property list. + * + * Failure: H5I_INVALID_HID + * *------------------------------------------------------------------------- */ hid_t H5Fget_access_plist(hid_t file_id) { - H5F_t *f; /* File info */ - hid_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* File info */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); /* Check args */ - if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file's access property list */ - if((ret_value = H5F_get_access_plist(f, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file access property list") + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_FAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list") done: FUNC_LEAVE_API(ret_value) @@ -229,36 +302,98 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_obj_count + * Function: H5F__get_all_count_cb + * + * Purpose: Get counter of all object types currently open. * - * Purpose: Public function returning the number of opened object IDs - * (files, datasets, groups and datatypes) in the same file. + * Return: Success: H5_ITER_CONT or H5_ITER_STOP + * + * Failure: H5_ITER_ERROR + * + *------------------------------------------------------------------------- + */ +static int +H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key) +{ + H5F_trav_obj_cnt_t *udata = (H5F_trav_obj_cnt_t *)key; + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + udata->obj_count++; + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F_get_all_count_cb */ + + +/*------------------------------------------------------------------------- + * Function: H5Fget_obj_count + * + * Purpose: Public function returning the number of opened object IDs + * (files, datasets, groups and datatypes) in the same file. + * + * Return: Success: The number of opened object IDs + * + * Failure: -1 * - * Return: Non-negative on success; negative on failure. *------------------------------------------------------------------------- */ ssize_t H5Fget_obj_count(hid_t file_id, unsigned types) { - H5F_t *f = NULL; /* File to query */ - size_t obj_count = 0; /* Number of opened objects */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = 0; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE2("Zs", "iIu", file_id, types); /* Check arguments */ - if(file_id != (hid_t)H5F_OBJ_ALL && (NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") if(0 == (types & H5F_OBJ_ALL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type") /* Perform the query */ - if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed") - - /* Set the return value */ - ret_value = (ssize_t)obj_count; + /* If the 'special' ID wasn't passed in, just make a normal call to + * count the IDs in the file. + */ + if(file_id != (hid_t)H5F_OBJ_ALL) { + H5VL_object_t *vol_obj; + + /* Get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id") + + /* Get the count */ + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, &ret_value) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)") + } + /* If we passed in the 'special' ID, get the count for everything open in the + * library, iterating over all open files and getting the object count for each. + */ + else { + H5F_trav_obj_cnt_t udata; + + /* Set up callback context */ + udata.types = types | H5F_OBJ_LOCAL; + udata.obj_count = 0; + + if(types & H5F_OBJ_FILE) + if(H5I_iterate(H5I_FILE, H5F__get_all_count_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed") + if(types & H5F_OBJ_DATASET) + if(H5I_iterate(H5I_DATASET, H5F__get_all_count_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed") + if(types & H5F_OBJ_GROUP) + if(H5I_iterate(H5I_GROUP, H5F__get_all_count_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed") + if(types & H5F_OBJ_DATATYPE) + if(H5I_iterate(H5I_DATATYPE, H5F__get_all_count_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed") + if(types & H5F_OBJ_ATTR) + if(H5I_iterate(H5I_ATTR, H5F__get_all_count_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed") + + /* Set return value */ + ret_value = (ssize_t)udata.obj_count; + } /* end else */ done: FUNC_LEAVE_API(ret_value) @@ -266,37 +401,116 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_object_ids + * Function: H5F__get_all_ids_cb + * + * Purpose: Get IDs of all currently open objects of a given type. * - * Purpose: Public function to return a list of opened object IDs. + * Return: Success: H5_ITER_CONT or H5_ITER_STOP + * + * Failure: H5_ITER_ERROR + * + *------------------------------------------------------------------------- + */ +static int +H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void *key) +{ + H5F_trav_obj_ids_t *udata = (H5F_trav_obj_ids_t *)key; + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + if(udata->obj_count >= udata->max_objs) + HGOTO_DONE(H5_ITER_STOP); + + /* Add the ID to the array */ + udata->oid_list[udata->obj_count] = obj_id; + udata->obj_count++; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F__get_all_ids_cb */ + + +/*------------------------------------------------------------------------- + * Function: H5Fget_object_ids + * + * Purpose: Public function to return a list of opened object IDs. + * + * NOTE: Type mismatch - You can ask for more objects than can be + * returned. + * + * NOTE: Currently, the IDs' ref counts are not incremented. Is this + * intentional and documented? + * + * Return: Success: The number of IDs in oid_list + * + * Failure: -1 * - * Return: Non-negative on success; negative on failure. *------------------------------------------------------------------------- */ ssize_t H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) { - H5F_t *f = NULL; /* File to query */ - size_t obj_id_count = 0; /* Number of open objects */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = 0; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE4("Zs", "iIuz*i", file_id, types, max_objs, oid_list); /* Check arguments */ - if(file_id != (hid_t)H5F_OBJ_ALL && (NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") if(0 == (types & H5F_OBJ_ALL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type") if(!oid_list) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "object ID list is NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "object ID list cannot be NULL") /* Perform the query */ - if(H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_id_count) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed") + /* If the 'special' ID wasn't passed in, just make a normal VOL call to + * get the IDs from the file. + */ + if(file_id != (hid_t)H5F_OBJ_ALL) { + H5VL_object_t *vol_obj; - /* Set the return value */ - ret_value = (ssize_t)obj_id_count; + /* get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") + + /* Get the IDs */ + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_IDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)") + } /* end if */ + /* If we passed in the 'special' ID, get the count for everything open in the + * library, iterating over all open files and getting the object count for each. + * + * XXX: Note that the RM states that passing in a negative value for max_objs + * gets you all the objects. This technically works, but is clearly wrong + * behavior since max_objs is an unsigned type. + */ + else { + H5F_trav_obj_ids_t udata; + + /* Set up callback context */ + udata.max_objs = max_objs; + udata.oid_list = oid_list; + udata.obj_count = 0; + + if(types & H5F_OBJ_FILE) + if(H5I_iterate(H5I_FILE, H5F__get_all_ids_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed") + if(types & H5F_OBJ_DATASET) + if(H5I_iterate(H5I_DATASET, H5F__get_all_ids_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed") + if(types & H5F_OBJ_GROUP) + if(H5I_iterate(H5I_GROUP, H5F__get_all_ids_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed") + if(types & H5F_OBJ_DATATYPE) + if(H5I_iterate(H5I_DATATYPE, H5F__get_all_ids_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed") + if(types & H5F_OBJ_ATTR) + if(H5I_iterate(H5I_ATTR, H5F__get_all_ids_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed") + + /* Set return value */ + ret_value = (ssize_t)udata.obj_count; + } /* end else */ done: FUNC_LEAVE_API(ret_value) @@ -309,30 +523,30 @@ done: * Purpose: Returns a pointer to the file handle of the low-level file * driver. * - * Return: Success: non-negative value. - * Failure: negative. + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t -H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle) +H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle) { - H5F_t *file; /* File to query */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ii**x", file_id, fapl, file_handle); + H5TRACE3("e", "ii**x", file_id, fapl_id, file_handle); /* Check args */ if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle pointer") - /* Get the file */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") + /* Get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Retrieve the VFD handle for the file */ - if(H5F_get_vfd_handle(file, fapl, file_handle) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle") + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle") done: FUNC_LEAVE_API(ret_value) @@ -340,38 +554,40 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fis_hdf5 + * Function: H5Fis_accessible * - * Purpose: Check the file signature to detect an HDF5 file. + * Purpose: Check if the file can be opened with the given fapl. * - * Bugs: This function is not robust: it only uses the default file - * driver when attempting to open the file when in fact it - * should use all known file drivers. + * Return: TRUE/FALSE/FAIL * - * Return: Success: TRUE/FALSE - * Failure: Negative *------------------------------------------------------------------------- */ htri_t -H5Fis_hdf5(const char *name) +H5Fis_accessible(const char *name, hid_t fapl_id) { htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE1("t", "*s", name); + H5TRACE2("t", "*si", name, fapl_id); - /* Check args and all the boring stuff. */ + /* Check args */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") - /* call the private is_HDF5 function */ - /* (Should not trigger raw data I/O - QAK, 2018/01/03) */ - if((ret_value = H5F__is_hdf5(name)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable open file") + /* Check the file access property list */ + if(H5P_DEFAULT == fapl_id) + fapl_id = H5P_FILE_ACCESS_DEFAULT; + else + if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + + /* Check if file is accessible */ + if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5") done: FUNC_LEAVE_API(ret_value) -} /* end H5Fis_hdf5() */ +} /* end H5Fis_accessible() */ /*------------------------------------------------------------------------- @@ -394,66 +610,70 @@ done: * the list of file creation and file access properties. * * Return: Success: A file ID - * Failure: FAIL + * + * Failure: H5I_INVALID_HID + * *------------------------------------------------------------------------- */ hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - H5F_t *new_file = NULL; /* file struct for new file */ - hid_t ret_value; /* return value */ + H5F_t *new_file = NULL; /* File struct for new file */ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); /* Check/fix arguments */ - if (!filename || !*filename) + if(!filename || !*filename) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name") /* In this routine, we only accept the following flags: * H5F_ACC_EXCL, H5F_ACC_TRUNC and H5F_ACC_SWMR_WRITE */ - if (flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE)) + if(flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid flags") /* The H5F_ACC_EXCL and H5F_ACC_TRUNC flags are mutually exclusive */ - if ((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) + if((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "mutually exclusive flags for file creation") /* Check file creation property list */ - if (H5P_DEFAULT == fcpl_id) + if(H5P_DEFAULT == fcpl_id) fcpl_id = H5P_FILE_CREATE_DEFAULT; else - if (TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) + if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not file create property list") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for * reading and writing. */ - if (0 == (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC))) + if(0 == (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC))) flags |= H5F_ACC_EXCL; /*default*/ flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; - /* Create a new file or truncate an existing file. */ - if (NULL == (new_file = H5F__create(filename, flags, fcpl_id, fapl_id))) + /* Create a new file or truncate an existing file through the VOL */ + if(NULL == (new_file = (H5F_t *)H5VL_file_create(&connector_prop, filename, flags, fcpl_id, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") /* Get an atom for the file */ - if ((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file") - - /* Keep this ID in file object structure */ - new_file->file_id = ret_value; + if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: - if(ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problems closing file") - FUNC_LEAVE_API(ret_value) } /* end H5Fcreate() */ @@ -473,26 +693,29 @@ done: * * Return: Success: A file ID * - * Failure: FAIL + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { - H5F_t *new_file = NULL; /* file struct for new file */ - hid_t ret_value; /* return value */ + H5F_t *new_file = NULL; /* File struct for new file */ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "*sIui", filename, flags, fapl_id); - /* Check/fix arguments. */ + /* Check arguments */ if(!filename || !*filename) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name") /* Reject undefined flags (~H5F_ACC_PUBLIC_FLAGS) and the H5F_ACC_TRUNC & H5F_ACC_EXCL flags */ if((flags & ~H5F_ACC_PUBLIC_FLAGS) || (flags & H5F_ACC_TRUNC) || (flags & H5F_ACC_EXCL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file open flags") + /* XXX (VOL MERGE): Might want to move SWMR flag checks to H5F_open() */ /* Asking for SWMR write access on a read-only file is invalid */ if((flags & H5F_ACC_SWMR_WRITE) && 0 == (flags & H5F_ACC_RDWR)) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "SWMR write access on a file open for read-only access is not allowed") @@ -504,133 +727,59 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Open the file */ - if(NULL == (new_file = H5F__open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") + /* Get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") - /* Get an atom for the file */ - if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + /* Open the file through the VOL layer */ + if(NULL == (new_file = (H5F_t *)H5VL_file_open(&connector_prop, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") - /* Keep this ID in file object structure */ - new_file->file_id = ret_value; + /* 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") done: - if(ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problems closing file") - FUNC_LEAVE_API(ret_value) } /* end H5Fopen() */ /*------------------------------------------------------------------------- - * Function: H5Fflush + * Function: H5Fflush + * + * Purpose: Flushes all outstanding buffers of a file to disk but does + * not remove them from the cache. The OBJECT_ID can be a file, + * dataset, group, attribute, or named data type. * - * Purpose: Flushes all outstanding buffers of a file to disk but does - * not remove them from the cache. The OBJECT_ID can be a file, - * dataset, group, attribute, or named data type. + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t H5Fflush(hid_t object_id, H5F_scope_t scope) { - H5F_t *f = NULL; /* File to flush */ - H5O_loc_t *oloc = NULL; /* Object location for ID */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Object info */ + H5I_type_t obj_type; /* Type of object */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "iFs", object_id, scope); - switch(H5I_get_type(object_id)) { - case H5I_FILE: - if(NULL == (f = (H5F_t *)H5I_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - break; - - case H5I_GROUP: - { - H5G_t *grp; - - if(NULL == (grp = (H5G_t *)H5I_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid group identifier") - oloc = H5G_oloc(grp); - } - break; - - case H5I_DATATYPE: - { - H5T_t *type; - - if(NULL == (type = (H5T_t *)H5I_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid type identifier") - oloc = H5T_oloc(type); - } - break; - - case H5I_DATASET: - { - H5D_t *dset; - - if(NULL == (dset = (H5D_t *)H5I_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") - oloc = H5D_oloc(dset); - } - break; - - case H5I_ATTR: - { - H5A_t *attr; - - if(NULL == (attr = (H5A_t *)H5I_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid attribute identifier") - oloc = H5A_oloc(attr); - } - break; - - case H5I_UNINIT: - case H5I_BADID: - case H5I_DATASPACE: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - } /* end switch */ - - if(!f) { - if(!oloc) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "object is not assocated with a file") - f = oloc->file; - } /* end if */ - if(!f) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "object is not associated with a file") - - /* Flush the file */ - /* - * Nothing to do if the file is read only. This determination is - * made at the shared open(2) flags level, implying that opening a - * file twice, once for read-only and once for read-write, and then - * calling H5Fflush() with the read-only handle, still causes data - * to be flushed. - */ - if(H5F_ACC_RDWR & H5F_INTENT(f)) { - hid_t fapl_id = H5P_DEFAULT; /* FAPL to use */ + /* Get the type of object we're flushing + sanity check */ + obj_type = H5I_get_type(object_id); + if(H5I_FILE != obj_type && H5I_GROUP != obj_type && H5I_DATATYPE != obj_type && + H5I_DATASET != obj_type && H5I_ATTR != obj_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - /* Verify access property list and set up collective metadata if appropriate */ - if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, object_id, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access property list info") + /* get the file object */ + if(NULL == (vol_obj = H5VL_vol_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Flush the file */ - if(H5F__flush(f, scope) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") - } /* end if */ + /* Flush the object */ + if(H5VL_file_specific(vol_obj, H5VL_FILE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, scope) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file") done: FUNC_LEAVE_API(ret_value) @@ -638,17 +787,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fclose + * Function: H5Fclose * - * Purpose: This function closes the file specified by FILE_ID by - * flushing all data to storage, and terminating access to the - * file through FILE_ID. If objects (e.g., datasets, groups, - * etc.) are open in the file then the underlying storage is not - * closed until those objects are closed; however, all data for - * the file and the open objects is flushed. + * Purpose: This function closes the file specified by FILE_ID by + * flushing all data to storage, and terminating access to the + * file through FILE_ID. If objects (e.g., datasets, groups, + * etc.) are open in the file then the underlying storage is not + * closed until those objects are closed; however, all data for + * the file and the open objects is flushed. + * + * Return: SUCCEED/FAIL * - * Return: Success: Non-negative - * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -661,11 +810,13 @@ H5Fclose(hid_t file_id) /* Check arguments */ if(H5I_FILE != H5I_get_type(file_id)) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID") - /* Close the file */ - if(H5F__close(file_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "closing file ID failed") + /* Decrement reference count on atom. When it reaches zero the file will + * be closed. + */ + if(H5I_dec_app_ref(file_id) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed") done: FUNC_LEAVE_API(ret_value) @@ -673,63 +824,60 @@ done: /*------------------------------------------------------------------------- - * Function: H5Freopen + * Function: H5Freopen + * + * Purpose: Reopen a file. The new file handle which is returned points + * to the same file as the specified file handle. Both handles + * share caches and other information. The only difference + * between the handles is that the new handle is not mounted + * anywhere and no files are mounted on it. * - * Purpose: Reopen a file. The new file handle which is returned points - * to the same file as the specified file handle. Both handles - * share caches and other information. The only difference - * between the handles is that the new handle is not mounted - * anywhere and no files are mounted on it. + * Return: Success: New file ID + * + * Failure: H5I_INVALID_HID * - * Return: Success: New file ID - * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5Freopen(hid_t file_id) { - H5F_t *old_file = NULL; - H5F_t *new_file = NULL; - hid_t ret_value; + H5VL_object_t *vol_obj = NULL; + H5F_t *file = NULL; /* File struct for new file */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); - /* Check arguments */ - if(NULL == (old_file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") - - /* Get a new "top level" file struct, sharing the same "low level" file struct */ - if(NULL == (new_file = H5F__new(old_file->shared, 0, H5P_FILE_CREATE_DEFAULT, H5P_FILE_ACCESS_DEFAULT, NULL))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") + /* Get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") - /* Duplicate old file's names */ - new_file->open_name = H5MM_xstrdup(old_file->open_name); - new_file->actual_name = H5MM_xstrdup(old_file->actual_name); - new_file->extpath = H5MM_xstrdup(old_file->extpath); + /* Reopen the file */ + if(H5VL_file_specific(vol_obj, H5VL_FILE_REOPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &file) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL connector") - if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") + /* Make sure that worked */ + if(NULL == file) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file") - /* Keep this ID in file object structure */ - new_file->file_id = ret_value; + /* Get an atom for the file */ + if((ret_value = H5VL_register(H5I_FILE, file, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: - if(ret_value < 0 && new_file) - if(H5F__dest(new_file, FALSE) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") - + /* XXX (VOL MERGE): If registration fails, file will not be closed */ FUNC_LEAVE_API(ret_value) } /* end H5Freopen() */ /*------------------------------------------------------------------------- - * Function: H5Fget_intent + * Function: H5Fget_intent * - * Purpose: Public API to retrieve the file's 'intent' flags passed - * during H5Fopen() + * Purpose: Public API to retrieve the file's 'intent' flags passed + * during H5Fopen() + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/negative on failure *------------------------------------------------------------------------- */ herr_t @@ -742,30 +890,15 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags) /* If no intent flags were passed in, exit quietly */ if(intent_flags) { - H5F_t *file; /* Pointer to file structure */ + H5VL_object_t *vol_obj; /* File info */ /* Get the internal file structure */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") - - /* HDF5 uses some flags internally that users don't know about. - * Simplify things for them so that they only get either H5F_ACC_RDWR - * or H5F_ACC_RDONLY. - */ - if(H5F_INTENT(file) & H5F_ACC_RDWR) { - *intent_flags = H5F_ACC_RDWR; - - /* Check for SWMR write access on the file */ - if(H5F_INTENT(file) & H5F_ACC_SWMR_WRITE) - *intent_flags |= H5F_ACC_SWMR_WRITE; - } /* end if */ - else { - *intent_flags = H5F_ACC_RDONLY; + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - /* Check for SWMR read access on the file */ - if(H5F_INTENT(file) & H5F_ACC_SWMR_READ) - *intent_flags |= H5F_ACC_SWMR_READ; - } /* end else */ + /* Get the flags */ + if((ret_value = H5VL_file_get(vol_obj, H5VL_FILE_GET_INTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags") } /* end if */ done: @@ -778,29 +911,28 @@ done: * * Purpose: Retrieves the amount of free space in the file. * - * Return: Success: Amount of free space for type - * Failure: Negative + * Return: Success: Amount of free space for type + * + * Failure: -1 + * *------------------------------------------------------------------------- */ hssize_t H5Fget_freespace(hid_t file_id) { - H5F_t *file; /* File object for file ID */ - hsize_t tot_space; /* Amount of free space in the file */ + H5VL_object_t *vol_obj = NULL; hssize_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE1("Hs", "i", file_id); - /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - - /* Get the free space in the file */ - if(H5F__get_freespace(file, &tot_space) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + /* Get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") - ret_value = (hssize_t)tot_space; + /* Get the amount of free space in the file */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space") done: FUNC_LEAVE_API(ret_value) @@ -812,35 +944,30 @@ done: * * Purpose: Retrieves the file size of the HDF5 file. This function * is called after an existing file is opened in order - * to learn the true size of the underlying file. + * to learn the true size of the underlying file. + * + * Return: SUCCEED/FAIL * - * Return: Success: Non-negative - * Failure: Negative *------------------------------------------------------------------------- */ herr_t H5Fget_filesize(hid_t file_id, hsize_t *size) { - H5F_t *file; /* File object for file ID */ - haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */ - haddr_t base_addr; /* Base address for the file */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", file_id, size); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(!size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size parameter cannot be NULL") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* Go get the actual file size */ - if(H5F__get_max_eof_eoa(file, &max_eof_eoa) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") - - base_addr = H5FD_get_base_addr(file->shared->lf); - - if(size) - *size = (hsize_t)(max_eof_eoa + base_addr); /* Convert relative base address for file to absolute address */ + /* Get the file size */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") done: FUNC_LEAVE_API(ret_value) @@ -851,56 +978,57 @@ done: * Function: H5Fget_file_image * * Purpose: If a buffer is provided (via the buf_ptr argument) and is - * big enough (size in buf_len argument), load *buf_ptr with - * an image of the open file whose ID is provided in the - * file_id parameter, and return the number of bytes copied - * to the buffer. + * big enough (size in buf_len argument), load *buf_ptr with + * an image of the open file whose ID is provided in the + * file_id parameter, and return the number of bytes copied + * to the buffer. * - * If the buffer exists, but is too small to contain an image - * of the indicated file, return a negative number. + * If the buffer exists, but is too small to contain an image + * of the indicated file, return a negative number. * - * Finally, if no buffer is provided, return the size of the - * buffer needed. This value is simply the eoa of the target - * file. + * Finally, if no buffer is provided, return the size of the + * buffer needed. This value is simply the eoa of the target + * file. * - * Note that any user block is skipped. + * Note that any user block is skipped. * - * Also note that the function may not be used on files - * opened with either the split/multi file driver or the - * family file driver. + * Also note that the function may not be used on files + * opened with either the split/multi file driver or the + * family file driver. * - * In the former case, the sparse address space makes the - * get file image operation impractical, due to the size of - * the image typically required. + * In the former case, the sparse address space makes the + * get file image operation impractical, due to the size of + * the image typically required. * - * In the case of the family file driver, the problem is - * the driver message in the super block, which will prevent - * the image being opened with any driver other than the - * family file driver -- which negates the purpose of the - * operation. This can be fixed, but no resources for - * this now. + * In the case of the family file driver, the problem is + * the driver message in the super block, which will prevent + * the image being opened with any driver other than the + * family file driver -- which negates the purpose of the + * operation. This can be fixed, but no resources for + * this now. + * + * Return: Success: Bytes copied / number of bytes needed + * + * Failure: -1 * - * Return: Success: Bytes copied / number of bytes needed. - * Failure: negative value *------------------------------------------------------------------------- */ ssize_t H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) { - H5F_t *file; /* File object for file ID */ - ssize_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* File object for file ID */ + ssize_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*xz", file_id, buf_ptr, buf_len); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID") - /* call private get_file_image function */ - /* (Should not trigger raw data I/O - QAK, 2018/01/03) */ - if((ret_value = H5F__get_file_image(file, buf_ptr, buf_len)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file image") + /* Get the file image */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image") done: FUNC_LEAVE_API(ret_value) @@ -908,37 +1036,39 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_mdc_config + * Function: H5Fget_mdc_config + * + * Purpose: Retrieves the current automatic cache resize configuration + * from the metadata cache, and return it in *config_ptr. * - * Purpose: Retrieves the current automatic cache resize configuration - * from the metadata cache, and return it in *config_ptr. + * Note that the version field of *config_Ptr must be correctly + * filled in by the caller. This allows us to adapt for + * obsolete versions of the structure. * - * Note that the version field of *config_Ptr must be correctly - * filled in by the caller. This allows us to adapt for - * obsolete versions of the structure. + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) { - H5F_t *file; /* File object for file ID */ + H5VL_object_t *vol_obj = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", file_id, config_ptr); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") if((NULL == config_ptr) || (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr") - /* Go get the resize configuration */ - if(H5AC_get_cache_auto_resize_config(file->shared->cache, config_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.") + /* Get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + + /* Get the metadata cache configuration */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration") done: FUNC_LEAVE_API(ret_value) @@ -949,29 +1079,29 @@ done: * Function: H5Fset_mdc_config * * Purpose: Sets the current metadata cache automatic resize - * configuration, using the contents of the instance of - * H5AC_cache_config_t pointed to by config_ptr. + * configuration, using the contents of the instance of + * H5AC_cache_config_t pointed to by config_ptr. + * + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) { - H5F_t *file; /* File object for file ID */ + H5VL_object_t *vol_obj = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", file_id, config_ptr); - /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + /* Get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - /* set the resize configuration */ - if(H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed.") + /* Set the metadata cache configuration */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration") done: FUNC_LEAVE_API(ret_value) @@ -982,33 +1112,32 @@ done: * Function: H5Fget_mdc_hit_rate * * Purpose: Retrieves the current hit rate from the metadata cache. - * This rate is the overall hit rate since the last time - * the hit rate statistics were reset either manually or - * automatically. + * This rate is the overall hit rate since the last time + * the hit rate statistics were reset either manually or + * automatically. + * + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) { - H5F_t *file; /* File object for file ID */ + H5VL_object_t *vol_obj; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*d", file_id, hit_rate_ptr); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - if(NULL == hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* Go get the current hit rate */ - if(H5AC_get_cache_hit_rate(file->shared->cache, hit_rate_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.") + /* Get the current hit rate */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate") done: FUNC_LEAVE_API(ret_value) @@ -1019,21 +1148,20 @@ done: * Function: H5Fget_mdc_size * * Purpose: Retrieves the maximum size, minimum clean size, current - * size, and current number of entries from the metadata - * cache associated with the specified file. If any of - * the ptr parameters are NULL, the associated datum is - * not returned. + * size, and current number of entries from the metadata + * cache associated with the specified file. If any of + * the ptr parameters are NULL, the associated datum is + * not returned. + * + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr, int *cur_num_entries_ptr) { - H5F_t *file; /* File object for file ID */ - uint32_t cur_num_entries; + H5VL_object_t *vol_obj; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1041,16 +1169,12 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* Go get the size data */ - if(H5AC_get_cache_size(file->shared->cache, max_size_ptr, - min_clean_size_ptr, cur_size_ptr, &cur_num_entries) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.") - - if(cur_num_entries_ptr != NULL) - *cur_num_entries_ptr = (int)cur_num_entries; + /* Get the size data */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size") done: FUNC_LEAVE_API(ret_value) @@ -1061,34 +1185,34 @@ done: * Function: H5Freset_mdc_hit_rate_stats * * Purpose: Reset the hit rate statistic whose current value can - * be obtained via the H5Fget_mdc_hit_rate() call. Note - * that this statistic will also be reset once per epoch - * by the automatic cache resize code if it is enabled. + * be obtained via the H5Fget_mdc_hit_rate() call. Note + * that this statistic will also be reset once per epoch + * by the automatic cache resize code if it is enabled. * - * It is probably a bad idea to call this function unless - * you are controlling cache size from your program instead - * of using our cache size control code. + * It is probably a bad idea to call this function unless + * you are controlling cache size from your program instead + * of using our cache size control code. + * + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t H5Freset_mdc_hit_rate_stats(hid_t file_id) { - H5F_t *file; /* File object for file ID */ + H5VL_object_t *vol_obj = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); - /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + /* Get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the hit rate statistic */ - if(H5AC_reset_cache_hit_rate_stats(file->shared->cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate") + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate") done: FUNC_LEAVE_API(ret_value) @@ -1099,57 +1223,45 @@ done: * Function: H5Fget_name * * Purpose: Gets the name of the file to which object OBJ_ID belongs. - * If `name' is non-NULL then write up to `size' bytes into that + * If 'name' is non-NULL then write up to 'size' bytes into that * buffer and always return the length of the entry name. - * Otherwise `size' is ignored and the function does not store the name, - * just returning the number of characters required to store the name. - * If an error occurs then the buffer pointed to by `name' (NULL or non-NULL) - * is unchanged and the function returns a negative value. + * Otherwise `size' is ignored and the function does not store + * the name, just returning the number of characters required to + * store the name. If an error occurs then the buffer pointed to + * by 'name' (NULL or non-NULL) is unchanged and the function + * returns a negative value. * * Note: This routine returns the name that was used to open the file, * not the actual name after resolving symlinks, etc. * - * Return: Success: The length of the file name - * Failure: Negative + * Return: Success: The length of the file name + * + * Failure: -1 + * *------------------------------------------------------------------------- */ ssize_t H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) { - H5F_t *f; /* Top file in mount hierarchy */ - size_t len; - ssize_t ret_value; + H5VL_object_t *vol_obj = NULL; + H5I_type_t type; + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", obj_id, name, size); - /* For file IDs, get the file object directly */ - /* (This prevents the H5G_loc() call from returning the file pointer for - * the top file in a mount hierarchy) - */ - if(H5I_get_type(obj_id) == H5I_FILE ) { - if(NULL == (f = (H5F_t *)H5I_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") - } /* end if */ - else { - H5G_loc_t loc; /* Object location */ - - /* Get symbol table entry */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID") - f = loc.oloc->file; - } /* end else */ - - len = HDstrlen(H5F_OPEN_NAME(f)); + /* Check the type */ + type = H5I_get_type(obj_id); + if(H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file or file object") - if(name) { - HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1,size)); - if(len >= size) - name[size-1]='\0'; - } /* end if */ + /* Get the file object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") - /* Set return value */ - ret_value = (ssize_t)len; + /* Get the filename via the VOL */ + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file name") done: FUNC_LEAVE_API(ret_value) @@ -1165,43 +1277,35 @@ done: * in the SOHM table if there is one. * 3. The amount of free space tracked in the file. * - * Return: Success: non-negative on success - * Failure: Negative + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) { - H5F_t *f; /* Top file in mount hierarchy */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; + H5I_type_t type; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", obj_id, finfo); /* Check args */ if(!finfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file info pointer can't be NULL") - /* For file IDs, get the file object directly */ - /* (This prevents the H5G_loc() call from returning the file pointer for - * the top file in a mount hierarchy) - */ - if(H5I_get_type(obj_id) == H5I_FILE ) { - if(NULL == (f = (H5F_t *)H5I_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") - } /* end if */ - else { - H5G_loc_t loc; /* Object location */ + /* Check the type */ + type = H5I_get_type(obj_id); + if(H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - /* Get symbol table entry */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID") - f = loc.oloc->file; - } /* end else */ - HDassert(f->shared); + /* Get the file object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Get the file info */ - if(H5F__get_info(f, finfo) < 0) + /* Get the file information */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, finfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") done: @@ -1212,17 +1316,18 @@ done: /*------------------------------------------------------------------------- * Function: H5Fget_metadata_read_retry_info * - * Purpose: To retrieve the collection of read retries for metadata items with checksum. + * Purpose: To retrieve the collection of read retries for metadata + * items with checksum. + * + * Return: SUCCEED/FAIL * - * Return: Success: non-negative on success - * Failure: Negative *------------------------------------------------------------------------- */ herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) { - H5F_t *file; /* File object for file ID */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* File object for file ID */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", file_id, info); @@ -1232,11 +1337,11 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Get the file pointer */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the retry info */ - if(H5F__get_metadata_read_retry_info(file, info) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info") done: @@ -1245,36 +1350,38 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_free_sections + * Function: H5Fget_free_sections + * + * Purpose: To get free-space section information for free-space manager with + * TYPE that is associated with file FILE_ID. + * If SECT_INFO is null, this routine returns the total # of free-space + * sections. + * + * Return: Success: The total # of free space sections * - * Purpose: To get free-space section information for free-space manager with - * TYPE that is associated with file FILE_ID. - * If SECT_INFO is null, this routine returns the total # of free-space - * sections. + * Failure: -1 * - * Return: Success: non-negative, the total # of free space sections - * Failure: negative *------------------------------------------------------------------------- */ ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/) { - H5F_t *file; /* Top file in mount hierarchy */ - ssize_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE4("Zs", "iFmzx", file_id, type, nsects, sect_info); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") if(sect_info && nsects == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0") /* Get the free-space section information in the file */ - if((ret_value = H5F__get_free_sections(file, type, nsects, sect_info)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections") done: FUNC_LEAVE_API(ret_value) @@ -1288,28 +1395,26 @@ done: * provided file, potentially closing any cached files * unless they are held open from somewhere\ else. * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fclear_elink_file_cache(hid_t file_id) { - H5F_t *file; /* File */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* See if there's an EFC */ - if(file->shared->efc) - /* Release the EFC */ - if(H5F__efc_release(file->shared->efc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") + /* Release the EFC */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") done: FUNC_LEAVE_API(ret_value) @@ -1319,32 +1424,57 @@ done: /*------------------------------------------------------------------------- * Function: H5Fstart_swmr_write * - * Purpose: To enable SWMR writing mode for the file + * Purpose: To enable SWMR writing mode for the file + * + * 1) Refresh opened objects: part 1 + * 2) Flush & reset accumulator + * 3) Mark the file in SWMR writing mode + * 4) Set metadata read attempts and retries info + * 5) Disable accumulator + * 6) Evict all cache entries except the superblock + * 7) Refresh opened objects (part 2) + * 8) Unlock the file + * + * Pre-conditions: + * + * 1) The file being opened has v3 superblock + * 2) The file is opened with H5F_ACC_RDWR + * 3) The file is not already marked for SWMR writing + * 4) Current implementaion for opened objects: + * --only allow datasets and groups without attributes + * --disallow named datatype with/without attributes + * --disallow opened attributes attached to objects + * + * NOTE: Currently, only opened groups and datasets are allowed + * when enabling SWMR via H5Fstart_swmr_write(). + * Will later implement a different approach-- + * set up flush dependency/proxy even for file opened without + * SWMR to resolve issues with opened objects. * - * Return: Non-negative on success/negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Fstart_swmr_write(hid_t file_id) { - H5F_t *file = NULL; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); - /* check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + /* Check args */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call the internal routine */ - if(H5F__start_swmr_write(file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "unable to convert file format") + /* Start SWMR writing */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing") done: FUNC_LEAVE_API(ret_value) @@ -1357,24 +1487,25 @@ done: * Purpose: Start metadata cache logging operations for a file. * - Logging must have been set up via the fapl. * - * Return: Non-negative on success/Negative on errors + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fstart_mdc_logging(hid_t file_id) { - H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); /* Sanity check */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5C_start_logging(file->shared->cache) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_MDC_LOGGING) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging") done: @@ -1389,24 +1520,25 @@ done: * - Does not close the log file. * - Logging must have been set up via the fapl. * - * Return: Non-negative on success/Negative on errors + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fstop_mdc_logging(hid_t file_id) { - H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); /* Sanity check */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5C_stop_logging(file->shared->cache) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") done: @@ -1421,25 +1553,26 @@ done: * set up via the fapl. is_currently_logging determines if * log messages are being recorded at this time. * - * Return: Non-negative on success/Negative on errors + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, hbool_t *is_currently_logging) { - H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*b*b", file_id, is_enabled, is_currently_logging); /* Sanity check */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5C_get_logging_status(file->shared->cache, is_enabled, is_currently_logging) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status") done: @@ -1455,29 +1588,30 @@ done: * H5Fset_latest_format() starting release 1.10.2. * See explanation for H5Fset_latest_format() in H5Fdeprec.c. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) { - H5F_t *f; /* File */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File as VOL object */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "iFvFv", file_id, low, high); /* Check args */ - if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal set_libver_bounds function */ - if(H5F__set_libver_bounds(f, low, high) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") + /* Set the library's version bounds */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") done: FUNC_LEAVE_API(ret_value) @@ -1485,38 +1619,36 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fformat_convert + * Function: H5Fformat_convert (Internal) * - * Purpose: Downgrade the superblock version to v2 and - * downgrade persistent file space to non-persistent - * for 1.8 library. + * Purpose: Downgrade the superblock version to v2 and + * downgrade persistent file space to non-persistent + * for 1.8 library. + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t -H5Fformat_convert(hid_t fid) +H5Fformat_convert(hid_t file_id) { - H5F_t *f; /* File to flush */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* File */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE1("e", "i", fid); - - if(H5I_FILE != H5I_get_type(fid)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + H5TRACE1("e", "i", file_id); - /* Get file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + /* Check args */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "file_id parameter is not a valid file identifier") /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(fid) < 0) + if(H5CX_set_loc(file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call the internal routine */ - if(H5F__format_convert(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "unable to convert file format") + /* Convert the format */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_FORMAT_CONVERT) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") done: FUNC_LEAVE_API(ret_value) @@ -1528,28 +1660,26 @@ done: * * Purpose: Resets statistics for the page buffer layer. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Freset_page_buffering_stats(hid_t file_id) { - H5F_t *file; /* File to reset stats on */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File to reset stats on */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object(file_id))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(NULL == file->shared->page_buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "page buffering not enabled on file") /* Reset the statistics */ - if(H5PB_reset_stats(file->shared->page_buf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't reset stats for page buffering") + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_PAGE_BUFFERING_STATS) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering") done: FUNC_LEAVE_API(ret_value) @@ -1561,31 +1691,29 @@ done: * * Purpose: Retrieves statistics for the page buffer layer. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2], unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]) { - H5F_t *file; /* File object for file ID */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File object */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*Iu*Iu*Iu*Iu*Iu", file_id, accesses, hits, misses, evictions, bypasses); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - if(NULL == file->shared->page_buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "page buffering not enabled on file") if(NULL == accesses || NULL == hits || NULL == misses || NULL == evictions || NULL == bypasses) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats") /* Get the statistics */ - if(H5PB_get_stats(file->shared->page_buf, accesses, hits, misses, evictions, bypasses) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_PAGE_BUFFERING_STATS, accesses, hits, misses, evictions, bypasses) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering") done: @@ -1602,28 +1730,26 @@ done: * image_len: --size of the on disk metadata cache image * --zero if no cache image * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len) { - H5F_t *file; /* File object for file ID */ + H5VL_object_t *vol_obj; /* File info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*a*h", file_id, image_addr, image_len); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - if(NULL == image_addr || NULL == image_len) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL image addr or image len") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Go get the address and size of the cache image */ - if(H5AC_get_mdc_image_info(file->shared->cache, image_addr, image_len) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve cache image info") + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_IMAGE_INFO, image_addr, image_len) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info") done: FUNC_LEAVE_API(ret_value) @@ -1637,38 +1763,29 @@ done: * allocated memory in the file. * (See H5FDget_eoa() in H5FD.c) * - * Return: Success: First byte after allocated memory. - * Failure: HADDR_UNDEF - * - * Return: Non-negative on success/Negative on errors + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa) { - H5F_t *file; /* File object for file ID */ - haddr_t rel_eoa; /* Relative address of EOA */ + H5VL_object_t *vol_obj; /* File info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*a", file_id, eoa); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") - /* This public routine will work only for drivers with this feature enabled.*/ - /* We might introduce a new feature flag in the future */ - if(!H5F_HAS_FEATURE(file, H5FD_FEAT_SUPPORTS_SWMR_IO)) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") - - /* The real work */ - if(HADDR_UNDEF == (rel_eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed") + /* Only do work if valid pointer to fill in */ + if(eoa) { + /* Retrieve the EOA for the file */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_EOA, eoa) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA") + } /* end if */ - /* (Note compensating for base address subtraction in internal routine) */ - if(eoa) - *eoa = rel_eoa + H5FD_get_base_addr(file->shared->lf); done: FUNC_LEAVE_API(ret_value) } /* H5Fget_eoa() */ @@ -1679,36 +1796,25 @@ done: * * Purpose: Set the EOA for the file to the maximum of (EOA, EOF) + increment * - * Return: Non-negative on success/Negative on errors + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment) { - H5F_t *file; /* File object for file ID */ - haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ih", file_id, increment); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") - /* This public routine will work only for drivers with this feature enabled.*/ - /* We might introduce a new feature flag in the future */ - if(!H5F_HAS_FEATURE(file, H5FD_FEAT_SUPPORTS_SWMR_IO)) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") - - /* Get the maximum of EOA and EOF */ - if(H5F__get_max_eof_eoa(file, &max_eof_eoa) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") - - /* Set EOA to the maximum value + increment */ - /* H5FD_set_eoa() will add base_addr to max_eof_eoa */ - if(H5FD_set_eoa(file->shared->lf, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") + /* Increment the file size */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_INCR_FILESIZE, increment) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size") done: FUNC_LEAVE_API(ret_value) @@ -1740,24 +1846,30 @@ herr_t H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize) { - H5F_t *f = NULL; - herr_t ret_value = SUCCEED; + H5VL_object_t *vol_obj = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*b", file_id, minimize); if (NULL == minimize) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "out pointer 'minimize' cannot be NULL") - - f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); - if (NULL == f) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "can't get file from id") + "out pointer 'minimize' cannot be NULL") - HDassert(f->shared); + vol_obj = (H5VL_object_t *)H5I_object(file_id); + if (NULL == vol_obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - *minimize = f->shared->crt_dset_min_ohdr_flag; + if (0 > H5VL_file_get( + vol_obj, + H5VL_FILE_GET_MIN_DSET_OHDR_FLAG, + H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, + minimize)) + { + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, + "unable to get file's dataset header minimization flag") + } done: FUNC_LEAVE_API(ret_value) @@ -1788,20 +1900,26 @@ herr_t H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize) { - H5F_t *f = NULL; - herr_t ret_value = SUCCEED; + H5VL_object_t *vol_obj = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE2("e", "ib", file_id, minimize); - f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); - if (NULL == f) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "can't get file from id") - - HDassert(f->shared); + vol_obj = (H5VL_object_t *)H5I_object(file_id); + if (NULL == vol_obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - f->shared->crt_dset_min_ohdr_flag = minimize; + if (0 > H5VL_file_optional( + vol_obj, + H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, + H5VL_FILE_SET_MIN_DSET_OHDR_FLAG, + minimize)) + { + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, + "unable to set file's dataset header minimization flag") + } done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5FApkg.h b/src/H5FApkg.h index 720c046..8f76fc9 100644 --- a/src/H5FApkg.h +++ b/src/H5FApkg.h @@ -275,8 +275,7 @@ H5_DLL herr_t H5FA__hdr_decr(H5FA_hdr_t *hdr); H5_DLL herr_t H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr); H5_DLL size_t H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr); H5_DLL herr_t H5FA__hdr_modified(H5FA_hdr_t *hdr); -H5_DLL H5FA_hdr_t *H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, - unsigned flags); +H5_DLL H5FA_hdr_t *H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags); H5_DLL herr_t H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags); H5_DLL herr_t H5FA__hdr_delete(H5FA_hdr_t *hdr); H5_DLL herr_t H5FA__hdr_dest(H5FA_hdr_t *hdr); @@ -285,8 +284,7 @@ H5_DLL herr_t H5FA__hdr_dest(H5FA_hdr_t *hdr); H5_DLL H5FA_dblock_t *H5FA__dblock_alloc(H5FA_hdr_t *hdr); H5_DLL haddr_t H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty); H5_DLL unsigned H5FA__dblock_sblk_idx(const H5FA_hdr_t *hdr, hsize_t idx); -H5_DLL H5FA_dblock_t *H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, - unsigned flags); +H5_DLL H5FA_dblock_t *H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, unsigned flags); H5_DLL herr_t H5FA__dblock_unprotect(H5FA_dblock_t *dblock, unsigned cache_flags); H5_DLL herr_t H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr); H5_DLL herr_t H5FA__dblock_dest(H5FA_dblock_t *dblock); @@ -294,21 +292,18 @@ H5_DLL herr_t H5FA__dblock_dest(H5FA_dblock_t *dblock); /* Data block page routines */ H5_DLL herr_t H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts); H5_DLL H5FA_dblk_page_t *H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts); -H5_DLL H5FA_dblk_page_t *H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, - size_t dblk_page_nelmts, unsigned flags); +H5_DLL H5FA_dblk_page_t *H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_page_nelmts, unsigned flags); H5_DLL herr_t H5FA__dblk_page_unprotect(H5FA_dblk_page_t *dblk_page, unsigned cache_flags); H5_DLL herr_t H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page); /* Debugging routines for dumping file structures */ -H5_DLL herr_t H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, - int fwidth, const H5FA_class_t *cls, haddr_t obj_addr); -H5_DLL herr_t H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, - int indent, int fwidth, const H5FA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr); +H5_DLL herr_t H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls, haddr_t obj_addr); +H5_DLL herr_t H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr); /* Testing routines */ #ifdef H5FA_TESTING -H5_DLL herr_t H5FA_get_cparam_test(const H5FA_t *ea, H5FA_create_t *cparam); -H5_DLL int H5FA_cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2); +H5_DLL herr_t H5FA__get_cparam_test(const H5FA_t *ea, H5FA_create_t *cparam); +H5_DLL int H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2); #endif /* H5FA_TESTING */ #endif /* _H5FApkg_H */ diff --git a/src/H5FAtest.c b/src/H5FAtest.c index 4b03036..27cd8b7 100644 --- a/src/H5FAtest.c +++ b/src/H5FAtest.c @@ -70,12 +70,9 @@ typedef struct H5FA__test_ctx_t { static void *H5FA__test_crt_context(void *udata); static herr_t H5FA__test_dst_context(void *ctx); static herr_t H5FA__test_fill(void *nat_blk, size_t nelmts); -static herr_t H5FA__test_encode(void *raw, const void *elmt, size_t nelmts, - void *ctx); -static herr_t H5FA__test_decode(const void *raw, void *elmt, size_t nelmts, - void *ctx); -static herr_t H5FA__test_debug(FILE *stream, int indent, int fwidth, - hsize_t idx, const void *elmt); +static herr_t H5FA__test_encode(void *raw, const void *elmt, size_t nelmts, void *ctx); +static herr_t H5FA__test_decode(const void *raw, void *elmt, size_t nelmts, void *ctx); +static herr_t H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt); static void *H5FA__test_crt_dbg_context(H5F_t *f, haddr_t obj_addr); @@ -361,7 +358,7 @@ END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */ /*------------------------------------------------------------------------- - * Function: H5FA_get_cparam_test + * Function: H5FA__get_cparam_test * * Purpose: Retrieve the parameters used to create the fixed array * @@ -372,9 +369,9 @@ END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, NOERR, +BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, -H5FA_get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam)) +H5FA__get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam)) /* Check arguments. */ HDassert(fa); @@ -384,11 +381,11 @@ H5FA_get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam)) cparam->raw_elmt_size = fa->hdr->cparam.raw_elmt_size; cparam->nelmts = fa->hdr->cparam.nelmts; -END_FUNC(PRIV) /* end H5FA_get_cparam_test() */ +END_FUNC(PKG) /* end H5FA__get_cparam_test() */ /*------------------------------------------------------------------------- - * Function: H5FA_cmp_cparam_test + * Function: H5FA__cmp_cparam_test * * Purpose: Compare the parameters used to create the fixed array * @@ -399,9 +396,9 @@ END_FUNC(PRIV) /* end H5FA_get_cparam_test() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERRCATCH, +BEGIN_FUNC(PKG, ERRCATCH, int, 0, -, -H5FA_cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2)) +H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2)) /* Check arguments. */ HDassert(cparam1); @@ -415,5 +412,5 @@ H5FA_cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2) CATCH -END_FUNC(PRIV) /* end H5FA_cmp_cparam_test() */ +END_FUNC(PKG) /* end H5FA__cmp_cparam_test() */ @@ -23,22 +23,22 @@ /* Module Setup */ /****************/ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /* Suppress error about including H5Fpkg */ #include "H5FDmodule.h" /* This source code file is part of the H5FD module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDpkg.h" /* File Drivers */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDpkg.h" /* File Drivers */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ /****************/ /* Local Macros */ @@ -58,8 +58,8 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5FD_free_cls(H5FD_class_t *cls); -static int H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/); +static herr_t H5FD__free_cls(H5FD_class_t *cls); +static herr_t H5FD__query(const H5FD_t *f, unsigned long *flags/*out*/); /*********************/ /* Package Variables */ @@ -94,21 +94,20 @@ static unsigned long H5FD_file_serial_no_g; /* File driver ID class */ static const H5I_class_t H5I_VFL_CLS[1] = {{ - H5I_VFL, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5FD_free_cls /* Callback routine for closing objects of this class */ + H5I_VFL, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5FD__free_cls /* Callback routine for closing objects of this class */ }}; /*------------------------------------------------------------------------- - * Function: H5FD__init_package + * Function: H5FD__init_package * - * Purpose: Initialize the virtual file layer. + * Purpose: Initialize the virtual file layer. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -131,16 +130,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_term_package + * Function: H5FD_term_package + * + * Purpose: Terminate this interface: free all memory and reset global + * variables to their initial values. Release all ID groups + * associated with this interface. * - * Purpose: Terminate this interface: free all memory and reset global - * variables to their initial values. Release all ID groups - * associated with this interface. + * Return: Success: Positive if anything was done that might + * have affected other interfaces; zero + * otherwise. * - * Return: Success: Positive if anything was done that might - * have affected other interfaces; zero - * otherwise. - * Failure: Never fails. + * Failure: Never fails. * *------------------------------------------------------------------------- */ @@ -171,26 +171,24 @@ H5FD_term_package(void) /*------------------------------------------------------------------------- - * Function: H5FD_free_cls + * Function: H5FD__free_cls * - * Purpose: Frees a file driver class struct and returns an indication of - * success. This function is used as the free callback for the - * virtual file layer object identifiers (cf H5FD__init_package). - * - * Return: Success: Non-negative + * Purpose: Frees a file driver class struct and returns an indication of + * success. This function is used as the free callback for the + * virtual file layer object identifiers (cf H5FD__init_package). * - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -H5FD_free_cls(H5FD_class_t *cls) +H5FD__free_cls(H5FD_class_t *cls) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - /* Sanity check */ + /* Sanity checks */ HDassert(cls); /* If the file driver has a terminate callback, call it to give the file @@ -219,37 +217,37 @@ done: * library is closed or the driver is * unregistered. * - * Failure: A negative value. + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5FDregister(const H5FD_class_t *cls) { - hid_t ret_value; - H5FD_mem_t type; + H5FD_mem_t type; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "*x", cls); /* Check arguments */ if(!cls) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "null class pointer is disallowed") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null class pointer is disallowed") if(!cls->open || !cls->close) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`open' and/or `close' methods are not defined") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'open' and/or 'close' methods are not defined") if(!cls->get_eoa || !cls->set_eoa) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eoa' and/or `set_eoa' methods are not defined") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'get_eoa' and/or 'set_eoa' methods are not defined") if(!cls->get_eof) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eof' method is not defined") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'get_eof' method is not defined") if(!cls->read || !cls->write) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`read' and/or `write' method is not defined") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'read' and/or 'write' method is not defined") for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type)) if(cls->fl_map[type] < H5FD_MEM_NOLIST || cls->fl_map[type] >= H5FD_MEM_NTYPES) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid free-list mapping") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid free-list mapping") /* Create the new class ID */ if((ret_value = H5FD_register(cls, sizeof(H5FD_class_t), TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID") done: FUNC_LEAVE_API(ret_value) @@ -268,7 +266,7 @@ done: * library is closed or the driver is * unregistered. * - * Failure: A negative value. + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -276,34 +274,35 @@ hid_t H5FD_register(const void *_cls, size_t size, hbool_t app_ref) { const H5FD_class_t *cls = (const H5FD_class_t *)_cls; - H5FD_class_t *saved = NULL; - H5FD_mem_t type; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5FD_class_t *saved = NULL; + H5FD_mem_t type; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) - /* Check arguments */ + /* Sanity checks */ HDassert(cls); HDassert(cls->open && cls->close); HDassert(cls->get_eoa && cls->set_eoa); HDassert(cls->get_eof); HDassert(cls->read && cls->write); - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { HDassert(cls->fl_map[type] >= H5FD_MEM_NOLIST && cls->fl_map[type] < H5FD_MEM_NTYPES); + } /* Copy the class structure so the caller can reuse or free it */ if(NULL == (saved = (H5FD_class_t *)H5MM_malloc(size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for file driver class struct") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for file driver class struct") HDmemcpy(saved, cls, size); /* Create the new class ID */ if((ret_value = H5I_register(H5I_VFL, saved, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(saved) - H5MM_xfree(saved); + saved = (H5FD_class_t *)H5MM_xfree(saved); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_register() */ @@ -317,9 +316,7 @@ done: * this driver or files which are already opened under this * driver. * - * Return: Success: Non-negative - * - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -333,11 +330,11 @@ H5FDunregister(hid_t driver_id) /* Check arguments */ if(NULL == H5I_object_verify(driver_id, H5I_VFL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver") /* The H5FD_class_t struct will be freed by this function */ if(H5I_dec_app_ref(driver_id) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "unable to unregister file driver") + HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "unable to unregister file driver") done: FUNC_LEAVE_API(ret_value) @@ -345,19 +342,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_class + * Function: H5FD_get_class * - * Purpose: Obtains a pointer to the driver struct containing all the - * callback pointers, etc. The PLIST_ID argument can be a file - * access property list, a data transfer property list, or a - * file driver identifier. + * Purpose: Obtains a pointer to the driver struct containing all the + * callback pointers, etc. The PLIST_ID argument can be a file + * access property list, a data transfer property list, or a + * file driver identifier. * - * Return: Success: Ptr to the driver information. The pointer is - * only valid as long as the driver remains - * registered or some file or property list - * exists which references the driver. + * Return: Success: Ptr to the driver information. The pointer is + * only valid as long as the driver remains + * registered or some file or property list + * exists which references the driver. * - * Failure: NULL + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -369,7 +366,7 @@ H5FD_get_class(hid_t id) FUNC_ENTER_NOAPI(NULL) if(H5I_VFL == H5I_get_type(id)) - ret_value = (H5FD_class_t *)H5I_object(id); + ret_value = (H5FD_class_t *)H5I_object(id); else { H5P_genplist_t *plist; /* Property list pointer */ @@ -394,29 +391,32 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sb_size + * Function: H5FD_sb_size * - * Purpose: Obtains the number of bytes required to store the driver file - * access data in the HDF5 superblock. + * Purpose: Obtains the number of bytes required to store the driver file + * access data in the HDF5 superblock. * - * Return: Success: Number of bytes required. + * Return: Success: Number of bytes required. May be zero if the + * driver has no data to store in the superblock. * - * Failure: 0 if an error occurs or if the driver has no - * data to store in the superblock. + * Failure: This function cannot indicate errors. * *------------------------------------------------------------------------- */ hsize_t H5FD_sb_size(H5FD_t *file) { - hsize_t ret_value=0; + hsize_t ret_value = 0; FUNC_ENTER_NOAPI(0) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if(file->cls->sb_size) - ret_value = (file->cls->sb_size)(file); + ret_value = (file->cls->sb_size)(file); done: FUNC_LEAVE_NOAPI(ret_value) @@ -424,31 +424,33 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sb_encode + * Function: H5FD_sb_encode * - * Purpose: Encode driver-specific data into the output arguments. The - * NAME is a nine-byte buffer which should get an - * eight-character driver name and/or version followed by a null - * terminator. The BUF argument is a buffer to receive the - * encoded driver-specific data. The size of the BUF array is - * the size returned by the H5FD_sb_size() call. + * Purpose: Encode driver-specific data into the output arguments. The + * NAME is a nine-byte buffer which should get an + * eight-character driver name and/or version followed by a null + * terminator. The BUF argument is a buffer to receive the + * encoded driver-specific data. The size of the BUF array is + * the size returned by the H5FD_sb_size() call. * - * Return: Success: Non-negative - * - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); + + /* Dispatch to driver */ if(file->cls->sb_encode && (file->cls->sb_encode)(file, name/*out*/, buf/*out*/) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_encode request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_encode request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -456,12 +458,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD__sb_decode + * Function: H5FD__sb_decode * - * Purpose: Decodes the driver information block. + * Purpose: Decodes the driver information block. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -472,11 +473,13 @@ H5FD__sb_decode(H5FD_t *file, const char *name, const uint8_t *buf) FUNC_ENTER_STATIC - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); - /* Decode driver information */ + /* Dispatch to driver */ if(file->cls->sb_decode && (file->cls->sb_decode)(file, name, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_decode request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_decode request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -484,12 +487,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sb_load + * Function: H5FD_sb_load * - * Purpose: Validate and decode the driver information block. + * Purpose: Validate and decode the driver information block. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -500,7 +502,9 @@ H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf) FUNC_ENTER_NOAPI(FAIL) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); /* Check if driver matches driver information saved. Unfortunately, we can't push this * function to each specific driver because we're checking if the driver is correct. @@ -520,37 +524,41 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_fapl_get + * Function: H5FD_fapl_get + * + * Purpose: Gets the file access property list associated with a file. + * Usually the file will copy what it needs from the original + * file access property list when the file is created. The + * purpose of this function is to create a new file access + * property list based on the settings in the file, which may + * have been modified from the original file access property + * list. * - * Purpose: Gets the file access property list associated with a file. - * Usually the file will copy what it needs from the original - * file access property list when the file is created. The - * purpose of this function is to create a new file access - * property list based on the settings in the file, which may - * have been modified from the original file access property - * list. + * Return: Success: Pointer to a new file access property list + * with all members copied. If the file is + * closed then this property list lives on, and + * vice versa. * - * Return: Success: Pointer to a new file access property list - * with all members copied. If the file is - * closed then this property list lives on, and - * vice versa. + * This can be NULL if the file has no properties. * - * Failure: NULL, including when the file has no - * properties. + * Failure: This function cannot indicate errors. * *------------------------------------------------------------------------- */ void * H5FD_fapl_get(H5FD_t *file) { - void *ret_value=NULL; + void *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) + /* Sanity checks */ HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if(file->cls->fapl_get) - ret_value = (file->cls->fapl_get)(file); + ret_value = (file->cls->fapl_get)(file); done: FUNC_LEAVE_NOAPI(ret_value) @@ -558,12 +566,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_fapl_close + * Function: H5FD_fapl_close * - * Purpose: Closes a driver for a dataset transfer property list + * Purpose: Closes a driver for a dataset transfer property list * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -574,7 +581,6 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info) FUNC_ENTER_NOAPI(FAIL) - /* Check args */ if(driver_id > 0) { H5FD_class_t *driver; @@ -589,7 +595,7 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") } /* end if */ else - H5MM_xfree((void *)driver_info); /* Casting away const OK -QAK */ + driver_info = H5MM_xfree((void *)driver_info); /* Casting away const OK -QAK */ } /* end if */ } /* end if */ @@ -599,59 +605,59 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDopen + * Function: H5FDopen * - * Purpose: Opens a file named NAME for the type(s) of access described - * by the bit vector FLAGS according to a file access property - * list FAPL_ID (which may be the constant H5P_DEFAULT). The - * file should expect to handle format addresses in the range [0, - * MAXADDR] (if MAXADDR is the undefined address then the caller - * doesn't care about the address range). + * Purpose: Opens a file named NAME for the type(s) of access described + * by the bit vector FLAGS according to a file access property + * list FAPL_ID (which may be the constant H5P_DEFAULT). The + * file should expect to handle format addresses in the range [0, + * MAXADDR] (if MAXADDR is the undefined address then the caller + * doesn't care about the address range). * - * Possible values for the FLAGS bits are: + * Possible values for the FLAGS bits are: * - * H5F_ACC_RDWR: Open the file for read and write access. If - * this bit is not set then open the file for - * read only access. It is permissible to open a - * file for read and write access when only read - * access is requested by the library (the - * library will never attempt to write to a file - * which it opened with only read access). + * H5F_ACC_RDWR: Open the file for read and write access. If + * this bit is not set then open the file for + * read only access. It is permissible to open a + * file for read and write access when only read + * access is requested by the library (the + * library will never attempt to write to a file + * which it opened with only read access). * - * H5F_ACC_CREATE: Create the file if it doesn't already exist. - * However, see H5F_ACC_EXCL below. + * H5F_ACC_CREATE: Create the file if it doesn't already exist. + * However, see H5F_ACC_EXCL below. * - * H5F_ACC_TRUNC: Truncate the file if it already exists. This - * is equivalent to deleting the file and then - * creating a new empty file. + * H5F_ACC_TRUNC: Truncate the file if it already exists. This + * is equivalent to deleting the file and then + * creating a new empty file. * - * H5F_ACC_EXCL: When used with H5F_ACC_CREATE, if the file - * already exists then the open should fail. - * Note that this is unsupported/broken with - * some file drivers (e.g., sec2 across nfs) and - * will contain a race condition when used to - * perform file locking. + * H5F_ACC_EXCL: When used with H5F_ACC_CREATE, if the file + * already exists then the open should fail. + * Note that this is unsupported/broken with + * some file drivers (e.g., sec2 across nfs) and + * will contain a race condition when used to + * perform file locking. * - * The MAXADDR is the maximum address which will be requested by - * the library during an allocation operation. Usually this is - * the same value as the MAXADDR field of the class structure, - * but it can be smaller if the driver is being used under some - * other driver. + * The MAXADDR is the maximum address which will be requested by + * the library during an allocation operation. Usually this is + * the same value as the MAXADDR field of the class structure, + * but it can be smaller if the driver is being used under some + * other driver. * - * Note that when the driver `open' callback gets control that - * the public part of the file struct (the H5FD_t part) will be - * incomplete and will be filled in after that callback returns. + * Note that when the driver 'open' callback gets control that + * the public part of the file struct (the H5FD_t part) will be + * incomplete and will be filled in after that callback returns. * - * Return: Success: Pointer to a new file driver struct. + * Return: Success: Pointer to a new file driver struct. * - * Failure: NULL + * Failure: NULL * *------------------------------------------------------------------------- */ H5FD_t * H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - H5FD_t *ret_value=NULL; + H5FD_t *ret_value = NULL; FUNC_ENTER_API(NULL) H5TRACE4("*x", "*sIuia", name, flags, fapl_id, maxaddr); @@ -660,11 +666,12 @@ H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if(H5P_DEFAULT == fapl_id) fapl_id = H5P_FILE_ACCESS_DEFAULT; else - if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS)) + if(TRUE != H5P_isa_class(fapl_id,H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(NULL==(ret_value=H5FD_open(name, flags, fapl_id, maxaddr))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file") + /* Call private function */ + if(NULL == (ret_value = H5FD_open(name, flags, fapl_id, maxaddr))) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file") done: FUNC_LEAVE_API(ret_value) @@ -672,13 +679,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_open + * Function: H5FD_open * - * Purpose: Private version of H5FDopen() + * Purpose: Private version of H5FDopen() * - * Return: Success: Pointer to a new file driver struct + * Return: Success: Pointer to a new file driver struct * - * Failure: NULL + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -695,9 +702,9 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) FUNC_ENTER_NOAPI(NULL) - /* Sanity check */ + /* Sanity checks */ if(0 == maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range") /* Get file access property list */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) @@ -709,9 +716,9 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Get driver info */ if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_prop.driver_id))) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list") if(NULL == driver->open) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method") /* Query driver flag */ if(H5FD_driver_query(driver, &driver_flags) < 0) @@ -731,13 +738,12 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if(HADDR_UNDEF == maxaddr) maxaddr = driver->maxaddr; if(NULL == (file = (driver->open)(name, flags, fapl_id, maxaddr))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed") /* Set the file access flags */ file->access_flags = flags; - /* - * Fill in public fields. We must increment the reference count on the + /* Fill in public fields. We must increment the reference count on the * driver ID to prevent it from being freed while this file is open. */ file->driver_id = driver_prop.driver_id; @@ -751,7 +757,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment") /* Retrieve the VFL driver feature flags */ - if(H5FD_query(file, &(file->feature_flags)) < 0) + if(H5FD__query(file, &(file->feature_flags)) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver") /* Increment the global serial number & assign it to this H5FD_t object */ @@ -775,32 +781,35 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDclose + * Function: H5FDclose * - * Purpose: Closes the file by calling the driver `close' callback, which - * should free all driver-private data and free the file struct. - * Note that the public part of the file struct (the H5FD_t part) - * will be all zero during the driver close callback like during - * the `open' callback. + * Purpose: Closes the file by calling the driver 'close' callback, which + * should free all driver-private data and free the file struct. + * Note that the public part of the file struct (the H5FD_t part) + * will be all zero during the driver close callback like during + * the 'open' callback. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5FDclose(H5FD_t *file) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "*x", file); - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + /* Call private function */ if(H5FD_close(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") done: FUNC_LEAVE_API(ret_value) @@ -808,12 +817,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_close + * Function: H5FD_close * - * Purpose: Private version of H5FDclose() + * Purpose: Private version of H5FDclose() * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -825,16 +833,16 @@ H5FD_close(H5FD_t *file) FUNC_ENTER_NOAPI(FAIL) - /* check args */ - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); /* Prepare to close file by clearing all public fields */ driver = file->cls; if(H5I_dec_ref(file->driver_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID") - /* - * Dispatch to the driver for actual close. If the driver fails to + /* Dispatch to the driver for actual close. If the driver fails to * close the file then the file will be in an unusable state. */ HDassert(driver->close); @@ -847,47 +855,48 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDcmp + * Function: H5FDcmp * - * Purpose: Compare the keys of two files using the file driver callback - * if the files belong to the same driver, otherwise sort the - * files by driver class pointer value. + * Purpose: Compare the keys of two files using the file driver callback + * if the files belong to the same driver, otherwise sort the + * files by driver class pointer value. * - * Return: Success: A value like strcmp() + * Return: Success: A value like strcmp() * - * Failure: Must never fail. If both file handles are - * invalid then they compare equal. If one file - * handle is invalid then it compares less than - * the other. If both files belong to the same - * driver and the driver doesn't provide a - * comparison callback then the file pointers - * themselves are compared. + * Failure: Must never fail. If both file handles are + * invalid then they compare equal. If one file + * handle is invalid then it compares less than + * the other. If both files belong to the same + * driver and the driver doesn't provide a + * comparison callback then the file pointers + * themselves are compared. * *------------------------------------------------------------------------- */ int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2) { - int ret_value; + int ret_value = -1; - FUNC_ENTER_API(-1) /*return value is arbitrary*/ + FUNC_ENTER_API(-1) /* return value is arbitrary */ H5TRACE2("Is", "*x*x", f1, f2); + /* Call private function */ ret_value = H5FD_cmp(f1, f2); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5FDcmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_cmp + * Function: H5FD_cmp * - * Purpose: Private version of H5FDcmp() + * Purpose: Private version of H5FDcmp() * - * Return: Success: A value like strcmp() + * Return: Success: A value like strcmp() * - * Failure: Must never fail. + * Failure: Must never fail. * *------------------------------------------------------------------------- */ @@ -896,7 +905,7 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2) { int ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI(-1) /*return value is arbitrary*/ + FUNC_ENTER_NOAPI(-1) /* return value is arbitrary */ if((!f1 || !f1->cls) && (!f2 || !f2->cls)) HGOTO_DONE(0) @@ -911,43 +920,50 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2) /* Files are same driver; no cmp callback */ if(!f1->cls->cmp) { - if(f1<f2) + if(f1 < f2) HGOTO_DONE(-1) - if(f1>f2) + if(f1 > f2) HGOTO_DONE(1) - HGOTO_DONE(0) + HGOTO_DONE(0) } + /* Dispatch to driver */ ret_value = (f1->cls->cmp)(f1, f2); done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FDquery - * - * Purpose: Query a VFL driver for its feature flags. (listed in H5FDpublic.h) + * Function: H5FDquery * - * Return: Success: non-negative + * Purpose: Query a VFL driver for its feature flags. (listed in H5FDpublic.h) * - * Failure: negative + * Return: Success: 0 + * Failure: -1 * *------------------------------------------------------------------------- */ int -H5FDquery(const H5FD_t *f, unsigned long *flags/*out*/) +H5FDquery(const H5FD_t *file, unsigned long *flags/*out*/) { - int ret_value; + int ret_value = 0; - FUNC_ENTER_API(FAIL) - H5TRACE2("Is", "*xx", f, flags); + FUNC_ENTER_API((-1)) + H5TRACE2("Is", "*xx", file, flags); - HDassert(f); - HDassert(flags); + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "file class pointer cannot be NULL") + if(!flags) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "flags parameter cannot be NULL") - ret_value = H5FD_query(f, flags); + /* Call private function */ + if(H5FD__query(file, flags) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "unable to query feature flags") done: FUNC_LEAVE_API(ret_value) @@ -955,69 +971,72 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_query - * - * Purpose: Private version of H5FDquery() + * Function: H5FD_query * - * Return: Success: non-negative + * Purpose: Private version of H5FDquery() * - * Failure: negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int -H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/) +static herr_t +H5FD__query(const H5FD_t *file, unsigned long *flags/*out*/) { - int ret_value = 0; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC - HDassert(f); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); HDassert(flags); - /* Check for query driver and call it */ - if(f->cls->query) - ret_value = (f->cls->query)(f, flags); + /* Dispatch to driver (if available) */ + if(file->cls->query) { + if((file->cls->query)(file, flags) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to query feature flags") + } else *flags=0; +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_query() */ /*------------------------------------------------------------------------- - * Function: H5FDalloc + * Function: H5FDalloc * - * Purpose: Allocates SIZE bytes of memory from the FILE. The memory will - * be used according to the allocation class TYPE. First we try - * to satisfy the request from one of the free lists, according - * to the free list map provided by the driver. The free list - * array has one entry for each request type and the value of - * that array element can be one of four possibilities: + * Purpose: Allocates SIZE bytes of memory from the FILE. The memory will + * be used according to the allocation class TYPE. First we try + * to satisfy the request from one of the free lists, according + * to the free list map provided by the driver. The free list + * array has one entry for each request type and the value of + * that array element can be one of four possibilities: * - * It can be the constant H5FD_MEM_DEFAULT (or zero) which - * indicates that the identity mapping is used. In other - * words, the request type maps to its own free list. + * It can be the constant H5FD_MEM_DEFAULT (or zero) which + * indicates that the identity mapping is used. In other + * words, the request type maps to its own free list. * - * It can be the request type itself, which has the same - * effect as the H5FD_MEM_DEFAULT value above. + * It can be the request type itself, which has the same + * effect as the H5FD_MEM_DEFAULT value above. * - * It can be the ID for another request type, which - * indicates that the free list for the specified type - * should be used instead. + * It can be the ID for another request type, which + * indicates that the free list for the specified type + * should be used instead. * - * It can be the constant H5FD_MEM_NOLIST which means that - * no free list should be used for this type of request. + * It can be the constant H5FD_MEM_NOLIST which means that + * no free list should be used for this type of request. * - * If the request cannot be satisfied from a free list then - * either the driver's `alloc' callback is invoked (if one was - * supplied) or the end-of-address marker is extended. The - * `alloc' callback is always called with the same arguments as - * the H5FDalloc(). + * If the request cannot be satisfied from a free list then + * either the driver's 'alloc' callback is invoked (if one was + * supplied) or the end-of-address marker is extended. The + * 'alloc' callback is always called with the same arguments as + * the H5FDalloc(). * - * Return: Success: The format address of the new file memory. + * Return: Success: The format address of the new file memory. * - * Failure: The undefined address HADDR_UNDEF + * Failure: The undefined address HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -1029,13 +1048,15 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) FUNC_ENTER_API(HADDR_UNDEF) H5TRACE4("a", "*xMtih", file, type, dxpl_id, size); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL") if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type") if(size == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request") if(H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else @@ -1045,9 +1066,9 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Do the real work */ + /* Call private function */ if(HADDR_UNDEF == (ret_value = H5FD__alloc_real(file, type, size, NULL, NULL))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file memory") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file memory") /* (Note compensating for base address subtraction in internal routine) */ ret_value += file->base_addr; @@ -1058,32 +1079,32 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDfree + * Function: H5FDfree * - * Purpose: Frees format addresses starting with ADDR and continuing for - * SIZE bytes in the file FILE. The type of space being freed is - * specified by TYPE, which is mapped to a free list as - * described for the H5FDalloc() function above. If the request - * doesn't map to a free list then either the application `free' - * callback is invoked (if defined) or the memory is leaked. - * - * Return: Success: Non-negative + * Purpose: Frees format addresses starting with ADDR and continuing for + * SIZE bytes in the file FILE. The type of space being freed is + * specified by TYPE, which is mapped to a free list as + * described for the H5FDalloc() function above. If the request + * doesn't map to a free list then either the application 'free' + * callback is invoked (if defined) or the memory is leaked. * - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "*xMtiah", file, type, dxpl_id, addr, size); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type") if(H5P_DEFAULT == dxpl_id) @@ -1095,9 +1116,9 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Do the real work */ + /* Call private function */ /* (Note compensating for base address addition in internal routine) */ - if(H5FD_free_real(file, type, addr - file->base_addr, size) < 0) + if(H5FD__free_real(file, type, addr - file->base_addr, size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "file deallocation request failed") done: @@ -1124,13 +1145,15 @@ H5FDget_eoa(H5FD_t *file, H5FD_mem_t type) FUNC_ENTER_API(HADDR_UNDEF) H5TRACE2("a", "*xMt", file, type); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL") if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file type") - /* The real work */ + /* Call private function */ if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(file, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eoa request failed") @@ -1171,15 +1194,17 @@ H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr) FUNC_ENTER_API(FAIL) H5TRACE3("e", "*xMta", file, type, addr); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file type") if(!H5F_addr_defined(addr) || addr > file->maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid end-of-address value") - /* The real work */ + /* Call private function */ /* (Note compensating for base address addition in internal routine) */ if(H5FD_set_eoa(file, type, addr - file->base_addr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file set eoa request failed") @@ -1190,23 +1215,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDget_eof + * Function: H5FDget_eof * - * Purpose: Returns the end-of-file address, which is the greater of the - * end-of-format address and the actual EOF marker. This - * function is called after an existing file is opened in order - * for the library to learn the true size of the underlying file - * and to determine whether the hdf5 data has been truncated. + * Purpose: Returns the end-of-file address, which is the greater of the + * end-of-format address and the actual EOF marker. This + * function is called after an existing file is opened in order + * for the library to learn the true size of the underlying file + * and to determine whether the hdf5 data has been truncated. * - * It is also used when a file is first opened to learn whether - * the file is empty or not. + * It is also used when a file is first opened to learn whether + * the file is empty or not. * - * It is permissible for the driver to return the maximum address - * for the file size if the file is not empty. + * It is permissible for the driver to return the maximum address + * for the file size if the file is not empty. * - * Return: Success: The EOF address. + * Return: Success: The EOF address. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -1219,10 +1244,12 @@ H5FDget_eof(H5FD_t *file, H5FD_mem_t type) H5TRACE2("a", "*xMt", file, type); /* Check arguments */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer") + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL") - /* The real work */ + /* Call private function */ if(HADDR_UNDEF == (ret_value = H5FD_get_eof(file, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eof request failed") @@ -1235,12 +1262,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_maxaddr + * Function: H5FD_get_maxaddr * - * Purpose: Private version of H5FDget_eof() + * Purpose: Private version of H5FDget_eof() * - * Return: Success: The maximum address allowed in the file. - * Failure: HADDR_UNDEF + * Return: Success: The maximum address allowed in the file. + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -1251,6 +1278,7 @@ H5FD_get_maxaddr(const H5FD_t *file) FUNC_ENTER_NOAPI(HADDR_UNDEF) + /* Sanity checks */ HDassert(file); /* Set return value */ @@ -1262,12 +1290,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_feature_flags + * Function: H5FD_get_feature_flags * - * Purpose: Retrieve the feature flags for the VFD + * Purpose: Retrieve the feature flags for the VFD * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1276,6 +1303,7 @@ H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); HDassert(feature_flags); @@ -1287,12 +1315,11 @@ H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags) /*------------------------------------------------------------------------- - * Function: H5FD_set_feature_flags + * Function: H5FD_set_feature_flags * - * Purpose: Set the feature flags for the VFD + * Purpose: Set the feature flags for the VFD * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1301,6 +1328,7 @@ H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); /* Set the file's feature flags */ @@ -1311,12 +1339,11 @@ H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags) /*------------------------------------------------------------------------- - * Function: H5FD_get_fs_type_map + * Function: H5FD_get_fs_type_map * - * Purpose: Retrieve the free space type mapping for the VFD + * Purpose: Retrieve the free space type mapping for the VFD * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1327,8 +1354,9 @@ H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map) FUNC_ENTER_NOAPI(FAIL) - /* Sanity check */ - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); HDassert(type_map); /* Check for VFD class providing a type map retrieval rouine */ @@ -1347,18 +1375,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDread + * Function: H5FDread * - * Purpose: Reads SIZE bytes from FILE beginning at address ADDR - * according to the data transfer property list DXPL_ID (which may - * be the constant H5P_DEFAULT). The result is written into the - * buffer BUF. + * Purpose: Reads SIZE bytes from FILE beginning at address ADDR + * according to the data transfer property list DXPL_ID (which may + * be the constant H5P_DEFAULT). The result is written into the + * buffer BUF. * - * Return: Success: Non-negative. The read result is written into - * the BUF buffer which should be allocated by - * the caller. + * Return: Success: SUCCEED + * The read result is written into the BUF buffer + * which should be allocated by the caller. * - * Failure: Negative. The contents of BUF is undefined. + * Failure: FAIL + * The contents of BUF are undefined. * *------------------------------------------------------------------------- */ @@ -1366,14 +1395,18 @@ herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "*xMtiazx", file, type, dxpl_id, addr, size, buf); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + if(!buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "result buffer parameter can't be NULL") /* Get the default dataset transfer property list if the user didn't provide one */ if(H5P_DEFAULT == dxpl_id) @@ -1381,16 +1414,14 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size else if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") - if(!buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null result buffer") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Do the real work */ + /* Call private function */ /* (Note compensating for base address addition in internal routine) */ if(H5FD_read(file, type, addr - file->base_addr, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed") done: FUNC_LEAVE_API(ret_value) @@ -1398,16 +1429,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDwrite + * Function: H5FDwrite * - * Purpose: Writes SIZE bytes to FILE beginning at address ADDR according - * to the data transfer property list DXPL_ID (which may be the - * constant H5P_DEFAULT). The bytes to be written come from the - * buffer BUF. - * - * Return: Success: Non-negative + * Purpose: Writes SIZE bytes to FILE beginning at address ADDR according + * to the data transfer property list DXPL_ID (which may be the + * constant H5P_DEFAULT). The bytes to be written come from the + * buffer BUF. * - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1415,30 +1444,33 @@ herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "*xMtiaz*x", file, type, dxpl_id, addr, size, buf); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + if(!buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "result buffer parameter can't be NULL") + /* Get the default dataset transfer property list if the user didn't provide one */ if(H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") - if(!buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null buffer") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* The real work */ + /* Call private function */ /* (Note compensating for base address addition in internal routine) */ if(H5FD_write(file, type, addr - file->base_addr, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed") done: FUNC_LEAVE_API(ret_value) @@ -1446,17 +1478,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDflush - * - * Purpose: Notify driver to flush all cached data. If the driver has no - * flush method then nothing happens. - * - * Return: Success: Non-negative + * Function: H5FDflush * - * Failure: Negative + * Purpose: Notify driver to flush all cached data. If the driver has no + * flush method then nothing happens. * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1468,9 +1495,12 @@ H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing) FUNC_ENTER_API(FAIL) H5TRACE3("e", "*xib", file, dxpl_id, closing); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + if(H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else @@ -1480,9 +1510,9 @@ H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing) /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Do the real work */ + /* Call private function */ if(H5FD_flush(file, closing) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "file flush request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "file flush request failed") done: FUNC_LEAVE_API(ret_value) @@ -1490,12 +1520,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_flush + * Function: H5FD_flush * - * Purpose: Private version of H5FDflush() + * Purpose: Private version of H5FDflush() * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1507,8 +1536,10 @@ H5FD_flush(H5FD_t *file, hbool_t closing) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file && file->cls); + HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if(file->cls->flush && (file->cls->flush)(file, H5CX_get_dxpl(), closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver flush request failed") @@ -1518,12 +1549,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDtruncate + * Function: H5FDtruncate * - * Purpose: Notify driver to truncate the file back to the allocated size. + * Purpose: Notify driver to truncate the file back to the allocated size. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1535,9 +1565,11 @@ H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing) FUNC_ENTER_API(FAIL) H5TRACE3("e", "*xib", file, dxpl_id, closing); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") if(H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else @@ -1547,9 +1579,9 @@ H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing) /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Do the real work */ + /* Call private function */ if(H5FD_truncate(file, closing) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "file flush request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "file flush request failed") done: FUNC_LEAVE_API(ret_value) @@ -1559,22 +1591,22 @@ done: /*------------------------------------------------------------------------- * Function: H5FD_truncate * - * Purpose: Private version of H5FDtruncate() + * Purpose: Private version of H5FDtruncate() * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5FD_truncate(H5FD_t *file, hbool_t closing) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file && file->cls); + HDassert(file); + HDassert(file->cls); /* Dispatch to driver */ if(file->cls->truncate && (file->cls->truncate)(file, H5CX_get_dxpl(), closing) < 0) @@ -1586,12 +1618,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDlock + * Function: H5FDlock * - * Purpose: Set a file lock + * Purpose: Set a file lock * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1603,13 +1634,15 @@ H5FDlock(H5FD_t *file, hbool_t rw) FUNC_ENTER_API(FAIL) H5TRACE2("e", "*xb", file, rw); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") - /* The real work */ + /* Call private function */ if(H5FD_lock(file, rw) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file lock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file lock request failed") done: FUNC_LEAVE_API(ret_value) @@ -1618,12 +1651,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_lock + * Function: H5FD_lock * - * Purpose: Private version of H5FDlock() + * Purpose: Private version of H5FDlock() * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1634,8 +1666,11 @@ H5FD_lock(H5FD_t *file, hbool_t rw) FUNC_ENTER_NOAPI(FAIL) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if(file->cls->lock && (file->cls->lock)(file, rw) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver lock request failed") @@ -1645,12 +1680,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDunlock + * Function: H5FDunlock * - * Purpose: Remove a file lock + * Purpose: Remove a file lock * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1662,13 +1696,15 @@ H5FDunlock(H5FD_t *file) FUNC_ENTER_API(FAIL) H5TRACE1("e", "*x", file); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") - /* The real work */ + /* Call private function */ if(H5FD_unlock(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file unlock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file unlock request failed") done: FUNC_LEAVE_API(ret_value) @@ -1676,12 +1712,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_unlock + * Function: H5FD_unlock * - * Purpose: Private version of H5FDunlock() + * Purpose: Private version of H5FDunlock() * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1692,8 +1727,11 @@ H5FD_unlock(H5FD_t *file) FUNC_ENTER_NOAPI(FAIL) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if(file->cls->unlock && (file->cls->unlock)(file) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver unlock request failed") @@ -1703,13 +1741,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_fileno + * Function: H5FD_get_fileno * - * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value - * (Mainly added to stop non-file routines from poking about in the - * H5FD_t data structure) + * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value + * (Mainly added to stop non-file routines from poking about in the + * H5FD_t data structure) * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1718,6 +1756,7 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); HDassert(filenum); @@ -1734,28 +1773,36 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum) * Purpose: Returns a pointer to the file handle of low-level virtual * file driver. * - * Return: Non-negative if succeed; negative otherwise. - * - * Programmer: Raymond Lu - * Sep. 16, 2002 + * Return: SUCCEED/FAIL * *-------------------------------------------------------------------------- */ herr_t -H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle) +H5FDget_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle) { - herr_t ret_value; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE3("e", "*xi**x", file, fapl, file_handle); + H5TRACE3("e", "*xi**x", file, fapl_id, file_handle); /* Check arguments */ - HDassert(file); - HDassert(file_handle); - - ret_value = H5FD_get_vfd_handle(file, fapl, file_handle); + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + if(FALSE == H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fapl_id parameter is not a file access property list") + if(!file_handle) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle parameter cannot be NULL") + + /* Call private function */ + if(H5FD_get_vfd_handle(file, fapl_id, file_handle) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver") done: + if(FAIL == ret_value) + *file_handle = NULL; + FUNC_LEAVE_API(ret_value) } /* end H5FDget_vfd_handle() */ @@ -1763,29 +1810,28 @@ done: /*-------------------------------------------------------------------------- * Function: H5FD_get_vfd_handle * - * Purpose: Retrieve the file handle for file driver. + * Purpose: Private version of H5FDget_vfd_handle() * - * Return: Non-negative if succeed; negative if fails. - * - * Programmer: Raymond Lu - * Sep. 16, 2002 + * Return: SUCCEED/FAIL * *-------------------------------------------------------------------------- */ herr_t -H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle) +H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - /* Sanity check */ + /* Sanity checks */ HDassert(file); + HDassert(file->cls); HDassert(file_handle); + /* Dispatch to driver */ if(NULL == file->cls->get_handle) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no `get_vfd_handle' method") - if((file->cls->get_handle)(file, fapl, file_handle) < 0) + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no `get_vfd_handle' method") + if((file->cls->get_handle)(file, fapl_id, file_handle) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver") done: @@ -1798,7 +1844,7 @@ done: * * Purpose: Set the base address for the file * - * Return: Non-negative if succeed; negative if fails. + * Return: SUCCEED (Can't fail) * *-------------------------------------------------------------------------- */ @@ -1807,6 +1853,7 @@ H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); HDassert(H5F_addr_defined(base_addr)); @@ -1822,8 +1869,8 @@ H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr) * * Purpose: Get the base address for the file * - * Return: Success: The absolute base address of the file - * Failure: The undefined address (HADDR_UNDEF) + * Return: Success: The absolute base address of the file + * (Can't fail) * *-------------------------------------------------------------------------- */ @@ -1832,6 +1879,7 @@ H5FD_get_base_addr(const H5FD_t *file) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); /* Return the file's base address */ @@ -1844,7 +1892,7 @@ H5FD_get_base_addr(const H5FD_t *file) * * Purpose: Set "paged_aggr" for the file. * - * Return: Non-negative if succeed; negative if fails. + * Return: SUCCEED (Can't fail) * *-------------------------------------------------------------------------- */ @@ -1853,6 +1901,7 @@ H5FD_set_paged_aggr(H5FD_t *file, hbool_t paged) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); /* Indicate whether paged aggregation for handling file space is enabled or not */ @@ -1883,6 +1932,7 @@ H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/) FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", driver_id, flags); + /* Check arguments */ if(NULL == flags) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "flags parameter cannot be NULL") diff --git a/src/H5FDint.c b/src/H5FDint.c index 023ff57..ea8c4d8 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FDint.c - * Jan 17 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5FDint.c * - * Purpose: Internal routine for VFD operations + * Purpose: Internal routine for VFD operations * *------------------------------------------------------------------------- */ @@ -32,12 +30,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDpkg.h" /* File Drivers */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDpkg.h" /* File Drivers */ +#include "H5Iprivate.h" /* IDs */ /****************/ @@ -83,26 +81,26 @@ * signature can appear at address 0, or any power of two * beginning with 512. * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Robb Matzke - * Friday, November 7, 1997 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr) { - haddr_t addr, eoa, eof; + haddr_t addr = HADDR_UNDEF; + haddr_t eoa = HADDR_UNDEF; + haddr_t eof = HADDR_UNDEF; uint8_t buf[H5F_SIGNATURE_LEN]; - unsigned n, maxpow; + unsigned n; + unsigned maxpow; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Sanity checks */ HDassert(file); + HDassert(sig_addr); /* Find the least N such that 2^N is larger than the file size */ eof = H5FD_get_eof(file, H5FD_MEM_SUPER); @@ -114,8 +112,7 @@ H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr) addr >>= 1; maxpow = MAX(maxpow, 9); - /* - * Search for the file signature at format address zero followed by + /* Search for the file signature at format address zero followed by * powers of two larger than 9. */ for(n = 8; n < maxpow; n++) { @@ -126,17 +123,16 @@ H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to read file signature") if(!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) break; - } /* end for */ + } - /* - * If the signature was not found then reset the EOA value and return + /* If the signature was not found then reset the EOA value and return * HADDR_UNDEF. */ if(n >= maxpow) { if(H5FD_set_eoa(file, H5FD_MEM_SUPER, eoa) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to reset EOA value") *sig_addr = HADDR_UNDEF; - } /* end if */ + } else /* Set return value */ *sig_addr = addr; @@ -147,44 +143,41 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_read - * - * Purpose: Private version of H5FDread() + * Function: H5FD_read * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Private version of H5FDread() * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, - void *buf/*out*/) +H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) { - hid_t dxpl_id; /* DXPL for operation */ - herr_t ret_value = SUCCEED; /* Return value */ + hid_t dxpl_id = H5I_INVALID_HID; /* DXPL for operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file && file->cls); + HDassert(file); + HDassert(file->cls); HDassert(buf); /* Get proper DXPL for I/O */ dxpl_id = H5CX_get_dxpl(); #ifndef H5_HAVE_PARALLEL - /* Do not return early for Parallel mode since the I/O could be a */ - /* collective transfer. */ - /* The no-op case */ + /* The no-op case + * + * Do not return early for Parallel mode since the I/O could be a + * collective transfer. + */ if(0 == size) HGOTO_DONE(SUCCEED) #endif /* H5_HAVE_PARALLEL */ - /* - * If the file is open for SWMR read access, allow access to data past + /* If the file is open for SWMR read access, allow access to data past * the end of the allocated space (the 'eoa'). This is done because the * eoa stored in the file's superblock might be out of sync with the * objects being written within the file by the application performing @@ -198,7 +191,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, if((addr + file->base_addr + size) > eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu, eoa = %llu", (unsigned long long)(addr + file->base_addr), (unsigned long long)size, (unsigned long long)eoa) - } /* end if */ + } /* Dispatch to driver */ if((file->cls->read)(file, type, dxpl_id, addr + file->base_addr, size, buf) < 0) @@ -210,45 +203,43 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_write - * - * Purpose: Private version of H5FDwrite() + * Function: H5FD_write * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Private version of H5FDwrite() * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, - const void *buf) +H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { - hid_t dxpl_id; /* DXPL for operation */ - haddr_t eoa = HADDR_UNDEF; /* EOA for file */ - herr_t ret_value = SUCCEED; /* Return value */ + hid_t dxpl_id; /* DXPL for operation */ + haddr_t eoa = HADDR_UNDEF; /* EOA for file */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file && file->cls); + HDassert(file); + HDassert(file->cls); HDassert(buf); /* Get proper DXPL for I/O */ dxpl_id = H5CX_get_dxpl(); #ifndef H5_HAVE_PARALLEL - /* Do not return early for Parallel mode since the I/O could be a */ - /* collective transfer. */ - /* The no-op case */ + /* The no-op case + * + * Do not return early for Parallel mode since the I/O could be a + * collective transfer. + */ if(0 == size) HGOTO_DONE(SUCCEED) #endif /* H5_HAVE_PARALLEL */ if(HADDR_UNDEF == (eoa = (file->cls->get_eoa)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed") if((addr + file->base_addr + size) > eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size=%llu, eoa=%llu", (unsigned long long)(addr+ file->base_addr), (unsigned long long)size, (unsigned long long)eoa) @@ -263,20 +254,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_set_eoa + * Function: H5FD_set_eoa * - * Purpose: Private version of H5FDset_eoa() + * Purpose: Private version of H5FDset_eoa() * * This function expects the EOA is a RELATIVE address, i.e. * relative to the base address. This is NOT the same as the * EOA stored in the superblock, which is an absolute * address. Object addresses are relative. * - * Return: Success: Non-negative - * Failure: Negative, no side effect - * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -292,7 +279,7 @@ H5FD_set_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr) /* Dispatch to driver, convert to absolute address */ if((file->cls->set_eoa)(file, type, addr + file->base_addr) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver set_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver set_eoa request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -300,20 +287,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_eoa + * Function: H5FD_get_eoa * - * Purpose: Private version of H5FDget_eoa() + * Purpose: Private version of H5FDget_eoa() * * This function returns the EOA as a RELATIVE address, i.e. * relative to the base address. This is NOT the same as the * EOA stored in the superblock, which is an absolute * address. Object addresses are relative. * - * Return: Success: First byte after allocated memory. - * Failure: HADDR_UNDEF + * Return: Success: First byte after allocated memory * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -328,7 +313,7 @@ H5FD_get_eoa(const H5FD_t *file, H5FD_mem_t type) /* Dispatch to driver */ if(HADDR_UNDEF == (ret_value = (file->cls->get_eoa)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") /* Adjust for base address in file (convert to relative address) */ ret_value -= file->base_addr; @@ -339,23 +324,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_eof + * Function: H5FD_get_eof * - * Purpose: Private version of H5FDget_eof() + * Purpose: Private version of H5FDget_eof() * * This function returns the EOF as a RELATIVE address, i.e. * relative to the base address. This will be different * from the end of the physical file if there is a user * block. * - * Return: Success: The EOF address. + * Return: Success: The EOF address. * - * Failure: HADDR_UNDEF - * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * - * Modifications: + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -370,11 +350,11 @@ H5FD_get_eof(const H5FD_t *file, H5FD_mem_t type) /* Dispatch to driver */ if(file->cls->get_eof) { - if(HADDR_UNDEF == (ret_value = (file->cls->get_eof)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "driver get_eof request failed") - } /* end if */ + if(HADDR_UNDEF == (ret_value = (file->cls->get_eof)(file, type))) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "driver get_eof request failed") + } else - ret_value = file->maxaddr; + ret_value = file->maxaddr; /* Adjust for base address in file (convert to relative address) */ ret_value -= file->base_addr; @@ -385,17 +365,14 @@ done: /*------------------------------------------------------------------------- -* Function: H5FD_driver_query -* -* Purpose: Similar to H5FD_query(), but intended for cases when we don't -* have a file available (e.g. before one is opened). Since we -* can't use the file to get the driver, the driver is passed in -* as a parameter. +* Function: H5FD_driver_query * -* Return: SUCCEED/FAIL +* Purpose: Similar to H5FD_query(), but intended for cases when we don't +* have a file available (e.g. before one is opened). Since we +* can't use the file to get the driver, the driver is passed in +* as a parameter. * -* Programmer: Jacob Gruber -* Wednesday, August 17, 2011 +* Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 7c2297a..3dcd7f5 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -117,7 +117,7 @@ typedef struct H5FD_log_t { * Whether to eliminate the family driver info and convert this file to * a single file */ - hbool_t fam_to_sec2; + hbool_t fam_to_single; /* Fields for tracking I/O operations */ unsigned char *nread; /* Number of reads from a file location */ @@ -635,13 +635,13 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Check for non-default FAPL */ if(H5P_FILE_ACCESS_DEFAULT != fapl_id) { /* This step is for h5repart tool only. If user wants to change file driver from - * family to sec2 while using h5repart, this private property should be set so that - * in the later step, the library can ignore the family driver information saved - * in the superblock. + * family to one that uses single files (sec2, etc.) while using h5repart, this + * private property should be set so that in the later step, the library can ignore + * the family driver information saved in the superblock. */ - if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SEC2_NAME) > 0) - if(H5P_get(plist, H5F_ACS_FAMILY_TO_SEC2_NAME, &file->fam_to_sec2) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to sec2") + if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME) > 0) + if(H5P_get(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME, &file->fam_to_single) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to single") } /* end if */ /* Set return value */ @@ -900,7 +900,7 @@ H5FD_log_query(const H5FD_t *_file, unsigned long *flags /* out */) *flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default VFD */ /* Check for flags that are set by h5repart */ - if(file && file->fam_to_sec2) + if(file && file->fam_to_single) *flags |= H5FD_FEAT_IGNORE_DRVRINFO; /* Ignore the driver info when file is opened (which eliminates it) */ } /* end if */ diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c index 4b42a73..7d58b7a 100644 --- a/src/H5FDmpi.c +++ b/src/H5FDmpi.c @@ -153,7 +153,7 @@ done: * * Return: Success: SUCCEED * - * Failure: Negative + * Failure: FAIL * * Programmer: John Mainzer * 4/4/17 diff --git a/src/H5FDpkg.h b/src/H5FDpkg.h index 6f47efb..22b5d17 100644 --- a/src/H5FDpkg.h +++ b/src/H5FDpkg.h @@ -30,7 +30,6 @@ #include "H5FDprivate.h" /* File drivers */ /* Other private headers needed by this file */ -#include "H5FLprivate.h" /* Free lists */ /**************************/ /* Package Private Macros */ @@ -50,14 +49,12 @@ /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL haddr_t H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, - haddr_t *align_addr, hsize_t *align_size); -H5_DLL herr_t H5FD_free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, - hsize_t size); +H5_DLL haddr_t H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *align_addr, hsize_t *align_size); +H5_DLL herr_t H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size); /* Testing functions */ #ifdef H5FD_TESTING -H5_DLL hbool_t H5FD_supports_swmr_test(const char *vfd_name); +H5_DLL hbool_t H5FD__supports_swmr_test(const char *vfd_name); #endif /* H5FD_TESTING */ #endif /* _H5FDpkg_H */ diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 0430064..c79d676 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -130,7 +130,7 @@ H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id, H5_DLL herr_t H5FD_close(H5FD_t *file); H5_DLL int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2); H5_DLL herr_t H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/); -H5_DLL haddr_t H5FD_alloc(H5FD_t *file, H5FD_mem_t type, +H5_DLL haddr_t H5FD_alloc(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size); H5_DLL herr_t H5FD_free(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f, haddr_t addr, hsize_t size); @@ -143,10 +143,8 @@ H5_DLL haddr_t H5FD_get_maxaddr(const H5FD_t *file); H5_DLL herr_t H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags); H5_DLL herr_t H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags); H5_DLL herr_t H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map); -H5_DLL herr_t H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, - size_t size, void *buf/*out*/); -H5_DLL herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, - size_t size, const void *buf); +H5_DLL herr_t H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); +H5_DLL herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5FD_flush(H5FD_t *file, hbool_t closing); H5_DLL herr_t H5FD_truncate(H5FD_t *file, hbool_t closing); H5_DLL herr_t H5FD_lock(H5FD_t *file, hbool_t rw); diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 32aff0f..06c008d 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -94,7 +94,7 @@ typedef struct H5FD_sec2_t { * Whether to eliminate the family driver info and convert this file to * a single file. */ - hbool_t fam_to_sec2; + hbool_t fam_to_single; } H5FD_sec2_t; @@ -386,13 +386,13 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, NULL, "not a file access property list") /* This step is for h5repart tool only. If user wants to change file driver from - * family to sec2 while using h5repart, this private property should be set so that - * in the later step, the library can ignore the family driver information saved - * in the superblock. + * family to one that uses single files (sec2, etc.) while using h5repart, this + * private property should be set so that in the later step, the library can ignore + * the family driver information saved in the superblock. */ - if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SEC2_NAME) > 0) - if(H5P_get(plist, H5F_ACS_FAMILY_TO_SEC2_NAME, &file->fam_to_sec2) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to sec2") + if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME) > 0) + if(H5P_get(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME, &file->fam_to_single) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to single") } /* end if */ /* Set return value */ @@ -532,7 +532,7 @@ H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */) *flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default VFD */ /* Check for flags that are set by h5repart */ - if(file && file->fam_to_sec2) + if(file && file->fam_to_single) *flags |= H5FD_FEAT_IGNORE_DRVRINFO; /* Ignore the driver info when file is opened (which eliminates it) */ } /* end if */ diff --git a/src/H5FDspace.c b/src/H5FDspace.c index e158a44..e1f0cb2 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -38,6 +38,7 @@ #include "H5Fprivate.h" /* File access */ #include "H5FDpkg.h" /* File Drivers */ #include "H5FDmulti.h" /* Usage-partitioned file family */ +#include "H5FLprivate.h" /* Free lists */ /****************/ @@ -273,7 +274,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_free_real + * Function: H5FD__free_real * * Purpose: Release space back to the VFD * @@ -286,11 +287,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FD_free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) +H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check args */ HDassert(file); @@ -348,13 +349,13 @@ HDfprintf(stderr, "%s: LEAKED MEMORY!!! type = %u, addr = %a, size = %Hu\n", FUN done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_free_real() */ +} /* end H5FD__free_real() */ /*------------------------------------------------------------------------- * Function: H5FD_free * - * Purpose: Wrapper for H5FD_free_real, to make certain EOA changes are + * Purpose: Wrapper for H5FD__free_real, to make certain EOA changes are * reflected in superblock. * * Note: When the metadata cache routines are updated to allow @@ -383,7 +384,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t addr, hsize_t size) HDassert(size > 0); /* Call the real 'free' routine */ - if(H5FD_free_real(file, type, addr, size) < 0) + if(H5FD__free_real(file, type, addr, size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "real 'free' request failed") /* Mark EOA info dirty in cache, so change will get encoded */ @@ -414,8 +415,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t blk_end, - hsize_t extra_requested) +H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t blk_end, hsize_t extra_requested) { haddr_t eoa; /* End of allocated space in file */ htri_t ret_value = FALSE; /* Return value */ diff --git a/src/H5FDtest.c b/src/H5FDtest.c index f528dfb..dec0818 100644 --- a/src/H5FDtest.c +++ b/src/H5FDtest.c @@ -71,7 +71,7 @@ /*------------------------------------------------------------------------- - * Function: H5FD_supports_swmr_test() + * Function: H5FD__supports_swmr_test() * * Purpose: Determines if a VFD supports SWMR. * @@ -98,19 +98,18 @@ *------------------------------------------------------------------------- */ hbool_t -H5FD_supports_swmr_test(const char *vfd_name) +H5FD__supports_swmr_test(const char *vfd_name) { hbool_t ret_value = FALSE; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(!vfd_name || !HDstrcmp(vfd_name, "")) + if(!vfd_name || !HDstrcmp(vfd_name, "") || !HDstrcmp(vfd_name, "nomatch")) ret_value = TRUE; else - ret_value = !HDstrcmp(vfd_name, "log") - || !HDstrcmp(vfd_name, "sec2"); + ret_value = !HDstrcmp(vfd_name, "log") || !HDstrcmp(vfd_name, "sec2"); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_supports_swmr_test() */ +} /* end H5FD__supports_swmr_test() */ @@ -58,8 +58,8 @@ /********************/ /* Section info routines */ -static herr_t H5FS_sinfo_free_sect_cb(void *item, void *key, void *op_data); -static herr_t H5FS_sinfo_free_node_cb(void *item, void *key, void *op_data); +static herr_t H5FS__sinfo_free_sect_cb(void *item, void *key, void *op_data); +static herr_t H5FS__sinfo_free_node_cb(void *item, void *key, void *op_data); /*********************/ @@ -221,7 +221,7 @@ HDfprintf(stderr, "%s: fspace->rc = %u\n", FUNC, fspace->rc); /* Increment the reference count on the free space manager header */ HDassert(fspace->rc <= 1); - if(H5FS_incr(fspace) < 0) + if(H5FS__incr(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINC, NULL, "unable to increment ref. count on free space header") fspace->alignment = alignment; @@ -545,7 +545,7 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC); } /* end if */ /* Destroy section info */ - if(H5FS_sinfo_dest(fspace->sinfo) < 0) + if(H5FS__sinfo_dest(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "unable to destroy free space section info") } /* end else */ @@ -560,7 +560,7 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC); } /* end else */ /* Decrement the reference count on the free space manager header */ - if(H5FS_decr(fspace) < 0) + if(H5FS__decr(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEC, FAIL, "unable to decrement ref. count on free space header") done: @@ -683,7 +683,7 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) /*------------------------------------------------------------------------- - * Function: H5FS_incr + * Function: H5FS__incr * * Purpose: Increment reference count on free space header * @@ -695,11 +695,11 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) *------------------------------------------------------------------------- */ herr_t -H5FS_incr(H5FS_t *fspace) +H5FS__incr(H5FS_t *fspace) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE #ifdef H5FS_DEBUG HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc); #endif /* H5FS_DEBUG */ @@ -719,11 +719,11 @@ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fsp done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_incr() */ +} /* end H5FS__incr() */ /*------------------------------------------------------------------------- - * Function: H5FS_decr + * Function: H5FS__decr * * Purpose: Decrement reference count on free space header * @@ -735,11 +735,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FS_decr(H5FS_t *fspace) +H5FS__decr(H5FS_t *fspace) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE #ifdef H5FS_DEBUG HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc); #endif /* H5FS_DEBUG */ @@ -766,11 +766,11 @@ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fsp done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_decr() */ +} /* end H5FS__decr() */ /*------------------------------------------------------------------------- - * Function: H5FS_dirty + * Function: H5FS__dirty * * Purpose: Mark free space header as dirty * @@ -782,11 +782,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FS_dirty(H5FS_t *fspace) +H5FS__dirty(H5FS_t *fspace) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE #ifdef QAK HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC); #endif /* QAK */ @@ -802,7 +802,7 @@ HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_dirty() */ +} /* end H5FS__dirty() */ /*------------------------------------------------------------------------- @@ -875,7 +875,7 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace) fspace->alloc_sect_size = fspace->sect_size; /* Mark free-space header as dirty */ - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") /* Cache the free-space section info */ @@ -959,7 +959,7 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hbool_t free_file_space) } /* end if */ /* Mark free-space manager header as dirty */ - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ @@ -1052,7 +1052,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_sect_cb + * Function: H5FS__sinfo_free_sect_cb * * Purpose: Free a size-tracking node for a bin * @@ -1064,12 +1064,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) +H5FS__sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) { H5FS_section_info_t *sect = (H5FS_section_info_t *)_sect; /* Section to free */ const H5FS_sinfo_t *sinfo = (const H5FS_sinfo_t *)op_data; /* Free space manager for section */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(sect); HDassert(sinfo); @@ -1078,11 +1078,11 @@ H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) (*sinfo->fspace->sect_cls[sect->type].free)(sect); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_sinfo_free_sect_cb() */ +} /* H5FS__sinfo_free_sect_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_node_cb + * Function: H5FS__sinfo_free_node_cb * * Purpose: Free a size-tracking node for a bin * @@ -1094,27 +1094,27 @@ H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) +H5FS__sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) { H5FS_node_t *fspace_node = (H5FS_node_t *)item; /* Temporary pointer to free space list node */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(fspace_node); HDassert(op_data); /* Release the skip list for sections of this size */ - H5SL_destroy(fspace_node->sect_list, H5FS_sinfo_free_sect_cb, op_data); + H5SL_destroy(fspace_node->sect_list, H5FS__sinfo_free_sect_cb, op_data); /* Release free space list node */ fspace_node = H5FL_FREE(H5FS_node_t, fspace_node); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_sinfo_free_node_cb() */ +} /* H5FS__sinfo_free_node_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_dest + * Function: H5FS__sinfo_dest * * Purpose: Destroys a free space section info in memory. * @@ -1126,12 +1126,12 @@ H5FS_sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) *------------------------------------------------------------------------- */ herr_t -H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) +H5FS__sinfo_dest(H5FS_sinfo_t *sinfo) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1143,7 +1143,7 @@ H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) /* Clear out lists of nodes */ for(u = 0; u < sinfo->nbins; u++) if(sinfo->bins[u].bin_list) { - H5SL_destroy(sinfo->bins[u].bin_list, H5FS_sinfo_free_node_cb, sinfo); + H5SL_destroy(sinfo->bins[u].bin_list, H5FS__sinfo_free_node_cb, sinfo); sinfo->bins[u].bin_list = NULL; } /* end if */ @@ -1160,7 +1160,7 @@ H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) * disappearing immediately) */ sinfo->fspace->sinfo = NULL; - if(H5FS_decr(sinfo->fspace) < 0) + if(H5FS__decr(sinfo->fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEC, FAIL, "unable to decrement ref. count on free space header") sinfo->fspace = NULL; @@ -1169,7 +1169,7 @@ H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_sinfo_dest() */ +} /* end H5FS__sinfo_dest() */ herr_t H5FS_get_sect_count(const H5FS_t *frsp, hsize_t *tot_sect_count) diff --git a/src/H5FScache.c b/src/H5FScache.c index fa04ba1..ac0874e 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -926,7 +926,7 @@ H5FS__cache_sinfo_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU uint32_t computed_chksum; /* Computed metadata checksum value */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ HDassert(image); @@ -981,7 +981,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, HDassert(dirty); /* Allocate a new free space section info */ - if(NULL == (sinfo = H5FS_sinfo_new(udata->f, fspace))) + if(NULL == (sinfo = H5FS__sinfo_new(udata->f, fspace))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* initialize old_sect_size */ @@ -1087,7 +1087,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, done: if(!ret_value && sinfo) - if(H5FS_sinfo_dest(sinfo) < 0) + if(H5FS__sinfo_dest(sinfo) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space info") FUNC_LEAVE_NOAPI(ret_value) @@ -1321,7 +1321,7 @@ H5FS__cache_sinfo_notify(H5AC_notify_action_t action, void *_thing) H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(sinfo); @@ -1404,7 +1404,7 @@ H5FS__cache_sinfo_free_icr(void *_thing) HDassert(fspace->cache_info.is_pinned); /* Destroy free space info */ - if(H5FS_sinfo_dest(sinfo) < 0) + if(H5FS__sinfo_dest(sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space info") done: @@ -1512,3 +1512,4 @@ H5FS__sinfo_serialize_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udat done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FS__sinfo_serialize_node_cb() */ + diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index a5896ee..2c56ab6 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -215,24 +215,22 @@ H5FL_EXTERN(H5FS_t); /******************************/ /* Generic routines */ -H5_DLL herr_t H5FS__create_flush_depend(H5AC_info_t *parent_entry, - H5AC_info_t *child_entry); -H5_DLL herr_t H5FS__destroy_flush_depend(H5AC_info_t *parent_entry, - H5AC_info_t *child_entry); +H5_DLL herr_t H5FS__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry); +H5_DLL herr_t H5FS__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry); /* Free space manager header routines */ H5_DLL H5FS_t *H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata); -H5_DLL herr_t H5FS_incr(H5FS_t *fspace); -H5_DLL herr_t H5FS_decr(H5FS_t *fspace); -H5_DLL herr_t H5FS_dirty(H5FS_t *fspace); +H5_DLL herr_t H5FS__incr(H5FS_t *fspace); +H5_DLL herr_t H5FS__decr(H5FS_t *fspace); +H5_DLL herr_t H5FS__dirty(H5FS_t *fspace); /* Free space section routines */ -H5_DLL H5FS_sinfo_t *H5FS_sinfo_new(H5F_t *f, H5FS_t *fspace); +H5_DLL H5FS_sinfo_t *H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace); /* Routines for destroying structures */ H5_DLL herr_t H5FS__hdr_dest(H5FS_t *hdr); -H5_DLL herr_t H5FS_sinfo_dest(H5FS_sinfo_t *sinfo); +H5_DLL herr_t H5FS__sinfo_dest(H5FS_sinfo_t *sinfo); /* Sanity check routines */ #ifdef H5FS_DEBUG_ASSERT @@ -242,8 +240,8 @@ H5_DLL void H5FS__sect_assert(const H5FS_t *fspace); /* Testing routines */ #ifdef H5FS_TESTING -H5_DLL herr_t H5FS_get_cparam_test(const H5FS_t *fh, H5FS_create_t *cparam); -H5_DLL int H5FS_cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2); +H5_DLL herr_t H5FS__get_cparam_test(const H5FS_t *fh, H5FS_create_t *cparam); +H5_DLL int H5FS__cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2); #endif /* H5FS_TESTING */ #endif /* _H5FSpkg_H */ diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index de1b4c1..31fc63c 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -25,9 +25,6 @@ #ifndef _H5FSprivate_H #define _H5FSprivate_H -/* Include package's public header */ -#include "H5FSpublic.h" - /* Private headers needed by this file */ #include "H5Fprivate.h" /* File access */ #include "H5FLprivate.h" /* Free Lists */ diff --git a/src/H5FSpublic.h b/src/H5FSpublic.h deleted file mode 100644 index 3090d0d..0000000 --- a/src/H5FSpublic.h +++ /dev/null @@ -1,52 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/*------------------------------------------------------------------------- - * - * Created: H5FSpublic.h - * May 2 2006 - * Quincey Koziol <koziol@hdfgroup.org> - * - * Purpose: Public declarations for the file free space package. - * - *------------------------------------------------------------------------- - */ - -#ifndef _H5FSpublic_H -#define _H5FSpublic_H - -/* Public headers needed by this file */ -#include "H5public.h" - -/*****************/ -/* Public Macros */ -/*****************/ - -/*******************/ -/* Public Typedefs */ -/*******************/ - -/**********************************/ -/* Public API Function Prototypes */ -/**********************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _H5FSpublic_H */ - diff --git a/src/H5FSsection.c b/src/H5FSsection.c index a58347f..27486f1 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -64,26 +64,26 @@ typedef struct { /********************/ /* Local Prototypes */ /********************/ -static herr_t H5FS_sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, unsigned flags); -static herr_t H5FS_sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls); -static herr_t H5FS_size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, +static herr_t H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls); +static herr_t H5FS__size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, const H5FS_section_class_t *cls); -static herr_t H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect); -static herr_t H5FS_sect_unlink_rest(H5FS_t *fspace, +static herr_t H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect); -static herr_t H5FS_sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect); -static herr_t H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect); +static herr_t H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect); -static herr_t H5FS_sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect, unsigned flags); -static herr_t H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, +static herr_t H5FS__sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags); -static herr_t H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, +static herr_t H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data); -static htri_t H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node); -static herr_t H5FS_sect_serialize_size(H5FS_t *fspace); +static htri_t H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node); +static herr_t H5FS__sect_serialize_size(H5FS_t *fspace); /*********************/ @@ -112,7 +112,7 @@ H5FL_DEFINE(H5FS_sinfo_t); /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_new + * Function: H5FS__sinfo_new * * Purpose: Create new section info structure * @@ -125,12 +125,12 @@ H5FL_DEFINE(H5FS_sinfo_t); *------------------------------------------------------------------------- */ H5FS_sinfo_t * -H5FS_sinfo_new(H5F_t *f, H5FS_t *fspace) +H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace) { H5FS_sinfo_t *sinfo = NULL; /* Section information struct created */ H5FS_sinfo_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(f); @@ -160,7 +160,7 @@ HDfprintf(stderr, "%s: sinfo->sect_off_size = %u, sinfo->sect_len_size = %u\n", HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space section bin array") /* Increment the reference count on the free space manager header */ - if(H5FS_incr(fspace) < 0) + if(H5FS__incr(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINC, NULL, "unable to increment ref. count on free space header") sinfo->fspace = fspace; @@ -183,11 +183,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sinfo_new() */ +} /* H5FS__sinfo_new() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_lock + * Function: H5FS__sinfo_lock * * Purpose: Make certain the section info for the free space manager is * in memory. @@ -204,12 +204,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) +H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) { H5FS_sinfo_cache_ud_t cache_udata; /* User-data for cache callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5FS_SINFO_DEBUG HDfprintf(stderr, "%s: Called, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", FUNC, fspace->addr, fspace->sinfo, fspace->sect_addr); @@ -280,7 +280,7 @@ HDfprintf(stderr, "%s: Creating new section info\n", FUNC); HDassert(fspace->ghost_sect_count == 0); /* Allocate and initialize free space section info */ - if(NULL == (fspace->sinfo = H5FS_sinfo_new(f, fspace))) + if(NULL == (fspace->sinfo = H5FS__sinfo_new(f, fspace))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create section info") /* Set initial size of section info to 0 */ @@ -298,11 +298,11 @@ HDfprintf(stderr, "%s: Leaving, fspace->addr = %a, fspace->sinfo = %p, fspace->s HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sinfo_lock() */ +} /* H5FS__sinfo_lock() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_unlock + * Function: H5FS__sinfo_unlock * * Purpose: Release the section info, either giving ownership back to * the cache or letting the free space header keep it. @@ -315,11 +315,11 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) +H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5FS_SINFO_DEBUG HDfprintf(stderr, "%s: Called, modified = %t, fspace->addr = %a, fspace->sect_addr = %a\n", FUNC, modified, fspace->addr, fspace->sect_addr); HDfprintf(stderr, "%s: fspace->sinfo_lock_count = %u, fspace->sinfo_modified = %t, fspace->sinfo_protected = %t\n", FUNC, fspace->sinfo_lock_count, fspace->sinfo_modified, fspace->sinfo_protected); @@ -347,7 +347,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" /* Assume that the modification will affect the statistics in the header * and mark that dirty also */ - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ @@ -442,7 +442,7 @@ HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC); /* If we haven't already marked the header dirty, do so now */ if(!modified) - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") #ifdef H5FS_SINFO_DEBUG @@ -460,11 +460,11 @@ done: HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sinfo_unlock() */ +} /* H5FS__sinfo_unlock() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_serialize_size + * Function: H5FS__sect_serialize_size * * Purpose: Determine serialized size of all sections in free space manager * @@ -476,17 +476,17 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_serialize_size(H5FS_t *fspace) +H5FS__sect_serialize_size(H5FS_t *fspace) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments. */ HDassert(fspace); #ifdef QAK -HDfprintf(stderr, "%s: Check 1.0 - fspace->sect_size = %Hu\n", "H5FS_sect_serialize_size", fspace->sect_size); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Zu\n", "H5FS_sect_serialize_size", fspace->serial_sect_count); -HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", "H5FS_sect_serialize_size", fspace->alloc_sect_size); -HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_serialize_size", fspace->sinfo->serial_size_count); +HDfprintf(stderr, "%s: Check 1.0 - fspace->sect_size = %Hu\n", "H5FS__sect_serialize_size", fspace->sect_size); +HDfprintf(stderr, "%s: fspace->serial_sect_count = %Zu\n", "H5FS__sect_serialize_size", fspace->serial_sect_count); +HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", "H5FS__sect_serialize_size", fspace->alloc_sect_size); +HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_serialize_size", fspace->sinfo->serial_size_count); #endif /* QAK */ /* Compute the size of the buffer required to serialize all the sections */ @@ -498,8 +498,8 @@ HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_ser /* Count for each differently sized serializable section */ #ifdef QAK -HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_serialize_size", fspace->sinfo->serial_size_count); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_size", fspace->serial_sect_count); +HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_serialize_size", fspace->sinfo->serial_size_count); +HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS__sect_serialize_size", fspace->serial_sect_count); #endif /* QAK */ sect_buf_size += fspace->sinfo->serial_size_count * H5VM_limit_enc_size((uint64_t)fspace->serial_sect_count); @@ -523,11 +523,11 @@ HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_ fspace->sect_size = fspace->sinfo->sect_prefix_size; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_sect_serialize_size() */ +} /* H5FS__sect_serialize_size() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_increase + * Function: H5FS__sect_increase * * Purpose: Increase the size of the serialized free space section info * on disk @@ -540,12 +540,12 @@ HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_ *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, +H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, unsigned flags) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -577,18 +577,18 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); /* Update the free space sections' serialized size */ /* (if we're not deserializing the sections from disk) */ if(!(flags & H5FS_ADD_DESERIALIZING)) { - if(H5FS_sect_serialize_size(fspace) < 0) + if(H5FS__sect_serialize_size(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") } /* end if */ } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_increase() */ +} /* H5FS__sect_increase() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_decrease + * Function: H5FS__sect_decrease * * Purpose: Decrease the size of the serialized free space section info * on disk @@ -601,11 +601,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls) +H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -635,17 +635,17 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); fspace->sinfo->serial_size -= cls->serial_size; /* Update the free space sections' serialized size */ - if(H5FS_sect_serialize_size(fspace) < 0) + if(H5FS__sect_serialize_size(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_decrease() */ +} /* H5FS__sect_decrease() */ /*------------------------------------------------------------------------- - * Function: H5FS_size_node_decr + * Function: H5FS__size_node_decr * * Purpose: Decrement the number of sections of a particular size * @@ -657,12 +657,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, +H5FS__size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, const H5FS_section_class_t *cls) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sinfo); @@ -728,11 +728,11 @@ HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bi done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_size_node_decr() */ +} /* H5FS__size_node_decr() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_unlink_size + * Function: H5FS__sect_unlink_size * * Purpose: Remove a section node from size tracking data structures for * a free space manager @@ -745,7 +745,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +H5FS__sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect) { H5FS_node_t *fspace_node; /* Free list size node */ @@ -753,7 +753,7 @@ H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, unsigned bin; /* Bin to put the free space section in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sinfo); @@ -777,16 +777,16 @@ H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list") /* Decrement # of sections in section size node */ - if(H5FS_size_node_decr(sinfo, bin, fspace_node, cls) < 0) + if(H5FS__size_node_decr(sinfo, bin, fspace_node, cls) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_unlink_size() */ +} /* H5FS__sect_unlink_size() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_unlink_rest + * Function: H5FS__sect_unlink_rest * * Purpose: Finish unlinking a section from the rest of the free space * manager's data structures, after the section has been removed @@ -800,12 +800,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, +H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -826,7 +826,7 @@ HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC } /* end if */ /* Update section info & check if we need less room for the serialized free space sections */ - if(H5FS_sect_decrease(fspace, cls) < 0) + if(H5FS__sect_decrease(fspace, cls) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk") /* Decrement amount of free space managed */ @@ -837,11 +837,11 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_unlink_rest() */ +} /* H5FS__sect_unlink_rest() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_remove_real + * Function: H5FS__sect_remove_real * * Purpose: Remove a section from the free space manager * @@ -853,12 +853,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect) +H5FS__sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect) { const H5FS_section_class_t *cls; /* Class of section */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -869,16 +869,16 @@ H5FS_sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect) cls = &fspace->sect_cls[sect->type]; /* Remove node from size tracked data structures */ - if(H5FS_sect_unlink_size(fspace->sinfo, cls, sect) < 0) + if(H5FS__sect_unlink_size(fspace->sinfo, cls, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from size tracking data structures") /* Update rest of free space manager data structures for node removal */ - if(H5FS_sect_unlink_rest(fspace, cls, sect) < 0) + if(H5FS__sect_unlink_rest(fspace, cls, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_remove_real() */ +} /* H5FS__sect_remove_real() */ /*------------------------------------------------------------------------- @@ -907,17 +907,17 @@ H5FS_sect_remove(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect) HDassert(sect); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; /* Perform actual section removal */ - if(H5FS_sect_remove_real(fspace, sect) < 0) + if(H5FS__sect_remove_real(fspace, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove section") done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, TRUE) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, TRUE) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -925,7 +925,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_link_size + * Function: H5FS__sect_link_size * * Purpose: Add a section of free space to the free list bins * @@ -937,7 +937,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect) { H5FS_node_t *fspace_node = NULL; /* Pointer to free space node of the correct size */ @@ -945,7 +945,7 @@ H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, unsigned bin; /* Bin to put the free space section in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef QAK HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, sect->addr); #endif /* QAK */ @@ -1028,11 +1028,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_link_size() */ +} /* H5FS__sect_link_size() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_link_rest + * Function: H5FS__sect_link_rest * * Purpose: Link a section into the rest of the non-size tracking * free space manager data structures @@ -1045,12 +1045,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, +H5FS__sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect, unsigned flags) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1070,7 +1070,7 @@ HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUN } /* end if */ /* Update section info & check if we need more room for the serialized free space sections */ - if(H5FS_sect_increase(fspace, cls, flags) < 0) + if(H5FS__sect_increase(fspace, cls, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk") /* Increment amount of free space managed */ @@ -1078,11 +1078,11 @@ HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUN done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_link_rest() */ +} /* H5FS__sect_link_rest() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_link + * Function: H5FS__sect_link * * Purpose: Link a section into the internal data structures * @@ -1094,12 +1094,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) +H5FS__sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) { const H5FS_section_class_t *cls; /* Class of section */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1113,14 +1113,14 @@ H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) #ifdef QAK HDfprintf(stderr, "%s: Check 1.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); #endif /* QAK */ - if(H5FS_sect_link_size(fspace->sinfo, cls, sect) < 0) + if(H5FS__sect_link_size(fspace->sinfo, cls, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add section to size tracking data structures") #ifdef QAK HDfprintf(stderr, "%s: Check 2.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); #endif /* QAK */ /* Update rest of free space manager data structures for section addition */ - if(H5FS_sect_link_rest(fspace, cls, sect, flags) < 0) + if(H5FS__sect_link_rest(fspace, cls, sect, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add section to non-size tracking data structures") #ifdef QAK HDfprintf(stderr, "%s: Check 3.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); @@ -1128,11 +1128,11 @@ HDfprintf(stderr, "%s: Check 3.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_link() */ +} /* H5FS__sect_link() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_merge + * Function: H5FS__sect_merge * * Purpose: Attempt to merge a returned free space section with existing * free space. @@ -1145,7 +1145,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) +H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) { H5FS_section_class_t *sect_cls; /* Section's class */ hbool_t modified; /* Flag to indicate merge or shrink occurred */ @@ -1153,7 +1153,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) htri_t status; /* Status value */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1203,7 +1203,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) HDassert(tmp_sect_cls->merge); /* Remove 'less than' node from data structures */ - if(H5FS_sect_remove_real(fspace, tmp_sect) < 0) + if(H5FS__sect_remove_real(fspace, tmp_sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") /* Merge the two sections together */ @@ -1249,7 +1249,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) HDassert(sect_cls->merge); /* Remove 'greater than' node from data structures */ - if(H5FS_sect_remove_real(fspace, tmp_sect) < 0) + if(H5FS__sect_remove_real(fspace, tmp_sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") /* Merge the two sections together */ @@ -1290,7 +1290,7 @@ HDfprintf(stderr, "%s: Can shrink!\n", FUNC); /* Remove SECT from free-space manager */ /* (only possible to happen on second+ pass through loop) */ if(remove_sect) { - if(H5FS_sect_remove_real(fspace, *sect) < 0) + if(H5FS__sect_remove_real(fspace, *sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") remove_sect = FALSE; } /* end if */ @@ -1342,7 +1342,7 @@ done: HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); #endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_merge() */ +} /* H5FS__sect_merge() */ /*------------------------------------------------------------------------- @@ -1379,7 +1379,7 @@ HDfprintf(stderr, "%s: *sect = {%a, %Hu, %u, %s}\n", FUNC, sect->addr, sect->siz HDassert(sect->size); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -1396,7 +1396,7 @@ HDfprintf(stderr, "%s: Returning space\n", FUNC); #endif /* H5FS_SINFO_DEBUG */ /* Attempt to merge returned section with existing sections */ - if(H5FS_sect_merge(fspace, §, op_data) < 0) + if(H5FS__sect_merge(fspace, §, op_data) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") } /* end if */ @@ -1405,7 +1405,7 @@ HDfprintf(stderr, "%s: Returning space\n", FUNC); * be NULL at this point - QAK) */ if(sect) - if(H5FS_sect_link(fspace, sect, flags) < 0) + if(H5FS__sect_link(fspace, sect, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") #ifdef H5FS_SINFO_DEBUG @@ -1418,7 +1418,7 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") #ifdef H5FS_DEBUG_ASSERT @@ -1475,7 +1475,7 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se H5FS_section_info_t *sect; /* Temporary free space section */ /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -1511,7 +1511,7 @@ if(_section_) H5FS_section_class_t *cls; /* Section's class */ /* Remove section from data structures */ - if(H5FS_sect_remove_real(fspace, sect) < 0) + if(H5FS__sect_remove_real(fspace, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") /* Get class for section */ @@ -1537,7 +1537,7 @@ if(_section_) /* Re-adding the section could cause it to disappear (particularly when paging) */ if(sect) { /* Re-add adjusted section to free sections data structures */ - if(H5FS_sect_link(fspace, sect, 0) < 0) + if(H5FS__sect_link(fspace, sect, 0) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") } /* end if */ } /* end if */ @@ -1561,7 +1561,7 @@ if(_section_) done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -1601,13 +1601,13 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, HDassert(sect->size); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; saved_fs_size = sect->size; /* Attempt to merge/shrink section with existing sections */ - if(H5FS_sect_merge(fspace, §, op_data) < 0) + if(H5FS__sect_merge(fspace, §, op_data) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") /* Check if section is shrunk and/or merged away completely */ @@ -1618,7 +1618,7 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, else { /* Check if section is merged */ if(sect->size > saved_fs_size) { - if(H5FS_sect_link(fspace, sect, flags) < 0) + if(H5FS__sect_link(fspace, sect, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") sinfo_modified = TRUE; HGOTO_DONE(TRUE) @@ -1627,7 +1627,7 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -1635,7 +1635,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_find_node + * Function: H5FS__sect_find_node * * Purpose: Locate a section of free space (in existing free space list * bins) that is large enough to fulfill request. @@ -1648,7 +1648,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) +H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) { H5FS_node_t *fspace_node; /* Free list size node */ unsigned bin; /* Bin to put the free space section in */ @@ -1658,7 +1658,7 @@ H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) const H5FS_section_class_t *cls; /* Class of section */ hsize_t alignment; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1696,9 +1696,9 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); /* Get section's class */ cls = &fspace->sect_cls[(*node)->type]; /* Decrement # of sections in section size node */ - if(H5FS_size_node_decr(fspace->sinfo, bin, fspace_node, cls) < 0) + if(H5FS__size_node_decr(fspace->sinfo, bin, fspace_node, cls) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") - if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0) + if(H5FS__sect_unlink_rest(fspace, cls, *node) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures") /* Indicate that we found a node for the request */ HGOTO_DONE(TRUE) @@ -1741,10 +1741,10 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); if(NULL == (*node = (H5FS_section_info_t *)H5SL_remove(curr_fspace_node->sect_list, &curr_sect->addr))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list") /* Decrement # of sections in section size node */ - if(H5FS_size_node_decr(fspace->sinfo, bin, curr_fspace_node, cls) < 0) + if(H5FS__size_node_decr(fspace->sinfo, bin, curr_fspace_node, cls) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") - if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0) + if(H5FS__sect_unlink_rest(fspace, cls, *node) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures") /* @@ -1755,7 +1755,7 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); */ if(mis_align) { split_sect = cls->split(*node, frag_size); - if((H5FS_sect_link(fspace, split_sect, 0) < 0)) + if((H5FS__sect_link(fspace, split_sect, 0) < 0)) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") /* sanity check */ HDassert(split_sect->addr < (*node)->addr); @@ -1780,7 +1780,7 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_find_node() */ +} /* H5FS__sect_find_node() */ /*------------------------------------------------------------------------- @@ -1823,12 +1823,12 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se #endif /* QAK */ if(fspace->tot_sect_count > 0) { /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; /* Look for node in bins */ - if((ret_value = H5FS_sect_find_node(fspace, request, node)) < 0) + if((ret_value = H5FS__sect_find_node(fspace, request, node)) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from bins") /* Decrement # of sections on free list, if we found an object */ @@ -1843,7 +1843,7 @@ HDfprintf(stderr, "%s: (*node)->size = %Hu, (*node)->addr = %a, (*node)->type = done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") #ifdef H5FS_DEBUG_ASSERT @@ -1965,7 +1965,7 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_c unsigned bin; /* Current bin we are on */ /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__READ_ONLY_FLAG) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__READ_ONLY_FLAG) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -1985,7 +1985,7 @@ HDfprintf(stderr, "%s: Iterate over section bins\n", FUNC); done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, FALSE) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, FALSE) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -2054,7 +2054,7 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, HDassert(new_class < fspace->nclasses); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -2179,12 +2179,12 @@ HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC fspace->sinfo->serial_size += fspace->sect_cls[new_class].serial_size; /* Update current space used for free space sections */ - if(H5FS_sect_serialize_size(fspace) < 0) + if(H5FS__sect_serialize_size(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, TRUE) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, TRUE) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -2343,13 +2343,12 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a, sect->type = %u\n", "H /*------------------------------------------------------------------------- - * Function: H5FS_sect_try_shrink_eoa + * Function: H5FS_sect_try_shrink_eoa * - * Purpose: To shrink the last section on the merge list if the section - * is at EOF. + * Purpose: To shrink the last section on the merge list if the section + * is at EOF. * - * Return: Success: non-negative (TRUE/FALSE) - * Failure: negative + * Return: TRUE/FALSE/FAIL * * Programmer: Vailin Choi * @@ -2367,7 +2366,7 @@ H5FS_sect_try_shrink_eoa(H5F_t *f, H5FS_t *fspace, void *op_data) /* Check arguments. */ HDassert(fspace); - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -2382,30 +2381,30 @@ H5FS_sect_try_shrink_eoa(H5F_t *f, H5FS_t *fspace, void *op_data) /* Get the pointer to the last section, from the last node */ tmp_sect = (H5FS_section_info_t *)H5SL_item(last_node); HDassert(tmp_sect); - tmp_sect_cls = &fspace->sect_cls[tmp_sect->type]; - if(tmp_sect_cls->can_shrink) { + tmp_sect_cls = &fspace->sect_cls[tmp_sect->type]; + if(tmp_sect_cls->can_shrink) { /* Check if the section can be shrunk away */ - if((ret_value = (*tmp_sect_cls->can_shrink)(tmp_sect, op_data)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container") - if(ret_value > 0) { - HDassert(tmp_sect_cls->shrink); + if((ret_value = (*tmp_sect_cls->can_shrink)(tmp_sect, op_data)) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container") + if(ret_value > 0) { + HDassert(tmp_sect_cls->shrink); /* Remove section from free space manager */ - if(H5FS_sect_remove_real(fspace, tmp_sect) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") + if(H5FS__sect_remove_real(fspace, tmp_sect) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") section_removed = TRUE; /* Shrink away section */ - if((*tmp_sect_cls->shrink)(&tmp_sect, op_data) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't shrink free space container") - } /* end if */ - } /* end if */ - } /* end if */ + if((*tmp_sect_cls->shrink)(&tmp_sect, op_data) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't shrink free space container") + } /* end if */ + } /* end if */ + } /* end if */ } /* end if */ done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, section_removed) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, section_removed) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -2557,15 +2556,15 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, if(H5F_IS_TMP_ADDR(f, (eoa + fspace->sect_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, "hdr file space alloc will overlap into 'temporary' file space") - hdr_alloc_size = H5FS_HEADER_SIZE(f); + hdr_alloc_size = H5FS_HEADER_SIZE(f); - /* if page allocation is enabled, extend the hdr_alloc_size to the - * next page boundary. + /* if page allocation is enabled, extend the hdr_alloc_size to the + * next page boundary. */ if(H5F_PAGED_AGGR(f)) { HDassert(0 == (eoa % f->shared->fs_page_size)); - hdr_alloc_size = ((hdr_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; + hdr_alloc_size = ((hdr_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; HDassert(hdr_alloc_size >= H5FS_HEADER_SIZE(f)); HDassert((hdr_alloc_size % f->shared->fs_page_size) == 0); @@ -2599,13 +2598,13 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, sinfo_alloc_size = fspace->sect_size; - /* if paged allocation is enabled, extend the sinfo_alloc_size to the - * next page boundary. + /* if paged allocation is enabled, extend the sinfo_alloc_size to the + * next page boundary. */ if(H5F_PAGED_AGGR(f)) { HDassert(0 == (eoa % f->shared->fs_page_size)); - sinfo_alloc_size = ((sinfo_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; + sinfo_alloc_size = ((sinfo_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; HDassert(sinfo_alloc_size >= fspace->sect_size); HDassert((sinfo_alloc_size % f->shared->fs_page_size) == 0); diff --git a/src/H5FStest.c b/src/H5FStest.c index 5ab0219..120a9a8 100644 --- a/src/H5FStest.c +++ b/src/H5FStest.c @@ -69,7 +69,7 @@ /*------------------------------------------------------------------------- - * Function: H5FS_get_cparam_test + * Function: H5FS__get_cparam_test * * Purpose: Retrieve the parameters used to create the free-space manager * similar to H5HF_get_cparam_test() @@ -82,9 +82,9 @@ *------------------------------------------------------------------------- */ herr_t -H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) +H5FS__get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ HDassert(frsp); @@ -97,16 +97,16 @@ H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) cparam->max_sect_size = frsp->max_sect_size; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_get_cparam_test() */ +} /* H5FS__get_cparam_test() */ /*------------------------------------------------------------------------- - * Function: H5FS_cmp_cparam_test + * Function: H5FS__cmp_cparam_test * * Purpose: Compare the parameters used to create the free space manager * similar to H5HF_cmp_cparam_test() * - * Return: SUCCEED/FAIL + * Return: A value like strcmp() * * Programmer: Vailin Choi * August 25th, 2008 @@ -114,11 +114,11 @@ H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) *------------------------------------------------------------------------- */ int -H5FS_cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2) +H5FS__cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2) { - int ret_value = SUCCEED; /* Return value */ + int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ HDassert(cparam1); @@ -151,5 +151,5 @@ H5FS_cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_cmp_cparam_test */ +} /* H5FS__cmp_cparam_test */ diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index 6417956..dfc1441 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -35,12 +35,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5Iprivate.h" /* IDs */ -#include "H5SMprivate.h" /* Shared object header messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5Iprivate.h" /* IDs */ +#include "H5SMprivate.h" /* Shared object header messages */ /****************/ @@ -84,23 +84,20 @@ * Function: H5Fget_info1 * * Purpose: Gets general information about the file, including: - * 1. Get storage size for superblock extension if there is one. + * 1. Get storage size for superblock extension if there is one. * 2. Get the amount of btree and heap storage for entries * in the SOHM table if there is one. - * 3. The amount of free space tracked in the file. + * 3. The amount of free space tracked in the file. * - * Return: Success: non-negative on success - * Failure: Negative - * - * Programmer: Vailin Choi - * July 11, 2007 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) { - H5F_t *f; /* Top file in mount hierarchy */ + H5VL_object_t *vol_obj = NULL; + H5I_type_t type; H5F_info2_t finfo2; /* Current file info struct */ herr_t ret_value = SUCCEED; /* Return value */ @@ -111,26 +108,17 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) if(!finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - /* For file IDs, get the file object directly */ - /* (This prevents the H5G_loc() call from returning the file pointer for - * the top file in a mount hierarchy) - */ - if(H5I_get_type(obj_id) == H5I_FILE ) { - if(NULL == (f = (H5F_t *)H5I_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") - } /* end if */ - else { - H5G_loc_t loc; /* Object location */ - - /* Get symbol table entry */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID") - f = loc.oloc->file; - } /* end else */ - HDassert(f->shared); - - /* Get the current file info */ - if(H5F__get_info(f, &finfo2) < 0) + /* Check the type */ + type = H5I_get_type(obj_id); + if(H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Get the file object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + /* Get the file information */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, &finfo2) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") /* Copy the compatible fields into the older struct */ @@ -144,6 +132,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5Fis_hdf5 + * + * Purpose: Check the file signature to detect an HDF5 file. + * + * Bugs: This function is not robust: it only uses the default file + * driver when attempting to open the file when in fact it + * should use all known file drivers. + * + * Return: TRUE/FALSE/FAIL + * + *------------------------------------------------------------------------- + */ +htri_t +H5Fis_hdf5(const char *name) +{ + htri_t ret_value; /* Return value */ + + FUNC_ENTER_API((-1)) + H5TRACE1("t", "*s", name); + + /* Check args and all the boring stuff. */ + if(!name || !*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "no file name specified") + + /* Check if file is accessible */ + if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5P_FILE_ACCESS_DEFAULT, name, &ret_value) < 0) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable to determine if file is accessible as HDF5") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Fis_hdf5() */ + + +/*------------------------------------------------------------------------- * Function: H5Fset_latest_format * * Purpose: Enable switching between latest or non-latest format while @@ -180,26 +202,31 @@ done: herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format) { - H5F_t *f; /* File */ - H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */ - H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File as VOL object */ + H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */ + H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ib", file_id, latest_format); /* Check args */ - if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(file_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* 'low' and 'high' are both initialized to LATEST. - If latest format is not expected, set 'low' to EARLIEST */ + * If latest format is not expected, set 'low' to EARLIEST + */ if(!latest_format) low = H5F_LIBVER_EARLIEST; - /* Call private set_libver_bounds function to set the bounds */ - if(H5F__set_libver_bounds(f, low, high) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") + /* Set the library's version bounds */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Fefc.c b/src/H5Fefc.c index 07bb644..a394071 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -481,7 +481,7 @@ H5F__efc_release(H5F_efc_t *efc) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(efc); @@ -491,7 +491,7 @@ H5F__efc_release(H5F_efc_t *efc) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't remove entry from external file cache") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_efc_release() */ diff --git a/src/H5Fint.c b/src/H5Fint.c index c3fe07a..1282608 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -37,6 +37,7 @@ #include "H5Pprivate.h" /* Property lists */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tprivate.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -47,7 +48,7 @@ /* Local Typedefs */ /******************/ -/* Struct only used by functions H5F_get_objects and H5F_get_objects_cb */ +/* Struct only used by functions H5F__get_objects and H5F__get_objects_cb */ typedef struct H5F_olist_t { H5I_type_t obj_type; /* Type of object to look for */ hid_t *obj_id_list; /* Pointer to the list of open IDs to return */ @@ -73,10 +74,12 @@ typedef struct H5F_olist_t { /* Local Prototypes */ /********************/ -static int H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); +static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); +static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/); static char *H5F__getenv_prefix_name(char **env_prefix/*in,out*/); -static herr_t H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name); +static H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); +static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name); static herr_t H5F__flush_phase1(H5F_t *f); static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing); @@ -104,19 +107,66 @@ H5FL_DEFINE(H5F_file_t); /*------------------------------------------------------------------------- - * Function: H5F_get_access_plist + * Function: H5F__set_vol_conn * - * Purpose: Returns a copy of the file access property list of the - * specified file. + * Purpose: Set the VOL connector ID and info for a file. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info) +{ + void *new_connector_info = NULL; /* Copy of connector info */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + HDassert(file); + + /* Only cache VOL connector ID & info the first time the file is opened */ + if(file->shared->nrefs == 1) { + /* Copy connector info, if it exists */ + if(vol_info) { + H5VL_class_t *connector; /* Pointer to connector */ + + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(vol_id))) + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Allocate and copy connector info */ + if(H5VL_copy_connector_info(connector, &new_connector_info, vol_info) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "connector info copy failed") + } /* end if */ + + /* Cache the connector ID & info for the container */ + file->shared->vol_id = vol_id; + file->shared->vol_info = new_connector_info; + if(H5I_inc_ref(file->shared->vol_id, FALSE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__set_vol_conn() */ + + +/*------------------------------------------------------------------------- + * Function: H5F_get_access_plist + * + * Purpose: Returns a copy of the file access property list of the + * specified file. * * NOTE: Make sure that, if you are going to overwrite * information in the copied property list that was * previously opened and assigned to the property list, then * you must close it before overwriting the values. * - * Return: Success: Object ID for a copy of the file access - * property list. - * Failure: FAIL + * Return: Success: Object ID for a copy of the file access + * property list. + * Failure: H5I_INVALID_HID *------------------------------------------------------------------------- */ hid_t @@ -126,72 +176,73 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) H5P_genplist_t *old_plist; /* Old property list */ H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ hbool_t driver_prop_copied = FALSE; /* Whether the driver property has been set up */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ unsigned efc_size = 0; - hid_t ret_value = SUCCEED; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Check args */ HDassert(f); /* Make a copy of the default file access property list */ if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") if((ret_value = H5P_copy_plist(old_plist, app_ref)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "can't copy file access property list") if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(ret_value))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") /* Copy properties of the file access property list */ if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, &(f->shared->mdc_initCacheCfg)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set initial metadata cache resize config.") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.") if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(f->shared->rdcc_nslots)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache number of slots") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache number of slots") if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(f->shared->rdcc_nbytes)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache byte size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache byte size") if(H5P_set(new_plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &(f->shared->rdcc_w0)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set preempt read chunks") if(H5P_set(new_plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment threshold") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment threshold") if(H5P_set(new_plist, H5F_ACS_ALIGN_NAME, &(f->shared->alignment)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment") if(H5P_set(new_plist, H5F_ACS_GARBG_COLCT_REF_NAME, &(f->shared->gc_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set garbage collect reference") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set garbage collect reference") if(H5P_set(new_plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(f->shared->meta_aggr.alloc_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set metadata cache size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set metadata cache size") if(H5P_set(new_plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't sieve buffer size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't sieve buffer size") if(H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->sdata_aggr.alloc_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' cache size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'small data' cache size") if(H5P_set(new_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &f->shared->low_bound) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'low' bound for library format versions") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'low' bound for library format versions") if(H5P_set(new_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &f->shared->high_bound) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'high' bound for library format versions") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'high' bound for library format versions") if(H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->read_attempts)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'read attempts ' flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag") if(H5P_set(new_plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object flush callback") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback") if(f->shared->efc) efc_size = H5F__efc_max_nfiles(f->shared->efc); if(H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set elink file cache size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set elink file cache size") if(f->shared->page_buf != NULL) { if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &(f->shared->page_buf->max_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set page buffer size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set page buffer size") if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &(f->shared->page_buf->min_meta_perc)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set minimum metadata fraction of page buffer") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum metadata fraction of page buffer") if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &(f->shared->page_buf->min_raw_perc)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set minimum raw data fraction of page buffer") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum raw data fraction of page buffer") } /* end if */ #ifdef H5_HAVE_PARALLEL if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") #endif /* H5_HAVE_PARALLEL */ if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set initial metadata cache resize config.") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.") /* Prepare the driver property */ driver_prop.driver_id = f->shared->lf->driver_id; @@ -200,18 +251,24 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) /* Set the driver property */ if(H5P_set(new_plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver ID & info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver ID & info") + + /* Set the VOL connector property */ + connector_prop.connector_id = f->shared->vol_id; + connector_prop.connector_info = f->shared->vol_info; + if(H5P_set(new_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector ID & info") /* Set the file close degree appropriately */ if(f->shared->fc_degree == H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->lf->cls->fc_degree)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") else if(f->shared->fc_degree != H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->fc_degree)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") done: /* Release the copy of the driver info, if it was set up */ if(driver_prop_copied && H5FD_fapl_close(driver_prop.driver_id, driver_prop.driver_info) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close copy of driver info") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close copy of driver info") FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_access_plist() */ @@ -237,8 +294,8 @@ H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_i HDassert(obj_id_count_ptr); /* Perform the query */ - if((ret_value = H5F_get_objects(f, types, 0, NULL, app_ref, obj_id_count_ptr)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_objects failed") + if((ret_value = H5F__get_objects(f, types, 0, NULL, app_ref, obj_id_count_ptr)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F__get_objects failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -264,8 +321,8 @@ H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list HDassert(obj_id_count_ptr); /* Perform the query */ - if((ret_value = H5F_get_objects(f, types, max_objs, oid_list, app_ref, obj_id_count_ptr)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_objects failed") + if((ret_value = H5F__get_objects(f, types, max_objs, oid_list, app_ref, obj_id_count_ptr)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F__get_objects failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -273,23 +330,23 @@ done: /*--------------------------------------------------------------------------- - * Function: H5F_get_objects + * Function: H5F__get_objects * - * Purpose: This function is called by H5F_get_obj_count or - * H5F_get_obj_ids to get number of object IDs and/or a - * list of opened object IDs (in return value). + * Purpose: This function is called by H5F_get_obj_count or + * H5F_get_obj_ids to get number of object IDs and/or a + * list of opened object IDs (in return value). * - * Return: Non-negative on success; Can't fail. + * Return: SUCCEED/FAIL *--------------------------------------------------------------------------- */ -herr_t -H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr) +static herr_t +H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr) { - size_t obj_id_count=0; /* Number of open IDs */ + size_t obj_id_count = 0; /* Number of open IDs */ H5F_olist_t olist; /* Structure to hold search results */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(obj_id_count_ptr); @@ -314,7 +371,7 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_ * IDs on the object list. */ if(types & H5F_OBJ_FILE) { olist.obj_type = H5I_FILE; - if(H5I_iterate(H5I_FILE, H5F_get_objects_cb, &olist, app_ref) < 0) + if(H5I_iterate(H5I_FILE, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(1)") } /* end if */ @@ -323,12 +380,12 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_ * search through dataset IDs to count number of datasets, and put their * IDs on the object list */ if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) { - if (types & H5F_OBJ_DATASET) { + if(types & H5F_OBJ_DATASET) { olist.obj_type = H5I_DATASET; - if(H5I_iterate(H5I_DATASET, H5F_get_objects_cb, &olist, app_ref) < 0) + if(H5I_iterate(H5I_DATASET, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(2)") } /* end if */ - } + } /* end if */ /* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero), * or the caller wants to get the list of IDs and the list isn't full, @@ -337,10 +394,10 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_ if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) { if(types & H5F_OBJ_GROUP) { olist.obj_type = H5I_GROUP; - if(H5I_iterate(H5I_GROUP, H5F_get_objects_cb, &olist, app_ref) < 0) + if(H5I_iterate(H5I_GROUP, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(3)") } /* end if */ - } + } /* end if */ /* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero), * or the caller wants to get the list of IDs and the list isn't full, @@ -349,10 +406,10 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_ if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) { if(types & H5F_OBJ_DATATYPE) { olist.obj_type = H5I_DATATYPE; - if(H5I_iterate(H5I_DATATYPE, H5F_get_objects_cb, &olist, app_ref) < 0) + if(H5I_iterate(H5I_DATATYPE, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(4)") } /* end if */ - } + } /* end if */ /* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero), * or the caller wants to get the list of IDs and the list isn't full, @@ -361,38 +418,38 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_ if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) { if(types & H5F_OBJ_ATTR) { olist.obj_type = H5I_ATTR; - if(H5I_iterate(H5I_ATTR, H5F_get_objects_cb, &olist, app_ref) < 0) + if(H5I_iterate(H5I_ATTR, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(5)") } /* end if */ - } + } /* end if */ /* Set the number of objects currently open */ *obj_id_count_ptr = obj_id_count; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_objects() */ +} /* end H5F__get_objects() */ /*------------------------------------------------------------------------- - * Function: H5F_get_objects_cb + * Function: H5F__get_objects_cb * - * Purpose: H5F_get_objects' callback function. It verifies if an - * object is in the file, and either count it or put its ID - * on the list. + * Purpose: H5F__get_objects' callback function. It verifies if an + * object is in the file, and either count it or put its ID + * on the list. * - * Return: H5_ITER_STOP if the array of object IDs is filled up. - * H5_ITER_CONT otherwise. + * Return: H5_ITER_STOP if the array of object IDs is filled up. + * H5_ITER_CONT otherwise. *------------------------------------------------------------------------- */ static int -H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) +H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) { H5F_olist_t *olist = (H5F_olist_t *)key; /* Alias for search info */ hbool_t add_obj = FALSE; int ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(obj_ptr); HDassert(olist); @@ -408,7 +465,7 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) add_obj = TRUE; } /* end if */ } /* end if */ - else { /* either count opened object IDs or put the IDs on the list */ + else { /* Either count opened object IDs or put the IDs on the list */ H5O_loc_t *oloc; /* Group entry info for object */ switch(olist->obj_type) { @@ -437,6 +494,7 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) case H5I_DATASPACE: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -473,14 +531,15 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) /* Check if we've filled up the array. Return H5_ITER_STOP only if * we have filled up the array. Otherwise return H5_ITER_CONT(RET_VALUE is * preset to H5_ITER_CONT) because H5I_iterate needs the return value of - * H5_ITER_CONT to continue the iteration. */ + * H5_ITER_CONT to continue the iteration. + */ if(olist->max_nobjs > 0 && olist->list_index >= olist->max_nobjs) HGOTO_DONE(H5_ITER_STOP) /* Indicate that the iterator should stop */ } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_objects_cb() */ +} /* end H5F__get_objects_cb() */ /*-------------------------------------------------------------------------- @@ -489,7 +548,6 @@ done: * Purpose: Prepend PREFIX to FILE_NAME and store in FULL_NAME * * Return: SUCCEED/FAIL - * *--------------------------------------------------------------------------*/ static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/) @@ -517,14 +575,14 @@ done: /*-------------------------------------------------------------------------- - * Function: H5F__getenv_prefix_name + * Function: H5F__getenv_prefix_name * - * Purpose: Get the first pathname in the list of pathnames stored in env_prefix, - * which is separated by the environment delimiter. - * env_prefix is modified to point to the remaining pathnames - * in the list. + * Purpose: Get the first pathname in the list of pathnames stored in env_prefix, + * which is separated by the environment delimiter. + * env_prefix is modified to point to the remaining pathnames + * in the list. * - * Return: A pointer to a pathname + * Return: A pointer to a pathname (can't fail but can return NULL) --------------------------------------------------------------------------*/ static char * H5F__getenv_prefix_name(char **env_prefix/*in,out*/) @@ -666,6 +724,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, /* Leave if file was opened */ else break; + H5E_clear_stack(NULL); } /* end if */ } /* end while */ @@ -776,29 +835,27 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__is_hdf5 - * - * Purpose: Check the file signature to detect an HDF5 file. + * Function: H5F__is_hdf5 * - * Bugs: This function is not robust: it only uses the default file - * driver when attempting to open the file when in fact it - * should use all known file drivers. + * Purpose: Check the file signature to detect an HDF5 file. * - * Return: Success: TRUE/FALSE - * * Failure: Negative + * Return: TRUE/FALSE/FAIL *------------------------------------------------------------------------- */ htri_t -H5F__is_hdf5(const char *name) +H5F__is_hdf5(const char *name, hid_t fapl_id) { - H5FD_t *file = NULL; /* Low-level file struct */ - haddr_t sig_addr; /* Addess of hdf5 file signature */ - htri_t ret_value = FAIL; /* Return value */ + H5FD_t *file = NULL; /* Low-level file struct */ + haddr_t sig_addr; /* Addess of hdf5 file signature */ + htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE - /* Open the file at the virtual file layer */ - if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF))) + /* Open the file */ + /* NOTE: This now uses the fapl_id that was passed in, so H5Fis_accessible() + * should work with arbitrary VFDs, unlike H5Fis_hdf5(). + */ + if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF))) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file") /* The file is an hdf5 file if the hdf5 file signature can be found */ @@ -809,10 +866,10 @@ H5F__is_hdf5(const char *name) done: /* Close the file */ if(file) - if(H5FD_close(file) < 0 && ret_value >= 0) + if(H5FD_close(file) < 0 && TRUE == ret_value) HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__is_hdf5() */ @@ -832,17 +889,17 @@ done: * *------------------------------------------------------------------------- */ -H5F_t * +static H5F_t * H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) { H5F_t *f = NULL; H5F_t *ret_value = NULL; - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC if(NULL == (f = H5FL_CALLOC(H5F_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure") - f->file_id = H5I_INVALID_HID; + f->id_exists = FALSE; if(shared) { HDassert(lf == NULL); @@ -1005,12 +1062,12 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ f->shared->feature_flags &= ~(unsigned)H5FD_FEAT_ACCUMULATE_METADATA; if(H5FD_set_feature_flags(f->shared->lf, f->shared->feature_flags) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set feature_flags in VFD") - } + } /* end if */ else { /* If no value for read attempts has been set, use the default */ if(!f->shared->read_attempts) f->shared->read_attempts = H5F_METADATA_READ_ATTEMPTS; - } + } /* end else */ /* Determine the # of bins for metdata read retries */ if(H5F_set_retries(f) < 0) @@ -1048,7 +1105,7 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure") /* Add new "shared" struct to list of open files */ - if(H5F_sfile_add(f->shared) < 0) + if(H5F__sfile_add(f->shared) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to append to list of open files") } /* end else */ @@ -1082,14 +1139,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__dest + * Function: H5F__dest * - * Purpose: Destroys a file structure. This function flushes the cache - * but doesn't do any other cleanup other than freeing memory - * for the file struct. The shared info for the file is freed - * only when its reference count reaches zero. + * Purpose: Destroys a file structure. This function flushes the cache + * but doesn't do any other cleanup other than freeing memory + * for the file struct. The shared info for the file is freed + * only when its reference count reaches zero. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -1243,7 +1300,7 @@ H5F__dest(H5F_t *f, hbool_t flush) HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); /* Remove shared file struct from list of open files */ - if(H5F_sfile_remove(f->shared) < 0) + if(H5F__sfile_remove(f->shared) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") @@ -1296,6 +1353,25 @@ H5F__dest(H5F_t *f, hbool_t flush) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close property list") + /* Clean up the cached VOL connector ID & info */ + if(f->shared->vol_info) { + H5VL_class_t *connector; /* Pointer to connector */ + + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(f->shared->vol_id))) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Free the connector info */ + if(H5VL_free_connector_info(connector, f->shared->vol_info) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") + } /* end if */ + if(f->shared->vol_id > 0) + if(H5I_dec_ref(f->shared->vol_id) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close VOL connector ID") + /* Close the file */ if(H5FD_close(f->shared->lf) < 0) /* Push error, but keep going*/ @@ -1336,78 +1412,6 @@ H5F__dest(H5F_t *f, hbool_t flush) /*------------------------------------------------------------------------- - * Function: H5F__create - * - * Purpose: Internal routine to create a file. - * - * Note: This routine is needed so that there's a non-API routine for - * creating files that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new file object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 13, 2017 - * - *------------------------------------------------------------------------- - */ -H5F_t * -H5F__create(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) -{ - H5F_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(filename); - - /* Create a new file or truncate an existing file. */ - if(NULL == (ret_value = H5F_open(filename, flags, fcpl_id, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5F__create() */ - - -/*------------------------------------------------------------------------- - * Function: H5F__open - * - * Purpose: Internal routine to open a file. - * - * Note: This routine is needed so that there's a non-API routine for - * opening files that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new file object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 13, 2017 - * - *------------------------------------------------------------------------- - */ -H5F_t * -H5F__open(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) -{ - H5F_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(filename); - - /* Open the file */ - if(NULL == (ret_value = H5F_open(filename, flags, fcpl_id, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5F__open() */ - - -/*------------------------------------------------------------------------- * Function: H5F_open * * Purpose: Opens (or creates) a file. This function understands the @@ -1542,30 +1546,16 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) tent_flags = flags; if(NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) { - if(tent_flags == flags) { -#ifndef H5_USING_MEMCHECKER - time_t mytime = HDtime(NULL); - - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: time = %s, name = '%s', tent_flags = %x", HDctime(&mytime), name, tent_flags) -#else /* H5_USING_MEMCHECKER */ + if(tent_flags == flags) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x", name, tent_flags) -#endif /* H5_USING_MEMCHECKER */ - } /* end if */ H5E_clear_stack(NULL); tent_flags = flags; - if(NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) { -#ifndef H5_USING_MEMCHECKER - time_t mytime = HDtime(NULL); - - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: time = %s, name = '%s', tent_flags = %x", HDctime(&mytime), name, tent_flags) -#else /* H5_USING_MEMCHECKER */ + if(NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x", name, tent_flags) -#endif /* H5_USING_MEMCHECKER */ - } /* end if */ } /* end if */ /* Is the file already open? */ - if((shared = H5F_sfile_search(lf)) != NULL) { + if((shared = H5F__sfile_search(lf)) != NULL) { /* * The file is already open, so use that one instead of the one we * just opened. We only one one H5FD_t* per file so one doesn't @@ -1621,7 +1611,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Create the 'top' file structure */ if(NULL == (file = H5F__new(NULL, flags, fcpl_id, fapl_id, lf))) { /* If this is the only time the file has been opened and the struct - * returned is NULL, H5FD_close() will never be called via H5F_dest() + * returned is NULL, H5FD_close() will never be called via H5F__dest() * so we have to close lf here before heading to the error handling. */ if(H5FD_close(lf) < 0) @@ -1697,7 +1687,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(H5G_mkroot(file, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group") } /* end if */ - else if (1 == shared->nrefs) { + else if(1 == shared->nrefs) { /* Read the superblock if it hasn't been read before. */ if(H5F__super_read(file, a_plist, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock") @@ -1720,16 +1710,6 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) */ if(H5P_get(a_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file close degree") - - /* This is a private property to clear the status_flags in the super block */ - /* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */ - if(H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) { - if(H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags") - else if(clear) - file->shared->sblock->status_flags = 0; - } /* end if */ - if(shared->nrefs == 1) { if(fc_degree == H5F_CLOSE_DEFAULT) shared->fc_degree = lf->cls->fc_degree; @@ -1743,6 +1723,15 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match") } /* end if */ + /* This is a private property to clear the status_flags in the super block */ + /* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */ + if(H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) { + if(H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags") + else if(clear) + file->shared->sblock->status_flags = 0; + } /* end if */ + /* Record the evict-on-close MDC behavior. If it's the first time opening * the file, set it to access property list value; if it's the second time * or later, verify that the access property list value matches the value @@ -1762,7 +1751,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath") /* Formulate the actual file name, after following symlinks, etc. */ - if(H5F_build_actual_name(file, a_plist, name, &file->actual_name) < 0) + if(H5F__build_actual_name(file, a_plist, name, &file->actual_name) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build actual name") if(set_flag) { @@ -1824,11 +1813,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_flush_phase1 + * Function: H5F_flush_phase1 * - * Purpose: First phase of flushing cached data. + * Purpose: First phase of flushing cached data. + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ static herr_t @@ -1861,11 +1851,12 @@ H5F__flush_phase1(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F__flush_phase2 + * Function: H5F__flush_phase2 * - * Purpose: Second phase of flushing cached data. + * Purpose: Second phase of flushing cached data. + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ static herr_t @@ -1884,13 +1875,14 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache") #ifdef H5_HAVE_PARALLEL - if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { /* Since we just returned from a call to H5AC_flush(), we just * passed through a barrier. Hence we can skip the barrier on * entry to the mpio file driver truncate call below, and the first * barrier in the following call to flush the cache again. */ H5CX_set_mpi_file_flushing(TRUE); + } #endif /* H5_HAVE_PARALLEL */ /* Truncate the file to the current allocated size */ @@ -1929,15 +1921,16 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) /*------------------------------------------------------------------------- - * Function: H5F__flush_real + * Function: H5F__flush * - * Purpose: Flushes cached data. + * Purpose: Flushes cached data. + * + * Return: SUCCEED/FAIL * - * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t -H5F__flush_real(H5F_t *f) +H5F__flush(H5F_t *f) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1957,133 +1950,43 @@ H5F__flush_real(H5F_t *f) HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush file data") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__flush_real() */ - - -/*------------------------------------------------------------------------- - * Function: H5F__flush - * - * Purpose: Internal routine to flush a file. - * - * Note: This routine is needed so that there's a non-API routine for - * flushing files that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * December 13, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5F__flush(H5F_t *f, H5F_scope_t scope) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(f); - HDassert(f->shared); - - /* Flush other files, depending on scope */ - if(H5F_SCOPE_GLOBAL == scope) { - /* Call the flush routine for mounted file hierarchies */ - if(H5F_flush_mounts(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") - } /* end if */ - else - /* Call the flush routine, for this file */ - if(H5F__flush_real(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) } /* end H5F__flush() */ /*------------------------------------------------------------------------- * Function: H5F__close * - * Purpose: Internal routine to close a file. - * - * Note: This routine is needed so that there's a non-API routine for - * closing files that can set up VOL / SWMR info - * (which need a DXPL). + * Purpose: Closes a file or causes the close operation to be pended. + * This function is called two ways: from the API it gets called + * by H5Fclose->H5I_dec_ref->H5F__close when H5I_dec_ref() + * decrements the file ID reference count to zero. The file ID + * is removed from the H5I_FILE group by H5I_dec_ref() just + * before H5F__close() is called. If there are open object + * headers then the close is pended by moving the file to the + * H5I_FILE_CLOSING ID group (the f->closing contains the ID + * assigned to file). * - * Return: Non-negative on success / Negative on failure + * This function is also called directly from H5O_close() when + * the last object header is closed for the file and the file + * has a pending close. * - * Programmer: Quincey Koziol - * December 16, 2017 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5F__close(hid_t file_id) +H5F__close(H5F_t *f) { - H5F_t *f; /* File pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL - - /* Flush file if this is the last reference to this id and we have write - * intent, unless it will be flushed by the "shared" file being closed. - * This is only necessary to replicate previous behaviour, and could be - * disabled by an option/property to improve performance. - */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "invalid file identifier") - if((f->shared->nrefs > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) { - int nref; /* Number of references to file ID */ - - if((nref = H5I_get_ref(file_id, FALSE)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get ID ref count") - if(nref == 1) - if(H5F__flush_real(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cache") - } /* end if */ - - /* Decrement reference count on file ID */ - /* (When it reaches zero the file will be closed) */ - if(H5I_dec_app_ref(file_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "decrementing file ID failed") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5F__close() */ - - -/*------------------------------------------------------------------------- - * Function: H5F__close_cb - * - * Purpose: Closes a file or causes the close operation to be pended. - * This function is called from the API and gets called - * by H5Fclose->H5I_dec_ref->H5F__close_cb when H5I_dec_ref() - * decrements the file ID reference count to zero. The file ID - * is removed from the H5I_FILE group by H5I_dec_ref() just - * before H5F__close_cb() is called. If there are open object - * headers then the close is pended by moving the file to the - * H5I_FILE_CLOSING ID group (the f->closing contains the ID - * assigned to file). - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5F__close_cb(H5F_t *f) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); - HDassert(f->file_id > 0); /* This routine should only be called when a file ID's ref count drops to zero */ /* Perform checks for "semi" file close degree here, since closing the - * file is not allowed if there are objects still open */ + * file is not allowed if there are objects still open. + */ if(f->shared->fc_degree == H5F_CLOSE_SEMI) { unsigned nopen_files = 0; /* Number of open files in file/mount hierarchy */ unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */ @@ -2095,32 +1998,33 @@ H5F__close_cb(H5F_t *f) /* If there are no other file IDs open on this file/mount hier., but * there are still open objects, issue an error and bail out now, * without decrementing the file ID's reference count and triggering - * a "real" attempt at closing the file */ + * a "real" attempt at closing the file. + */ if(nopen_files == 1 && nopen_objs > 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file, there are objects still open") - } /* end if */ + } /* Reset the file ID for this file */ - f->file_id = -1; + f->id_exists = FALSE; /* Attempt to close the file/mount hierarchy */ if(H5F_try_close(f, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5F__close_cb() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__close() */ /*------------------------------------------------------------------------- - * Function: H5F_try_close + * Function: H5F_try_close * - * Purpose: Attempts to close a file due to one of several actions: - * - The reference count on the file ID dropped to zero - * - The last open object was closed in the file - * - The file was unmounted + * Purpose: Attempts to close a file due to one of several actions: + * - The reference count on the file ID dropped to zero + * - The last open object was closed in the file + * - The file was unmounted * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -2151,7 +2055,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) if(was_closed) *was_closed = TRUE; HGOTO_DONE(SUCCEED) - } /* end if */ + } /* Get the number of open objects and open files on this file/mount hierarchy */ if(H5F__mount_count_ids(f, &nopen_files, &nopen_objs) < 0) @@ -2185,7 +2089,8 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) HGOTO_DONE(SUCCEED) /* Sanity check: If close degree if "semi" and we have gotten this - * far and there are objects left open, bail out now */ + * far and there are objects left open, bail out now. + */ HDassert(nopen_files == 0 && nopen_objs == 0); /* If we've gotten this far (ie. there are no open objects in the file), fall through to flush & close */ @@ -2226,9 +2131,9 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) for(u = 0; u < obj_count; u++) if(H5I_dec_ref(objs[u]) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't close object") - } /* end while */ + } if(result < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(1)") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(1)") /* Get the list of IDs of open named datatype objects */ /* (Do this separately from the dataset & attribute IDs, because @@ -2242,7 +2147,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) for(u = 0; u < obj_count; u++) if(H5I_dec_ref(objs[u]) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't close object") - } /* end while */ + } if(result < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(2)") } /* end if */ @@ -2261,17 +2166,18 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) /* If there is more than one reference to the shared file struct and the * file has an external file cache, we should see if it can be closed. This - * can happen if a cycle is formed with external file caches */ + * can happen if a cycle is formed with external file caches. + */ if(f->shared->efc && (f->shared->nrefs > 1)) if(H5F__efc_try_close(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't attempt to close EFC") /* Delay flush until the shared file struct is closed, in H5F__dest. If the * application called H5Fclose, it would have been flushed in that function - * (unless it will have been flushed in H5F_dest anyways). */ + * (unless it will have been flushed in H5F__dest anyways). + */ - /* - * Destroy the H5F_t struct and decrement the reference count for the + /* Destroy the H5F_t struct and decrement the reference count for the * shared H5F_file_t struct. If the reference count for the H5F_file_t * struct reaches zero then destroy it also. */ @@ -2285,18 +2191,57 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_try_close() */ + +/*------------------------------------------------------------------------- + * Function: H5F__reopen + * + * Purpose: Reopen a file. The new file handle which is returned points + * to the same file as the specified file handle. Both handles + * share caches and other information. The only difference + * between the handles is that the new handle is not mounted + * anywhere and no files are mounted on it. + * + * Return: Success: A pointer to a file struct + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5F_t * +H5F__reopen(H5F_t *f) +{ + H5F_t *ret_value = NULL; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Get a new "top level" file struct, sharing the same "low level" file struct */ + if(NULL == (ret_value = H5F__new(f->shared, 0, H5P_FILE_CREATE_DEFAULT, H5P_FILE_ACCESS_DEFAULT, NULL))) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to reopen file") + + /* Duplicate old file's names */ + ret_value->open_name = H5MM_xstrdup(f->open_name); + ret_value->actual_name = H5MM_xstrdup(f->actual_name); + ret_value->extpath = H5MM_xstrdup(f->extpath); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__reopen() */ + /*------------------------------------------------------------------------- - * Function: H5F_get_id + * Function: H5F_get_id * - * Purpose: Get the file ID, incrementing it, or "resurrecting" it as - * appropriate. + * Purpose: Get the file ID, incrementing it, or "resurrecting" it as + * appropriate. + * + * Return: Success: An ID for a file + * + * Failure: H5I_INVALID_HID * - * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ hid_t -H5F_get_id(H5F_t *file, hbool_t app_ref) +H5F_get_id(H5F_t *file) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -2304,31 +2249,30 @@ H5F_get_id(H5F_t *file, hbool_t app_ref) HDassert(file); - if(file->file_id == -1) { - /* Get an atom for the file */ - if((file->file_id = H5I_register(H5I_FILE, file, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file") - } + if(H5I_find_id(file, H5I_FILE, &ret_value) < 0 || H5I_INVALID_HID == ret_value) { + /* resurrect the ID - Register an ID with the native connector */ + if((ret_value = H5VL_wrap_register(H5I_FILE, file, FALSE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + file->id_exists = TRUE; + } /* end if */ else { - /* Increment reference count on atom. */ - if(H5I_inc_ref(file->file_id, app_ref) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed") + /* Increment reference count on existing ID */ + if(H5I_inc_ref(ret_value, FALSE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "incrementing file ID failed") } /* end else */ - ret_value = file->file_id; - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_id() */ /*------------------------------------------------------------------------- - * Function: H5F_incr_nopen_objs + * Function: H5F_incr_nopen_objs * - * Purpose: Increment the number of open objects for a file. + * Purpose: Increment the number of open objects for a file. * - * Return: Success: The number of open objects, after the increment - * Failure: (can't happen) + * Return: Success: The number of open objects, after the increment + * Failure: (can't happen) *------------------------------------------------------------------------- */ unsigned @@ -2344,12 +2288,12 @@ H5F_incr_nopen_objs(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_decr_nopen_objs + * Function: H5F_decr_nopen_objs * - * Purpose: Decrement the number of open objects for a file. + * Purpose: Decrement the number of open objects for a file. * - * Return: Success: The number of open objects, after the decrement - * Failure: (can't happen) + * Return: Success: The number of open objects, after the decrement + * Failure: (can't happen) *------------------------------------------------------------------------- */ unsigned @@ -2365,28 +2309,27 @@ H5F_decr_nopen_objs(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_build_actual_name + * Function: H5F__build_actual_name * - * Purpose: Retrieve the name of a file, after following symlinks, etc. + * Purpose: Retrieve the name of a file, after following symlinks, etc. * - * Note: Currently only working for "POSIX I/O compatible" VFDs + * Note: Currently only working for "POSIX I/O compatible" VFDs * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t -H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, +H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char **actual_name/*out*/) { - hid_t new_fapl_id = -1; /* ID for duplicated FAPL */ + hid_t new_fapl_id = H5I_INVALID_HID; /* ID for duplicated FAPL */ #ifdef H5_HAVE_SYMLINK /* This has to be declared here to avoid unfreed resources on errors */ char *realname = NULL; /* Fully resolved path name of file */ #endif /* H5_HAVE_SYMLINK */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -2483,17 +2426,17 @@ done: #endif /* H5_HAVE_SYMLINK */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5F_build_actual_name() */ +} /* H5F__build_actual_name() */ /*------------------------------------------------------------------------- - * Function: H5F_addr_encode_len + * Function: H5F_addr_encode_len * - * Purpose: Encodes an address into the buffer pointed to by *PP and - * then increments the pointer to the first byte after the - * address. An undefined value is stored as all 1's. + * Purpose: Encodes an address into the buffer pointed to by *PP and + * then increments the pointer to the first byte after the + * address. An undefined value is stored as all 1's. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ void @@ -2524,13 +2467,13 @@ H5F_addr_encode_len(size_t addr_len, uint8_t **pp/*in,out*/, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5F_addr_encode + * Function: H5F_addr_encode * - * Purpose: Encodes an address into the buffer pointed to by *PP and - * then increments the pointer to the first byte after the - * address. An undefined value is stored as all 1's. + * Purpose: Encodes an address into the buffer pointed to by *PP and + * then increments the pointer to the first byte after the + * address. An undefined value is stored as all 1's. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ void @@ -2548,16 +2491,16 @@ H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5F_addr_decode_len + * Function: H5F_addr_decode_len * - * Purpose: Decodes an address from the buffer pointed to by *PP and - * updates the pointer to point to the next byte after the - * address. + * Purpose: Decodes an address from the buffer pointed to by *PP and + * updates the pointer to point to the next byte after the + * address. * - * If the value read is all 1's then the address is returned - * with an undefined value. + * If the value read is all 1's then the address is returned + * with an undefined value. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ void @@ -2612,16 +2555,16 @@ H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr /*------------------------------------------------------------------------- - * Function: H5F_addr_decode + * Function: H5F_addr_decode * - * Purpose: Decodes an address from the buffer pointed to by *PP and - * updates the pointer to point to the next byte after the - * address. + * Purpose: Decodes an address from the buffer pointed to by *PP and + * updates the pointer to point to the next byte after the + * address. * - * If the value read is all 1's then the address is returned - * with an undefined value. + * If the value read is all 1's then the address is returned + * with an undefined value. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ void @@ -2643,8 +2586,7 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o * * Purpose: Set the grp_btree_shared field with a valid ref-count pointer. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2669,8 +2611,7 @@ H5F_set_grp_btree_shared(H5F_t *f, H5UC_t *rc) * * Purpose: Set the sohm_addr field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2694,8 +2635,7 @@ H5F_set_sohm_addr(H5F_t *f, haddr_t addr) * * Purpose: Set the sohm_vers field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2719,8 +2659,7 @@ H5F_set_sohm_vers(H5F_t *f, unsigned vers) * * Purpose: Set the sohm_nindexes field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2744,8 +2683,7 @@ H5F_set_sohm_nindexes(H5F_t *f, unsigned nindexes) * * Purpose: Set the store_msg_crt_idx field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2765,14 +2703,14 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag) /*------------------------------------------------------------------------- - * Function: H5F_set_libver_bounds() + * Function: H5F__set_libver_bounds() * * Purpose: Set the file's low and high bound to the input parameters * 'low' and 'high' respectively. * This is done only if the existing setting is different * from the inputs. * - * Return: SUCCEED on success, and FAIL on failure. + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi; December 2017 * @@ -2783,7 +2721,7 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(f); @@ -2811,49 +2749,17 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high) * * QAK - April, 2018 */ - if(H5F__flush_real(f) < 0) + if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") /* Set the new bounds */ f->shared->low_bound = low; f->shared->high_bound = high; - } /* end if */ + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5F_set_libver_bounds() */ - - -/*------------------------------------------------------------------------- - * Function: H5F__get_freespace - * - * Purpose: Private version of H5Fget_freespace - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: SUCCEED - * Failure: FAIL - *------------------------------------------------------------------------- - */ -herr_t -H5F__get_freespace(H5F_t *f, hsize_t *tot_space) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(f); - HDassert(f->shared); - - /* Go get the actual amount of free space in the file */ - if(H5MF_get_freespace(f, tot_space, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5F__get_freespace() */ +} /* H5F__set_libver_bounds() */ /*------------------------------------------------------------------------- @@ -2861,11 +2767,8 @@ done: * * Purpose: Private version of H5Fget_file_image * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Bytes copied / number of bytes needed. - * Failure: negative value + * Failure: -1 *------------------------------------------------------------------------- */ ssize_t @@ -2875,14 +2778,14 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) haddr_t eoa; /* End of file address */ ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ if(!file || !file->shared || !file->shared->lf) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file_id yields invalid file pointer") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "file_id yields invalid file pointer") fd_ptr = file->shared->lf; if(!fd_ptr->cls) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "fd_ptr yields invalid class pointer") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "fd_ptr yields invalid class pointer") /* the address space used by the split and multi file drivers is not * a good fit for this call. Since the plan is to depreciate these @@ -2903,7 +2806,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) * JRM -- 11/11/22 */ if(HDstrcmp(fd_ptr->cls->name, "multi") == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not supported for multi file driver.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "Not supported for multi file driver.") /* While the family file driver is conceptually fully compatible * with the get file image operation, it sets a file driver message @@ -2925,11 +2828,11 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) * JRM -- 12/21/11 */ if(HDstrcmp(fd_ptr->cls->name, "family") == 0) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "Not supported for family file driver.") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "Not supported for family file driver.") /* Go get the actual file size */ if(HADDR_UNDEF == (eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file size") /* set ret_value = to eoa -- will overwrite this if appropriate */ ret_value = (ssize_t)eoa; @@ -2942,14 +2845,14 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) /* Check for buffer too small */ if((haddr_t)buf_len < eoa) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "supplied buffer too small") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "supplied buffer too small") space_needed = (size_t)eoa; /* read in the file image */ /* (Note compensation for base address addition in internal routine) */ if(H5FD_read(fd_ptr, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "file image read request failed") + HGOTO_ERROR(H5E_FILE, H5E_READERROR, (-1), "file image read request failed") /* Offset to "status_flags" in the superblock */ tmp = H5F_SUPER_STATUS_FLAGS_OFF(file->shared->sblock->super_vers); @@ -2962,7 +2865,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) } /* end if */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__get_file_image() */ @@ -2971,9 +2874,6 @@ done: * * Purpose: Private version of H5Fget_info * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: SUCCEED * Failure: FAIL *------------------------------------------------------------------------- @@ -2983,7 +2883,7 @@ H5F__get_info(H5F_t *f, H5F_info2_t *finfo) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -3012,21 +2912,20 @@ H5F__get_info(H5F_t *f, H5F_info2_t *finfo) finfo->free.version = HDF5_FREESPACE_VERSION; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__get_info() */ /*------------------------------------------------------------------------- - * Function: H5F_track_metadata_read_retries + * Function: H5F_track_metadata_read_retries * - * Purpose: To track the # of a "retries" (log10) for a metadata item. - * This routine should be used only when: - * "retries" > 0 - * f->shared->read_attempts > 1 (does not have retry when 1) - * f->shared->retries_nbins > 0 (calculated based on f->shared->read_attempts) + * Purpose: To track the # of a "retries" (log10) for a metadata item. + * This routine should be used only when: + * "retries" > 0 + * f->shared->read_attempts > 1 (does not have retry when 1) + * f->shared->retries_nbins > 0 (calculated based on f->shared->read_attempts) * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -3065,14 +2964,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_set_retries + * Function: H5F_set_retries * - * Purpose: To initialize data structures for read retries: - * --zero out "retries" - * --set up "retries_nbins" based on read_attempts + * Purpose: To initialize data structures for read retries: + * --zero out "retries" + * --set up "retries_nbins" based on read_attempts * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -3101,39 +2999,6 @@ H5F_set_retries(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F__get_free_sections - * - * Purpose: Private version of H5Fget_free_sections - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: non-negative, the total # of free space sections - * Failure: negative - *------------------------------------------------------------------------- - */ -ssize_t -H5F__get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, - H5F_sect_info_t *sect_info) -{ - ssize_t ret_value = -1; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(f); - HDassert(f->shared); - - /* Go get the actual amount of free space in the file */ - if((ret_value = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free space sections for file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5F__get_free_sections() */ - - -/*------------------------------------------------------------------------- * Function: H5F_object_flush_cb * * Purpose: To invoke the callback function for object flush that is set @@ -3209,6 +3074,7 @@ H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr) HDassert(f->shared); /* Dispatch to driver */ + /* (H5FD_set_eoa() will add base_addr to addr) */ if(H5FD_set_eoa(f->shared->lf, type, addr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") @@ -3246,11 +3112,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__get_max_eof_eoa + * Function: H5F__get_max_eof_eoa * - * Purpose: Determine the maximum of (EOA, EOF) for the file + * Purpose: Determine the maximum of (EOA, EOF) for the file * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -3289,8 +3155,7 @@ done: * * Purpose: Set the coll_md_read field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ void @@ -3310,7 +3175,7 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr) /*------------------------------------------------------------------------- - * Function: H5F__get_metadata_read_retry_info + * Function: H5F_get_metadata_read_retry_info * * Purpose: Private function to retrieve the collection of read retries * for metadata items with checksum. @@ -3320,13 +3185,13 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr) *------------------------------------------------------------------------- */ herr_t -H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) +H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) { unsigned i, j; /* Local index variable */ size_t tot_size; /* Size of each retries[i] */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(FAIL) /* Check args */ HDassert(file); @@ -3339,7 +3204,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) HDmemset(info->retries, 0, sizeof(info->retries)); /* Return if there are no bins -- no retries */ - if (!info->nbins) + if(!info->nbins) HGOTO_DONE(SUCCEED); /* Calculate size for each retries[i] */ @@ -3347,7 +3212,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) /* Map and copy information to info's retries for metadata items with tracking for read retries */ j = 0; - for (i = 0; i < H5AC_NTYPES; i++) { + for(i = 0; i < H5AC_NTYPES; i++) { switch (i) { case H5AC_OHDR_ID: case H5AC_OHDR_CHK_ID: @@ -3371,13 +3236,13 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) case H5AC_FARRAY_DBLK_PAGE_ID: case H5AC_SUPERBLOCK_ID: HDassert(j < H5F_NUM_METADATA_READ_RETRY_TYPES); - if (file->shared->retries[i] != NULL) { + if(file->shared->retries[i] != NULL) { /* Allocate memory for retries[i] * * This memory should be released by the user with * the H5free_memory() call. */ - if (NULL == (info->retries[j] = (uint32_t *)H5MM_malloc(tot_size))) + if(NULL == (info->retries[j] = (uint32_t *)H5MM_malloc(tot_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Copy the information */ @@ -3395,8 +3260,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__get_metadata_read_retry_info() */ - +} /* end H5F_get_metadata_read_retry_info() */ /*------------------------------------------------------------------------- @@ -3423,17 +3287,14 @@ done: * --disallow named datatype with/without attributes * --disallow opened attributes attached to objects * - * Note: Currently, only opened groups and datasets are allowed + * NOTE: Currently, only opened groups and datasets are allowed * when enabling SWMR via H5Fstart_swmr_write(). * Will later implement a different approach-- * set up flush dependency/proxy even for file opened without * SWMR to resolve issues with opened objects. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t @@ -3449,9 +3310,10 @@ H5F__start_swmr_write(H5F_t *f) H5G_name_t *obj_paths = NULL; /* Group hierarchy path */ size_t u; /* Local index variable */ hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */ + H5VL_t *vol_connector = NULL; /* VOL connector for the file */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -3484,20 +3346,20 @@ H5F__start_swmr_write(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock extension") /* Flush data buffers */ - if(H5F__flush_real(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush f's cached information") + if(H5F__flush(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") /* Get the # of opened named datatypes and attributes */ - if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE|H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed") - if(nt_attr_count) + if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE | H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed") + if(nt_attr_count > 0) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "named datatypes and/or attributes opened in the file") /* Get the # of opened datasets and groups */ - if(H5F_get_obj_count(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed") + if(H5F_get_obj_count(f, H5F_OBJ_GROUP | H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed") - if(grp_dset_count) { + if(grp_dset_count > 0) { /* Allocate space for group and object locations */ if((obj_ids = (hid_t *) H5MM_malloc(grp_dset_count * sizeof(hid_t))) == NULL) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for hid_t") @@ -3512,7 +3374,20 @@ H5F__start_swmr_write(H5F_t *f) if(H5F_get_obj_ids(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed") - /* Refresh opened objects (groups, datasets) in the file */ + /* Save the VOL connector and the object wrapping context for the refresh step */ + if(grp_dset_count > 0) { + H5VL_object_t *vol_obj; + + /* Get the VOL object for one of the IDs */ + if(NULL == (vol_obj = H5VL_vol_object(obj_ids[0]))) + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "invalid object identifier") + + /* Get the (top) connector for the ID */ + vol_connector = vol_obj->connector; + } /* end if */ + + /* Gather information about opened objects (groups, datasets) in the file */ + /* (For refresh later on) */ for(u = 0; u < grp_dset_count; u++) { H5O_loc_t *oloc; /* object location */ H5G_loc_t tmp_loc; @@ -3574,7 +3449,7 @@ H5F__start_swmr_write(H5F_t *f) /* Refresh (reopen) the objects (groups & datasets) in the file */ for(u = 0; u < grp_dset_count; u++) - if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], TRUE) < 0) + if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_connector, TRUE) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object") /* Unlock the file */ @@ -3583,7 +3458,6 @@ H5F__start_swmr_write(H5F_t *f) done: if(ret_value < 0 && setup) { - HDassert(f); /* Re-enable accumulator */ f->shared->feature_flags |= (unsigned)H5FD_FEAT_ACCUMULATE_METADATA; @@ -3598,7 +3472,7 @@ done: /* Un-set H5F_ACC_SWMR_WRITE in shared open flags */ f->shared->flags &= ~H5F_ACC_SWMR_WRITE; - /* Unmark the f: not in SWMR writing mode */ + /* Unmark the file: not in SWMR writing mode */ f->shared->sblock->status_flags &= (uint8_t)(~H5F_SUPER_SWMR_WRITE_ACCESS); /* Mark superblock as dirty */ @@ -3620,8 +3494,8 @@ done: if(obj_paths) H5MM_xfree(obj_paths); - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5F__start_swmr_write() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__start_swmr_write() */ /*------------------------------------------------------------------------- @@ -3629,9 +3503,6 @@ done: * * Purpose: Private version of H5Fformat_convert * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: SUCCEED * Failure: FAIL *------------------------------------------------------------------------- @@ -3642,7 +3513,7 @@ H5F__format_convert(H5F_t *f) hbool_t mark_dirty = FALSE; /* Whether to mark the file's superblock dirty */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -3650,41 +3521,217 @@ H5F__format_convert(H5F_t *f) /* Check if the superblock should be downgraded */ if(f->shared->sblock->super_vers > HDF5_SUPERBLOCK_VERSION_V18_LATEST) { - f->shared->sblock->super_vers = HDF5_SUPERBLOCK_VERSION_V18_LATEST; - mark_dirty = TRUE; - } /* end if */ + f->shared->sblock->super_vers = HDF5_SUPERBLOCK_VERSION_V18_LATEST; + mark_dirty = TRUE; + } /* Check for persistent freespace manager, which needs to be downgraded */ if(!(f->shared->fs_strategy == H5F_FILE_SPACE_STRATEGY_DEF && f->shared->fs_persist == H5F_FREE_SPACE_PERSIST_DEF && f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF && f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF)) { - /* Check to remove free-space manager info message from superblock extension */ - if(H5F_addr_defined(f->shared->sblock->ext_addr)) - if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in removing message from superblock extension") - - /* Close freespace manager */ - if(H5MF_try_close(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to free free-space address") - - /* Set non-persistent freespace manager */ - f->shared->fs_strategy = H5F_FILE_SPACE_STRATEGY_DEF; - f->shared->fs_persist = H5F_FREE_SPACE_PERSIST_DEF; - f->shared->fs_threshold = H5F_FREE_SPACE_THRESHOLD_DEF; - f->shared->fs_page_size = H5F_FILE_SPACE_PAGE_SIZE_DEF; - - /* Indicate that the superblock should be marked dirty */ - mark_dirty = TRUE; + + /* Check to remove free-space manager info message from superblock extension */ + if(H5F_addr_defined(f->shared->sblock->ext_addr)) + if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in removing message from superblock extension") + + /* Close freespace manager */ + if(H5MF_try_close(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to free free-space address") + + /* Set non-persistent freespace manager */ + f->shared->fs_strategy = H5F_FILE_SPACE_STRATEGY_DEF; + f->shared->fs_persist = H5F_FREE_SPACE_PERSIST_DEF; + f->shared->fs_threshold = H5F_FREE_SPACE_THRESHOLD_DEF; + f->shared->fs_page_size = H5F_FILE_SPACE_PAGE_SIZE_DEF; + + /* Indicate that the superblock should be marked dirty */ + mark_dirty = TRUE; } /* end if */ /* Check if we should mark the superblock dirty */ if(mark_dirty) - /* Mark superblock as dirty */ - if(H5F_super_dirty(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") + /* Mark superblock as dirty */ + if(H5F_super_dirty(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__format_convert() */ + +/*--------------------------------------------------------------------------- + * Function: H5F__get_file + * + * Purpose: Utility routine to get file struct for an object + * + * Returns: SUCCESS: A pointer to the H5F_t struct for the file + * associated with the object. + * FAILURE: NULL + * + *--------------------------------------------------------------------------- + */ +H5F_t * +H5F__get_file(void *obj, H5I_type_t type) +{ + H5F_t *ret_value = NULL; /* File pointer */ + H5O_loc_t *oloc = NULL; /* Object location for ID */ + + FUNC_ENTER_PACKAGE + + switch(type) { + case H5I_FILE: + ret_value = (H5F_t *)obj; + break; + + case H5I_GROUP: + oloc = H5G_oloc((H5G_t *)obj); + break; + + case H5I_DATATYPE: + oloc = H5T_oloc((H5T_t *)obj); + break; + + case H5I_DATASET: + oloc = H5D_oloc((H5D_t *)obj); + break; + + case H5I_ATTR: + oloc = H5A_oloc((H5A_t *)obj); + break; + + case H5I_UNINIT: + case H5I_BADID: + case H5I_DATASPACE: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_VOL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + } /* end switch */ + + /* Set return value for objects (not files) */ + if(oloc) + ret_value = oloc->file; + + /* Couldn't find a file struct */ + if(!ret_value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "object is not associated with a file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F__get_file */ + + +/*------------------------------------------------------------------------- + * Function: H5F__get_file_id + * + * Purpose: The package version of H5Iget_file_id(), obtains the file + * ID given an object ID. + * + * Return: Success: The file ID associated with the object + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5F__get_file_id(H5F_t *file) +{ + hid_t file_id = H5I_INVALID_HID; /* File ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check if the file's ID already exists */ + if(H5I_find_id(file, H5I_FILE, &file_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed") + + /* If the ID does not exist, register it with the VOL connector */ + if(H5I_INVALID_HID == file_id) { + if((file_id = H5VL_wrap_register(H5I_FILE, file, TRUE)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + file->id_exists = TRUE; + } /* end if */ + else { + /* Increment ref count on existing ID */ + if(H5I_inc_ref(file_id, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") + } /* end else */ + + /* Set return value */ + ret_value = file_id; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__get_file_id() */ + + +/*------------------------------------------------------------------------- + * Function: H5F_get_file_id + * + * Purpose: The private version of H5Iget_file_id(), obtains the file + * ID given an object ID. + * + * Return: Success: The file ID associated with the object + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5F_get_file_id(hid_t obj_id, H5I_type_t type) +{ + H5VL_object_t *vol_obj; /* File info */ + hid_t file_id = H5I_INVALID_HID; /* File ID for object */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Get the object pointer */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") + + /* Get the file through the VOL */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_ID, type, &file_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file ID") + if(H5I_INVALID_HID == file_id) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file ID through the VOL") + + /* Set return value */ + ret_value = file_id; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_get_file_id() */ + + + +/*------------------------------------------------------------------------- + * Function: H5F_set_min_dset_ohdr + * + * Purpose: Set the crt_dset_ohdr_flag field with a new value. + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +herr_t +H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(f); + HDassert(f->shared); + + f->shared->crt_dset_min_ohdr_flag = minimize; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5F_set_min_dset_ohdr() */ + diff --git a/src/H5Fio.c b/src/H5Fio.c index 830b7ee..69e6bb2 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -92,8 +92,7 @@ *------------------------------------------------------------------------- */ herr_t -H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, - void *buf/*out*/) +H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) { H5FD_mem_t map_type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ @@ -138,8 +137,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, - const void *buf) +H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { H5FD_mem_t map_type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 4cd1edf..d7f8915 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -24,6 +24,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /* PRIVATE PROTOTYPES */ static void H5F__mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs); @@ -112,7 +113,7 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED H5G_loc_t root_loc; /* Group location of root of file to mount */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(loc); HDassert(name && *name); @@ -132,7 +133,7 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED */ if(child->parent) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "file is already mounted") - if(H5G_loc_find(loc, name, &mp_loc/*out*/) < 0) + if(H5G_loc_find(loc, name, &mp_loc) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") /* If the mount location is holding its file open, that file will close * and remove the mount as soon as we exit this function. Prevent the @@ -240,7 +241,7 @@ done: } } - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__mount() */ @@ -277,7 +278,7 @@ H5F__unmount(H5G_loc_t *loc, const char *name) int child_idx; /* Index of child in parent's mtab */ herr_t ret_value = SUCCEED; /*return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(loc); HDassert(name && *name); @@ -390,7 +391,7 @@ done: if(mp_loc_setup) H5G_loc_free(&mp_loc); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__unmount() */ @@ -438,8 +439,8 @@ H5F_is_mount(const H5F_t *file) herr_t H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) { - H5G_loc_t loc; /* Parent location */ - H5F_t *child = NULL; /* Child object */ + H5VL_object_t *loc_vol_obj = NULL; /* Parent object */ + H5VL_object_t *child_vol_obj = NULL; /* Child object */ H5I_type_t loc_type; /* ID type of location */ H5I_type_t child_type; /* ID type of child */ herr_t ret_value = SUCCEED; /* Return value */ @@ -462,22 +463,26 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) plist_id = H5P_FILE_MOUNT_DEFAULT; else if(TRUE != H5P_isa_class(plist_id, H5P_FILE_MOUNT)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a file mount property list ID") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Get the location object */ - if(H5G_loc(loc_id, &loc) < 0) + if(NULL == (loc_vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object") /* Get the child object */ - if(NULL == (child = (H5F_t *)H5I_object_verify(child_id, H5I_FILE))) + if(NULL == (child_vol_obj = (H5VL_object_t *)H5I_object(child_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object") + /* Check if both objects are associated with the same VOL connector */ + if(loc_vol_obj->connector->cls->value != child_vol_obj->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL connector") + /* Perform the mount operation */ - if(H5F__mount(&loc, name, child, plist_id) < 0) + if(H5VL_file_specific(loc_vol_obj, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name, child_vol_obj->data, plist_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") done: @@ -504,7 +509,7 @@ done: herr_t H5Funmount(hid_t loc_id, const char *name) { - H5G_loc_t loc; /* Parent location */ + H5VL_object_t *vol_obj = NULL; /* Parent object */ H5I_type_t loc_type; /* ID type of location */ herr_t ret_value = SUCCEED; /* Return value */ @@ -525,11 +530,11 @@ H5Funmount(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Get the location object */ - if(H5G_loc(loc_id, &loc) < 0) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object") /* Perform the unmount operation */ - if(H5F__unmount(&loc, name) < 0) + if(H5VL_file_specific(vol_obj, H5VL_FILE_UNMOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") done: @@ -563,7 +568,7 @@ H5F__mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_ob HDassert(nopen_objs); /* If this file is still open, increment number of file IDs open */ - if(f->file_id > 0) + if(H5F_ID_EXISTS(f)) *nopen_files += 1; /* Increment number of open objects in file @@ -651,7 +656,7 @@ H5F_flush_mounts_recurse(H5F_t *f) nerrors++; /* Call the "real" flush routine, for this file */ - if(H5F__flush_real(f) < 0) + if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") /* Check flush errors for children - errors are already on the stack */ diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index f854d3b..6ddbfbb 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -231,7 +231,7 @@ H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag) H5TRACE2("e", "ib", file_id, flag); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Check VFD */ @@ -271,7 +271,7 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag) H5TRACE2("e", "i*b", file_id, flag); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Check VFD */ @@ -320,11 +320,11 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) attached to the loc_id */ if(H5I_INVALID_HID != loc_id) { H5G_loc_t loc; - H5F_t *f; + H5F_t *f = NULL; /* Retrieve the file structure */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") f = loc.oloc->file; HDassert(f); @@ -333,8 +333,8 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) /* retrieve the file communicator */ if(MPI_COMM_NULL == (*mpi_comm = H5F_mpi_get_comm(f))) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator") - } /* end if */ - } /* end if */ + } + } /* otherwise, this is from H5Fopen or H5Fcreate and has to be collective */ else { H5P_genplist_t *plist; /* Property list pointer */ @@ -349,8 +349,8 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad VFL driver info") *mpi_comm = fa->comm; - } /* end if */ - } /* end else */ + } + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index edbd460..266ae6e 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -30,11 +30,12 @@ #include "H5Fprivate.h" /* Other public headers needed by this file */ -#include "H5Bpublic.h" /* B-tree header, for H5B_NUM_BTREE_ID */ +#include "H5VLpublic.h" /* Virtual Object Layer */ /* Other private headers needed by this file */ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ +#include "H5Bprivate.h" /* B-trees */ #include "H5FLprivate.h" /* Free Lists */ #include "H5FOprivate.h" /* File objects */ #include "H5FSprivate.h" /* File free space */ @@ -291,7 +292,7 @@ struct H5F_file_t { /* begin on file access/create */ char *mdc_log_location; /* location of mdc log */ hid_t fcpl_id; /* File creation property list ID */ - H5F_close_degree_t fc_degree; /* File close behavior degree */ + H5F_close_degree_t fc_degree; /* File close behavior degree */ hbool_t evict_on_close; /* If the file's objects should be evicted from the metadata cache on close */ size_t rdcc_nslots; /* Size of raw data chunk cache (slots) */ size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */ @@ -309,6 +310,10 @@ struct H5F_file_t { H5FO_t *open_objs; /* Open objects in file */ H5UC_t *grp_btree_shared; /* Ref-counted group B-tree node info */ + /* Cached VOL connector ID & info */ + hid_t vol_id; /* ID of VOL connector for the container */ + void *vol_info; /* Copy of VOL connector info for container */ + /* File space allocation information */ H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */ hsize_t fs_threshold; /* Free space section threshold */ @@ -325,7 +330,7 @@ struct H5F_file_t { /* been used accessed for either */ /* allocation or deallocation */ /* since file open. */ - haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */ + haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */ /* for self referential FSMs */ haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */ /* for self referential FSMs */ @@ -368,7 +373,7 @@ struct H5F_t { H5F_file_t *shared; /* The shared file info */ unsigned nopen_objs; /* Number of open object headers */ H5FO_t *obj_count; /* # of time each object is opened through top file structure */ - hid_t file_id; /* ID of this file */ + hbool_t id_exists; /* Whether an ID for this struct exists */ hbool_t closing; /* File is in the process of being closed */ struct H5F_t *parent; /* Parent file that this file is mounted to */ unsigned nmounts; /* Number of children mounted to this file */ @@ -378,6 +383,36 @@ struct H5F_t { #endif /* H5_HAVE_PARALLEL */ }; +/* types for file optional VOL operations */ +typedef enum H5VL_file_optional_t { + H5VL_FILE_CLEAR_ELINK_CACHE, /* Clear external link cache */ + H5VL_FILE_GET_FILE_IMAGE, /* file image */ + H5VL_FILE_GET_FREE_SECTIONS, /* file free selections */ + H5VL_FILE_GET_FREE_SPACE, /* file freespace */ + H5VL_FILE_GET_INFO, /* file info */ + H5VL_FILE_GET_MDC_CONF, /* file metadata cache configuration */ + H5VL_FILE_GET_MDC_HR, /* file metadata cache hit rate */ + H5VL_FILE_GET_MDC_SIZE, /* file metadata cache size */ + H5VL_FILE_GET_SIZE, /* file size */ + H5VL_FILE_GET_VFD_HANDLE, /* file VFD handle */ + H5VL_FILE_GET_FILE_ID, /* retrieve or resurrect file ID of object */ + H5VL_FILE_RESET_MDC_HIT_RATE, /* get metadata cache hit rate */ + H5VL_FILE_SET_MDC_CONFIG, /* set metadata cache configuration */ + H5VL_FILE_GET_METADATA_READ_RETRY_INFO, + H5VL_FILE_START_SWMR_WRITE, + H5VL_FILE_START_MDC_LOGGING, + H5VL_FILE_STOP_MDC_LOGGING, + H5VL_FILE_GET_MDC_LOGGING_STATUS, + H5VL_FILE_FORMAT_CONVERT, + H5VL_FILE_RESET_PAGE_BUFFERING_STATS, + H5VL_FILE_GET_PAGE_BUFFERING_STATS, + H5VL_FILE_GET_MDC_IMAGE_INFO, + H5VL_FILE_GET_EOA, + H5VL_FILE_INCR_FILESIZE, + H5VL_FILE_SET_LIBVER_BOUNDS, + H5VL_FILE_SET_MIN_DSET_OHDR_FLAG +} H5VL_file_optional_t; + /*****************************/ /* Package Private Variables */ @@ -395,24 +430,19 @@ H5FL_EXTERN(H5F_file_t); /******************************/ /* General routines */ -H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); +H5_DLL H5F_t *H5F__reopen(H5F_t *f); H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush); -H5_DLL H5F_t *H5F__create(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id); -H5_DLL H5F_t *H5F__open(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id); -H5_DLL herr_t H5F__flush(H5F_t *f, H5F_scope_t scope); -H5_DLL herr_t H5F__flush_real(H5F_t *f); -H5_DLL htri_t H5F__is_hdf5(const char *name); -H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); -H5_DLL herr_t H5F__get_freespace(H5F_t *f, hsize_t *tot_space); +H5_DLL herr_t H5F__flush(H5F_t *f); +H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t fapl_id); H5_DLL ssize_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len); H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo); -H5_DLL ssize_t H5F__get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info); -H5_DLL herr_t H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info); H5_DLL herr_t H5F__format_convert(H5F_t *f); H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); -H5_DLL herr_t H5F__close(hid_t file_id); -H5_DLL herr_t H5F__close_cb(H5F_t *f); +H5_DLL herr_t H5F__close(H5F_t *f); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); +H5_DLL H5F_t *H5F__get_file(void *obj, H5I_type_t type); +H5_DLL hid_t H5F__get_file_id(H5F_t *file); +H5_DLL herr_t H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info); /* File mount related routines */ H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id); @@ -427,7 +457,7 @@ H5_DLL herr_t H5F__super_size(H5F_t *f, hsize_t *super_size, hsize_t *super_ext_ H5_DLL herr_t H5F__super_free(H5F_super_t *sblock); /* Superblock extension related routines */ -H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr); +H5_DLL herr_t H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr); H5_DLL herr_t H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, hbool_t may_create, unsigned mesg_flags); H5_DLL herr_t H5F__super_ext_remove_msg(H5F_t *f, unsigned id); H5_DLL herr_t H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created); @@ -440,9 +470,9 @@ H5_DLL herr_t H5F__accum_flush(H5F_t *f); H5_DLL herr_t H5F__accum_reset(H5F_t *f, hbool_t flush); /* Shared file list related routines */ -H5_DLL herr_t H5F_sfile_add(H5F_file_t *shared); -H5_DLL H5F_file_t * H5F_sfile_search(H5FD_t *lf); -H5_DLL herr_t H5F_sfile_remove(H5F_file_t *shared); +H5_DLL herr_t H5F__sfile_add(H5F_file_t *shared); +H5_DLL H5F_file_t *H5F__sfile_search(H5FD_t *lf); +H5_DLL herr_t H5F__sfile_remove(H5F_file_t *shared); /* External file cache routines */ H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles); @@ -468,10 +498,11 @@ H5_DLL herr_t H5F__evict_cache_entries(H5F_t *f); /* Testing functions */ #ifdef H5F_TESTING -H5_DLL herr_t H5F_get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t *mesg_count); -H5_DLL herr_t H5F_check_cached_stab_test(hid_t file_id); -H5_DLL herr_t H5F_get_maxaddr_test(hid_t file_id, haddr_t *maxaddr); -H5_DLL herr_t H5F_get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr); +H5_DLL herr_t H5F__get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t *mesg_count); +H5_DLL herr_t H5F__check_cached_stab_test(hid_t file_id); +H5_DLL herr_t H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr); +H5_DLL herr_t H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr); +H5_DLL htri_t H5F__same_file_test(hid_t file_id1, hid_t file_id2); #endif /* H5F_TESTING */ #endif /* _H5Fpkg_H */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 5d0c11a..f728200 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -286,7 +286,7 @@ typedef struct H5F_t H5F_t; #define H5F_NOPEN_OBJS(F) ((F)->nopen_objs) #define H5F_INCR_NOPEN_OBJS(F) ((F)->nopen_objs++) #define H5F_DECR_NOPEN_OBJS(F) ((F)->nopen_objs--) -#define H5F_FILE_ID(F) ((F)->file_id) +#define H5F_ID_EXISTS(F) ((F)->id_exists) #define H5F_PARENT(F) ((F)->parent) #define H5F_NMOUNTS(F) ((F)->nmounts) #define H5F_GET_READ_ATTEMPTS(F) ((F)->shared->read_attempts) @@ -332,6 +332,7 @@ typedef struct H5F_t H5F_t; #define H5F_FIRST_ALLOC_DEALLOC(F) ((F)->shared->first_alloc_dealloc) #define H5F_EOA_PRE_FSM_FSALLOC(F) ((F)->shared->eoa_pre_fsm_fsalloc) #define H5F_MIN_DSET_OHDR(F) ((F)->shared->crt_dset_min_ohdr_flag) +#define H5F_SET_MIN_DSET_OHDR(F, V) ((F)->shared->crt_dset_min_ohdr_flag = (V)) #else /* H5F_MODULE */ #define H5F_LOW_BOUND(F) (H5F_get_low_bound(F)) #define H5F_HIGH_BOUND(F) (H5F_get_high_bound(F)) @@ -344,7 +345,7 @@ typedef struct H5F_t H5F_t; #define H5F_NOPEN_OBJS(F) (H5F_get_nopen_objs(F)) #define H5F_INCR_NOPEN_OBJS(F) (H5F_incr_nopen_objs(F)) #define H5F_DECR_NOPEN_OBJS(F) (H5F_decr_nopen_objs(F)) -#define H5F_FILE_ID(F) (H5F_get_file_id(F)) +#define H5F_ID_EXISTS(F) (H5F_file_id_exists(F)) #define H5F_PARENT(F) (H5F_get_parent(F)) #define H5F_NMOUNTS(F) (H5F_get_nmounts(F)) #define H5F_GET_READ_ATTEMPTS(F) (H5F_get_read_attempts(F)) @@ -390,6 +391,7 @@ typedef struct H5F_t H5F_t; #define H5F_FIRST_ALLOC_DEALLOC(F) (H5F_get_first_alloc_dealloc(F)) #define H5F_EOA_PRE_FSM_FSALLOC(F) (H5F_get_eoa_pre_fsm_fsalloc(F)) #define H5F_MIN_DSET_OHDR(F) (H5F_get_min_dset_ohdr(F)) +#define H5F_SET_MIN_DSET_OHDR(F) (H5F_get_min_dset_ohdr((F), (V))) #endif /* H5F_MODULE */ @@ -481,10 +483,11 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_SDATA_BLOCK_SIZE_NAME "sdata_block_size" /* Minimum "small data" allocation block size (when aggregating "small" raw data allocations) */ #define H5F_ACS_GARBG_COLCT_REF_NAME "gc_ref" /* Garbage-collect references */ #define H5F_ACS_FILE_DRV_NAME "vfd_info" /* File driver ID & info */ +#define H5F_ACS_VOL_CONN_NAME "vol_connector_info" /* VOL connector ID & info */ #define H5F_ACS_CLOSE_DEGREE_NAME "close_degree" /* File close degree */ #define H5F_ACS_FAMILY_OFFSET_NAME "family_offset" /* Offset position in file for family file driver */ #define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */ -#define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2" /* Whether to convert family to sec2 driver. (private property only used by h5repart) */ +#define H5F_ACS_FAMILY_TO_SINGLE_NAME "family_to_single" /* Whether to convert family to a single-file driver. (private property only used by h5repart) */ #define H5F_ACS_MULTI_TYPE_NAME "multi_type" /* Data type in multi file driver */ #define H5F_ACS_LIBVER_LOW_BOUND_NAME "libver_low_bound" /* 'low' bound of library format versions */ #define H5F_ACS_LIBVER_HIGH_BOUND_NAME "libver_high_bound" /* 'high' bound of library format versions */ @@ -717,7 +720,7 @@ typedef enum H5F_prefix_open_t { /* Private functions */ H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/); -H5_DLL herr_t H5F_start_swmr_write(H5F_t *file); +H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type); /* Functions that retrieve values from the file struct */ H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f); @@ -731,12 +734,12 @@ H5_DLL hbool_t H5F_same_shared(const H5F_t *f1, const H5F_t *f2); H5_DLL unsigned H5F_get_nopen_objs(const H5F_t *f); H5_DLL unsigned H5F_incr_nopen_objs(H5F_t *f); H5_DLL unsigned H5F_decr_nopen_objs(H5F_t *f); -H5_DLL hid_t H5F_get_file_id(const H5F_t *f); +H5_DLL hbool_t H5F_file_id_exists(const H5F_t *f); H5_DLL H5F_t *H5F_get_parent(const H5F_t *f); H5_DLL unsigned H5F_get_nmounts(const H5F_t *f); H5_DLL unsigned H5F_get_read_attempts(const H5F_t *f); H5_DLL hid_t H5F_get_access_plist(H5F_t *f, hbool_t app_ref); -H5_DLL hid_t H5F_get_id(H5F_t *file, hbool_t app_ref); +H5_DLL hid_t H5F_get_id(H5F_t *file); H5_DLL herr_t H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_id_count_ptr); H5_DLL herr_t H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list, hbool_t app_ref, size_t *obj_id_count_ptr); H5_DLL hsize_t H5F_get_pgend_meta_thres(const H5F_t *f); @@ -766,7 +769,6 @@ H5_DLL size_t H5F_rdcc_nslots(const H5F_t *f); H5_DLL double H5F_rdcc_w0(const H5F_t *f); H5_DLL size_t H5F_sieve_buf_size(const H5F_t *f); H5_DLL unsigned H5F_gc_ref(const H5F_t *f); -H5_DLL unsigned H5F_use_latest_flags(const H5F_t *f, unsigned fl); H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f); H5_DLL herr_t H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag); H5_DLL struct H5UC_t *H5F_grp_btree_shared(const H5F_t *f); @@ -782,6 +784,7 @@ H5_DLL void H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t flag); H5_DLL hbool_t H5F_use_mdc_logging(const H5F_t *f); H5_DLL hbool_t H5F_start_mdc_log_on_access(const H5F_t *f); H5_DLL char *H5F_mdc_log_location(const H5F_t *f); +H5_DLL herr_t H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize); /* Functions that retrieve values from VFD layer */ H5_DLL hid_t H5F_get_driver_id(const H5F_t *f); @@ -802,7 +805,7 @@ H5_DLL herr_t H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t si /* Functions that flush or evict */ H5_DLL herr_t H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag); -H5_DLL herr_t H5F_evict_tagged_metadata(H5F_t * f, haddr_t tag); +H5_DLL herr_t H5F_evict_tagged_metadata(H5F_t *f, haddr_t tag); /* Functions that verify a piece of metadata with checksum */ H5_DLL herr_t H5F_get_checksums(const uint8_t *buf, size_t chk_size, uint32_t *s_chksum, uint32_t *c_chksum); @@ -810,6 +813,7 @@ H5_DLL herr_t H5F_get_checksums(const uint8_t *buf, size_t chk_size, uint32_t *s /* Routine to track the # of retries */ H5_DLL herr_t H5F_track_metadata_read_retries(H5F_t *f, unsigned actype, unsigned retries); H5_DLL herr_t H5F_set_retries(H5F_t *f); +H5_DLL herr_t H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info); /* Routine to invoke callback function upon object flush */ H5_DLL herr_t H5F_object_flush_cb(H5F_t *f, hid_t obj_id); diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 6274eb0..e79a147 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -223,7 +223,7 @@ extern "C" { #endif /* Functions in H5F.c */ -H5_DLL htri_t H5Fis_hdf5(const char *filename); +H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id); H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags, hid_t create_plist, hid_t access_plist); H5_DLL hid_t H5Fopen(const char *filename, unsigned flags, @@ -305,6 +305,7 @@ typedef struct H5F_info1_t { /* Function prototypes */ H5_DLL herr_t H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo); H5_DLL herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format); +H5_DLL htri_t H5Fis_hdf5(const char *filename); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Fquery.c b/src/H5Fquery.c index e02e402..103ad3b 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -277,23 +277,23 @@ H5F_get_nopen_objs(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_file_id + * Function: H5F_file_id_exists * - * Purpose: Retrieve the file's 'file_id' value + * Purpose: Determines if a file ID exists for this file struct * - * Return: 'file_id' on success/abort on failure (shouldn't fail) + * Return: TRUE/FALSE *------------------------------------------------------------------------- */ -hid_t -H5F_get_file_id(const H5F_t *f) +hbool_t +H5F_file_id_exists(const H5F_t *f) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR HDassert(f); - FUNC_LEAVE_NOAPI(f->file_id) -} /* end H5F_get_file_id() */ + FUNC_LEAVE_NOAPI(f->id_exists) +} /* end H5F_file_id_exists() */ /*------------------------------------------------------------------------- @@ -923,7 +923,7 @@ H5F_get_eoa(const H5F_t *f, H5FD_mem_t type) /* Dispatch to driver */ if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f->shared->lf, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c index e0c830b..ebc2ab2 100644 --- a/src/H5Fsfile.c +++ b/src/H5Fsfile.c @@ -40,11 +40,11 @@ H5F_sfile_node_t *H5F_sfile_head_g = NULL; /*------------------------------------------------------------------------- - * Function: H5F_sfile_assert_num + * Function: H5F_sfile_assert_num * - * Purpose: Sanity checking that shared file list is empty + * Purpose: Sanity checking that shared file list is empty * - * Return: none (void) + * Return: void * * Programmer: Quincey Koziol * Monday, July 25, 2005 @@ -84,33 +84,31 @@ H5F_sfile_assert_num(unsigned n) /*------------------------------------------------------------------------- - * Function: H5F_sfile_add + * Function: H5F__sfile_add * - * Purpose: Add a "shared" file struct to the list of open files + * Purpose: Add a "shared" file struct to the list of open files * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, July 18, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5F_sfile_add(H5F_file_t *shared) +H5F__sfile_add(H5F_file_t *shared) { H5F_sfile_node_t *new_shared; /* New shared file node */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(shared); /* Allocate new shared file node */ if (NULL == (new_shared = H5FL_CALLOC(H5F_sfile_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Set shared file value */ new_shared->shared = shared; @@ -121,31 +119,29 @@ H5F_sfile_add(H5F_file_t *shared) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_sfile_add() */ +} /* end H5F__sfile_add() */ /*------------------------------------------------------------------------- - * Function: H5F_sfile_search + * Function: H5F__sfile_search * - * Purpose: Search for a "shared" file with low-level file info that + * Purpose: Search for a "shared" file with low-level file info that * matches * - * Return: Non-NULL on success / NULL on failure + * Return: Non-NULL on success / NULL on failure * * Programmer: Quincey Koziol * Monday, July 18, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ H5F_file_t * -H5F_sfile_search(H5FD_t *lf) +H5F__sfile_search(H5FD_t *lf) { H5F_sfile_node_t *curr; /* Current shared file node */ H5F_file_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(lf); @@ -154,7 +150,7 @@ H5F_sfile_search(H5FD_t *lf) curr = H5F_sfile_head_g; while(curr) { /* Check for match */ - if(0==H5FD_cmp(curr->shared->lf, lf)) + if(0 == H5FD_cmp(curr->shared->lf, lf)) HGOTO_DONE(curr->shared) /* Advance to next shared file node */ @@ -163,31 +159,29 @@ H5F_sfile_search(H5FD_t *lf) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_sfile_search() */ +} /* end H5F__sfile_search() */ /*------------------------------------------------------------------------- - * Function: H5F_sfile_remove + * Function: H5F__sfile_remove * - * Purpose: Remove a "shared" file struct from the list of open files + * Purpose: Remove a "shared" file struct from the list of open files * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, July 18, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5F_sfile_remove(H5F_file_t *shared) +H5F__sfile_remove(H5F_file_t *shared) { H5F_sfile_node_t *curr; /* Current shared file node */ H5F_sfile_node_t *last; /* Last shared file node */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(shared); @@ -203,7 +197,7 @@ H5F_sfile_remove(H5F_file_t *shared) /* Indicate error if the node wasn't found */ if(curr == NULL) - HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "can't find shared file info") + HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "can't find shared file info") /* Remove node found from list */ if(last != NULL) @@ -219,5 +213,5 @@ H5F_sfile_remove(H5F_file_t *shared) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_sfile_remove() */ +} /* end H5F__sfile_remove() */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 9339b3d..489cc21 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -134,7 +134,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_super_ext_open + * Function: H5F__super_ext_open * * Purpose: Open an existing superblock extension * @@ -146,11 +146,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr) +H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -168,7 +168,7 @@ H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5F_super_ext_open() */ +} /* H5F__super_ext_open() */ /*------------------------------------------------------------------------- @@ -398,7 +398,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result) } /* end if */ else { - /* Locate the signature as per per the serial library */ + /* Locate the signature as per per the serial library */ #endif /* H5_HAVE_PARALLEL */ if(H5FD_locate_signature(file, &super_addr) < 0) @@ -705,7 +705,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) } /* end if */ /* Open the superblock extension */ - if(H5F_super_ext_open(f, sblock->ext_addr, &ext_loc) < 0) + if(H5F__super_ext_open(f, sblock->ext_addr, &ext_loc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension") /* Check for the extension having a 'driver info' message */ @@ -836,7 +836,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if(!skip_eof_check && !null_fsm_addr) { HDassert((!f->shared->fs_persist) || (f->shared->eoa_pre_fsm_fsalloc != HADDR_UNDEF)); HDassert(!f->shared->first_alloc_dealloc); - } /* end if */ + } /* As "eoa_pre_fsm_fsalloc" may be undefined for a crashed file * with persistent free space managers, therefore, set @@ -882,14 +882,14 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if(null_fsm_addr) { if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension") - } /* end if */ + } else { if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTDELETE, FAIL, "error in removing message from superblock extension") if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, TRUE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension") - } /* end else */ + } #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ f->shared->sblock = NULL; #endif /* JRM */ @@ -962,20 +962,20 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Write driver info information to the superblock extension */ #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ - /* KLUGE ALERT!! - * - * H5F__super_ext_write_msg() expects f->shared->sblock to - * be set -- verify that it is NULL, and then set it. - * Set it back to NULL when we are done. - */ - HDassert(f->shared->sblock == NULL); - f->shared->sblock = sblock; + /* KLUGE ALERT!! + * + * H5F__super_ext_write_msg() expects f->shared->sblock to + * be set -- verify that it is NULL, and then set it. + * Set it back to NULL when we are done. + */ + HDassert(f->shared->sblock == NULL); + f->shared->sblock = sblock; #endif /* JRM */ - if(H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0) + if(H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension") #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ - f->shared->sblock = NULL; + f->shared->sblock = NULL; #endif /* JRM */ } /* end if */ @@ -1320,10 +1320,11 @@ H5F__super_init(H5F_t *f) /* Create the Shared Object Header Message table and register it with * the metadata cache, if this file supports shared messages. */ - if(f->shared->sohm_nindexes > 0) + if(f->shared->sohm_nindexes > 0) { /* Initialize the shared message code & write the SOHM message to the extension */ if(H5SM_init(f, plist, &ext_loc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create SOHM table") + } /* Check for non-default v1 B-tree 'K' values to store */ if(sblock->btree_k[H5B_SNODE_ID] != HDF5_BTREE_SNODE_IK_DEF || @@ -1503,9 +1504,10 @@ H5F_eoa_dirty(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo as dirty") } /* end if */ /* If the driver info is stored as a message, update that instead */ - else if(f->shared->drvinfo_sb_msg_exists) + else if(f->shared->drvinfo_sb_msg_exists) { if(H5F__update_super_ext_driver_msg(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo message as dirty") + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1676,13 +1678,13 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, /* Open/create the superblock extension object header */ if(H5F_addr_defined(f->shared->sblock->ext_addr)) { - if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) + if(H5F__super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension") } /* end if */ else { HDassert(may_create); - if(H5F__super_ext_create(f, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension") + if(H5F__super_ext_create(f, &ext_loc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension") ext_created = TRUE; } /* end else */ HDassert(H5F_addr_defined(ext_loc.addr)); @@ -1690,24 +1692,24 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, /* Check if message with ID does not exist in the object header */ if((status = H5O_msg_exists(&ext_loc, id)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check object header for message or message exists") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check object header for message or message exists") /* Check for creating vs. writing */ if(may_create) { if(status) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should not exist") - /* Create the message with ID in the superblock extension */ - if(H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header") + /* Create the message with ID in the superblock extension */ + if(H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header") } /* end if */ else { if(!status) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should exist") - /* Update the message with ID in the superblock extension */ - if(H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header") + /* Update the message with ID in the superblock extension */ + if(H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header") } /* end else */ done: @@ -1757,35 +1759,36 @@ H5F__super_ext_remove_msg(H5F_t *f, unsigned id) H5AC_set_ring(H5AC_RING_SBE, &orig_ring); /* Open superblock extension object header */ - if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension") + if(H5F__super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension") ext_opened = TRUE; /* Check if message with ID exists in the object header */ if((status = H5O_msg_exists(&ext_loc, id)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message") - else if(status) { /* message exists */ - H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */ - - /* Remove the message */ - if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message") - - /* Get info for the superblock extension's object header */ - if(H5O_get_hdr_info(&ext_loc, &hdr_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info") - - /* If the object header is an empty base chunk, remove superblock extension */ - if(hdr_info.nchunks == 1) { - if((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") - else if((unsigned)null_count == hdr_info.nmesgs) { - HDassert(H5F_addr_defined(ext_loc.addr)); - if(H5O_delete(f, ext_loc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") - f->shared->sblock->ext_addr = HADDR_UNDEF; - } /* end if */ - } /* end if */ + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message") + else if(status) { + /* message exists */ + H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */ + + /* Remove the message */ + if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message") + + /* Get info for the superblock extension's object header */ + if(H5O_get_hdr_info(&ext_loc, &hdr_info) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info") + + /* If the object header is an empty base chunk, remove superblock extension */ + if(hdr_info.nchunks == 1) { + if((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") + else if((unsigned)null_count == hdr_info.nmesgs) { + HDassert(H5F_addr_defined(ext_loc.addr)); + if(H5O_delete(f, ext_loc.addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") + f->shared->sblock->ext_addr = HADDR_UNDEF; + } /* end else-if */ + } /* end if */ } /* end if */ done: diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 76866db..361f8a1 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -42,7 +42,6 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ /****************/ diff --git a/src/H5Ftest.c b/src/H5Ftest.c index bdecad2..49a2a22 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -26,24 +26,25 @@ /* Module Setup */ /****************/ -#include "H5Fmodule.h" /* This source code file is part of the H5F module */ -#define H5F_TESTING /*suppress warning about H5F testing funcs*/ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ -#define H5G_TESTING /*suppress warning about H5G testing funcs*/ -#define H5SM_FRIEND /*suppress error about including H5SMpkg */ -#define H5SM_TESTING /*suppress warning about H5SM testing funcs*/ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ +#define H5F_TESTING /* Suppress warning about H5F testing funcs */ +#define H5G_FRIEND /* Suppress error about including H5Gpkg.h */ +#define H5G_TESTING /* Suppress warning about H5G testing funcs */ +#define H5SM_FRIEND /* Suppress error about including H5SMpkg.h */ +#define H5SM_TESTING /* Suppress warning about H5SM testing funcs */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5SMpkg.h" /* Shared object header messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5SMpkg.h" /* Shared object header messages */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -82,31 +83,29 @@ /*------------------------------------------------------------------------- - * Function: H5F_get_sohm_mesg_count_test + * Function: H5F__get_sohm_mesg_count_test * * Purpose: Retrieve the number of shared messages of a given type in a file * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jan 3, 2007 + * Programmer: Quincey Koziol + * Jan 3, 2007 * *------------------------------------------------------------------------- */ herr_t -H5F_get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, - size_t *mesg_count) +H5F__get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, size_t *mesg_count) { - H5F_t *file; /* File info */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Push API context */ if(H5CX_push() < 0) @@ -122,19 +121,18 @@ done: HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_sohm_mesg_count_test() */ +} /* end H5F__get_sohm_mesg_count_test() */ /*------------------------------------------------------------------------- - * Function: H5F_check_cached_stab_test + * Function: H5F__check_cached_stab_test * * Purpose: Check that a file's superblock contains a cached symbol * table entry, that the entry matches that in the root * group's object header, and check that the addresses are * valid. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * Mar 31, 2009 @@ -142,17 +140,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_check_cached_stab_test(hid_t file_id) +H5F__check_cached_stab_test(hid_t file_id) { - H5F_t *file; /* File info */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Push API context */ if(H5CX_push() < 0) @@ -168,16 +166,15 @@ done: HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_check_cached_stab_test() */ +} /* end H5F__check_cached_stab_test() */ /*------------------------------------------------------------------------- - * Function: H5F_get_maxaddr_test + * Function: H5F__get_maxaddr_test * * Purpose: Retrieve the maximum address for a file * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Jun 10, 2009 @@ -185,33 +182,32 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_get_maxaddr_test(hid_t file_id, haddr_t *maxaddr) +H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr) { - H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Retrieve maxaddr for file */ *maxaddr = file->shared->maxaddr; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_maxaddr_test() */ +} /* end H5F__get_maxaddr_test() */ /*------------------------------------------------------------------------- - * Function: H5F_get_sbe_addr_test + * Function: H5F__get_sbe_addr_test * * Purpose: Retrieve the address of a superblock extension's object header - * for a file + * for a file * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Jul 10, 2016 @@ -219,21 +215,55 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr) +H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr) { - H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Retrieve maxaddr for file */ *sbe_addr = file->shared->sblock->ext_addr; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_sbe_addr_test() */ +} /* end H5F__get_sbe_addr_test() */ + + +/*------------------------------------------------------------------------- + * Function: H5F__same_file_test + * + * Purpose: Check if two file IDs refer to the same underlying file. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * Oct 13, 2018 + * + *------------------------------------------------------------------------- + */ +htri_t +H5F__same_file_test(hid_t file_id1, hid_t file_id2) +{ + H5F_t *file1, *file2; /* File info */ + htri_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments */ + if(NULL == (file1 = (H5F_t *)H5VL_object_verify(file_id1, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + if(NULL == (file2 = (H5F_t *)H5VL_object_verify(file_id2, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + + /* If they are using the same underlying "shared" file struct, they are the same file */ + ret_value = (file1->shared == file2->shared); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__same_file_test() */ @@ -14,14 +14,12 @@ /*------------------------------------------------------------------------- * * Created: H5G.c - * Jul 18 1997 - * Robb Matzke <matzke@llnl.gov> * * Purpose: Symbol table functions. The functions that begin with - * `H5G_stab_' don't understand the naming system; they operate + * 'H5G_stab_' don't understand the naming system; they operate * on a single symbol table at a time. * - * The functions that begin with `H5G_node_' operate on the leaf + * The functions that begin with 'H5G_node_' operate on the leaf * nodes of a symbol table B-tree. They should be defined in * the H5Gnode.c file. * @@ -42,11 +40,11 @@ * +--------------+----------- +--------------------------------+ * | Location ID | Name | Meaning | * +--------------+------------+--------------------------------+ - * | File ID | "/foo/bar" | Find `foo' within `bar' within | + * | File ID | "/foo/bar" | Find 'foo' within 'bar' within | * | | | the root group of the specified| * | | | file. | * +--------------+------------+--------------------------------+ - * | File ID | "foo/bar" | Find `foo' within `bar' within | + * | File ID | "foo/bar" | Find 'foo' within 'bar' within | * | | | the root group of the specified| * | | | file. | * +--------------+------------+--------------------------------+ @@ -56,11 +54,11 @@ * | File ID | "." | The root group of the specified| * | | | the specified file. | * +--------------+------------+--------------------------------+ - * | Group ID | "/foo/bar" | Find `foo' within `bar' within | + * | Group ID | "/foo/bar" | Find 'foo' within 'bar' within | * | | | the root group of the file | * | | | containing the specified group.| * +--------------+------------+--------------------------------+ - * | Group ID | "foo/bar" | File `foo' within `bar' within | + * | Group ID | "foo/bar" | File 'foo' within 'bar' within | * | | | the specified group. | * +--------------+------------+--------------------------------+ * | Group ID | "/" | The root group of the file | @@ -83,13 +81,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -111,6 +109,9 @@ /* Local Prototypes */ /********************/ +/* Group close callback */ +static herr_t H5G__close_cb(H5VL_object_t *grp_vol_obj); + /*********************/ /* Package Variables */ @@ -131,10 +132,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Group ID class */ static const H5I_class_t H5I_GROUP_CLS[1] = {{ - H5I_GROUP, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5G__close_cb /* Callback routine for closing objects of this class */ + H5I_GROUP, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5G__close_cb /* Callback routine for closing objects of this class */ }}; /* Flag indicating "top" of interface has been initialized */ @@ -258,9 +259,41 @@ H5G_term_package(void) /*------------------------------------------------------------------------- - * Function: H5Gcreate2 + * Function: H5G__close_cb + * + * Purpose: Called when the ref count reaches zero on the group's ID + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5G__close_cb(H5VL_object_t *grp_vol_obj) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(grp_vol_obj); + + /* Close the group */ + if(H5VL_group_close(grp_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group") + + /* Free the VOL object */ + if(H5VL_free_object(grp_vol_obj) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "unable to free VOL object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G__close_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5Gcreate2 * - * Purpose: Creates a new group relative to LOC_ID, giving it the + * Purpose: Creates a new group relative to LOC_ID, giving it the * specified creation property list GCPL_ID and access * property list GAPL_ID. The link to the new group is * created with the LCPL_ID. @@ -272,14 +305,11 @@ H5G_term_package(void) * hid_t gcpl_id; IN: Property list for group creation * hid_t gapl_id; IN: Property list for group access * - * Return: Success: The object ID of a new, empty group open for - * writing. Call H5Gclose() when finished with - * the group. - * - * Failure: H5I_INVALID_HID + * Return: Success: The object ID of a new, empty group open for + * writing. Call H5Gclose() when finished with + * the group. * - * Programmer: Quincey Koziol - * April 5, 2007 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -287,46 +317,64 @@ hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id) { - H5G_loc_t loc; /* Location to create group */ - H5G_t *grp = NULL; /* New group created */ - hid_t ret_value; /* Return value */ + void *grp = NULL; /* Structure for new group */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist; /* Property list pointer */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "i*siii", loc_id, name, lcpl_id, gcpl_id, gapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") - /* Get correct property list */ + /* Check link creation property list */ if(H5P_DEFAULT == lcpl_id) lcpl_id = H5P_LINK_CREATE_DEFAULT; else if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a link creation property list") /* Check group creation property list */ if(H5P_DEFAULT == gcpl_id) gcpl_id = H5P_GROUP_CREATE_DEFAULT; else if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group create property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group creation property list") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id))) + /* Get the gcpl structure and set the link properties on it */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") + if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set property value for lcpl id") + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Set the location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Create the group */ + if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") - if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + + /* Get an atom for the group */ + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: - if(ret_value < 0) - if(grp && H5G_close(grp) < 0) + if(H5I_INVALID_HID == ret_value) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -334,9 +382,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gcreate_anon + * Function: H5Gcreate_anon * - * Purpose: Creates a new group relative to LOC_ID, giving it the + * Purpose: Creates a new group relative to LOC_ID, giving it the * specified creation property list GCPL_ID and access * property list GAPL_ID. * @@ -352,37 +400,30 @@ done: * hid_t gcpl_id; IN: Property list for group creation * hid_t gapl_id; IN: Property list for group access * - * Example: To create missing groups "A" and "B01" along the given path "/A/B01/grp" + * Example: To create missing groups "A" and "B01" along the given path "/A/B01/grp" * hid_t create_id = H5Pcreate(H5P_GROUP_CREATE); * int status = H5Pset_create_intermediate_group(create_id, TRUE); * hid_t gid = H5Gcreate_anon(file_id, "/A/B01/grp", create_id, H5P_DEFAULT); * - * Return: Success: The object ID of a new, empty group open for - * writing. Call H5Gclose() when finished with - * the group. + * Return: Success: The object ID of a new, empty group open for + * writing. Call H5Gclose() when finished with + * the group. * - * Failure: H5I_INVALID_HID - * - * Programmer: Peter Cao - * May 08, 2005 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) { - H5G_loc_t loc; - H5G_t *grp = NULL; - H5G_obj_create_t gcrt_info; /* Information for group creation */ - hid_t ret_value; + void *grp = NULL; /* Structure for new group */ + H5VL_object_t *vol_obj = NULL; /* Object token for loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "iii", loc_id, gcpl_id, gapl_id); - /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - /* Check group creation property list */ if(H5P_DEFAULT == gcpl_id) gcpl_id = H5P_GROUP_CREATE_DEFAULT; @@ -394,34 +435,26 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Set up group creation info */ - gcrt_info.gcpl_id = gcpl_id; - gcrt_info.cache_type = H5G_NOTHING_CACHED; - HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); - - /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create_anon(loc.oloc->file, &gcrt_info))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") - if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); -done: - /* Release the group's object header, if it was created */ - if(grp) { - H5O_loc_t *oloc; /* Object location for group */ + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") - /* Get the new group's object location */ - if(NULL == (oloc = H5G_oloc(grp))) - HDONE_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to get object location of group") + /* Create the group */ + if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, NULL, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") - /* Decrement refcount on group's object header in memory */ - if(H5O_dec_rc_by_loc(oloc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement refcount on newly created object") - } /* end if */ + /* Get an atom for the group */ + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") +done: /* Cleanup on failure */ - if(ret_value < 0) - if(grp && H5G_close(grp) < 0) + if(H5I_INVALID_HID == ret_value) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -429,53 +462,59 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gopen2 + * Function: H5Gopen2 * - * Purpose: Opens an existing group for modification. When finished, - * call H5Gclose() to close it and release resources. + * Purpose: Opens an existing group for modification. When finished, + * call H5Gclose() to close it and release resources. * * This function allows the user the pass in a Group Access * Property List, which H5Gopen1() does not. * - * Return: Success: Object ID of the group. - * Failure: H5I_INVALID_HID + * Return: Success: Object ID of the group * - * Programmer: James Laird - * Thursday, July 27, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) { - H5G_t *grp = NULL; /* Group opened */ - H5G_loc_t loc; /* Location of parent for group */ - hid_t ret_value; /* Return value */ + void *grp = NULL; /* Group opened */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, gapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + /* Open the group */ - if(NULL == (grp = H5G__open_name(&loc, name))) + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + if(NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Register an ID for the group */ - if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: - if(ret_value < 0) - if(grp && H5G_close(grp) < 0) + if(H5I_INVALID_HID == ret_value) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -483,36 +522,34 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gget_create_plist - * - * Purpose: Returns a copy of the group creation property list. + * Function: H5Gget_create_plist * - * Return: Success: ID for a copy of the group creation - * property list. The property list ID should be - * released by calling H5Pclose(). + * Purpose: Returns a copy of the group creation property list. * - * Failure: H5I_INVALID_HID + * Return: Success: ID for a copy of the group creation + * property list. The property list ID should be + * released by calling H5Pclose(). * - * Programmer: Quincey Koziol - * Tuesday, October 25, 2005 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Gget_create_plist(hid_t group_id) { - H5G_t *group = NULL; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5VL_object_t *vol_obj = NULL; + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", group_id); /* Check args */ - if(NULL == (group = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID") - if((ret_value = H5G__get_create_plist(group)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") + /* Get the group creation property list for the group */ + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_GCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") done: FUNC_LEAVE_API(ret_value) @@ -520,42 +557,41 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gget_info - * - * Purpose: Retrieve information about a group. + * Function: H5Gget_info * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Retrieve information about a group. * - * Programmer: Quincey Koziol - * November 27 2006 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5Gget_info(hid_t grp_id, H5G_info_t *grp_info) +H5Gget_info(hid_t loc_id, H5G_info_t *group_info) { - H5I_type_t id_type; /* Type of ID */ - H5G_loc_t loc; /* Location of group */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; + H5I_type_t id_type; /* Type of ID */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*x", grp_id, grp_info); + H5TRACE2("e", "i*x", loc_id, group_info); /* Check args */ - id_type = H5I_get_type(grp_id); + id_type = H5I_get_type(loc_id); if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") - if(!grp_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID") + if(!group_info) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL") /* Get group location */ - if(H5G_loc(grp_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the group's information */ - if(H5G__get_info(&loc, grp_info/*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = id_type; + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, group_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") done: FUNC_LEAVE_API(ret_value) @@ -563,42 +599,50 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gget_info_by_name - * - * Purpose: Retrieve information about a group. + * Function: H5Gget_info_by_name * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Retrieve information about a group, where the group is + * identified by name instead of ID. * - * Programmer: Quincey Koziol - * November 27 2006 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, +H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*s*xi", loc_id, name, grp_info, lapl_id); + H5TRACE4("e", "i*s*xi", loc_id, name, group_info, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(!grp_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") + if(!group_info) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info") + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set up location parameters */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + /* Retrieve the group's information */ - if(H5G__get_info_by_name(&loc, name, grp_info/*out*/) < 0) + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -607,48 +651,58 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gget_info_by_idx + * Function: H5Gget_info_by_idx * - * Purpose: Retrieve information about a group, according to the order + * Purpose: Retrieve information about a group, according to the order * of an index. * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * November 27 2006 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, H5G_info_t *grp_info, hid_t lapl_id) + H5_iter_order_t order, hsize_t n, H5G_info_t *group_info, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, grp_info, + H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, group_info, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(!group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL") + if(!*group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(!grp_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!group_info) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info") + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + /* Retrieve the group's information */ - if(H5G__get_info_by_idx(&loc, group_name, idx_type, order, n, grp_info/*out*/) < 0) + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -657,15 +711,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gclose + * Function: H5Gclose * - * Purpose: Closes the specified group. The group ID will no longer be - * valid for accessing the group. + * Purpose: Closes the specified group. The group ID will no longer be + * valid for accessing the group. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Wednesday, December 31, 1997 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -678,11 +729,10 @@ H5Gclose(hid_t group_id) H5TRACE1("e", "i", group_id); /* Check args */ - if(NULL == H5I_object_verify(group_id,H5I_GROUP)) + if(NULL == H5I_object_verify(group_id, H5I_GROUP)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") - /* - * Decrement the counter on the group atom. It will be freed if the count + /* Decrement the counter on the group atom. It will be freed if the count * reaches zero. */ if(H5I_dec_app_ref(group_id) < 0) @@ -708,22 +758,22 @@ done: herr_t H5Gflush(hid_t group_id) { - H5G_t *grp; /* Group for this operation */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* Group for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", group_id); /* Check args */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Flush group's metadata to file */ - if(H5G__flush(grp, group_id) < 0) + if(H5VL_group_specific(vol_obj, H5VL_GROUP_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") done: @@ -746,22 +796,22 @@ done: herr_t H5Grefresh(hid_t group_id) { - H5G_t *grp; /* Group for this operation */ - herr_t ret_value = SUCCEED; /* Return value */ - + H5VL_object_t *vol_obj; /* Group for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", group_id); /* Check args */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call private function to refresh group object */ - if((H5G__refresh(grp, group_id)) < 0) + /* Refresh group's metadata */ + if(H5VL_group_specific(vol_obj, H5VL_GROUP_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") done: diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index aae5496..7e2b324 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -59,19 +59,20 @@ typedef struct { /* Private macros */ /* PRIVATE PROTOTYPES */ -static herr_t H5G_compact_build_table_cb(const void *_mesg, unsigned idx, void *_udata); +static herr_t H5G__compact_build_table_cb(const void *_mesg, unsigned idx, void *_udata); static herr_t H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order, H5G_link_table_t *ltable); +static herr_t H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata); /*------------------------------------------------------------------------- - * Function: H5G_compact_build_table_cb + * Function: H5G__compact_build_table_cb * - * Purpose: Callback routine for searching 'link' messages for a particular + * Purpose: Callback routine for searching 'link' messages for a particular * name. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -80,13 +81,13 @@ static herr_t H5G__compact_build_table(const H5O_loc_t *oloc, *------------------------------------------------------------------------- */ static herr_t -H5G_compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) +H5G__compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */ H5G_iter_bt_t *udata = (H5G_iter_bt_t *)_udata; /* 'User data' passed in */ herr_t ret_value=H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(lnk); @@ -102,7 +103,7 @@ H5G_compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_build_table_cb() */ +} /* end H5G__compact_build_table_cb() */ /*------------------------------------------------------------------------- @@ -151,7 +152,7 @@ H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, /* Iterate through the link messages, adding them to the table */ op.op_type = H5O_MESG_OP_APP; - op.u.app_op = H5G_compact_build_table_cb; + op.u.app_op = H5G__compact_build_table_cb; if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages") @@ -432,12 +433,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_compact_lookup_cb + * Function: H5G__compact_lookup_cb * - * Purpose: Callback routine for searching 'link' messages for a particular + * Purpose: Callback routine for searching 'link' messages for a particular * name & gettting object location for it * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -446,13 +447,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) +H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */ H5G_iter_lkp_t *udata = (H5G_iter_lkp_t *)_udata; /* 'User data' passed in */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(lnk); @@ -475,7 +476,7 @@ H5G_compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_uda done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_lookup_cb() */ +} /* end H5G__compact_lookup_cb() */ /*------------------------------------------------------------------------- @@ -511,7 +512,7 @@ H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk) /* Iterate through the link messages, adding them to the table */ op.op_type = H5O_MESG_OP_APP; - op.u.app_op = H5G_compact_lookup_cb; + op.u.app_op = H5G__compact_lookup_cb; if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages") @@ -571,71 +572,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__compact_lookup_by_idx() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5G__compact_get_type_by_idx - * - * Purpose: Returns the type of objects in the group by giving index. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Sep 12, 2005 - * - *------------------------------------------------------------------------- - */ -H5G_obj_t -H5G__compact_get_type_by_idx(H5O_loc_t *oloc, const H5O_linfo_t *linfo, - hsize_t idx) -{ - H5G_link_table_t ltable = {0, NULL}; /* Link table */ - H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity check */ - HDassert(oloc); - - /* Build table of all link messages */ - if(H5G__compact_build_table(oloc, linfo, H5_INDEX_NAME, H5_ITER_INC, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5G_UNKNOWN, "can't create link message table") - - /* Check for going out of bounds */ - if(idx >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound") - - /* Determine type of object */ - if(ltable.lnks[idx].type == H5L_TYPE_SOFT) - ret_value = H5G_LINK; - else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN) - ret_value = H5G_UDLINK; - else if(ltable.lnks[idx].type == H5L_TYPE_HARD){ - H5O_loc_t tmp_oloc; /* Temporary object location */ - H5O_type_t obj_type; /* Type of object at location */ - - /* Build temporary object location */ - tmp_oloc.file = oloc->file; - tmp_oloc.addr = ltable.lnks[idx].u.hard.addr; - - /* Get the type of the object */ - if(H5O_obj_type(&tmp_oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type") - - /* Map to group object type */ - if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type))) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type") - } else { - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "unknown link type") - } /* end else */ - -done: - /* Release link table */ - if(ltable.lnks && H5G__link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__compact_get_type_by_idx() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - diff --git a/src/H5Gdense.c b/src/H5Gdense.c index 326561a..a2ef55c 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -416,7 +416,7 @@ HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDst /* Create serialized form of link */ if(H5O_msg_encode(f, H5O_LINK_ID, FALSE, (unsigned char *)link_ptr, lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link") + HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link") /* Open the fractal heap */ if(NULL == (fheap = H5HF_open(f, linfo->fheap_addr))) @@ -966,8 +966,7 @@ done: */ herr_t H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, - H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, - void *op_data) + H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data) { H5HF_t *fheap = NULL; /* Fractal heap handle */ H5G_link_table_t ltable = {0, NULL}; /* Table of links */ @@ -1778,80 +1777,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__dense_delete() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5G__dense_get_type_by_idx - * - * Purpose: Returns the type of objects in the group by giving index. - * - * Note: This routine assumes a lookup on the link name index in - * increasing order and isn't currently set up to be as - * flexible as other routines in this code module, because - * the H5Gget_objtype_by_idx that it's supporting is - * deprecated. - * - * Return: Success: Non-negative, object type - * Failure: Negative - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 19 2006 - * - *------------------------------------------------------------------------- - */ -H5G_obj_t -H5G__dense_get_type_by_idx(H5F_t *f, H5O_linfo_t *linfo, hsize_t idx) -{ - H5G_link_table_t ltable = {0, NULL}; /* Table of links */ - H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* - * Check arguments. - */ - HDassert(f); - HDassert(linfo); - - /* Build the table of links for this group */ - if(H5G__dense_build_table(f, linfo, H5_INDEX_NAME, H5_ITER_INC, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "error building table of links") - - /* Check for going out of bounds */ - if(idx >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "index out of bound") - - /* Determine type of object */ - if(ltable.lnks[idx].type == H5L_TYPE_SOFT) - ret_value = H5G_LINK; - else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN) - ret_value = H5G_UDLINK; - else if(ltable.lnks[idx].type == H5L_TYPE_HARD) { - H5O_loc_t tmp_oloc; /* Temporary object location */ - H5O_type_t obj_type; /* Type of object at location */ - - /* Build temporary object location */ - tmp_oloc.file = f; - tmp_oloc.addr = ltable.lnks[idx].u.hard.addr; - - /* Get the type of the object */ - if(H5O_obj_type(&tmp_oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type") - - /* Map to group object type */ - if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type))) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type") - } else { - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "unknown link type") - } /* end else */ - -done: - /* Release link table */ - if(ltable.lnks && H5G__link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__dense_get_type_by_idx() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index f6c6d8f..a15703e 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -43,6 +43,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -71,30 +72,9 @@ typedef struct { /********************/ /* Local Prototypes */ /********************/ - -static herr_t H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, - hid_t new_loc_id, const char *new_name, hid_t lcpl_id); -static herr_t H5G__move(hid_t src_loc_id, const char *src_name, - hid_t dst_loc_id, const char *dst_name, hid_t lcpl_id); -static herr_t H5G__unlink(H5G_loc_t *loc, const char *name); -static herr_t H5G__get_linkval(const H5G_loc_t *loc, const char *name, size_t size, - char *buf/*out*/); -static herr_t H5G__set_comment(const H5G_loc_t *loc, const char *name, - const char *comment); -static int H5G__get_comment(const H5G_loc_t *loc, const char *name, char *buf, - size_t bufsize); -static herr_t H5G__iterate(hid_t loc_id, const char *name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, hsize_t *last_lnk, - const H5G_link_iterate_t *lnk_op, void *op_data); -static herr_t H5G__get_num_objs(const H5O_loc_t *oloc, H5G_info_t *grp_info); static herr_t H5G__get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name, - hbool_t follow_link, H5G_stat_t *statbuf/*out*/); -static ssize_t H5G__get_objname_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, char *name, size_t size); -static H5G_obj_t H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx); #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -177,7 +157,7 @@ H5G_map_obj_type(H5O_type_t obj_type) * writing. Call H5Gclose() when finished with * the group. * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Wednesday, September 24, 1997 @@ -187,67 +167,86 @@ H5G_map_obj_type(H5O_type_t obj_type) hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) { - H5G_loc_t loc; /* Location to create group */ - H5G_t *grp = NULL; /* New group created */ - hid_t tmp_gcpl = (-1); /* Temporary group creation property list */ - hid_t ret_value; /* Return value */ - - FUNC_ENTER_API(FAIL) + void *grp = NULL; /* New group created */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist; /* Property list pointer */ + hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */ + hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*sz", loc_id, name, size_hint); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given") /* Check if we need to create a non-standard GCPL */ if(size_hint > 0) { - H5P_genplist_t *gc_plist; /* Property list created */ H5O_ginfo_t ginfo; /* Group info property */ + H5P_genplist_t *gc_plist; /* Property list created */ /* Get the default property list */ if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(H5P_GROUP_CREATE_DEFAULT))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") /* Make a copy of the default property list */ if((tmp_gcpl = H5P_copy_plist(gc_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to copy the creation property list") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list") /* Get pointer to the copied property list */ if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(tmp_gcpl))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") /* Get the group info property */ if(H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get group info") /* Set the non-default local heap size hint */ H5_CHECKED_ASSIGN(ginfo.lheap_size_hint, uint32_t, size_hint, size_t); if(H5P_set(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info") - } /* end if */ + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set group info") + } else tmp_gcpl = H5P_GROUP_CREATE_DEFAULT; /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read info") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(tmp_gcpl))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") + + /* get creation properties */ + if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get property value for lcpl id") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") - /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create_named(&loc, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") - if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") + /* Create the group */ + if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") + + /* Get an atom for the group */ + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: - if(tmp_gcpl > 0 && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT) + if(H5I_INVALID_HID != tmp_gcpl && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT) if(H5I_dec_ref(tmp_gcpl) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release property list") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list") - if(ret_value < 0) - if(grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") + if(H5I_INVALID_HID == ret_value) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gcreate1() */ @@ -263,7 +262,7 @@ done: * * Return: Success: Object ID of the group. * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Wednesday, December 31, 1997 @@ -273,31 +272,38 @@ done: hid_t H5Gopen1(hid_t loc_id, const char *name) { - H5G_t *grp = NULL; /* Group opened */ - H5G_loc_t loc; /* Location of parent for group */ - hid_t ret_value; /* Return value */ + void *grp = NULL; /* Group opened */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the group */ - if(NULL == (grp = H5G__open_name(&loc, name))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") + if(NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") - /* Register an atom for the group */ - if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") + /* Get an atom for the group */ + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: - if(ret_value < 0) - if(grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") + if(H5I_INVALID_HID == ret_value) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gopen1() */ @@ -314,6 +320,8 @@ done: herr_t H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name) { + hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT; + H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -321,17 +329,75 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Check arguments */ if(!cur_name || !*cur_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") if(!new_name || !*new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(cur_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine to create link */ - if(H5G__link(cur_loc_id, cur_name, type, H5L_SAME_LOC, new_name, H5P_LINK_CREATE_DEFAULT) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link") + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Create link */ + if(type == H5L_TYPE_HARD) { + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params1; + H5VL_loc_params_t loc_params2; + H5VL_object_t tmp_vol_obj; /* Temporary object token of */ + + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.obj_type = H5I_get_type(cur_loc_id); + loc_params1.loc_data.loc_by_name.name = cur_name; + loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.loc_data.loc_by_name.name = new_name; + loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj->data) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target") + if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target loc params") + + /* Construct a temporary VOL object */ + tmp_vol_obj.data = NULL; + tmp_vol_obj.connector = vol_obj->connector; + + /* Create the link through the VOL */ + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + 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_loc_params_t loc_params; + + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = new_name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params.obj_type = H5I_get_type(cur_loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TARGET_NAME, &cur_name) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") + + /* Create the link through the VOL */ + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") + } /* end else-if */ + else + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid link type") done: FUNC_LEAVE_API(ret_value) @@ -350,6 +416,8 @@ herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id, const char *new_name) { + hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT; + H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -357,92 +425,83 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* Check arguments */ if(!cur_name || !*cur_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") if(!new_name || !*new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(cur_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine to create link */ - if(H5G__link(cur_loc_id, cur_name, type, new_loc_id, new_name, H5P_LINK_CREATE_DEFAULT) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Glink2() */ - - -/*------------------------------------------------------------------------- - * Function: H5G__link - * - * Purpose: Internal routine to create a new link. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, December 18, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, - hid_t new_loc_id, const char *new_name, hid_t lcpl_id) -{ - H5G_loc_t new_loc; /* Information about new link's group */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Create the appropriate kind of link */ if(type == H5L_TYPE_HARD) { - H5G_loc_t cur_loc, *cur_loc_p; /* Information about current link's group */ - H5G_loc_t *new_loc_p; /* Information about new link's group */ - - /* Finish checking arguments */ - if(cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC") - if(cur_loc_id != H5L_SAME_LOC && H5G_loc(cur_loc_id, &cur_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") - if(new_loc_id != H5L_SAME_LOC && H5G_loc(new_loc_id, &new_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") - - /* Set up current & new location pointers */ - cur_loc_p = &cur_loc; - new_loc_p = &new_loc; - if(cur_loc_id == H5L_SAME_LOC) - cur_loc_p = new_loc_p; - else if(new_loc_id == H5L_SAME_LOC) - new_loc_p = cur_loc_p; - else if(cur_loc_p->oloc->file != new_loc_p->oloc->file) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") - - /* Create the link */ - if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0) + H5VL_object_t *vol_obj1; /* Object token of loc_id */ + H5VL_object_t *vol_obj2; /* Object token of loc_id */ + H5VL_loc_params_t loc_params1; + H5VL_loc_params_t loc_params2; + + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.obj_type = H5I_get_type(cur_loc_id); + loc_params1.loc_data.loc_by_name.name = cur_name; + loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.obj_type = H5I_get_type(new_loc_id); + loc_params2.loc_data.loc_by_name.name = new_name; + loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + + /* get the location object */ + if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(cur_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(new_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj1->data) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id") + if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target name") + + /* Create the link through the VOL */ + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else if(type == H5L_TYPE_SOFT) { - /* Soft links only need one location, the new_loc_id, but it's possible - * that new_loc_id is H5L_SAME_LOC - */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + + /* Soft links only need one location, the new_loc_id, but it's possible that + * new_loc_id is H5L_SAME_LOC */ if(new_loc_id == H5L_SAME_LOC) new_loc_id = cur_loc_id; - /* Finish checking arguments */ - if(H5G_loc(new_loc_id, &new_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = new_name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params.obj_type = H5I_get_type(new_loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(new_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TARGET_NAME, &cur_name) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") - /* Create the link */ - if(H5L_create_soft(cur_name, &new_loc, new_name, lcpl_id) < 0) + /* Create the link through the VOL */ + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") - } /* end else if */ + } /* end else-if */ else - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "Not a valid link type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__link() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Glink2() */ /*------------------------------------------------------------------------- @@ -455,7 +514,10 @@ done: herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) { - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params1; + H5VL_loc_params_t loc_params2; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*s*s", src_loc_id, src_name, dst_name); @@ -464,9 +526,22 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) if(H5CX_set_loc(src_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call common routine to move the link */ - if(H5G__move(src_loc_id, src_name, H5L_SAME_LOC, dst_name, H5P_LINK_CREATE_DEFAULT) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.obj_type = H5I_get_type(src_loc_id); + loc_params1.loc_data.loc_by_name.name = src_name; + loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.loc_data.loc_by_name.name = dst_name; + loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(src_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Move the link */ + if(H5VL_link_move(vol_obj, &loc_params1, NULL, &loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") done: FUNC_LEAVE_API(ret_value) @@ -484,80 +559,47 @@ herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name) { - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */ + H5VL_loc_params_t loc_params1; + H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ + H5VL_loc_params_t loc_params2; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*si*s", src_loc_id, src_name, dst_loc_id, dst_name); - /* Check arguments */ - if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC") - /* Set up collective metadata if appropriate */ if(H5CX_set_loc(dst_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call common routine to move the link */ - if(H5G__move(src_loc_id, src_name, dst_loc_id, dst_name, H5P_LINK_CREATE_DEFAULT) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gmove2() */ - - -/*------------------------------------------------------------------------- - * Function: H5G__move - * - * Purpose: Renames an object within an HDF5 file and moves it to a new - * group. The original name SRC is unlinked from the group graph - * and then inserted with the new name DST (which can specify a - * new path for the object) as an atomic operation. The names - * are interpreted relative to SRC_LOC_ID and - * DST_LOC_ID, which are either file IDs or group ID. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, November 6, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, - const char *dst_name, hid_t lcpl_id) -{ - H5G_loc_t src_loc, *src_loc_p; /* Group info for source location */ - H5G_loc_t dst_loc, *dst_loc_p; /* Group info for destination location */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") - if(dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") - if(!src_name || !*src_name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no current name specified") - if(!dst_name || !*dst_name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no destination name specified") - - /* Set up src & dst location pointers */ - src_loc_p = &src_loc; - dst_loc_p = &dst_loc; - if(src_loc_id == H5L_SAME_LOC) - src_loc_p = dst_loc_p; - else if(dst_loc_id == H5L_SAME_LOC) - dst_loc_p = src_loc_p; + /* Set location parameter for source object */ + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.loc_data.loc_by_name.name = src_name; + loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params1.obj_type = H5I_get_type(src_loc_id); + + /* Set location parameter for destination object */ + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.loc_data.loc_by_name.name = dst_name; + loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params2.obj_type = H5I_get_type(dst_loc_id); + + if(H5L_SAME_LOC != src_loc_id) + /* get the location object */ + if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + if(H5L_SAME_LOC != dst_loc_id) + /* get the location object */ + if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Move the link */ - if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") + if(H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__move() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Gmove2() */ /*------------------------------------------------------------------------- @@ -570,60 +612,37 @@ done: herr_t H5Gunlink(hid_t loc_id, const char *name) { - H5G_loc_t loc; /* Group's location */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*s", loc_id, name); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine */ - if(H5G__unlink(&loc, name) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gunlink() */ - - -/*------------------------------------------------------------------------- - * Function: H5G__unlink - * - * Purpose: Internal version of H5Gunlink. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__unlink(H5G_loc_t *loc, const char *name) -{ - herr_t ret_value = SUCCEED; /* Return value */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; - FUNC_ENTER_STATIC_VOL + /* 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") - /* Call H5L routine... */ - if(H5L_delete(loc, name) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") + /* Delete the link */ + if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__unlink() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Gunlink() */ /*------------------------------------------------------------------------- @@ -637,61 +656,37 @@ done: herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) { - H5G_loc_t loc; /* Group's location */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*szx", loc_id, name, size, buf); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine */ - if(H5G__get_linkval(&loc, name, size, buf) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gget_linkval() */ + /* 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") - -/*------------------------------------------------------------------------- - * Function: H5G__get_linkval - * - * Purpose: Internal version of H5Gget_linkval. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__get_linkval(const H5G_loc_t *loc, const char *name, size_t size, - char *buf/*out*/) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Call the link routine which provides this capability */ - if(H5L_get_val(loc, name, buf, size) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info") + /* Get the link value */ + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_linkval() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_linkval() */ /*------------------------------------------------------------------------- @@ -714,59 +709,37 @@ done: herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment) { - H5G_loc_t loc; /* Group's location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*s*s", loc_id, name, comment); - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine */ - if(H5G__set_comment(&loc, name, comment) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gset_comment() */ - - -/*------------------------------------------------------------------------- - * Function: H5G__set_comment - * - * Purpose: Internal version of H5Gset_comment. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__set_comment(const H5G_loc_t *loc, const char *name, const char *comment) -{ - herr_t ret_value = SUCCEED; /* Return value */ + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); - FUNC_ENTER_STATIC_VOL + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Call the common routine which provides this capability */ - if(H5G_loc_set_comment(loc, name, comment) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") + /* Set the comment */ + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, &loc_params, comment) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__set_comment() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Gset_comment() */ /*------------------------------------------------------------------------- @@ -795,62 +768,39 @@ done: int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) { - H5G_loc_t loc; /* Group's location */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; int ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("Is", "i*sz*s", loc_id, name, bufsize, buf); - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(bufsize > 0 && !buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine */ - if((ret_value = H5G__get_comment(&loc, name, buf, bufsize)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gget_comment() */ - - -/*------------------------------------------------------------------------- - * Function: H5G__get_comment - * - * Purpose: Internal version of H5Gget_comment. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static int -H5G__get_comment(const H5G_loc_t *loc, const char *name, char *buf, - size_t bufsize) -{ - int ret_value = FAIL; /* Return value */ + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); - FUNC_ENTER_STATIC_VOL + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Call the common routine which provides this capability */ - if((ret_value = (int)H5G_loc_get_comment(loc, name, buf, bufsize)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") + /* Get the comment */ + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, &loc_params, buf, bufsize, &ret_value) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_comment() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_comment() */ /*------------------------------------------------------------------------- @@ -881,6 +831,8 @@ 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_loc_params_t loc_params; H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_obj; /* Index of last object looked at */ hsize_t idx; /* Internal location to hold index */ @@ -891,11 +843,11 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, /* Check args */ if(!name || !*name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_p && *idx_p < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "invalid index specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") if(!op) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Set number of objects looked at to zero */ last_obj = 0; @@ -905,9 +857,19 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_type = H5G_LINK_OP_OLD; lnk_op.op_func.op_old = op; - /* Call private function. */ - if((ret_value = H5G__iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") + /* Fill out location struct */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the object pointer */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") + + /* Call private iteration function, through VOL callback */ + if((ret_value = H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_GROUP_ITERATE_OLD, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0) + HERROR(H5E_SYM, H5E_BADITER, "error iterating over group's links"); /* Set the index we stopped at */ if(idx_p) @@ -919,39 +881,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__iterate - * - * Purpose: Internal version of H5Giterate. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__iterate(hid_t loc_id, const char *name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, hsize_t *last_lnk, - const H5G_link_iterate_t *lnk_op, void *op_data) -{ - herr_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Call the common routine which provides this capability */ - if((ret_value = H5G_iterate(loc_id, name, idx_type, order, idx, last_lnk, lnk_op, op_data)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__iterate() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_num_objs * * Purpose: Returns the number of objects in the group. It iterates @@ -970,24 +899,35 @@ done: herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) { - H5G_loc_t loc; /* Location of object */ - H5G_info_t grp_info; /* Group information */ - herr_t ret_value = SUCCEED; + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5I_type_t id_type; /* Type of ID */ + H5VL_loc_params_t loc_params; + H5G_info_t grp_info; /* Group information */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", loc_id, num_objs); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") + id_type = H5I_get_type(loc_id); + if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID") if(!num_objs) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "bad pointer to # of objects") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects") - /* Call the internal routine */ - if(H5G__get_num_objs(loc.oloc, &grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = id_type; - /* Set the number of objects [sic: links] in the group */ + /* Get group location */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve the group's information */ + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, &grp_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") + + /* Set the number of objects [i.e. links] in the group */ *num_objs = grp_info.nlinks; done: @@ -996,44 +936,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_num_objs - * - * Purpose: Internal version of H5Gget_num_objs. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__get_num_objs(const H5O_loc_t *oloc, H5G_info_t *grp_info) -{ - H5O_type_t obj_type; /* Type of object at location */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check args */ - if(H5O_obj_type(oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") - - /* Retrieve information about the group */ - if(H5G__obj_info(oloc, grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine # of objects") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_num_objs() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_objinfo * * Purpose: Returns information about an object. If FOLLOW_LINK is @@ -1052,23 +954,40 @@ done: */ herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, - H5G_stat_t *statbuf/*out*/) + H5G_stat_t *statbuf/*out*/) { - H5G_loc_t loc; /* Group's location */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + + /* Retrieve object info, if pointer to struct is given */ + if(statbuf) { + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; - /* Get info */ - if(H5G__get_objinfo(&loc, name, follow_link, statbuf) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") + /* Fill out location struct */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve the object's information */ + if(H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_GROUP_GET_OBJINFO, &loc_params, (unsigned)follow_link, statbuf) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) + } /* end if */ done: FUNC_LEAVE_API(ret_value) @@ -1093,6 +1012,7 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) { H5G_trav_goi_t *udata = (H5G_trav_goi_t *)_udata; /* User data passed in */ + H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1101,48 +1021,43 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c if(lnk == NULL && obj_loc == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name) - /* Only modify user's buffer if it's available */ - if(udata->statbuf) { - H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */ - - /* Common code to retrieve the file's fileno */ - if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno") + /* Common code to retrieve the file's fileno */ + if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno") - /* Info for soft and UD links is gotten by H5L_get_info. If we have - * a hard link, follow it and get info on the object - */ - if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) { - H5O_info_t oinfo; /* Object information */ + /* Info for soft and UD links is gotten by H5L_get_info. If we have + * a hard link, follow it and get info on the object + */ + if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) { + H5O_info_t oinfo; /* Object information */ - /* Go retrieve the object information */ - /* (don't need index & heap info) */ - HDassert(obj_loc); - if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_HDR) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info") + /* Go retrieve the object information */ + /* (don't need index & heap info) */ + HDassert(obj_loc); + if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_HDR) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info") - /* Get mapped object type */ - statbuf->type = H5G_map_obj_type(oinfo.type); + /* Get mapped object type */ + statbuf->type = H5G_map_obj_type(oinfo.type); - /* Get object number (i.e. address) for object */ - statbuf->objno[0] = (unsigned long)(oinfo.addr); + /* Get object number (i.e. address) for object */ + statbuf->objno[0] = (unsigned long)(oinfo.addr); #if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - statbuf->objno[1] = (unsigned long)(oinfo.addr >> 8 * sizeof(long)); + statbuf->objno[1] = (unsigned long)(oinfo.addr >> 8 * sizeof(long)); #else - statbuf->objno[1] = 0; + statbuf->objno[1] = 0; #endif - /* Get # of hard links pointing to object */ - statbuf->nlink = oinfo.rc; + /* Get # of hard links pointing to object */ + statbuf->nlink = oinfo.rc; - /* Get modification time for object */ - statbuf->mtime = oinfo.ctime; + /* Get modification time for object */ + statbuf->mtime = oinfo.ctime; - /* Retrieve the object header information */ - statbuf->ohdr.size = oinfo.hdr.space.total; - statbuf->ohdr.free = oinfo.hdr.space.free; - statbuf->ohdr.nmesgs = oinfo.hdr.nmesgs; - statbuf->ohdr.nchunks = oinfo.hdr.nchunks; - } /* end if */ + /* Retrieve the object header information */ + statbuf->ohdr.size = oinfo.hdr.space.total; + statbuf->ohdr.free = oinfo.hdr.space.free; + statbuf->ohdr.nmesgs = oinfo.hdr.nmesgs; + statbuf->ohdr.nchunks = oinfo.hdr.nchunks; } /* end if */ done: @@ -1170,22 +1085,22 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/) { H5G_trav_goi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(loc); HDassert(name && *name); + HDassert(statbuf); - /* Reset stat buffer, if one was given */ - if(statbuf) - HDmemset(statbuf, 0, sizeof(H5G_stat_t)); + /* Reset stat buffer */ + HDmemset(statbuf, 0, sizeof(H5G_stat_t)); /* Set up user data for retrieving information */ udata.statbuf = statbuf; @@ -1193,12 +1108,11 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, udata.loc_file = loc->oloc->file; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : H5G_TARGET_SLINK|H5G_TARGET_UDLINK), - H5G__get_objinfo_cb, &udata) < 0) + if(H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : (H5G_TARGET_SLINK | H5G_TARGET_UDLINK)), H5G__get_objinfo_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") /* If we're pointing at a soft or UD link, get the real link length and type */ - if(statbuf && follow_link == 0) { + if(follow_link == 0) { H5L_info_t linfo; /* Link information buffer */ herr_t ret; @@ -1220,7 +1134,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, } /* end if */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_objinfo() */ @@ -1250,19 +1164,33 @@ done: ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) { - H5G_loc_t loc; /* Object location */ - ssize_t ret_value; + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("Zs", "ih*sz", loc_id, idx, name, size); - /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set collective metadata read info") + + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = "."; + loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_NAME; + loc_params.loc_data.loc_by_idx.order = H5_ITER_INC; + loc_params.loc_data.loc_by_idx.n = idx; + loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Call internal function */ - if((ret_value = H5G__get_objname_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object name") + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get object name") done: FUNC_LEAVE_API(ret_value) @@ -1270,45 +1198,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_objname_by_idx - * - * Purpose: Internal version of H5Gget_objname_by_idx. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static ssize_t -H5G__get_objname_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, char *name, size_t size) -{ - H5O_type_t obj_type; /* Type of object at location */ - ssize_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check args */ - if(H5O_obj_type(oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") - - /* Call common routine */ - if((ret_value = H5G_obj_get_name_by_idx(oloc, idx_type, order, idx, name, size)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_objname_by_idx() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_objtype_by_idx * * Purpose: Returns the type of objects in the group by giving index. @@ -1326,82 +1215,39 @@ done: H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) { - H5G_loc_t loc; /* Object location */ - H5G_obj_t ret_value; + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + H5O_info_t oinfo; /* Object info (contains object type) */ + unsigned fields; /* Which fields in object info to populate */ + H5G_obj_t ret_value; /* Return value */ FUNC_ENTER_API(H5G_UNKNOWN) H5TRACE2("Go", "ih", loc_id, idx); - /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID") + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = "."; + loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_NAME; + loc_params.loc_data.loc_by_idx.order = H5_ITER_INC; + loc_params.loc_data.loc_by_idx.n = idx; + loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); - /* Call internal function*/ - if(H5G_UNKNOWN == (ret_value = H5G__obj_get_type_by_idx(loc.oloc, idx))) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type") + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier") -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gget_objtype_by_idx() */ + /* Retrieve the object's basic information (which includes its type) */ + fields = H5O_INFO_BASIC; + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, &oinfo, fields) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info") - -/*------------------------------------------------------------------------- - * Function: H5G__obj_get_type_by_idx - * - * Purpose: Private function for H5Gget_objtype_by_idx. - * Returns the type of objects in the group by giving index. - * - * Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3) - * - * Failure: Negative - * - * Programmer: Raymond Lu - * Nov 20, 2002 - * - *------------------------------------------------------------------------- - */ -static H5G_obj_t -H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) -{ - H5O_linfo_t linfo; /* Link info message */ - htri_t linfo_exists; /* Whether the link info message exists */ - H5O_type_t obj_type; /* Type of object at location */ - H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ - - FUNC_ENTER_STATIC_VOL_TAG(oloc->addr) - - /* Sanity check */ - HDassert(oloc); - - /* Check args */ - if(H5O_obj_type(oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "not a group") - - /* Attempt to get the link info for this group */ - if((linfo_exists = H5G__obj_get_linfo(oloc, &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't check for link info message") - if(linfo_exists) { - if(H5F_addr_defined(linfo.fheap_addr)) { - /* Get the object's name from the dense link storage */ - if((ret_value = H5G__dense_get_type_by_idx(oloc->file, &linfo, idx)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type") - } /* end if */ - else { - /* Get the object's type from the link messages */ - if((ret_value = H5G__compact_get_type_by_idx(oloc, &linfo, idx)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type") - } /* end else */ - } /* end if */ - else { - /* Get the object's type from the symbol table */ - if((ret_value = H5G__stab_get_type_by_idx(oloc, idx)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type") - } /* end else */ + /* Map to group object type */ + if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(oinfo.type))) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type") done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) -} /* end H5G__obj_get_type_by_idx() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_objtype_by_idx() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Gint.c b/src/H5Gint.c index 3b5de44..049c696 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -32,13 +32,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -134,7 +134,7 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, H5G_obj_create_t gcrt_info; /* Information for group creation */ H5G_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -161,48 +161,11 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, ret_value = (H5G_t *)ocrt_info.new_obj; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__create_named() */ /*------------------------------------------------------------------------- - * Function: H5G__create_anon - * - * Purpose: Internal routine to create a new anonymous group. - * - * Note: This routine is needed so that there's a non-API routine for - * creating groups that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new group object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 17, 2017 - * - *------------------------------------------------------------------------- - */ -H5G_t * -H5G__create_anon(H5F_t *file, H5G_obj_create_t *gcrt_info) -{ - H5G_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(file); - HDassert(gcrt_info); - - /* Create the new group & get its ID */ - if(NULL == (ret_value = H5G__create(file, gcrt_info))) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, NULL, "unable to create group") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__create_anon() */ - - -/*------------------------------------------------------------------------- * Function: H5G__create * * Purpose: Creates a new empty group with the specified name. The name @@ -302,7 +265,7 @@ H5G__open_name(const H5G_loc_t *loc, const char *name) H5O_type_t obj_type; /* Type of object at location */ H5G_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(loc); @@ -336,7 +299,7 @@ done: if(loc_found && H5G_loc_free(&grp_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, NULL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__open_name() */ @@ -486,38 +449,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__close_cb - * - * Purpose: Closes the specified group. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Sunday, February 18, 2018 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__close_cb(H5G_t *grp) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check args */ - HDassert(grp && grp->shared); - HDassert(grp->shared->fo_count > 0); - - /* Call actual group close routine */ - if(H5G_close(grp) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "problem closing group") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__close_cb() */ - - -/*------------------------------------------------------------------------- * Function: H5G_close * * Purpose: Closes the specified group. @@ -647,7 +578,7 @@ H5G_oloc(H5G_t *grp) *------------------------------------------------------------------------- */ H5G_name_t * -H5G_nameof(H5G_t *grp) +H5G_nameof(const H5G_t *grp) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -842,12 +773,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_iterate + * Function: H5G_iterate * * Purpose: Private function for iterating over links in a group * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Oct 3, 2005 @@ -855,32 +785,29 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_iterate(hid_t loc_id, const char *group_name, +H5G_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, const H5G_link_iterate_t *lnk_op, void *op_data) { - H5G_loc_t loc; /* Location of parent for group */ - hid_t gid = -1; /* ID of group to iterate over */ - H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */ - H5G_iter_appcall_ud_t udata; /* User data for callback */ - herr_t ret_value = FAIL; /* Return value */ + hid_t gid = H5I_INVALID_HID; /* ID of group to iterate over */ + H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */ + H5G_iter_appcall_ud_t udata; /* User data for callback */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ + HDassert(loc); HDassert(group_name); HDassert(last_lnk); HDassert(lnk_op && lnk_op->op_func.op_new); - /* - * Open the group on which to operate. We also create a group ID which + /* Open the group on which to operate. We also create a group ID which * we can pass to the application-defined operator. */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(NULL == (grp = H5G__open_name(&loc, group_name))) + if(NULL == (grp = H5G__open_name(loc, group_name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((gid = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") /* Set up user data for callback */ @@ -894,10 +821,10 @@ H5G_iterate(hid_t loc_id, const char *group_name, done: /* Release the group opened */ - if(gid > 0) { + if(gid != H5I_INVALID_HID) { if(H5I_dec_app_ref(gid) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") - } /* end if */ + } else if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") @@ -1091,9 +1018,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_visit + * Function: H5G_visit * - * Purpose: Recursively visit all the links in a group and all + * Purpose: Recursively visit all the links in a group and all * the groups that are linked to from that group. Links within * each group are visited according to the order within the * specified index (unless the specified index does not exist for @@ -1105,31 +1032,25 @@ done: * callback with more than one link that points to a particular * _object_. * - * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. - * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. - * - * + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * - * Programmer: Quincey Koziol - * November 4 2007 + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * *------------------------------------------------------------------------- */ herr_t -H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type, +H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data) { H5G_iter_visit_ud_t udata; /* User data for callback */ H5O_linfo_t linfo; /* Link info message */ htri_t linfo_exists; /* Whether the link info message exists */ - hid_t gid = (-1); /* Group ID */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ H5G_t *grp = NULL; /* Group opened */ - H5G_loc_t loc; /* Location of group passed in */ H5G_loc_t start_loc; /* Location of starting group */ unsigned rc; /* Reference count of object */ herr_t ret_value = FAIL; /* Return value */ @@ -1140,15 +1061,15 @@ H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type, FUNC_ENTER_NOAPI(FAIL) /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!loc) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc parameter cannot be NULL") /* Open the group to begin visiting within */ - if(NULL == (grp = H5G__open_name(&loc, group_name))) + if(NULL == (grp = H5G__open_name(loc, group_name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an ID for the starting group */ - if((gid = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") /* Get the location of the starting group */ @@ -1227,10 +1148,10 @@ done: H5SL_destroy(udata.visited, H5G_free_visit_visited, NULL); /* Release the group opened */ - if(gid > 0) { + if(gid != H5I_INVALID_HID) { if(H5I_dec_app_ref(gid) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") - } /* end if */ + } else if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") @@ -1239,44 +1160,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_create_plist - * - * Purpose: Internal routine to retrieve a group's creation property list. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: ID for a copy of the group creation property - * list. The property list ID should be released - * by calling H5Pclose(). - * - * Failure: H5I_INVALID_HID - * - * Programmer: Quincey Koziol - * December 17, 2017 - * - *------------------------------------------------------------------------- - */ -hid_t -H5G__get_create_plist(const H5G_t *grp) -{ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(grp); - - /* Retrieve the GCPL */ - if((ret_value = H5G_get_create_plist(grp)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_create_plist() */ - - -/*------------------------------------------------------------------------- * Function: H5G_get_create_plist * * Purpose: Private function for H5Gget_create_plist @@ -1335,7 +1218,7 @@ H5G_get_create_plist(const H5G_t *grp) /* Check for the group having a link info message */ if((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header") if(linfo_exists) { /* Set the link info for the property list */ if(H5P_set(new_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0) @@ -1372,51 +1255,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_info - * - * Purpose: Internal routine to retrieve the info for a group. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__get_info(const H5G_loc_t *loc, H5G_info_t *grp_info) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(grp_info); - - /* Retrieve the group's information */ - if(H5G__obj_info(loc->oloc, grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_info() */ - - -/*------------------------------------------------------------------------- * Function: H5G__get_info_by_name * * Purpose: Internal routine to retrieve the info for a group, by name. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 18, 2017 @@ -1432,7 +1275,7 @@ H5G__get_info_by_name(const H5G_loc_t *loc, const char *name, H5G_info_t *grp_in hbool_t loc_found = FALSE; /* Location at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -1457,7 +1300,7 @@ done: if(loc_found && H5G_loc_free(&grp_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_info_by_name() */ @@ -1466,11 +1309,7 @@ done: * * Purpose: Internal routine to retrieve the info for a group, by index. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 18, 2017 @@ -1487,7 +1326,7 @@ H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, hbool_t loc_found = FALSE; /* Location at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -1512,76 +1351,6 @@ done: if(loc_found && H5G_loc_free(&grp_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_info_by_idx() */ - -/*------------------------------------------------------------------------- - * Function: H5G__flush - * - * Purpose: Internal routine to flushes a group to disk. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__flush(H5G_t *grp, hid_t group_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(grp); - - /* Flush metadata to file */ - if(H5O_flush_common(&grp->oloc, group_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group and object flush callback") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5G__flush */ - - -/*------------------------------------------------------------------------- - * Function: H5G__refresh - * - * Purpose: Internal routine to refresh a group. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__refresh(H5G_t *grp, hid_t group_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(grp); - - /* Call private function to refresh group object */ - if((H5O_refresh_metadata(group_id, grp->oloc)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5G__refresh */ - diff --git a/src/H5Glink.c b/src/H5Glink.c index 509e511..82a2dcf 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -568,7 +568,7 @@ H5G__link_name_replace(H5F_t *file, H5RS_str_t *grp_full_path_r, const H5O_link_ obj_path_r = H5G_build_fullpath_refstr_str(grp_full_path_r, lnk->name); if(H5G_name_replace(lnk, H5G_NAME_DELETE, file, obj_path_r, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to replace name") - } /* end if */ + } done: if(obj_path_r) diff --git a/src/H5Gloc.c b/src/H5Gloc.c index f5a14a1..2dacd94 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -137,117 +137,139 @@ static herr_t H5G__loc_get_comment_cb(H5G_loc_t *grp_loc, const char *name, /*------------------------------------------------------------------------- - * Function: H5G_loc + * Function: H5G_loc_real * - * Purpose: Given an object ID return a location for the object. + * Purpose: Utility routine to get object location * - * Return: Success: Group pointer. - * Failure: NULL - * - * Programmer: Quincey Koziol - * Tuesday, September 13, 2005 + * Returns: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5G_loc(hid_t loc_id, H5G_loc_t *loc) +H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - switch(H5I_get_type(loc_id)) { + switch(type) { case H5I_FILE: - { - H5F_t *f; - - /* Get the file struct */ - if(NULL == (f = (H5F_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file ID") + { + H5F_t *f = (H5F_t *)obj; - /* Construct a group location for root group of the file */ - if(H5G_root_loc(f, loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unable to create location for file") - } /* end case */ + /* Construct a group location for root group of the file */ + if(H5G_root_loc(f, loc) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unable to create location for file") break; - - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of property list") - - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of error class, message or stack") + } case H5I_GROUP: - { - H5G_t *group; - - if(NULL == (group = (H5G_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group ID") - if(NULL == (loc->oloc = H5G_oloc(group))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of group") - if(NULL == (loc->path = H5G_nameof(group))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of group") - } /* end case */ + { + H5G_t *group = (H5G_t *)obj; + + if(NULL == (loc->oloc = H5G_oloc(group))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of group") + if(NULL == (loc->path = H5G_nameof(group))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of group") break; + } case H5I_DATATYPE: - { - H5T_t *dt; - - if(NULL == (dt = (H5T_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid type ID") - if(NULL == (loc->oloc = H5T_oloc(dt))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of datatype") - if(NULL == (loc->path = H5T_nameof(dt))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of datatype") - } /* end case */ - break; + { + H5T_t *dt = NULL; - case H5I_DATASPACE: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of dataspace") + /* Get the actual datatype object if the VOL object is set */ + dt = H5T_get_actual_type((H5T_t *)obj); + + if(NULL == (loc->oloc = H5T_oloc(dt))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of datatype") + if(NULL == (loc->path = H5T_nameof(dt))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of datatype") + break; + } case H5I_DATASET: - { - H5D_t *dset; - - if(NULL == (dset = (H5D_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data ID") - if(NULL == (loc->oloc = H5D_oloc(dset))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of dataset") - if(NULL == (loc->path = H5D_nameof(dset))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of dataset") - } /* end case */ + { + H5D_t *dset = (H5D_t *)obj; + + if(NULL == (loc->oloc = H5D_oloc(dset))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of dataset") + if(NULL == (loc->path = H5D_nameof(dset))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of dataset") break; + } case H5I_ATTR: - { - H5A_t *attr; - - if(NULL == (attr = (H5A_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid attribute ID") - if(NULL == (loc->oloc = H5A_oloc(attr))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of attribute") - if(NULL == (loc->path = H5A_nameof(attr))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of attribute") - } /* end case */ + { + H5A_t *attr = (H5A_t *)obj; + + if(NULL == (loc->oloc = H5A_oloc(attr))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of attribute") + if(NULL == (loc->path = H5A_nameof(attr))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of attribute") break; + } case H5I_REFERENCE: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of reference") + case H5I_DATASPACE: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of dataspace") + + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of property list") + + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of error class, message or stack") + + case H5I_VFL: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual file driver (VFD)") + + case H5I_VOL: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual object layer (VOL) driver") + case H5I_UNINIT: case H5I_BADID: - case H5I_VFL: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid location ID") } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_loc_real() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_loc + * + * Purpose: Given an object ID return a location for the object. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5G_loc(hid_t loc_id, H5G_loc_t *loc) +{ + void *obj = NULL; /* VOL object */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Get the object from the VOL */ + if(NULL == (obj = H5VL_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Fill in the struct */ + if(H5G_loc_real(obj, H5I_get_type(loc_id), loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to fill in location struct") + +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_loc() */ @@ -764,7 +786,7 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_A /* Check for existing comment message */ if((exists = H5O_msg_exists(obj_loc->oloc, H5O_NAME_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header") /* Remove the previous comment message if any */ if(exists) @@ -774,9 +796,9 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_A /* Add the new message */ if(udata->comment && *udata->comment) { /* Casting away const OK -QAK */ - comment.s = (char *)udata->comment; - if(H5O_msg_create(obj_loc->oloc, H5O_NAME_ID, 0, H5O_UPDATE_TIME, &comment) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message") + comment.s = (char *)udata->comment; + if(H5O_msg_create(obj_loc->oloc, H5O_NAME_ID, 0, H5O_UPDATE_TIME, &comment) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message") } /* end if */ done: @@ -854,20 +876,21 @@ H5G__loc_get_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_A /* Query object comment */ comment.s = NULL; if(NULL == H5O_msg_read(obj_loc->oloc, H5O_NAME_ID, &comment)) { - if(udata->comment && udata->bufsize > 0) + if(udata->comment && udata->bufsize > 0) udata->comment[0] = '\0'; - udata->comment_size = 0; - } /* end if */ + udata->comment_size = 0; + } else { if(udata->comment && udata->bufsize) - HDstrncpy(udata->comment, comment.s, udata->bufsize); - udata->comment_size = (ssize_t)HDstrlen(comment.s); - H5O_msg_reset(H5O_NAME_ID, &comment); - } /* end else */ + HDstrncpy(udata->comment, comment.s, udata->bufsize); + udata->comment_size = (ssize_t)HDstrlen(comment.s); + H5O_msg_reset(H5O_NAME_ID, &comment); + } done: /* Indicate that this callback didn't take ownership of the group * - * location for the object */ + * location for the object. + */ *own_loc = H5G_OWN_NONE; FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Gname.c b/src/H5Gname.c index c1156ca..f6ddeeb 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -584,21 +584,9 @@ H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size, *cached = TRUE; } /* end if */ else if(!loc->path->obj_hidden) { - hid_t file; - - /* Retrieve file ID for name search */ - if((file = H5F_get_id(loc->oloc->file, FALSE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get file ID") - /* Search for name of object */ - if((len = H5G_get_name_by_addr(file, loc->oloc, name, size)) < 0) { - H5I_dec_ref(file); + if((len = H5G_get_name_by_addr(loc->oloc->file, loc->oloc, name, size)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine name") - } /* end if */ - - /* Close file ID used for search */ - if(H5I_dec_ref(file) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCLOSEFILE, FAIL, "can't determine name") /* Indicate that the name is _not_ cached, if requested */ /* (Currently only used for testing - QAK, 2010/07/26) */ @@ -835,6 +823,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -1155,7 +1144,7 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, else { /* We pass NULL as link pointer when we need to search all IDs */ search_group = search_dataset = search_datatype = TRUE; - } /* end else */ + } /* Check if we need to operate on the objects affected */ if(search_group || search_dataset || search_datatype) { @@ -1166,26 +1155,26 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, src_file = H5F_PARENT(src_file); /* Set up common information for callback */ - names.src_file = src_file; - names.src_full_path_r = src_full_path_r; - names.dst_file = dst_file; - names.dst_full_path_r = dst_full_path_r; - names.op = op; + names.src_file = src_file; + names.src_full_path_r = src_full_path_r; + names.dst_file = dst_file; + names.dst_full_path_r = dst_full_path_r; + names.op = op; /* Search through group IDs */ if(search_group) if(H5I_iterate(H5I_GROUP, H5G_name_replace_cb, &names, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over groups") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over groups") /* Search through dataset IDs */ if(search_dataset) if(H5I_iterate(H5I_DATASET, H5G_name_replace_cb, &names, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datasets") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datasets") /* Search through datatype IDs */ if(search_datatype) if(H5I_iterate(H5I_DATATYPE, H5G_name_replace_cb, &names, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datatypes") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datatypes") } /* end if */ } /* end if */ @@ -1269,10 +1258,11 @@ done: * * Purpose: Tries to figure out the path to an object from it's address * - * Return: returns size of path name, and copies it into buffer - * pointed to by name if that buffer is big enough. - * 0 if it cannot find the path - * negative on failure. + * Return: Success: Returns size of path name, and copies it into buffer + * pointed to by name if that buffer is big enough. + * 0 if it cannot find the path + * + * Failure: -1 * * Programmer: Quincey Koziol * November 4 2007 @@ -1280,28 +1270,27 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc, - char *name, size_t size) +H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size) { - H5G_gnba_iter_t udata; /* User data for iteration */ - H5G_loc_t root_loc; /* Root group's location */ - hbool_t found_obj = FALSE; /* If we found the object */ - herr_t status; /* Status from iteration */ - ssize_t ret_value = -1; /* Return value */ + H5G_gnba_iter_t udata; /* User data for iteration */ + H5G_loc_t root_loc; /* Root group's location */ + hbool_t found_obj = FALSE; /* If we found the object */ + herr_t status; /* Status from iteration */ + ssize_t ret_value = -1; /* Return value */ /* Portably clear udata struct (before FUNC_ENTER) */ HDmemset(&udata, 0, sizeof(udata)); - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) - /* Construct the link info for the file's root group */ - if(H5G_loc(file, &root_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get root group's location") + /* Construct a group location for root group of the file */ + if(H5G_root_loc(f, &root_loc) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get root group's location") /* Check for root group being the object looked for */ if(root_loc.oloc->addr == loc->addr && root_loc.oloc->file == loc->file) { if(NULL == (udata.path = H5MM_strdup(""))) - HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "can't duplicate path string") + HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, (-1), "can't duplicate path string") found_obj = TRUE; } /* end if */ else { @@ -1310,8 +1299,8 @@ H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc, udata.path = NULL; /* Visit all the links in the file */ - if((status = H5G_visit(file, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G_get_name_by_addr_cb, &udata)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group traversal failed while looking for object name") + if((status = H5G_visit(&root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G_get_name_by_addr_cb, &udata)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, (-1), "group traversal failed while looking for object name") else if(status > 0) found_obj = TRUE; } /* end else */ @@ -1342,3 +1331,4 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_get_name_by_addr() */ + diff --git a/src/H5Gobj.c b/src/H5Gobj.c index e93896c..15dbd79 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -36,7 +36,6 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* File access */ #include "H5Gpkg.h" /* Groups */ -#include "H5HLprivate.h" /* Local Heaps */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ @@ -257,7 +256,7 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo, * incremented if the object is added to the group directed graph. */ if(H5O_create(f, hdr_size, (size_t)1, gcpl_id, oloc/*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header") /* Check for format of group to create */ if(use_at_least_v18) { diff --git a/src/H5Goh.c b/src/H5Goh.c index 38570f9..f29529b 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -27,6 +27,7 @@ #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Object headers */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -46,7 +47,7 @@ static void *H5O__group_get_copy_file_udata(void); static void H5O__group_free_copy_file_udata(void *udata); static htri_t H5O__group_isa(const H5O_t *loc); -static hid_t H5O__group_open(const H5G_loc_t *obj_loc, hbool_t app_ref); +static void *H5O__group_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type); static void *H5O__group_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc); static H5O_loc_t *H5O__group_get_oloc(hid_t obj_id); static herr_t H5O__group_bh_info(const H5O_loc_t *loc, H5O_t *oh, @@ -193,40 +194,40 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__group_open + * Function: H5O__group_open * - * Purpose: Open a group at a particular location + * Purpose: Open a group at a particular location * - * Return: Success: Open object identifier - * Failure: Negative + * Return: Success: Pointer to group data + * Failure: NULL * * Programmer: Quincey Koziol * Monday, November 6, 2006 * *------------------------------------------------------------------------- */ -static hid_t -H5O__group_open(const H5G_loc_t *obj_loc, hbool_t app_ref) +static void * +H5O__group_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) { - H5G_t *grp = NULL; /* Group opened */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5G_t *grp = NULL; /* Group opened */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC HDassert(obj_loc); + *opened_type = H5I_GROUP; + /* Open the group */ if(NULL == (grp = H5G_open(obj_loc))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group") - /* Register an ID for the group */ - if((ret_value = H5I_register(H5I_GROUP, grp, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") + ret_value = (void *)grp; done: - if(ret_value < 0) + if(NULL == ret_value) if(grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, NULL, "unable to release group") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__group_open() */ @@ -303,7 +304,7 @@ H5O__group_get_oloc(hid_t obj_id) FUNC_ENTER_STATIC /* Get the group */ - if(NULL == (grp = (H5G_t *)H5I_object(obj_id))) + if(NULL == (grp = (H5G_t *)H5VL_object(obj_id))) HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID") /* Get the group's object header location */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index f0a9aea..159b6f5 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -299,6 +299,22 @@ typedef struct H5G_copy_file_ud_t { H5G_cache_t cache; /* Cached data for symbol table entry */ } H5G_copy_file_ud_t; +/* Types for optional group VOL operations */ +typedef enum H5VL_group_optional_t { + H5VL_GROUP_ITERATE_OLD, /* HG5Giterate (deprecated routine) */ + H5VL_GROUP_GET_OBJINFO /* HG5Gget_objinfo (deprecated routine) */ + /* (These two enum values should have an + * "#ifndefH5_NO_DEPRECATED_SYMBOLS" + * around them, but the compiler + * complains about an empty enum + * when deprecated symbols are + * disabled currently. When + * another enum value is added, + * please put the #ifdef around + * these symbols. QAK - 2018/12/06 + */ +} H5VL_group_optional_t; + /*****************************/ /* Package Private Variables */ @@ -331,17 +347,11 @@ H5FL_EXTERN(H5G_shared_t); H5_DLL H5G_t *H5G__create(H5F_t *file, H5G_obj_create_t *gcrt_info); H5_DLL H5G_t *H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, hid_t gcpl_id); -H5_DLL H5G_t *H5G__create_anon(H5F_t *file, H5G_obj_create_t *gcrt_info); H5_DLL H5G_t *H5G__open_name(const H5G_loc_t *loc, const char *name); -H5_DLL hid_t H5G__get_create_plist(const H5G_t *grp); -H5_DLL herr_t H5G__get_info(const H5G_loc_t *loc, H5G_info_t *grp_info); H5_DLL herr_t H5G__get_info_by_name(const H5G_loc_t *loc, const char *name, H5G_info_t *grp_info); H5_DLL herr_t H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *grp_info); -H5_DLL herr_t H5G__flush(H5G_t *grp, hid_t group_id); -H5_DLL herr_t H5G__refresh(H5G_t *grp, hid_t group_id); -H5_DLL herr_t H5G__close_cb(H5G_t *grp); /* * Group hierarchy traversal routines @@ -387,9 +397,6 @@ H5_DLL herr_t H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t #ifndef H5_STRICT_FORMAT_CHECKS H5_DLL herr_t H5G__stab_valid(H5O_loc_t *grp_oloc, H5O_stab_t *alt_stab); #endif /* H5_STRICT_FORMAT_CHECKS */ -#ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL H5G_obj_t H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* @@ -434,8 +441,7 @@ H5_DLL herr_t H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type H5_DLL herr_t H5G__link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip, hsize_t *last_lnk, const H5G_lib_iterate_t op, void *op_data); H5_DLL herr_t H5G__link_release_table(H5G_link_table_t *ltable); -H5_DLL herr_t H5G__link_name_replace(H5F_t *file, H5RS_str_t *grp_full_path_r, - const H5O_link_t *lnk); +H5_DLL herr_t H5G__link_name_replace(H5F_t *file, H5RS_str_t *grp_full_path_r, const H5O_link_t *lnk); /* Functions that understand "compact" link storage */ H5_DLL herr_t H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk); @@ -455,10 +461,6 @@ H5_DLL htri_t H5G__compact_lookup(const H5O_loc_t *grp_oloc, const char *name, H5_DLL herr_t H5G__compact_lookup_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_link_t *lnk); -#ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL H5G_obj_t H5G__compact_get_type_by_idx(H5O_loc_t *oloc, - const H5O_linfo_t *linfo, hsize_t idx); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Functions that understand "dense" link storage */ H5_DLL herr_t H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo, @@ -483,10 +485,6 @@ H5_DLL herr_t H5G__dense_remove_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_r, H5_index_t idx_type, H5_iter_order_t order, hsize_t n); H5_DLL herr_t H5G__dense_delete(H5F_t *f, H5O_linfo_t *linfo, hbool_t adj_link); -#ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL H5G_obj_t H5G__dense_get_type_by_idx(H5F_t *f, H5O_linfo_t *linfo, - hsize_t idx); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Functions that understand group objects */ H5_DLL herr_t H5G__obj_create(H5F_t *f, H5G_obj_create_t *gcrt_info, @@ -501,6 +499,10 @@ H5_DLL herr_t H5G__obj_iterate(const H5O_loc_t *grp_oloc, H5_DLL herr_t H5G__obj_info(const H5O_loc_t *oloc, H5G_info_t *grp_info); H5_DLL htri_t H5G__obj_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk); +#ifndef H5_NO_DEPRECATED_SYMBOLS +H5_DLL herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name, + hbool_t follow_link, H5G_stat_t *statbuf/*out*/); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* * These functions operate on group hierarchy names. diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 95dfef5..f149f29 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -187,7 +187,7 @@ typedef struct H5G_entry_t H5G_entry_t; * call. */ H5_DLL struct H5O_loc_t *H5G_oloc(H5G_t *grp); -H5_DLL H5G_name_t * H5G_nameof(H5G_t *grp); +H5_DLL H5G_name_t * H5G_nameof(const H5G_t *grp); H5_DLL H5F_t *H5G_fileof(H5G_t *grp); H5_DLL H5G_t *H5G_open(const H5G_loc_t *loc); H5_DLL herr_t H5G_close(H5G_t *grp); @@ -209,10 +209,10 @@ H5_DLL char *H5G_normalize(const char *name); */ H5_DLL herr_t H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traverse_t op, void *op_data); -H5_DLL herr_t H5G_iterate(hid_t loc_id, const char *group_name, +H5_DLL herr_t H5G_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, const H5G_link_iterate_t *lnk_op, void *op_data); -H5_DLL herr_t H5G_visit(hid_t loc_id, const char *group_name, +H5_DLL herr_t H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data); /* @@ -261,13 +261,14 @@ H5_DLL herr_t H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_dept H5_DLL herr_t H5G_name_free(H5G_name_t *name); H5_DLL ssize_t H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size, hbool_t *cached); -H5_DLL ssize_t H5G_get_name_by_addr(hid_t fid, const struct H5O_loc_t *loc, - char* name, size_t size); +H5_DLL ssize_t H5G_get_name_by_addr(H5F_t *f, const struct H5O_loc_t *loc, + char* name, size_t size); H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char *name); /* * These functions operate on group "locations" */ +H5_DLL herr_t H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc); H5_DLL herr_t H5G_loc(hid_t loc_id, H5G_loc_t *loc); H5_DLL herr_t H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth); H5_DLL herr_t H5G_loc_find(const H5G_loc_t *loc, const char *name, diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 64c4054..e8d38b9 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -225,14 +225,14 @@ H5G__stab_create(H5O_loc_t *grp_oloc, const H5O_ginfo_t *ginfo, H5O_stab_t *stab /* Go create the B-tree & local heap */ if(H5G__stab_create_components(grp_oloc->file, stab, size_hint) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create symbol table components") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create symbol table components") /* * Insert the symbol table message into the object header and the symbol * table entry. */ if(H5O_msg_create(grp_oloc, H5O_STAB_ID, 0, H5O_UPDATE_TIME, stab) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -534,7 +534,7 @@ H5G__stab_iterate(const H5O_loc_t *oloc, H5_iter_order_t order, /* Get the B-tree info */ if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") /* Pin the heap down in memory */ if(NULL == (heap = H5HL_protect(oloc->file, stab.heap_addr, H5AC__READ_ONLY_FLAG))) @@ -626,7 +626,7 @@ H5G__stab_count(const H5O_loc_t *oloc, hsize_t *num_objs) /* Get the B-tree info */ if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") /* Iterate over the group members */ if(H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_sumup, num_objs) < 0) @@ -757,7 +757,7 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t /* Get the B-tree & local heap info */ if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") /* Pin the heap down in memory */ if(NULL == (heap = H5HL_protect(oloc->file, stab.heap_addr, H5AC__READ_ONLY_FLAG))) @@ -785,11 +785,11 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t /* Iterate over the group members */ if(H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed") /* If we don't know the name now, we almost certainly went out of bounds */ if(udata.name == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound") /* Get the length of the name */ ret_value = (ssize_t)HDstrlen(udata.name); @@ -979,7 +979,7 @@ H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_ /* Get the B-tree & local heap info */ if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") /* Pin the heap down in memory */ if(NULL == (heap = H5HL_protect(grp_oloc->file, stab.heap_addr, H5AC__READ_ONLY_FLAG))) @@ -1007,11 +1007,11 @@ H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_ /* Iterate over the group members */ if(H5B_iterate(grp_oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed") /* If we didn't find the link, we almost certainly went out of bounds */ if(!udata.found) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound") done: /* Release resources */ @@ -1103,118 +1103,3 @@ done: } /* end H5G__stab_valid */ #endif /* H5_STRICT_FORMAT_CHECKS */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5G_stab_get_type_by_idx_cb - * - * Purpose: Callback for B-tree iteration 'by index' info query to - * retrieve the type of an object - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Nov 7, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G_stab_get_type_by_idx_cb(const H5G_entry_t *ent, void *_udata) -{ - H5G_bt_it_gtbi_t *udata = (H5G_bt_it_gtbi_t *)_udata; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Sanity check */ - HDassert(ent); - HDassert(udata); - - /* Check for a soft link */ - switch(ent->type) { - case H5G_CACHED_SLINK: - udata->type = H5G_LINK; - break; - - case H5G_CACHED_ERROR: - case H5G_NOTHING_CACHED: - case H5G_CACHED_STAB: - case H5G_NCACHED: - default: - { - H5O_loc_t tmp_oloc; /* Temporary object location */ - H5O_type_t obj_type; /* Type of object at location */ - - /* Build temporary object location */ - tmp_oloc.file = udata->f; - HDassert(H5F_addr_defined(ent->header)); - tmp_oloc.addr = ent->header; - - /* Get the type of the object */ - if(H5O_obj_type(&tmp_oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") - udata->type = H5G_map_obj_type(obj_type); - } - break; - } /* end switch */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_get_type_by_idx_cb */ - - -/*------------------------------------------------------------------------- - * Function: H5G__stab_get_type_by_idx - * - * Purpose: Private function for H5Gget_objtype_by_idx. - * Returns the type of objects in the group by giving index. - * - * Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3) - * - * Failure: UNKNOWN - * - * Programmer: Raymond Lu - * Nov 20, 2002 - * - *------------------------------------------------------------------------- - */ -H5G_obj_t -H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) -{ - H5O_stab_t stab; /* Info about local heap & B-tree */ - H5G_bt_it_gtbi_t udata; /* User data for B-tree callback */ - H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ - - FUNC_ENTER_PACKAGE_TAG(oloc->addr) - - /* Sanity check */ - HDassert(oloc); - - /* Get the B-tree & local heap info */ - if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address") - - /* Set iteration information */ - udata.common.idx = idx; - udata.common.num_objs = 0; - udata.common.op = H5G_stab_get_type_by_idx_cb; - udata.f = oloc->file; - udata.type = H5G_UNKNOWN; - - /* Iterate over the group members */ - if(H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "iteration operator failed") - - /* If we don't know the type now, we almost certainly went out of bounds */ - if(udata.type == H5G_UNKNOWN) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "index out of bound") - - /* Set the return value */ - ret_value = udata.type; - -done: - FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5G__stab_get_type_by_idx() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - diff --git a/src/H5Gtest.c b/src/H5Gtest.c index f2f3e3a..1995015 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -28,13 +28,15 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gpkg.h" /* Groups */ -#include "H5HLprivate.h" /* Local Heaps */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gpkg.h" /* Groups */ +#include "H5HLprivate.h" /* Local Heaps */ +#include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* Virtual Object Layer */ + /****************/ /* Local Macros */ @@ -80,7 +82,7 @@ htri_t H5G__is_empty_test(gid) hid_t gid; IN: group to check RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group has no link messages and no symbol table message and no "dense" link storage @@ -102,7 +104,7 @@ H5G__is_empty_test(hid_t gid) FUNC_ENTER_PACKAGE /* Get group structure */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set API context */ @@ -114,7 +116,7 @@ H5G__is_empty_test(hid_t gid) /* Check if the group has any link messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) { /* Sanity check that new group format shouldn't have old messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) @@ -127,7 +129,7 @@ H5G__is_empty_test(hid_t gid) /* Check for a link info message */ if((linfo_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(linfo_exists > 0) { H5O_linfo_t linfo; /* Link info message */ @@ -158,7 +160,7 @@ H5G__is_empty_test(hid_t gid) /* Check if the group has a symbol table message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) { H5O_stab_t stab; /* Info about local heap & B-tree */ hsize_t nlinks; /* Number of links in the group */ @@ -202,7 +204,7 @@ done: hid_t gid; IN: group to check unsigned *nmsgs; OUT: # of link messages in header RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group has link messages and how many. GLOBAL VARIABLES @@ -222,7 +224,7 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs) FUNC_ENTER_PACKAGE /* Get group structure */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set API context */ @@ -232,15 +234,15 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs) /* Check if the group has any link messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists == 0) HGOTO_DONE(FALSE) /* Check if the group has a symbol table message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") /* Check if we should retrieve the number of link messages */ if(nmsgs) { @@ -269,7 +271,7 @@ done: htri_t H5G__has_stab_test(gid) hid_t gid; IN: group to check RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group has a symbol table message. GLOBAL VARIABLES @@ -289,7 +291,7 @@ H5G__has_stab_test(hid_t gid) FUNC_ENTER_PACKAGE /* Get group structure */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set API context */ @@ -299,15 +301,15 @@ H5G__has_stab_test(hid_t gid) /* Check if the group has a symbol table message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists == 0) HGOTO_DONE(FALSE) /* Check if the group has any link messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") done: if(api_ctx_pushed && H5CX_pop() < 0) @@ -326,7 +328,7 @@ done: htri_t H5G__is_new_dense_test(gid) hid_t gid; IN: group to check RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group is in the "new" format for groups (link messages/ fractal heap+v2 B-tree) and if it is in "dense" storage form (ie. it has @@ -348,7 +350,7 @@ H5G__is_new_dense_test(hid_t gid) FUNC_ENTER_PACKAGE /* Get group structure */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set API context */ @@ -358,19 +360,19 @@ H5G__is_new_dense_test(hid_t gid) /* Check if the group has a symbol table message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_DONE(FALSE) /* Check if the group has any link messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_DONE(FALSE) /* Check if the group has link info message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) { H5O_linfo_t linfo; /* Link info message */ @@ -404,7 +406,7 @@ done: hsize_t *name_count; OUT: Number of links in name index hsize_t *corder_count; OUT: Number of links in creation order index RETURNS - Non-negative on success, negative on failure + SUCCEED/FAIL DESCRIPTION Currently, just retrieves the number of links in each index and returns them. @@ -427,7 +429,7 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) FUNC_ENTER_PACKAGE /* Get group structure */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set API context */ @@ -495,7 +497,7 @@ done: hid_t gid; IN: group to check size_t *lheap_size; OUT: Size of local heap RETURNS - Non-negative on success, negative on failure + SUCCEED/FAIL DESCRIPTION Checks the size of the local heap for a group GLOBAL VARIABLES @@ -515,7 +517,7 @@ H5G__lheap_size_test(hid_t gid, size_t *lheap_size) FUNC_ENTER_PACKAGE /* Get group structure */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set API context */ @@ -525,11 +527,11 @@ H5G__lheap_size_test(hid_t gid, size_t *lheap_size) /* Make certain the group has a symbol table message */ if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbol table message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbol table message") /* Check the size of the local heap for the group */ if(H5HL_get_size(grp->oloc.file, stab.heap_addr, lheap_size) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't query local heap size") + HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't query local heap size") done: if(api_ctx_pushed && H5CX_pop() < 0) @@ -551,7 +553,7 @@ done: size_t *user_path_len; OUT: Size of user path unsigned *obj_hidden; OUT: Whether object is hidden RETURNS - Non-negative on success, negative on failure + SUCCEED/FAIL DESCRIPTION Retrieves the user path for an ID. A zero for the length is returned in the case of no user path. @@ -576,7 +578,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign HDassert(obj_hidden); /* Get pointer to object for ID */ - if(NULL == (obj_ptr = H5I_object(obj_id))) + if(NULL == (obj_ptr = H5VL_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get object for ID") /* Set API context */ @@ -609,6 +611,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -648,15 +651,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__verify_cached_stab_test + * Function: H5G__verify_cached_stab_test * * Purpose: Check that a that the provided group entry contains a * cached symbol table entry, that the entry matches that in * the provided group's object header, and check that the * addresses are valid. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * Mar 31, 2009 @@ -666,9 +668,9 @@ done: herr_t H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) { - H5O_stab_t stab; /* Symbol table */ - H5HL_t *heap = NULL; /* Pointer to local heap */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_stab_t stab; /* Symbol table */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(grp_oloc->addr) @@ -681,7 +683,8 @@ H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "unable to read symbol table message") /* Verify that the cached symbol table info matches the symbol table message - * in the object header */ + * in the object header. + */ if((ent->cache.stab.btree_addr != stab.btree_addr) || (ent->cache.stab.heap_addr != stab.heap_addr)) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "cached stab info does not match object header") @@ -711,7 +714,7 @@ done: * group with a symbol table, and that that information is * correct. * - * Return: Non-negative on success/Negative on failure + * Return: H5_ITER_STOP/H5_ITER_CONT/H5_ITER_ERROR * * Programmer: Neil Fortner * Apr 8, 2011 @@ -732,9 +735,7 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, FUNC_ENTER_STATIC - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); @@ -749,7 +750,7 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, targ_oloc.holding_file = FALSE; /* Iterate over entries */ - for(i=0; i<sn->nsyms; i++) { + for(i = 0; i < sn->nsyms; i++) { /* Update oloc address */ targ_oloc.addr = sn->entry[i].header; @@ -773,7 +774,7 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, if((sn->entry[i].cache.stab.btree_addr != stab.btree_addr) || (sn->entry[i].cache.stab.heap_addr != stab.heap_addr)) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "cached symbol table information is incorrect") - } /* end if */ + } else if(sn->entry[i].type == H5G_CACHED_STAB) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "nonexistent STAB message is cached") @@ -831,7 +832,7 @@ H5G__verify_cached_stabs_test(hid_t gid) HDassert(gid >= 0); /* Check args */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set up metadata tagging */ diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 37b6292..d029bea 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -32,18 +32,17 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5Gpkg.h" /* Groups */ -#include "H5HLprivate.h" /* Local Heaps */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Ppublic.h" /* Property Lists */ -#include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Ppublic.h" /* Property Lists */ +#include "H5WBprivate.h" /* Wrapped Buffers */ /****************/ @@ -198,7 +197,7 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, /* Create a group ID to pass to the user-defined callback */ if(NULL == (grp = H5G_open(&grp_loc_copy))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((cur_grp = H5I_register(H5I_GROUP, grp, FALSE)) < 0) + if((cur_grp = H5VL_wrap_register(H5I_GROUP, grp, FALSE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") /* User-defined callback function */ @@ -324,7 +323,7 @@ H5G__traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, /* Traverse the link */ if(H5G__traverse_real(&tmp_grp_loc, lnk->u.soft.name, target, H5G__traverse_slink_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link") /* Pass back information about whether the object exists */ *obj_exists = udata.exists; @@ -359,8 +358,7 @@ done: */ herr_t H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, - unsigned target, hbool_t last_comp, H5G_loc_t *obj_loc, - hbool_t *obj_exists) + unsigned target, hbool_t last_comp, H5G_loc_t *obj_loc, hbool_t *obj_exists) { size_t nlinks; /* # of soft / UD links left to traverse */ herr_t ret_value = SUCCEED; /* Return value */ @@ -372,13 +370,13 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, HDassert(lnk); HDassert(obj_loc); - /* - * If we found a symbolic link then we should follow it. But if this + /* If we found a symbolic link then we should follow it. But if this * is the last component of the name and the H5G_TARGET_SLINK bit of * TARGET is set then we don't follow it. */ if(H5L_TYPE_SOFT == lnk->type && (0 == (target & H5G_TARGET_SLINK) || !last_comp)) { + /* Get the # of soft / UD links left to traverse */ if(H5CX_get_nlinks(&nlinks) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse") @@ -403,6 +401,7 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, */ if(lnk->type >= H5L_TYPE_UD_MIN && (0 == (target & H5G_TARGET_UDLINK) || !last_comp) ) { + /* Get the # of soft / UD links left to traverse */ if(H5CX_get_nlinks(&nlinks) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse") @@ -830,20 +829,21 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver if(!op) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no operation provided") - /* Retrieve the original # of soft / UD links that are able to be traversed */ - /* (So that multiple calls to H5G_traverse don't incorrectly look - * like they've traversed too many. Nested calls, like in H5L__move(), + /* Retrieve the original # of soft / UD links that are able to be traversed + * (So that multiple calls to H5G_traverse don't incorrectly look + * like they've traversed too many. Nested calls, like in H5L_move(), * may need their own mechanism to set & reset the # of links to traverse) */ if(H5CX_get_nlinks(&orig_nlinks) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse") /* Set up invalid tag. This is a precautionary step only. Setting an invalid - tag here will ensure that no metadata accessed while doing the traversal - is given an improper tag, unless another one is specifically set up - first. This will ensure we're not accidentally tagging something we - shouldn't be during the traversal. Note that for best tagging assertion - coverage, setting H5C_DO_TAGGING_SANITY_CHECKS is advised. */ + * tag here will ensure that no metadata accessed while doing the traversal + * is given an improper tag, unless another one is specifically set up + * first. This will ensure we're not accidentally tagging something we + * shouldn't be during the traversal. Note that for best tagging assertion + * coverage, setting H5C_DO_TAGGING_SANITY_CHECKS is advised. + */ H5_BEGIN_TAG(H5AC__INVALID_TAG); /* Go perform "real" traversal */ @@ -167,7 +167,7 @@ H5HF_create(H5F_t *f, const H5HF_create_t *cparam) /* Create shared fractal heap header */ if(HADDR_UNDEF == (fh_addr = H5HF_hdr_create(f, cparam))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create fractal heap header") /* Allocate fractal heap wrapper */ if(NULL == (fh = H5FL_MALLOC(H5HF_t))) diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 70dfeed..fc437dc 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -395,7 +395,7 @@ H5HF_hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) /* Load the fractal heap header */ if(NULL == (hdr = H5HF__hdr_protect(f, addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* Print the information about the heap's header */ H5HF_hdr_print(hdr, FALSE, stream, indent, fwidth); @@ -531,13 +531,13 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Load the fractal heap header */ if(NULL == (hdr = H5HF__hdr_protect(f, hdr_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* * Load the heap direct block */ if(NULL == (dblock = H5HF__man_dblock_protect(hdr, addr, block_size, NULL, 0, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap direct block") /* Print opening message */ HDfprintf(stream, "%*sFractal Heap Direct Block...\n", indent, ""); @@ -788,13 +788,13 @@ H5HF_iblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Load the fractal heap header */ if(NULL == (hdr = H5HF__hdr_protect(f, hdr_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* * Load the heap indirect block */ if(NULL == (iblock = H5HF__man_iblock_protect(hdr, addr, nrows, NULL, 0, FALSE, H5AC__READ_ONLY_FLAG, &did_protect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap indirect block") /* Print the information about the heap's indirect block */ H5HF_iblock_print(iblock, FALSE, stream, indent, fwidth); @@ -878,8 +878,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent, - int fwidth) +H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent, int fwidth) { H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */ herr_t ret_value = SUCCEED; /* Return value */ @@ -897,7 +896,7 @@ H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent, /* Load the fractal heap header */ if(NULL == (hdr = H5HF__hdr_protect(f, fh_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* Initialize the free space information for the heap */ if(H5HF__space_start(hdr, FALSE) < 0) diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 8166d88..b014017 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -484,7 +484,7 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* Second phase of header final initialization */ /* (needs ID and filter lengths set up) */ if(H5HF_hdr_finish_init_phase2(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "can't finish phase #2 of header final initialization") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "can't finish phase #2 of header final initialization") /* Extra checking for possible gap between max. direct block size minus * overhead and "huge" object size */ @@ -494,11 +494,11 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* Allocate space for the header on disk */ if(HADDR_UNDEF == (hdr->heap_addr = H5MF_alloc(f, H5FD_MEM_FHEAP_HDR, (hsize_t)hdr->heap_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for fractal heap header") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for fractal heap header") /* Cache the new fractal heap header */ if(H5AC_insert_entry(f, H5AC_FHEAP_HDR, hdr->heap_addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, HADDR_UNDEF, "can't add fractal heap header to cache") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, HADDR_UNDEF, "can't add fractal heap header to cache") /* Set address of heap header to return */ ret_value = hdr->heap_addr; diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index e5c2559..20a62b7 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -256,52 +256,52 @@ H5HF__iblock_decr(H5HF_indirect_t *iblock) /* Check for last reference to block */ if(iblock->rc == 0) { - /* If this indirect block has a parent, reset it's child iblock pointer */ - if(iblock->parent) { - H5HF_indirect_t *par_iblock = iblock->parent; /* Parent indirect block */ - unsigned indir_idx; /* Index in parent's child iblock pointer array */ - - /* Sanity check */ - HDassert(par_iblock->child_iblocks); - HDassert(iblock->par_entry >= (iblock->hdr->man_dtable.max_direct_rows - * iblock->hdr->man_dtable.cparam.width)); - - /* Compute index in parent's child iblock pointer array */ - indir_idx = iblock->par_entry - (iblock->hdr->man_dtable.max_direct_rows - * iblock->hdr->man_dtable.cparam.width); - - /* Reset pointer to pinned child indirect block in parent */ - HDassert(par_iblock->child_iblocks[indir_idx]); - par_iblock->child_iblocks[indir_idx] = NULL; - } /* end if */ - else { - /* Check for root indirect block */ - if(iblock->block_off == 0) { - /* Sanity check - shouldn't be recursively unpinning root indirect block */ - HDassert(iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PINNED); - - /* Check if we should reset the root iblock pointer */ - if(H5HF_ROOT_IBLOCK_PINNED == iblock->hdr->root_iblock_flags) { - HDassert(NULL != iblock->hdr->root_iblock); - iblock->hdr->root_iblock = NULL; - } /* end if */ - - /* Indicate that the root indirect block is unpinned */ - iblock->hdr->root_iblock_flags &= (unsigned)(~(H5HF_ROOT_IBLOCK_PINNED)); - } /* end if */ - } /* end else */ - - /* Check if the block is still in the cache */ - if(!iblock->removed_from_cache) { - /* Unpin the indirect block, making it evictable again */ - if(H5HF__iblock_unpin(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block") - } /* end if */ - else { - /* Destroy the indirect block */ - if(H5HF_man_iblock_dest(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") - } /* end else */ + /* If this indirect block has a parent, reset it's child iblock pointer */ + if(iblock->parent) { + H5HF_indirect_t *par_iblock = iblock->parent; /* Parent indirect block */ + unsigned indir_idx; /* Index in parent's child iblock pointer array */ + + /* Sanity check */ + HDassert(par_iblock->child_iblocks); + HDassert(iblock->par_entry >= (iblock->hdr->man_dtable.max_direct_rows + * iblock->hdr->man_dtable.cparam.width)); + + /* Compute index in parent's child iblock pointer array */ + indir_idx = iblock->par_entry - (iblock->hdr->man_dtable.max_direct_rows + * iblock->hdr->man_dtable.cparam.width); + + /* Reset pointer to pinned child indirect block in parent */ + HDassert(par_iblock->child_iblocks[indir_idx]); + par_iblock->child_iblocks[indir_idx] = NULL; + } /* end if */ + else { + /* Check for root indirect block */ + if(iblock->block_off == 0) { + /* Sanity check - shouldn't be recursively unpinning root indirect block */ + HDassert(iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PINNED); + + /* Check if we should reset the root iblock pointer */ + if(H5HF_ROOT_IBLOCK_PINNED == iblock->hdr->root_iblock_flags) { + HDassert(NULL != iblock->hdr->root_iblock); + iblock->hdr->root_iblock = NULL; + } /* end if */ + + /* Indicate that the root indirect block is unpinned */ + iblock->hdr->root_iblock_flags &= (unsigned)(~(H5HF_ROOT_IBLOCK_PINNED)); + } /* end if */ + } /* end else */ + + /* Check if the block is still in the cache */ + if(!iblock->removed_from_cache) { + /* Unpin the indirect block, making it evictable again */ + if(H5HF__iblock_unpin(iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block") + } /* end if */ + else { + /* Destroy the indirect block */ + if(H5HF_man_iblock_dest(iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") + } /* end else */ } /* end if */ done: @@ -408,13 +408,13 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) dblock->parent = iblock; dblock->par_entry = 0; - /* Destroy flush dependency between direct block and header */ - if(H5AC_destroy_flush_dependency(dblock->fd_parent, dblock) < 0) + /* Destroy flush dependency between direct block and header */ + if(H5AC_destroy_flush_dependency(dblock->fd_parent, dblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") dblock->fd_parent = NULL; - /* Create flush dependency between direct block and new root indirect block */ - if(H5AC_create_flush_dependency(iblock, dblock) < 0) + /* Create flush dependency between direct block and new root indirect block */ + if(H5AC_create_flush_dependency(iblock, dblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") dblock->fd_parent = iblock; @@ -1059,14 +1059,14 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, iblock->block_off += hdr->man_dtable.row_block_off[par_entry / hdr->man_dtable.cparam.width]; iblock->block_off += hdr->man_dtable.row_block_size[par_entry / hdr->man_dtable.cparam.width] * (par_entry % hdr->man_dtable.cparam.width); - /* Set indirect block parent as flush dependency parent */ - iblock->fd_parent = par_iblock; + /* Set indirect block parent as flush dependency parent */ + iblock->fd_parent = par_iblock; } /* end if */ else { iblock->block_off = 0; /* Must be the root indirect block... */ - /* Set heap header as flush dependency parent */ - iblock->fd_parent = hdr; + /* Set heap header as flush dependency parent */ + iblock->fd_parent = hdr; } /* end else */ /* Update indirect block's statistics */ @@ -1430,69 +1430,69 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) if(H5HF__man_iblock_root_revert(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't convert root indirect block back to root direct block") - /* If the indirect block wasn't removed already (by reverting it) */ - if(!iblock->removed_from_cache) { - /* Check for reducing size of root indirect block */ - if(iblock->nchildren > 0 && hdr->man_dtable.cparam.start_root_rows != 0 - && entry > iblock->max_child) { - unsigned max_child_row; /* Row for max. child entry */ - - /* Compute information needed for determining whether to reduce size of root indirect block */ - max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; - - /* Check if the root indirect block should be reduced */ - if(iblock->nrows > 1 && max_child_row <= (iblock->nrows / 2)) - if(H5HF__man_iblock_root_halve(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce size of root indirect block") - } /* end if */ - } /* end if */ + /* If the indirect block wasn't removed already (by reverting it) */ + if(!iblock->removed_from_cache) { + /* Check for reducing size of root indirect block */ + if(iblock->nchildren > 0 && hdr->man_dtable.cparam.start_root_rows != 0 + && entry > iblock->max_child) { + unsigned max_child_row; /* Row for max. child entry */ + + /* Compute information needed for determining whether to reduce size of root indirect block */ + max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; + + /* Check if the root indirect block should be reduced */ + if(iblock->nrows > 1 && max_child_row <= (iblock->nrows / 2)) + if(H5HF__man_iblock_root_halve(iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce size of root indirect block") + } /* end if */ + } /* end if */ } /* end if */ /* If the indirect block wasn't removed already (by reverting it) */ if(!iblock->removed_from_cache) { - /* Mark indirect block as modified */ - if(H5HF_iblock_dirty(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") - - /* Check for last child being removed from indirect block */ - if(iblock->nchildren == 0) { - hbool_t did_protect = FALSE; /* Whether the indirect block was protected */ - - /* If this indirect block's refcount is >1, then it's being deleted - * from the fractal heap (since its nchildren == 0), but is still - * referred to from free space sections in the heap (refcount >1). - * Its space in the file needs to be freed now, and it also needs - * to be removed from the metadata cache now, in case the space in - * the file is reused by another piece of metadata that is inserted - * into the cache before the indirect block's entry is evicted - * (having two entries at the same address would be an error, from - * the cache's perspective). - */ - /* Lock indirect block for deletion */ - if(NULL == (del_iblock = H5HF__man_iblock_protect(hdr, iblock->addr, iblock->nrows, iblock->parent, iblock->par_entry, TRUE, H5AC__NO_FLAGS_SET, &did_protect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") - HDassert(did_protect == TRUE); - - /* Check for deleting root indirect block (and no root direct block) */ - if(iblock->block_off == 0 && hdr->man_dtable.curr_root_rows > 0) - /* Reset header information back to "empty heap" state */ - if(H5HF__hdr_empty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty") - - /* Detach from parent indirect block */ - if(iblock->parent) { - /* Destroy flush dependency between indirect block and parent */ - if(H5AC_destroy_flush_dependency(iblock->fd_parent, iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") - iblock->fd_parent = NULL; - - /* Detach from parent indirect block */ - if(H5HF__man_iblock_detach(iblock->parent, iblock->par_entry) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block") - iblock->parent = NULL; - iblock->par_entry = 0; - } /* end if */ - } /* end if */ + /* Mark indirect block as modified */ + if(H5HF_iblock_dirty(iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") + + /* Check for last child being removed from indirect block */ + if(iblock->nchildren == 0) { + hbool_t did_protect = FALSE; /* Whether the indirect block was protected */ + + /* If this indirect block's refcount is >1, then it's being deleted + * from the fractal heap (since its nchildren == 0), but is still + * referred to from free space sections in the heap (refcount >1). + * Its space in the file needs to be freed now, and it also needs + * to be removed from the metadata cache now, in case the space in + * the file is reused by another piece of metadata that is inserted + * into the cache before the indirect block's entry is evicted + * (having two entries at the same address would be an error, from + * the cache's perspective). + */ + /* Lock indirect block for deletion */ + if(NULL == (del_iblock = H5HF__man_iblock_protect(hdr, iblock->addr, iblock->nrows, iblock->parent, iblock->par_entry, TRUE, H5AC__NO_FLAGS_SET, &did_protect))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") + HDassert(did_protect == TRUE); + + /* Check for deleting root indirect block (and no root direct block) */ + if(iblock->block_off == 0 && hdr->man_dtable.curr_root_rows > 0) + /* Reset header information back to "empty heap" state */ + if(H5HF__hdr_empty(hdr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty") + + /* Detach from parent indirect block */ + if(iblock->parent) { + /* Destroy flush dependency between indirect block and parent */ + if(H5AC_destroy_flush_dependency(iblock->fd_parent, iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + iblock->fd_parent = NULL; + + /* Detach from parent indirect block */ + if(H5HF__man_iblock_detach(iblock->parent, iblock->par_entry) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block") + iblock->parent = NULL; + iblock->par_entry = 0; + } /* end if */ + } /* end if */ } /* end if */ /* Decrement the reference count on this indirect block if we're not deleting it */ @@ -1501,48 +1501,48 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) * not being deleted) */ if(H5HF__iblock_decr(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") iblock = NULL; /* Delete indirect block from cache, if appropriate */ if(del_iblock) { - unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotect */ - hbool_t took_ownership = FALSE; /* Flag to indicate that block ownership has transitioned */ - - /* If the refcount is still >0, unpin the block and take ownership - * from the cache, otherwise let the cache destroy it. - */ - if(del_iblock->rc > 0) { - cache_flags |= (H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG); - cache_flags |= H5AC__UNPIN_ENTRY_FLAG; - took_ownership = TRUE; - } /* end if */ - else { - /* Entry should be removed from the cache */ - cache_flags |= H5AC__DELETED_FLAG; - - /* If the indirect block is in real file space, tell - * the cache to free its file space as well. - */ - if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) - cache_flags |= H5AC__FREE_FILE_SPACE_FLAG; - } /* end else */ - - /* Unprotect the indirect block, with appropriate flags */ - if(H5HF__man_iblock_unprotect(del_iblock, cache_flags, TRUE) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") - - /* if took ownership, free file space & mark block as removed from cache */ - if(took_ownership) { - /* Free indirect block disk space, if it's in real space */ - if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) - if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, del_iblock->addr, (hsize_t)del_iblock->size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space") - del_iblock->addr = HADDR_UNDEF; - - /* Mark block as removed from the cache */ - del_iblock->removed_from_cache = TRUE; - } /* end if */ + unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotect */ + hbool_t took_ownership = FALSE; /* Flag to indicate that block ownership has transitioned */ + + /* If the refcount is still >0, unpin the block and take ownership + * from the cache, otherwise let the cache destroy it. + */ + if(del_iblock->rc > 0) { + cache_flags |= (H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG); + cache_flags |= H5AC__UNPIN_ENTRY_FLAG; + took_ownership = TRUE; + } /* end if */ + else { + /* Entry should be removed from the cache */ + cache_flags |= H5AC__DELETED_FLAG; + + /* If the indirect block is in real file space, tell + * the cache to free its file space as well. + */ + if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) + cache_flags |= H5AC__FREE_FILE_SPACE_FLAG; + } /* end else */ + + /* Unprotect the indirect block, with appropriate flags */ + if(H5HF__man_iblock_unprotect(del_iblock, cache_flags, TRUE) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + + /* if took ownership, free file space & mark block as removed from cache */ + if(took_ownership) { + /* Free indirect block disk space, if it's in real space */ + if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) + if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, del_iblock->addr, (hsize_t)del_iblock->size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space") + del_iblock->addr = HADDR_UNDEF; + + /* Mark block as removed from the cache */ + del_iblock->removed_from_cache = TRUE; + } /* end if */ } /* end if */ done: @@ -1633,24 +1633,24 @@ H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, if(H5F_addr_defined(iblock->ents[entry].addr)) { /* Are we in a direct or indirect block row */ if(row < hdr->man_dtable.max_direct_rows) { - hsize_t dblock_size; /* Size of direct block on disk */ + hsize_t dblock_size; /* Size of direct block on disk */ - /* Check for I/O filters on this heap */ - if(hdr->filter_len > 0) - dblock_size = iblock->filt_ents[entry].size; - else - dblock_size = hdr->man_dtable.row_block_size[row]; + /* Check for I/O filters on this heap */ + if(hdr->filter_len > 0) + dblock_size = iblock->filt_ents[entry].size; + else + dblock_size = hdr->man_dtable.row_block_size[row]; /* Delete child direct block */ if(H5HF__man_dblock_delete(hdr->f, iblock->ents[entry].addr, dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap child direct block") } /* end if */ else { - hsize_t row_block_size; /* The size of blocks in this row */ + hsize_t row_block_size; /* The size of blocks in this row */ unsigned child_nrows; /* Number of rows in new indirect block */ - /* Get the row's block size */ - row_block_size = (hsize_t)hdr->man_dtable.row_block_size[row]; + /* Get the row's block size */ + row_block_size = (hsize_t)hdr->man_dtable.row_block_size[row]; /* Compute # of rows in next child indirect block to use */ child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, row_block_size); @@ -1733,30 +1733,30 @@ H5HF__man_iblock_size(H5F_t *f, H5HF_hdr_t *hdr, haddr_t iblock_addr, /* Indirect entries in this indirect block */ if(iblock->nrows > hdr->man_dtable.max_direct_rows) { - unsigned first_row_bits; /* Number of bits used bit addresses in first row */ + unsigned first_row_bits; /* Number of bits used bit addresses in first row */ unsigned num_indirect_rows; /* Number of rows of blocks in each indirect block */ unsigned entry; /* Current entry in row */ size_t u; /* Local index variable */ entry = hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width; - first_row_bits = H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + - H5VM_log2_of2(hdr->man_dtable.cparam.width); + first_row_bits = H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + + H5VM_log2_of2(hdr->man_dtable.cparam.width); num_indirect_rows = - (H5VM_log2_gen(hdr->man_dtable.row_block_size[hdr->man_dtable.max_direct_rows]) - first_row_bits) + 1; + (H5VM_log2_gen(hdr->man_dtable.row_block_size[hdr->man_dtable.max_direct_rows]) - first_row_bits) + 1; for(u = hdr->man_dtable.max_direct_rows; u < iblock->nrows; u++, num_indirect_rows++) { size_t v; /* Local index variable */ - for(v = 0; v < hdr->man_dtable.cparam.width; v++, entry++) - if(H5F_addr_defined(iblock->ents[entry].addr)) - if(H5HF__man_iblock_size(f, hdr, iblock->ents[entry].addr, num_indirect_rows, iblock, entry, heap_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to get fractal heap storage info for indirect block") + for(v = 0; v < hdr->man_dtable.cparam.width; v++, entry++) + if(H5F_addr_defined(iblock->ents[entry].addr)) + if(H5HF__man_iblock_size(f, hdr, iblock->ents[entry].addr, num_indirect_rows, iblock, entry, heap_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to get fractal heap storage info for indirect block") } /* end for */ } /* end if */ done: /* Release the indirect block */ if(iblock && H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") iblock = NULL; FUNC_LEAVE_NOAPI(ret_value) @@ -1810,17 +1810,17 @@ H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off, */ prev_par_block_off = par_block_off = 0; while(row >= hdr->man_dtable.max_direct_rows) { - /* Retain previous parent block offset */ - prev_par_block_off = par_block_off; + /* Retain previous parent block offset */ + prev_par_block_off = par_block_off; /* Compute the new parent indirect block's offset in the heap's address space */ /* (based on previous block offset) */ par_block_off += hdr->man_dtable.row_block_off[row]; par_block_off += hdr->man_dtable.row_block_size[row] * col; - /* Preserve current row & column */ - prev_row = row; - prev_col = col; + /* Preserve current row & column */ + prev_row = row; + prev_col = col; /* Look up row & column in new indirect block for object */ if(H5HF_dtable_lookup(&hdr->man_dtable, (block_off - par_block_off), &row, &col) < 0) diff --git a/src/H5HFman.c b/src/H5HFman.c index 394bcff..7f90f49 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -140,6 +140,7 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) /* Check for row section */ if(sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW || sec_node->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW) { + /* Allocate 'single' selection out of 'row' selection */ if(H5HF__man_iblock_alloc_row(hdr, &sec_node) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't break up row section") diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h index 5086afb..4eec1c1 100644 --- a/src/H5HFprivate.h +++ b/src/H5HFprivate.h @@ -25,9 +25,6 @@ #ifndef _H5HFprivate_H #define _H5HFprivate_H -/* Include package's public header */ -#include "H5HFpublic.h" - /* Private headers needed by this file */ #include "H5Fprivate.h" /* File access */ #include "H5Oprivate.h" /* Object headers */ @@ -110,15 +107,13 @@ H5_DLL H5HF_t *H5HF_create(H5F_t *f, const H5HF_create_t *cparam); H5_DLL H5HF_t *H5HF_open(H5F_t *f, haddr_t fh_addr); H5_DLL herr_t H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p/*out*/); H5_DLL herr_t H5HF_get_heap_addr(const H5HF_t *fh, haddr_t *heap_addr/*out*/); -H5_DLL herr_t H5HF_insert(H5HF_t *fh, size_t size, const void *obj, - void *id/*out*/); +H5_DLL herr_t H5HF_insert(H5HF_t *fh, size_t size, const void *obj, void *id/*out*/); H5_DLL herr_t H5HF_get_obj_len(H5HF_t *fh, const void *id, size_t *obj_len_p/*out*/); H5_DLL herr_t H5HF_get_obj_off(H5HF_t *fh, const void *_id, hsize_t *obj_off_p/*out*/); H5_DLL herr_t H5HF_read(H5HF_t *fh, const void *id, void *obj/*out*/); H5_DLL herr_t H5HF_write(H5HF_t *fh, void *id, hbool_t *id_changed, const void *obj); -H5_DLL herr_t H5HF_op(H5HF_t *fh, const void *id, H5HF_operator_t op, - void *op_data); +H5_DLL herr_t H5HF_op(H5HF_t *fh, const void *id, H5HF_operator_t op, void *op_data); H5_DLL herr_t H5HF_remove(H5HF_t *fh, const void *id); H5_DLL herr_t H5HF_close(H5HF_t *fh); H5_DLL herr_t H5HF_delete(H5F_t *f, haddr_t fh_addr); @@ -128,11 +123,9 @@ H5_DLL herr_t H5HF_stat_info(const H5HF_t *fh, H5HF_stat_t *stats); H5_DLL herr_t H5HF_size(const H5HF_t *fh, hsize_t *heap_size/*out*/); /* Debugging routines */ -H5_DLL herr_t H5HF_id_print(H5HF_t *fh, const void *id, FILE *stream, - int indent, int fwidth); +H5_DLL herr_t H5HF_id_print(H5HF_t *fh, const void *id, FILE *stream, int indent, int fwidth); #ifdef H5HF_DEBUGGING -H5_DLL herr_t H5HF_sects_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, - int fwidth); +H5_DLL herr_t H5HF_sects_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth); #endif /* H5HF_DEBUGGING */ #endif /* _H5HFprivate_H */ diff --git a/src/H5HFpublic.h b/src/H5HFpublic.h deleted file mode 100644 index 82cfc21..0000000 --- a/src/H5HFpublic.h +++ /dev/null @@ -1,52 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/*------------------------------------------------------------------------- - * - * Created: H5HFpublic.h - * Feb 24 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> - * - * Purpose: Public declarations for the fractal heap package. - * - *------------------------------------------------------------------------- - */ - -#ifndef _H5HFpublic_H -#define _H5HFpublic_H - -/* Public headers needed by this file */ -#include "H5public.h" - -/*****************/ -/* Public Macros */ -/*****************/ - -/*******************/ -/* Public Typedefs */ -/*******************/ - -/**********************************/ -/* Public API Function Prototypes */ -/**********************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _H5HFpublic_H */ - diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 66c8414..36e966e 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -692,8 +692,7 @@ H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, *------------------------------------------------------------------------- */ herr_t -H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, - size_t amt) +H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, size_t amt) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2094,8 +2093,7 @@ H5HF__sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t *------------------------------------------------------------------------- */ static herr_t -H5HF__sect_row_debug(const H5FS_section_info_t *_sect, - FILE *stream, int indent, int fwidth) +H5HF__sect_row_debug(const H5FS_section_info_t *_sect, FILE *stream, int indent, int fwidth) { const H5HF_free_section_t *sect = (const H5HF_free_section_t *)_sect; /* Section to dump info */ @@ -2666,8 +2664,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, - unsigned start_entry, unsigned nentries) +H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start_entry, unsigned nentries) { H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */ H5HF_free_section_t *first_row_sect = NULL; /* First row section in new indirect section */ @@ -2841,8 +2838,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, - H5HF_indirect_t *sect_iblock) +H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_indirect_t *sect_iblock) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5HFspace.c b/src/H5HFspace.c index 5260ae2..37a0502 100644 --- a/src/H5HFspace.c +++ b/src/H5HFspace.c @@ -311,7 +311,7 @@ H5HF__space_revert_root(const H5HF_hdr_t *hdr) /* Only need to scan the sections if the free space has been initialized */ if(hdr->fspace) - /* Iterate over all sections, resetting the parent pointers in 'single' sections */ + /* Iterate over all sections, resetting the parent pointers in 'single' sections */ if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF_space_revert_root_cb, NULL) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to reset parent pointers") @@ -404,7 +404,7 @@ H5HF__space_create_root(const H5HF_hdr_t *hdr, H5HF_indirect_t *root_iblock) /* Only need to scan the sections if the free space has been initialized */ if(hdr->fspace) - /* Iterate over all sections, seting the parent pointers in 'single' sections to the new indirect block */ + /* Iterate over all sections, seting the parent pointers in 'single' sections to the new indirect block */ if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF_space_create_root_cb, root_iblock) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to set parent pointers") @@ -602,8 +602,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, - uint16_t new_class) +H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, uint16_t new_class) { herr_t ret_value = SUCCEED; /* Return value */ @@ -83,7 +83,7 @@ /********************/ static haddr_t H5HG__create(H5F_t *f, size_t size); - +static size_t H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr); /*********************/ /* Package Variables */ @@ -204,11 +204,11 @@ H5HG__create(H5F_t *f, size_t size) /* Add this heap to the beginning of the CWFS list */ if(H5F_cwfs_add(f, heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to add global heap collection to file's CWFS") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to add global heap collection to file's CWFS") /* Add the heap to the cache */ if(H5AC_insert_entry(f, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to cache global heap collection") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to cache global heap collection") ret_value = addr; @@ -223,7 +223,7 @@ done: /* Check if the heap object was allocated */ if(heap) /* Destroy the heap object */ - if(H5HG_free(heap) < 0) + if(H5HG__free(heap) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy global heap collection") } /* end if */ } /* end if */ @@ -275,7 +275,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HG_alloc + * Function: H5HG__alloc * * Purpose: Given a heap with enough free space, this function will split * the free space to make a new empty heap object and initialize @@ -293,14 +293,14 @@ done: *------------------------------------------------------------------------- */ static size_t -H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) +H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) { size_t idx; uint8_t *p; size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(heap); @@ -363,27 +363,27 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) heap->obj[0].begin = NULL; } /* end if */ else if(heap->obj[0].size-need >= H5HG_SIZEOF_OBJHDR (f)) { - /* - * Some free space remains and it's larger than a heap object header, - * so write the new free heap object header to the heap. - */ - heap->obj[0].size -= need; - heap->obj[0].begin += need; - p = heap->obj[0].begin; - UINT16ENCODE(p, 0); /*id*/ - UINT16ENCODE(p, 0); /*nrefs*/ - UINT32ENCODE(p, 0); /*reserved*/ - H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); - HDassert(H5HG_ISALIGNED(heap->obj[0].size)); + /* + * Some free space remains and it's larger than a heap object header, + * so write the new free heap object header to the heap. + */ + heap->obj[0].size -= need; + heap->obj[0].begin += need; + p = heap->obj[0].begin; + UINT16ENCODE(p, 0); /*id*/ + UINT16ENCODE(p, 0); /*nrefs*/ + UINT32ENCODE(p, 0); /*reserved*/ + H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); + HDassert(H5HG_ISALIGNED(heap->obj[0].size)); } /* end else-if */ else { - /* - * Some free space remains but it's smaller than a heap object header, - * so we don't write the header. - */ - heap->obj[0].size -= need; - heap->obj[0].begin += need; - HDassert(H5HG_ISALIGNED(heap->obj[0].size)); + /* + * Some free space remains but it's smaller than a heap object header, + * so we don't write the header. + */ + heap->obj[0].size -= need; + heap->obj[0].begin += need; + HDassert(H5HG_ISALIGNED(heap->obj[0].size)); } /* Mark the heap as dirty */ @@ -394,7 +394,7 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) done: FUNC_LEAVE_NOAPI(ret_value); -} /* end H5HG_alloc() */ +} /* end H5HG__alloc() */ /*------------------------------------------------------------------------- @@ -522,7 +522,7 @@ H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/) HDassert(hobj); if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") /* Find a large enough collection on the CWFS list */ need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); @@ -548,7 +548,7 @@ H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap") /* Split the free space to make room for the new object */ - if(0 == (idx = H5HG_alloc(f, heap, size, &heap_flags))) + if(0 == (idx = H5HG__alloc(f, heap, size, &heap_flags))) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate global heap object") /* Copy data into the heap */ @@ -608,7 +608,7 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object/*out*/, size_t *buf_size) /* Load the heap */ if(NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap") HDassert(hobj->idx < heap->nused); HDassert(heap->obj[hobj->idx].begin); @@ -617,7 +617,7 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object/*out*/, size_t *buf_size) /* Allocate a buffer for the object read in, if the user didn't give one */ if(!object && NULL == (object = H5MM_malloc(size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemcpy(object, p, size); /* @@ -678,7 +678,7 @@ H5HG_link(H5F_t *f, const H5HG_t *hobj, int adjust) HDassert(f); HDassert(hobj); if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") /* Load the heap */ if(NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__NO_FLAGS_SET))) @@ -785,7 +785,14 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap") HDassert(hobj->idx < heap->nused); - HDassert(heap->obj[hobj->idx].begin); + + /* When the application selects the same location to rewrite the VL element by using H5Sselect_elements, + * it can happen that the entry has been removed by first rewrite. Here we simply skip the removal of + * the entry and let the second rewrite happen (see HDFFV-10635). In the future, it'd be nice to handle + * this situation in H5T_conv_vlen in H5Tconv.c instead of this level (HDFFV-10648). */ + if(heap->obj[hobj->idx].nrefs == 0 && heap->obj[hobj->idx].size == 0 && !heap->obj[hobj->idx].begin) + HGOTO_DONE(ret_value) + obj_start = heap->obj[hobj->idx].begin; /* Include object header size */ need = H5HG_ALIGN(heap->obj[hobj->idx].size) + H5HG_SIZEOF_OBJHDR(f); @@ -839,11 +846,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5HG_free + * Function: H5HG__free * - * Purpose: Destroys a global heap collection in memory + * Purpose: Destroys a global heap collection in memory * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, January 15, 2003 @@ -851,7 +858,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HG_free(H5HG_heap_t *heap) +H5HG__free(H5HG_heap_t *heap) { herr_t ret_value = SUCCEED; /* Return value */ @@ -872,5 +879,5 @@ H5HG_free(H5HG_heap_t *heap) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HG_free() */ +} /* H5HG__free() */ diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 3a770ae..beaea7b 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -374,7 +374,7 @@ H5HG__cache_heap_deserialize(const void *_image, size_t len, void *_udata, done: if(!ret_value && heap) - if(H5HG_free(heap) < 0) + if(H5HG__free(heap) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy global heap collection") FUNC_LEAVE_NOAPI(ret_value) @@ -485,7 +485,7 @@ H5HG__cache_heap_free_icr(void *_thing) HDassert(heap->cache_info.type == H5AC_GHEAP); /* Destroy global heap collection */ - if(H5HG_free(heap) < 0) + if(H5HG__free(heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy global heap collection") done: diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index a735ba0..4ed9b10 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -137,7 +137,7 @@ struct H5HG_heap_t { /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5HG_free(H5HG_heap_t *heap); +H5_DLL herr_t H5HG__free(H5HG_heap_t *heap); H5_DLL H5HG_heap_t *H5HG__protect(H5F_t *f, haddr_t addr, unsigned flags); #endif /* _H5HGpkg_H */ diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h index a7d7a80..1c609e2 100644 --- a/src/H5HGprivate.h +++ b/src/H5HGprivate.h @@ -18,9 +18,6 @@ #ifndef _H5HGprivate_H #define _H5HGprivate_H -/* Include package's public header */ -#include "H5HGpublic.h" - /* Private headers needed by this file. */ #include "H5Fprivate.h" /* File access */ diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index e4e6fa8..edb0261 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -76,10 +76,10 @@ H5HL_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, int fwidth)) "Data bytes allocated for heap:", h->dblk_size); - /* - * Traverse the free list and check that all free blocks fall within + /* Traverse the free list and check that all free blocks fall within * the heap and that no two free blocks point to the same region of - * the heap. */ + * the heap. + */ if(NULL == (marker = (uint8_t *)H5MM_calloc(h->dblk_size))) H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); @@ -88,35 +88,30 @@ H5HL_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, int fwidth)) char temp_str[32]; HDsnprintf(temp_str, sizeof(temp_str), "Block #%d:", free_block); - HDfprintf(stream, "%*s%-*s %8Zu, %8Zu\n", indent+3, "", MAX(0,fwidth-9), - temp_str, - freelist->offset, freelist->size); - if((freelist->offset + freelist->size) > h->dblk_size) - HDfprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n"); - else { + HDfprintf(stream, "%*s%-*s %8Zu, %8Zu\n", indent+3, "", MAX(0,fwidth-9), temp_str, freelist->offset, freelist->size); + if((freelist->offset + freelist->size) > h->dblk_size) + HDfprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n"); + else { int overlap = 0; size_t i; - for(i = 0; i < freelist->size; i++) { - if(marker[freelist->offset + i]) - overlap++; - marker[freelist->offset + i] = 1; - } /* end for */ - if(overlap) - HDfprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); - else - amount_free += freelist->size; - } /* end for */ + for(i = 0; i < freelist->size; i++) { + if(marker[freelist->offset + i]) + overlap++; + marker[freelist->offset + i] = 1; + } /* end for */ + if(overlap) + HDfprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); + else + amount_free += freelist->size; + } /* end else */ } /* end for */ if(h->dblk_size) - HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, - "Percent of heap used:", - ((double)100.0f * (double)(h->dblk_size - amount_free) / (double)h->dblk_size)); + HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:", + ((double)100.0f * (double)(h->dblk_size - amount_free) / (double)h->dblk_size)); - /* - * Print the data in a VMS-style octal dump. - */ + /* Print the data in a VMS-style octal dump */ H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size); CATCH @@ -127,3 +122,4 @@ CATCH H5E_THROW(H5E_CANTFREE, "can't free marker buffer"); END_FUNC(PRIV) /* end H5HL_debug() */ + diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index 4001ef1..7a53b25 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -24,9 +24,6 @@ #ifndef _H5HLprivate_H #define _H5HLprivate_H -/* Include package's public header */ -#include "H5HLpublic.h" - /* Private headers needed by this file. */ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ @@ -26,28 +26,24 @@ */ #include "H5Imodule.h" /* This source code file is part of the H5I module */ +#define H5T_FRIEND /* Suppress error about including H5Tpkg */ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Gprivate.h" /* Groups */ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ #include "H5SLprivate.h" /* Skip Lists */ +#include "H5Tpkg.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ -/* Define this to compile in support for dumping ID information */ -/* #define H5I_DEBUG_OUTPUT */ -#ifndef H5I_DEBUG_OUTPUT -#include "H5Gprivate.h" /* Groups */ -#else /* H5I_DEBUG_OUTPUT */ -#define H5G_FRIEND /* Suppress error about including H5Gpkg */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Tprivate.h" /* Datatypes */ -#endif /* H5I_DEBUG_OUTPUT */ /* Local Macros */ @@ -80,11 +76,24 @@ typedef struct { void *ret_obj; /* Object to return */ } H5I_search_ud_t; +typedef struct { + H5I_iterate_func_t op; /* Application's callback routine */ + void *op_data; /* Application's user data */ +} H5I_iterate_pub_ud_t; + +/* User data for iterator callback for retrieving an ID corresponding to an object pointer */ +typedef struct { + const void *object; /* object pointer to search for */ + H5I_type_t obj_type; /* type of object we are searching for */ + hid_t ret_id; /* ID returned */ +} H5I_get_id_ud_t; + /* User data for iterator callback for ID iteration */ typedef struct { H5I_search_func_t user_func; /* 'User' function to invoke */ void *user_udata; /* User data to pass to 'user' function */ hbool_t app_ref; /* Whether this is an appl. ref. call */ + H5I_type_t obj_type; /* Type of object we are iterating over */ } H5I_iterate_ud_t; /* User data for H5I__clear_type_cb */ @@ -119,7 +128,10 @@ H5FL_DEFINE_STATIC(H5I_id_type_t); /* Declare a free list to manage the H5I_class_t struct */ H5FL_DEFINE_STATIC(H5I_class_t); +H5FL_EXTERN(H5VL_object_t); + /*--------------------- Local function prototypes ---------------------------*/ +static void *H5I__unwrap(void *obj_ptr, H5I_type_t type); static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata); static int H5I__destroy_type(H5I_type_t type); static void *H5I__remove_verify(hid_t id, H5I_type_t id_type); @@ -128,11 +140,9 @@ static int H5I__inc_type_ref(H5I_type_t type); static int H5I__get_type_ref(H5I_type_t type); static int H5I__search_cb(void *obj, hid_t id, void *_udata); static H5I_id_info_t *H5I__find_id(hid_t id); -static ssize_t H5I__get_name(const H5G_loc_t *loc, char *name, size_t size); -#ifdef H5I_DEBUG_OUTPUT -static int H5I__debug_cb(void *_item, void *_key, void *_udata); -static herr_t H5I__debug(H5I_type_t type); -#endif /* H5I_DEBUG_OUTPUT */ +static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata); +static int H5I__find_id_cb(void *_item, void *_key, void *_udata); +static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); /*------------------------------------------------------------------------- @@ -145,7 +155,7 @@ static herr_t H5I__debug(H5I_type_t type); * Return: Success: Positive if any action was taken that might * affect some other interface; zero otherwise. * - * Failure: Negative. + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -443,6 +453,50 @@ done: /*------------------------------------------------------------------------- + * Function: H5I__unwrap + * + * Purpose: Unwraps the object pointer for the 'item' that corresponds + * to an ID. + * + * Return: Pointer to the unwrapped pointer (can't fail) + * + * Programmer: Quincey Koziol + * Friday, October 19, 2018 + * + *------------------------------------------------------------------------- + */ +static void * +H5I__unwrap(void *obj_ptr, H5I_type_t type) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(obj_ptr); + + /* The stored object pointer might be an H5VL_object_t, in which + * case we'll need to get the wrapped object struct (H5F_t *, etc.). + */ + if(H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { + const H5VL_object_t *vol_obj; + + vol_obj = (const H5VL_object_t *)obj_ptr; + ret_value = H5VL_object_data(vol_obj); + } /* end if */ + else if(H5I_DATATYPE == type) { + H5T_t *dt = (H5T_t *)obj_ptr; + + ret_value = (void *)H5T_get_actual_type(dt); + } /* end if */ + else + ret_value = obj_ptr; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__unwrap() */ + + +/*------------------------------------------------------------------------- * Function: H5Iclear_type * * Purpose: Removes all objects from the type, calling the free @@ -538,6 +592,7 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(id); HDassert(udata); HDassert(udata->type_ptr); @@ -547,12 +602,11 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) */ if(udata->force || (id->count - (!udata->app_ref * id->app_count)) <= 1) { /* Check for a 'free' function and call it, if it exists */ - /* (Casting away const OK -QAK) */ - if(udata->type_ptr->cls->free_func && (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { + if(udata->type_ptr->cls->free_func && (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { /* (Casting away const OK -QAK) */ if(udata->force) { #ifdef H5I_DEBUG if(H5DEBUG(I)) { - fprintf(H5DEBUG(I), "H5I: free type=%d obj=0x%08lx " + HDfprintf(H5DEBUG(I), "H5I: free type=%d obj=0x%08lx " "failure ignored\n", (int)udata->type_ptr->cls->type_id, (unsigned long)(id->obj_ptr)); @@ -755,7 +809,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_register_with_id + * Function: H5I_register_using_existing_id * * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it. * This routine will check to ensure the supplied ID is not already @@ -764,12 +818,16 @@ done: * registered (thus, it is possible to register one object under * multiple IDs). * + * NOTE: Intended for use in refresh calls, where we have to close + * and re-open the underlying data, then hook the object back + * up to the original ID. + * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t id) +H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id) { H5I_id_type_t *type_ptr; /* ptr to the type */ H5I_id_info_t *id_ptr; /* ptr to the new ID information */ @@ -781,7 +839,7 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t HDassert(object); /* Make sure ID is not already in use */ - if(NULL != (id_ptr = H5I__find_id(id))) + if(NULL != (id_ptr = H5I__find_id(existing_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "ID already in use") /* Make sure type number is valid */ @@ -795,7 +853,7 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Make sure requested ID belongs to object's type */ - if(H5I_TYPE(id) != type) + if(H5I_TYPE(existing_id) != type) HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "invalid type for provided ID") /* Allocate new structure to house this ID */ @@ -803,7 +861,7 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed") /* Create the struct & insert requested ID */ - id_ptr->id = id; + id_ptr->id = existing_id; id_ptr->count = 1; /* initial reference count*/ id_ptr->app_count = !!app_ref; id_ptr->obj_ptr = object; @@ -815,7 +873,7 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_register_with_id() */ +} /* end H5I_register_using_existing_id() */ /*------------------------------------------------------------------------- @@ -845,8 +903,7 @@ H5I_subst(hid_t id, const void *new_object) HGOTO_ERROR(H5E_ATOM, H5E_NOTFOUND, NULL, "can't get ID ref count") /* Get the old object pointer to return */ - /* (Casting away const OK -QAK) */ - ret_value = (void *)id_ptr->obj_ptr; + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ /* Set the new object pointer for the ID */ id_ptr->obj_ptr = new_object; @@ -1851,6 +1908,91 @@ done: /*------------------------------------------------------------------------- + * Function: H5I__iterate_pub_cb + * + * Purpose: Callback routine for H5Iiterate, when it calls + * H5I_iterate. Calls "user" callback search function, and + * then sets return value, based on the result of that + * callback. + * + * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1) + * Failure: H5_ITER_ERROR (-1) + * + * Programmer: Neil Fortner + * Friday, October 11, 2013 + * + *------------------------------------------------------------------------- + */ +static int +H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata) +{ + H5I_iterate_pub_ud_t *udata = (H5I_iterate_pub_ud_t *)_udata; /* User data for callback */ + herr_t cb_ret_val; /* User callback return value */ + int ret_value = H5_ITER_ERROR; /* Callback return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Invoke the callback */ + cb_ret_val = (*udata->op)(id, udata->op_data); + + /* Set the return value based on the callback's return value */ + if(cb_ret_val > 0) + ret_value = H5_ITER_STOP; /* terminate iteration early */ + else if(cb_ret_val < 0) + ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__iterate_pub_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5Iiterate + * + * Purpose: Call the callback funciton op for each member of the id + * type type. op takes as parameters the id and a + * passthrough of op_data, and returns an herr_t. A positive + * return from op will cause the iteration to stop and + * H5Iiterate will return the value returned by op. A + * negative return from op will cause the iteration to stop + * and H5Iiterate will return failure. A zero return from op + * will allow iteration to continue, as long as there are + * other ids remaining in type. + * + * Limitation: Currently there is no way to start searching from where a + * previous search left off. + * + * Return: The last value returned by op + * + * Programmer: Neil Fortner + * Friday, October 11, 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data) +{ + H5I_iterate_pub_ud_t int_udata; /* Internal user data */ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "Itx*x", type, op, op_data); + + /* Set up udata struct */ + int_udata.op = op; + int_udata.op_data = op_data; + + /* Note that H5I_iterate returns an error code. We ignore it + * here, as we can't do anything with it without revising the API. + */ + if ((ret_value = H5I_iterate(type, H5I__iterate_pub_cb, &int_udata, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "can't iterate over ids") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Iiterate() */ + + +/*------------------------------------------------------------------------- * Function: H5I__iterate_cb * * Purpose: Callback routine for H5I_iterate, invokes "user" callback @@ -1875,17 +2017,24 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) * its reference count is positive. */ if((!udata->app_ref) || (item->app_count > 0)) { + H5I_type_t type = udata->obj_type; + const void *obj_ptr = NULL; herr_t cb_ret_val; + /* The stored object pointer might be an H5VL_object_t, in which + * case we'll need to get the wrapped object struct (H5F_t *, etc.). + */ + obj_ptr = H5I__unwrap((void *)item->obj_ptr, type); + /* Invoke callback function */ - cb_ret_val = (*udata->user_func)((void *)item->obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */ + cb_ret_val = (*udata->user_func)((void *)obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */ /* Set the return value based on the callback's return value */ if(cb_ret_val > 0) ret_value = H5_ITER_STOP; /* terminate iteration early */ else if(cb_ret_val < 0) ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ - } + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__iterate_cb() */ @@ -1938,11 +2087,12 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re iter_udata.user_func = func; iter_udata.user_udata = udata; iter_udata.app_ref = app_ref; + iter_udata.obj_type = type; /* Iterate over IDs */ if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") - } + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1996,6 +2146,9 @@ done: * * Failure: -1 * + * NOTE: Not safe for arbitrary VOL connectors as it relies on + * private H5G calls. + * * Comments: Public function * If 'name' is non-NULL then write up to 'size' bytes into that * buffer and always return the length of the entry name. @@ -2011,65 +2164,36 @@ 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_loc_params_t loc_params; H5G_loc_t loc; /* Object location */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", id, name, size); - /* Get object location */ - if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") - - /* Call internal routine to retrieve object's name */ - if((ret_value = H5I__get_name(&loc, name, size)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Iget_name() */ - - -/*------------------------------------------------------------------------- - * Function: H5I__get_name - * - * Purpose: Internal routine to retrieve the name for an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: The length of the name - * Failure: -1 - * - * Programmer: Quincey Koziol - * January 9, 2018 - * - *------------------------------------------------------------------------- - */ -static ssize_t -H5I__get_name(const H5G_loc_t *loc, char *name, size_t size) -{ - ssize_t ret_value = -1; /* Return value */ - - FUNC_ENTER_STATIC_VOL + /* Get the object pointer */ + if(NULL == (vol_obj = H5VL_vol_object(id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") - /* Check arguments */ - HDassert(loc); + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(id); /* Retrieve object's name */ - if((ret_value = H5G_get_name(loc, name, size, NULL)) < 0) + if(H5VL_object_get(vol_obj, &loc_params, H5VL_ID_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5I__get_name() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Iget_name() */ /*------------------------------------------------------------------------- * Function: H5Iget_file_id * - * Purpose: The public version of H5I_get_file_id(), obtains the file - * ID given an object ID. User has to close this ID. + * Purpose: Obtains the file ID given an object ID. The user has to + * close this ID. * * Return: Success: The file ID associated with the object * @@ -2091,9 +2215,9 @@ H5Iget_file_id(hid_t obj_id) /* Call internal function */ if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - if ((ret_value = H5I_get_file_id(obj_id, type)) < 0) + if ((ret_value = H5F_get_file_id(obj_id, type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") - } + } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "not an ID of a file object") @@ -2103,52 +2227,94 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_get_file_id + * Function: H5I__find_id_cb * - * Purpose: The private version of H5Iget_file_id(), obtains the file - * ID given an object ID. + * Purpose: Callback for searching for an ID with a specific pointer * - * Return: Success: The file ID associated with the object - * Failure: H5I_INVALID_HID + * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1) + * Failure: H5_ITER_ERROR (-1) * *------------------------------------------------------------------------- */ -hid_t -H5I_get_file_id(hid_t obj_id, H5I_type_t type) +static int +H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ + H5I_get_id_ud_t *udata = (H5I_get_id_ud_t *)_udata; /* Pointer to user data */ + H5I_type_t type = udata->obj_type; + const void *obj_ptr = NULL; + int ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC_NOERR - /* Process based on object type */ - if (type == H5I_FILE) { - /* Increment reference count on file ID */ - if(H5I_inc_ref(obj_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") + /* Sanity check */ + HDassert(item); + HDassert(udata); - /* Set return value */ - ret_value = obj_id; - } - else { - H5G_loc_t loc; /* Location of object */ + /* Get a pointer to the VOL connector's data */ + obj_ptr = H5I__unwrap(item->obj_ptr, type); - /* Get the object location information */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't get object location") + /* Check for a match */ + if (obj_ptr == udata->object) { + udata->ret_id = item->id; + ret_value = H5_ITER_STOP; + } /* end if */ - /* Get the file ID for the object */ - if((ret_value = H5F_get_id(loc.oloc->file, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't get file ID") - } + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__find_id_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5I_find_id + * + * Purpose: Return the ID of an object by searching through the ID list + * for the type. + * + * Return: SUCCEED/FAIL + * (id will be set to H5I_INVALID_HID on errors or not found) + * + *------------------------------------------------------------------------- + */ +herr_t +H5I_find_id(const void *object, H5I_type_t type, hid_t *id) +{ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(id); + + *id = H5I_INVALID_HID; + + type_ptr = H5I_id_type_list_g[type]; + if (!type_ptr || type_ptr->init_count <= 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") + + /* Only iterate through ID list if it is initialized and there are IDs in type */ + if (type_ptr->init_count > 0 && type_ptr->id_count > 0) { + H5I_get_id_ud_t udata; /* User data */ + herr_t iter_status; /* Iteration status */ + + /* Set up iterator user data */ + udata.object = object; + udata.obj_type = type; + udata.ret_id = H5I_INVALID_HID; + + /* Iterate over IDs for the ID type */ + if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__find_id_cb, &udata)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") + + *id = udata.ret_id; + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_get_file_id() */ +} /* end H5I_find_id() */ -#ifdef H5I_DEBUG_OUTPUT /*------------------------------------------------------------------------- - * Function: H5I__debug_cb + * Function: H5I__id_dump_cb * * Purpose: Dump the contents of an ID to stderr for debugging. * @@ -2157,11 +2323,12 @@ done: *------------------------------------------------------------------------- */ static int -H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) +H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ H5G_name_t *path = NULL; /* Path to file object */ + const void *obj_ptr = NULL; /* Pointer to VOL connector object */ FUNC_ENTER_STATIC_NOERR @@ -2173,19 +2340,33 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) switch (type) { case H5I_GROUP: { - path = H5G_nameof((H5G_t*)item->obj_ptr); + const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; + + obj_ptr = H5VL_object_data(vol_obj); + if(H5_VOL_NATIVE == vol_obj->connector->cls->value) + path = H5G_nameof((const H5G_t *)obj_ptr); break; } + case H5I_DATASET: { - path = H5D_nameof((H5D_t*)item->obj_ptr); + const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; + + obj_ptr = H5VL_object_data(vol_obj); + if(H5_VOL_NATIVE == vol_obj->connector->cls->value) + path = H5D_nameof((const H5D_t *)obj_ptr); break; } + case H5I_DATATYPE: { - path = H5T_nameof((H5T_t*)item->obj_ptr); + const H5T_t *dt = (const H5T_t *)item->obj_ptr; + + obj_ptr = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */ + path = H5T_nameof((const H5T_t *)obj_ptr); break; } + case H5I_UNINIT: case H5I_BADID: case H5I_FILE: @@ -2193,6 +2374,7 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -2211,11 +2393,11 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) } FUNC_LEAVE_NOAPI(H5_ITER_CONT) -} /* end H5I__debug_cb() */ +} /* end H5I__id_dump_cb() */ /*------------------------------------------------------------------------- - * Function: H5I__debug + * Function: H5I_dump_ids_for_type * * Purpose: Dump the contents of a type to stderr for debugging. * @@ -2223,27 +2405,33 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) * *------------------------------------------------------------------------- */ -static herr_t -H5I__debug(H5I_type_t type) +herr_t +H5I_dump_ids_for_type(H5I_type_t type) { - H5I_id_type_t *type_ptr; + H5I_id_type_t *type_ptr = NULL; - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_NOAPI_NOERR HDfprintf(stderr, "Dumping ID type %d\n", (int)type); type_ptr = H5I_id_type_list_g[type]; - /* Header */ - HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count); - HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); - HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count); - HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid); + if(type_ptr) { + + /* Header */ + HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count); + HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); + HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count); + HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid); - /* List */ - HDfprintf(stderr, " List:\n"); - H5SL_iterate(type_ptr->ids, H5I__debug_cb, &type); + /* List */ + if(type_ptr->id_count > 0) { + HDfprintf(stderr, " List:\n"); + H5SL_iterate(type_ptr->ids, H5I__id_dump_cb, &type); + } + } + else + HDfprintf(stderr, "Global type info/tracking pointer for that type is NULL\n"); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5I__debug() */ -#endif /* H5I_DEBUG_OUTPUT */ +} /* end H5I_dump_ids_for_type() */ diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index 3bfde93..9068b5f 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -25,6 +25,7 @@ /* Private headers needed by this file */ #include "H5private.h" +#include "H5VLprivate.h" /**************************/ /* Library Private Macros */ @@ -66,14 +67,7 @@ typedef struct H5I_class_t { H5_DLL herr_t H5I_register_type(const H5I_class_t *cls); H5_DLL int64_t H5I_nmembers(H5I_type_t type); H5_DLL herr_t H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref); -H5_DLL hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref); -H5_DLL herr_t H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t id); -H5_DLL void *H5I_subst(hid_t id, const void *new_object); -H5_DLL void *H5I_object(hid_t id); -H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type); H5_DLL H5I_type_t H5I_get_type(hid_t id); -H5_DLL hid_t H5I_get_file_id(hid_t obj_id, H5I_type_t id_type); -H5_DLL void *H5I_remove(hid_t id); H5_DLL herr_t H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref); H5_DLL int H5I_get_ref(hid_t id, hbool_t app_ref); H5_DLL int H5I_inc_ref(hid_t id, hbool_t app_ref); @@ -81,6 +75,30 @@ H5_DLL int H5I_dec_ref(hid_t id); H5_DLL int H5I_dec_app_ref(hid_t id); H5_DLL int H5I_dec_app_ref_always_close(hid_t id); H5_DLL int H5I_dec_type_ref(H5I_type_t type); +H5_DLL herr_t H5I_find_id(const void *object, H5I_type_t type, hid_t *id /*out*/); + +/* NOTE: The object and ID functions below deal in non-VOL objects (i.e.; + * H5S_t, etc.). Similar VOL calls exist in H5VLprivate.h. Use + * the H5VL calls with objects that go through the VOL, such as + * datasets and groups, and the H5I calls with objects + * that do not, such as property lists and dataspaces. Datatypes + * are can be either named, where they will use the VOL, or not, + * and thus require special treatment. See the datatype docs for + * how to handle this. + */ + +/* Functions that manipulate objects */ +H5_DLL void *H5I_object(hid_t id); +H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type); +H5_DLL void *H5I_remove(hid_t id); +H5_DLL void *H5I_subst(hid_t id, const void *new_object); + +/* ID registration functions */ +H5_DLL hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref); +H5_DLL herr_t H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id); + +/* Debugging functions */ +H5_DLL herr_t H5I_dump_ids_for_type(H5I_type_t type); #endif /* _H5Iprivate_H */ diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index c737bbe..f4b5cc9 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -44,6 +44,7 @@ typedef enum H5I_type_t { H5I_ATTR, /* type ID for Attribute objects */ H5I_REFERENCE, /* *DEPRECATED* type ID for Reference objects */ H5I_VFL, /* type ID for virtual file layer */ + H5I_VOL, /* type ID for virtual object layer */ H5I_GENPROP_CLS, /* type ID for generic property list classes */ H5I_GENPROP_LST, /* type ID for generic property lists */ H5I_ERROR_CLASS, /* type ID for error classes */ @@ -66,11 +67,14 @@ typedef int64_t hid_t; * can be removed from the ID type. If the function returns negative * (failure) then the object will remain in the ID type. */ -typedef herr_t (*H5I_free_t)(void*); +typedef herr_t (*H5I_free_t)(void *); /* Type of the function to compare objects & keys */ typedef int (*H5I_search_func_t)(void *obj, hid_t id, void *key); +/* Type of the H5Iiterate callback function */ +typedef herr_t (*H5I_iterate_func_t)(hid_t id, void *udata); + #ifdef __cplusplus extern "C" { #endif @@ -93,6 +97,7 @@ H5_DLL int H5Iinc_type_ref(H5I_type_t type); H5_DLL int H5Idec_type_ref(H5I_type_t type); H5_DLL int H5Iget_type_ref(H5I_type_t type); H5_DLL void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key); +H5_DLL herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data); H5_DLL herr_t H5Inmembers(H5I_type_t type, hsize_t *num_members); H5_DLL htri_t H5Itype_exists(H5I_type_t type); H5_DLL htri_t H5Iis_valid(hid_t id); diff --git a/src/H5Itest.c b/src/H5Itest.c index 4b54835..79bc482 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -78,26 +78,41 @@ ssize_t H5I__get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached) { + H5VL_object_t *vol_obj; /* Object token of id */ H5G_loc_t loc; /* Object location */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t vol_wrapper_set = FALSE;/* Whether the VOL object wrapping context was set up */ ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_PACKAGE - /* Get object location */ - if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") - /* Set API context */ if(H5CX_push() < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set API context") api_ctx_pushed = TRUE; + /* Get the object pointer */ + if(NULL == (vol_obj = H5VL_vol_object(id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Get object location */ + if(H5G_loc(id, &loc) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") + /* Call internal group routine to retrieve object's name */ if((ret_value = H5G_get_name(&loc, name, size, cached)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_ATOM, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + if(api_ctx_pushed && H5CX_pop() < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRESET, (-1), "can't reset API context") @@ -21,18 +21,20 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lpkg.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* File objects */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lpkg.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* File objects */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ + /****************/ /* Local Macros */ @@ -63,7 +65,7 @@ typedef struct { typedef struct { const char *dst_name; /* Destination name for moving object */ H5T_cset_t cset; /* Char set for new name */ - const H5G_loc_t *dst_loc; /* Destination location for moving object */ + const H5G_loc_t *dst_loc; /* Destination location for moving object */ unsigned dst_target_flags; /* Target flags for destination object */ hbool_t copy; /* TRUE if this is a copy operation */ size_t orig_nlinks; /* The original value for the # of soft / UD links that can be traversed */ @@ -102,70 +104,40 @@ static herr_t H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path, H5F_t *obj_file, H5O_link_t *lnk, H5O_obj_create_t *ocrt_info, hid_t lcpl_id); -static herr_t H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, - const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id); -static herr_t H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, - const char *link_name, hid_t lcpl_id); static herr_t H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size); static herr_t H5L__get_val_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__get_val(const H5G_loc_t *loc, const char *name, - void *buf/*out*/, size_t size); static herr_t H5L__get_val_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - void *buf/*out*/, size_t size); static herr_t H5L__delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__delete(const H5G_loc_t *loc, const char *name); static herr_t H5L__delete_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n); static herr_t H5L__move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); static herr_t H5L__move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__move(const H5G_loc_t *src_loc, const char *src_name, - H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, hid_t lcpl_id); static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); static herr_t H5L__exists_inter_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static htri_t H5L__exists(const H5G_loc_t *loc, const char *name); static herr_t H5L__get_info_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__get_info(const H5G_loc_t *loc, const char *name, - H5L_info_t *linfo/*out*/); static herr_t H5L__get_info_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - H5L_info_t *linfo /*out*/); static herr_t H5L__get_name_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static ssize_t H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - char *name /*out*/, size_t size); -static herr_t H5L__iterate(hid_t grp_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, - H5L_iterate_t op, void *op_data); -static herr_t H5L__visit(hid_t grp_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, - void *op_data); - /*********************/ /* Package Variables */ @@ -282,16 +254,16 @@ H5L_term_package(void) /*------------------------------------------------------------------------- - * Function: H5Lmove + * Function: H5Lmove * - * Purpose: Renames an object within an HDF5 file and moves it to a new + * Purpose: Renames an object within an HDF5 file and moves it to a new * group. The original name SRC is unlinked from the group graph * and then inserted with the new name DST (which can specify a * new path for the object) as an atomic operation. The names - * are interpreted relative to SRC_LOC_ID and - * DST_LOC_ID, which are either file IDs or group ID. + * are interpreted relative to SRC_LOC_ID and DST_LOC_ID, + * which are either file IDs or group ID. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: James Laird * Wednesday, March 29, 2006 @@ -302,9 +274,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) { - H5G_loc_t src_loc, *src_loc_p; - H5G_loc_t dst_loc, *dst_loc_p; - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */ + H5VL_loc_params_t loc_params1; + H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ + H5VL_loc_params_t loc_params2; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id, @@ -313,10 +287,6 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Check arguments */ if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC") - if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!src_name || !*src_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") if(!dst_name || !*dst_name) @@ -324,22 +294,44 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Check the link create property list */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") - /* Set up src & dst location pointers */ - src_loc_p = &src_loc; - dst_loc_p = &dst_loc; - if(src_loc_id == H5L_SAME_LOC) - src_loc_p = dst_loc_p; - else if(dst_loc_id == H5L_SAME_LOC) - dst_loc_p = src_loc_p; + /* Set location paramter for source object */ + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.loc_data.loc_by_name.name = src_name; + loc_params1.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params1.obj_type = H5I_get_type(src_loc_id); + + /* Set location paramter for destination object */ + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.loc_data.loc_by_name.name = dst_name; + loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params2.obj_type = H5I_get_type(dst_loc_id); + + if (H5L_SAME_LOC != src_loc_id) + /* Get the location object */ + if (NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + if (H5L_SAME_LOC != dst_loc_id) + /* Get the location object */ + if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Make sure that the VOL connectors are the same */ + if (vol_obj1 && vol_obj2) + if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked") /* Move the link */ - if(H5L__move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + if(H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: FUNC_LEAVE_API(ret_value) @@ -347,13 +339,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lcopy + * Function: H5Lcopy * - * Purpose: Creates an identical copy of a link with the same creation + * Purpose: Creates an identical copy of a link with the same creation * time and target. The new link can have a different name * and be in a different location than the original. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: James Laird * Wednesday, March 29, 2006 @@ -364,9 +356,12 @@ herr_t H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t src_loc, *src_loc_p; - H5G_loc_t dst_loc, *dst_loc_p; - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */ + H5VL_loc_params_t loc_params1; + H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ + H5VL_loc_params_t loc_params2; + H5VL_object_t tmp_vol_obj; /* Temporary object token of */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id, @@ -375,10 +370,6 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Check arguments */ if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC") - if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!src_name || !*src_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") if(!dst_name || !*dst_name) @@ -391,17 +382,43 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") - /* Set up src & dst location pointers */ - src_loc_p = &src_loc; - dst_loc_p = &dst_loc; - if(src_loc_id == H5L_SAME_LOC) - src_loc_p = dst_loc_p; - else if(dst_loc_id == H5L_SAME_LOC) - dst_loc_p = src_loc_p; + /* Check the link create property list */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + + /* Set location paramter for source object */ + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.loc_data.loc_by_name.name = src_name; + loc_params1.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params1.obj_type = H5I_get_type(src_loc_id); + + /* Set location paramter for destination object */ + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.loc_data.loc_by_name.name = dst_name; + loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params2.obj_type = H5I_get_type(dst_loc_id); + + if(H5L_SAME_LOC != src_loc_id) + /* Get the location object */ + if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + if(H5L_SAME_LOC != dst_loc_id) + /* Get the location object */ + if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Make sure that the VOL connectors are the same */ + if(vol_obj1 && vol_obj2) + if(vol_obj1->connector->cls->value != vol_obj2->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked") + + /* Construct a temporary source VOL object */ + tmp_vol_obj.data = (vol_obj1 ? vol_obj1->data : NULL); + tmp_vol_obj.connector = (vol_obj1 ? vol_obj1->connector : vol_obj2->connector); /* Copy the link */ - if(H5L__move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + if(H5VL_link_copy(&tmp_vol_obj, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to copy link") done: FUNC_LEAVE_API(ret_value) @@ -409,17 +426,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lcreate_soft + * Function: H5Lcreate_soft * - * Purpose: Creates a soft link from LINK_NAME to LINK_TARGET. + * Purpose: Creates a soft link from LINK_NAME to LINK_TARGET. * - * LINK_TARGET can be anything and is interpreted at lookup + * LINK_TARGET can be anything and is interpreted at lookup * time relative to the group which contains the final component * of LINK_NAME. For instance, if LINK_TARGET is `./foo' and * LINK_NAME is `./x/y/bar' and a request is made for `./x/y/bar' * then the actual object looked up is `./x/y/./foo'. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Monday, April 6, 1998 @@ -427,32 +444,60 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lcreate_soft(const char *link_target, hid_t link_loc_id, - const char *link_name, hid_t lcpl_id, hid_t lapl_id) +H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, + hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t link_loc; /* Group location for new link */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "*si*sii", link_target, link_loc_id, link_name, lcpl_id, lapl_id); /* Check arguments */ - if(H5G_loc(link_loc_id, &link_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!link_target || !*link_target) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no target specified") - if(!link_name || !*link_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") + if(link_loc_id == H5L_SAME_LOC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link location id should not be H5L_SAME_LOC") + if(!link_target) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be NULL") + if(!*link_target) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be an empty string") + if(!link_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_name parameter cannot be NULL") + if(!*link_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_name parameter cannot be an empty string") if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Check the group access property list */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + + /* Set location fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = link_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(link_loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(link_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TARGET_NAME, &link_target) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") + /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Create the link */ - if(H5L__create_soft(link_target, &link_loc, link_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link") done: FUNC_LEAVE_API(ret_value) @@ -460,15 +505,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lcreate_hard + * Function: H5Lcreate_hard * - * Purpose: Creates a hard link from NEW_NAME to CUR_NAME. + * Purpose: Creates a hard link from NEW_NAME to CUR_NAME. * - * CUR_NAME must name an existing object. CUR_NAME and + * CUR_NAME must name an existing object. CUR_NAME and * NEW_NAME are interpreted relative to CUR_LOC_ID and * NEW_LOC_ID, which are either file IDs or group IDs. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Monday, April 6, 1998 @@ -479,9 +524,13 @@ herr_t H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t cur_loc, *cur_loc_p; - H5G_loc_t new_loc, *new_loc_p; - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj1 = NULL; /* Object token of cur_loc_id */ + H5VL_object_t *vol_obj2 = NULL; /* Object token of new_loc_id */ + H5VL_object_t tmp_vol_obj; /* Temporary object token of */ + H5VL_loc_params_t loc_params1; + H5VL_loc_params_t loc_params2; + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*si*sii", cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, @@ -490,34 +539,67 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, /* Check arguments */ if(cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC") - if(cur_loc_id != H5L_SAME_LOC && H5G_loc(cur_loc_id, &cur_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(new_loc_id != H5L_SAME_LOC && H5G_loc(new_loc_id, &new_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!cur_name || !*cur_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") - if(!new_name || !*new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") + if(!cur_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be NULL") + if(!*cur_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be an empty string") + if(!new_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be NULL") + if(!*new_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be an empty string") if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Check the link create property list */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, cur_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") - /* Set up current & new location pointers */ - cur_loc_p = &cur_loc; - new_loc_p = &new_loc; - if(cur_loc_id == H5L_SAME_LOC) - cur_loc_p = new_loc_p; - else if(new_loc_id == H5L_SAME_LOC) - new_loc_p = cur_loc_p; - else if(cur_loc_p->oloc->file != new_loc_p->oloc->file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") + /* Set up current & new location structs */ + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.obj_type = H5I_get_type(cur_loc_id); + loc_params1.loc_data.loc_by_name.name = cur_name; + loc_params1.loc_data.loc_by_name.lapl_id = lapl_id; + + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.obj_type = H5I_get_type(new_loc_id); + loc_params2.loc_data.loc_by_name.name = new_name; + loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; + + if(H5L_SAME_LOC != cur_loc_id) + /* Get the current location object */ + if (NULL == (vol_obj1 = (H5VL_object_t *)H5VL_vol_object(cur_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + if(H5L_SAME_LOC != new_loc_id) + /* Get the new location object */ + if(NULL == (vol_obj2 = (H5VL_object_t *)H5VL_vol_object(new_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Make sure that the VOL connectors are the same */ + if(vol_obj1 && vol_obj2) + if(vol_obj1->connector->cls->value != vol_obj2->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked") + + /* Get the link creation plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_LINK, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TARGET, (vol_obj1 ? &(vol_obj1->data) : NULL)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't set property value for target id") + if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't set property value for target name") + + /* Construct a temporary VOL object */ + tmp_vol_obj.data = (vol_obj2 ? (vol_obj2->data) : NULL); + tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector); /* Create the link */ - if(H5L__create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link") done: FUNC_LEAVE_API(ret_value) @@ -525,23 +607,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lcreate_ud + * Function: H5Lcreate_ud * - * Purpose: Creates a user-defined link of type LINK_TYPE named LINK_NAME + * Purpose: Creates a user-defined link of type LINK_TYPE named LINK_NAME * with user-specified data UDATA. * - * The format of the information pointed to by UDATA is + * The format of the information pointed to by UDATA is * defined by the user. UDATA_SIZE holds the size of this buffer. * - * LINK_NAME is interpreted relative to LINK_LOC_ID. + * LINK_NAME is interpreted relative to LINK_LOC_ID. * - * The property list specified by LCPL_ID holds properties used + * The property list specified by LCPL_ID holds properties used * to create the link. * * The link class of the new link must already be registered * with the library. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: James Laird * Tuesday, December 13, 2005 @@ -552,28 +634,53 @@ herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t link_loc; - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE7("e", "i*sLl*xzii", link_loc_id, link_name, link_type, udata, udata_size, lcpl_id, lapl_id); /* Check arguments */ - if(H5G_loc(link_loc_id, &link_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!link_name || !*link_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified") if(link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") + /* Check the group access property list */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = link_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(link_loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") + if(H5P_set(plist, H5VL_PROP_LINK_UDATA, &udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") + if(H5P_set(plist, H5VL_PROP_LINK_UDATA_SIZE, &udata_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") + /* Create external link */ - if(H5L__create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) @@ -581,16 +688,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ldelete + * Function: H5Ldelete * - * Purpose: Removes the specified NAME from the group graph and - * decrements the link count for the object to which NAME - * points. If the link count reaches zero then all file-space - * associated with the object will be reclaimed (but if the - * object is open, then the reclamation of the file space is - * delayed until all handles to the object are closed). + * Purpose: Removes the specified NAME from the group graph and + * decrements the link count for the object to which NAME + * points. If the link count reaches zero then all file-space + * associated with the object will be reclaimed (but if the + * object is open, then the reclamation of the file space is + * delayed until all handles to the object are closed). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Monday, April 6, 1998 @@ -600,25 +707,34 @@ done: herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) { - H5G_loc_t loc; /* Group's location */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*si", loc_id, name, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Fill in the location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Unlink */ - if(H5L__delete(&loc, name) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: FUNC_LEAVE_API(ret_value) @@ -648,29 +764,40 @@ herr_t H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id) { - H5G_loc_t loc; /* Group's location */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*sIiIohi", loc_id, group_name, idx_type, order, n, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Delete the link */ - if(H5L__delete_by_idx(&loc, group_name, idx_type, order, n) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: FUNC_LEAVE_API(ret_value) @@ -700,25 +827,33 @@ herr_t H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, hid_t lapl_id) { - H5G_loc_t loc; /* Group location for location to query */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*sxzi", loc_id, name, buf, size, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Get the link value */ - if(H5L__get_val(&loc, name, buf, size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) done: FUNC_LEAVE_API(ret_value) @@ -748,7 +883,8 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size, hid_t lapl_id) { - H5G_loc_t loc; /* Group location for location to query */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -756,22 +892,32 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Get the link value */ - if(H5L__get_val_by_idx(&loc, group_name, idx_type, order, n, buf, size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for") + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value") done: FUNC_LEAVE_API(ret_value) @@ -779,12 +925,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lexists + * Function: H5Lexists * - * Purpose: Checks if a link of a given name exists in a group + * Purpose: Checks if a link of a given name exists in a group * - * Return: Success: TRUE/FALSE - * Failure: Negative + * Return: Success: TRUE/FALSE/FAIL * * Programmer: Quincey Koziol * Friday, March 16, 2007 @@ -794,24 +939,35 @@ done: htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { - H5G_loc_t loc; - htri_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("t", "i*si", loc_id, name, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Check for the existence of the link */ - if((ret_value = H5L__exists(&loc, name)) < 0) + if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -837,25 +993,33 @@ herr_t H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, hid_t lapl_id) { - H5G_loc_t loc; + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + 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") + /* Get the link information */ - if(H5L__get_info(&loc, name, linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -881,7 +1045,8 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5L_info_t *linfo /*out*/, hid_t lapl_id) { - H5G_loc_t loc; /* Group location for group to query */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -889,22 +1054,32 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Get the link information */ - if(H5L__get_info_by_idx(&loc, group_name, idx_type, order, n, linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -991,11 +1166,11 @@ H5Lunregister(H5L_type_t id) /* Check args */ if(id < 0 || id > H5L_TYPE_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type") /* Do it */ if(H5L_unregister(id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to unregister link type") + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to unregister link type") done: FUNC_LEAVE_API(ret_value) @@ -1003,14 +1178,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lis_registered + * Function: H5Lis_registered * - * Purpose: Tests whether a user-defined link class has been registered + * Purpose: Tests whether a user-defined link class has been registered * or not. * - * Return: Positive if the link class has been registered - * Zero if it is unregistered - * Negative on error (if the class is not a valid UD class ID) + * Return: TRUE if the link class has been registered + * FALSE if it is unregistered + * FAIL on error (if the class is not a valid UD class ID) * * Programmer: James Laird * Monday, July 10, 2006 @@ -1032,7 +1207,7 @@ H5Lis_registered(H5L_type_t id) /* Is the link class already registered? */ for(i = 0; i < H5L_table_used_g; i++) - if(H5L_table_g[i].id == id) { + if(H5L_table_g[i].id == id) { ret_value = TRUE; break; } /* end if */ @@ -1043,16 +1218,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lget_name_by_idx + * Function: H5Lget_name_by_idx * - * Purpose: Gets name for a link, according to the order within an + * Purpose: Gets name for a link, according to the order within an * index. * * Same pattern of behavior as H5Iget_name. * - * Return: Success: Non-negative length of name, with information - * in NAME buffer - * Failure: Negative + * Return: Success: Non-negative length of name, with information + * in NAME buffer + * + * Failure: -1 * * Programmer: Quincey Koziol * Saturday, November 11, 2006 @@ -1064,30 +1240,42 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ - ssize_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE8("Zs", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, name, size, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, (-1), "can't set access property list info") + + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get the link information */ - if((ret_value = H5L__get_name_by_idx(&loc, group_name, idx_type, order, n, name, size)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name") + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name") done: FUNC_LEAVE_API(ret_value) @@ -1113,17 +1301,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, +H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data) { - H5I_type_t id_type; /* Type of ID */ - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + H5I_type_t id_type; /* Type of ID */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE6("e", "iIiIo*hx*x", grp_id, idx_type, order, idx_p, op, op_data); + H5TRACE6("e", "iIiIo*hx*x", group_id, idx_type, order, idx_p, op, op_data); /* Check arguments */ - id_type = H5I_get_type(grp_id); + 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) @@ -1133,9 +1323,17 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, if (!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + /* Get the location object */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(group_id); + /* Iterate over the links */ - if((ret_value = H5L__iterate(grp_id, ".", idx_type, order, idx_p, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + 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: FUNC_LEAVE_API(ret_value) @@ -1143,20 +1341,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5Literate_by_name + * Function: H5Literate_by_name * - * Purpose: Iterates over links in a group, with user callback routine, + * Purpose: Iterates over links in a group, with user callback routine, * according to the order within an index. * * Same pattern of behavior as H5Giterate. * - * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * * * Programmer: Quincey Koziol @@ -1169,29 +1367,43 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data, hid_t lapl_id) { - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, group_name, idx_type, order, idx_p, op, op_data, lapl_id); /* Check arguments */ - if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(!group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL") + if(!*group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = group_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + /* Iterate over the links */ - if((ret_value = H5L__iterate(loc_id, group_name, idx_type, order, idx_p, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + 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: FUNC_LEAVE_API(ret_value) @@ -1199,9 +1411,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lvisit + * Function: H5Lvisit * - * Purpose: Recursively visit all the links in a group and all + * Purpose: Recursively visit all the links in a group and all * the groups that are linked to from that group. Links within * each group are visited according to the order within the * specified index (unless the specified index does not exist for @@ -1213,13 +1425,13 @@ done: * callback with more than one link that points to a particular * _object_. * - * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * * Programmer: Quincey Koziol * November 24 2007 @@ -1227,29 +1439,39 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, +H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data) { - H5I_type_t id_type; /* Type of ID */ - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + H5I_type_t id_type; /* Type of ID */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "iIiIox*x", grp_id, idx_type, order, op, op_data); + H5TRACE5("e", "iIiIox*x", group_id, idx_type, order, op, op_data); /* Check args */ - id_type = H5I_get_type(grp_id); + id_type = H5I_get_type(group_id); if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") - /* Call internal routine */ - if((ret_value = H5L__visit(grp_id, ".", idx_type, order, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(group_id); + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Iterate over the links */ + if((ret_value = 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) @@ -1257,9 +1479,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lvisit_by_name + * Function: H5Lvisit_by_name * - * Purpose: Recursively visit all the links in a group and all + * Purpose: Recursively visit all the links in a group and all * the groups that are linked to from that group. Links within * each group are visited according to the order within the * specified index (unless the specified index does not exist for @@ -1271,13 +1493,13 @@ done: * callback with more than one link that points to a particular * _object_. * - * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * * Programmer: Quincey Koziol * November 3 2007 @@ -1288,19 +1510,23 @@ herr_t H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id) { - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE7("e", "i*sIiIox*xi", loc_id, group_name, idx_type, order, op, op_data, lapl_id); /* Check args */ - if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(!group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL") + if(!*group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") @@ -1308,9 +1534,19 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call internal routine */ - if((ret_value = H5L__visit(loc_id, group_name, idx_type, order, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = group_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + + /* Visit the links */ + if((ret_value = 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) @@ -1502,8 +1738,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, - hid_t lcpl_id) +H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid_t lcpl_id) { H5O_link_t lnk; /* Link to insert */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1688,7 +1923,7 @@ H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATT /* Set up location for user-defined callback */ if(NULL == (grp = H5G_open(&temp_loc))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((grp_id = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + if((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register ID for group") /* Make callback */ @@ -1895,50 +2130,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__create_hard + * Function: H5L_create_soft * - * Purpose: Internal routine to create a hard link + * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 25, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, - const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(cur_loc); - HDassert(cur_name); - HDassert(link_loc); - HDassert(link_name); - - /* Create the link */ - if(H5L_create_hard(cur_loc, cur_name, link_loc, link_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__create_hard() */ - - -/*------------------------------------------------------------------------- - * Function: H5L_create_soft - * - * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH. - * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Monday, April 6, 1998 @@ -1982,44 +2178,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__create_soft - * - * Purpose: Internal routine to create a soft link - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 25, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, - const char *link_name, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(target_path); - HDassert(link_loc); - HDassert(link_name); - - /* Create the link */ - if(H5L_create_soft(target_path, link_loc, link_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__create_soft() */ - - -/*------------------------------------------------------------------------- * Function: H5L__create_ud * * Purpose: Creates a user-defined link. See H5Lcreate_ud for @@ -2039,7 +2197,7 @@ H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, H5O_link_t lnk; /* Link to insert */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(type >= H5L_TYPE_UD_MIN && type <= H5L_TYPE_MAX); @@ -2073,7 +2231,7 @@ done: /* Free the link's udata buffer if it's been allocated */ H5MM_xfree(lnk.u.ud.udata); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__create_ud() */ @@ -2216,42 +2374,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_val - * - * Purpose: Internal routine to query a link value - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Get the link value */ - if(H5L_get_val(loc, name, buf, size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__get_val() */ - - -/*------------------------------------------------------------------------- * Function: H5L__get_val_by_idx_cb * * Purpose: Callback for retrieving a link's value according to an @@ -2303,30 +2425,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_val_by_idx + * Function: H5L_get_val_by_idx * * Purpose: Internal routine to query a link value according to the - * index within a group - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). + * index within a group * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 27, 2017 * *------------------------------------------------------------------------- */ -static herr_t -H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +herr_t +H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size) { H5L_trav_gvbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ HDassert(loc); @@ -2344,8 +2462,8 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info for index: %llu", (unsigned long long)n) done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__get_val_by_idx() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_get_val_by_idx() */ /*------------------------------------------------------------------------- @@ -2386,7 +2504,7 @@ H5L__delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk /* Remove the link from the group */ if(H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, name) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to remove link from group") + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to remove link from group") done: /* Indicate that this callback didn't take ownership of the group * @@ -2439,42 +2557,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__delete - * - * Purpose: Internal routine to delete a link - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__delete(const H5G_loc_t *loc, const char *name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Delete the link */ - if(H5L_delete(loc, name) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link: %s", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__delete() */ - - -/*------------------------------------------------------------------------- * Function: H5L__delete_by_idx_cb * * Purpose: Callback for removing a link according to an index's order. @@ -2514,32 +2596,28 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__delete_by_idx + * Function: H5L_delete_by_idx * * Purpose: Internal routine to delete a link according to its index - * within a group. + * within a group. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 27, 2017 * *------------------------------------------------------------------------- */ -static herr_t -H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +herr_t +H5L_delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n) { H5L_trav_rmbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_NOAPI(FAIL) - /* Check arguments */ + /* Sanity check */ HDassert(loc); HDassert(name && *name); @@ -2553,8 +2631,8 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "link doesn't exist") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__delete() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_delete_by_idx() */ /*------------------------------------------------------------------------- @@ -2630,7 +2708,7 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, /* Set up location for user-defined callback */ if(NULL == (grp = H5G_open(&temp_loc))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((grp_id = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + if((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register group ID") if(udata->copy) { @@ -2728,7 +2806,7 @@ H5L__move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, /* Insert the link into its new location */ if(H5G_traverse(udata->dst_loc, udata->dst_name, udata->dst_target_flags, H5L__move_dest_cb, &udata_out) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to follow symbolic link") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to follow symbolic link") /* If this is a move and not a copy operation, change the object's name and remove the old link */ if(!udata->copy) { @@ -2856,7 +2934,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo /* Do the move */ if(H5G_traverse(src_loc, src_name, H5G_TARGET_MOUNT | H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__move_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to find link") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to find link") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2864,45 +2942,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__move - * - * Purpose: Internal routine to move / copy a link - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 25, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__move(const H5G_loc_t *src_loc, const char *src_name, H5G_loc_t *dst_loc, - const char *dst_name, hbool_t copy_flag, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(src_loc); - HDassert(src_name); - HDassert(dst_loc); - HDassert(dst_name); - - /* Move the link */ - if(H5L_move(src_loc, src_name, dst_loc, dst_name, copy_flag, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__move() */ - - -/*------------------------------------------------------------------------- * Function: H5L__exists_final_cb * * Purpose: Callback for checking whether a link exists, as the final @@ -3063,7 +3102,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__exists + * Function: H5L_exists * * Purpose: Returns whether a link exists in a group * @@ -3078,12 +3117,12 @@ done: *------------------------------------------------------------------------- */ htri_t -H5L__exists(const H5G_loc_t *loc, const char *name) +H5L_exists(const H5G_loc_t *loc, const char *name) { H5L_trav_le_t udata; /* User data for traversal */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_NOAPI(FAIL) /* A path of "/" will always exist in a file */ if(0 == HDstrcmp(name, "/")) @@ -3098,8 +3137,8 @@ H5L__exists(const H5G_loc_t *loc, const char *name) ret_value = (htri_t)udata.exists; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5L__exists() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5L_exists() */ /*------------------------------------------------------------------------- @@ -3173,42 +3212,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_info - * - * Purpose: Internal routine to retrieve link info - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linfo/*out*/) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Get the link information */ - if(H5L_get_info(loc, name, linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info for: '%s'", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__get_info() */ - - -/*------------------------------------------------------------------------- * Function: H5L__get_info_by_idx_cb * * Purpose: Callback for retrieving a link's metadata according to an @@ -3260,30 +3263,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_info_by_idx + * Function: H5L_get_info_by_idx * * Purpose: Internal routine to retrieve link info according to an * index's order. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static herr_t -H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +herr_t +H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5L_info_t *linfo /*out*/) { H5L_trav_gibi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ HDassert(loc); @@ -3298,11 +3294,11 @@ H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type /* Traverse the group hierarchy to locate the object to get info about */ if(H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_info_by_idx_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__get_info_by_idx() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_get_info_by_idx() */ /*------------------------------------------------------------------------- @@ -3346,31 +3342,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_name_by_idx + * Function: H5L_get_name_by_idx * * Purpose: Internal routine to retrieve link name according to an * index's order. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static ssize_t -H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, +ssize_t +H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size) { H5L_trav_gnbi_t udata; /* User data for callback */ ssize_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ HDassert(loc); @@ -3392,97 +3381,8 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, ret_value = udata.name_len; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__get_name_by_idx() */ - - -/*------------------------------------------------------------------------- - * Function: H5L__iterate - * - * Purpose: Internal routine to iterate over links - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data) -{ - H5G_link_iterate_t lnk_op; /* Link operator */ - hsize_t last_lnk; /* Index of last object looked at */ - hsize_t idx; /* Internal location to hold index */ - herr_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(group_name); - HDassert(op); - - /* Set up iteration beginning/end info */ - idx = (idx_p == NULL ? 0 : *idx_p); - last_lnk = 0; - - /* Build link operator info */ - lnk_op.op_type = H5G_LINK_OP_NEW; - lnk_op.op_func.op_new = op; - - /* Iterate over the links */ - if((ret_value = H5G_iterate(grp_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") - - /* Set the index we stopped at */ - if(idx_p) - *idx_p = last_lnk; - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__iterate() */ - - -/*------------------------------------------------------------------------- - * Function: H5L__visit - * - * Purpose: Internal routine to visit links - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__visit(hid_t grp_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, H5L_iterate_t op, void *op_data) -{ - herr_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(group_name); - HDassert(op); - - /* Call internal group visitation routine */ - if((ret_value = H5G_visit(grp_id, group_name, idx_type, order, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__visit() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_get_name_by_idx() */ /*------------------------------------------------------------------------- @@ -3615,3 +3515,49 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__link_copy_file() */ + +/*------------------------------------------------------------------------- + * Function: H5L_iterate + * + * Purpose: Iterates through links in a group + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data) +{ + H5G_link_iterate_t lnk_op; /* Link operator */ + hsize_t last_lnk; /* Index of last object looked at */ + hsize_t idx; /* Internal location to hold index */ + herr_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity checks */ + HDassert(loc); + HDassert(group_name); + HDassert(op); + + /* Set up iteration beginning/end info */ + idx = (idx_p == NULL ? 0 : *idx_p); + last_lnk = 0; + + /* Build link operator info */ + lnk_op.op_type = H5G_LINK_OP_NEW; + lnk_op.op_func.op_new = op; + + /* Iterate over the links */ + if((ret_value = H5G_iterate(loc, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + + /* Set the index we stopped at */ + if(idx_p) + *idx_p = last_lnk; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_iterate() */ + diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 7c32309..0f3296f 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -33,6 +33,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Opublic.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -102,7 +103,7 @@ static const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{ * link access property list, appends that prefix to the * filename being opened. * - * Return: ID of the opened object on success/Negative on failure + * Return: ID of the opened object on success/H5I_INVALID_HID on failure * * Programmer: James Laird * Monday, July 10, 2006 @@ -125,12 +126,14 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, unsigned intent; /* File access permissions */ H5L_elink_cb_t cb_info; /* Callback info struct */ hid_t fapl_id = -1; /* File access property list for external link's file */ - hid_t ext_obj = -1; /* ID for external link's object */ + void *ext_obj = NULL; /* External link's object */ + hid_t ext_obj_id = H5I_INVALID_HID; /* ID for external link's object */ + H5I_type_t opened_type; /* ID type of external link's object */ char *parent_group_name = NULL;/* Temporary pointer to group name */ char local_group_name[H5L_EXT_TRAVERSE_BUF_SIZE]; /* Local buffer to hold group name */ H5P_genplist_t *fa_plist; /* File access property list pointer */ - H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */ - char *elink_prefix; /* Pointer to elink prefix */ + H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */ + char *elink_prefix = NULL; /* Pointer to elink prefix */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_STATIC @@ -140,9 +143,9 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Check external link version & flags */ if(((*p >> 4) & 0x0F) > H5L_EXT_VERSION) - HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad version number for external link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, H5I_INVALID_HID, "bad version number for external link") if((*p & 0x0F) & ~H5L_EXT_FLAGS_ALL) - HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad flags for external link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, H5I_INVALID_HID, "bad flags for external link") p++; /* Gather some information from the external link's user data */ @@ -152,19 +155,19 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") /* Get the fapl_id set for lapl_id if any */ if(H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &fapl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get fapl for links") /* Get the location for the group holding the external link */ if(H5G_loc(cur_group, &loc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get object location") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "can't get object location") /* get the access flags set for lapl_id if any */ if(H5P_get(plist, H5L_ACS_ELINK_FLAGS_NAME, &intent) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get elink file access flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get elink file access flags") /* get the file access mode flags for the parent file, if they were not set * on lapl_id */ @@ -172,15 +175,15 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, intent = H5F_INTENT(loc.oloc->file); if((fapl_id == H5P_DEFAULT) && ((fapl_id = H5F_get_access_plist(loc.oloc->file, FALSE)) < 0)) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get parent's file access property list") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "can't get parent's file access property list") /* Get callback_info */ if(H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get elink callback info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get elink callback info") /* Get file access property list */ if(NULL == (fa_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") /* Make callback if it exists */ if(cb_info.func) { @@ -192,7 +195,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Query length of parent group name */ if((group_name_len = H5G_get_name(&loc, NULL, (size_t) 0, NULL)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve length of group name") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve length of group name") /* Account for null terminator */ group_name_len++; @@ -200,59 +203,64 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Check if we need to allocate larger buffer */ if((size_t)group_name_len > sizeof(local_group_name)) { if(NULL == (parent_group_name = (char *)H5MM_malloc((size_t)group_name_len))) - HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, FAIL, "can't allocate buffer to hold group name, group_name_len = %zd", group_name_len) + HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate buffer to hold group name, group_name_len = %zd", group_name_len) } /* end if */ else parent_group_name = local_group_name; /* Get parent group name */ if(H5G_get_name(&loc, parent_group_name, (size_t) group_name_len, NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve group name") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve group name") /* Make callback */ if((cb_info.func)(parent_file_name, parent_group_name, file_name, obj_name, &intent, fapl_id, cb_info.user_data) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "traversal operator failed") + HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, H5I_INVALID_HID, "traversal operator failed") /* Check access flags */ if((intent & H5F_ACC_TRUNC) || (intent & H5F_ACC_EXCL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file open flags") } /* end if */ /* Set file close degree for new file to "weak" */ if(H5P_set(fa_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") /* Get the current elink prefix */ if(H5P_peek(plist, H5L_ACS_ELINK_PREFIX_NAME, &elink_prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get external link prefix") /* Search for the target file */ if(NULL == (ext_file = H5F_prefix_open_file(loc.oloc->file, H5F_PREFIX_ELINK, elink_prefix, file_name, intent, fapl_id))) - HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, FAIL, "unable to open external file, external link file name = '%s'", file_name) + HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open external file, external link file name = '%s'", file_name) /* Retrieve the "group location" for the file's root group */ if(H5G_root_loc(ext_file, &root_loc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "unable to create location for file") + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, H5I_INVALID_HID, "unable to create location for file") /* Open the object referenced in the external file */ - if((ext_obj = H5O_open_name(&root_loc, obj_name, FALSE)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open object") + if(NULL == (ext_obj = H5O_open_name(&root_loc, obj_name, &opened_type))) + HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + + /* Get an ID for the external link's object */ + if((ext_obj_id = H5VL_wrap_register(opened_type, ext_obj, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register external link object") /* Set return value */ - ret_value = ext_obj; + ret_value = ext_obj_id; done: +/* XXX (VOL MERGE): Probably also want to consider closing ext_obj here on failures */ /* Release resources */ if(fapl_id > 0 && H5I_dec_ref(fapl_id) < 0) - HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") + HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close atom for file access property list") if(ext_file && H5F_efc_close(loc.oloc->file, ext_file) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, FAIL, "problem closing external file") + HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problem closing external file") if(parent_group_name && parent_group_name != local_group_name) parent_group_name = (char *)H5MM_xfree(parent_group_name); if(ret_value < 0) { /* Close object if it's open and something failed */ - if(ext_obj >= 0 && H5I_dec_ref(ext_obj) < 0) - HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for external object") + if(ext_obj_id >= 0 && H5I_dec_ref(ext_obj_id) < 0) + HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close atom for external object") } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -312,7 +320,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Lcreate_external * - * Purpose: Creates an external link from LINK_NAME to OBJ_NAME. + * Purpose: Creates an external link from LINK_NAME to OBJ_NAME. * * External links are links to objects in other HDF5 files. They * are allowed to "dangle" like soft links internal to a file. @@ -322,9 +330,9 @@ done: * LINK_NAME is interpreted relative to LINK_LOC_ID, which is * either a file ID or a group ID. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 18, 2005 * *------------------------------------------------------------------------- @@ -333,13 +341,16 @@ herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t link_loc; /* Group location to create link */ - char *norm_obj_name = NULL; /* Pointer to normalized current name */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + char *norm_obj_name = NULL; /* Pointer to normalized current name */ void *ext_link_buf = NULL; /* Buffer to contain external link */ size_t buf_size; /* Size of buffer to hold external link */ size_t file_name_len; /* Length of file name string */ size_t norm_obj_name_len; /* Length of normalized object name string */ uint8_t *p; /* Pointer into external link buffer */ + H5P_genplist_t *plist; /* Property list pointer */ + H5L_type_t link_type = H5L_TYPE_EXTERNAL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -351,11 +362,13 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no file name specified") if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name specified") - if(H5G_loc(link_loc_id, &link_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!link_name || !*link_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified") + /* Check the group access property list */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + /* Get normalized copy of the link target */ if(NULL == (norm_obj_name = H5G_normalize(obj_name))) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize object name") @@ -378,9 +391,30 @@ H5Lcreate_external(const char *file_name, const char *obj_name, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = link_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(link_loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") + if(H5P_set(plist, H5VL_PROP_LINK_UDATA, &ext_link_buf) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") + if(H5P_set(plist, H5VL_PROP_LINK_UDATA_SIZE, &buf_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") + /* Create an external link */ - if(H5L__create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link") done: H5MM_xfree(ext_link_buf); diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h index 3bbb6b6..fa3c097 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -122,12 +122,27 @@ H5_DLL herr_t H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, hid_t lcpl_id); H5_DLL htri_t H5L_exists_tolerant(const H5G_loc_t *loc, const char *name); +H5_DLL htri_t H5L_exists(const H5G_loc_t *loc, const char *name); H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linkbuf/*out*/); H5_DLL herr_t H5L_delete(const H5G_loc_t *loc, const char *name); +H5_DLL herr_t H5L_delete_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n); +H5_DLL herr_t H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + H5L_info_t *linfo /*out*/); +H5_DLL ssize_t H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + char *name /*out*/, size_t size); H5_DLL herr_t H5L_get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size); +H5_DLL herr_t H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + void *buf/*out*/, size_t size); H5_DLL herr_t H5L_register_external(void); +H5_DLL herr_t H5L_iterate(H5G_loc_t *loc, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, + H5L_iterate_t op, void *op_data); /* User-defined link functions */ H5_DLL herr_t H5L_register(const H5L_class_t *cls); diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index e6fd37c..7bdb001 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -41,10 +41,10 @@ #define H5L_SAME_LOC (hid_t)0 /* Current version of the H5L_class_t struct */ -#define H5L_LINK_CLASS_T_VERS 1 +#define H5L_LINK_CLASS_T_VERS 1 /* Previous versions of the H5L_class_t struct */ -#define H5L_LINK_CLASS_T_VERS_0 0 +#define H5L_LINK_CLASS_T_VERS_0 0 #ifdef __cplusplus extern "C" { @@ -2291,6 +2291,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -2320,6 +2321,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, &curr_ring); curr_ring = needed_ring; @@ -2435,6 +2437,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, &curr_ring); curr_ring = needed_ring; diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index 58e5054..bd57f05 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -60,8 +60,7 @@ H5_DLL herr_t H5MF_xfree(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size); H5_DLL herr_t H5MF_try_extend(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, hsize_t extra_requested); -H5_DLL htri_t H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, - hsize_t size); +H5_DLL htri_t H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size); H5_DLL ssize_t H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info); @@ -75,9 +75,9 @@ /*------------------------------------------------------------------------- - * Function: H5Oopen + * Function: H5Oopen * - * Purpose: Opens an object within an HDF5 file. + * Purpose: Opens an object within an HDF5 file. * * This function opens an object in the same way that H5Gopen2, * H5Topen2, and H5Dopen2 do. However, H5Oopen doesn't require @@ -88,8 +88,9 @@ * The opened object should be closed again with H5Oclose * or H5Gclose, H5Tclose, or H5Dclose. * - * Return: Success: An open object identifier - * Failure: Negative + * Return: Success: An open object identifier + * + * Failure: H5I_INVALID_HID * * Programmer: James Laird * July 14 2006 @@ -99,25 +100,42 @@ hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ - hid_t ret_value = FAIL; + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5I_type_t opened_type; + void *opened_obj = NULL; + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + /* Open the object */ - if((ret_value = H5O__open_name(&loc, name)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open 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") + + /* Get an atom for the object */ + 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) @@ -140,7 +158,7 @@ done: * or H5Gclose, H5Tclose, or H5Dclose. * * Return: Success: An open object identifier - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * November 20 2006 @@ -151,29 +169,45 @@ hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ - hid_t ret_value = FAIL; + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5I_type_t opened_type; + void *opened_obj = NULL; + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE6("i", "i*sIiIohi", loc_id, group_name, idx_type, order, n, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + /* Open the object */ - if((ret_value = H5O__open_by_idx(&loc, group_name, idx_type, order, n)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open 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") + + 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) @@ -208,7 +242,7 @@ done: * map this to an address on disk for the filesystem. * * Return: Success: An open object identifier - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: James Laird * July 14 2006 @@ -218,21 +252,30 @@ done: hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr) { - H5G_loc_t loc; /* Location within file */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5I_type_t opened_type; + void *opened_obj = NULL; + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "ia", loc_id, addr); - /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if(!H5F_addr_defined(addr)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no address supplied") + loc_params.type = H5VL_OBJECT_BY_ADDR; + loc_params.loc_data.loc_by_addr.addr = addr; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the object */ - if((ret_value = H5O__open_by_addr(&loc, addr)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open 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 */ + 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) @@ -264,20 +307,20 @@ herr_t H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t new_loc; /* Location of group to link from */ - H5G_loc_t obj_loc; /* Location of object to link to */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj1 = NULL; /* object token of obj_id */ + H5VL_object_t *vol_obj2 = NULL; /* object token of new_loc_id */ + H5VL_object_t tmp_vol_obj; /* Temporary object token of */ + H5VL_loc_params_t loc_params1; + H5VL_loc_params_t loc_params2; + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "ii*sii", obj_id, new_loc_id, new_name, lcpl_id, lapl_id); /* Check arguments */ - if(H5G_loc(obj_id, &obj_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(new_loc_id == H5L_SAME_LOC) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot use H5L_SAME_LOC when only one location is specified") - if(H5G_loc(new_loc_id, &new_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!new_name || !*new_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Avoid compiler warning on 32-bit machines */ @@ -288,13 +331,53 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Check the group access property list */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, obj_id, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params1.type = H5VL_OBJECT_BY_SELF; + loc_params1.obj_type = H5I_get_type(obj_id); + + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.obj_type = H5I_get_type(new_loc_id); + loc_params2.loc_data.loc_by_name.name = new_name; + loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; + + if(H5L_SAME_LOC != obj_id) + /* get the location object */ + if(NULL == (vol_obj1 = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + if(H5L_SAME_LOC != new_loc_id) + /* get the location object */ + if(NULL == (vol_obj2 = H5VL_vol_object(new_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Make sure that the VOL connectors are the same */ + if(vol_obj1 && vol_obj2) + if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj1->data) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id") + if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id") + + /* Construct a temporary VOL object */ + tmp_vol_obj.data = vol_obj2->data; + tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector); + /* Create a link to the object */ - if(H5O__create_link(&new_loc, new_name, &obj_loc, lcpl_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) @@ -324,22 +407,26 @@ done: herr_t H5Oincr_refcount(hid_t object_id) { - H5O_loc_t *oloc; /* Object location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", object_id); - /* Get the object's oloc so we can adjust its link count */ - if((oloc = H5O_get_loc(object_id)) == NULL) - HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID") + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(object_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(object_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Change the object's refcount */ - if(H5O__link(oloc, 1) < 0) + /* Change the object's reference count */ + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -370,22 +457,26 @@ done: herr_t H5Odecr_refcount(hid_t object_id) { - H5O_loc_t *oloc; /* Object location */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", object_id); - /* Get the object's oloc so we can adjust its link count */ - if((oloc = H5O_get_loc(object_id)) == NULL) - HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID") + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(object_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(object_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Change the object's refcount */ - if(H5O__link(oloc, -1) < 0) + /* Change the object's reference count */ + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, -1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -394,12 +485,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oexists_by_name + * Function: H5Oexists_by_name * - * Purpose: Determine if a linked-to object exists + * Purpose: Determine if a linked-to object exists * - * Return: Success: TRUE/FALSE - * Failure: Negative + * Return: Success: TRUE/FALSE + * Failure: FAIL * * Programmer: Quincey Koziol * February 2 2010 @@ -409,24 +500,35 @@ done: htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { - H5G_loc_t loc; /* Location info */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("t", "i*si", loc_id, name, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) 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") + + /* Set the location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + /* Check if the object exists */ - if((ret_value = H5O__exists_by_name(&loc, name)) < 0) + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: @@ -441,8 +543,7 @@ done: * * NOTE: Add a parameter "fields" to indicate selection of object info. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * July 7 2010 @@ -452,22 +553,29 @@ done: herr_t H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*xIu", loc_id, oinfo, fields); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") if(fields & ~H5O_INFO_ALL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + /* 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(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, fields) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -475,38 +583,38 @@ done: } /* end H5Oget_info2() */ - /*------------------------------------------------------------------------- - * Function: H5Oget_info_by_name2 - * - * Purpose: Retrieve information about an object. - * - * NOTE: Add a parameter "fields" to indicate selection of object info. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Neil Fortner - * July 7 2010 - * - *------------------------------------------------------------------------- - */ +/*------------------------------------------------------------------------- + * Function: H5Oget_info_by_name2 + * + * Purpose: Retrieve information about an object + * + * NOTE: Add a parameter "fields" to indicate selection of object info. + * + * Return: SUCCEED/FAIL + * + * Programmer: Neil Fortner + * July 7 2010 + * + *------------------------------------------------------------------------- + */ herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*s*xIui", loc_id, name, oinfo, fields, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") if(!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") if(fields & ~H5O_INFO_ALL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") @@ -514,8 +622,18 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Fill out location struct */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, fields) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: @@ -543,7 +661,8 @@ herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -551,8 +670,6 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, fields, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name || !*group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -568,8 +685,20 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Retrieve the object's information */ - if(H5O__get_info_by_idx(&loc, group_name, idx_type, order, n, oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -578,16 +707,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oset_comment + * Function: H5Oset_comment * * Purpose: Gives the specified object a comment. The COMMENT string - * should be a null terminated string. An object can have only - * one comment at a time. Passing NULL for the COMMENT argument - * will remove the comment property from the object. + * should be a null terminated string. An object can have only + * one comment at a time. Passing NULL for the COMMENT argument + * will remove the comment property from the object. * - * Note: Deprecated in favor of using attributes on objects + * Note: Deprecated in favor of using attributes on objects * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * August 30 2007 @@ -597,22 +726,27 @@ done: herr_t H5Oset_comment(hid_t obj_id, const char *comment) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*s", obj_id, comment); - /* Check args */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(obj_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(obj_id); + /* (Re)set the object's comment */ - if(H5O__set_comment_by_name(&loc, ".", comment) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, &loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") done: @@ -621,16 +755,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oset_comment_by_name + * Function: H5Oset_comment_by_name * * Purpose: Gives the specified object a comment. The COMMENT string - * should be a null terminated string. An object can have only - * one comment at a time. Passing NULL for the COMMENT argument - * will remove the comment property from the object. + * should be a null terminated string. An object can have only + * one comment at a time. Passing NULL for the COMMENT argument + * will remove the comment property from the object. * - * Note: Deprecated in favor of using attributes on objects + * Note: Deprecated in favor of using attributes on objects * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * August 30 2007 @@ -641,15 +775,14 @@ herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*s*si", loc_id, name, comment, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") @@ -657,8 +790,18 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* (Re)set the object's comment */ - if(H5O__set_comment_by_name(&loc, name, comment) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, &loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name) done: @@ -667,15 +810,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oget_comment + * Function: H5Oget_comment * - * Purpose: Retrieve comment for an object. + * Purpose: Retrieve comment for an object. * - * Return: Success: Number of bytes in the comment excluding the - * null terminator. Zero if the object has no - * comment. + * Return: Success: Number of bytes in the comment excluding the + * null terminator. Zero if the object has no + * comment. * - * Failure: Negative + * Failure: -1 * * Programmer: Quincey Koziol * August 30 2007 @@ -685,19 +828,24 @@ done: ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) { - H5G_loc_t loc; /* Location of group */ - ssize_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize); - /* Check args */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + /* Get the object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + + /* Set fields in the location struct */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(obj_id); /* Retrieve the object's comment */ - if((ret_value = H5O__get_comment_by_name(&loc, ".", comment/*out*/, bufsize)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object") + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object") done: FUNC_LEAVE_API(ret_value) @@ -705,15 +853,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oget_comment_by_name + * Function: H5Oget_comment_by_name * - * Purpose: Retrieve comment for an object. + * Purpose: Retrieve comment for an object. * - * Return: Success: Number of bytes in the comment excluding the - * null terminator. Zero if the object has no - * comment. + * Return: Success: Number of bytes in the comment excluding the + * null terminator. Zero if the object has no + * comment. * - * Failure: Negative + * Failure: -1 * * Programmer: Quincey Koziol * August 30 2007 @@ -724,25 +872,34 @@ ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ - ssize_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE5("Zs", "i*s*szi", loc_id, name, comment, bufsize, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, (-1), "can't set access property list info") + + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Retrieve the object's comment */ - if((ret_value = H5O__get_comment_by_name(&loc, name, comment/*out*/, bufsize)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object: '%s'", name) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name) done: FUNC_LEAVE_API(ret_value) @@ -750,9 +907,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ovisit2 + * Function: H5Ovisit2 * - * Purpose: Recursively visit an object and all the objects reachable + * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects * linked to from that group will be visited. Links within * each group are visited according to the order within the @@ -772,12 +929,12 @@ done: * object info to be retrieved to the callback "op". * * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. + * library, or the negative value returned by one + * of the operators. * * Programmer: Quincey Koziol * November 25 2007 @@ -788,7 +945,9 @@ herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields) { - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iIiIox*xIu", obj_id, idx_type, order, op, op_data, fields); @@ -803,9 +962,17 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, if(fields & ~H5O_INFO_ALL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") - /* Call internal object visitation routine */ - if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, fields)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(obj_id); + + /* Visit the objects */ + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: FUNC_LEAVE_API(ret_value) @@ -813,7 +980,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ovisit_by_name2 + * Function: H5Ovisit_by_name2 * * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects @@ -835,12 +1002,12 @@ done: * object info to be retrieved to the callback "op". * * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * * Programmer: Quincey Koziol * November 24 2007 @@ -851,15 +1018,19 @@ herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields, hid_t lapl_id) { - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* Object token 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, fields, lapl_id); /* Check args */ - if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!obj_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL") + if(!*obj_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) @@ -873,9 +1044,19 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call internal object visitation routine */ - if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, fields)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Visit the objects */ + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: FUNC_LEAVE_API(ret_value) @@ -883,17 +1064,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oclose + * Function: H5Oclose * - * Purpose: Close an open file object. + * Purpose: Close an open file object. * * This is the companion to H5Oopen. It is used to close any * open object in an HDF5 file (but not IDs are that not file * objects, such as property lists and dataspaces). It has * the same effect as calling H5Gclose, H5Dclose, or H5Tclose. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: James Laird * July 14 2006 @@ -926,6 +1106,7 @@ H5Oclose(hid_t object_id) case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 570e16d..23dd928 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -57,9 +57,9 @@ /* Local Prototypes */ /********************/ -static herr_t H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, +static herr_t H5O__add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied, size_t idx, uint8_t *new_gap_loc, size_t new_gap_size); -static herr_t H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, +static herr_t H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, uint8_t *new_gap_loc, size_t new_gap_size); static herr_t H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, const H5O_msg_class_t *new_type, void *new_native, size_t new_size); @@ -70,10 +70,10 @@ static herr_t H5O__alloc_find_best_nonnull(const H5F_t *f, const H5O_t *oh, size static herr_t H5O__alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t *new_idx); static herr_t H5O__alloc_find_best_null(const H5O_t *oh, size_t size, size_t *mesg_idx); -static htri_t H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u); -static htri_t H5O_move_msgs_forward(H5F_t *f, H5O_t *oh); -static htri_t H5O_merge_null(H5F_t *f, H5O_t *oh); -static htri_t H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh); +static htri_t H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u); +static htri_t H5O__move_msgs_forward(H5F_t *f, H5O_t *oh); +static htri_t H5O__merge_null(H5F_t *f, H5O_t *oh); +static htri_t H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh); static herr_t H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno); @@ -97,7 +97,7 @@ H5FL_EXTERN(H5O_cont_t); /*------------------------------------------------------------------------- - * Function: H5O_add_gap + * Function: H5O__add_gap * * Purpose: Add a gap to a chunk * @@ -110,14 +110,14 @@ H5FL_EXTERN(H5O_cont_t); *------------------------------------------------------------------------- */ static herr_t -H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied, +H5O__add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied, size_t idx, uint8_t *new_gap_loc, size_t new_gap_size) { hbool_t merged_with_null; /* Whether the gap was merged with a null message */ size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -150,7 +150,7 @@ if(chunkno > 0) { HDassert(oh->chunk[chunkno].gap == 0); /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(oh, chk_dirtied, &oh->mesg[u], new_gap_loc, new_gap_size) < 0) + if(H5O__eliminate_gap(oh, chk_dirtied, &oh->mesg[u], new_gap_loc, new_gap_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't eliminate gap in chunk") /* Set flag to indicate that the gap was handled */ @@ -178,7 +178,7 @@ if(chunkno > 0) { /* Check if we need to extend message table to hold the new null message */ if(oh->nmesgs >= oh->alloc_nmesgs) - if(H5O_alloc_msgs(oh, (size_t)1) < 0) + if(H5O__alloc_msgs(oh, (size_t)1) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* Increment new gap size */ @@ -212,11 +212,11 @@ if(chunkno > 0) { done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_add_gap() */ +} /* H5O__add_gap() */ /*------------------------------------------------------------------------- - * Function: H5O_eliminate_gap + * Function: H5O__eliminate_gap * * Purpose: Eliminate a gap in a chunk with a null message. * @@ -236,13 +236,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, +H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, uint8_t *gap_loc, size_t gap_size) { uint8_t *move_start, *move_end; /* Pointers to area of messages to move */ hbool_t null_before_gap; /* Flag whether the null message is before the gap or not */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(oh); @@ -319,7 +319,7 @@ H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, *chk_dirtied = TRUE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5O_eliminate_gap() */ +} /* H5O__eliminate_gap() */ /*------------------------------------------------------------------------- @@ -369,7 +369,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, alloc_msg->raw_size = new_size; /* Add the gap to the chunk */ - if(H5O_add_gap(f, oh, alloc_msg->chunkno, &chk_dirtied, null_idx, alloc_msg->raw + alloc_msg->raw_size, gap_size) < 0) + if(H5O__add_gap(f, oh, alloc_msg->chunkno, &chk_dirtied, null_idx, alloc_msg->raw + alloc_msg->raw_size, gap_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk") } /* end if */ else { @@ -378,7 +378,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, /* Check if we need to extend message table to hold the new null message */ if(oh->nmesgs >= oh->alloc_nmesgs) { - if(H5O_alloc_msgs(oh, (size_t)1) < 0) + if(H5O__alloc_msgs(oh, (size_t)1) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* "Retarget" 'alloc_msg' pointer into newly re-allocated array of messages */ @@ -402,7 +402,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, unsigned null_chunkno = null_msg->chunkno; /* Chunk w/gap */ /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(oh, &chk_dirtied, null_msg, + if(H5O__eliminate_gap(oh, &chk_dirtied, null_msg, ((oh->chunk[null_chunkno].image + oh->chunk[null_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[null_chunkno].gap)), oh->chunk[null_chunkno].gap) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") @@ -432,7 +432,7 @@ done: /*------------------------------------------------------------------------- * - * Function: H5O_alloc_msgs + * Function: H5O__alloc_msgs * * Purpose: Allocate more messages for a header * @@ -445,14 +445,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_alloc_msgs(H5O_t *oh, size_t min_alloc) +H5O__alloc_msgs(H5O_t *oh, size_t min_alloc) { size_t old_alloc; /* Old number of messages allocated */ size_t na; /* New number of messages allocated */ H5O_mesg_t *new_mesg; /* Pointer to new message array */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* check args */ HDassert(oh); @@ -474,7 +474,7 @@ H5O_alloc_msgs(H5O_t *oh, size_t min_alloc) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_alloc_msgs() */ +} /* H5O__alloc_msgs() */ /*------------------------------------------------------------------------- @@ -590,7 +590,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, /* Protect chunk */ if(NULL == (chk_proxy = H5O__chunk_protect(f, oh, chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") /* Determine whether the chunk can be extended */ was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, oh->chunk[chunkno].addr, (hsize_t)(oh->chunk[chunkno].size), (hsize_t)(delta + extra_prfx_size)); @@ -618,7 +618,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, else { /* Create a new null message */ if(oh->nmesgs >= oh->alloc_nmesgs) - if(H5O_alloc_msgs(oh, (size_t)1) < 0) + if(H5O__alloc_msgs(oh, (size_t)1) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* Set extension message */ @@ -690,7 +690,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, } /* end for */ /* Resize the chunk in the cache */ - if(H5O_chunk_resize(oh, chk_proxy) < 0) + if(H5O__chunk_resize(oh, chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk") /* Set new message index */ @@ -958,7 +958,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, * that could be generated below. */ if(oh->nmesgs + 3 > oh->alloc_nmesgs) - if(H5O_alloc_msgs(oh, (size_t)3) < 0) + if(H5O__alloc_msgs(oh, (size_t)3) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* Check if we need to move multiple messages, in order to make room for the new message */ @@ -1361,7 +1361,7 @@ done: /*------------------------------------------------------------------------- * - * Function: H5O_release_mesg + * Function: H5O__release_mesg * * Purpose: Convert a message into a null message * @@ -1374,13 +1374,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link) +H5O__release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */ hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(f); @@ -1395,7 +1395,7 @@ H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link) /* Protect chunk */ if(NULL == (chk_proxy = H5O__chunk_protect(f, oh, mesg->chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") /* Free any native information */ H5O__msg_free_mesg(mesg); @@ -1415,7 +1415,7 @@ H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link) /* Check if chunk has a gap currently */ if(oh->chunk[mesg->chunkno].gap) { /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(oh, &chk_dirtied, mesg, + if(H5O__eliminate_gap(oh, &chk_dirtied, mesg, ((oh->chunk[mesg->chunkno].image + oh->chunk[mesg->chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[mesg->chunkno].gap)), oh->chunk[mesg->chunkno].gap) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") @@ -1427,11 +1427,11 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_release_mesg() */ +} /* H5O__release_mesg() */ /*------------------------------------------------------------------------- - * Function: H5O_move_cont + * Function: H5O__move_cont * * Purpose: Check and move message(s) forward into a continuation message * @@ -1444,7 +1444,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) +H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that continuation message is in */ H5O_mesg_t *cont_msg; /* Pointer to the continuation message */ @@ -1452,7 +1452,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) hbool_t chk_dirtied = FALSE; /* Flags for unprotecting chunk */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(f); @@ -1500,7 +1500,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) /* Convert continuation message into a null message. Do not delete * the target chunk yet, so we can still copy messages from it. */ - if(H5O_release_mesg(f, oh, cont_msg, FALSE) < 0) + if(H5O__release_mesg(f, oh, cont_msg, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message") /* Protect chunk */ @@ -1549,7 +1549,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) /* Check if there is space that should be a gap */ if(gap_size > 0) { /* Convert remnant into gap in chunk */ - if(H5O_add_gap(f, oh, cont_chunkno, &chk_dirtied, cont_u, move_start, gap_size) < 0) + if(H5O__add_gap(f, oh, cont_chunkno, &chk_dirtied, cont_u, move_start, gap_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk") } /* end if */ @@ -1594,12 +1594,12 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_move_cont() */ +} /* H5O__move_cont() */ /*------------------------------------------------------------------------- * - * Function: H5O_move_msgs_forward + * Function: H5O__move_msgs_forward * * Purpose: Move messages toward first chunk * @@ -1612,7 +1612,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) +H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) { H5O_chunk_proxy_t *null_chk_proxy = NULL; /* Chunk that null message is in */ H5O_chunk_proxy_t *curr_chk_proxy = NULL; /* Chunk that message is in */ @@ -1623,7 +1623,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) hbool_t did_packing = FALSE; /* Whether any messages were packed */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -1706,7 +1706,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) if(H5O_CONT_ID == curr_msg->type->id) { htri_t status; /* Status from moving messages */ - if((status = H5O_move_cont(f, oh, u)) < 0) + if((status = H5O__move_cont(f, oh, u)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "Error in moving messages into cont message") else if(status > 0) { /* Message(s) got moved into "continuation" message */ packed_msg = TRUE; @@ -1818,7 +1818,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) /* Check for gap in null message's chunk */ if(oh->chunk[old_chunkno].gap > 0) { /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(oh, &null_chk_dirtied, null_msg, + if(H5O__eliminate_gap(oh, &null_chk_dirtied, null_msg, ((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)), oh->chunk[old_chunkno].gap) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") @@ -1845,7 +1845,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) null_chk_dirtied = TRUE; /* Add the gap to the chunk */ - if(H5O_add_gap(f, oh, null_msg->chunkno, &null_chk_dirtied, v, null_msg->raw + null_msg->raw_size, gap_size) < 0) + if(H5O__add_gap(f, oh, null_msg->chunkno, &null_chk_dirtied, v, null_msg->raw + null_msg->raw_size, gap_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk") /* Re-use message # for new null message taking place of non-null message */ @@ -1862,7 +1862,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) /* Create new null message for previous location of non-null message */ if(oh->nmesgs >= oh->alloc_nmesgs) { - if(H5O_alloc_msgs(oh, (size_t)1) < 0) + if(H5O__alloc_msgs(oh, (size_t)1) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* "Retarget" 'curr_msg' pointer into newly re-allocated array of messages */ @@ -1893,7 +1893,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) /* Check for gap in new null message's chunk */ if(oh->chunk[old_chunkno].gap > 0) { /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(oh, &curr_chk_dirtied, &oh->mesg[new_null_msg], + if(H5O__eliminate_gap(oh, &curr_chk_dirtied, &oh->mesg[new_null_msg], ((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)), oh->chunk[old_chunkno].gap) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") @@ -1945,12 +1945,12 @@ done: HDassert(!null_chk_proxy && !curr_chk_proxy && !cont_targ_chk_proxy); FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_move_msgs_forward() */ +} /* H5O__move_msgs_forward() */ /*------------------------------------------------------------------------- * - * Function: H5O_merge_null + * Function: H5O__merge_null * * Purpose: Merge neighboring null messages in an object header * @@ -1963,13 +1963,13 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_merge_null(H5F_t *f, H5O_t *oh) +H5O__merge_null(H5F_t *f, H5O_t *oh) { hbool_t merged_msg; /* Flag to indicate that messages were merged */ hbool_t did_merging = FALSE; /* Whether any messages were merged */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh != NULL); @@ -2051,7 +2051,7 @@ H5O_merge_null(H5F_t *f, H5O_t *oh) oh->nmesgs--; /* The merge null message might span the entire chunk: scan for empty chunk to remove */ - if((result = H5O_remove_empty_chunks(f, oh)) < 0) + if((result = H5O__remove_empty_chunks(f, oh)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk") else if(result > 0) /* Get out of loop */ @@ -2084,12 +2084,12 @@ H5O_merge_null(H5F_t *f, H5O_t *oh) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_merge_null() */ +} /* H5O__merge_null() */ /*------------------------------------------------------------------------- * - * Function: H5O_remove_empty_chunks + * Function: H5O__remove_empty_chunks * * Purpose: Attempt to eliminate empty chunks from object header. * @@ -2106,13 +2106,13 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh) +H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh) { hbool_t deleted_chunk; /* Whether to a chunk was deleted */ hbool_t did_deleting = FALSE; /* Whether any chunks were deleted */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh != NULL); @@ -2173,7 +2173,7 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh) deleted_chunkno = null_msg->chunkno; /* Convert continuation message into a null message */ - if(H5O_release_mesg(f, oh, cont_msg, TRUE) < 0) + if(H5O__release_mesg(f, oh, cont_msg, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message") /* @@ -2273,12 +2273,12 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_remove_empty_chunks() */ +} /* H5O__remove_empty_chunks() */ /*------------------------------------------------------------------------- * - * Function: H5O_condense_header + * Function: H5O__condense_header * * Purpose: Attempt to eliminate empty chunks from object header. * @@ -2291,13 +2291,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_condense_header(H5F_t *f, H5O_t *oh) +H5O__condense_header(H5F_t *f, H5O_t *oh) { hbool_t rescan_header; /* Whether to rescan header */ htri_t result; /* Result from packing/merging/etc */ herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(oh != NULL); @@ -2308,33 +2308,33 @@ H5O_condense_header(H5F_t *f, H5O_t *oh) rescan_header = FALSE; /* Scan for messages that can be moved earlier in chunks */ - result = H5O_move_msgs_forward(f, oh); + result = H5O__move_msgs_forward(f, oh); if(result < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't move header messages forward") if(result > 0) rescan_header = TRUE; /* Scan for adjacent null messages & merge them */ - result = H5O_merge_null(f, oh); + result = H5O__merge_null(f, oh); if(result < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack null header messages") if(result > 0) rescan_header = TRUE; /* Scan for empty chunks to remove */ - result = H5O_remove_empty_chunks(f, oh); + result = H5O__remove_empty_chunks(f, oh); if(result < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk") if(result > 0) rescan_header = TRUE; } while(rescan_header); #ifdef H5O_DEBUG -H5O_assert(oh); +H5O__assert(oh); #endif /* H5O_DEBUG */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_condense_header() */ +} /* H5O__condense_header() */ /*------------------------------------------------------------------------- @@ -2523,7 +2523,7 @@ H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno) HDassert(new_size <= old_size); /* Resize the chunk in the cache */ - if(H5O_chunk_resize(oh, chk_proxy) < 0) + if(H5O__chunk_resize(oh, chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk") /* Free the unused space in the file */ diff --git a/src/H5Oattr.c b/src/H5Oattr.c index a62a3a3..c93bf32 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -44,48 +44,48 @@ static herr_t H5O__attr_debug(H5F_t *f, const void *_mesg, FILE * stream, int indent, int fwidth); /* Set up & include shared message "interface" info */ -#define H5O_SHARED_TYPE H5O_MSG_ATTR -#define H5O_SHARED_DECODE H5O_attr_shared_decode -#define H5O_SHARED_DECODE_REAL H5O_attr_decode -#define H5O_SHARED_ENCODE H5O_attr_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_attr_encode -#define H5O_SHARED_SIZE H5O_attr_shared_size -#define H5O_SHARED_SIZE_REAL H5O_attr_size -#define H5O_SHARED_DELETE H5O__attr_shared_delete -#define H5O_SHARED_DELETE_REAL H5O__attr_delete -#define H5O_SHARED_LINK H5O__attr_shared_link -#define H5O_SHARED_LINK_REAL H5O__attr_link -#define H5O_SHARED_COPY_FILE H5O__attr_shared_copy_file -#define H5O_SHARED_COPY_FILE_REAL H5O__attr_copy_file -#define H5O_SHARED_POST_COPY_FILE H5O_attr_shared_post_copy_file -#define H5O_SHARED_POST_COPY_FILE_REAL H5O__attr_post_copy_file +#define H5O_SHARED_TYPE H5O_MSG_ATTR +#define H5O_SHARED_DECODE H5O_attr_shared_decode +#define H5O_SHARED_DECODE_REAL H5O_attr_decode +#define H5O_SHARED_ENCODE H5O_attr_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O_attr_encode +#define H5O_SHARED_SIZE H5O_attr_shared_size +#define H5O_SHARED_SIZE_REAL H5O_attr_size +#define H5O_SHARED_DELETE H5O__attr_shared_delete +#define H5O_SHARED_DELETE_REAL H5O__attr_delete +#define H5O_SHARED_LINK H5O__attr_shared_link +#define H5O_SHARED_LINK_REAL H5O__attr_link +#define H5O_SHARED_COPY_FILE H5O__attr_shared_copy_file +#define H5O_SHARED_COPY_FILE_REAL H5O__attr_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O_attr_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE_REAL H5O__attr_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_UPD -#define H5O_SHARED_DEBUG H5O_attr_shared_debug -#define H5O_SHARED_DEBUG_REAL H5O__attr_debug +#define H5O_SHARED_DEBUG H5O_attr_shared_debug +#define H5O_SHARED_DEBUG_REAL H5O__attr_debug #include "H5Oshared.h" /* Shared Object Header Message Callbacks */ /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_ATTR[1] = {{ - H5O_ATTR_ID, /* message id number */ - "attribute", /* message name for debugging */ - sizeof(H5A_t), /* native message size */ - H5O_SHARE_IS_SHARABLE, /* messages are sharable? */ - H5O_attr_shared_decode, /* decode message */ - H5O_attr_shared_encode, /* encode message */ - H5O_attr_copy, /* copy the native value */ - H5O_attr_shared_size, /* size of raw message */ - H5O__attr_reset, /* reset method */ - H5O__attr_free, /* free method */ - H5O__attr_shared_delete, /* file delete method */ - H5O__attr_shared_link, /* link method */ - NULL, /*set share method */ - NULL, /*can share method */ - H5O_attr_pre_copy_file, /* pre copy native value to file */ - H5O__attr_shared_copy_file, /* copy native value to file */ - H5O_attr_shared_post_copy_file, /* post copy native value to file */ - H5O_attr_get_crt_index, /* get creation index */ - H5O_attr_set_crt_index, /* set creation index */ - H5O_attr_shared_debug /* debug the message */ + H5O_ATTR_ID, /* message id number */ + "attribute", /* message name for debugging */ + sizeof(H5A_t), /* native message size */ + H5O_SHARE_IS_SHARABLE, /* messages are sharable? */ + H5O_attr_shared_decode, /* decode message */ + H5O_attr_shared_encode, /* encode message */ + H5O_attr_copy, /* copy the native value */ + H5O_attr_shared_size, /* size of raw message */ + H5O__attr_reset, /* reset method */ + H5O__attr_free, /* free method */ + H5O__attr_shared_delete, /* file delete method */ + H5O__attr_shared_link, /* link method */ + NULL, /* set share method */ + NULL, /* can share method */ + H5O_attr_pre_copy_file, /* pre copy native value to file */ + H5O__attr_shared_copy_file, /* copy native value to file */ + H5O_attr_shared_post_copy_file, /* post copy native value to file */ + H5O_attr_get_crt_index, /* get creation index */ + H5O_attr_set_crt_index, /* set creation index */ + H5O_attr_shared_debug /* debug the message */ }}; /* Flags for attribute flag encoding */ @@ -474,7 +474,7 @@ H5O_attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg) * Purpose: Frees resources within a attribute message, but doesn't free * the message itself. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Tuesday, December 9, 1997 @@ -491,11 +491,11 @@ H5O__attr_reset(void H5_ATTR_UNUSED *_mesg) /*------------------------------------------------------------------------- - * Function: H5O__attr_free + * Function: H5O__attr_free * - * Purpose: Frees the message + * Purpose: Frees the message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, November 18, 2004 @@ -525,7 +525,7 @@ done: * * Purpose: Free file space referenced by message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, September 26, 2003 @@ -563,7 +563,7 @@ done: * Purpose: Increment reference count on any objects referenced by * message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, September 26, 2003 @@ -604,9 +604,7 @@ done: * Purpose: Perform any necessary actions before copying message between * files for attribute messages. * - * Return: Success: Non-negative - * - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, June 26, 2006 @@ -628,7 +626,8 @@ H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src, HDassert(cpy_info->file_dst); /* Check to ensure that the version of the message to be copied does not exceed - the message version allowed by the destination file's high bound */ + * the message version allowed by the destination file's high bound. + */ if(attr_src->shared->version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)]) HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "attribute message version out of bounds") @@ -649,7 +648,6 @@ done: * Purpose: Copies a message from _MESG to _DEST in file * * Return: Success: Ptr to _DEST - * * Failure: NULL * * Programmer: Quincey Koziol @@ -695,7 +693,7 @@ done: * an object may have a reference attribute that points to the * object itself. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Peter Cao * March 6, 2005 @@ -719,12 +717,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_get_crt_index + * Function: H5O_attr_get_crt_index * - * Purpose: Get creation index from the message + * Purpose: Get creation index from the message * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, January 18, 2007 @@ -749,12 +746,11 @@ H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/) /*------------------------------------------------------------------------- - * Function: H5O_attr_set_crt_index + * Function: H5O_attr_set_crt_index * - * Purpose: Set creation index from the message + * Purpose: Set creation index from the message * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, January 18, 2007 diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 640d1c7..6e135c5 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Oattribute.c - * Dec 11 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5Oattribute.c * - * Purpose: Object header attribute routines. + * Purpose: Object header attribute routines. * *------------------------------------------------------------------------- */ @@ -26,21 +24,21 @@ /* Module Setup */ /****************/ -#define H5A_FRIEND /*suppress error about including H5Apkg */ +#define H5A_FRIEND /* Suppress error about including H5Apkg.h */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Fprivate.h" /* File */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Fprivate.h" /* File */ /****************/ @@ -129,8 +127,24 @@ typedef struct { /********************/ /* Local Prototypes */ /********************/ -static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, +static herr_t H5O__attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata); +static htri_t H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open); +static herr_t H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequence, + unsigned H5_ATTR_UNUSED *oh_modified, void *_udata); +static herr_t H5O__attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr); +static herr_t H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata); +static herr_t H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata); +static herr_t H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata); +static herr_t H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo); +static herr_t H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata); +static herr_t H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata); /*********************/ /* Package Variables */ @@ -149,12 +163,12 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, /*------------------------------------------------------------------------- - * Function: H5O_attr_to_dense_cb + * Function: H5O__attr_to_dense_cb * - * Purpose: Object header iterator callback routine to convert compact + * Purpose: Object header iterator callback routine to convert compact * attributes to dense attributes * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -163,14 +177,14 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, *------------------------------------------------------------------------- */ static herr_t -H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) { H5O_iter_cvt_t *udata = (H5O_iter_cvt_t *)_udata; /* Operator user data */ H5A_t *attr = (H5A_t *)mesg->native; /* Pointer to attribute to insert */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -186,7 +200,7 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, /* Convert message into a null message in the header */ /* (don't delete attribute's space in the file though) */ - if(H5O_release_mesg(udata->f, oh, mesg, FALSE) < 0) + if(H5O__release_mesg(udata->f, oh, mesg, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message") /* Indicate that the object header was modified */ @@ -194,15 +208,15 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_to_dense_cb() */ +} /* end H5O__attr_to_dense_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_create + * Function: H5O__attr_create * - * Purpose: Create a new attribute in the object header. + * Purpose: Create a new attribute in the object header. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, December 8, 2006 @@ -283,7 +297,7 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) /* Iterate over existing attributes, moving them to dense storage */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_to_dense_cb; + op.u.lib_op = H5O__attr_to_dense_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCONVERT, FAIL, "error converting attributes to dense storage") } /* end if */ @@ -337,7 +351,8 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) /* Increment reference count for shared attribute object for the * object handle created by the caller function H5A__create. The count * for the cached object header has been incremented in the step above - * (in H5O__msg_append_real). The dense storage doesn't need a count. */ + * (in H5O__msg_append_real). The dense storage doesn't need a count. + */ attr->shared->nrefs += 1; /* Was new attribute shared? */ @@ -392,12 +407,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_open_cb + * Function: H5O__attr_open_cb * - * Purpose: Object header iterator callback routine to open an + * Purpose: Object header iterator callback routine to open an * attribute stored compactly. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -406,13 +421,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, +H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/) { H5O_iter_opn_t *udata = (H5O_iter_opn_t *)_udata; /* Operator user data */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -437,15 +452,15 @@ H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_open_cb() */ +} /* end H5O__attr_open_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_open_by_name + * Function: H5O__attr_open_by_name * - * Purpose: Open an existing attribute in an object header. + * Purpose: Open an existing attribute in an object header. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 11, 2006 @@ -470,7 +485,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name) /* Protect the object header to iterate over */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -483,7 +498,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name) /* If found the attribute is already opened, make a copy of it to share the * object information. If not, open attribute as a new object */ - if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, name)) < 0) + if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute") else if(found_open_attr == TRUE) { if(NULL == (opened_attr = H5A__copy(NULL, exist_attr))) @@ -506,7 +521,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name) /* Iterate over attributes, to locate correct one to open */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_open_cb; + op.u.lib_op = H5O__attr_open_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "error updating attribute") @@ -541,12 +556,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_open_by_idx_cb + * Function: H5O__attr_open_by_idx_cb * - * Purpose: Callback routine opening an attribute by index + * Purpose: Callback routine opening an attribute by index * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -555,12 +569,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr) +H5O__attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr) { H5A_t **ret_attr = (H5A_t **)_ret_attr; /* 'User data' passed in */ herr_t ret_value = H5_ITER_STOP; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(attr); @@ -572,16 +586,16 @@ H5O_attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_open_by_idx_cb() */ +} /* end H5O__attr_open_by_idx_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_open_by_idx + * Function: H5O__attr_open_by_idx * - * Purpose: Open an existing attribute in an object header according to + * Purpose: Open an existing attribute in an object header according to * an index. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 18, 2006 @@ -605,7 +619,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_LIB; - attr_op.u.lib_op = H5O_attr_open_by_idx_cb; + attr_op.u.lib_op = H5O__attr_open_by_idx_cb; /* Iterate over attributes to locate correct one */ if(H5O_attr_iterate_real((hid_t)-1, loc, idx_type, order, n, NULL, &attr_op, &opened_attr) < 0) @@ -615,7 +629,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, * and make a copy of the already opened object to share the object info. */ if(opened_attr) { - if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, opened_attr->shared->name)) < 0) + if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, opened_attr->shared->name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute") /* If found that the attribute is already opened, make a copy of it @@ -647,12 +661,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_find_opened_attr + * Function: H5O__attr_find_opened_attr * - * Purpose: Find out whether an attribute has been opened by giving + * Purpose: Find out whether an attribute has been opened by giving * the name. Return the pointer to the object if found. * - * Return: TRUE: found the already opened object + * Return: TRUE: found the already opened object * FALSE: didn't find the opened object * FAIL: function failed. * @@ -662,14 +676,14 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open) +H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open) { hid_t *attr_id_list = NULL; /* List of IDs for opened attributes */ unsigned long loc_fnum; /* File serial # for object */ size_t num_open_attr; /* Number of opened attributes */ htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get file serial number for the location of attribute */ if(H5F_get_fileno(loc->file, &loc_fnum) < 0) @@ -691,15 +705,15 @@ H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_t /* Retrieve the IDs of all opened attributes */ if(H5F_get_obj_ids(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, num_open_attr, attr_id_list, FALSE, &check_num_attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get IDs of opened attributes") - if(check_num_attr != num_open_attr) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "open attribute count mismatch") + if(check_num_attr != num_open_attr) + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "open attribute count mismatch") /* Iterate over the attributes */ for(u = 0; u < num_open_attr; u++) { unsigned long attr_fnum; /* Attributes file serial number */ /* Get pointer to attribute */ - if(NULL == (*attr = (H5A_t *)H5I_object_verify(attr_id_list[u], H5I_ATTR))) + if(NULL == (*attr = (H5A_t *)H5VL_object_verify(attr_id_list[u], H5I_ATTR))) HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, FAIL, "not an attribute") /* Get file serial number for attribute */ @@ -724,15 +738,15 @@ done: H5MM_free(attr_id_list); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_find_opened_attr */ +} /* end H5O__attr_find_opened_attr() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_update_shared + * Function: H5O__attr_update_shared * - * Purpose: Update a shared attribute. + * Purpose: Update a shared attribute. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -802,25 +816,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_write_cb + * Function: H5O__attr_write_cb * - * Purpose: Object header iterator callback routine to update an + * Purpose: Object header iterator callback routine to update an * attribute stored compactly. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org * Dec 4 2006 * - * Modification:Raymond Lu - * 4 June 2008 - * Took out the data copying part because the attribute data - * is shared between attribute handle and object header. *------------------------------------------------------------------------- */ static herr_t -H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) { H5O_iter_wrt_t *udata = (H5O_iter_wrt_t *)_udata; /* Operator user data */ @@ -828,7 +838,7 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -885,15 +895,15 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_write_cb() */ +} /* end H5O__attr_write_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_write + * Function: H5O__attr_write * - * Purpose: Write a new value to an attribute. + * Purpose: Write a new value to an attribute. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 4, 2006 @@ -915,7 +925,7 @@ H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr) /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -942,7 +952,7 @@ H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr) /* Iterate over attributes, to locate correct one to update */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_write_cb; + op.u.lib_op = H5O__attr_write_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") @@ -964,12 +974,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_rename_chk_cb + * Function: H5O__attr_rename_chk_cb * - * Purpose: Object header iterator callback routine to check for + * Purpose: Object header iterator callback routine to check for * duplicate name during rename * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -978,13 +988,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/) { H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(oh); @@ -1001,21 +1011,21 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_rename_chk_cb() */ +} /* end H5O__attr_rename_chk_cb() */ /*------------------------------------------------------------------------- - * Function: H5O_attr_rename_mod_cb + * Function: H5O__attr_rename_mod_cb * - * Purpose: Object header iterator callback routine to change name of + * Purpose: Object header iterator callback routine to change name of * attribute during rename * - * Note: This routine doesn't currently allow an attribute to change + * Note: This routine doesn't currently allow an attribute to change * its "shared" status, if the name change would cause a size * difference that would put it into a different category. * Something for later... * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1024,7 +1034,7 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, *------------------------------------------------------------------------- */ static herr_t -H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) { H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */ @@ -1032,7 +1042,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -1096,7 +1106,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, /* (doesn't decrement the link count on shared components because * the "native" pointer has been reset) */ - if(H5O_release_mesg(udata->f, oh, mesg, FALSE) < 0) + if(H5O__release_mesg(udata->f, oh, mesg, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release previous attribute") *oh_modified = H5O_MODIFY_CONDENSE; @@ -1130,15 +1140,15 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_rename_mod_cb() */ +} /* end H5O__attr_rename_mod_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_rename + * Function: H5O__attr_rename * - * Purpose: Rename an attribute. + * Purpose: Rename an attribute. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 5, 2006 @@ -1162,7 +1172,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name, /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1190,7 +1200,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name, /* Iterate over attributes, to check if "new name" exists already */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_rename_chk_cb; + op.u.lib_op = H5O__attr_rename_chk_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") @@ -1200,7 +1210,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name, /* Iterate over attributes again, to actually rename attribute with old name */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_rename_mod_cb; + op.u.lib_op = H5O__attr_rename_mod_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") @@ -1218,15 +1228,15 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5O__attr_rename */ +} /* end H5O__attr_rename() */ /*------------------------------------------------------------------------- - * Function: H5O_attr_iterate_real + * Function: H5O_attr_iterate_real * - * Purpose: Internal routine to iterate over attributes for an object. + * Purpose: Internal routine to iterate over attributes for an object. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 5, 2006 @@ -1294,7 +1304,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, H5_index_t idx_type, /* Iterate over attributes in table */ if((ret_value = H5A__attr_iterate_table(&atable, skip, last_attr, loc_id, attr_op, op_data)) < 0) - HERROR(H5E_ATTR, H5E_CANTNEXT, "iteration operator failed"); + HERROR(H5E_ATTR, H5E_BADITER, "iteration operator failed"); } /* end else */ done: @@ -1309,11 +1319,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__attr_iterate + * Function: H5O__attr_iterate * - * Purpose: Iterate over attributes for an object. + * Purpose: Iterate over attributes for an object. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 5, 2006 @@ -1322,8 +1332,7 @@ done: */ herr_t H5O__attr_iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, - hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, - void *op_data) + hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data) { H5G_loc_t loc; /* Object location */ herr_t ret_value = FAIL; /* Return value */ @@ -1347,11 +1356,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_remove_update + * Function: H5O__attr_remove_update * - * Purpose: Check for reverting from dense to compact attribute storage + * Purpose: Check for reverting from dense to compact attribute storage * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, February 14, 2007 @@ -1367,12 +1376,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) +H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) { H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -1427,7 +1436,7 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) /* Insert attribute message into object header (Will increment reference count on shared attributes) */ /* Find out whether the attribute has been opened */ - if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0) + if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "failed in finding opened attribute") /* If found the attribute is already opened, use the opened message to insert. @@ -1450,7 +1459,8 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) /* Update the message after removing the attribute */ /* This is particularly needed when removing the last attribute that is - accessed via fractal heap/v2 B-tree (HDFFV-9277) */ + * accessed via fractal heap/v2 B-tree (HDFFV-9277) + */ if(H5O__msg_write_real(loc->file, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info message") @@ -1468,16 +1478,16 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_remove_update() */ +} /* end H5O__attr_remove_update() */ /*------------------------------------------------------------------------- - * Function: H5O_attr_remove_cb + * Function: H5O__attr_remove_cb * - * Purpose: Object header iterator callback routine to remove an + * Purpose: Object header iterator callback routine to remove an * attribute stored compactly. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1486,13 +1496,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) { H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -1502,7 +1512,7 @@ H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, /* Check for correct attribute message to modify */ if(HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) { /* Convert message into a null message (i.e. delete it) */ - if(H5O_release_mesg(udata->f, oh, mesg, TRUE) < 0) + if(H5O__release_mesg(udata->f, oh, mesg, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message") /* Indicate that the object header was modified */ @@ -1517,15 +1527,15 @@ H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_remove_cb() */ +} /* end H5O__attr_remove_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_remove + * Function: H5O__attr_remove * - * Purpose: Delete an attribute on an object. + * Purpose: Delete an attribute on an object. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 11, 2006 @@ -1548,7 +1558,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name) /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1575,7 +1585,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name) /* Iterate over attributes, to locate correct one to delete */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_remove_cb; + op.u.lib_op = H5O__attr_remove_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute") @@ -1586,7 +1596,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name) /* Update the attribute information after removing an attribute */ if(ainfo_exists) - if(H5O_attr_remove_update(loc, oh, &ainfo) < 0) + if(H5O__attr_remove_update(loc, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info") /* Update the modification time, if any */ @@ -1602,12 +1612,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__attr_remove_by_idx + * Function: H5O__attr_remove_by_idx * - * Purpose: Delete an attribute on an object, according to an order within - * an index. + * Purpose: Delete an attribute on an object, according to an order within + * an index. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, February 14, 2007 @@ -1631,7 +1641,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1666,7 +1676,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Iterate over attributes, to locate correct one to delete */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_remove_cb; + op.u.lib_op = H5O__attr_remove_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute") @@ -1677,7 +1687,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Update the attribute information after removing an attribute */ if(ainfo_exists) - if(H5O_attr_remove_update(loc, oh, &ainfo) < 0) + if(H5O__attr_remove_update(loc, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info") /* Update the modification time, if any */ @@ -1695,11 +1705,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_count_real + * Function: H5O__attr_count_real * - * Purpose: Determine the # of attributes on an object + * Purpose: Determine the # of attributes on an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, March 9, 2007 @@ -1707,11 +1717,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs) +H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_TAG(oh->cache_info.addr) + FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr) /* Check arguments */ HDassert(f); @@ -1745,16 +1755,16 @@ H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs) done: FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5O_attr_count_real */ +} /* end H5O__attr_count_real */ /*------------------------------------------------------------------------- - * Function: H5O_attr_exists_cb + * Function: H5O__attr_exists_cb * - * Purpose: Object header iterator callback routine to check for an + * Purpose: Object header iterator callback routine to check for an * attribute stored compactly, by name. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1763,13 +1773,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/) { H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(mesg); @@ -1785,15 +1795,15 @@ H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_exists_cb() */ +} /* end H5O__attr_exists_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_exists + * Function: H5O__attr_exists * - * Purpose: Determine if an attribute with a particular name exists on an object + * Purpose: Determine if an attribute with a particular name exists on an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 11, 2006 @@ -1815,7 +1825,7 @@ H5O__attr_exists(const H5O_loc_t *loc, const char *name) /* Protect the object header to iterate over */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1842,7 +1852,7 @@ H5O__attr_exists(const H5O_loc_t *loc, const char *name) /* Iterate over existing attributes, checking for attribute with same name */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_exists_cb; + op.u.lib_op = H5O__attr_exists_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error checking for existence of attribute") @@ -1863,7 +1873,7 @@ done: * * Purpose: For 1.8 attribute, returns storage amount for btree and fractal heap * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi * June 19, 2007 @@ -1943,11 +1953,11 @@ done: #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5O__attr_count + * Function: H5O__attr_count * - * Purpose: Determine the # of attributes on an object + * Purpose: Determine the # of attributes on an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 11, 2006 @@ -1968,10 +1978,10 @@ H5O__attr_count(const H5O_loc_t *loc) /* Protect the object header to iterate over */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Retrieve # of attributes on object */ - if(H5O_attr_count_real(loc->file, oh, &nattrs) < 0) + if(H5O__attr_count_real(loc->file, oh, &nattrs) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute count") /* Set return value */ diff --git a/src/H5Obogus.c b/src/H5Obogus.c index 92fd218..fbf04f2 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -75,7 +75,7 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{ 0, /*native message size */ 0, /* messages are sharable? */ H5O__bogus_decode, /*decode message */ - H5O__bogus_encode, /*encode message */ + H5O_bogus_encode, /*encode message */ NULL, /*copy the native value */ H5O_bogus_size, /*raw message size */ NULL, /*free internal memory */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 59e1705..fba4f6e 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -437,7 +437,7 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing) HDassert(oh->cache_info.type == H5AC_OHDR); HDassert(oh->chunk[0].size == len); #ifdef H5O_DEBUG - H5O_assert(oh); + H5O__assert(oh); #endif /* H5O_DEBUG */ /* Point to raw data 'image' for first chunk, which @@ -1430,9 +1430,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Check for combining two adjacent 'null' messages */ if((udata->file_intent & H5F_ACC_RDWR) && - H5O_NULL_ID == id && oh->nmesgs > 0 && - H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id && - oh->mesg[oh->nmesgs - 1].chunkno == chunkno) { + H5O_NULL_ID == id && oh->nmesgs > 0 && + H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id && + oh->mesg[oh->nmesgs - 1].chunkno == chunkno) { size_t mesgno; /* Current message to operate on */ @@ -1448,7 +1448,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Check if we need to extend message table to hold the new message */ if(oh->nmesgs >= oh->alloc_nmesgs) - if(H5O_alloc_msgs(oh, (size_t)1) < 0) + if(H5O__alloc_msgs(oh, (size_t)1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate more space for messages") /* Get pointer to message to set up */ @@ -1470,9 +1470,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* (Usually from future versions of the library) */ if(id >= H5O_UNKNOWN_ID || #ifdef H5O_ENABLE_BOGUS - id == H5O_BOGUS_VALID_ID || + id == H5O_BOGUS_VALID_ID || #endif - NULL == H5O_msg_class_g[id]) { + NULL == H5O_msg_class_g[id]) { H5O_unknown_t *unknown; /* Pointer to "unknown" message info */ @@ -1491,9 +1491,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Check for "fail if unknown" message flags */ if(((udata->file_intent & H5F_ACC_RDWR) && - (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE)) - || (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS)) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unknown message with 'fail if unknown' flag found") + (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE)) + || (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS)) + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unknown message with 'fail if unknown' flag found") /* Check for "mark if unknown" message flag, etc. */ else if((flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN) && !(flags & H5O_MSG_FLAG_WAS_UNKNOWN) && @@ -1619,7 +1619,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image done: if(ret_value < 0 && udata->cont_msg_info->msgs) { - udata->cont_msg_info->msgs = (H5O_chunk_t *)H5FL_SEQ_FREE(H5O_cont_t, udata->cont_msg_info->msgs); + udata->cont_msg_info->msgs = H5FL_SEQ_FREE(H5O_cont_t, udata->cont_msg_info->msgs); udata->cont_msg_info->alloc_nmsgs = 0; } FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index 205515a..94301b3 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -77,12 +77,11 @@ H5FL_DEFINE(H5O_chunk_proxy_t); /*------------------------------------------------------------------------- - * Function: H5O__chunk_add + * Function: H5O__chunk_add * - * Purpose: Add new chunk for object header to metadata cache + * Purpose: Add new chunk for object header to metadata cache * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -107,7 +106,7 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno) /* Allocate space for the object header data structure */ if(NULL == (chk_proxy = H5FL_CALLOC(H5O_chunk_proxy_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Increment reference count on object header */ if(H5O__inc_rc(oh) < 0) @@ -128,6 +127,7 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno) /* Insert the chunk proxy into the cache */ if(H5AC_insert_entry(f, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header chunk") + chk_proxy = NULL; done: @@ -146,12 +146,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__chunk_protect + * Function: H5O_chunk_protect * - * Purpose: Protect an object header chunk for modifications + * Purpose: Protect an object header chunk for modifications * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -221,12 +220,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__chunk_unprotect + * Function: H5O__chunk_unprotect * - * Purpose: Unprotect an object header chunk after modifications + * Purpose: Unprotect an object header chunk after modifications * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -273,12 +271,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_chunk_resize + * Function: H5O__chunk_resize * - * Purpose: Resize an object header chunk + * Purpose: Resize an object header chunk * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -287,11 +284,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy) +H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(oh); @@ -311,16 +308,15 @@ H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_chunk_resize() */ +} /* end H5O__chunk_resize() */ /*------------------------------------------------------------------------- - * Function: H5O__chunk_update_idx + * Function: H5O__chunk_update_idx * - * Purpose: Update the chunk index for a chunk proxy + * Purpose: Update the chunk index for a chunk proxy * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -367,12 +363,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__chunk_delete + * Function: H5O__chunk_delete * - * Purpose: Notify metadata cache that a chunk has been deleted + * Purpose: Notify metadata cache that a chunk has been deleted * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -413,12 +408,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__chunk_dest + * Function: H5O__chunk_dest * - * Purpose: Destroy a chunk proxy object + * Purpose: Destroy a chunk proxy object * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org diff --git a/src/H5Ocont.c b/src/H5Ocont.c index 2eb27d6..ad54272 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -36,10 +36,10 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_cont_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, +static void *H5O__cont_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static size_t H5O_cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static size_t H5O__cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__cont_free(void *mesg); static herr_t H5O__cont_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); static herr_t H5O__cont_debug(H5F_t *f, const void *_mesg, FILE * stream, @@ -51,10 +51,10 @@ const H5O_msg_class_t H5O_MSG_CONT[1] = {{ "hdr continuation", /*message name for debugging */ sizeof(H5O_cont_t), /*native message size */ 0, /* messages are sharable? */ - H5O_cont_decode, /*decode message */ - H5O_cont_encode, /*encode message */ + H5O__cont_decode, /*decode message */ + H5O__cont_encode, /*encode message */ NULL, /*no copy method */ - H5O_cont_size, /*size of header continuation */ + H5O__cont_size, /*size of header continuation */ NULL, /*reset method */ H5O__cont_free, /* free method */ H5O__cont_delete, /* file delete method */ @@ -74,7 +74,7 @@ H5FL_DEFINE(H5O_cont_t); /*------------------------------------------------------------------------- - * Function: H5O_cont_decode + * Function: H5O__cont_decode * * Purpose: Decode the raw header continuation message. * @@ -89,14 +89,14 @@ H5FL_DEFINE(H5O_cont_t); *------------------------------------------------------------------------- */ static void * -H5O_cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, +H5O__cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { H5O_cont_t *cont = NULL; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -116,11 +116,11 @@ H5O_cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_cont_decode() */ +} /* end H5O__cont_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_cont_encode + * Function: H5O__cont_encode * * Purpose: Encodes a continuation message. * @@ -133,11 +133,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_cont_t *cont = (const H5O_cont_t *) _mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -151,11 +151,11 @@ H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con H5F_ENCODE_LENGTH(f, p, cont->size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_cont_encode() */ +} /* end H5O__cont_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_cont_size + * Function: H5O__cont_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -172,18 +172,18 @@ H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con *------------------------------------------------------------------------- */ static size_t -H5O_cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) +H5O__cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ ret_value = (size_t)(H5F_SIZEOF_ADDR(f) + /* Continuation header address */ H5F_SIZEOF_SIZE(f)); /* Continuation header length */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_cont_size() */ +} /* end H5O__cont_size() */ /*------------------------------------------------------------------------- @@ -256,8 +256,6 @@ done: * matzke@llnl.gov * Aug 6 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 2e628f4..a3d4884 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Ocopy.c - * Nov 6 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5Ocopy.c * - * Purpose: Object copying routines. + * Purpose: Object copying routines. * *------------------------------------------------------------------------- */ @@ -32,19 +30,20 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Aprivate.h" /* Attributes */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5HGprivate.h" /* Global Heaps */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Lprivate.h" /* Links */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5HGprivate.h" /* Global Heaps */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Lprivate.h" /* Links */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -79,8 +78,6 @@ typedef struct H5O_copy_search_comm_dt_ud_t { /* Local Prototypes */ /********************/ -static herr_t H5O__copy(const H5G_loc_t *loc, const char *src_name, - H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id); static herr_t H5O__copy_free_addrmap_cb(void *item, void *key, void *op_data); static herr_t H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5O_copy_t *cpy_info, H5O_type_t *obj_type, void **udata); @@ -195,19 +192,18 @@ H5FL_DEFINE(haddr_t); * hid_t lcpl_id IN: Properties which apply to the new hard link * * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Peter Cao - * June 4, 2005 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, - const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id) + const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id) { - H5G_loc_t loc; /* Source group group location */ - H5G_loc_t dst_loc; /* Destination group location */ + H5VL_object_t *vol_obj1 = NULL; /* object token of src_id */ + H5VL_loc_params_t loc_params1; + H5VL_object_t *vol_obj2 = NULL; /* object token of dst_id */ + H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -215,21 +211,43 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, ocpypl_id, lcpl_id); /* Check arguments */ - if(H5G_loc(src_loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(H5G_loc(dst_loc_id, &dst_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!src_name || !*src_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source name specified") if(!dst_name || !*dst_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") + + /* Get correct property lists */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + else + if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list") + + /* Get object copy property list */ + if (H5P_DEFAULT == ocpypl_id) + ocpypl_id = H5P_OBJECT_COPY_DEFAULT; + else + if(TRUE != H5P_isa_class(ocpypl_id, H5P_OBJECT_COPY)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not object copy property list") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(src_loc_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine to copy object */ - if(H5O__copy(&loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id) < 0) + /* get the object */ + if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + loc_params1.type = H5VL_OBJECT_BY_SELF; + loc_params1.obj_type = H5I_get_type(src_loc_id); + + /* get the object */ + if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + loc_params2.type = H5VL_OBJECT_BY_SELF; + loc_params2.obj_type = H5I_get_type(dst_loc_id); + + /* Copy the object */ + if(H5VL_object_copy(vol_obj1, &loc_params1, src_name, vol_obj2, &loc_params2, dst_name, ocpypl_id, lcpl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") done: @@ -238,23 +256,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__copy - * - * Purpose: Internal routine to copy an object + * Function: H5O_copy * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). + * Purpose: Private version of H5Ocopy * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 29, 2017 * *------------------------------------------------------------------------- */ -static herr_t -H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, +herr_t +H5O_copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id) { H5G_loc_t src_loc; /* Source object group location */ @@ -263,9 +277,9 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, htri_t dst_exists; /* Does destination name exist already? */ hbool_t loc_found = FALSE; /* Location at 'name' found */ hbool_t obj_open = FALSE; /* Entry at 'name' found */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_NOAPI_NOINIT /* Check arguments */ HDassert(loc); @@ -275,7 +289,7 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, /* Check if destination name already exists */ if((dst_exists = H5L_exists_tolerant(dst_loc, dst_name)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check if destination name exists") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check if destination name exists") if(TRUE == dst_exists) HGOTO_ERROR(H5E_OHDR, H5E_EXISTS, FAIL, "destination object already exists") @@ -294,24 +308,6 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") obj_open = TRUE; - /* Get correct property lists */ - if(H5P_DEFAULT == lcpl_id) { - if((lcpl_id = H5P_get_default(H5P_CLS_LCRT)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to get default lcpl") - } /* end if */ - else - if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list") - - /* Get object copy property list */ - if(H5P_DEFAULT == ocpypl_id) { - if((ocpypl_id = H5P_get_default(H5P_CLS_OCPY)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to get default ocpypl") - } /* end if */ - else - if(TRUE != H5P_isa_class(ocpypl_id, H5P_OBJECT_COPY)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not object copy property list") - /* Do the actual copying of the object */ if(H5O__copy_obj(&src_loc, dst_loc, dst_name, ocpypl_id, lcpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") @@ -322,8 +318,8 @@ done: if(obj_open && H5O_close(&src_oloc, NULL) < 0) HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, FAIL, "unable to release object header") - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__copy() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_copy() */ /*------------------------------------------------------------------------- @@ -442,7 +438,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, } /* end if */ /* Flush any dirty messages in source object header to update the header chunks */ - if(H5O_flush_msgs(oloc_src->file, oh_src) < 0) + if(H5O__flush_msgs(oloc_src->file, oh_src) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object header messages") /* Allocate the destination object header and fill in header fields */ @@ -777,7 +773,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, /* Make sure we have enough space for new NULL message */ if(oh_dst->nmesgs + 1 > oh_dst->alloc_nmesgs) - if(H5O_alloc_msgs(oh_dst, (size_t)1) < 0) + if(H5O__alloc_msgs(oh_dst, (size_t)1) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* Create null message for [rest of] space in new chunk */ @@ -1226,7 +1222,7 @@ H5O__copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, const char *dst_name, /* Insert the new object in the destination file's group */ if(H5L_link(dst_loc, dst_name, &new_loc, lcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link") entry_inserted = TRUE; done: @@ -1544,7 +1540,7 @@ H5O_copy_search_comm_dt_attr_cb(const H5A_t *attr, void *_udata) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get attribute datatype") /* Check if the datatype is committed and search the skip list if so */ - if(H5T_committed(dt)) { + if(H5T_is_named(dt)) { /* Allocate key */ if(NULL == (key = H5FL_MALLOC(H5O_copy_search_comm_dt_key_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") @@ -1661,9 +1657,8 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc, if(NULL == (key->dt = (H5T_t *)H5O_msg_read(obj_oloc, H5O_DTYPE_ID, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read DTYPE message") - /* Check if the datatype is committed and search the skip list if so - */ - if(H5T_committed(key->dt)) { + /* Check if the datatype is committed and search the skip list if so */ + if(H5T_is_named(key->dt)) { /* Get datatype object fileno */ H5F_GET_FILENO(obj_oloc->file, key->fileno); @@ -1800,7 +1795,7 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, HDassert(oh_src); HDassert(oloc_dst); HDassert(oloc_dst->file); - HDassert(H5F_FILE_ID(oloc_dst->file) >= 0); + HDassert(H5F_ID_EXISTS(oloc_dst->file)); HDassert(cpy_info); /* Allocate key */ @@ -1910,7 +1905,7 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, /* Traverse the destination file, adding committed datatypes to the skip * list */ - if(H5G_visit(H5F_FILE_ID(oloc_dst->file), "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5O__copy_search_comm_dt_cb, &udata) < 0) + if(H5G_visit(&dst_root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5O__copy_search_comm_dt_cb, &udata) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") cpy_info->dst_dt_list_complete = TRUE; } /* end if */ diff --git a/src/H5Odbg.c b/src/H5Odbg.c index 1fc95dd..b8190ae 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -76,12 +76,12 @@ #ifdef H5O_DEBUG /*------------------------------------------------------------------------- - * Function: H5O_assert + * Function: H5O__assert * - * Purpose: Sanity check the information for an object header data + * Purpose: Sanity check the information for an object header data * structure. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED (Doesn't fail, just crashes) * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -90,7 +90,7 @@ *------------------------------------------------------------------------- */ herr_t -H5O_assert(const H5O_t *oh) +H5O__assert(const H5O_t *oh) { H5O_mesg_t *curr_msg; /* Pointer to current message to examine */ H5O_mesg_t *tmp_msg; /* Pointer to temporary message to examine */ @@ -101,7 +101,7 @@ H5O_assert(const H5O_t *oh) size_t hdr_size; /* Size of header's chunks */ unsigned u, v; /* Local index variables */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Initialize the tracking variables */ hdr_size = 0; @@ -223,7 +223,7 @@ H5O_assert(const H5O_t *oh) HDassert(hdr_size == (free_space + meta_space + mesg_space)); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_assert() */ +} /* end H5O__assert() */ #endif /* H5O_DEBUG */ @@ -270,31 +270,27 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_debug_real + * Function: H5O__debug_real * - * Purpose: Prints debugging info about an object header. + * Purpose: Prints debugging info about an object header. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * matzke@llnl.gov * Aug 6 1997 * - * Modifications: - * Feb. 2009: Vailin Choi - * Fixed bug in the accumulation of chunk_total - * Used the appropriate flag when printing creation order tracked/indexed *------------------------------------------------------------------------- */ herr_t -H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth) +H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth) { size_t mesg_total = 0, chunk_total = 0, gap_total = 0; unsigned *sequence = NULL; unsigned i; /* Local index variable */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(f); @@ -323,16 +319,16 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int /* Extra information for later versions */ if(oh->version > H5O_VERSION_1) { /* Display object's status flags */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Attribute creation order tracked:", (oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) ? "Yes" : "No"); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Attribute creation order indexed:", (oh->flags & H5O_HDR_ATTR_CRT_ORDER_INDEXED) ? "Yes" : "No"); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Attribute storage phase change values:", (oh->flags & H5O_HDR_ATTR_STORE_PHASE_CHANGE) ? "Non-default" : "Default"); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Timestamps:", (oh->flags & H5O_HDR_STORE_TIMES) ? "Enabled" : "Disabled"); if(oh->flags & ~H5O_HDR_ALL_FLAGS) @@ -385,14 +381,14 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int for(i = 0, chunk_total = 0; i < oh->nchunks; i++) { size_t chunk_size; - HDfprintf(stream, "%*sChunk %d...\n", indent, "", i); + HDfprintf(stream, "%*sChunk %d...\n", indent, "", i); - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), "Address:", oh->chunk[i].addr); /* Decrement chunk 0's size by the object header prefix size */ - if(0 == i) { + if(0 == i) { if(H5F_addr_ne(oh->chunk[i].addr, addr)) HDfprintf(stream, "*** WRONG ADDRESS FOR CHUNK #0!\n"); chunk_size = oh->chunk[i].size - (size_t)H5O_SIZEOF_HDR(oh); @@ -401,54 +397,53 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int chunk_size = oh->chunk[i].size; /* Accumulate chunk's size to total */ - chunk_total += chunk_size; - gap_total += oh->chunk[i].gap; + chunk_total += chunk_size; + gap_total += oh->chunk[i].gap; - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), "Size in bytes:", chunk_size); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), "Gap:", oh->chunk[i].gap); } /* end for */ /* debug each message */ if(NULL == (sequence = (unsigned *)H5MM_calloc(NELMTS(H5O_msg_class_g) * sizeof(unsigned)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") for(i = 0, mesg_total = 0; i < oh->nmesgs; i++) { const H5O_msg_class_t *debug_type; /* Type of message to use for callbacks */ unsigned chunkno; /* Chunk for message */ /* Accumulate message's size to total */ - mesg_total += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size; + mesg_total += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size; - /* For version 2 object header, add size of "OCHK" for continuation chunk */ - if (oh->mesg[i].type->id == H5O_CONT_ID) - mesg_total += H5O_SIZEOF_CHKHDR_OH(oh); + /* For version 2 object header, add size of "OCHK" for continuation chunk */ + if(oh->mesg[i].type->id == H5O_CONT_ID) + mesg_total += H5O_SIZEOF_CHKHDR_OH(oh); - HDfprintf(stream, "%*sMessage %d...\n", indent, "", i); + HDfprintf(stream, "%*sMessage %d...\n", indent, "", i); - /* check for bad message id */ - if(oh->mesg[i].type->id >= (int)NELMTS(H5O_msg_class_g)) { - HDfprintf(stream, "*** BAD MESSAGE ID 0x%04x\n", - oh->mesg[i].type->id); - continue; - } /* end if */ + /* check for bad message id */ + if(oh->mesg[i].type->id >= (int)NELMTS(H5O_msg_class_g)) { + HDfprintf(stream, "*** BAD MESSAGE ID 0x%04x\n", oh->mesg[i].type->id); + continue; + } /* end if */ - /* message name and size */ - HDfprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n", + /* message name and size */ + HDfprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n", indent + 3, "", MAX(0, fwidth - 3), "Message ID (sequence number):", (unsigned) (oh->mesg[i].type->id), oh->mesg[i].type->name, sequence[oh->mesg[i].type->id]++); - HDfprintf(stream, "%*s%-*s %t\n", indent + 3, "", MAX (0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %t\n", indent + 3, "", MAX (0, fwidth - 3), "Dirty:", oh->mesg[i].dirty); HDfprintf(stream, "%*s%-*s ", indent + 3, "", MAX (0, fwidth - 3), "Message flags:"); - if(oh->mesg[i].flags) { + if(oh->mesg[i].flags) { hbool_t flag_printed = FALSE; /* Sanity check that all flags in format are covered below */ @@ -497,39 +492,40 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int } /* end if */ else HDfprintf(stream, "<none>\n"); - HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", MAX(0, fwidth - 3), + + HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", MAX(0, fwidth - 3), "Chunk number:", oh->mesg[i].chunkno); - chunkno = oh->mesg[i].chunkno; - if(chunkno >= oh->nchunks) - HDfprintf(stream, "*** BAD CHUNK NUMBER\n"); - HDfprintf(stream, "%*s%-*s (%Zu, %Zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3), + chunkno = oh->mesg[i].chunkno; + if(chunkno >= oh->nchunks) + HDfprintf(stream, "*** BAD CHUNK NUMBER\n"); + HDfprintf(stream, "%*s%-*s (%Zu, %Zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3), "Raw message data (offset, size) in chunk:", (size_t)(oh->mesg[i].raw - oh->chunk[chunkno].image), oh->mesg[i].raw_size); - /* check the size */ - if((oh->mesg[i].raw + oh->mesg[i].raw_size > + /* check the size */ + if((oh->mesg[i].raw + oh->mesg[i].raw_size > oh->chunk[chunkno].image + oh->chunk[chunkno].size) || (oh->mesg[i].raw < oh->chunk[chunkno].image)) - HDfprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n"); + HDfprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n"); - /* decode the message */ - debug_type = oh->mesg[i].type; - if(NULL == oh->mesg[i].native && debug_type->decode) + /* decode the message */ + debug_type = oh->mesg[i].type; + if(NULL == oh->mesg[i].native && debug_type->decode) H5O_LOAD_NATIVE(f, H5O_DECODEIO_NOCHANGE, oh, &oh->mesg[i], FAIL) - /* print the message */ - HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), + /* print the message */ + HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), "Message Information:"); - if(debug_type->debug && oh->mesg[i].native != NULL) - (debug_type->debug)(f, oh->mesg[i].native, stream, indent + 6, MAX(0, fwidth - 6)); - else - HDfprintf(stream, "%*s<No info for this message>\n", indent + 6, ""); + if(debug_type->debug && oh->mesg[i].native != NULL) + (debug_type->debug)(f, oh->mesg[i].native, stream, indent + 6, MAX(0, fwidth - 6)); + else + HDfprintf(stream, "%*s<No info for this message>\n", indent + 6, ""); } /* end for */ if((mesg_total + gap_total) != chunk_total) - HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n"); + HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n"); done: /* Release resources */ @@ -537,7 +533,7 @@ done: sequence = (unsigned *)H5MM_xfree(sequence); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_debug_real() */ +} /* end H5O__debug_real() */ /*------------------------------------------------------------------------- @@ -575,14 +571,15 @@ H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) loc.holding_file = FALSE; if(NULL == (oh = H5O_protect(&loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* debug */ - H5O_debug_real(f, oh, addr, stream, indent, fwidth); + if(H5O__debug_real(f, oh, addr, stream, indent, fwidth) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "debug dump call failed") done: if(oh && H5O_unprotect(&loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_debug() */ diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 876579d..93fc18a 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -31,9 +31,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Opkg.h" /* Object headers */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Opkg.h" /* Object headers */ /****************/ @@ -87,20 +89,27 @@ herr_t H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", loc_id, oinfo); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -121,26 +130,37 @@ done: herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*s*xi", loc_id, name, oinfo, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") if(!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") - /* Verify access property list and set up collective metadata if appropriate */ + /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* 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(H5O__get_info_by_name(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: @@ -166,11 +186,8 @@ herr_t H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ - H5G_loc_t obj_loc; /* Location used to open group */ - 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 */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -178,8 +195,6 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name || !*group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -193,15 +208,23 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Retrieve the object's information */ - if(H5O__get_info_by_idx(&loc, group_name, idx_type, order, n, oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: - /* Release the object location */ - if(loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_API(ret_value) } /* end H5Oget_info_by_idx1() */ @@ -242,7 +265,9 @@ herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data) { - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "iIiIox*x", obj_id, idx_type, order, op, op_data); @@ -255,8 +280,16 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") - /* Call internal object visitation routine */ - if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(obj_id); + + /* Visit the objects */ + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: @@ -300,15 +333,19 @@ herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id) { - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE7("e", "i*sIiIox*xi", loc_id, obj_name, idx_type, order, op, op_data, lapl_id); /* Check args */ - if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!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) @@ -320,8 +357,18 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call internal object visitation routine */ - if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Visit the objects */ + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 8060398..28970d1 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -15,13 +15,13 @@ #define H5T_FRIEND /*prevent warning from including H5Tpkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Gprivate.h" /* Groups */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Gprivate.h" /* Groups */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object headers */ #include "H5Tpkg.h" /* Datatypes */ #include "H5VMprivate.h" /* Vectors and arrays */ @@ -1485,7 +1485,7 @@ H5O_dtype_can_share(const void *_mesg) HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "can't tell if datatype is immutable") /* Don't share committed datatypes */ - if((tri_ret = H5T_committed(mesg)) > 0) + if((tri_ret = H5T_is_named(mesg)) > 0) HGOTO_DONE(FALSE) else if(tri_ret < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "can't tell if datatype is shared") @@ -1619,14 +1619,15 @@ H5O__dtype_shared_post_copy_upd(const H5O_loc_t H5_ATTR_UNUSED *src_oloc, FUNC_ENTER_STATIC if(dt_dst->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { - HDassert(H5T_committed(dt_dst)); + HDassert(H5T_is_named(dt_dst)); if(H5O_loc_reset(&(dt_dst->oloc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to reset location") dt_dst->oloc.file = dt_dst->sh_loc.file; dt_dst->oloc.addr = dt_dst->sh_loc.u.loc.oh_addr; } /* end if */ - else - HDassert(!H5T_committed(dt_dst)); + else { + HDassert(!H5T_is_named(dt_dst)); + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 8a6004d..125da36 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -344,12 +344,12 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, if((exists = H5O_msg_exists_oh(open_oh, H5O_DTYPE_ID)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read object header") if(exists) { - if((dt = H5O_msg_read_oh(f, open_oh, H5O_DTYPE_ID, NULL)) < 0) + if(NULL == (dt = (H5T_t *)H5O_msg_read_oh(f, open_oh, H5O_DTYPE_ID, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't read DTYPE message") /* Verify size */ - if(fill->size != H5T_GET_SIZE(dt)) + if(fill->size != (ssize_t)H5T_GET_SIZE(dt)) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "inconsistent fill value size") - } + } /* end if */ if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value") @@ -754,8 +754,8 @@ H5O_fill_reset_dyn(H5O_fill_t *fill) } /* end if */ fill->size = 0; if(fill->type) { - (void)H5T_close_real(fill->type); - fill->type = NULL; + (void)H5T_close_real(fill->type); + fill->type = NULL; } /* end if */ done: @@ -1008,7 +1008,7 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed) * Can we convert between source and destination data types? */ if(NULL == (tpath = H5T_path_find(fill->type, dset_type))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes") /* Don't bother doing anything if there will be no actual conversion */ if(!H5T_path_noop(tpath)) { diff --git a/src/H5Oflush.c b/src/H5Oflush.c index e8e077e..3e1ae46 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -27,6 +27,7 @@ /****************/ #include "H5Omodule.h" /* This source code file is part of the H5O module */ +#define H5T_FRIEND /* Suppress error about including H5Tpkg */ /***********/ /* Headers */ @@ -40,16 +41,14 @@ #include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Objects */ - +#include "H5Tpkg.h" /* Datatypes */ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5O__flush(hid_t obj_id); static herr_t H5O__oh_tag(const H5O_loc_t *oloc, haddr_t *tag); static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc); -static herr_t H5O__refresh(hid_t obj_id); /*************/ @@ -59,11 +58,11 @@ static herr_t H5O__refresh(hid_t obj_id); /*------------------------------------------------------------------------- - * Function: H5Oflush + * Function: H5Oflush * - * Purpose: Flushes all buffers associated with an object to disk. + * Purpose: Flushes all buffers associated with an object to disk. * - * Return: Non-negative on success, negative on failure + * Return: SUCCEED/FAIL * * Programmer: Mike McGreevy * May 19, 2010 @@ -73,17 +72,27 @@ static herr_t H5O__refresh(hid_t obj_id); herr_t H5Oflush(hid_t obj_id) { - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Object token */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", obj_id); + /* Check args */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + /* Set up collective metadata if appropriate */ if(H5CX_set_loc(obj_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call internal routine */ - if(H5O__flush(obj_id) < 0) + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(obj_id); + + /* Flush the object */ + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") done: @@ -92,6 +101,49 @@ done: /*------------------------------------------------------------------------- + * Function: H5O_flush + * + * Purpose: Internal routine to flush an object + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * December 29, 2017 + * + *------------------------------------------------------------------------- + */ +herr_t +H5O_flush(H5O_loc_t *oloc, hid_t obj_id) +{ + void *obj_ptr; /* Pointer to object */ + const H5O_obj_class_t *obj_class; /* Class of object */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Get the object pointer */ + if(NULL == (obj_ptr = H5VL_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + /* Get the object class */ + if(NULL == (obj_class = H5O__obj_class(oloc))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object class") + + /* Flush the object of this class */ + if(obj_class->flush && obj_class->flush(obj_ptr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") + + /* Flush the object metadata and invoke flush callback */ + if(H5O_flush_common(oloc, obj_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_flush() */ + + +/*------------------------------------------------------------------------- * Function: H5O_flush_common * * Purpose: Flushes the object's metadata @@ -121,7 +173,7 @@ H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id) /* Check to invoke callback */ if(H5F_object_flush_cb(oloc->file, obj_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to do object flush callback") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to do object flush callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -129,57 +181,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__flush - * - * Purpose: Internal routine to flush an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 29, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5O__flush(hid_t obj_id) -{ - H5O_loc_t *oloc; /* Object location */ - void *obj_ptr; /* Pointer to object */ - const H5O_obj_class_t *obj_class; /* Class of object */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check args */ - if(NULL == (oloc = H5O_get_loc(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object") - - /* Get the object pointer */ - if(NULL == (obj_ptr = H5I_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - - /* Get the object class */ - if(NULL == (obj_class = H5O__obj_class(oloc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object class") - - /* Flush the object of this class */ - if(obj_class->flush && obj_class->flush(obj_ptr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") - - /* Flush the object metadata and invoke flush callback */ - if(H5O_flush_common(oloc, obj_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__flush() */ - - -/*------------------------------------------------------------------------- * Function: H5O__oh_tag * * Purpose: Get object header's address--tag value for the object @@ -223,9 +224,9 @@ done: /*------------------------------------------------------------------------- * Function: H5Orefresh * - * Purpose: Refreshes all buffers associated with an object. + * Purpose: Refreshes all buffers associated with an object. * - * Return: Non-negative on success, negative on failure + * Return: SUCCEED/FAIL * * Programmer: Mike McGreevy * July 28, 2010 @@ -235,17 +236,27 @@ done: herr_t H5Orefresh(hid_t oid) { - herr_t ret_value = SUCCEED; /* Return value */ - + H5VL_object_t *vol_obj = NULL; /* Object token */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", oid); + /* Check args */ + if(NULL == (vol_obj = H5VL_vol_object(oid))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + /* Set up collective metadata if appropriate */ if(H5CX_set_loc(oid) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(oid); - /* Call internal routine */ - if(H5O__refresh(oid) < 0) + /* Refresh the object */ + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oid) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") done: @@ -276,6 +287,7 @@ done: herr_t H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) { + H5VL_object_t *vol_obj = NULL; /* VOL object associated with the ID */ hbool_t objs_incr = FALSE; /* Whether the object count in the file was incremented */ herr_t ret_value = SUCCEED; /* Return value */ @@ -286,6 +298,8 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) H5G_loc_t obj_loc; H5O_loc_t obj_oloc; H5G_name_t obj_path; + H5O_shared_t cached_H5O_shared; + H5VL_t *connector = NULL; /* Create empty object location */ obj_loc.oloc = &obj_oloc; @@ -298,13 +312,40 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) H5F_incr_nopen_objs(oloc.file); objs_incr = TRUE; + /* Save important datatype state */ + if(H5I_get_type(oid) == H5I_DATATYPE) + if(H5T_save_refresh_state(oid, &cached_H5O_shared) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to save datatype state") + + /* Get the VOL object from the ID and cache a pointer to the connector. + * The vol_obj will disappear when the underlying object is closed, so + * we can't use that directly. + */ + if(NULL == (vol_obj = H5VL_vol_object(oid))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + connector = vol_obj->connector; + + /* Bump the number of references on the VOL connector. + * If you don't do this, VDS refreshes can accidentally close the connector. + */ + connector->nrefs++; + /* Close object & evict its metadata */ if((H5O__refresh_metadata_close(oid, oloc, &obj_loc)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") /* Re-open the object, re-fetching its metadata */ - if((H5O_refresh_metadata_reopen(oid, &obj_loc, FALSE)) < 0) + if((H5O_refresh_metadata_reopen(oid, &obj_loc, connector, FALSE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") + + /* Restore the number of references on the VOL connector */ + connector->nrefs--; + + /* Restore important datatype state */ + if(H5I_get_type(oid) == H5I_DATATYPE) + if(H5T_restore_refresh_state(oid, &cached_H5O_shared) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to restore datatype state") + } /* end if */ done: @@ -351,10 +392,10 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc) H5G_loc_copy(obj_loc, &tmp_loc, H5_COPY_DEEP); } /* end if */ - /* Get object's type */ + /* Handle close for multiple dataset opens */ if(H5I_get_type(oid) == H5I_DATASET) - if(H5D_mult_refresh_close(oid) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") + if(H5D_mult_refresh_close(oid) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") /* Retrieve tag for object */ if(H5O__oh_tag(&oloc, &tag) < 0) @@ -378,8 +419,8 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc) /* Re-cork object with tag */ if(corked) - if(H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to cork the object") + if(H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to cork the object") done: FUNC_LEAVE_NOAPI(ret_value); @@ -401,14 +442,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr) +H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_connector, hbool_t start_swmr) { - void *object = NULL; /* Dataset for this operation */ + void *object = NULL; /* Object for this operation */ H5I_type_t type; /* Type of object for the ID */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Sanity check */ + HDassert(obj_loc); + HDassert(vol_connector); + /* Get object's type */ type = H5I_get_type(oid); @@ -416,13 +461,13 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr) case H5I_GROUP: /* Re-open the group */ if(NULL == (object = H5G_open(obj_loc))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open group") break; case H5I_DATATYPE: /* Re-open the named datatype */ if(NULL == (object = H5T_open(obj_loc))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to open named datatype") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open named datatype") break; case H5I_DATASET: @@ -431,7 +476,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") if(!start_swmr) /* No need to handle multiple opens when H5Fstart_swmr_write() */ if(H5D_mult_refresh_reopen((H5D_t *)object) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to finish refresh for dataset") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to finish refresh for dataset") break; case H5I_UNINIT: @@ -441,6 +486,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr) case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -448,52 +494,15 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr) case H5I_ERROR_STACK: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid file object ID (dataset, group, or datatype)") + HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not a valid file object ID (dataset, group, or datatype)") break; } /* end switch */ /* Re-register ID for the object */ - if((H5I_register_with_id(type, object, TRUE, oid)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object atom") + if((H5VL_register_using_existing_id(type, object, vol_connector, TRUE, oid)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh") done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5O_refresh_metadata_reopen() */ - -/*------------------------------------------------------------------------- - * Function: H5O__refresh - * - * Purpose: Internal routine to refresh an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 29, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5O__refresh(hid_t obj_id) -{ - H5O_loc_t *oloc; /* Object location */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check args */ - if(NULL == (oloc = H5O_get_loc(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object") - - /* Private function */ - if(H5O_refresh_metadata(obj_id, *oloc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__refresh() */ - diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index b75a9c5..4b34a52 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -113,7 +113,7 @@ H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, /* Allocate space for message */ if(NULL == (ginfo = H5FL_CALLOC(H5O_ginfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Get the flags for the group */ flags = *p++; @@ -231,7 +231,7 @@ H5O_ginfo_copy(const void *_mesg, void *_dest) /* check args */ HDassert(ginfo); if(!dest && NULL == (dest = H5FL_MALLOC(H5O_ginfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* copy */ *dest = *ginfo; diff --git a/src/H5Oint.c b/src/H5Oint.c index b543d1b..aa96cb4 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -42,7 +42,7 @@ #include "H5MMprivate.h" /* Memory management */ #endif /* H5O_ENABLE_BOGUS */ #include "H5Opkg.h" /* Object headers */ -#include "H5SMprivate.h" /* Shared object header messages */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -664,28 +664,28 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_open_name + * Function: H5O_open_name * - * Purpose: Opens an object within an HDF5 file. + * Purpose: Opens an object by name * - * Return: Success: An open object identifier - * Failure: Negative + * Return: Success: Pointer to object data + * Failure: NULL * * Programmer: Quincey Koziol * March 5 2007 * *------------------------------------------------------------------------- */ -hid_t -H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref) +void * +H5O_open_name(const H5G_loc_t *loc, const char *name, H5I_type_t *opened_type) { H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t ret_value = H5I_INVALID_HID; + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(H5I_INVALID_HID) + FUNC_ENTER_NOAPI(NULL) /* Check args */ HDassert(loc); @@ -698,85 +698,46 @@ H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref) /* Find the object's location */ if(H5G_loc_find(loc, name, &obj_loc/*out*/) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, H5I_INVALID_HID, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "object not found") loc_found = TRUE; /* Open the object */ - if((ret_value = H5O__open_by_loc(&obj_loc, app_ref)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + if(NULL == (ret_value = H5O_open_by_loc(&obj_loc, opened_type))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object") done: - if(ret_value < 0 && loc_found) - if(H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location") + if(NULL == ret_value) + if(loc_found && H5G_loc_free(&obj_loc) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "can't free location") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_open_name() */ /*------------------------------------------------------------------------- - * Function: H5O__open_name - * - * Purpose: Internal routine to open an object by name - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -hid_t -H5O__open_name(const H5G_loc_t *loc, const char *name) -{ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name); - - /* Open the object */ - if((ret_value = H5O_open_name(loc, name, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__open_name() */ - - -/*------------------------------------------------------------------------- - * Function: H5O__open_by_idx + * Function: H5O_open_by_idx * * Purpose: Internal routine to open an object by index within group * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Pointer to object data + * Failure: NULL * * Programmer: Quincey Koziol * December 28, 2017 * *------------------------------------------------------------------------- */ -hid_t -H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n) +void * +H5O_open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, H5I_type_t *opened_type) { H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_NOAPI(NULL) /* Check arguments */ HDassert(loc); @@ -788,48 +749,45 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, /* Find the object's location, according to the order in the index */ if(H5G_loc_find_by_idx(loc, name, idx_type, order, n, &obj_loc/*out*/) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, H5I_INVALID_HID, "group not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "group not found") loc_found = TRUE; /* Open the object */ - if((ret_value = H5O__open_by_loc(&obj_loc, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + if(NULL == (ret_value = H5O_open_by_loc(&obj_loc, opened_type))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object") done: /* Release the object location if we failed after copying it */ - if(ret_value < 0 && loc_found) - if(H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location") + if(NULL == ret_value) + if(loc_found && H5G_loc_free(&obj_loc) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__open_by_idx() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_open_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5O__open_by_addr + * Function: H5O_open_by_addr * * Purpose: Internal routine to open an object by its address * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Pointer to object data + * Failure: NULL * * Programmer: Quincey Koziol * December 28, 2017 * *------------------------------------------------------------------------- */ -hid_t -H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr) +void * +H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type) { H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_NOAPI(NULL) /* Check arguments */ HDassert(loc); @@ -843,87 +801,49 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr) H5G_name_reset(obj_loc.path); /* objects opened through this routine don't have a path name */ /* Open the object */ - if((ret_value = H5O__open_by_loc(&obj_loc, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + if(NULL == (ret_value = H5O_open_by_loc(&obj_loc, opened_type))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__open_by_addr() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_open_by_addr() */ /*------------------------------------------------------------------------- - * Function: H5O__open_by_loc + * Function: H5O_open_by_loc * - * Purpose: Opens an object and returns an ID given its group loction. + * Purpose: Opens an object * - * Return: Success: Open object identifier - * Failure: Negative + * Return: Success: Pointer to object data + * Failure: NULL * * Programmer: James Laird * July 25 2006 * *------------------------------------------------------------------------- */ -hid_t -H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref) +void * +H5O_open_by_loc(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) { const H5O_obj_class_t *obj_class; /* Class of object for location */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(NULL) HDassert(obj_loc); /* Get the object class for this location */ if(NULL == (obj_class = H5O__obj_class(obj_loc->oloc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "unable to determine object class") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to determine object class") /* Call the object class's 'open' routine */ HDassert(obj_class->open); - if((ret_value = obj_class->open(obj_loc, app_ref)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + if(NULL == (ret_value = obj_class->open(obj_loc, opened_type))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__open_by_loc() */ - - -/*------------------------------------------------------------------------- - * Function: H5O__create_link - * - * Purpose: Internal routine to create a link from a group to an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__create_link(const H5G_loc_t *new_loc, const char *new_name, - H5G_loc_t *obj_loc, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(new_loc); - HDassert(new_name && *new_name); - HDassert(obj_loc); - - /* Link to the object */ - if(H5L_link(new_loc, new_name, obj_loc, lcpl_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__create_link() */ +} /* end H5O_open_by_loc() */ /*------------------------------------------------------------------------- @@ -964,11 +884,10 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/) #ifdef H5O_DEBUG if(H5DEBUG(O)) { - if(H5F_FILE_ID(loc->file)< 0 && 1 == H5F_NREFS(loc->file)) - HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n", - loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file)); - else - HDfprintf(H5DEBUG(O), "< %a\n", loc->addr); + if(FALSE == H5F_ID_EXISTS(loc->file) && 1 == H5F_NREFS(loc->file)) + HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n", loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file)); + else + HDfprintf(H5DEBUG(O), "< %a\n", loc->addr); } #endif @@ -991,14 +910,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__link_oh + * Function: H5O__link_oh * - * Purpose: Adjust the link count for an open object header by adding - * ADJUST to the link count. + * Purpose: Adjust the link count for an open object header by adding + * ADJUST to the link count. * - * Return: Success: New link count + * Return: Success: New link count * - * Failure: Negative + * Failure: -1 * * Programmer: Robb Matzke * matzke@llnl.gov @@ -1024,14 +943,14 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) if(adjust < 0) { /* Check for too large of an adjustment */ if((unsigned)(-adjust) > oh->nlink) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative") + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, (-1), "link count would be negative") /* Adjust the link count for the object header */ oh->nlink = (unsigned)((int)oh->nlink + adjust); /* Mark object header as dirty in cache */ if(H5AC_mark_entry_dirty(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") + HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, (-1), "unable to mark object header as dirty") /* Check if the object should be deleted */ if(oh->nlink == 0) { @@ -1039,7 +958,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) if(H5FO_opened(f, addr) != NULL) { /* Flag the object to be deleted when it's closed */ if(H5FO_mark(f, addr, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "can't mark object for deletion") } /* end if */ else { /* Mark the object header for deletion */ @@ -1054,7 +973,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) if(H5FO_marked(f, addr)) { /* Remove "delete me" flag on the object */ if(H5FO_mark(f, addr, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "can't mark object for deletion") } /* end if */ } /* end if */ @@ -1063,7 +982,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) /* Mark object header as dirty in cache */ if(H5AC_mark_entry_dirty(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") + HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, (-1), "unable to mark object header as dirty") } /* end if */ /* Check for operations on refcount message */ @@ -1073,7 +992,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) /* Check for removing refcount message */ if(oh->nlink <= 1) { if(H5O__msg_remove_real(f, oh, H5O_MSG_REFCOUNT, H5O_ALL, NULL, NULL, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete refcount message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "unable to delete refcount message") oh->has_refcount_msg = FALSE; } /* end if */ /* Update refcount message with new link count */ @@ -1081,7 +1000,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) H5O_refcount_t refcount = oh->nlink; if(H5O__msg_write_real(f, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update refcount message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, (-1), "unable to update refcount message") } /* end else */ } /* end if */ else { @@ -1090,7 +1009,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) H5O_refcount_t refcount = oh->nlink; if(H5O__msg_append_real(f, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to create new refcount message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, (-1), "unable to create new refcount message") oh->has_refcount_msg = TRUE; } /* end if */ } /* end else */ @@ -1154,41 +1073,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__link - * - * Purpose: Internal routine to change the refcount for an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__link(const H5O_loc_t *oloc, int adjust) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(oloc); - - /* Change the object's refcount */ - if(H5O_link(oloc, adjust) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__link() */ - - -/*------------------------------------------------------------------------- * Function: H5O_protect * * Purpose: Wrapper around H5AC_protect for use during a H5O_protect-> @@ -1326,7 +1210,7 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks) } /* end if */ #ifdef H5O_DEBUG -H5O_assert(oh); +H5O__assert(oh); #endif /* H5O_DEBUG */ /* Pin the other chunks also when requested, so that the object header @@ -1590,8 +1474,9 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) chk_dirtied = TRUE; } /* end if */ else { - /* XXX: For now, update access time & change fields in the object header */ - /* (will need to add some code to update modification time appropriately) */ + /* XXX: For now, update access time & change fields in the object header + * (will need to add some code to update modification time appropriately) + */ oh->atime = oh->ctime = now; /* Mark object header as dirty in cache */ @@ -1691,25 +1576,25 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags) H5O_bogus_t *bogus; /* Pointer to the bogus information */ /* Allocate the native message in memory */ - if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t)))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message") + if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t)))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message") /* Update the native value */ bogus->u = H5O_BOGUS_VALUE; - if(bogus_id == H5O_BOGUS_VALID_ID) - type = H5O_MSG_BOGUS_VALID; - else if(bogus_id == H5O_BOGUS_INVALID_ID) - type = H5O_MSG_BOGUS_INVALID; - else - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message") + if(bogus_id == H5O_BOGUS_VALID_ID) + type = H5O_MSG_BOGUS_VALID; + else if(bogus_id == H5O_BOGUS_INVALID_ID) + type = H5O_MSG_BOGUS_INVALID; + else + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message") /* Allocate space in the object header for bogus message */ - if(H5O__msg_alloc(f, oh, type, &mesg_flags, bogus, &idx) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message") + if(H5O__msg_alloc(f, oh, type, &mesg_flags, bogus, &idx) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message") /* Point to "bogus" information (take it over) */ - oh->mesg[idx].native = bogus; + oh->mesg[idx].native = bogus; /* Set the appropriate flags for the message */ oh->mesg[idx].flags = mesg_flags; @@ -1899,23 +1784,23 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type) /* Set type to "unknown" */ *obj_type = H5O_TYPE_UNKNOWN; - } /* end if */ + } else { /* Set object type */ *obj_type = obj_class->type; - } /* end else */ + } FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__obj_type_real() */ /*------------------------------------------------------------------------- - * Function: H5O__obj_class + * Function: H5O__obj_class * - * Purpose: Returns the class of object pointed to by `loc'. + * Purpose: Returns the class of object pointed to by 'loc'. * - * Return: Success: An object class - * Failure: NULL + * Return: Success: An object class + * Failure: NULL * * Programmer: Quincey Koziol * Monday, November 6, 2006 @@ -1928,7 +1813,7 @@ H5O__obj_class(const H5O_loc_t *loc) H5O_t *oh = NULL; /* Object header for location */ const H5O_obj_class_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_STATIC_TAG(loc->addr) + FUNC_ENTER_PACKAGE_TAG(loc->addr) /* Load the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) @@ -1940,7 +1825,7 @@ H5O__obj_class(const H5O_loc_t *loc) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O__obj_class() */ @@ -1979,7 +1864,7 @@ H5O__obj_class_real(const H5O_t *oh) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type") else if(isa) HGOTO_DONE(H5O_obj_class_g[i - 1]) - } /* end for */ + } if(0 == i) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type") @@ -2032,6 +1917,7 @@ H5O_get_loc(hid_t object_id) case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -2201,42 +2087,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__exists_by_name - * - * Purpose: Internal routine to check if an object exists - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -htri_t -H5O__exists_by_name(const H5G_loc_t *loc, const char *name) -{ - htri_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Check if the object exists */ - if((ret_value = H5G_loc_exists(loc, name)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__exists_by_name() */ - - -/*------------------------------------------------------------------------- * Function: H5O_get_hdr_info * * Purpose: Retrieve the object header information for an object @@ -2413,7 +2263,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields) /* Set the object's reference count */ oinfo->rc = oh->nlink; - } + } /* end if */ /* Get time information, if requested */ if(fields & H5O_INFO_TIME) { @@ -2465,7 +2315,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields) /* Retrieve # of attributes */ if(fields & H5O_INFO_NUM_ATTRS) - if(H5O_attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0) + if(H5O__attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count") /* Get B-tree & heap metadata storage size, if requested */ @@ -2492,52 +2342,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__get_info_by_name - * - * Purpose: Internal routine to retrieve an object's info - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Note: Add a parameter "fields" to indicate selection of object info. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo, unsigned fields) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - HDassert(oinfo); - - /* Retrieve the object's information */ - if(H5G_loc_info(loc, name, oinfo/*out*/, fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__get_info_by_name() */ - - -/*------------------------------------------------------------------------- * Function: H5O__get_info_by_idx * * Purpose: Internal routine to retrieve an object's info according to * an index within a group. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). * * Note: Add a parameter "fields" to indicate selection of object info. * @@ -2559,7 +2368,7 @@ H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id hbool_t loc_found = FALSE; /* Entry at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -2585,85 +2394,11 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__get_info_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5O__set_comment_by_name - * - * Purpose: Internal routine to set an object's "comment" - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__set_comment_by_name(const H5G_loc_t *loc, const char *name, - const char *comment) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* (Re)set the object's comment */ - if(H5G_loc_set_comment(loc, name, comment) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__set_comment_by_name() */ - - -/*------------------------------------------------------------------------- - * Function: H5O__get_comment_by_name - * - * Purpose: Internal routine to retrieve an object's "comment" - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -ssize_t -H5O__get_comment_by_name(const H5G_loc_t *loc, const char *name, - char *comment, size_t bufsize) -{ - ssize_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Retrieve the object's comment */ - if((ret_value = H5G_loc_get_comment(loc, name, comment/*out*/, bufsize)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__get_comment_by_name() */ - - -/*------------------------------------------------------------------------- * Function: H5O_get_create_plist * * Purpose: Retrieve the object creation properties for an object @@ -3053,7 +2788,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__visit + * Function: H5O__visit * * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects @@ -3074,12 +2809,12 @@ done: * Note: Add a parameter "fields" to indicate selection of object info. * * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. + * library, or the negative value returned by one + * of the operators. * * Programmer: Quincey Koziol * November 24 2007 @@ -3087,27 +2822,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, +H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields) { H5O_iter_visit_ud_t udata; /* User data for callback */ - H5G_loc_t loc; /* Location of reference object */ H5G_loc_t obj_loc; /* Location used to open object */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ H5O_info_t oinfo; /* Object info struct */ - hid_t obj_id = (-1); /* ID of object */ + void *obj = NULL; /* Object */ + H5I_type_t opened_type; /* ID type of object */ + hid_t obj_id = H5I_INVALID_HID; /* ID of object */ herr_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Portably initialize user data struct to zeros */ HDmemset(&udata, 0, sizeof(udata)); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HDassert(loc); /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -3115,7 +2850,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0) + if(H5G_loc_find(loc, obj_name, &obj_loc/*out*/) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; @@ -3125,9 +2860,13 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Open the object */ /* (Takes ownership of the obj_loc information) */ - if((obj_id = H5O__open_by_loc(&obj_loc, TRUE)) < 0) + if(NULL == (obj = H5O_open_by_loc(&obj_loc, &opened_type))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") + /* Get an ID for the visited object */ + if((obj_id = H5VL_wrap_register(opened_type, obj, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register visited object") + /* Make callback for starting object */ if((ret_value = op(obj_id, ".", &oinfo, op_data)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "can't visit objects") @@ -3139,6 +2878,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Check for object being a group */ if(oinfo.type == H5O_TYPE_GROUP) { H5G_loc_t start_loc; /* Location of starting group */ + H5G_loc_t vis_loc; /* Location of visited group */ /* Get the location of the starting group */ if(H5G_loc(obj_id, &start_loc) < 0) @@ -3171,24 +2911,30 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Add to list of visited objects */ if(H5SL_insert(udata.visited, obj_pos, obj_pos) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object node into visited list") - } /* end if */ + } + + /* Get the location of the visited group */ + if(H5G_loc(obj_id, &vis_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Call internal group visitation routine */ - if((ret_value = H5G_visit(obj_id, ".", idx_type, order, H5O__visit_cb, &udata)) < 0) + if((ret_value = H5G_visit(&vis_loc, ".", idx_type, order, H5O__visit_cb, &udata)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") } /* end if */ done: - if(obj_id > 0) { +/* XXX (VOL MERGE): Probably also want to consider closing obj here on failures */ + if(obj_id != H5I_INVALID_HID) { if(H5I_dec_app_ref(obj_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") - } /* end if */ + } else if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + if(udata.visited) H5SL_destroy(udata.visited, H5O__free_visit_visited, NULL); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__visit() */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 5f16837..2b65e0c 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -243,9 +243,15 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr)); /* Chunk dimensions */ - for(u = 0; u < mesg->u.chunk.ndims; u++) + for(u = 0; u < mesg->u.chunk.ndims; u++) { UINT32DECODE(p, mesg->u.chunk.dim[u]); + /* Just in case that something goes very wrong, such as file corruption. */ + if(mesg->u.chunk.dim[u] == 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "chunk dimension must be positive: mesg->u.chunk.dim[%u] = %u", + u, mesg->u.chunk.dim[u]) + } /* end for */ + /* Compute chunk size */ for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++) mesg->u.chunk.size *= mesg->u.chunk.dim[u]; diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index 4903d9f..9827b6a 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -44,13 +44,13 @@ static size_t H5O_linfo_size(const H5F_t *f, hbool_t disable_shared, const void static herr_t H5O__linfo_free(void *_mesg); static herr_t H5O__linfo_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); static void *H5O__linfo_copy_file(H5F_t *file_src, void *native_src, - H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, - H5O_copy_t *cpy_info, void *udata); + H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, + H5O_copy_t *cpy_info, void *udata); static herr_t H5O__linfo_post_copy_file(const H5O_loc_t *parent_src_oloc, - const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst, - unsigned *mesg_flags, H5O_copy_t *cpy_info); -static herr_t H5O__linfo_debug(H5F_t *f, const void *_mesg, - FILE * stream, int indent, int fwidth); + const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst, + unsigned *mesg_flags, H5O_copy_t *cpy_info); +static herr_t H5O__linfo_debug(H5F_t *f, const void *_mesg, FILE * stream, + int indent, int fwidth); /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_LINFO[1] = {{ diff --git a/src/H5Olink.c b/src/H5Olink.c index 6447936..55e1aee 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -612,6 +612,7 @@ herr_t H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) { H5O_link_t *lnk = (H5O_link_t *)_mesg; + hid_t file_id = -1; /* ID for the file the link is located in (passed to user callback) */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -645,25 +646,21 @@ H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) /* Check for delete callback */ if(link_class->del_func) { - hid_t file_id; /* ID for the file the link is located in (passed to user callback) */ - /* Get a file ID for the file the link is in */ - if((file_id = H5F_get_id(f, FALSE)) < 0) + if((file_id = H5F_get_id(f)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID") /* Call user-defined link's 'delete' callback */ - if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) { - H5I_dec_ref(file_id); + if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "link deletion callback returned failure") - } /* end if */ - - /* Release the file ID */ - if(H5I_dec_ref(file_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file") } /* end if */ } /* end if */ done: + /* Release the file ID */ + if(file_id > 0 && H5I_dec_ref(file_id) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_link_delete() */ diff --git a/src/H5Omessage.c b/src/H5Omessage.c index e156dcd..d6e3dce 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -127,11 +127,11 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Go append message to object header */ if(H5O_msg_append_oh(loc->file, oh, type_id, mesg_flags, update_flags, mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header") done: if(oh && H5O_unpin(oh) < 0) @@ -225,7 +225,7 @@ H5O__msg_append_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, if(H5O__copy_mesg(f, oh, idx, type, mesg, mesg_flags, update_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to write message") #ifdef H5O_DEBUG -H5O_assert(oh); +H5O__assert(oh); #endif /* H5O_DEBUG */ done: @@ -276,7 +276,7 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Call the "real" modify routine */ if(H5O__msg_write_real(loc->file, oh, type, mesg_flags, update_flags, mesg) < 0) @@ -384,7 +384,7 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, /* Check for modifying a constant message */ if(!(update_flags & H5O_UPDATE_FORCE) && (idx_msg->flags & H5O_MSG_FLAG_CONSTANT)) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message") /* This message is shared, but it's being modified. */ else if((idx_msg->flags & H5O_MSG_FLAG_SHARED) || (idx_msg->flags & H5O_MSG_FLAG_SHAREABLE)) { htri_t status; /* Status of "try share" call */ @@ -427,7 +427,7 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, if(H5O__copy_mesg(f, oh, idx, type, mesg, mesg_flags, update_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message") #ifdef H5O_DEBUG -H5O_assert(oh); +H5O__assert(oh); #endif /* H5O_DEBUG */ done: @@ -474,15 +474,15 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header") /* Call the "real" read routine */ if(NULL == (ret_value = H5O_msg_read_oh(loc->file, oh, type_id, mesg))) - HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header message") + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header message") done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_msg_read() */ @@ -616,12 +616,12 @@ H5O__msg_reset_real(const H5O_msg_class_t *type, void *native) HDassert(type); if(native) { - if(type->reset) { - if((type->reset)(native) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed") - } /* end if */ + if(type->reset) { + if((type->reset)(native) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed") + } /* end if */ else - HDmemset(native, 0, type->native_size); + HDmemset(native, 0, type->native_size); } /* end if */ done: @@ -658,7 +658,7 @@ H5O_msg_free(unsigned type_id, void *mesg) HDassert(type); /* Call the "real" free routine */ - ret_value = H5O__msg_free_real(type, mesg); + ret_value = H5O_msg_free_real(type, mesg); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_free() */ @@ -667,7 +667,7 @@ H5O_msg_free(unsigned type_id, void *mesg) /*------------------------------------------------------------------------- * Function: H5O__msg_free_mesg * - * Purpose: Call H5O__msg_free_real() on a message. + * Purpose: Call H5O_msg_free_real() on a message. * * Return: Non-negative on success/Negative on failure * @@ -685,14 +685,14 @@ H5O__msg_free_mesg(H5O_mesg_t *mesg) HDassert(mesg); /* Free any native information */ - mesg->native = H5O__msg_free_real(mesg->type, mesg->native); + mesg->native = H5O_msg_free_real(mesg->type, mesg->native); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__msg_free_mesg() */ /*------------------------------------------------------------------------- - * Function: H5O__msg_free_real + * Function: H5O_msg_free_real * * Purpose: Similar to H5O_msg_reset() except it also frees the message * pointer. @@ -706,9 +706,9 @@ H5O__msg_free_mesg(H5O_mesg_t *mesg) *------------------------------------------------------------------------- */ void * -H5O__msg_free_real(const H5O_msg_class_t *type, void *msg_native) +H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native) { - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_NOAPI_NOINIT_NOERR /* check args */ HDassert(type); @@ -722,7 +722,7 @@ H5O__msg_free_real(const H5O_msg_class_t *type, void *msg_native) } /* end if */ FUNC_LEAVE_NOAPI(NULL) -} /* end H5O__msg_free_real() */ +} /* end H5O_msg_free_real() */ /*------------------------------------------------------------------------- @@ -798,22 +798,22 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id) /* Load the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Count the messages of the correct type */ - msg_count = H5O_msg_count_real(oh, type); + msg_count = H5O__msg_count_real(oh, type); H5_CHECKED_ASSIGN(ret_value, int, msg_count, unsigned); done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_count() */ /*------------------------------------------------------------------------- - * Function: H5O_msg_count_real + * Function: H5O__msg_count_real * * Purpose: Counts the number of messages in an object header which are a * certain type. @@ -828,12 +828,12 @@ done: *------------------------------------------------------------------------- */ unsigned -H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) +H5O__msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) { unsigned u; /* Local index variable */ unsigned ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(oh); @@ -841,11 +841,11 @@ H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) /* Loop over all messages, counting the ones of the type looked for */ for(u = ret_value = 0; u < oh->nmesgs; u++) - if(oh->mesg[u].type == type) + if(oh->mesg[u].type == type) ret_value++; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_msg_count_real() */ +} /* end H5O__msg_count_real() */ /*------------------------------------------------------------------------- @@ -976,11 +976,11 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Call the "real" remove routine */ if((ret_value = H5O__msg_remove_real(loc->file, oh, type, sequence, NULL, NULL, adj_link)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message") done: if(oh && H5O_unpin(oh) < 0) @@ -1028,11 +1028,11 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence, /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Call the "real" remove routine */ if((ret_value = H5O__msg_remove_real(loc->file, oh, type, sequence, op, op_data, adj_link)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message") done: if(oh && H5O_unpin(oh) < 0) @@ -1090,7 +1090,7 @@ H5O__msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, * (OK to remove constant messages - QAK) */ /* Convert message into a null message */ - if(H5O_release_mesg(udata->f, oh, mesg, udata->adj_link) < 0) + if(H5O__release_mesg(udata->f, oh, mesg, udata->adj_link) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release message") /* Indicate that the object header was modified */ @@ -1315,8 +1315,8 @@ done: * message removal) */ if(oh_modified & H5O_MODIFY_CONDENSE) - if(H5O_condense_header(f, oh) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header") + if(H5O__condense_header(f, oh) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header") /* Mark object header as changed */ if(H5O_touch_oh(f, oh, FALSE) < 0) @@ -1973,7 +1973,7 @@ H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, /* Protect chunk */ if(NULL == (chk_proxy = H5O__chunk_protect(f, oh, idx_msg->chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") /* Reset existing native information for the header's message */ H5O__msg_reset_real(type, idx_msg->native); @@ -1991,7 +1991,7 @@ H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, /* Release chunk */ if(H5O__chunk_unprotect(f, chk_proxy, chk_dirtied) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") chk_proxy = NULL; /* Update the modification time, if requested */ @@ -2197,7 +2197,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_flush_msgs + * Function: H5O__flush_msgs * * Purpose: Flushes messages for object header. * @@ -2210,13 +2210,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_flush_msgs(H5F_t *f, H5O_t *oh) +H5O__flush_msgs(H5F_t *f, H5O_t *oh) { H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(f); @@ -2240,7 +2240,7 @@ H5O_flush_msgs(H5F_t *f, H5O_t *oh) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_flush_msgs() */ +} /* end H5O__flush_msgs() */ /*------------------------------------------------------------------------- diff --git a/src/H5Omtime.c b/src/H5Omtime.c index db1d8d7..172f9ab 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -442,8 +442,6 @@ H5O__mtime_free(void *mesg) * matzke@llnl.gov * Jul 24 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -454,7 +452,7 @@ H5O__mtime_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, struct tm *tm; char buf[128]; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 616f96b..dbc8089 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -63,7 +63,7 @@ ) #define H5O_ALIGN_OH(O, X) \ H5O_ALIGN_VERS((O)->version, X) -#define H5O_ALIGN_F(F, X) \ +#define H5O_ALIGN_F(F, X) \ H5O_ALIGN_VERS(MAX(H5O_VERSION_1, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), X) /* Size of checksum (on disk) */ @@ -339,7 +339,7 @@ typedef struct H5O_obj_class_t { void *(*get_copy_file_udata)(void); /*retrieve user data for 'copy file' operation */ void (*free_copy_file_udata)(void *); /*free user data for 'copy file' operation */ htri_t (*isa)(const H5O_t *); /*if a header matches an object class */ - hid_t (*open)(const H5G_loc_t *, hbool_t ); /*open an object of this class */ + void *(*open)(const H5G_loc_t *, H5I_type_t *); /*open an object of this class */ void *(*create)(H5F_t *, void *, H5G_loc_t *); /*create an object of this class */ H5O_loc_t *(*get_oloc)(hid_t ); /*get the object header location for an object */ herr_t (*bh_info)(const H5O_loc_t *loc, H5O_t *oh, H5_ih_info_t *bh_info); /*get the index & heap info for an object */ @@ -414,7 +414,6 @@ typedef struct H5O_chk_cache_ud_t { H5O_common_cache_ud_t common; /* Common object header cache callback info */ } H5O_chk_cache_ud_t; - /* Header message ID to class mapping */ H5_DLLVAR const H5O_msg_class_t *const H5O_msg_class_g[H5O_MSG_TYPES]; @@ -555,26 +554,11 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1]; H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1]; /* Package-local function prototypes */ -H5_DLL hid_t H5O__open_name(const H5G_loc_t *loc, const char *name); -H5_DLL hid_t H5O__open_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n); -H5_DLL hid_t H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr); -H5_DLL hid_t H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref); -H5_DLL herr_t H5O__create_link(const H5G_loc_t *new_loc, const char *new_name, - H5G_loc_t *obj_loc, hid_t lcpl_id); H5_DLL const H5O_obj_class_t *H5O__obj_class(const H5O_loc_t *loc); H5_DLL int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted); -H5_DLL herr_t H5O__link(const H5O_loc_t *loc, int adjust); -H5_DLL htri_t H5O__exists_by_name(const H5G_loc_t *loc, const char *name); -H5_DLL herr_t H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, - H5O_info_t *oinfo, unsigned fields); H5_DLL herr_t H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields); -H5_DLL herr_t H5O__set_comment_by_name(const H5G_loc_t *loc, const char *name, - const char *comment); -H5_DLL ssize_t H5O__get_comment_by_name(const H5G_loc_t *loc, const char *name, - char *comment, size_t bufsize); -H5_DLL herr_t H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, +H5_DLL herr_t H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields); H5_DLL herr_t H5O__inc_rc(H5O_t *oh); H5_DLL herr_t H5O__dec_rc(H5O_t *oh); @@ -587,9 +571,8 @@ H5_DLL herr_t H5O__msg_append_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *t unsigned mesg_flags, unsigned update_flags, void *mesg); H5_DLL herr_t H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, unsigned mesg_flags, unsigned update_flags, void *mesg); -H5_DLL void *H5O__msg_free_real(const H5O_msg_class_t *type, void *mesg); H5_DLL herr_t H5O__msg_free_mesg(H5O_mesg_t *mesg); -H5_DLL unsigned H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type); +H5_DLL unsigned H5O__msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type); H5_DLL herr_t H5O__msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, int sequence, H5O_operator_t op, void *op_data, hbool_t adj_link); H5_DLL void *H5O__msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, @@ -597,17 +580,15 @@ H5_DLL void *H5O__msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata); H5_DLL herr_t H5O__msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, const H5O_mesg_operator_t *op, void *op_data); -H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg); -H5_DLL herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh); +H5_DLL herr_t H5O__flush_msgs(H5F_t *f, H5O_t *oh); H5_DLL herr_t H5O__delete_mesg(H5F_t *f, H5O_t *open_oh, H5O_mesg_t *mesg); /* Object header chunk routines */ H5_DLL herr_t H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno); H5_DLL H5O_chunk_proxy_t *H5O__chunk_protect(H5F_t *f, H5O_t *oh, unsigned idx); -H5_DLL herr_t H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, - hbool_t chk_dirtied); +H5_DLL herr_t H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_t chk_dirtied); H5_DLL herr_t H5O__chunk_update_idx(H5F_t *f, H5O_t *oh, unsigned idx); -H5_DLL herr_t H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy); +H5_DLL herr_t H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy); H5_DLL herr_t H5O__chunk_delete(H5F_t *f, H5O_t *oh, unsigned idx); H5_DLL herr_t H5O__chunk_dest(H5O_chunk_proxy_t *chunk_proxy); @@ -615,20 +596,20 @@ H5_DLL herr_t H5O__chunk_dest(H5O_chunk_proxy_t *chunk_proxy); H5_DLL herr_t H5O__attr_bh_info(H5F_t *f, H5O_t *oh, H5_ih_info_t *bh_info); /* Object header allocation routines */ -H5_DLL herr_t H5O_alloc_msgs(H5O_t *oh, size_t min_alloc); +H5_DLL herr_t H5O__alloc_msgs(H5O_t *oh, size_t min_alloc); H5_DLL herr_t H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_msg_alloc_info_t *found_msg, size_t *new_idx); H5_DLL herr_t H5O__alloc(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, const void *mesg, size_t *mesg_idx); -H5_DLL herr_t H5O_condense_header(H5F_t *f, H5O_t *oh); -H5_DLL herr_t H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, +H5_DLL herr_t H5O__condense_header(H5F_t *f, H5O_t *oh); +H5_DLL herr_t H5O__release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link); /* Shared object operators */ -H5_DLL void * H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, +H5_DLL void * H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf, const H5O_msg_class_t *type); -H5_DLL herr_t H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg); -H5_DLL size_t H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg); +H5_DLL herr_t H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg); +H5_DLL size_t H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg); H5_DLL herr_t H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *mesg_type, H5O_shared_t *sh_mesg); H5_DLL herr_t H5O__shared_link(H5F_t *f, H5O_t *open_oh, @@ -640,17 +621,18 @@ H5_DLL herr_t H5O__shared_copy_file(H5F_t *file_src, H5F_t *file_dst, H5_DLL herr_t H5O__shared_post_copy_file (H5F_t *f, const H5O_msg_class_t *mesg_type, const H5O_shared_t *shared_src, H5O_shared_t *shared_dst, unsigned *mesg_flags, H5O_copy_t *cpy_info); -H5_DLL herr_t H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, +H5_DLL herr_t H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth); /* Attribute message operators */ H5_DLL herr_t H5O__attr_reset(void *_mesg); H5_DLL herr_t H5O__attr_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); H5_DLL herr_t H5O__attr_link(H5F_t *f, H5O_t *open_oh, void *_mesg); -H5_DLL herr_t H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs); +H5_DLL herr_t H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs); /* Arrays of versions for: - Object header, Attribute/Fill value/Filter pipeline messages */ + * Object header, Attribute/Fill value/Filter pipeline messages + */ /* Layout/Datatype/Dataspace arrays of versions are in H5Dpkg.h, H5Tpkg.h and H5Spkg.h */ H5_DLLVAR const unsigned H5O_obj_ver_bounds[H5F_LIBVER_NBOUNDS]; H5_DLLVAR const unsigned H5O_attr_ver_bounds[H5F_LIBVER_NBOUNDS]; @@ -659,24 +641,22 @@ H5_DLLVAR const unsigned H5O_pline_ver_bounds[H5F_LIBVER_NBOUNDS]; /* Testing functions */ #ifdef H5O_TESTING -H5_DLL htri_t H5O_is_attr_empty_test(hid_t oid); -H5_DLL htri_t H5O_is_attr_dense_test(hid_t oid); -H5_DLL herr_t H5O_num_attrs_test(hid_t oid, hsize_t *nattrs); -H5_DLL herr_t H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count); -H5_DLL herr_t H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val); -H5_DLL herr_t H5O_expunge_chunks_test(const H5O_loc_t *oloc); -H5_DLL herr_t H5O_get_rc(const H5O_loc_t *oloc, unsigned *rc); -H5_DLL herr_t H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, - unsigned *chunk_num); -H5_DLL herr_t H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type); +H5_DLL htri_t H5O__is_attr_empty_test(hid_t oid); +H5_DLL htri_t H5O__is_attr_dense_test(hid_t oid); +H5_DLL herr_t H5O__num_attrs_test(hid_t oid, hsize_t *nattrs); +H5_DLL herr_t H5O__attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count); +H5_DLL herr_t H5O__check_msg_marked_test(hid_t oid, hbool_t flag_val); +H5_DLL herr_t H5O__expunge_chunks_test(const H5O_loc_t *oloc); +H5_DLL herr_t H5O__get_rc_test(const H5O_loc_t *oloc, unsigned *rc); +H5_DLL herr_t H5O__msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num); +H5_DLL herr_t H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type); #endif /* H5O_TESTING */ /* Object header debugging routines */ #ifdef H5O_DEBUG -H5_DLL herr_t H5O_assert(const H5O_t *oh); +H5_DLL herr_t H5O__assert(const H5O_t *oh); #endif /* H5O_DEBUG */ -H5_DLL herr_t H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, - int indent, int fwidth); +H5_DLL herr_t H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth); #endif /* _H5Opkg_H */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index f8154c4..db19503 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -43,6 +43,7 @@ typedef struct H5O_fill_t H5O_fill_t; #include "H5HGprivate.h" /* Global Heaps */ #include "H5SLprivate.h" /* Skip lists */ #include "H5Tprivate.h" /* Datatype functions */ +#include "H5VLprivate.h" #include "H5Zprivate.h" /* I/O pipeline filters */ /* Forward references of package typedefs */ @@ -856,6 +857,12 @@ typedef struct { } u; } H5O_mesg_operator_t; +/* Types for object optional VOL operations */ +typedef enum H5VL_object_optional_t { + H5VL_OBJECT_GET_COMMENT, /* get object comment */ + H5VL_OBJECT_GET_INFO, /* get object info */ + H5VL_OBJECT_SET_COMMENT /* set object comment */ +} H5VL_object_optional_t; /* Typedef for abstract object creation */ typedef struct { @@ -875,10 +882,13 @@ H5_DLL H5O_t *H5O__create_ohdr(H5F_t *f, hid_t ocpl_id); H5_DLL herr_t H5O__apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t initial_rc, H5O_loc_t *loc_out); H5_DLL herr_t H5O_open(H5O_loc_t *loc); +H5_DLL void *H5O_open_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5I_type_t *opened_type/*out*/); +H5_DLL void *H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type/*out*/); +H5_DLL void *H5O_open_by_loc(const H5G_loc_t *obj_loc, H5I_type_t *opened_type/*out*/); H5_DLL herr_t H5O_close(H5O_loc_t *loc, hbool_t *file_closed/*out*/); H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust); -H5_DLL H5O_t *H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, - hbool_t pin_all_chunks); +H5_DLL H5O_t *H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks); H5_DLL H5O_t *H5O_pin(const H5O_loc_t *loc); H5_DLL herr_t H5O_unpin(H5O_t *oh); H5_DLL herr_t H5O_dec_rc_by_loc(const H5O_loc_t *loc); @@ -893,7 +903,7 @@ H5_DLL herr_t H5O_get_hdr_info(const H5O_loc_t *oloc, H5O_hdr_info_t *hdr); H5_DLL herr_t H5O_get_info(const H5O_loc_t *oloc, H5O_info_t *oinfo, unsigned fields); H5_DLL herr_t H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type); H5_DLL herr_t H5O_get_create_plist(const H5O_loc_t *loc, struct H5P_genplist_t *oc_plist); -H5_DLL hid_t H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref); +H5_DLL void *H5O_open_name(const H5G_loc_t *loc, const char *name, H5I_type_t *opened_type/*out*/); H5_DLL herr_t H5O_get_nlinks(const H5O_loc_t *loc, hsize_t *nlinks); H5_DLL void *H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_loc_t *obj_loc); H5_DLL haddr_t H5O_get_oh_addr(const H5O_t *oh); @@ -912,10 +922,12 @@ H5_DLL herr_t H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, unsigned update_flags, void *mesg); H5_DLL herr_t H5O_msg_write_oh(H5F_t *f, H5O_t *oh, unsigned type_id, unsigned mesg_flags, unsigned update_flags, void *mesg); +H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg); H5_DLL void *H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg); H5_DLL void *H5O_msg_read_oh(H5F_t *f, H5O_t *oh, unsigned type_id, void *mesg); H5_DLL herr_t H5O_msg_reset(unsigned type_id, void *native); H5_DLL void *H5O_msg_free(unsigned type_id, void *mesg); +H5_DLL void *H5O_msg_free_real(const H5O_msg_class_t *type, void *mesg); H5_DLL void *H5O_msg_copy(unsigned type_id, const void *mesg, void *dst); H5_DLL int H5O_msg_count(const H5O_loc_t *loc, unsigned type_id); H5_DLL htri_t H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id); @@ -949,9 +961,10 @@ H5_DLL herr_t H5O_msg_delete(H5F_t *f, H5O_t *open_oh, unsigned type_id, H5_DLL herr_t H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, uint8_t *flags); /* Object metadata flush/refresh routines */ +H5_DLL herr_t H5O_flush(H5O_loc_t *oloc, hid_t obj_id); H5_DLL herr_t H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id); H5_DLL herr_t H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc); -H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr); +H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, hbool_t start_swmr); /* Object copying routines */ H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, @@ -960,6 +973,8 @@ H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst H5_DLL herr_t H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref, H5F_t *file_dst, void *_dst_ref, size_t ref_count, H5R_type_t ref_type, H5O_copy_t *cpy_info); +H5_DLL herr_t H5O_copy(const H5G_loc_t *src_loc, const char *src_name, + H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id); /* Debugging routines */ H5_DLL herr_t H5O_debug_id(unsigned type_id, H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidth); diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 328ba4b..4fc0488 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -69,6 +69,10 @@ /********************/ /* Local Prototypes */ /********************/ +static void *H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, + const H5O_shared_t *shared, const H5O_msg_class_t *type); +static herr_t H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh, + const H5O_msg_class_t *type, H5O_shared_t *shared, int adjust); /*********************/ @@ -88,14 +92,14 @@ /*------------------------------------------------------------------------- - * Function: H5O_shared_read + * Function: H5O__shared_read * - * Purpose: Reads a message referred to by a shared message. + * Purpose: Reads a message referred to by a shared message. * - * Return: Success: Ptr to message in native format. The message - * should be freed by calling H5O_msg_reset(). + * Return: Success: Ptr to message in native format. The message + * should be freed by calling H5O_msg_reset(). * - * Failure: NULL + * Failure: NULL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -104,7 +108,7 @@ *------------------------------------------------------------------------- */ static void * -H5O_shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, +H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const H5O_shared_t *shared, const H5O_msg_class_t *type) { H5HF_t *fheap = NULL; @@ -112,7 +116,7 @@ H5O_shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, uint8_t mesg_buf[H5O_MESG_BUF_SIZE]; /* Buffer for deserializing messages */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -194,13 +198,13 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, NULL, "can't close wrapped buffer") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_shared_read() */ +} /* end H5O__shared_read() */ /*------------------------------------------------------------------------- - * Function: H5O__shared_link_adj + * Function: H5O__shared_link_adj * - * Purpose: Changes the link count for the object referenced by a shared + * Purpose: Changes the link count for the object referenced by a shared * message. * * This function changes the object header link count and is @@ -209,8 +213,7 @@ done: * reference count is stored in the file-wide shared message * index and is changed in a different place in the code. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -294,11 +297,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_shared_decode + * Function: H5O__shared_decode * - * Purpose: Decodes a shared object message + * Purpose: Decodes a shared object message * - * Return: Non-negative on success/Negative on failure + * Return: Success: A buffer containing the decoded shared object + * Failure: NULL * * Programmer: Quincey Koziol * Monday, January 22, 2007 @@ -306,14 +310,14 @@ done: *------------------------------------------------------------------------- */ void * -H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf, +H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf, const H5O_msg_class_t *type) { H5O_shared_t sh_mesg; /* Shared message info */ unsigned version; /* Shared message version */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check args */ HDassert(f); @@ -373,20 +377,20 @@ H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *bu sh_mesg.msg_type_id = type->id; /* Retrieve actual message, through decoded shared message info */ - if(NULL == (ret_value = H5O_shared_read(f, open_oh, ioflags, &sh_mesg, type))) + if(NULL == (ret_value = H5O__shared_read(f, open_oh, ioflags, &sh_mesg, type))) HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to retrieve native message") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_shared_decode() */ +} /* end H5O__shared_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_shared_encode + * Function: H5O__shared_encode * - * Purpose: Encodes message _MESG into buffer BUF. + * Purpose: Encodes message _MESG into buffer BUF. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Thursday, April 2, 1998 @@ -394,11 +398,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg) +H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg) { unsigned version; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(f); @@ -427,15 +431,15 @@ H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_me H5F_addr_encode(f, &buf, sh_mesg->u.loc.oh_addr); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_shared_encode() */ +} /* end H5O__shared_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_set_shared + * Function: H5O_set_shared * - * Purpose: Sets the shared component for a message. + * Purpose: Sets the shared component for a message. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -460,12 +464,12 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src) /*------------------------------------------------------------------------- - * Function: H5O_shared_size + * Function: H5O__shared_size * - * Purpose: Returns the length of a shared object message. + * Purpose: Returns the length of a shared object message. * - * Return: Success: Length - * Failure: 0 + * Return: Success: Length + * Failure: 0 * * Programmer: Robb Matzke * Thursday, April 2, 1998 @@ -473,26 +477,26 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src) *------------------------------------------------------------------------- */ size_t -H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg) +H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg) { size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR if(sh_mesg->type == H5O_SHARE_TYPE_COMMITTED) { - ret_value = (size_t)1 + /*version */ - (size_t)1 + /*the type field */ - (size_t)H5F_SIZEOF_ADDR(f); /*sharing by another obj hdr */ + ret_value = (size_t)1 + /* Version */ + (size_t)1 + /* Type field */ + (size_t)H5F_SIZEOF_ADDR(f); /* Sharing by another obj hdr */ } /* end if */ else { HDassert(sh_mesg->type == H5O_SHARE_TYPE_SOHM); - ret_value = 1 + /*version */ - 1 + /*the type field */ - H5O_FHEAP_ID_LEN; /* Shared in the heap */ + ret_value = 1 + /* Version */ + 1 + /* Type field */ + H5O_FHEAP_ID_LEN; /* Shared in the heap */ } /* end else */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_shared_size() */ +} /* end H5O__shared_size() */ /*------------------------------------------------------------------------- @@ -500,7 +504,7 @@ H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg) * * Purpose: Free file space referenced by message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, September 26, 2003 @@ -521,7 +525,7 @@ H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, /* * Committed datatypes increment the OH of the original message when they - * are written (in H5O__shared_link) and decrement it here. + * are written (in H5O_shared_link) and decrement it here. * SOHMs in the heap behave differently; their refcount is incremented * during H5SM_share when they are going to be written (in H5O_msg_append * or H5O_msg_write). Their refcount in the SOHM indexes still needs to @@ -543,7 +547,7 @@ done: * Purpose: Increment reference count on any objects referenced by * message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, September 26, 2003 @@ -558,7 +562,7 @@ H5O__shared_link(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, FUNC_ENTER_PACKAGE - /* check args */ + /* Check args */ HDassert(f); HDassert(sh_mesg); @@ -576,8 +580,7 @@ done: * * Purpose: Copies a message from _MESG to _DEST in file * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * January 22, 2007 @@ -647,7 +650,7 @@ done: * to complish that is to delete the old message and write the * new message with the correct values. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Peter Cao * xcao@hdfgroup.org @@ -696,7 +699,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_shared_debug + * Function: H5O__shared_debug * * Purpose: Prints debugging info for the message * @@ -708,9 +711,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth) +H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(mesg); @@ -756,5 +759,5 @@ H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth) } /* end switch */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_shared_debug() */ +} /* end H5O__shared_debug() */ diff --git a/src/H5Oshared.h b/src/H5Oshared.h index 2960fef..8040a6a 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -66,7 +66,7 @@ H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, /* Check for shared message */ if(mesg_flags & H5O_MSG_FLAG_SHARED) { /* Retrieve native message info indirectly through shared message */ - if(NULL == (ret_value = H5O_shared_decode(f, open_oh, ioflags, p, H5O_SHARED_TYPE))) + if(NULL == (ret_value = H5O__shared_decode(f, open_oh, ioflags, p, H5O_SHARED_TYPE))) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message") /* We currently do not support automatically fixing shared messages */ @@ -129,13 +129,13 @@ H5O_SHARED_ENCODE(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mes /* Check for message stored elsewhere */ if(H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) { /* Encode shared message into buffer */ - if(H5O_shared_encode(f, p, sh_mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message") + if(H5O__shared_encode(f, p, sh_mesg) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message") } /* end if */ else { /* Encode native message directly */ if(H5O_SHARED_ENCODE_REAL(f, p, _mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode native message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode native message") } /* end else */ done: @@ -181,13 +181,13 @@ H5O_SHARED_SIZE(const H5F_t *f, hbool_t disable_shared, const void *_mesg) /* Check for message stored elsewhere */ if(H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) { /* Retrieve encoded size of shared message */ - if(0 == (ret_value = H5O_shared_size(f, sh_mesg))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message") + if(0 == (ret_value = H5O__shared_size(f, sh_mesg))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message") } /* end if */ else { /* Retrieve size of native message directly */ if(0 == (ret_value = H5O_SHARED_SIZE_REAL(f, _mesg))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of native message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of native message") } /* end else */ done: @@ -232,13 +232,13 @@ H5O_SHARED_DELETE(H5F_t *f, H5O_t *open_oh, void *_mesg) if(H5O_IS_TRACKED_SHARED(sh_mesg->type)) { /* Decrement the reference count on the shared message/object */ if(H5O__shared_delete(f, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message") } /* end if */ #ifdef H5O_SHARED_DELETE_REAL else { /* Decrement the reference count on the native message directly */ if(H5O_SHARED_DELETE_REAL(f, open_oh, _mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for native message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for native message") } /* end else */ #endif /* H5O_SHARED_DELETE_REAL */ @@ -284,13 +284,13 @@ H5O_SHARED_LINK(H5F_t *f, H5O_t *open_oh, void *_mesg) if(H5O_IS_TRACKED_SHARED(sh_mesg->type)) { /* Increment the reference count on the shared message/object */ if(H5O__shared_link(f, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for shared message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for shared message") } /* end if */ #ifdef H5O_SHARED_LINK_REAL else { /* Increment the reference count on the native message directly */ if(H5O_SHARED_LINK_REAL(f, open_oh, _mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for native message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for native message") } /* end else */ #endif /* H5O_SHARED_LINK_REAL */ @@ -473,7 +473,7 @@ H5O_SHARED_DEBUG(H5F_t *f, const void *_mesg, FILE *stream, int indent, /* Check for message stored elsewhere */ if(H5O_IS_STORED_SHARED(sh_mesg->type)) { /* Print shared message information */ - if(H5O_shared_debug(sh_mesg, stream, indent, fwidth) < 0) + if(H5O__shared_debug(sh_mesg, stream, indent, fwidth) < 0) HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display shared message info") } /* end if */ diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 87fb771..0f14a4b 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -37,9 +37,9 @@ /* PRIVATE PROTOTYPES */ static void *H5O__stab_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_stab_copy(const void *_mesg, void *_dest); -static size_t H5O_stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__stab_copy(const void *_mesg, void *_dest); +static size_t H5O__stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__stab_free(void *_mesg); static herr_t H5O__stab_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); static void *H5O__stab_copy_file(H5F_t *file_src, void *native_src, @@ -58,9 +58,9 @@ const H5O_msg_class_t H5O_MSG_STAB[1] = {{ sizeof(H5O_stab_t), /*native message size */ 0, /* messages are sharable? */ H5O__stab_decode, /*decode message */ - H5O_stab_encode, /*encode message */ - H5O_stab_copy, /*copy the native value */ - H5O_stab_size, /*size of symbol table entry */ + H5O__stab_encode, /*encode message */ + H5O__stab_copy, /*copy the native value */ + H5O__stab_size, /*size of symbol table entry */ NULL, /*default reset method */ H5O__stab_free, /* free method */ H5O__stab_delete, /* file delete method */ @@ -111,7 +111,7 @@ H5O__stab_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, /* decode */ if(NULL == (stab = H5FL_CALLOC(H5O_stab_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") H5F_addr_decode(f, &p, &(stab->btree_addr)); H5F_addr_decode(f, &p, &(stab->heap_addr)); @@ -129,7 +129,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_stab_encode + * Function: H5O__stab_encode * * Purpose: Encodes a symbol table message. * @@ -142,11 +142,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_stab_t *stab = (const H5O_stab_t *) _mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -158,11 +158,11 @@ H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con H5F_addr_encode(f, &p, stab->heap_addr); FUNC_LEAVE_NOAPI(SUCCEED) -} +} /* end H5O__stab_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_stab_copy + * Function: H5O__stab_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -178,18 +178,18 @@ H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con *------------------------------------------------------------------------- */ static void * -H5O_stab_copy(const void *_mesg, void *_dest) +H5O__stab_copy(const void *_mesg, void *_dest) { const H5O_stab_t *stab = (const H5O_stab_t *) _mesg; H5O_stab_t *dest = (H5O_stab_t *) _dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(stab); if(!dest && NULL == (dest = H5FL_MALLOC(H5O_stab_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* copy */ *dest = *stab; @@ -199,11 +199,11 @@ H5O_stab_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_stab_copy() */ +} /* end H5O__stab_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_stab_size + * Function: H5O__stab_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -220,17 +220,17 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) +H5O__stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ ret_value = (size_t)(2 * H5F_SIZEOF_ADDR(f)); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_stab_size() */ +} /* end H5O__stab_size() */ /*------------------------------------------------------------------------- @@ -327,14 +327,14 @@ H5O__stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, /* Get the old local heap's size and use that as the hint for the new heap */ if(H5HL_get_size(file_src, stab_src->heap_addr, &size_hint) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, NULL, "can't query local heap size") + HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, NULL, "can't query local heap size") /* Set copy metadata tag */ H5_BEGIN_TAG(H5AC__COPIED_TAG); /* Create components of symbol table message */ if(H5G__stab_create_components(file_dst, stab_dst, size_hint) < 0) - HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components") + HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components") /* Reset metadata tag */ H5_END_TAG diff --git a/src/H5Otest.c b/src/H5Otest.c index 32b31f2..df08ff7 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -75,11 +75,11 @@ /*-------------------------------------------------------------------------- NAME - H5O_is_attr_dense_test + H5O__is_attr_dense_test PURPOSE Determine whether attributes for an object are stored "densely" USAGE - htri_t H5O_is_attr_dense_test(oid) + htri_t H5O__is_attr_dense_test(oid) hid_t oid; IN: object to check RETURNS Non-negative TRUE/FALSE on success, negative on failure @@ -93,7 +93,7 @@ REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5O_is_attr_dense_test(hid_t oid) +H5O__is_attr_dense_test(hid_t oid) { H5O_t *oh = NULL; /* Object header */ H5O_ainfo_t ainfo; /* Attribute information for object */ @@ -101,7 +101,7 @@ H5O_is_attr_dense_test(hid_t oid) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -114,7 +114,7 @@ H5O_is_attr_dense_test(hid_t oid) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -127,7 +127,7 @@ H5O_is_attr_dense_test(hid_t oid) /* Check if dense storage is being used */ if(H5F_addr_defined(ainfo.fheap_addr)) { /* Check for any messages in object header */ - HDassert(H5O_msg_count_real(oh, H5O_MSG_ATTR) == 0); + HDassert(H5O__msg_count_real(oh, H5O_MSG_ATTR) == 0); ret_value = TRUE; } /* end if */ @@ -136,21 +136,21 @@ H5O_is_attr_dense_test(hid_t oid) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(api_ctx_pushed && H5CX_pop() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_is_attr_dense_test() */ +} /* H5O__is_attr_dense_test() */ /*-------------------------------------------------------------------------- NAME - H5O_is_attr_empty_test + H5O__is_attr_empty_test PURPOSE Determine whether there are any attributes for an object USAGE - htri_t H5O_is_attr_empty_test(oid) + htri_t H5O__is_attr_empty_test(oid) hid_t oid; IN: object to check RETURNS Non-negative TRUE/FALSE on success, negative on failure @@ -163,7 +163,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5O_is_attr_empty_test(hid_t oid) +H5O__is_attr_empty_test(hid_t oid) { H5O_t *oh = NULL; /* Object header */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ @@ -174,7 +174,7 @@ H5O_is_attr_empty_test(hid_t oid) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -187,7 +187,7 @@ H5O_is_attr_empty_test(hid_t oid) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ if(oh->version > H5O_VERSION_1) { @@ -197,7 +197,7 @@ H5O_is_attr_empty_test(hid_t oid) } /* end if */ /* Retrieve the number of attribute messages in header */ - nattrs = H5O_msg_count_real(oh, H5O_MSG_ATTR); + nattrs = H5O__msg_count_real(oh, H5O_MSG_ATTR); /* Check for later version of object header format & attribute info available */ if(oh->version > H5O_VERSION_1) { @@ -237,21 +237,21 @@ done: if(bt2_name && H5B2_close(bt2_name) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(api_ctx_pushed && H5CX_pop() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_is_attr_empty_test() */ +} /* H5O__is_attr_empty_test() */ /*-------------------------------------------------------------------------- NAME - H5O_num_attrs_test + H5O__num_attrs_test PURPOSE Determine whether there are any attributes for an object USAGE - herr_t H5O_num_attrs_test(oid, nattrs) + herr_t H5O__num_attrs_test(oid, nattrs) hid_t oid; IN: object to check hsize_t *nattrs; OUT: Number of attributes on object RETURNS @@ -265,7 +265,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) +H5O__num_attrs_test(hid_t oid, hsize_t *nattrs) { H5O_t *oh = NULL; /* Object header */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ @@ -275,7 +275,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -288,7 +288,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -299,7 +299,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) } /* end if */ /* Retrieve the number of attribute messages in header */ - obj_nattrs = H5O_msg_count_real(oh, H5O_MSG_ATTR); + obj_nattrs = H5O__msg_count_real(oh, H5O_MSG_ATTR); /* Check for later version of object header format */ if(oh->version > H5O_VERSION_1) { @@ -335,21 +335,21 @@ done: if(bt2_name && H5B2_close(bt2_name) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(api_ctx_pushed && H5CX_pop() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_num_attrs_test() */ +} /* H5O__num_attrs_test() */ /*-------------------------------------------------------------------------- NAME - H5O_attr_dense_info_test + H5O__attr_dense_info_test PURPOSE Retrieve information about the state of the "dense" storage for attributes USAGE - herr_t H5O_attr_dense_info_test(oid, name_count, corder_count) + herr_t H5O__attr_dense_info_test(oid, name_count, corder_count) hid_t oid; IN: Object to check hsize_t *name_count; OUT: Number of attributes in name index hsize_t *corder_count; OUT: Number of attributes in creation order index @@ -365,7 +365,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) +H5O__attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) { H5O_t *oh = NULL; /* Object header */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ @@ -375,7 +375,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -391,7 +391,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -438,22 +438,22 @@ done: if(bt2_corder && H5B2_close(bt2_corder) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(api_ctx_pushed && H5CX_pop() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_attr_dense_info_test() */ +} /* H5O__attr_dense_info_test() */ /*-------------------------------------------------------------------------- NAME - H5O_check_msg_marked_test + H5O__check_msg_marked_test PURPOSE Check if an unknown message with the "mark if unknown" flag actually gets marked. USAGE - herr_t H5O_check_msg_marked_test(oid, flag_val) + herr_t H5O__check_msg_marked_test(oid, flag_val) hid_t oid; IN: Object to check hbool_t flag_val; IN: Desired flag value RETURNS @@ -468,7 +468,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) +H5O__check_msg_marked_test(hid_t oid, hbool_t flag_val) { H5O_t *oh = NULL; /* Object header */ H5O_loc_t *loc; /* Pointer to object's location */ @@ -476,7 +476,7 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) unsigned idx; /* Index of message */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -484,11 +484,11 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Locate "unknown" message */ for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) - if(idx_msg->type->id == H5O_UNKNOWN_ID) { + if(idx_msg->type->id == H5O_UNKNOWN_ID) { /* Check for "unknown" message having the correct flags */ if(((idx_msg->flags & H5O_MSG_FLAG_WAS_UNKNOWN) > 0) != flag_val) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "'unknown' message has incorrect 'was unknown' flag value") @@ -503,15 +503,15 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_check_msg_marked_test() */ +} /* H5O__check_msg_marked_test() */ /*-------------------------------------------------------------------------- NAME - H5O_expunge_chunks_test + H5O__expunge_chunks_test PURPOSE Expunge all the chunks for an object header from the cache. USAGE @@ -529,7 +529,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_expunge_chunks_test(const H5O_loc_t *loc) +H5O__expunge_chunks_test(const H5O_loc_t *loc) { H5O_t *oh = NULL; /* Object header */ haddr_t chk_addr[16]; /* Array of chunk addresses */ @@ -537,11 +537,11 @@ H5O_expunge_chunks_test(const H5O_loc_t *loc) size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__NO_FLAGS_SET, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Safety check */ nchunks = oh->nchunks; @@ -553,7 +553,7 @@ H5O_expunge_chunks_test(const H5O_loc_t *loc) /* Release the object header */ if(H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header") /* Iterate over all the saved chunk addresses, evicting them from the cache */ /* (in reverse order, so that chunk #0 is unpinned) */ @@ -563,16 +563,16 @@ H5O_expunge_chunks_test(const H5O_loc_t *loc) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_expunge_chunks_test() */ +} /* H5O__expunge_chunks_test() */ /*-------------------------------------------------------------------------- NAME - H5O_get_rc + H5O__get_rc_test PURPOSE Retrieve the refcount for the object header USAGE - herr_t H5O_expunge_chunks_test(loc, rc) + herr_t H5O__get_rc_test(loc, rc) const H5O_loc_t *loc; IN: Object location for object header to query unsigned *rc; OUT: Pointer to refcount for object header RETURNS @@ -587,12 +587,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_get_rc(const H5O_loc_t *loc, unsigned *rc) +H5O__get_rc_test(const H5O_loc_t *loc, unsigned *rc) { H5O_t *oh = NULL; /* Object header */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(loc); @@ -600,7 +600,7 @@ H5O_get_rc(const H5O_loc_t *loc, unsigned *rc) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Save the refcount for the object header */ *rc = oh->nlink; @@ -608,19 +608,19 @@ H5O_get_rc(const H5O_loc_t *loc, unsigned *rc) done: /* Release the object header */ if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_expunge_chunks_test() */ +} /* H5O__get_rc_test() */ /*-------------------------------------------------------------------------- NAME - H5O_msg_get_chunkno_test + H5O__msg_get_chunkno_test PURPOSE Retrieve the chunk number for an object header message of a given type. USAGE - herr_t H5O_check_msg_marked_test(oid, chunk_num) + herr_t H5O__msg_get_chunkno_test(oid, msg_type, chunk_num) hid_t oid; IN: Object to check unsigned msg_type; IN: Object header message type to check unsigned *chunk_num; OUT: Object header chunk that the message is in @@ -636,7 +636,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) +H5O__msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) { H5O_t *oh = NULL; /* Object header */ H5O_loc_t *loc; /* Pointer to object's location */ @@ -645,7 +645,7 @@ H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -658,11 +658,11 @@ H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Locate first message of given type */ for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) - if(idx_msg->type->id == msg_type) { + if(idx_msg->type->id == msg_type) { /* Set the chunk number for the message */ *chunk_num = idx_msg->chunkno; @@ -676,21 +676,21 @@ H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(api_ctx_pushed && H5CX_pop() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_msg_get_chunkno_test() */ +} /* H5O__msg_get_chunkno_test() */ /*-------------------------------------------------------------------------- NAME - H5O_msg_move_to_new_chunk_test + H5O__msg_move_to_new_chunk_test PURPOSE Move a message into a new chunk USAGE - herr_t H5O_msg_move_to_new_chunk_test(oid, msg_type) + herr_t H5O__msg_move_to_new_chunk_test(oid, msg_type) hid_t oid; IN: Object to check unsigned msg_type; IN: Object header message type to check RETURNS @@ -704,7 +704,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) +H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) { H5O_t *oh = NULL; /* Object header */ H5O_loc_t *loc; /* Pointer to object's location */ @@ -713,7 +713,7 @@ H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -726,11 +726,11 @@ H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__NO_FLAGS_SET, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Locate first message of given type */ for(idx = 0, curr_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, curr_msg++) - if(curr_msg->type->id == msg_type) { + if(curr_msg->type->id == msg_type) { H5O_msg_alloc_info_t found_msg; /* Information about message to move */ unsigned msg_chunkno = curr_msg->chunkno; /* Chunk that the message is in */ uint8_t *end_chunk_data = (oh->chunk[msg_chunkno].image + oh->chunk[msg_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[msg_chunkno].gap); /* End of message data in chunk */ @@ -784,10 +784,10 @@ H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(api_ctx_pushed && H5CX_pop() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_msg_get_chunkno_test() */ +} /* H5O__msg_get_chunkno_test() */ diff --git a/src/H5Ounknown.c b/src/H5Ounknown.c index dbab28c..89c00ad 100644 --- a/src/H5Ounknown.c +++ b/src/H5Ounknown.c @@ -63,11 +63,11 @@ H5FL_DEFINE(H5O_unknown_t); /*------------------------------------------------------------------------- - * Function: H5O__unknown_free + * Function: H5O__unknown_free * - * Purpose: Frees the message + * Purpose: Frees the message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, May 1, 2007 @@ -82,7 +82,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE; hid_t id; IN: Property list or class ID to copy RETURNS Success: valid property list ID on success (non-negative) - Failure: negative + Failure: H5I_INVALID_HID (negative) DESCRIPTION Copy a property list or class and return the ID. This routine calls the class 'copy' callback after any property 'copy' callbacks are called @@ -97,37 +97,37 @@ hid_t H5Pcopy(hid_t id) { void *obj; /* Property object to copy */ - hid_t ret_value=FALSE; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", id); - if(H5P_DEFAULT==id) + if(H5P_DEFAULT == id) HGOTO_DONE(H5P_DEFAULT); /* Check arguments. */ if(H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property object"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not property object"); if(NULL == (obj = H5I_object(id))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist"); + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "property object doesn't exist"); /* Compare property lists */ if(H5I_GENPROP_LST == H5I_get_type(id)) { if((ret_value = H5P_copy_plist((H5P_genplist_t *)obj, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "can't copy property list"); } /* end if */ /* Must be property classes */ else { H5P_genclass_t *copy_class; /* Copy of class */ /* Copy the class */ - if((copy_class = H5P_copy_pclass((H5P_genclass_t *)obj)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property class"); + if((copy_class = H5P__copy_pclass((H5P_genclass_t *)obj)) == NULL) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "can't copy property class"); /* Get an atom for the copied class */ if((ret_value = H5I_register(H5I_GENPROP_CLS, copy_class, TRUE)) < 0) { - H5P_close_class(copy_class); - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class"); + H5P__close_class(copy_class); + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class"); } /* end if */ } /* end else */ @@ -162,7 +162,7 @@ done: void *close_data; IN: Pointer to user data to pass along to class close callback. RETURNS - Returns a valid property list class ID on success, NULL on failure. + Returns a valid property list class ID on success, H5I_INVALID_HID on failure. DESCRIPTION Allocates memory and attaches a class to the property list class hierarchy. GLOBAL VARIABLES @@ -179,39 +179,39 @@ H5Pcreate_class(hid_t parent, const char *name, { H5P_genclass_t *par_class = NULL; /* Pointer to the parent class */ H5P_genclass_t *pclass = NULL; /* Property list class created */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE8("i", "i*sx*xx*xx*x", parent, name, cls_create, create_data, cls_copy, copy_data, cls_close, close_data); /* Check arguments. */ if(H5P_DEFAULT!=parent && (H5I_GENPROP_CLS!=H5I_get_type(parent))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list class") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid class name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid class name") if((create_data != NULL && cls_create == NULL) || (copy_data != NULL && cls_copy == NULL) || (close_data != NULL && cls_close == NULL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data specified, but no callback provided") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "data specified, but no callback provided") /* Get the pointer to the parent class */ if(parent == H5P_DEFAULT) par_class = NULL; else if(NULL == (par_class = (H5P_genclass_t *)H5I_object(parent))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't retrieve parent class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't retrieve parent class") /* Create the new property list class */ - if(NULL == (pclass = H5P_create_class(par_class, name, H5P_TYPE_USER, cls_create, create_data, cls_copy, copy_data, cls_close, close_data))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list class") + if(NULL == (pclass = H5P__create_class(par_class, name, H5P_TYPE_USER, cls_create, create_data, cls_copy, copy_data, cls_close, close_data))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list class") /* Get an atom for the class */ if((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class") done: - if(ret_value < 0 && pclass) - H5P_close_class(pclass); + if(H5I_INVALID_HID == ret_value && pclass) + H5P__close_class(pclass); FUNC_LEAVE_API(ret_value) } /* H5Pcreate_class() */ @@ -226,7 +226,7 @@ done: hid_t H5Pcreate(cls_id) hid_t cls_id; IN: Property list class create list from RETURNS - Returns a valid property list ID on success, FAIL on failure. + Returns a valid property list ID on success, H5I_INVALID_HID on failure. DESCRIPTION Creates a property list of a given class. If a 'create' callback exists for the property list class, it is called before the @@ -243,18 +243,18 @@ hid_t H5Pcreate(hid_t cls_id) { H5P_genclass_t *pclass; /* Property list class to modify */ - hid_t ret_value; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", cls_id); /* Check arguments. */ if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(cls_id, H5I_GENPROP_CLS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list class"); /* Create the new property list */ if((ret_value = H5P_create_id(pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list"); done: FUNC_LEAVE_API(ret_value) @@ -440,7 +440,7 @@ H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value, /* Create the new property list class */ orig_pclass = pclass; - if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, prp_cmp, prp_close)) < 0) + if((ret_value = H5P__register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, prp_cmp, prp_close)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class") /* Check if the property class changed and needs to be substituted in the ID */ @@ -453,7 +453,7 @@ H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value, HDassert(old_pclass == orig_pclass); /* Close the previous class */ - if(H5P_close_class(old_pclass) < 0) + if(H5P__close_class(old_pclass) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution") } /* end if */ @@ -738,7 +738,7 @@ H5Pexist(hid_t id, const char *name) if(H5I_GENPROP_CLS == H5I_get_type(id)) { if(NULL == (pclass = (H5P_genclass_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class"); - if((ret_value = H5P_exist_pclass(pclass, name)) < 0) + if((ret_value = H5P__exist_pclass(pclass, name)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property does not exist in class"); } /* end if */ else @@ -795,7 +795,7 @@ H5Pget_size(hid_t id, const char *name, size_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Check the property size */ - if((ret_value = H5P_get_size_plist(plist, name, size)) < 0) + if((ret_value = H5P__get_size_plist(plist, name, size)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query size in plist"); } /* end if */ else @@ -804,7 +804,7 @@ H5Pget_size(hid_t id, const char *name, size_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Check the property size */ - if((ret_value = H5P_get_size_pclass(pclass, name, size)) < 0) + if((ret_value = H5P__get_size_pclass(pclass, name, size)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query size in plist"); } /* end if */ else @@ -867,8 +867,8 @@ done: hid_t H5Pdecode(buf) void *buf; IN: buffer that holds the encoded plist RETURNS - Returns non-negative ID of new property list object on success, negative - on failure. + Success: ID of new property list object + Failure: H5I_INVALID_HID (negative) DESCRIPTION Decodes a property list from a binary buffer. The contents of the buffer contain the values for the correponding properties of the plist. The decode @@ -884,14 +884,14 @@ done: hid_t H5Pdecode(const void *buf) { - hid_t ret_value = SUCCEED; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "*x", buf); /* Call the internal decode routine */ if((ret_value = H5P__decode(buf)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "unable to decode property list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, H5I_INVALID_HID, "unable to decode property list"); done: FUNC_LEAVE_API(ret_value) @@ -908,7 +908,7 @@ done: hid_t plist_id; IN: Property list to query RETURNS Success: ID of class object - Failure: negative + Failure: H5I_INVALID_HID (negative) DESCRIPTION This routine retrieves the class of a property list. @@ -923,30 +923,30 @@ H5Pget_class(hid_t plist_id) { H5P_genplist_t *plist; /* Property list to query */ H5P_genclass_t *pclass=NULL; /* Property list class */ - hid_t ret_value=FAIL; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", plist_id); /* Check arguments. */ if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list"); /* Retrieve the property list class */ if((pclass = H5P_get_class(plist)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to query class of property list"); + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to query class of property list"); /* Increment the outstanding references to the class object */ - if(H5P_access_class(pclass, H5P_MOD_INC_REF) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Can't increment class ID ref count"); + if(H5P__access_class(pclass, H5P_MOD_INC_REF) < 0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID,"Can't increment class ID ref count"); /* Get an atom for the class */ if((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class"); done: - if(ret_value<0 && pclass) - H5P_close_class(pclass); + if(H5I_INVALID_HID == ret_value && pclass) + H5P__close_class(pclass); FUNC_LEAVE_API(ret_value) } /* H5Pget_class() */ @@ -994,7 +994,7 @@ H5Pget_nprops(hid_t id, size_t *nprops) if(H5I_GENPROP_LST == H5I_get_type(id)) { if(NULL == (plist = (H5P_genplist_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); - if(H5P_get_nprops_plist(plist, nprops) < 0) + if(H5P__get_nprops_plist(plist, nprops) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query # of properties in plist"); } /* end if */ else @@ -1054,7 +1054,7 @@ H5Pequal(hid_t id1, hid_t id2) if(H5I_GENPROP_LST == H5I_get_type(id1)) { int cmp_ret = 0; - if(H5P_cmp_plist((const H5P_genplist_t *)obj1, (const H5P_genplist_t *)obj2, &cmp_ret) < 0) + if(H5P__cmp_plist((const H5P_genplist_t *)obj1, (const H5P_genplist_t *)obj2, &cmp_ret) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOMPARE, FAIL, "can't compare property lists") /* Set return value */ @@ -1062,7 +1062,7 @@ H5Pequal(hid_t id1, hid_t id2) } /* end if */ /* Must be property classes */ else { - if(H5P_cmp_class((const H5P_genclass_t *)obj1, (const H5P_genclass_t *)obj2) == 0) + if(H5P__cmp_class((const H5P_genclass_t *)obj1, (const H5P_genclass_t *)obj2) == 0) ret_value = TRUE; } /* end else */ @@ -1236,13 +1236,13 @@ H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data) if(H5I_GENPROP_LST == H5I_get_type(id)) { /* Iterate over a property list */ - if((ret_value = H5P_iterate_plist((H5P_genplist_t *)obj, TRUE, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0) + if((ret_value = H5P__iterate_plist((H5P_genplist_t *)obj, TRUE, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over list"); } /* end if */ else if(H5I_GENPROP_CLS == H5I_get_type(id)) { /* Iterate over a property class */ - if((ret_value = H5P_iterate_pclass((H5P_genclass_t *)obj, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0) + if((ret_value = H5P__iterate_pclass((H5P_genclass_t *)obj, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over class"); } /* end if */ else @@ -1419,12 +1419,12 @@ H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name) /* Compare property lists */ if(H5I_GENPROP_LST == src_id_type) { - if(H5P_copy_prop_plist(dst_id, src_id, name) < 0) + if(H5P__copy_prop_plist(dst_id, src_id, name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between lists") } /* end if */ /* Must be property classes */ else { - if(H5P_copy_prop_pclass(dst_id, src_id, name) < 0) + if(H5P__copy_prop_pclass(dst_id, src_id, name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between classes") } /* end else */ @@ -1470,7 +1470,7 @@ H5Punregister(hid_t pclass_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name"); /* Remove the property list from class */ - if((ret_value = H5P_unregister(pclass, name)) < 0) + if((ret_value = H5P__unregister(pclass, name)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to remove property from class"); done: @@ -1575,7 +1575,7 @@ done: hid_t pclass_id; IN: Property class to query RETURNS Success: ID of parent class object - Failure: NULL + Failure: H5I_INVALID_HID (negative) DESCRIPTION This routine retrieves an ID for the parent class of a property class. @@ -1589,30 +1589,30 @@ H5Pget_class_parent(hid_t pclass_id) { H5P_genclass_t *pclass; /* Property class to query */ H5P_genclass_t *parent = NULL; /* Parent's property class */ - hid_t ret_value; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", pclass_id); /* Check arguments. */ if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property class") /* Retrieve the property class's parent */ - if(NULL == (parent = H5P_get_class_parent(pclass))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to query class of property list") + if(NULL == (parent = H5P__get_class_parent(pclass))) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to query class of property list") /* Increment the outstanding references to the class object */ - if(H5P_access_class(parent, H5P_MOD_INC_REF) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't increment class ID ref count") + if(H5P__access_class(parent, H5P_MOD_INC_REF) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID,"Can't increment class ID ref count") /* Get an atom for the class */ if((ret_value = H5I_register(H5I_GENPROP_CLS, parent, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class") done: - if(ret_value < 0 && parent) - H5P_close_class(parent); + if(H5I_INVALID_HID == ret_value && parent) + H5P__close_class(parent); FUNC_LEAVE_API(ret_value) } /* H5Pget_class_parent() */ diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h index aef87e1..b94b845 100644 --- a/src/H5PBprivate.h +++ b/src/H5PBprivate.h @@ -91,10 +91,8 @@ H5_DLL herr_t H5PB_dest(H5F_t *f); H5_DLL herr_t H5PB_add_new_page(H5F_t *f, H5FD_mem_t type, haddr_t page_addr); H5_DLL herr_t H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5PB_remove_entry(const H5F_t *f, haddr_t addr); -H5_DLL herr_t H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, - void *buf/*out*/); -H5_DLL herr_t H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, - const void *buf); +H5_DLL herr_t H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); +H5_DLL herr_t H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); /* Statistics routines */ H5_DLL herr_t H5PB_reset_stats(H5PB_t *page_buf); diff --git a/src/H5PLint.c b/src/H5PLint.c index b190746..bbe71fe 100644 --- a/src/H5PLint.c +++ b/src/H5PLint.c @@ -235,7 +235,7 @@ done: *------------------------------------------------------------------------- */ const void * -H5PL_load(H5PL_type_t type, H5PL_key_t key) +H5PL_load(H5PL_type_t type, const H5PL_key_t *key) { H5PL_search_params_t search_params; /* Plugin search parameters */ hbool_t found = FALSE; /* Whether the plugin was found */ @@ -250,6 +250,10 @@ H5PL_load(H5PL_type_t type, H5PL_key_t key) if ((H5PL_plugin_control_mask_g & H5PL_FILTER_PLUGIN) == 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "filter plugins disabled") break; + case H5PL_TYPE_VOL: + if((H5PL_plugin_control_mask_g & H5PL_VOL_PLUGIN) == 0) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "Virtual Object Layer (VOL) driver plugins disabled") + break; case H5PL_TYPE_ERROR: case H5PL_TYPE_NONE: default: @@ -258,7 +262,7 @@ H5PL_load(H5PL_type_t type, H5PL_key_t key) /* Set up the search parameters */ search_params.type = type; - search_params.key.id = key.id; + search_params.key.id = key->id; /* Search in the table of already loaded plugin libraries */ if(H5PL__find_plugin_in_cache(&search_params, &found, &plugin_info) < 0) @@ -303,7 +307,8 @@ done: #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" herr_t -H5PL__open(const char *path, H5PL_type_t type, H5PL_key_t key, hbool_t *success, const void **plugin_info) +H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, + hbool_t *success, const void **plugin_info) { H5PL_HANDLE handle = NULL; H5PL_get_plugin_info_t get_plugin_info = NULL; @@ -345,13 +350,44 @@ H5PL__open(const char *path, H5PL_type_t type, H5PL_key_t key, hbool_t *success, HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get filter info from plugin") /* If the filter IDs match, we're done. Set the output parameters. */ - if (filter_info->id == key.id) { + if (filter_info->id == key->id) { *plugin_info = (const void *)filter_info; *success = TRUE; } break; } + + case H5PL_TYPE_VOL: + { + const H5VL_class_t *cls; + + /* Get the plugin info */ + if(NULL == (cls = (const H5VL_class_t *)(*get_plugin_info)())) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get VOL driver info from plugin") + + /* Which kind of key are we looking for? */ + if(key->vol.kind == H5VL_GET_CONNECTOR_BY_NAME) { + /* If the plugin names match, we're done. Set the output parameters. */ + if(cls->name && !HDstrcmp(cls->name, key->vol.u.name)) { + *plugin_info = (const void *)cls; + *success = TRUE; + } /* end if */ + } /* end if */ + else { + /* Sanity check */ + HDassert(key->vol.kind == H5VL_GET_CONNECTOR_BY_VALUE); + + /* If the plugin values match, we're done. Set the output parameters. */ + if(cls->value == key->vol.u.value) { + *plugin_info = (const void *)cls; + *success = TRUE; + } /* end if */ + } /* end else */ + + break; + } + case H5PL_TYPE_ERROR: case H5PL_TYPE_NONE: default: diff --git a/src/H5PLpath.c b/src/H5PLpath.c index 972f1d0..d53007b 100644 --- a/src/H5PLpath.c +++ b/src/H5PLpath.c @@ -689,7 +689,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo continue; /* attempt to open the dynamic library as a filter library */ - if (H5PL__open(path, search_params->type, search_params->key, found, plugin_info) < 0) + if (H5PL__open(path, search_params->type, &(search_params->key), found, plugin_info) < 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed") if (*found) HGOTO_DONE(SUCCEED) @@ -755,7 +755,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo continue; /* attempt to open the dynamic library as a filter library */ - if (H5PL__open(path, search_params->type, search_params->key, found, plugin_info) < 0) + if (H5PL__open(path, search_params->type, &(search_params->key), found, plugin_info) < 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed") if (*found) HGOTO_DONE(SUCCEED) diff --git a/src/H5PLpkg.h b/src/H5PLpkg.h index dfaa4af..d60da82 100644 --- a/src/H5PLpkg.h +++ b/src/H5PLpkg.h @@ -134,13 +134,15 @@ H5_DLL herr_t H5PL__get_plugin_control_mask(unsigned int *mask /*out*/); H5_DLL herr_t H5PL__set_plugin_control_mask(unsigned int mask); /* Plugin search and manipulation */ -H5_DLL herr_t H5PL__open(const char *libname, H5PL_type_t type, H5PL_key_t key, hbool_t *success /*out*/, const void **plugin_info /*out*/); +H5_DLL herr_t H5PL__open(const char *libname, H5PL_type_t type, const H5PL_key_t *key, + hbool_t *success /*out*/, const void **plugin_info /*out*/); H5_DLL herr_t H5PL__close(H5PL_HANDLE handle); /* Plugin cache calls */ H5_DLL herr_t H5PL__create_plugin_cache(void); H5_DLL herr_t H5PL__close_plugin_cache(hbool_t *already_closed /*out*/); -H5_DLL herr_t H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle); +H5_DLL herr_t H5PL__add_plugin(H5PL_type_t type, const H5PL_key_t *key, + H5PL_HANDLE handle); H5_DLL herr_t H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *found /*out*/, const void **plugin_info /*out*/); /* Plugin search path calls */ diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c index e905ac2..7fe676d 100644 --- a/src/H5PLplugin_cache.c +++ b/src/H5PLplugin_cache.c @@ -216,7 +216,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle) +H5PL__add_plugin(H5PL_type_t type, const H5PL_key_t *key, H5PL_HANDLE handle) { herr_t ret_value = SUCCEED; @@ -229,7 +229,7 @@ H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle) /* Store the plugin info and bump the # of plugins */ H5PL_cache_g[H5PL_num_plugins_g].type = type; - H5PL_cache_g[H5PL_num_plugins_g].key = key; + H5PL_cache_g[H5PL_num_plugins_g].key = *key; H5PL_cache_g[H5PL_num_plugins_g].handle = handle; H5PL_num_plugins_g++; diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h index cc2e258..5ce9b87 100644 --- a/src/H5PLprivate.h +++ b/src/H5PLprivate.h @@ -21,7 +21,8 @@ #include "H5PLpublic.h" /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /**************************/ @@ -35,7 +36,14 @@ /* The key that will be used to find the plugin */ typedef union H5PL_key_t { - int id; /* filters */ + int id; /* I/O filters */ + struct { + H5VL_get_connector_kind_t kind; /* Kind of VOL lookup to do */ + union { + H5VL_class_value_t value; /* VOL connector value */ + const char *name; /* VOL connector name */ + } u; + } vol; } H5PL_key_t; @@ -49,7 +57,7 @@ typedef union H5PL_key_t { /***************************************/ /* Internal API routines */ -H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, H5PL_key_t key); +H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, const H5PL_key_t *key); #endif /* _H5PLprivate_H */ diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h index fe5bdfb..8e022cc 100644 --- a/src/H5PLpublic.h +++ b/src/H5PLpublic.h @@ -32,11 +32,13 @@ typedef enum H5PL_type_t { H5PL_TYPE_ERROR = -1, /* Error */ H5PL_TYPE_FILTER = 0, /* Filter */ - H5PL_TYPE_NONE = 1 /* This must be last! */ + H5PL_TYPE_VOL = 1, /* VOL driver */ + H5PL_TYPE_NONE = 2 /* This must be last! */ } H5PL_type_t; /* Common dynamic plugin type flags used by the set/get_loading_state functions */ #define H5PL_FILTER_PLUGIN 0x0001 +#define H5PL_VOL_PLUGIN 0x0002 #define H5PL_ALL_PLUGIN 0xFFFF #ifdef __cplusplus diff --git a/src/H5Pacpl.c b/src/H5Pacpl.c index 4368dd6..2322c76 100644 --- a/src/H5Pacpl.c +++ b/src/H5Pacpl.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Pacpl.c - * January 2 2006 - * James Laird <jlaird@ncsa.uiuc.edu> + * Created: H5Pacpl.c * - * Purpose: Attribute creation property list class routines + * Purpose: Attribute creation property list class routines * *------------------------------------------------------------------------- */ @@ -32,15 +30,20 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Ppkg.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ /* Local Macros */ /****************/ +/* Definitions for locations parameters */ +#define H5A_CRT_LOCATION_SIZE sizeof(H5VL_loc_params_t) +#define H5A_CRT_LOCATION_DEF H5I_BADID + /******************/ /* Local Typedefs */ @@ -56,6 +59,9 @@ /* Local Prototypes */ /********************/ +/* Property class callbacks */ +static herr_t H5P_acrt_reg_prop(H5P_genclass_t *pclass); + /*********************/ /* Package Variables */ @@ -63,21 +69,21 @@ /* Attribute creation property list class library initialization object */ const H5P_libclass_t H5P_CLS_ACRT[1] = {{ - "attribute create", /* Class name for debugging */ - H5P_TYPE_ATTRIBUTE_CREATE, /* Class type */ - - &H5P_CLS_STRING_CREATE_g, /* Parent class */ - &H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class */ - &H5P_CLS_ATTRIBUTE_CREATE_ID_g, /* Pointer to class ID */ - &H5P_LST_ATTRIBUTE_CREATE_ID_g, /* Pointer to default property list ID */ - NULL, /* Default property registration routine */ - - NULL, /* Class creation callback */ - NULL, /* Class creation callback info */ - NULL, /* Class copy callback */ - NULL, /* Class copy callback info */ - NULL, /* Class close callback */ - NULL /* Class close callback info */ + "attribute create", /* Class name for debugging */ + H5P_TYPE_ATTRIBUTE_CREATE, /* Class type */ + + &H5P_CLS_STRING_CREATE_g, /* Parent class */ + &H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class */ + &H5P_CLS_ATTRIBUTE_CREATE_ID_g, /* Pointer to class ID */ + &H5P_LST_ATTRIBUTE_CREATE_ID_g, /* Pointer to default property list ID */ + H5P_acrt_reg_prop, /* Default property registration routine */ + + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ }}; @@ -85,4 +91,44 @@ const H5P_libclass_t H5P_CLS_ACRT[1] = {{ /* Library Private Variables */ /*****************************/ + +/*------------------------------------------------------------------------- + * Function: H5P_acrt_reg_prop + * + * Purpose: Register the attribute creation property list class's properties + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P_acrt_reg_prop(H5P_genclass_t *pclass) +{ + hid_t type_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + /* Register the type ID property*/ + if(H5P__register_real(pclass, H5VL_PROP_ATTR_TYPE_ID, sizeof(hid_t), &type_id, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the space ID property */ + if(H5P__register_real(pclass, H5VL_PROP_ATTR_SPACE_ID, sizeof(hid_t), &space_id, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the lcpl ID property */ + HDmemset(&loc_params, 0, sizeof(H5VL_loc_params_t)); + loc_params.obj_type = H5A_CRT_LOCATION_DEF; + if(H5P__register_real(pclass, H5VL_PROP_ATTR_LOC_PARAMS, H5A_CRT_LOCATION_SIZE, &loc_params, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_acrt_reg_prop() */ diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index da06297..00e598f 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -204,46 +204,46 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register the size of raw data chunk cache (elements) */ - if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, + if(H5P__register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, NULL, NULL, NULL, H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache(bytes) */ - if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, + if(H5P__register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, NULL, NULL, NULL, H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the preemption for reading chunks */ - if(H5P_register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, + if(H5P__register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, NULL, NULL, NULL, H5D_ACS_PREEMPT_READ_CHUNKS_ENC, H5D_ACS_PREEMPT_READ_CHUNKS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the VDS view option */ - if(H5P_register_real(pclass, H5D_ACS_VDS_VIEW_NAME, H5D_ACS_VDS_VIEW_SIZE, &virtual_view, + if(H5P__register_real(pclass, H5D_ACS_VDS_VIEW_NAME, H5D_ACS_VDS_VIEW_SIZE, &virtual_view, NULL, NULL, NULL, H5D_ACS_VDS_VIEW_ENC, H5D_ACS_VDS_VIEW_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the VDS printf gap */ - if(H5P_register_real(pclass, H5D_ACS_VDS_PRINTF_GAP_NAME, H5D_ACS_VDS_PRINTF_GAP_SIZE, &printf_gap, + if(H5P__register_real(pclass, H5D_ACS_VDS_PRINTF_GAP_NAME, H5D_ACS_VDS_PRINTF_GAP_SIZE, &printf_gap, NULL, NULL, NULL, H5D_ACS_VDS_PRINTF_GAP_ENC, H5D_ACS_VDS_PRINTF_GAP_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for vds prefix */ - if(H5P_register_real(pclass, H5D_ACS_VDS_PREFIX_NAME, H5D_ACS_VDS_PREFIX_SIZE, &H5D_def_vds_prefix_g, + if(H5P__register_real(pclass, H5D_ACS_VDS_PREFIX_NAME, H5D_ACS_VDS_PREFIX_SIZE, &H5D_def_vds_prefix_g, NULL, H5D_ACS_VDS_PREFIX_SET, H5D_ACS_VDS_PREFIX_GET, H5D_ACS_VDS_PREFIX_ENC, H5D_ACS_VDS_PREFIX_DEC, H5D_ACS_VDS_PREFIX_DEL, H5D_ACS_VDS_PREFIX_COPY, H5D_ACS_VDS_PREFIX_CMP, H5D_ACS_VDS_PREFIX_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register info for append flush */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_ACS_APPEND_FLUSH_NAME, H5D_ACS_APPEND_FLUSH_SIZE, &H5D_def_append_flush_g, + if(H5P__register_real(pclass, H5D_ACS_APPEND_FLUSH_NAME, H5D_ACS_APPEND_FLUSH_SIZE, &H5D_def_append_flush_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external file prefix */ - if(H5P_register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g, + if(H5P__register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g, NULL, H5D_ACS_EFILE_PREFIX_SET, H5D_ACS_EFILE_PREFIX_GET, H5D_ACS_EFILE_PREFIX_ENC, H5D_ACS_EFILE_PREFIX_DEC, H5D_ACS_EFILE_PREFIX_DEL, H5D_ACS_EFILE_PREFIX_COPY, H5D_ACS_EFILE_PREFIX_CMP, H5D_ACS_EFILE_PREFIX_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index a1799ad..adb63c7 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Pdcpl.c - * February 26 1998 - * Robb Matzke <matzke@llnl.gov> + * Created: H5Pdcpl.c * - * Purpose: Dataset creation property list class routines + * Purpose: Dataset creation property list class routines * *------------------------------------------------------------------------- */ @@ -33,19 +31,19 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Ppkg.h" /* Property lists */ -#include "H5Sprivate.h" /* Dataspaces */ -#include "H5Tprivate.h" /* Datatypes */ -#include "H5VMprivate.h" /* Vectors and arrays */ -#include "H5Zprivate.h" /* Data filters */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Ppkg.h" /* Property lists */ +#include "H5Sprivate.h" /* Dataspaces */ +#include "H5Tprivate.h" /* Datatypes */ +#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5Zprivate.h" /* Data filters */ /****************/ @@ -248,36 +246,39 @@ static hbool_t H5P_dcrt_def_layout_init_g = FALSE; static herr_t H5P__dcrt_reg_prop(H5P_genclass_t *pclass) { - herr_t ret_value = SUCCEED; /* Return value */ + hid_t type_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Register the storage layout property */ - if(H5P_register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &H5D_def_layout_g, + if(H5P__register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &H5D_def_layout_g, NULL, H5D_CRT_LAYOUT_SET, H5D_CRT_LAYOUT_GET, H5D_CRT_LAYOUT_ENC, H5D_CRT_LAYOUT_DEC, H5D_CRT_LAYOUT_DEL, H5D_CRT_LAYOUT_COPY, H5D_CRT_LAYOUT_CMP, H5D_CRT_LAYOUT_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the fill value property */ - if(H5P_register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &H5D_def_fill_g, + if(H5P__register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &H5D_def_fill_g, NULL, H5D_CRT_FILL_VALUE_SET, H5D_CRT_FILL_VALUE_GET, H5D_CRT_FILL_VALUE_ENC, H5D_CRT_FILL_VALUE_DEC, H5D_CRT_FILL_VALUE_DEL, H5D_CRT_FILL_VALUE_COPY, H5D_CRT_FILL_VALUE_CMP, H5D_CRT_FILL_VALUE_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the space allocation time state property */ - if(H5P_register_real(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &H5D_def_alloc_time_state_g, + if(H5P__register_real(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &H5D_def_alloc_time_state_g, NULL, NULL, NULL, H5D_CRT_ALLOC_TIME_STATE_ENC, H5D_CRT_ALLOC_TIME_STATE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the external file list property */ - if(H5P_register_real(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &H5D_def_efl_g, + if(H5P__register_real(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &H5D_def_efl_g, NULL, H5D_CRT_EXT_FILE_LIST_SET, H5D_CRT_EXT_FILE_LIST_GET, H5D_CRT_EXT_FILE_LIST_ENC, H5D_CRT_EXT_FILE_LIST_DEC, H5D_CRT_EXT_FILE_LIST_DEL, H5D_CRT_EXT_FILE_LIST_COPY, H5D_CRT_EXT_FILE_LIST_CMP, H5D_CRT_EXT_FILE_LIST_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the object header minimization property */ - if (0 > H5P_register_real( + if (0 > H5P__register_real( pclass, /* class */ H5D_CRT_MIN_DSET_HDR_SIZE_NAME, /* name */ H5D_CRT_MIN_DSET_HDR_SIZE_SIZE, /* size */ @@ -296,6 +297,21 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass) "can't insert property into class") } + /* Register the type ID property*/ + if(H5P__register_real(pclass, H5VL_PROP_DSET_TYPE_ID, sizeof(hid_t), &type_id, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the space ID property */ + if(H5P__register_real(pclass, H5VL_PROP_DSET_SPACE_ID, sizeof(hid_t), &space_id, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the lcpl ID property */ + if(H5P__register_real(pclass, H5VL_PROP_DSET_LCPL_ID, sizeof(hid_t), &lcpl_id, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dcrt_reg_prop() */ @@ -3232,10 +3248,10 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) H5T_path_t *tpath; /* Conversion information */ /* Retrieve pointer to datatype */ - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - /* Set the fill value */ + /* Set the fill value */ if(NULL == (fill.type = H5T_copy(type, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy datatype") fill.size = (ssize_t)H5T_get_size(type); diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index 226d206..4a63b36 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -242,7 +242,7 @@ H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value, /* Create the new property list class */ orig_pclass = pclass; - if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, NULL, prp_close)) < 0) + if((ret_value = H5P__register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, NULL, prp_close)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class"); /* Check if the property class changed and needs to be substituted in the ID */ @@ -255,7 +255,7 @@ H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value, HDassert(old_pclass == orig_pclass); /* Close the previous class */ - if(H5P_close_class(orig_pclass) < 0) + if(H5P__close_class(orig_pclass) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution") } /* end if */ diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index e6eed32..bfc1d93 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -271,131 +271,131 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register the max. temp buffer size property */ - if(H5P_register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &H5D_def_max_temp_buf_g, + if(H5P__register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &H5D_def_max_temp_buf_g, NULL, NULL, NULL, H5D_XFER_MAX_TEMP_BUF_ENC, H5D_XFER_MAX_TEMP_BUF_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the type conversion buffer property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_TCONV_BUF_NAME, H5D_XFER_TCONV_BUF_SIZE, &H5D_def_tconv_buf_g, + if(H5P__register_real(pclass, H5D_XFER_TCONV_BUF_NAME, H5D_XFER_TCONV_BUF_SIZE, &H5D_def_tconv_buf_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the background buffer property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_NAME, H5D_XFER_BKGR_BUF_SIZE, &H5D_def_bkgr_buf_g, + if(H5P__register_real(pclass, H5D_XFER_BKGR_BUF_NAME, H5D_XFER_BKGR_BUF_SIZE, &H5D_def_bkgr_buf_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the background buffer type property */ - if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_TYPE_NAME, H5D_XFER_BKGR_BUF_TYPE_SIZE, &H5D_def_bkgr_buf_type_g, + if(H5P__register_real(pclass, H5D_XFER_BKGR_BUF_TYPE_NAME, H5D_XFER_BKGR_BUF_TYPE_SIZE, &H5D_def_bkgr_buf_type_g, NULL, NULL, NULL, H5D_XFER_BKGR_BUF_TYPE_ENC, H5D_XFER_BKGR_BUF_TYPE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the B-Tree node splitting ratios property */ - if(H5P_register_real(pclass, H5D_XFER_BTREE_SPLIT_RATIO_NAME, H5D_XFER_BTREE_SPLIT_RATIO_SIZE, H5D_def_btree_split_ratio_g, + if(H5P__register_real(pclass, H5D_XFER_BTREE_SPLIT_RATIO_NAME, H5D_XFER_BTREE_SPLIT_RATIO_SIZE, H5D_def_btree_split_ratio_g, NULL, NULL, NULL, H5D_XFER_BTREE_SPLIT_RATIO_ENC, H5D_XFER_BTREE_SPLIT_RATIO_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen allocation function property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_NAME, H5D_XFER_VLEN_ALLOC_SIZE, &H5D_def_vlen_alloc_g, + if(H5P__register_real(pclass, H5D_XFER_VLEN_ALLOC_NAME, H5D_XFER_VLEN_ALLOC_SIZE, &H5D_def_vlen_alloc_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen allocation information property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_INFO_NAME, H5D_XFER_VLEN_ALLOC_INFO_SIZE, &H5D_def_vlen_alloc_info_g, + if(H5P__register_real(pclass, H5D_XFER_VLEN_ALLOC_INFO_NAME, H5D_XFER_VLEN_ALLOC_INFO_SIZE, &H5D_def_vlen_alloc_info_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen free function property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_NAME, H5D_XFER_VLEN_FREE_SIZE, &H5D_def_vlen_free_g, + if(H5P__register_real(pclass, H5D_XFER_VLEN_FREE_NAME, H5D_XFER_VLEN_FREE_SIZE, &H5D_def_vlen_free_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen free information property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &H5D_def_vlen_free_info_g, + if(H5P__register_real(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &H5D_def_vlen_free_info_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vector size property */ - if(H5P_register_real(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &H5D_def_hyp_vec_size_g, + if(H5P__register_real(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &H5D_def_hyp_vec_size_g, NULL, NULL, NULL, H5D_XFER_HYPER_VECTOR_SIZE_ENC, H5D_XFER_HYPER_VECTOR_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the I/O transfer mode properties */ - if(H5P_register_real(pclass, H5D_XFER_IO_XFER_MODE_NAME, H5D_XFER_IO_XFER_MODE_SIZE, &H5D_def_io_xfer_mode_g, + if(H5P__register_real(pclass, H5D_XFER_IO_XFER_MODE_NAME, H5D_XFER_IO_XFER_MODE_SIZE, &H5D_def_io_xfer_mode_g, NULL, NULL, NULL, H5D_XFER_IO_XFER_MODE_ENC, H5D_XFER_IO_XFER_MODE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE, &H5D_def_mpio_collective_opt_mode_g, + if(H5P__register_real(pclass, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE, &H5D_def_mpio_collective_opt_mode_g, NULL, NULL, NULL, H5D_XFER_MPIO_COLLECTIVE_OPT_ENC, H5D_XFER_MPIO_COLLECTIVE_OPT_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE, &H5D_def_mpio_chunk_opt_mode_g, + if(H5P__register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE, &H5D_def_mpio_chunk_opt_mode_g, NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_HARD_ENC, H5D_XFER_MPIO_CHUNK_OPT_HARD_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE, &H5D_def_mpio_chunk_opt_num_g, + if(H5P__register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE, &H5D_def_mpio_chunk_opt_num_g, NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_NUM_ENC, H5D_XFER_MPIO_CHUNK_OPT_NUM_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE, &H5D_def_mpio_chunk_opt_ratio_g, + if(H5P__register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE, &H5D_def_mpio_chunk_opt_ratio_g, NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_RATIO_ENC, H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the chunk optimization mode property. */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE, &H5D_def_mpio_actual_chunk_opt_mode_g, + if(H5P__register_real(pclass, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE, &H5D_def_mpio_actual_chunk_opt_mode_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the actual I/O mode property. */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_IO_MODE_NAME, H5D_MPIO_ACTUAL_IO_MODE_SIZE, &H5D_def_mpio_actual_io_mode_g, + if(H5P__register_real(pclass, H5D_MPIO_ACTUAL_IO_MODE_NAME, H5D_MPIO_ACTUAL_IO_MODE_SIZE, &H5D_def_mpio_actual_io_mode_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the local cause of broken collective I/O */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g, + if(H5P__register_real(pclass, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the global cause of broken collective I/O */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g, + if(H5P__register_real(pclass, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the EDC property */ - if(H5P_register_real(pclass, H5D_XFER_EDC_NAME, H5D_XFER_EDC_SIZE, &H5D_def_enable_edc_g, + if(H5P__register_real(pclass, H5D_XFER_EDC_NAME, H5D_XFER_EDC_SIZE, &H5D_def_enable_edc_g, NULL, NULL, NULL, H5D_XFER_EDC_ENC, H5D_XFER_EDC_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the filter callback property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_FILTER_CB_NAME, H5D_XFER_FILTER_CB_SIZE, &H5D_def_filter_cb_g, + if(H5P__register_real(pclass, H5D_XFER_FILTER_CB_NAME, H5D_XFER_FILTER_CB_SIZE, &H5D_def_filter_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the type conversion callback property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_CONV_CB_NAME, H5D_XFER_CONV_CB_SIZE, &H5D_def_conv_cb_g, + if(H5P__register_real(pclass, H5D_XFER_CONV_CB_NAME, H5D_XFER_CONV_CB_SIZE, &H5D_def_conv_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the data transform property */ - if(H5P_register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &H5D_def_xfer_xform_g, + if(H5P__register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &H5D_def_xfer_xform_g, NULL, H5D_XFER_XFORM_SET, H5D_XFER_XFORM_GET, H5D_XFER_XFORM_ENC, H5D_XFER_XFORM_DEC, H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, H5D_XFER_XFORM_CMP, H5D_XFER_XFORM_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index 73c48d7..8b9962f 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -428,7 +428,7 @@ H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf, /* Iterate over all properties in property list, encoding them */ idx = 0; - if(H5P_iterate_plist(plist, enc_all_prop, &idx, H5P__encode_cb, &udata) < 0) + if(H5P__iterate_plist(plist, enc_all_prop, &idx, H5P__encode_cb, &udata) < 0) HGOTO_ERROR(H5E_PLIST, H5E_BADITER, FAIL, "can't iterate over properties") /* Encode a terminator for list of properties */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 7ba9c11..923c792 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -39,14 +39,18 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory Management */ #include "H5Ppkg.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ -/* Includes needed to set as default file driver */ -#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ +/* Includes needed to set default file driver */ +#include "H5FDsec2.h" /* POSIX unbuffered I/O */ #include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS #include "H5FDwindows.h" /* Win32 I/O */ #endif +/* Includes needed to set default VOL connector */ +#include "H5VLnative.h" /* Native VOL connector */ + /****************/ /* Local Macros */ @@ -131,10 +135,11 @@ * property only used by h5repart */ #define H5F_ACS_FAMILY_NEWSIZE_SIZE sizeof(hsize_t) #define H5F_ACS_FAMILY_NEWSIZE_DEF 0 -/* Definition for whether to convert family to sec2 driver. It's private - * property only used by h5repart */ -#define H5F_ACS_FAMILY_TO_SEC2_SIZE sizeof(hbool_t) -#define H5F_ACS_FAMILY_TO_SEC2_DEF FALSE +/* Definition for whether to convert family to a single-file driver. + * It's a private property only used by h5repart. + */ +#define H5F_ACS_FAMILY_TO_SINGLE_SIZE sizeof(hbool_t) +#define H5F_ACS_FAMILY_TO_SINGLE_DEF FALSE /* Definition for data type in multi file driver */ #define H5F_ACS_MULTI_TYPE_SIZE sizeof(H5FD_mem_t) #define H5F_ACS_MULTI_TYPE_DEF H5FD_MEM_DEFAULT @@ -258,6 +263,16 @@ #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF 0 #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC H5P__encode_unsigned #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC H5P__decode_unsigned +/* Definition for file VOL connector properties (ID, etc.) */ +#define H5F_ACS_VOL_CONN_SIZE sizeof(H5VL_connector_prop_t) +#define H5F_ACS_VOL_CONN_DEF {H5_DEFAULT_VOL, NULL} +#define H5F_ACS_VOL_CONN_CRT H5P__facc_vol_create +#define H5F_ACS_VOL_CONN_SET H5P__facc_vol_set +#define H5F_ACS_VOL_CONN_GET H5P__facc_vol_get +#define H5F_ACS_VOL_CONN_DEL H5P__facc_vol_del +#define H5F_ACS_VOL_CONN_COPY H5P__facc_vol_copy +#define H5F_ACS_VOL_CONN_CMP H5P__facc_vol_cmp +#define H5F_ACS_VOL_CONN_CLOSE H5P__facc_vol_close /******************/ @@ -320,6 +335,15 @@ static int H5P__facc_cache_image_config_cmp(const void *_config1, const void *_c static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value); +/* VOL connector callbacks */ +static herr_t H5P__facc_vol_create(const char *name, size_t size, void *value); +static herr_t H5P__facc_vol_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_vol_get(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_vol_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_vol_copy(const char *name, size_t size, void *value); +static int H5P__facc_vol_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__facc_vol_close(const char *name, size_t size, void *value); + /*********************/ /* Package Variables */ @@ -368,7 +392,7 @@ static const unsigned H5F_def_gc_ref_g = H5F_ACS_GARBG_COLCT_REF_DEF; static const H5F_close_degree_t H5F_def_close_degree_g = H5F_CLOSE_DEGREE_DEF; /* Default file close degree */ static const hsize_t H5F_def_family_offset_g = H5F_ACS_FAMILY_OFFSET_DEF; /* Default offset for family VFD */ static const hsize_t H5F_def_family_newsize_g = H5F_ACS_FAMILY_NEWSIZE_DEF; /* Default size of new files for family VFD */ -static const hbool_t H5F_def_family_to_sec2_g = H5F_ACS_FAMILY_TO_SEC2_DEF; /* Default ?? for family VFD */ +static const hbool_t H5F_def_family_to_single_g = H5F_ACS_FAMILY_TO_SINGLE_DEF; /* Default ?? for family VFD */ static const H5FD_mem_t H5F_def_mem_type_g = H5F_ACS_MULTI_TYPE_DEF; /* Default file space type for multi VFD */ static const H5F_libver_t H5F_def_libver_low_bound_g = H5F_ACS_LIBVER_LOW_BOUND_DEF; /* Default setting for "low" bound of format version */ @@ -398,7 +422,7 @@ static const size_t H5F_def_page_buf_size_g = H5F_ACS_PAGE_BUFFER_SIZE_DEF; static const unsigned H5F_def_page_buf_min_meta_perc_g = H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEF; /* Default page buffer minimum metadata size */ static const unsigned H5F_def_page_buf_min_raw_perc_g = H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF; /* Default page buffer mininum raw data size */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_reg_prop * @@ -414,115 +438,116 @@ static herr_t H5P__facc_reg_prop(H5P_genclass_t *pclass) { const H5FD_driver_prop_t def_driver_prop = H5F_ACS_FILE_DRV_DEF; /* Default VFL driver ID & info (initialized from a variable) */ + const H5VL_connector_prop_t def_vol_prop = H5F_ACS_VOL_CONN_DEF; /* Default VOL connector ID & info (initialized from a variable) */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Register the initial metadata cache resize configuration */ - if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g, + if(H5P__register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g, NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_CONFIG_DEC, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache (elements) */ - if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &H5F_def_rdcc_nslots_g, + if(H5P__register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &H5F_def_rdcc_nslots_g, NULL, NULL, NULL, H5F_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5F_ACS_DATA_CACHE_NUM_SLOTS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache(bytes) */ - if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &H5F_def_rdcc_nbytes_g, + if(H5P__register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &H5F_def_rdcc_nbytes_g, NULL, NULL, NULL, H5F_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the preemption for reading chunks */ - if(H5P_register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &H5F_def_rdcc_w0_g, + if(H5P__register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &H5F_def_rdcc_w0_g, NULL, NULL, NULL, H5F_ACS_PREEMPT_READ_CHUNKS_ENC, H5F_ACS_PREEMPT_READ_CHUNKS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the threshold for alignment */ - if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g, + if(H5P__register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g, NULL, NULL, NULL, H5F_ACS_ALIGN_THRHD_ENC, H5F_ACS_ALIGN_THRHD_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the alignment */ - if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g, + if(H5P__register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g, NULL, NULL, NULL, H5F_ACS_ALIGN_ENC, H5F_ACS_ALIGN_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum metadata allocation block size */ - if(H5P_register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &H5F_def_meta_block_size_g, + if(H5P__register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &H5F_def_meta_block_size_g, NULL, NULL, NULL, H5F_ACS_META_BLOCK_SIZE_ENC, H5F_ACS_META_BLOCK_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the maximum sieve buffer size */ - if(H5P_register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &H5F_def_sieve_buf_size_g, + if(H5P__register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &H5F_def_sieve_buf_size_g, NULL, NULL, NULL, H5F_ACS_SIEVE_BUF_SIZE_ENC, H5F_ACS_SIEVE_BUF_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum "small data" allocation block size */ - if(H5P_register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &H5F_def_sdata_block_size_g, + if(H5P__register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &H5F_def_sdata_block_size_g, NULL, NULL, NULL, H5F_ACS_SDATA_BLOCK_SIZE_ENC, H5F_ACS_SDATA_BLOCK_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the garbage collection reference */ - if(H5P_register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &H5F_def_gc_ref_g, + if(H5P__register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &H5F_def_gc_ref_g, NULL, NULL, NULL, H5F_ACS_GARBG_COLCT_REF_ENC, H5F_ACS_GARBG_COLCT_REF_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file driver ID & info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop, + if(H5P__register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop, H5F_ACS_FILE_DRV_CRT, H5F_ACS_FILE_DRV_SET, H5F_ACS_FILE_DRV_GET, NULL, NULL, H5F_ACS_FILE_DRV_DEL, H5F_ACS_FILE_DRV_COPY, H5F_ACS_FILE_DRV_CMP, H5F_ACS_FILE_DRV_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file close degree */ - if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g, + if(H5P__register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g, NULL, NULL, NULL, H5F_CLOSE_DEGREE_ENC, H5F_CLOSE_DEGREE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the offset of family driver info */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &H5F_def_family_offset_g, + if(H5P__register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &H5F_def_family_offset_g, NULL, NULL, NULL, H5F_ACS_FAMILY_OFFSET_ENC, H5F_ACS_FAMILY_OFFSET_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of new family file size. It's used by h5repart only. */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &H5F_def_family_newsize_g, + if(H5P__register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &H5F_def_family_newsize_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */ + /* Register the private property of whether convert family to a single-file driver. It's used by h5repart only. */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_g, + if(H5P__register_real(pclass, H5F_ACS_FAMILY_TO_SINGLE_NAME, H5F_ACS_FAMILY_TO_SINGLE_SIZE, &H5F_def_family_to_single_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the data type of multi driver info */ - if(H5P_register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g, + if(H5P__register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g, NULL, NULL, NULL, H5F_ACS_MULTI_TYPE_ENC, H5F_ACS_MULTI_TYPE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 'low' bound of library format versions */ - if(H5P_register_real(pclass, H5F_ACS_LIBVER_LOW_BOUND_NAME, H5F_ACS_LIBVER_LOW_BOUND_SIZE, &H5F_def_libver_low_bound_g, + if(H5P__register_real(pclass, H5F_ACS_LIBVER_LOW_BOUND_NAME, H5F_ACS_LIBVER_LOW_BOUND_SIZE, &H5F_def_libver_low_bound_g, NULL, NULL, NULL, H5F_ACS_LIBVER_LOW_BOUND_ENC, H5F_ACS_LIBVER_LOW_BOUND_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 'high' bound of library format versions */ - if(H5P_register_real(pclass, H5F_ACS_LIBVER_HIGH_BOUND_NAME, H5F_ACS_LIBVER_HIGH_BOUND_SIZE, &H5F_def_libver_high_bound_g, + if(H5P__register_real(pclass, H5F_ACS_LIBVER_HIGH_BOUND_NAME, H5F_ACS_LIBVER_HIGH_BOUND_SIZE, &H5F_def_libver_high_bound_g, NULL, NULL, NULL, H5F_ACS_LIBVER_HIGH_BOUND_ENC, H5F_ACS_LIBVER_HIGH_BOUND_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -530,125 +555,132 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) /* Register the private property of whether to retrieve the file descriptor from the core VFD */ /* (used internally to the library only) */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g, + if(H5P__register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the external file cache size */ - if(H5P_register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &H5F_def_efc_size_g, + if(H5P__register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &H5F_def_efc_size_g, NULL, NULL, NULL, H5F_ACS_EFC_SIZE_ENC, H5F_ACS_EFC_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the initial file image info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, + if(H5P__register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, NULL, H5F_ACS_FILE_IMAGE_INFO_SET, H5F_ACS_FILE_IMAGE_INFO_GET, NULL, NULL, H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, H5F_ACS_FILE_IMAGE_INFO_CMP, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the core VFD backing store write tracking flag */ - if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g, + if(H5P__register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g, NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC, H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the core VFD backing store page size */ - if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g, + if(H5P__register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g, NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the # of read attempts */ - if(H5P_register_real(pclass, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, H5F_ACS_METADATA_READ_ATTEMPTS_SIZE, &H5F_def_metadata_read_attempts_g, + if(H5P__register_real(pclass, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, H5F_ACS_METADATA_READ_ATTEMPTS_SIZE, &H5F_def_metadata_read_attempts_g, NULL, NULL, NULL, H5F_ACS_METADATA_READ_ATTEMPTS_ENC, H5F_ACS_METADATA_READ_ATTEMPTS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register object flush callback */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_OBJECT_FLUSH_CB_NAME, H5F_ACS_OBJECT_FLUSH_CB_SIZE, &H5F_def_object_flush_cb_g, + if(H5P__register_real(pclass, H5F_ACS_OBJECT_FLUSH_CB_NAME, H5F_ACS_OBJECT_FLUSH_CB_SIZE, &H5F_def_object_flush_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether to clear the superblock status_flags. It's used by h5clear only. */ - if(H5P_register_real(pclass, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, H5F_ACS_CLEAR_STATUS_FLAGS_SIZE, &H5F_def_clear_status_flags_g, + if(H5P__register_real(pclass, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, H5F_ACS_CLEAR_STATUS_FLAGS_SIZE, &H5F_def_clear_status_flags_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether to skip EOF check. It's used by h5clear only. */ - if(H5P_register_real(pclass, H5F_ACS_SKIP_EOF_CHECK_NAME, H5F_ACS_SKIP_EOF_CHECK_SIZE, &H5F_def_skip_eof_check_g, + if(H5P__register_real(pclass, H5F_ACS_SKIP_EOF_CHECK_NAME, H5F_ACS_SKIP_EOF_CHECK_SIZE, &H5F_def_skip_eof_check_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether to drop free-space to the floor. It's used by h5clear only. */ - if(H5P_register_real(pclass, H5F_ACS_NULL_FSM_ADDR_NAME, H5F_ACS_NULL_FSM_ADDR_SIZE, &H5F_def_null_fsm_addr_g, + if(H5P__register_real(pclass, H5F_ACS_NULL_FSM_ADDR_NAME, H5F_ACS_NULL_FSM_ADDR_SIZE, &H5F_def_null_fsm_addr_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the metadata cache logging flag. */ - if(H5P_register_real(pclass, H5F_ACS_USE_MDC_LOGGING_NAME, H5F_ACS_USE_MDC_LOGGING_SIZE, &H5F_def_use_mdc_logging_g, + if(H5P__register_real(pclass, H5F_ACS_USE_MDC_LOGGING_NAME, H5F_ACS_USE_MDC_LOGGING_SIZE, &H5F_def_use_mdc_logging_g, NULL, NULL, NULL, H5F_ACS_USE_MDC_LOGGING_ENC, H5F_ACS_USE_MDC_LOGGING_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the metadata cache log location. */ - if(H5P_register_real(pclass, H5F_ACS_MDC_LOG_LOCATION_NAME, H5F_ACS_MDC_LOG_LOCATION_SIZE, &H5F_def_mdc_log_location_g, + if(H5P__register_real(pclass, H5F_ACS_MDC_LOG_LOCATION_NAME, H5F_ACS_MDC_LOG_LOCATION_SIZE, &H5F_def_mdc_log_location_g, NULL, NULL, NULL, H5F_ACS_MDC_LOG_LOCATION_ENC, H5F_ACS_MDC_LOG_LOCATION_DEC, H5F_ACS_MDC_LOG_LOCATION_DEL, H5F_ACS_MDC_LOG_LOCATION_COPY, H5F_ACS_MDC_LOG_LOCATION_CMP, H5F_ACS_MDC_LOG_LOCATION_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the flag that indicates whether mdc logging starts on file access. */ - if(H5P_register_real(pclass, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, H5F_ACS_START_MDC_LOG_ON_ACCESS_SIZE, &H5F_def_start_mdc_log_on_access_g, + if(H5P__register_real(pclass, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, H5F_ACS_START_MDC_LOG_ON_ACCESS_SIZE, &H5F_def_start_mdc_log_on_access_g, NULL, NULL, NULL, H5F_ACS_START_MDC_LOG_ON_ACCESS_ENC, H5F_ACS_START_MDC_LOG_ON_ACCESS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the evict on close flag */ - if(H5P_register_real(pclass, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE, &H5F_def_evict_on_close_flag_g, + if(H5P__register_real(pclass, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE, &H5F_def_evict_on_close_flag_g, NULL, NULL, NULL, H5F_ACS_EVICT_ON_CLOSE_FLAG_ENC, H5F_ACS_EVICT_ON_CLOSE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ - if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, + if(H5P__register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the metadata collective write flag */ - if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g, + if(H5P__register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g, NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #endif /* H5_HAVE_PARALLEL */ /* Register the initial metadata cache image configuration */ - if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE, &H5F_def_mdc_initCacheImageCfg_g, + if(H5P__register_real(pclass, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE, &H5F_def_mdc_initCacheImageCfg_g, NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEC, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the page buffer size */ - if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_SIZE_NAME, H5F_ACS_PAGE_BUFFER_SIZE_SIZE, &H5F_def_page_buf_size_g, + if(H5P__register_real(pclass, H5F_ACS_PAGE_BUFFER_SIZE_NAME, H5F_ACS_PAGE_BUFFER_SIZE_SIZE, &H5F_def_page_buf_size_g, NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_SIZE_ENC, H5F_ACS_PAGE_BUFFER_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the page buffer minimum metadata size */ - if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE, &H5F_def_page_buf_min_meta_perc_g, + if(H5P__register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE, &H5F_def_page_buf_min_meta_perc_g, NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the page buffer minimum raw data size */ - if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE, &H5F_def_page_buf_min_raw_perc_g, + if(H5P__register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE, &H5F_def_page_buf_min_raw_perc_g, NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the file VOL connector ID & info */ + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P__register_real(pclass, H5F_ACS_VOL_CONN_NAME, H5F_ACS_VOL_CONN_SIZE, &def_vol_prop, + H5F_ACS_VOL_CONN_CRT, H5F_ACS_VOL_CONN_SET, H5F_ACS_VOL_CONN_GET, NULL, NULL, + H5F_ACS_VOL_CONN_DEL, H5F_ACS_VOL_CONN_COPY, H5F_ACS_VOL_CONN_CMP, H5F_ACS_VOL_CONN_CLOSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_reg_prop() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_alignment * @@ -706,7 +738,7 @@ done: FUNC_LEAVE_API(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5Pget_alignment * @@ -747,7 +779,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_alignment() */ - + /*------------------------------------------------------------------------- * Function: H5P_set_driver * @@ -795,7 +827,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_set_driver() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_driver * @@ -838,7 +870,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_driver() */ - + /*------------------------------------------------------------------------- * Function: H5P_peek_driver * @@ -882,7 +914,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_peek_driver() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_driver * @@ -923,7 +955,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_driver() */ - + /*------------------------------------------------------------------------- * Function: H5P_peek_driver_info * @@ -965,7 +997,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_peek_driver_info() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_driver_info * @@ -1005,7 +1037,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_driver_info() */ - + /*------------------------------------------------------------------------- * Function: H5P__file_driver_copy * @@ -1071,7 +1103,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__file_driver_copy() */ - + /*------------------------------------------------------------------------- * Function: H5P__file_driver_free * @@ -1123,7 +1155,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__file_driver_free() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_create * @@ -1152,7 +1184,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_create() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_set * @@ -1185,7 +1217,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_set() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_get * @@ -1218,7 +1250,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_get() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_del * @@ -1247,7 +1279,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_del() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_copy * @@ -1276,7 +1308,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_copy() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_cmp * @@ -1335,7 +1367,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_close * @@ -1364,7 +1396,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_close() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_family_offset * @@ -1403,7 +1435,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_family_offset() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_family_offset * @@ -1444,7 +1476,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_family_offset() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_multi_type * @@ -1483,7 +1515,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_multi_type() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_multi_type * @@ -1524,7 +1556,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_multi_type() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_cache * @@ -1578,7 +1610,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_cache() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_cache * @@ -1630,7 +1662,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_cache() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_mdc_image_config * @@ -1674,7 +1706,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pset_mdc_image_config() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_mdc_image_config * @@ -1725,7 +1757,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pget_mdc_image_config() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_mdc_config * @@ -1769,7 +1801,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pset_mdc_config() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_mdc_config * @@ -1820,7 +1852,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pget_mdc_config() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_gc_references * @@ -1873,7 +1905,7 @@ done: FUNC_LEAVE_API(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5Pget_gc_references * @@ -1916,7 +1948,7 @@ done: FUNC_LEAVE_API(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5Pset_fclose_degree * @@ -1952,7 +1984,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_fclose_degree() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_fclose_degree * @@ -1987,7 +2019,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_fclose_degree() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_meta_block_size * @@ -2038,7 +2070,7 @@ done: FUNC_LEAVE_API(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5Pget_meta_block_size * @@ -2082,7 +2114,7 @@ done: FUNC_LEAVE_API(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5Pset_sieve_buf_size * @@ -2133,7 +2165,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_sieve_buf_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_sieve_buf_size * @@ -2176,7 +2208,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_sieve_buf_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_small_data_block_size * @@ -2222,7 +2254,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_small_data_block_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_small_data_block_size * @@ -2261,7 +2293,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_small_data_block_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_libver_bounds * @@ -2403,14 +2435,14 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_libver_bounds() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_libver_bounds * - * Purpose: Returns the current settings for the library version format bounds - * from a file access property list. + * Purpose: Returns the current settings for the library version format bounds + * from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Thursday, January 3, 2008 @@ -2446,7 +2478,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_libver_bounds() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_elink_file_cache_size * @@ -2484,7 +2516,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_elink_file_cache_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_elink_file_cache_size * @@ -2523,7 +2555,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_elink_file_cache_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_file_image * @@ -2604,7 +2636,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_file_image() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_file_image * @@ -2693,7 +2725,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_file_image */ - + /*------------------------------------------------------------------------- * Function: H5Pset_file_image_callbacks * @@ -2770,7 +2802,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_file_image_callbacks() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_file_image_callbacks * @@ -2826,7 +2858,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_file_image_callbacks() */ - + /*------------------------------------------------------------------------- * Function: H5P__file_image_info_copy * @@ -2904,7 +2936,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__file_image_info_copy() */ - + /*------------------------------------------------------------------------- * Function: H5P__file_image_info_free * @@ -2959,7 +2991,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__file_image_info_free() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_image_config_cmp * @@ -3002,7 +3034,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_cache_image_config_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_image_config_enc * @@ -3048,7 +3080,7 @@ H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_cache_image_config_enc() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_image_config_dec * @@ -3100,7 +3132,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_cache_image_config_dec() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_set * @@ -3133,7 +3165,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_set() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_get * @@ -3166,7 +3198,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_get() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_del * @@ -3197,7 +3229,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_del() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_copy * @@ -3227,7 +3259,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_copy() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_cmp * @@ -3286,7 +3318,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_close * @@ -3316,7 +3348,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_close() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_config_cmp * @@ -3428,7 +3460,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_cache_config_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_config_enc * @@ -3573,7 +3605,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_cache_config_enc() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_config_dec * @@ -3708,7 +3740,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_cache_config_dec() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_fclose_degree_enc * @@ -3746,7 +3778,7 @@ H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_fclose_degree_enc() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_fclose_degree_dec * @@ -3781,7 +3813,7 @@ H5P__facc_fclose_degree_dec(const void **_pp, void *_value) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_fclose_degree_dec() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_multi_type_enc * @@ -3819,7 +3851,7 @@ H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_multi_type_enc() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_multi_type_dec * @@ -3854,7 +3886,7 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_multi_type_dec() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_libver_type_enc * @@ -3966,7 +3998,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_core_write_tracking() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_core_write_tracking * @@ -4008,7 +4040,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_core_write_tracking() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_metadata_read_attempts * @@ -4051,7 +4083,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pset_metadata_read_attempts() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_metadata_read_attempts * @@ -4092,7 +4124,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_metadata_read_attempts() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_obj_flush_cb * @@ -4136,7 +4168,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pset_obj_flush_cb() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_obj_flush_cb * @@ -4177,7 +4209,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pget_obj_flush_cb() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_mdc_log_options * @@ -4229,7 +4261,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_mdc_log_options() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_mdc_log_options * @@ -4284,7 +4316,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_mdc_log_options() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_enc * @@ -4337,7 +4369,7 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P_facc_mdc_log_location_enc() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_dec * @@ -4391,7 +4423,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_facc_mdc_log_location_dec() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_del * @@ -4414,7 +4446,7 @@ H5P_facc_mdc_log_location_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_U FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P_facc_mdc_log_location_del() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_copy * @@ -4436,7 +4468,7 @@ H5P_facc_mdc_log_location_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_U FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P_facc_mdc_log_location_copy() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_cmp * @@ -4468,7 +4500,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_facc_mdc_log_location_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_close * @@ -4491,7 +4523,7 @@ H5P_facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P_facc_mdc_log_location_close() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_evict_on_close * @@ -4539,7 +4571,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_evict_on_close() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_evict_on_close * @@ -4583,7 +4615,7 @@ done: } /* end H5Pget_evict_on_close() */ #ifdef H5_HAVE_PARALLEL - + /*------------------------------------------------------------------------- * Function: H5P__encode_coll_md_read_flag_t * @@ -4621,7 +4653,7 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__encode_coll_md_read_flag_t() */ - + /*------------------------------------------------------------------------- * Function: H5P__decode_coll_md_read_flag_t * @@ -4655,7 +4687,7 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__decode_coll_md_read_flag_t() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_all_coll_metadata_ops * @@ -4714,7 +4746,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_all_coll_metadata_ops() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_all_coll_metadata_ops * @@ -4772,7 +4804,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pget_all_coll_metadata_ops */ - + /*------------------------------------------------------------------------- * Function: H5Pset_coll_metadata_write * @@ -4811,7 +4843,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_coll_metadata_write() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_coll_metadata_write * @@ -4849,7 +4881,7 @@ done: } /* end H5Pget_coll_metadata_write() */ #endif /* H5_HAVE_PARALLEL */ - + /*------------------------------------------------------------------------- * Function: H5Pset_page_buffer_size * @@ -4897,7 +4929,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_page_buffer_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_page_buffer_size * @@ -4939,3 +4971,408 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_page_buffer_size() */ + +/*------------------------------------------------------------------------- + * Function: H5P_set_vol + * + * Purpose: Set the VOL connector for a file access property list + * (PLIST_ID). The VOL properties will + * be copied into the property list and the reference count on + * the VOL will be incremented. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == H5I_object_verify(vol_id, H5I_VOL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { + H5VL_connector_prop_t vol_prop; /* Property for VOL ID & info */ + + /* Prepare the VOL connector property */ + vol_prop.connector_id = vol_id; + vol_prop.connector_info = vol_info; + + /* Set the connector ID & info property */ + if(H5P_set(plist, H5F_ACS_VOL_CONN_NAME, &vol_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL connector ID & info") + } /* end if */ + else + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_set_vol() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_vol + * + * Purpose: Set the file VOL connector (VOL_ID) for a file access + * property list (PLIST_ID) + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "ii*x", plist_id, new_vol_id, new_vol_info); + + /* Check arguments */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + if(NULL == H5I_object_verify(new_vol_id, H5I_VOL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file VOL ID") + + /* Set the VOL */ + if(H5P_set_vol(plist, new_vol_id, new_vol_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_vol() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_vol_id + * + * Purpose: Returns the ID of the current VOL connector. + * This ID should be closed with H5VLclose(). + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_vol_id(hid_t plist_id, hid_t *vol_id) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*i", plist_id, vol_id); + + /* Get property list for ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get the current VOL ID */ + if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + + /* Get the connector property */ + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector info") + + /* Increment the VOL ID's ref count */ + if(H5I_inc_ref(connector_prop.connector_id, TRUE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID") + + /* Set the connector ID to return */ + *vol_id = connector_prop.connector_id; + } /* end if */ + else + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_vol_id() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_vol_info + * + * Purpose: Returns a copy of the VOL info for a connector. + * This information should be freed with H5VLfree_connector_info. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_vol_info(hid_t plist_id, void **vol_info) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i**x", plist_id, vol_info); + + /* Get property list for ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get the current VOL info */ + if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { + void *new_connector_info = NULL; /* Copy of connector info */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + + /* Get the connector property */ + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector property") + + /* Copy connector info, if it exists */ + if(connector_prop.connector_info) { + H5VL_class_t *connector; /* Pointer to connector */ + + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop.connector_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Allocate and copy connector info */ + if(H5VL_copy_connector_info(connector, &new_connector_info, connector_prop.connector_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed") + } /* end if */ + + /* Set the connector info */ + *vol_info = new_connector_info; + } /* end if */ + else + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_vol_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_vol_create + * + connectorose: Create callback for the VOL connector ID & info property. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_vol_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Make copy of the VOL connector */ + if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_vol_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_vol_set + * + * Purpose: Copies a VOL connector property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_vol_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of VOL connector ID & info */ + if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_vol_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_vol_get + * + * Purpose: Copies a VOL connector property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_vol_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of VOL connector */ + if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_vol_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_vol_del + * + * Purpose: Frees memory used to store the VOL connector ID & info property + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_vol_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Free the VOL connector ID & info */ + if(H5VL_conn_free((H5VL_connector_prop_t *)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_vol_del() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_vol_copy + * + * Purpose: Copy callback for the VOL connector ID & info property. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_vol_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Make copy of VOL connector */ + if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_vol_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_vol_cmp + * + * Purpose: Callback routine which is called whenever the VOL connector + * ID & info property in the file access property list + * is compared. + * + * Return: positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. + * + *------------------------------------------------------------------------- + */ +static int +H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED size) +{ + const H5VL_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 */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(info1); + HDassert(info2); + HDassert(size == sizeof(H5VL_connector_prop_t)); + + /* Compare connectors */ + if(NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->connector_id))) + HGOTO_DONE(-1) + if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->connector_id))) + HGOTO_DONE(1) + status = H5VL_cmp_connector_cls(&cmp_value, cls1, cls2); + HDassert(status >= 0); + if(cmp_value != 0) + HGOTO_DONE(cmp_value); + + /* At this point, we should be able to assume that we are dealing with + * the same connector class struct (or a copies of the same class struct) + */ + + + /* Use one of the classes (cls1) info comparison routines to compare the + * info objects + */ + HDassert(cls1->info_cmp == cls2->info_cmp); + status = H5VL_cmp_connector_info(cls1, &cmp_value, info1->connector_info, info2->connector_info); + HDassert(status >= 0); + + /* Set return value */ + ret_value = cmp_value; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_vol_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_vol_close + * + * Purpose: Close callback for the VOL connector ID & info property. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_vol_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Free the VOL connector */ + if(H5VL_conn_free((H5VL_connector_prop_t *)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_vol_close() */ + + diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index f90dae5..56af8b1 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -36,7 +36,6 @@ #include "H5Bprivate.h" /* B-tree subclass names */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ -#include "H5SMprivate.h" /* Shared object header messages */ #include "H5Ppkg.h" /* Property lists */ @@ -213,85 +212,85 @@ H5P_fcrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT /* Register the user block size */ - if(H5P_register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &H5F_def_userblock_size_g, + if(H5P__register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &H5F_def_userblock_size_g, NULL, NULL, NULL, H5F_CRT_USER_BLOCK_ENC, H5F_CRT_USER_BLOCK_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 1/2 rank for symbol table leaf nodes */ - if(H5P_register_real(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &H5F_def_sym_leaf_k_g, + if(H5P__register_real(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &H5F_def_sym_leaf_k_g, NULL, NULL, NULL, H5F_CRT_SYM_LEAF_ENC, H5F_CRT_SYM_LEAF_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 1/2 rank for btree internal nodes */ - if(H5P_register_real(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, H5F_def_btree_k_g, + if(H5P__register_real(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, H5F_def_btree_k_g, NULL, NULL, NULL, H5F_CRT_BTREE_RANK_ENC, H5F_CRT_BTREE_RANK_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the byte number for an address */ - if(H5P_register_real(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &H5F_def_sizeof_addr_g, + if(H5P__register_real(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &H5F_def_sizeof_addr_g, NULL, NULL, NULL, H5F_CRT_ADDR_BYTE_NUM_ENC, H5F_CRT_ADDR_BYTE_NUM_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the byte number for object size */ - if(H5P_register_real(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &H5F_def_sizeof_size_g, + if(H5P__register_real(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &H5F_def_sizeof_size_g, NULL, NULL, NULL, H5F_CRT_OBJ_BYTE_NUM_ENC, H5F_CRT_OBJ_BYTE_NUM_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the superblock version number */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &H5F_def_superblock_ver_g, + if(H5P__register_real(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &H5F_def_superblock_ver_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the shared OH message information */ - if(H5P_register_real(pclass, H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &H5F_def_num_sohm_indexes_g, + if(H5P__register_real(pclass, H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &H5F_def_num_sohm_indexes_g, NULL, NULL, NULL, H5F_CRT_SHMSG_NINDEXES_ENC, H5F_CRT_SHMSG_NINDEXES_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &H5F_def_sohm_index_flags_g, + if(H5P__register_real(pclass, H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &H5F_def_sohm_index_flags_g, NULL, NULL, NULL, H5F_CRT_SHMSG_INDEX_TYPES_ENC, H5F_CRT_SHMSG_INDEX_TYPES_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &H5F_def_sohm_index_minsizes_g, + if(H5P__register_real(pclass, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &H5F_def_sohm_index_minsizes_g, NULL, NULL, NULL, H5F_CRT_SHMSG_INDEX_MINSIZE_ENC, H5F_CRT_SHMSG_INDEX_MINSIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the shared OH cutoff size information */ - if(H5P_register_real(pclass, H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &H5F_def_sohm_list_max_g, + if(H5P__register_real(pclass, H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &H5F_def_sohm_list_max_g, NULL, NULL, NULL, H5F_CRT_SHMSG_LIST_MAX_ENC, H5F_CRT_SHMSG_LIST_MAX_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &H5F_def_sohm_btree_min_g, + if(H5P__register_real(pclass, H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &H5F_def_sohm_btree_min_g, NULL, NULL, NULL, H5F_CRT_SHMSG_BTREE_MIN_ENC, H5F_CRT_SHMSG_BTREE_MIN_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file space handling strategy */ - if(H5P_register_real(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &H5F_def_file_space_strategy_g, + if(H5P__register_real(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &H5F_def_file_space_strategy_g, NULL, NULL, NULL, H5F_CRT_FILE_SPACE_STRATEGY_ENC, H5F_CRT_FILE_SPACE_STRATEGY_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the free-space persist flag */ - if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_PERSIST_NAME, H5F_CRT_FREE_SPACE_PERSIST_SIZE, &H5F_def_free_space_persist_g, + if(H5P__register_real(pclass, H5F_CRT_FREE_SPACE_PERSIST_NAME, H5F_CRT_FREE_SPACE_PERSIST_SIZE, &H5F_def_free_space_persist_g, NULL, NULL, NULL, H5F_CRT_FREE_SPACE_PERSIST_ENC, H5F_CRT_FREE_SPACE_PERSIST_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the free space section threshold */ - if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &H5F_def_free_space_threshold_g, + if(H5P__register_real(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &H5F_def_free_space_threshold_g, NULL, NULL, NULL, H5F_CRT_FREE_SPACE_THRESHOLD_ENC, H5F_CRT_FREE_SPACE_THRESHOLD_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file space page size */ - if(H5P_register_real(pclass, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, H5F_CRT_FILE_SPACE_PAGE_SIZE_SIZE, &H5F_def_file_space_page_size_g, + if(H5P__register_real(pclass, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, H5F_CRT_FILE_SPACE_PAGE_SIZE_SIZE, &H5F_def_file_space_page_size_g, NULL, NULL, NULL, H5F_CRT_FILE_SPACE_PAGE_SIZE_ENC, H5F_CRT_FILE_SPACE_PAGE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c index e858a79..1e39749 100644 --- a/src/H5Pfmpl.c +++ b/src/H5Pfmpl.c @@ -124,7 +124,7 @@ H5P_fmnt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT /* Register property of whether symlinks is local to file */ - if(H5P_register_real(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &H5F_def_local_g, + if(H5P__register_real(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &H5F_def_local_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 6f1fab1..ab289e4 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -32,12 +32,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Ppkg.h" /* Property lists */ /****************/ @@ -128,22 +128,28 @@ static const H5O_linfo_t H5G_def_linfo_g = H5G_CRT_LINK_INFO_DEF; /* Defaul static herr_t H5P__gcrt_reg_prop(H5P_genclass_t *pclass) { + hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Register group info property */ - if(H5P_register_real(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, &H5G_def_ginfo_g, + if(H5P__register_real(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, &H5G_def_ginfo_g, NULL, NULL, NULL, H5G_CRT_GROUP_INFO_ENC, H5G_CRT_GROUP_INFO_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register link info property */ - if(H5P_register_real(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, &H5G_def_linfo_g, + if(H5P__register_real(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, &H5G_def_linfo_g, NULL, NULL, NULL, H5G_CRT_LINK_INFO_ENC, H5G_CRT_LINK_INFO_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the lcpl ID property */ + if(H5P__register_real(pclass, H5VL_PROP_GRP_LCPL_ID, sizeof(hid_t), &lcpl_id, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__gcrt_reg_prop() */ diff --git a/src/H5Pint.c b/src/H5Pint.c index 6a0cc14..e2ae792 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -100,11 +100,23 @@ typedef herr_t (*H5P_do_pclass_op_t)(H5P_genplist_t *plist, const char *name, H5 /********************/ /* General helper routines */ -static H5P_genprop_t *H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type); -static herr_t H5P_free_prop(H5P_genprop_t *prop); -static int H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2); +static H5P_genplist_t *H5P__create(H5P_genclass_t *pclass); +static H5P_genprop_t *H5P__create_prop(const char *name, size_t size, H5P_prop_within_t type, + const void *value, H5P_prp_create_func_t prp_create, + H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, + H5P_prp_delete_func_t prp_delete, + H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, + H5P_prp_close_func_t prp_close); +static H5P_genprop_t *H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type); +static herr_t H5P__free_prop(H5P_genprop_t *prop); +static int H5P__cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2); static herr_t H5P__do_prop(H5P_genplist_t *plist, const char *name, H5P_do_plist_op_t plist_op, H5P_do_pclass_op_t pclass_op, void *udata); +static int H5P__open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key); +static H5P_genprop_t *H5P__find_prop_pclass(H5P_genclass_t *pclass, const char *name); +static herr_t H5P__free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data); +static herr_t H5P__free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data); /*********************/ @@ -336,7 +348,7 @@ static const H5I_class_t H5I_GENPROPCLS_CLS[1] = {{ H5I_GENPROP_CLS, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5P_close_class /* Callback routine for closing objects of this class */ + (H5I_free_t)H5P__close_class /* Callback routine for closing objects of this class */ }}; /* Generic Property List ID class */ @@ -425,7 +437,7 @@ H5P__init_package(void) HDassert(lib_class->par_pclass || lib_class == H5P_CLS_ROOT); /* Allocate the new class */ - if(NULL == (*lib_class->pclass = H5P_create_class(lib_class->par_pclass ? *lib_class->par_pclass : NULL, lib_class->name, lib_class->type, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data))) + if(NULL == (*lib_class->pclass = H5P__create_class(lib_class->par_pclass ? *lib_class->par_pclass : NULL, lib_class->name, lib_class->type, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data))) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") /* Call routine to register properties for class */ @@ -626,14 +638,14 @@ H5P__do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Property callback failed") /* Make a copy of the class's property */ - if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST))) + if(NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") /* Copy the changed value into the new property */ HDmemcpy(pcopy->value, tmp_value, prop->size); /* Insert the changed property into the property list */ - if(H5P_add_prop(slist, pcopy) < 0) + if(H5P__add_prop(slist, pcopy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into skip list") done: @@ -644,7 +656,7 @@ done: /* Cleanup on failure */ if(ret_value < 0) if(pcopy) - H5P_free_prop(pcopy); + H5P__free_prop(pcopy); FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__do_prop_cb1() */ @@ -652,11 +664,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_copy_pclass + H5P__copy_pclass PURPOSE Internal routine to copy a generic property class USAGE - hid_t H5P_copy_pclass(pclass) + hid_t H5P__copy_pclass(pclass) H5P_genclass_t *pclass; IN: Property class to copy RETURNS Success: valid property class ID on success (non-negative) @@ -671,13 +683,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ H5P_genclass_t * -H5P_copy_pclass(H5P_genclass_t *pclass) +H5P__copy_pclass(H5P_genclass_t *pclass) { H5P_genclass_t *new_pclass = NULL; /* Property list class copied */ H5P_genprop_t *pcopy; /* Copy of property to insert into class */ H5P_genclass_t *ret_value=NULL; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(pclass); @@ -686,7 +698,7 @@ H5P_copy_pclass(H5P_genclass_t *pclass) */ /* Create the new property list class */ - if(NULL == (new_pclass = H5P_create_class(pclass->parent, pclass->name, pclass->type, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data))) + if(NULL == (new_pclass = H5P__create_class(pclass->parent, pclass->name, pclass->type, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "unable to create property list class") /* Copy the properties registered for this class */ @@ -697,11 +709,11 @@ H5P_copy_pclass(H5P_genclass_t *pclass) curr_node=H5SL_first(pclass->props); while(curr_node!=NULL) { /* Make a copy of the class's property */ - if(NULL == (pcopy = H5P_dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS))) + if(NULL == (pcopy = H5P__dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL,"Can't copy property") /* Insert the initialized property into the property list */ - if(H5P_add_prop(new_pclass->props,pcopy) < 0) + if(H5P__add_prop(new_pclass->props,pcopy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, NULL,"Can't insert property into class") /* Increment property count for class */ @@ -716,11 +728,11 @@ H5P_copy_pclass(H5P_genclass_t *pclass) ret_value=new_pclass; done: - if(ret_value==NULL && new_pclass) - H5P_close_class(new_pclass); + if(NULL == ret_value && new_pclass) + H5P__close_class(new_pclass); FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_copy_pclass() */ +} /* H5P__copy_pclass() */ /*-------------------------------------------------------------------------- @@ -733,7 +745,7 @@ done: hid_t old_plist_id; IN: Property list ID to copy RETURNS Success: valid property list ID on success (non-negative) - Failure: negative + Failure: H5I_INVALID_HID DESCRIPTION Copy a property list and return the ID. This routine calls the class 'copy' callback after any property 'copy' callbacks are called @@ -756,9 +768,9 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) H5SL_t *seen=NULL; /* Skip list containing properties already seen */ size_t nseen; /* Number of items 'seen' */ hbool_t has_parent_class; /* Flag to indicate that this property list's class has a parent */ - hid_t ret_value=FAIL; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) HDassert(old_plist); @@ -768,7 +780,7 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Allocate room for the property list */ if(NULL==(new_plist = H5FL_CALLOC(H5P_genplist_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,"memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") /* Set class state */ new_plist->pclass = old_plist->pclass; @@ -777,80 +789,80 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Initialize the skip list to hold the changed properties */ if((new_plist->props = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for changed properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "can't create skip list for changed properties") /* Create the skip list for deleted properties */ if((new_plist->del = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for deleted properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "can't create skip list for deleted properties") /* Create the skip list to hold names of properties already seen * (This prevents a property in the class hierarchy from having it's * 'create' callback called, if a property in the class hierarchy has * already been seen) */ - if((seen = H5SL_create(H5SL_TYPE_STR, NULL))== NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for seen properties") + if((seen = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "can't create skip list for seen properties") nseen = 0; /* Cycle through the deleted properties & copy them into the new list's deleted section */ - if(H5SL_count(old_plist->del)>0) { - curr_node=H5SL_first(old_plist->del); + if(H5SL_count(old_plist->del) > 0) { + curr_node = H5SL_first(old_plist->del); while(curr_node) { char *new_name; /* Pointer to new name */ /* Duplicate string for insertion into new deleted property skip list */ - if((new_name=H5MM_xstrdup((char *)H5SL_item(curr_node))) == NULL) - HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"memory allocation failed") + if((new_name = H5MM_xstrdup((char *)H5SL_item(curr_node))) == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") /* Insert property name into deleted list */ if(H5SL_insert(new_plist->del,new_name,new_name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into deleted skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into deleted skip list") /* Add property name to "seen" list */ if(H5SL_insert(seen,new_name,new_name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into seen skip list") nseen++; /* Get the next property node in the skip list */ - curr_node=H5SL_next(curr_node); + curr_node = H5SL_next(curr_node); } /* end while */ } /* end if */ /* Cycle through the properties and copy them also */ - if(H5SL_count(old_plist->props)>0) { - curr_node=H5SL_first(old_plist->props); + if(H5SL_count(old_plist->props) > 0) { + curr_node = H5SL_first(old_plist->props); while(curr_node) { /* Get a pointer to the node's property */ tmp = (H5P_genprop_t *)H5SL_item(curr_node); /* Make a copy of the list's property */ - if(NULL == (new_prop = H5P_dup_prop(tmp, H5P_PROP_WITHIN_LIST))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property") + if(NULL == (new_prop = H5P__dup_prop(tmp, H5P_PROP_WITHIN_LIST))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't copy property") /* Call property copy callback, if it exists */ if(new_prop->copy) { if((new_prop->copy)(new_prop->name,new_prop->size,new_prop->value) < 0) { - H5P_free_prop(new_prop); - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property") + H5P__free_prop(new_prop); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't copy property") } /* end if */ } /* end if */ /* Insert the initialized property into the property list */ - if(H5P_add_prop(new_plist->props,new_prop) < 0) { - H5P_free_prop(new_prop); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into list") + if(H5P__add_prop(new_plist->props,new_prop) < 0) { + H5P__free_prop(new_prop); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "Can't insert property into list") } /* end if */ /* Add property name to "seen" list */ if(H5SL_insert(seen,new_prop->name,new_prop->name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into seen skip list") nseen++; /* Increment the number of properties in list */ new_plist->nprops++; /* Get the next property node in the skip list */ - curr_node=H5SL_next(curr_node); + curr_node = H5SL_next(curr_node); } /* end while */ } /* end if */ @@ -860,27 +872,27 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) */ tclass=old_plist->pclass; has_parent_class = (hbool_t)(tclass != NULL && tclass->parent != NULL && tclass->parent->nprops > 0); - while(tclass!=NULL) { + while(tclass != NULL) { if(tclass->nprops>0) { /* Walk through the properties in the old class */ - curr_node=H5SL_first(tclass->props); + curr_node = H5SL_first(tclass->props); while(curr_node!=NULL) { /* Get pointer to property from node */ tmp = (H5P_genprop_t *)H5SL_item(curr_node); /* Only "copy" properties we haven't seen before */ - if(nseen==0 || H5SL_search(seen,tmp->name) == NULL) { + if(nseen == 0 || H5SL_search(seen,tmp->name) == NULL) { /* Call property copy callback, if it exists */ if(tmp->copy) { /* Call the callback & insert changed value into skip list (if necessary) */ if(H5P__do_prop_cb1(new_plist->props, tmp, tmp->copy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't create property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't create property") } /* end if */ /* Add property name to "seen" list, if we have other classes to work on */ if(has_parent_class) { if(H5SL_insert(seen,tmp->name,tmp->name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into seen skip list") nseen++; } /* end if */ @@ -889,24 +901,24 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) } /* end if */ /* Get the next property node in the skip list */ - curr_node=H5SL_next(curr_node); + curr_node = H5SL_next(curr_node); } /* end while */ } /* end if */ /* Go up to parent class */ - tclass=tclass->parent; + tclass = tclass->parent; } /* end while */ /* Increment the number of property lists derived from class */ - if(H5P_access_class(new_plist->pclass, H5P_MOD_INC_LST) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't increment class ref count") + if(H5P__access_class(new_plist->pclass, H5P_MOD_INC_LST) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't increment class ref count") /* Get an atom for the property list */ if((new_plist_id = H5I_register(H5I_GENPROP_LST, new_plist, app_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list") /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */ - new_plist->plist_id=new_plist_id; + new_plist->plist_id = new_plist_id; /* Call the class callback (if it exists) now that we have the property list ID * (up through chain of parent classes also) @@ -917,7 +929,7 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) if((tclass->copy_func)(new_plist_id, old_plist->plist_id, old_plist->pclass->copy_data) < 0) { /* Delete ID, ignore return value */ H5I_remove(new_plist_id); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't initialize property") } /* end if */ } /* end if */ @@ -933,10 +945,10 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) done: /* Release the list of 'seen' properties */ - if(seen!=NULL) + if(seen != NULL) H5SL_close(seen); - if(ret_value<0 && new_plist) + if(H5I_INVALID_HID == ret_value && new_plist) H5P_close(new_plist); FUNC_LEAVE_NOAPI(ret_value) @@ -945,11 +957,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_dup_prop + H5P__dup_prop PURPOSE Internal routine to duplicate a property USAGE - H5P_genprop_t *H5P_dup_prop(oprop) + H5P_genprop_t *H5P__dup_prop(oprop) H5P_genprop_t *oprop; IN: Pointer to property to copy H5P_prop_within_t type; IN: Type of object the property will be inserted into RETURNS @@ -963,12 +975,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5P_genprop_t * -H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) +H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) { H5P_genprop_t *prop = NULL; /* Pointer to new property copied */ H5P_genprop_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(oprop); HDassert(type != H5P_PROP_WITHIN_UNKNOWN); @@ -1037,16 +1049,16 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_dup_prop() */ +} /* H5P__dup_prop() */ /*-------------------------------------------------------------------------- NAME - H5P_create_prop + H5P__create_prop PURPOSE Internal routine to create a new property USAGE - H5P_genprop_t *H5P_create_prop(name,size,type,value,prp_create,prp_set, + H5P_genprop_t *H5P__create_prop(name,size,type,value,prp_create,prp_set, prp_get,prp_delete,prp_close, prp_encode, prp_decode) const char *name; IN: Name of property to register size_t size; IN: Size of property in bytes @@ -1074,7 +1086,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5P_genprop_t * -H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, +H5P__create_prop(const char *name, size_t size, H5P_prop_within_t type, const void *value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, @@ -1085,7 +1097,7 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, H5P_genprop_t *prop = NULL; /* Pointer to new property copied */ H5P_genprop_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(name); HDassert((size > 0 && value != NULL) || (size == 0)); @@ -1141,16 +1153,16 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_create_prop() */ +} /* H5P__create_prop() */ /*-------------------------------------------------------------------------- NAME - H5P_add_prop + H5P__add_prop PURPOSE Internal routine to insert a property into a property skip list USAGE - herr_t H5P_add_prop(slist, prop) + herr_t H5P__add_prop(slist, prop) H5SL_t *slist; IN/OUT: Pointer to skip list of properties H5P_genprop_t *prop; IN: Pointer to property to insert RETURNS @@ -1163,11 +1175,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_add_prop(H5SL_t *slist, H5P_genprop_t *prop) +H5P__add_prop(H5SL_t *slist, H5P_genprop_t *prop) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE HDassert(slist); HDassert(prop); @@ -1179,7 +1191,7 @@ H5P_add_prop(H5SL_t *slist, H5P_genprop_t *prop) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_add_prop() */ +} /* H5P__add_prop() */ /*-------------------------------------------------------------------------- @@ -1244,11 +1256,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_find_prop_pclass + H5P__find_prop_pclass PURPOSE Internal routine to check for a property in a class skip list USAGE - H5P_genprop_t *H5P_find_prop_class(pclass, name) + H5P_genprop_t *H5P__find_prop_class(pclass, name) H5P_genclass *pclass; IN: Pointer generic property class to check const char *name; IN: Name of property to check for RETURNS @@ -1261,11 +1273,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5P_genprop_t * -H5P_find_prop_pclass(H5P_genclass_t *pclass, const char *name) +H5P__find_prop_pclass(H5P_genclass_t *pclass, const char *name) { H5P_genprop_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(pclass); HDassert(name); @@ -1276,16 +1288,16 @@ H5P_find_prop_pclass(H5P_genclass_t *pclass, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_find_prop_pclass() */ +} /* H5P__find_prop_pclass() */ /*-------------------------------------------------------------------------- NAME - H5P_free_prop + H5P__free_prop PURPOSE Internal routine to destroy a property node USAGE - herr_t H5P_free_prop(prop) + herr_t H5P__free_prop(prop) H5P_genprop_t *prop; IN: Pointer to property to destroy RETURNS Returns non-negative on success, negative on failure. @@ -1298,9 +1310,9 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P_free_prop(H5P_genprop_t *prop) +H5P__free_prop(H5P_genprop_t *prop) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(prop); @@ -1315,16 +1327,16 @@ H5P_free_prop(H5P_genprop_t *prop) prop = H5FL_FREE(H5P_genprop_t, prop); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5P_free_prop() */ +} /* H5P__free_prop() */ /*-------------------------------------------------------------------------- NAME - H5P_free_prop_cb + H5P__free_prop_cb PURPOSE Internal routine to properties from a property skip list USAGE - herr_t H5P_free_prop_cb(item, key, op_data) + herr_t H5P__free_prop_cb(item, key, op_data) void *item; IN/OUT: Pointer to property void *key; IN/OUT: Pointer to property key void *_make_cb; IN: Whether to make property callbacks or not @@ -1339,12 +1351,12 @@ H5P_free_prop(H5P_genprop_t *prop) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P_free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) +H5P__free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) { H5P_genprop_t *tprop=(H5P_genprop_t *)item; /* Temporary pointer to property */ hbool_t make_cb = *(hbool_t *)op_data; /* Whether to make property 'close' callback */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(tprop); @@ -1353,19 +1365,19 @@ H5P_free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) (tprop->close)(tprop->name, tprop->size, tprop->value); /* Free the property, ignoring return value, nothing we can do */ - H5P_free_prop(tprop); + H5P__free_prop(tprop); FUNC_LEAVE_NOAPI(0) -} /* H5P_free_prop_cb() */ +} /* H5P__free_prop_cb() */ /*-------------------------------------------------------------------------- NAME - H5P_free_del_name_cb + H5P__free_del_name_cb PURPOSE Internal routine to free 'deleted' property name USAGE - herr_t H5P_free_del_name_cb(item, key, op_data) + herr_t H5P__free_del_name_cb(item, key, op_data) void *item; IN/OUT: Pointer to deleted name void *key; IN/OUT: Pointer to key void *op_data; IN: Operator callback data (unused) @@ -1379,11 +1391,11 @@ H5P_free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) +H5P__free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) { char *del_name=(char *)item; /* Temporary pointer to deleted name */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(del_name); @@ -1391,17 +1403,17 @@ H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED * H5MM_xfree(del_name); FUNC_LEAVE_NOAPI(0) -} /* H5P_free_del_name_cb() */ +} /* H5P__free_del_name_cb() */ /*-------------------------------------------------------------------------- NAME - H5P_access_class + H5P__access_class PURPOSE - Internal routine to increment or decrement list & class dependencies on a + Internal routine to increment or decrement list & class dependancies on a property list class USAGE - herr_t H5P_access_class(pclass,mod) + herr_t H5P__access_class(pclass,mod) H5P_genclass_t *pclass; IN: Pointer to class to modify H5P_class_mod_t mod; IN: Type of modification to class RETURNS @@ -1417,9 +1429,9 @@ H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED * REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) +H5P__access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(pclass); HDassert(mod > H5P_MOD_ERR && mod < H5P_MOD_MAX); @@ -1473,27 +1485,27 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) if(pclass->props) { hbool_t make_cb = FALSE; - H5SL_destroy(pclass->props, H5P_free_prop_cb, &make_cb); + H5SL_destroy(pclass->props, H5P__free_prop_cb, &make_cb); } /* end if */ pclass = H5FL_FREE(H5P_genclass_t, pclass); /* Reduce the number of dependent classes on parent class also */ if(par_class != NULL) - H5P_access_class(par_class, H5P_MOD_DEC_CLS); + H5P__access_class(par_class, H5P_MOD_DEC_CLS); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5P_access_class() */ +} /* H5P__access_class() */ /*-------------------------------------------------------------------------- NAME - H5P_open_class_path_cb + H5P__open_class_path_cb PURPOSE Internal callback routine to check for duplicated names in parent class. USAGE - int H5P_open_class_path_cb(obj, id, key) + int H5P__open_class_path_cb(obj, id, key) H5P_genclass_t *obj; IN: Pointer to class hid_t id; IN: ID of object being looked at const void *key; IN: Pointer to information used to compare @@ -1509,13 +1521,13 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) REVISION LOG --------------------------------------------------------------------------*/ static int -H5P_open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key) +H5P__open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key) { H5P_genclass_t *obj = (H5P_genclass_t *)_obj; /* Pointer to the class for this ID */ H5P_check_class_t *key = (H5P_check_class_t *)_key; /* Pointer to key information for comparison */ int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(obj); HDassert(H5I_GENPROP_CLS == H5I_get_type(id)); @@ -1531,16 +1543,16 @@ H5P_open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key) } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_open_class_path_cb() */ +} /* end H5P__open_class_path_cb() */ /*-------------------------------------------------------------------------- NAME - H5P_create_class + H5P__create_class PURPOSE Internal routine to create a new property list class. USAGE - H5P_genclass_t H5P_create_class(par_class, name, type, + H5P_genclass_t H5P__create_class(par_class, name, type, cls_create, create_data, cls_close, close_data) H5P_genclass_t *par_class; IN: Pointer to parent class const char *name; IN: Name of class we are creating @@ -1568,7 +1580,7 @@ H5P_open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key) REVISION LOG --------------------------------------------------------------------------*/ H5P_genclass_t * -H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type, +H5P__create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type, H5P_cls_create_func_t cls_create, void *create_data, H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data) @@ -1576,7 +1588,7 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t t H5P_genclass_t *pclass = NULL; /* Property list class created */ H5P_genclass_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_PACKAGE HDassert(name); /* Allow internal classes to break some rules */ @@ -1614,7 +1626,7 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t t /* Increment parent class's derived class value */ if(par_class != NULL) { - if(H5P_access_class(par_class, H5P_MOD_INC_CLS) < 0) + if(H5P__access_class(par_class, H5P_MOD_INC_CLS) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, NULL, "Can't increment parent class ref count") } /* end if */ @@ -1630,22 +1642,22 @@ done: if(pclass->props) { hbool_t make_cb = FALSE; - H5SL_destroy(pclass->props, H5P_free_prop_cb, &make_cb); + H5SL_destroy(pclass->props, H5P__free_prop_cb, &make_cb); } /* end if */ pclass = H5FL_FREE(H5P_genclass_t, pclass); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_create_class() */ +} /* H5P__create_class() */ /*-------------------------------------------------------------------------- NAME - H5P_create + H5P__create PURPOSE Internal routine to create a new property list of a property list class. USAGE - H5P_genplist_t *H5P_create(class) + H5P_genplist_t *H5P__create(class) H5P_genclass_t *class; IN: Property list class create list from RETURNS Returns a pointer to the newly created property list on success, @@ -1665,7 +1677,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5P_genplist_t * -H5P_create(H5P_genclass_t *pclass) +H5P__create(H5P_genclass_t *pclass) { H5P_genclass_t *tclass; /* Temporary class pointer */ H5P_genplist_t *plist = NULL; /* New property list created */ @@ -1673,7 +1685,7 @@ H5P_create(H5P_genclass_t *pclass) H5SL_t *seen = NULL; /* Skip list to hold names of properties already seen */ H5P_genplist_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(pclass); @@ -1748,7 +1760,7 @@ H5P_create(H5P_genclass_t *pclass) } /* end while */ /* Increment the number of property lists derived from class */ - if(H5P_access_class(plist->pclass,H5P_MOD_INC_LST) < 0) + if(H5P__access_class(plist->pclass,H5P_MOD_INC_LST) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, NULL,"Can't increment class ref count") /* Set return value */ @@ -1766,7 +1778,7 @@ done: if(plist->props) { unsigned make_cb=1; - H5SL_destroy(plist->props,H5P_free_prop_cb,&make_cb); + H5SL_destroy(plist->props, H5P__free_prop_cb, &make_cb); } /* end if */ /* Close the deleted property skip list */ @@ -1779,7 +1791,7 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_create() */ +} /* H5P__create() */ /*-------------------------------------------------------------------------- @@ -1791,7 +1803,7 @@ done: hid_t H5P_create_id(pclass) H5P_genclass_t *pclass; IN: Property list class create list from RETURNS - Returns a valid property list ID on success, FAIL on failure. + Returns a valid property list ID on success, H5I_INVALID_HID on failure. DESCRIPTION Creates a property list of a given class. If a 'create' callback exists for the property list class, it is called before the @@ -1812,20 +1824,20 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) hid_t plist_id = FAIL; /* Property list ID */ hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) HDassert(pclass); /* Create the new property list */ - if((plist=H5P_create(pclass)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list") + if((plist = H5P__create(pclass)) == NULL) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list") /* Get an atom for the property list */ if((plist_id = H5I_register(H5I_GENPROP_LST, plist, app_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list") /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */ - plist->plist_id=plist_id; + plist->plist_id = plist_id; /* Call the class callback (if it exists) now that we have the property list ID * (up through chain of parent classes also) @@ -1836,7 +1848,7 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) if((tclass->create_func)(plist_id, tclass->create_data) < 0) { /* Delete ID, ignore return value */ H5I_remove(plist_id); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't initialize property") } /* end if */ } /* end if */ @@ -1848,10 +1860,10 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) plist->class_init = TRUE; /* Set the return value */ - ret_value=plist_id; + ret_value = plist_id; done: - if(ret_value<0 && plist) + if(H5I_INVALID_HID == ret_value && plist) H5P_close(plist); FUNC_LEAVE_NOAPI(ret_value) @@ -1860,11 +1872,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_register_real + H5P__register_real PURPOSE Internal routine to register a new property in a property list class. USAGE - herr_t H5P_register_real(class, name, size, default, prp_create, prp_set, + herr_t H5P__register_real(class, name, size, default, prp_create, prp_set, prp_get, prp_close, prp_encode, prp_decode) H5P_genclass_t *class; IN: Property list class to modify const char *name; IN: Name of property to register @@ -2043,7 +2055,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, +H5P__register_real(H5P_genclass_t *pclass, const char *name, size_t size, const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, @@ -2054,7 +2066,7 @@ H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, H5P_genprop_t *new_prop = NULL; /* Temporary property pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE HDassert(pclass); HDassert(0 == pclass->plists); @@ -2067,13 +2079,13 @@ H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists") /* Create property object from parameters */ - if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_CLASS, + if(NULL == (new_prop = H5P__create_prop(name, size, H5P_PROP_WITHIN_CLASS, def_value, prp_create, prp_set, prp_get, prp_encode, prp_decode, prp_delete, prp_copy, prp_cmp, prp_close))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property") /* Insert property into property list class */ - if(H5P_add_prop(pclass->props, new_prop) < 0) + if(H5P__add_prop(pclass->props, new_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class") /* Increment property count for class */ @@ -2084,20 +2096,20 @@ H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, done: if(ret_value < 0) - if(new_prop && H5P_free_prop(new_prop) < 0) + if(new_prop && H5P__free_prop(new_prop) < 0) HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close property") FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_register_real() */ +} /* H5P__register_real() */ /*-------------------------------------------------------------------------- NAME - H5P_register + H5P__register PURPOSE Internal routine to register a new property in a property list class. USAGE - herr_t H5P_register(class, name, size, default, prp_create, prp_set, prp_get, prp_close) + herr_t H5P__register(class, name, size, default, prp_create, prp_set, prp_get, prp_close) H5P_genclass_t **class; IN: Property list class to modify const char *name; IN: Name of property to register size_t size; IN: Size of property in bytes @@ -2275,7 +2287,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, +H5P__register(H5P_genclass_t **ppclass, const char *name, size_t size, const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, @@ -2287,7 +2299,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, H5P_genclass_t *new_class = NULL; /* New class pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(ppclass); @@ -2297,7 +2309,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, * been created since the last modification was made to the class. */ if(pclass->plists > 0 || pclass->classes > 0) { - if(NULL == (new_class = H5P_create_class(pclass->parent, pclass->name, + if(NULL == (new_class = H5P__create_class(pclass->parent, pclass->name, pclass->type, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data))) @@ -2313,11 +2325,11 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, H5P_genprop_t *pcopy; /* Property copy */ /* Make a copy of the class's property */ - if(NULL == (pcopy = H5P_dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS))) + if(NULL == (pcopy = H5P__dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") /* Insert the initialized property into the property class */ - if(H5P_add_prop(new_class->props, pcopy) < 0) + if(H5P__add_prop(new_class->props, pcopy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class") /* Increment property count for class */ @@ -2333,7 +2345,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, } /* end if */ /* Really register the property in the class */ - if(H5P_register_real(pclass, name, size, def_value, prp_create, prp_set, prp_get, + if(H5P__register_real(pclass, name, size, def_value, prp_create, prp_set, prp_get, prp_encode, prp_decode, prp_delete, prp_copy, prp_cmp, prp_close) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't register property") @@ -2343,11 +2355,11 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, done: if(ret_value < 0) - if(new_class && H5P_close_class(new_class) < 0) + if(new_class && H5P__close_class(new_class) < 0) HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close new property class") FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_register() */ +} /* H5P__register() */ /*-------------------------------------------------------------------------- @@ -2570,13 +2582,13 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, /* Ok to add to property list */ /* Create property object from parameters */ - if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_LIST, value, NULL, + if(NULL == (new_prop = H5P__create_prop(name, size, H5P_PROP_WITHIN_LIST, value, NULL, prp_set, prp_get, prp_encode, prp_decode, prp_delete, prp_copy, prp_cmp, prp_close))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "Can't create property") /* Insert property into property list class */ - if(H5P_add_prop(plist->props, new_prop) < 0) + if(H5P__add_prop(plist->props, new_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into class") /* Increment property count for class */ @@ -2584,7 +2596,7 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, done: if(ret_value < 0) - if(new_prop && H5P_free_prop(new_prop) < 0) + if(new_prop && H5P__free_prop(new_prop) < 0) HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close property") FUNC_LEAVE_NOAPI(ret_value) @@ -2764,20 +2776,20 @@ H5P__poke_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") /* Make a copy of the class's property */ - if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST))) + if(NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") HDmemcpy(pcopy->value, udata->value, pcopy->size); /* Insert the changed property into the property list */ - if(H5P_add_prop(plist->props, pcopy) < 0) + if(H5P__add_prop(plist->props, pcopy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") done: /* Cleanup on failure */ if(ret_value < 0) if(pcopy) - H5P_free_prop(pcopy); + H5P__free_prop(pcopy); FUNC_LEAVE_NOAPI(ret_value) } /* H5P__poke_pclass_cb() */ @@ -2970,13 +2982,13 @@ H5P__set_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, prp_value = udata->value; /* Make a copy of the class's property */ - if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST))) + if(NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") HDmemcpy(pcopy->value, prp_value, pcopy->size); /* Insert the changed property into the property list */ - if(H5P_add_prop(plist->props, pcopy) < 0) + if(H5P__add_prop(plist->props, pcopy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") done: @@ -2987,7 +2999,7 @@ done: /* Cleanup on failure */ if(ret_value < 0) if(pcopy) - H5P_free_prop(pcopy); + H5P__free_prop(pcopy); FUNC_LEAVE_NOAPI(ret_value) } /* H5P__set_pclass_cb() */ @@ -3109,11 +3121,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_exist_pclass + H5P__exist_pclass PURPOSE Internal routine to query the existance of a property in a property class. USAGE - herr_t H5P_exist_pclass(pclass, name) + herr_t H5P__exist_pclass(pclass, name) H5P_genclass_t *pclass; IN: Property class to check const char *name; IN: Name of property to check for RETURNS @@ -3129,11 +3141,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5P_exist_pclass(H5P_genclass_t *pclass, const char *name) +H5P__exist_pclass(H5P_genclass_t *pclass, const char *name) { htri_t ret_value = FAIL; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(pclass); HDassert(name); @@ -3159,16 +3171,16 @@ H5P_exist_pclass(H5P_genclass_t *pclass, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_exist_pclass() */ +} /* H5P__exist_pclass() */ /*-------------------------------------------------------------------------- NAME - H5P_get_size_plist + H5P__get_size_plist PURPOSE Internal routine to query the size of a property in a property list. USAGE - herr_t H5P_get_size_plist(plist, name) + herr_t H5P__get_size_plist(plist, name) const H5P_genplist_t *plist; IN: Property list to check const char *name; IN: Name of property to query size_t *size; OUT: Size of property @@ -3185,12 +3197,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size) +H5P__get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size) { H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(plist); HDassert(name); @@ -3205,16 +3217,16 @@ H5P_get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get_size_plist() */ +} /* H5P__get_size_plist() */ /*-------------------------------------------------------------------------- NAME - H5P_get_size_pclass + H5P__get_size_pclass PURPOSE Internal routine to query the size of a property in a property class. USAGE - herr_t H5P_get_size_pclass(pclass, name) + herr_t H5P__get_size_pclass(pclass, name) H5P_genclass_t *pclass; IN: Property class to check const char *name; IN: Name of property to query size_t *size; OUT: Size of property @@ -3231,36 +3243,36 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size) +H5P__get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size) { H5P_genprop_t *prop; /* Temporary property pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(pclass); HDassert(name); HDassert(size); /* Find property */ - if((prop=H5P_find_prop_pclass(pclass,name)) == NULL) + if((prop = H5P__find_prop_pclass(pclass,name)) == NULL) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") /* Get property size */ - *size=prop->size; + *size = prop->size; done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get_size_pclass() */ +} /* H5P__get_size_pclass() */ /*-------------------------------------------------------------------------- NAME - H5P_get_nprops_plist + H5P__get_nprops_plist PURPOSE Internal routine to query the number of properties in a property list USAGE - herr_t H5P_get_nprops_plist(plist, nprops) + herr_t H5P__get_nprops_plist(plist, nprops) H5P_genplist_t *plist; IN: Property list to check size_t *nprops; OUT: Number of properties in the property list RETURNS @@ -3275,9 +3287,9 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops) +H5P__get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(plist); HDassert(nprops); @@ -3286,7 +3298,7 @@ H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops) *nprops = plist->nprops; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5P_get_nprops_plist() */ +} /* H5P__get_nprops_plist() */ /*-------------------------------------------------------------------------- @@ -3337,11 +3349,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_cmp_prop + H5P__cmp_prop PURPOSE Internal routine to compare two generic properties USAGE - int H5P_cmp_prop(prop1, prop2) + int H5P__cmp_prop(prop1, prop2) H5P_genprop_t *prop1; IN: 1st property to compare H5P_genprop_t *prop1; IN: 2nd property to compare RETURNS @@ -3358,12 +3370,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static int -H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2) +H5P__cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2) { int cmp_value; /* Value from comparison */ int ret_value = 0; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(prop1); HDassert(prop2); @@ -3432,16 +3444,16 @@ H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_cmp_prop() */ +} /* H5P__cmp_prop() */ /*-------------------------------------------------------------------------- NAME - H5P_cmp_class + H5P__cmp_class PURPOSE Internal routine to compare two generic property classes USAGE - int H5P_cmp_class(pclass1, pclass2) + int H5P__cmp_class(pclass1, pclass2) H5P_genclass_t *pclass1; IN: 1st property class to compare H5P_genclass_t *pclass2; IN: 2nd property class to compare RETURNS @@ -3458,13 +3470,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ int -H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) +H5P__cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) { H5SL_node_t *tnode1, *tnode2; /* Temporary pointer to property nodes */ int cmp_value; /* Value from comparison */ int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(pclass1); HDassert(pclass2); @@ -3528,7 +3540,7 @@ H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) /* Compare the two properties */ prop1 = (H5P_genprop_t *)H5SL_item(tnode1); prop2 = (H5P_genprop_t *)H5SL_item(tnode2); - if((cmp_value = H5P_cmp_prop(prop1, prop2)) != 0) + if((cmp_value = H5P__cmp_prop(prop1, prop2)) != 0) HGOTO_DONE(cmp_value); /* Advance the pointers */ @@ -3538,7 +3550,7 @@ H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_cmp_class() */ +} /* H5P__cmp_class() */ /*-------------------------------------------------------------------------- @@ -3588,7 +3600,7 @@ H5P__cmp_plist_cb(H5P_genprop_t *prop, void *_udata) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5_ITER_ERROR, "property doesn't exist") /* Compare the two properties */ - if((udata->cmp_value = H5P_cmp_prop(prop, prop2)) != 0) + if((udata->cmp_value = H5P__cmp_prop(prop, prop2)) != 0) HGOTO_DONE(H5_ITER_STOP); } /* end if */ else { @@ -3604,11 +3616,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_cmp_plist + H5P__cmp_plist PURPOSE Internal routine to compare two generic property lists USAGE - herr_t H5P_cmp_plist(plist1, plist2, cmp_ret) + herr_t H5P__cmp_plist(plist1, plist2, cmp_ret) H5P_genplist_t *plist1; IN: 1st property list to compare H5P_genplist_t *plist2; IN: 2nd property list to compare int *cmp_ret; OUT: Comparison value for two property lists @@ -3627,14 +3639,14 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, +H5P__cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, int *cmp_ret) { H5P_plist_cmp_ud_t udata; /* User data for callback */ int idx = 0; /* Index of property to begin with */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(plist1); HDassert(plist2); @@ -3665,7 +3677,7 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, udata.plist2 = plist2; /* Iterate over properties in first property list */ - if((ret_value = H5P_iterate_plist(plist1, TRUE, &idx, H5P__cmp_plist_cb, &udata)) < 0) + if((ret_value = H5P__iterate_plist(plist1, TRUE, &idx, H5P__cmp_plist_cb, &udata)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over list") if(ret_value != 0) { *cmp_ret = udata.cmp_value; @@ -3673,7 +3685,7 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, } /* end if */ /* Check the parent classes */ - if((*cmp_ret = H5P_cmp_class(plist1->pclass, plist2->pclass)) != 0) + if((*cmp_ret = H5P__cmp_class(plist1->pclass, plist2->pclass)) != 0) HGOTO_DONE(SUCCEED); /* Property lists must be equal, set comparison value to 0 */ @@ -3681,7 +3693,7 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_cmp_plist() */ +} /* H5P__cmp_plist() */ /*-------------------------------------------------------------------------- @@ -3718,7 +3730,7 @@ H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) HDassert(pclass2); /* Compare property classes */ - if(H5P_cmp_class(pclass1, pclass2) == 0) { + if(H5P__cmp_class(pclass1, pclass2) == 0) { HGOTO_DONE(TRUE); } else { /* Check if the class is derived, and walk up the chain, if so */ @@ -3931,11 +3943,11 @@ H5P__iterate_plist_pclass_cb(void *_item, void *_key, void *_udata) /*-------------------------------------------------------------------------- NAME - H5P_iterate_plist + H5P__iterate_plist PURPOSE Internal routine to iterate over the properties in a property list USAGE - int H5P_iterate_plist(plist, iter_all_prop, idx, cb_func, iter_data) + int H5P__iterate_plist(plist, iter_all_prop, idx, cb_func, iter_data) const H5P_genplist_t *plist; IN: Property list to iterate over hbool_t iter_all_prop; IN: Whether to iterate over all properties (TRUE), or just non-default (i.e. changed) @@ -3984,7 +3996,7 @@ iteration, the function's behavior is undefined. REVISION LOG --------------------------------------------------------------------------*/ int -H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, +H5P__iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, H5P_iterate_int_t cb_func, void *udata) { H5P_genclass_t *tclass; /* Temporary class pointer */ @@ -3993,7 +4005,7 @@ H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, int curr_idx = 0; /* Current iteration index */ int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(plist); @@ -4042,7 +4054,7 @@ done: H5SL_close(seen); FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_iterate_plist() */ +} /* H5P__iterate_plist() */ /*-------------------------------------------------------------------------- @@ -4098,11 +4110,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_iterate_pclass + H5P__iterate_pclass PURPOSE Internal routine to iterate over the properties in a property class USAGE - herr_t H5P_iterate_pclass(pclass, idx, cb_func, iter_data) + herr_t H5P__iterate_pclass(pclass, idx, cb_func, iter_data) const H5P_genpclass_t *pclass; IN: Property list class to iterate over int *idx; IN/OUT: Index of the property to begin with H5P_iterate_t cb_func; IN: Function pointer to function to be @@ -4148,14 +4160,14 @@ iteration, the function's behavior is undefined. REVISION LOG --------------------------------------------------------------------------*/ int -H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx, +H5P__iterate_pclass(const H5P_genclass_t *pclass, int *idx, H5P_iterate_int_t cb_func, void *udata) { H5P_iter_pclass_ud_t udata_int; /* User data for skip list iterator */ int curr_idx = 0; /* Current iteration index */ int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(pclass); @@ -4178,7 +4190,7 @@ done: *idx = curr_idx; FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_iterate_pclass() */ +} /* H5P__iterate_pclass() */ /*-------------------------------------------------------------------------- @@ -4450,7 +4462,7 @@ H5P__del_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove property from skip list") /* Free the property, ignoring return value, nothing we can do */ - H5P_free_prop(prop); + H5P__free_prop(prop); /* Decrement the number of properties in list */ plist->nprops--; @@ -4586,11 +4598,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_copy_prop_plist + H5P__copy_prop_plist PURPOSE Internal routine to copy a property from one list to another USAGE - herr_t H5P_copy_prop_plist(dst_plist, src_plist, name) + herr_t H5P__copy_prop_plist(dst_plist, src_plist, name) hid_t dst_id; IN: ID of destination property list or class hid_t src_id; IN: ID of source property list or class const char *name; IN: Name of property to copy @@ -4616,7 +4628,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) +H5P__copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) { H5P_genplist_t *dst_plist; /* Pointer to destination property list */ H5P_genplist_t *src_plist; /* Pointer to source property list */ @@ -4624,7 +4636,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) H5P_genprop_t *new_prop=NULL; /* Pointer to new property */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(name); @@ -4642,7 +4654,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) prop = H5P__find_prop_plist(src_plist, name); /* Make a copy of the source property */ - if((new_prop=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) + if((new_prop = H5P__dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property") /* Call property copy callback, if it exists */ @@ -4652,7 +4664,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) } /* end if */ /* Insert the initialized property into the property list */ - if(H5P_add_prop(dst_plist->props,new_prop) < 0) + if(H5P__add_prop(dst_plist->props,new_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into list") /* Increment the number of properties in list */ @@ -4664,7 +4676,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) prop = H5P__find_prop_plist(src_plist, name); /* Create property object from parameters */ - if(NULL == (new_prop = H5P_create_prop(prop->name, prop->size, H5P_PROP_WITHIN_LIST, prop->value, + if(NULL == (new_prop = H5P__create_prop(prop->name, prop->size, H5P_PROP_WITHIN_LIST, prop->value, prop->create, prop->set, prop->get, prop->encode, prop->decode, prop->del, prop->copy, prop->cmp, prop->close))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property") @@ -4676,7 +4688,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) } /* end if */ /* Insert property into property list class */ - if(H5P_add_prop(dst_plist->props, new_prop) < 0) + if(H5P__add_prop(dst_plist->props, new_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class") /* Increment property count for class */ @@ -4685,22 +4697,22 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) done: /* Cleanup, if necessary */ - if(ret_value<0) { - if(new_prop!=NULL) - H5P_free_prop(new_prop); + if(ret_value < 0) { + if(new_prop != NULL) + H5P__free_prop(new_prop); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_copy_prop_plist() */ +} /* H5P__copy_prop_plist() */ /*-------------------------------------------------------------------------- NAME - H5P_copy_prop_pclass + H5P__copy_prop_pclass PURPOSE Internal routine to copy a property from one class to another USAGE - herr_t H5P_copy_prop_pclass(dst_pclass, src_pclass, name) + herr_t H5P__copy_prop_pclass(dst_pclass, src_pclass, name) H5P_genclass_t *dst_pclass; IN: Pointer to destination class H5P_genclass_t *src_pclass; IN: Pointer to source class const char *name; IN: Name of property to copy @@ -4724,7 +4736,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) +H5P__copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) { H5P_genclass_t *src_pclass; /* Source property class, containing property to copy */ H5P_genclass_t *dst_pclass; /* Destination property class */ @@ -4732,7 +4744,7 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(name); @@ -4744,19 +4756,19 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "destination property class object doesn't exist") /* Get the property from the source */ - if(NULL == (prop = H5P_find_prop_pclass(src_pclass, name))) + if(NULL == (prop = H5P__find_prop_pclass(src_pclass, name))) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to locate property") /* If the property exists in the destination already */ - if(H5P_exist_pclass(dst_pclass, name)) { + if(H5P__exist_pclass(dst_pclass, name)) { /* Delete the old property from the destination class */ - if(H5P_unregister(dst_pclass, name) < 0) + if(H5P__unregister(dst_pclass, name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property") } /* end if */ /* Register the property into the destination */ orig_dst_pclass = dst_pclass; - if(H5P_register(&dst_pclass, name, prop->size, prop->value, prop->create, prop->set, prop->get, + if(H5P__register(&dst_pclass, name, prop->size, prop->value, prop->create, prop->set, prop->get, prop->encode, prop->decode, prop->del, prop->copy, prop->cmp, prop->close) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property") @@ -4770,7 +4782,7 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) HDassert(old_dst_pclass == orig_dst_pclass); /* Close the previous class */ - if(H5P_close_class(old_dst_pclass) < 0) + if(H5P__close_class(old_dst_pclass) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution") } /* end if */ @@ -4778,16 +4790,16 @@ done: /* Cleanup, if necessary */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_copy_prop_pclass() */ +} /* H5P__copy_prop_pclass() */ /*-------------------------------------------------------------------------- NAME - H5P_unregister + H5P__unregister PURPOSE Internal routine to remove a property from a property list class. USAGE - herr_t H5P_unregister(pclass, name) + herr_t H5P__unregister(pclass, name) H5P_genclass_t *pclass; IN: Property list class to modify const char *name; IN: Name of property to remove RETURNS @@ -4803,12 +4815,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_unregister(H5P_genclass_t *pclass, const char *name) +H5P__unregister(H5P_genclass_t *pclass, const char *name) { H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(pclass); HDassert(name); @@ -4822,7 +4834,7 @@ H5P_unregister(H5P_genclass_t *pclass, const char *name) HGOTO_ERROR(H5E_PLIST,H5E_CANTDELETE,FAIL,"can't remove property from skip list") /* Free the property, ignoring return value, nothing we can do */ - H5P_free_prop(prop); + H5P__free_prop(prop); /* Decrement the number of registered properties in class */ pclass->nprops--; @@ -4832,7 +4844,7 @@ H5P_unregister(H5P_genclass_t *pclass, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_unregister() */ +} /* H5P__unregister() */ /*-------------------------------------------------------------------------- @@ -4982,18 +4994,18 @@ H5P_close(void *_plist) } /* end while */ /* Decrement class's dependent property list value! */ - if(H5P_access_class(plist->pclass,H5P_MOD_DEC_LST) < 0) + if(H5P__access_class(plist->pclass,H5P_MOD_DEC_LST) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't decrement class ref count") /* Free the list of 'seen' properties */ H5SL_close(seen); - seen=NULL; + seen = NULL; /* Free the list of deleted property names */ - H5SL_destroy(plist->del,H5P_free_del_name_cb,NULL); + H5SL_destroy(plist->del, H5P__free_del_name_cb, NULL); /* Free the properties */ - H5SL_destroy(plist->props,H5P_free_prop_cb,&make_cb); + H5SL_destroy(plist->props, H5P__free_prop_cb, &make_cb); /* Destroy property list object */ plist = H5FL_FREE(H5P_genplist_t, plist); @@ -5046,11 +5058,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_get_class_path + H5P__get_class_path PURPOSE Internal routine to query the full path of a generic property list class USAGE - char *H5P_get_class_name(pclass) + char *H5P__get_class_name(pclass) H5P_genclass_t *pclass; IN: Property list class to check RETURNS Success: Pointer to a malloc'ed string containing the full path of class @@ -5066,11 +5078,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ char * -H5P_get_class_path(H5P_genclass_t *pclass) +H5P__get_class_path(H5P_genclass_t *pclass) { char *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(pclass); @@ -5079,7 +5091,7 @@ H5P_get_class_path(H5P_genclass_t *pclass) char *par_path; /* Parent class's full path */ /* Get the parent class's path */ - par_path = H5P_get_class_path(pclass->parent); + par_path = H5P__get_class_path(pclass->parent); if(par_path != NULL) { size_t ret_str_len; @@ -5104,16 +5116,16 @@ H5P_get_class_path(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get_class_path() */ +} /* H5P__get_class_path() */ /*-------------------------------------------------------------------------- NAME - H5P_open_class_path + H5P__open_class_path PURPOSE Internal routine to open [a copy of] a class with its full path name USAGE - H5P_genclass_t *H5P_open_class_path(path) + H5P_genclass_t *H5P__open_class_path(path) const char *path; IN: Full path name of class to open [copy of] RETURNS Success: Pointer to a generic property class object @@ -5127,7 +5139,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ H5P_genclass_t * -H5P_open_class_path(const char *path) +H5P__open_class_path(const char *path) { char *tmp_path = NULL; /* Temporary copy of the path */ char *curr_name; /* Pointer to current component of path name */ @@ -5136,7 +5148,7 @@ H5P_open_class_path(const char *path) H5P_check_class_t check_info; /* Structure to hold the information for checking duplicate names */ H5P_genclass_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(path); @@ -5157,8 +5169,8 @@ H5P_open_class_path(const char *path) check_info.new_class = NULL; /* Find the class with this name & parent by iterating over the open classes */ - if(H5I_iterate(H5I_GENPROP_CLS, H5P_open_class_path_cb, &check_info, FALSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADITER, NULL, "can't iterate over classes") + if(H5I_iterate(H5I_GENPROP_CLS, H5P__open_class_path_cb, &check_info, FALSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_BADITER, NULL, "can't iterate over classes") else if(NULL == check_info.new_class) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class") @@ -5175,13 +5187,13 @@ H5P_open_class_path(const char *path) check_info.new_class = NULL; /* Find the class with this name & parent by iterating over the open classes */ - if(H5I_iterate(H5I_GENPROP_CLS, H5P_open_class_path_cb, &check_info, FALSE) < 0) + if(H5I_iterate(H5I_GENPROP_CLS, H5P__open_class_path_cb, &check_info, FALSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_BADITER, NULL, "can't iterate over classes") else if(NULL == check_info.new_class) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class") /* Copy it */ - if(NULL == (ret_value = H5P_copy_pclass(check_info.new_class))) + if(NULL == (ret_value = H5P__copy_pclass(check_info.new_class))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL, "can't copy property class") done: @@ -5189,16 +5201,16 @@ done: H5MM_xfree(tmp_path); FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_open_class_path() */ +} /* H5P__open_class_path() */ /*-------------------------------------------------------------------------- NAME - H5P_get_class_parent + H5P__get_class_parent PURPOSE Internal routine to query the parent class of a generic property class USAGE - H5P_genclass_t *H5P_get_class_parent(pclass) + H5P_genclass_t *H5P__get_class_parent(pclass) H5P_genclass_t *pclass; IN: Property class to check RETURNS Success: Pointer to the parent class of a property class @@ -5212,11 +5224,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ H5P_genclass_t * -H5P_get_class_parent(const H5P_genclass_t *pclass) +H5P__get_class_parent(const H5P_genclass_t *pclass) { H5P_genclass_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(pclass); @@ -5224,16 +5236,16 @@ H5P_get_class_parent(const H5P_genclass_t *pclass) ret_value = pclass->parent; FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get_class_parent() */ +} /* H5P__get_class_parent() */ /*-------------------------------------------------------------------------- NAME - H5P_close_class + H5P__close_class PURPOSE Internal routine to close a property list class. USAGE - herr_t H5P_close_class(class) + herr_t H5P__close_class(class) H5P_genclass_t *class; IN: Property list class to close RETURNS Returns non-negative on success, negative on failure. @@ -5245,7 +5257,7 @@ H5P_get_class_parent(const H5P_genclass_t *pclass) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_close_class(void *_pclass) +H5P__close_class(void *_pclass) { H5P_genclass_t *pclass = (H5P_genclass_t *)_pclass; herr_t ret_value = SUCCEED; /* Return value */ @@ -5255,12 +5267,12 @@ H5P_close_class(void *_pclass) HDassert(pclass); /* Decrement the reference count & check if the object should go away */ - if(H5P_access_class(pclass, H5P_MOD_DEC_REF) < 0) + if(H5P__access_class(pclass, H5P_MOD_DEC_REF) < 0) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't decrement ID ref count") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_close_class() */ +} /* H5P__close_class() */ /*------------------------------------------------------------------------- @@ -5269,7 +5281,7 @@ done: * Purpose: Create a new property list, of a given type * * Return: Success: ID of new property list - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * Thursday, August 2, 2012 @@ -5291,9 +5303,9 @@ H5P__new_plist_of_type(H5P_plist_type_t type) /* Check arguments */ if(type == H5P_TYPE_USER) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't create user property list"); + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, H5I_INVALID_HID, "can't create user property list"); if(type == H5P_TYPE_ROOT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "shouldn't be creating root class property list"); + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, H5I_INVALID_HID, "shouldn't be creating root class property list"); /* Instantiate a property list of the proper type */ switch(type) { @@ -5374,11 +5386,11 @@ H5P__new_plist_of_type(H5P_plist_type_t type) /* Get the class object */ if(NULL == (pclass = (H5P_genclass_t *)H5I_object(class_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property class") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, H5I_INVALID_HID, "not a property class") /* Create the new property list */ if((ret_value = H5P_create_id(pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5394,7 +5406,7 @@ done: * H5P_genplist_t data structure) * * Return: Success: Non-negative ID of property list. - * Failure: negative. + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol <koziol@hdfgroup.org> * April 22, 2014 @@ -5442,30 +5454,20 @@ H5P_get_class(const H5P_genplist_t *plist) /*------------------------------------------------------------------------- - * Function: H5P_get_default - * - * Purpose: Get the default property list ID, for a property class. + * Function: H5P_ignore_cmp * - * Return: Success: Non-negative ID of property list. - * Failure: negative. + * Purpose: Callback routine to ignore comparing property values. * - * Programmer: Quincey Koziol <koziol@lbl.gov> - * December 29, 2017 + * Return: zero * *------------------------------------------------------------------------- */ -hid_t -H5P_get_default(const H5P_libclass_t *libclass) +int +H5P_ignore_cmp(const void H5_ATTR_UNUSED *val1, const void H5_ATTR_UNUSED *val2, + size_t H5_ATTR_UNUSED size) { - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_NOAPI(H5I_INVALID_HID) - - HDassert(libclass); - - ret_value = *libclass->def_plist_id; + FUNC_ENTER_NOAPI_NOINIT_NOERR -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_default() */ + FUNC_LEAVE_NOAPI(0) +} /* end H5P_ignore_cmp() */ diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 18b81ac..bedeed9 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -194,38 +194,38 @@ H5P__lacc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register property for number of links traversed */ - if(H5P_register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &H5L_def_nlinks_g, + if(H5P__register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &H5L_def_nlinks_g, NULL, NULL, NULL, H5L_ACS_NLINKS_ENC, H5L_ACS_NLINKS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external link prefix */ - if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &H5L_def_elink_prefix_g, + if(H5P__register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &H5L_def_elink_prefix_g, NULL, H5L_ACS_ELINK_PREFIX_SET, H5L_ACS_ELINK_PREFIX_GET, H5L_ACS_ELINK_PREFIX_ENC, H5L_ACS_ELINK_PREFIX_DEC, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, H5L_ACS_ELINK_PREFIX_CMP, H5L_ACS_ELINK_PREFIX_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register fapl for link access */ - if(H5P_register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &H5L_def_fapl_id_g, + if(H5P__register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &H5L_def_fapl_id_g, NULL, H5L_ACS_ELINK_FAPL_SET, H5L_ACS_ELINK_FAPL_GET, H5L_ACS_ELINK_FAPL_ENC, H5L_ACS_ELINK_FAPL_DEC, H5L_ACS_ELINK_FAPL_DEL, H5L_ACS_ELINK_FAPL_COPY, H5L_ACS_ELINK_FAPL_CMP, H5L_ACS_ELINK_FAPL_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external link file access flags */ - if(H5P_register_real(pclass, H5L_ACS_ELINK_FLAGS_NAME, H5L_ACS_ELINK_FLAGS_SIZE, &H5L_def_elink_flags_g, + if(H5P__register_real(pclass, H5L_ACS_ELINK_FLAGS_NAME, H5L_ACS_ELINK_FLAGS_SIZE, &H5L_def_elink_flags_g, NULL, NULL, NULL, H5L_ACS_ELINK_FLAGS_ENC, H5L_ACS_ELINK_FLAGS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external link file traversal callback */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5L_ACS_ELINK_CB_NAME, H5L_ACS_ELINK_CB_SIZE, &H5L_def_elink_cb_g, + if(H5P__register_real(pclass, H5L_ACS_ELINK_CB_NAME, H5L_ACS_ELINK_CB_SIZE, &H5L_def_elink_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ - if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, &H5L_def_coll_md_read_g, + if(H5P__register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, &H5L_def_coll_md_read_g, NULL, NULL, NULL, H5L_ACS_COLL_MD_READ_ENC, H5L_ACS_COLL_MD_READ_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -569,7 +569,7 @@ H5P__lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t H5_ATTR_ if(obj1 && obj2) { herr_t status; - status = H5P_cmp_plist(obj1, obj2, &ret_value); + status = H5P__cmp_plist(obj1, obj2, &ret_value); HDassert(status >= 0); } /* end if */ diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index 6508a82..16be52a 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Plcpl.c - * May 8 2006 - * Peter Cao <xcao@ncsa.uiuc.edu> + * Created: H5Plcpl.c * - * Purpose: Link creation property list class routines + * Purpose: Link creation property list class routines * *------------------------------------------------------------------------- */ @@ -32,11 +30,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5Ppkg.h" /* Property lists */ /****************/ @@ -50,6 +48,31 @@ #define H5L_CRT_INTERMEDIATE_GROUP_ENC H5P__encode_unsigned #define H5L_CRT_INTERMEDIATE_GROUP_DEC H5P__decode_unsigned +/* ======== VOL specific properties ========= */ +/* Definitions for target object ID */ +#define H5L_CRT_TARGET_SIZE sizeof(void *) +#define H5L_CRT_TARGET_DEF NULL + +/* Definitions for Location params */ +#define H5L_CRT_LOCATION_SIZE sizeof(H5VL_loc_params_t) +#define H5L_CRT_LOCATION_DEF {H5I_BADID, H5VL_OBJECT_BY_SELF, {{HADDR_UNDEF}}} + +/* Definitions for target object NAME */ +#define H5L_CRT_TARGET_NAME_SIZE sizeof(char *) +#define H5L_CRT_TARGET_NAME_DEF NULL + +/* Definitions for link type */ +#define H5L_CRT_LINK_TYPE_SIZE sizeof(link_type) +#define H5L_CRT_LINK_TYPE_DEF H5L_TYPE_ERROR + +/* Definitions for UDATA */ +#define H5L_CRT_UDATA_SIZE sizeof(void *) +#define H5L_CRT_UDATA_DEF NULL + +/* Definitions for UDATA_SIZE */ +#define H5L_CRT_UDATA_SIZE_SIZE sizeof(size_t) +#define H5L_CRT_UDATA_SIZE_DEF 0 + /******************/ /* Local Typedefs */ /******************/ @@ -120,16 +143,46 @@ static const unsigned H5L_def_intmd_group_g = H5L_CRT_INTERMEDIATE_GROUP_DEF; herr_t H5P_lcrt_reg_prop(H5P_genclass_t *pclass) { - herr_t ret_value = SUCCEED; /* Return value */ + void* target = H5L_CRT_TARGET_DEF; + H5VL_loc_params_t loc_params = H5L_CRT_LOCATION_DEF; + char *target_name = H5L_CRT_TARGET_NAME_DEF; + H5L_type_t link_type = H5L_CRT_LINK_TYPE_DEF; + void *udata = H5L_CRT_UDATA_DEF; + size_t udata_size = H5L_CRT_UDATA_SIZE_DEF; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Register create intermediate groups property */ - if(H5P_register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &H5L_def_intmd_group_g, + if(H5P__register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &H5L_def_intmd_group_g, NULL, NULL, NULL, H5L_CRT_INTERMEDIATE_GROUP_ENC, H5L_CRT_INTERMEDIATE_GROUP_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + if(H5P__register_real(pclass, H5VL_PROP_LINK_TARGET, H5L_CRT_TARGET_SIZE, &target, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + if(H5P__register_real(pclass, H5VL_PROP_LINK_TARGET_LOC_PARAMS, H5L_CRT_LOCATION_SIZE, &loc_params, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + if(H5P__register_real(pclass, H5VL_PROP_LINK_TARGET_NAME, H5L_CRT_TARGET_NAME_SIZE, &target_name, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + if(H5P__register_real(pclass, H5VL_PROP_LINK_TYPE, H5L_CRT_LINK_TYPE_SIZE, &link_type, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + if(H5P__register_real(pclass, H5VL_PROP_LINK_UDATA, H5L_CRT_UDATA_SIZE, &udata, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + if(H5P__register_real(pclass, H5VL_PROP_LINK_UDATA_SIZE, H5L_CRT_UDATA_SIZE_SIZE, &udata_size, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_lcrt_reg_prop() */ diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index be41e32..c2bf6cb 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -165,25 +165,25 @@ H5P__ocrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register max. compact attribute storage property */ - if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &H5O_def_attr_max_compact_g, + if(H5P__register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &H5O_def_attr_max_compact_g, NULL, NULL, NULL, H5O_CRT_ATTR_MAX_COMPACT_ENC, H5O_CRT_ATTR_MAX_COMPACT_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register min. dense attribute storage property */ - if(H5P_register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &H5O_def_attr_min_dense_g, + if(H5P__register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &H5O_def_attr_min_dense_g, NULL, NULL, NULL, H5O_CRT_ATTR_MIN_DENSE_ENC, H5O_CRT_ATTR_MIN_DENSE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register object header flags property */ - if(H5P_register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &H5O_def_ohdr_flags_g, + if(H5P__register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &H5O_def_ohdr_flags_g, NULL, NULL, NULL, H5O_CRT_OHDR_FLAGS_ENC, H5O_CRT_OHDR_FLAGS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the pipeline property */ - if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &H5O_def_pline_g, + if(H5P__register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &H5O_def_pline_g, NULL, H5O_CRT_PIPELINE_SET, H5O_CRT_PIPELINE_GET, H5O_CRT_PIPELINE_ENC, H5O_CRT_PIPELINE_DEC, H5O_CRT_PIPELINE_DEL, H5O_CRT_PIPELINE_COPY, H5O_CRT_PIPELINE_CMP, H5O_CRT_PIPELINE_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -899,7 +899,7 @@ H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, filter = &pline.filter[idx]; /* Get filter information */ - if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) + if(H5P__get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info") /* Set return value */ @@ -952,7 +952,7 @@ H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID is invalid") /* Get filter information */ - if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) + if(H5P__get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info") done: @@ -1118,7 +1118,7 @@ H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_filter_by_id() */ +} /* end H5P_filter_in_pline() */ /*------------------------------------------------------------------------- @@ -1292,7 +1292,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_get_filter + * Function: H5P__get_filter * * Purpose: Internal component of H5Pget_filter & H5Pget_filter_id * @@ -1304,12 +1304,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, +H5P__get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, size_t namelen, char name[]/*out*/, unsigned *filter_config /*out*/) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ HDassert(filter); @@ -1364,7 +1364,7 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, H5Z_get_filter_info(filter->id, filter_config); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_get_filter() */ +} /* end H5P__get_filter() */ /*------------------------------------------------------------------------- @@ -1893,7 +1893,7 @@ H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, filter = &pline.filter[idx]; /* Get filter information */ - if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0) + if(H5P__get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info") /* Set return value */ diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index 47bba05..666a945 100644 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -161,20 +161,20 @@ H5P__ocpy_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register copy options property */ - if(H5P_register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &H5O_def_ocpy_option_g, + if(H5P__register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &H5O_def_ocpy_option_g, NULL, NULL, NULL, H5O_CPY_OPTION_ENC, H5O_CPY_OPTION_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register merge named dtype list property */ - if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &H5O_def_merge_comm_dtype_list_g, + if(H5P__register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &H5O_def_merge_comm_dtype_list_g, NULL, H5O_CPY_MERGE_COMM_DT_LIST_SET, H5O_CPY_MERGE_COMM_DT_LIST_GET, H5O_CPY_MERGE_COMM_DT_LIST_ENC, H5O_CPY_MERGE_COMM_DT_LIST_DEC, H5O_CPY_MERGE_COMM_DT_LIST_DEL, H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP, H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for callback when completing the search for a matching named datatype from the named dtype list */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &H5O_def_mcdt_cb_g, + if(H5P__register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &H5O_def_mcdt_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 60b2363..13f3b13 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -129,48 +129,48 @@ struct H5Z_filter_info_t; /******************************/ /* Private functions, not part of the publicly documented API */ -H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class, +H5_DLL H5P_genclass_t *H5P__create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type, H5P_cls_create_func_t cls_create, void *create_data, H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data); -H5_DLL H5P_genclass_t *H5P_copy_pclass(H5P_genclass_t *pclass); -H5_DLL herr_t H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, +H5_DLL H5P_genclass_t *H5P__copy_pclass(H5P_genclass_t *pclass); +H5_DLL herr_t H5P__register_real(H5P_genclass_t *pclass, const char *name, size_t size, const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); -H5_DLL herr_t H5P_register(H5P_genclass_t **pclass, const char *name, size_t size, +H5_DLL herr_t H5P__register(H5P_genclass_t **pclass, const char *name, size_t size, const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); -H5_DLL herr_t H5P_add_prop(H5SL_t *props, H5P_genprop_t *prop); -H5_DLL herr_t H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod); -H5_DLL htri_t H5P_exist_pclass(H5P_genclass_t *pclass, const char *name); -H5_DLL herr_t H5P_get_size_plist(const H5P_genplist_t *plist, const char *name, +H5_DLL herr_t H5P__add_prop(H5SL_t *props, H5P_genprop_t *prop); +H5_DLL herr_t H5P__access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod); +H5_DLL htri_t H5P__exist_pclass(H5P_genclass_t *pclass, const char *name); +H5_DLL herr_t H5P__get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size); -H5_DLL herr_t H5P_get_size_pclass(H5P_genclass_t *pclass, const char *name, +H5_DLL herr_t H5P__get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size); -H5_DLL herr_t H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops); -H5_DLL int H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); -H5_DLL herr_t H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, +H5_DLL herr_t H5P__get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops); +H5_DLL int H5P__cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); +H5_DLL herr_t H5P__cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, int *cmp_ret); -H5_DLL int H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, +H5_DLL int H5P__iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, H5P_iterate_int_t iter_func, void *iter_data); -H5_DLL int H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx, +H5_DLL int H5P__iterate_pclass(const H5P_genclass_t *pclass, int *idx, H5P_iterate_int_t iter_func, void *iter_data); -H5_DLL herr_t H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name); -H5_DLL herr_t H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name); -H5_DLL herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name); -H5_DLL char *H5P_get_class_path(H5P_genclass_t *pclass); -H5_DLL H5P_genclass_t *H5P_open_class_path(const char *path); -H5_DLL H5P_genclass_t *H5P_get_class_parent(const H5P_genclass_t *pclass); -H5_DLL herr_t H5P_close_class(void *_pclass); +H5_DLL herr_t H5P__copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name); +H5_DLL herr_t H5P__copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name); +H5_DLL herr_t H5P__unregister(H5P_genclass_t *pclass, const char *name); +H5_DLL char *H5P__get_class_path(H5P_genclass_t *pclass); +H5_DLL H5P_genclass_t *H5P__open_class_path(const char *path); +H5_DLL H5P_genclass_t *H5P__get_class_parent(const H5P_genclass_t *pclass); +H5_DLL herr_t H5P__close_class(void *_pclass); H5_DLL H5P_genprop_t *H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name); H5_DLL hid_t H5P__new_plist_of_type(H5P_plist_type_t type); @@ -194,14 +194,14 @@ H5_DLL herr_t H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, siz H5_DLL herr_t H5P__decode_coll_md_read_flag_t(const void **_pp, void *value); /* Private OCPL routines */ -H5_DLL herr_t H5P_get_filter(const struct H5Z_filter_info_t *filter, +H5_DLL herr_t H5P__get_filter(const struct H5Z_filter_info_t *filter, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); /* Testing functions */ #ifdef H5P_TESTING -H5_DLL char *H5P_get_class_path_test(hid_t pclass_id); -H5_DLL hid_t H5P_open_class_path_test(const char *path); +H5_DLL char *H5P__get_class_path_test(hid_t pclass_id); +H5_DLL hid_t H5P__open_class_path_test(const char *path); #endif /* H5P_TESTING */ #endif /* _H5Ppkg_H */ diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 1a2bb95..866f088 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -177,6 +177,7 @@ H5_DLL hid_t H5P_peek_driver(H5P_genplist_t *plist); H5_DLL const void *H5P_peek_driver_info(H5P_genplist_t *plist); H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info); +H5_DLL herr_t H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info); H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, void *free_info); @@ -190,7 +191,6 @@ H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); H5_DLL htri_t H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id); -H5_DLL hid_t H5P_get_default(const H5P_libclass_t *pclass); /* Query internal fields of the property list struct */ H5_DLL hid_t H5P_get_plist_id(const H5P_genplist_t *plist); @@ -205,6 +205,8 @@ H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status); H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, const struct H5T_t *type, void *value); +H5_DLL int H5P_ignore_cmp(const void H5_ATTR_UNUSED *val1, const void H5_ATTR_UNUSED *val2, + size_t H5_ATTR_UNUSED size); #endif /* _H5Pprivate_H */ diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index c2f9b4c..2f094ea 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -313,6 +313,9 @@ H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_info); H5_DLL hid_t H5Pget_driver(hid_t plist_id); H5_DLL const void *H5Pget_driver_info(hid_t plist_id); +H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info); +H5_DLL herr_t H5Pget_vol_id(hid_t plist_id, hid_t *vol_id); +H5_DLL herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info); H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset); H5_DLL herr_t H5Pget_family_offset(hid_t fapl_id, hsize_t *offset); H5_DLL herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type); diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index fb91356..45343c6 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -130,7 +130,7 @@ H5P__strcrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register character encoding */ - if(H5P_register_real(pclass, H5P_STRCRT_CHAR_ENCODING_NAME, H5P_STRCRT_CHAR_ENCODING_SIZE, &H5P_def_char_encoding_g, + if(H5P__register_real(pclass, H5P_STRCRT_CHAR_ENCODING_NAME, H5P_STRCRT_CHAR_ENCODING_SIZE, &H5P_def_char_encoding_g, NULL, NULL, NULL, H5P_STRCRT_CHAR_ENCODING_ENC, H5P_STRCRT_CHAR_ENCODING_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Ptest.c b/src/H5Ptest.c index 475a164..114b37b 100644 --- a/src/H5Ptest.c +++ b/src/H5Ptest.c @@ -35,11 +35,11 @@ /*-------------------------------------------------------------------------- NAME - H5P_get_class_path_test + H5P__get_class_path_test PURPOSE Routine to query the full path of a generic property list class USAGE - char *H5P_get_class_name_test(pclass_id) + char *H5P__get_class_name_test(pclass_id) hid_t pclass_id; IN: Property class to query RETURNS Success: Pointer to a malloc'ed string containing the full path of class @@ -51,75 +51,75 @@ GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS - DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P_get_class_path() + DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P__get_class_path() EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ char * -H5P_get_class_path_test(hid_t pclass_id) +H5P__get_class_path_test(hid_t pclass_id) { H5P_genclass_t *pclass; /* Property class to query */ char *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_PACKAGE /* Check arguments. */ if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property class"); /* Get the property list class path */ - if(NULL == (ret_value = H5P_get_class_path(pclass))) + if(NULL == (ret_value = H5P__get_class_path(pclass))) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "unable to query full path of class") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get_class_path_test() */ +} /* H5P__get_class_path_test() */ /*-------------------------------------------------------------------------- NAME - H5P_open_class_path_test + H5P__open_class_path_test PURPOSE Routine to open a [copy of] a class with its full path name USAGE - hid_t H5P_open_class_name_test(path) + hid_t H5P__open_class_name_test(path) const char *path; IN: Full path name of class to open [copy of] RETURNS Success: ID of generic property class - Failure: NULL + Failure: H5I_INVALID_HID DESCRIPTION This routine opens [a copy] of the class indicated by the full path. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS - DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P_open_class_path() + DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P__open_class_path() EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ hid_t -H5P_open_class_path_test(const char *path) +H5P__open_class_path_test(const char *path) { H5P_genclass_t *pclass = NULL; /* Property class to query */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check arguments. */ - if (NULL == path || *path=='\0') - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid class path"); + if(NULL == path || *path=='\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid class path"); /* Open the property list class */ - if ((pclass=H5P_open_class_path(path))==NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to find class with full path"); + if(NULL == (pclass = H5P__open_class_path(path))) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to find class with full path"); /* Get an atom for the class */ - if ((ret_value=H5I_register(H5I_GENPROP_CLS, pclass, TRUE))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class"); + if((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class"); done: - if(ret_value<0 && pclass) - H5P_close_class(pclass); + if(H5I_INVALID_HID == ret_value && pclass) + H5P__close_class(pclass); FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_open_class_path_test() */ +} /* H5P__open_class_path_test() */ @@ -91,9 +91,9 @@ herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id) { - H5G_loc_t loc; /* File location */ - H5S_t *space = NULL; /* Pointer to dataspace containing region */ - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "*xi*sRti", ref, loc_id, name, ref_type, space_id); @@ -101,25 +101,33 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t /* Check args */ if (ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") - if (H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if (!name || !*name) + if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") - if (ref_type != H5R_OBJECT && ref_type != H5R_DATASET_REGION) + if(ref_type != H5R_OBJECT && ref_type != H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "reference type not supported") - if (space_id == (-1) && ref_type == H5R_DATASET_REGION) + if(space_id == (-1) && ref_type == H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid") - if (space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the file object */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") /* Create reference */ - if((ret_value = H5R__create(ref, &loc, name, ref_type, space)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_REF_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, ref, name, ref_type, space_id)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference") done: @@ -157,34 +165,45 @@ done: hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_ref) { - H5G_loc_t loc; /* Group location */ - H5F_t *file = NULL; /* File object */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5I_type_t opened_type; + void *opened_obj = NULL; + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE4("i", "iiRt*x", obj_id, oapl_id, ref_type, _ref); /* Check args */ - if (H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if (oapl_id < 0) + if(oapl_id < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") - if (_ref == NULL) + if(_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&oapl_id, H5P_CLS_DACC, obj_id, FALSE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Get the file pointer from the entry */ - file = loc.oloc->file; + /* Get the VOL object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") - /* Create reference */ - if((ret_value = H5R__dereference(file, oapl_id, ref_type, _ref)) < 0) + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_REF; + loc_params.loc_data.loc_by_ref.ref_type = ref_type; + loc_params.loc_data.loc_by_ref._ref = _ref; + loc_params.loc_data.loc_by_ref.lapl_id = oapl_id; + loc_params.obj_type = H5I_get_type(obj_id); + + /* Dereference */ + if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") + done: FUNC_LEAVE_API(ret_value) } /* end H5Rdereference2() */ @@ -216,29 +235,31 @@ done: hid_t H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) { - H5G_loc_t loc; /* Object's group location */ - H5S_t *space = NULL; /* Dataspace object */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "iRt*x", id, ref_type, ref); /* Check args */ - if (H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if (ref_type != H5R_DATASET_REGION) + if(ref_type != H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") - if (ref == NULL) + if(ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(id); + + /* get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") + /* Get the dataspace with the correct region selected */ - if(NULL == (space = H5R__get_region(loc.oloc->file, ref))) + if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_REGION, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve dataspace") - /* Atomize */ - if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") - done: FUNC_LEAVE_API(ret_value) } /* end H5Rget_region() */ @@ -271,22 +292,29 @@ herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "iRt*x*Ot", id, ref_type, ref, obj_type); /* Check args */ - if (H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") - if (ref == NULL) + if(ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") - /* Get the object information */ - if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, obj_type) < 0) + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(id); + + /* Get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + + /* Get the object type */ + if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") done: @@ -331,26 +359,29 @@ ssize_t H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, size_t size) { - H5G_loc_t loc; /* Group location */ - H5F_t *file; /* File object */ - ssize_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE5("Zs", "iRt*x*sz", id, ref_type, _ref, name, size); /* Check args */ - if (H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type") - if (_ref == NULL) + if(_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer") - /* Get the file pointer from the entry */ - file = loc.oloc->file; + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(id); + + /* Get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get name */ - if((ret_value = H5R__get_name(file, id, ref_type, _ref, name, size)) < 0) + if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size, ref_type, _ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine object path") done: @@ -137,7 +137,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ H5RS_str_t * -H5RS_wrap(char *s) +H5RS_wrap(const char *s) { H5RS_str_t *ret_value; /* Return value */ @@ -148,7 +148,7 @@ H5RS_wrap(char *s) HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed") /* Set the internal fields */ - ret_value->s = s; + ret_value->s = (char *)s; ret_value->wrapped = 1; ret_value->n = 1; diff --git a/src/H5RSprivate.h b/src/H5RSprivate.h index f69624a..1d26a18 100644 --- a/src/H5RSprivate.h +++ b/src/H5RSprivate.h @@ -44,7 +44,7 @@ typedef struct H5RS_str_t H5RS_str_t; /* Private routines */ /********************/ H5_DLL H5RS_str_t *H5RS_create(const char *s); -H5_DLL H5RS_str_t *H5RS_wrap(char *s); +H5_DLL H5RS_str_t *H5RS_wrap(const char *s); H5_DLL H5RS_str_t *H5RS_own(char *s); H5_DLL herr_t H5RS_decr(H5RS_str_t *rs); H5_DLL herr_t H5RS_incr(H5RS_str_t *rs); diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index fb62430..827506e 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -42,6 +42,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ #include "H5Oprivate.h" /* Object headers */ #include "H5Rpkg.h" /* References */ @@ -102,7 +103,8 @@ H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; H5O_type_t obj_type; /* Object type */ H5G_obj_t ret_value; /* Return value */ @@ -110,16 +112,22 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) H5TRACE3("Go", "iRt*x", id, ref_type, ref); /* Check args */ - if (H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location") if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference type") if (ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer") + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(id); + + /* Get the vol object */ + if (NULL == (vol_obj = H5VL_vol_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid file identifier") + /* Get the object information */ - if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, &obj_type) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type") + if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type, ref_type, ref) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "unable to determine object type") /* Set return value */ ret_value = H5G_map_obj_type(obj_type); @@ -148,27 +156,38 @@ done: hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) { - H5G_loc_t loc; /* Group location */ - H5F_t *file = NULL; /* File object */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5I_type_t opened_type; + void *opened_obj = NULL; + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "iRt*x", obj_id, ref_type, _ref); /* Check args */ - if (H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") if (_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") - /* Get the file pointer from the entry */ - file = loc.oloc->file; + /* Get the VOL object */ + if (NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") + + loc_params.type = H5VL_OBJECT_BY_REF; + loc_params.loc_data.loc_by_ref.ref_type = ref_type; + loc_params.loc_data.loc_by_ref._ref = _ref; + loc_params.loc_data.loc_by_ref.lapl_id = H5P_DATASET_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(obj_id); + + /* Dereference */ + if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") - /* Create reference */ - if((ret_value = H5R__dereference(file, H5P_DATASET_ACCESS_DEFAULT, ref_type, _ref)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID, "unable dereference object") + /* Get an atom for the object */ + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Rint.c b/src/H5Rint.c index acf6b56..365facd 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -221,8 +221,7 @@ H5R_term_package(void) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, - H5S_t *space) +H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space) { H5G_loc_t obj_loc; /* Group hier. location of object */ H5G_name_t path; /* Object group hier. path */ @@ -230,7 +229,7 @@ H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, hbool_t obj_found = FALSE; /* Object location found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(_ref); HDassert(loc); @@ -335,7 +334,7 @@ done: if (obj_found) H5G_loc_free(&obj_loc); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__create() */ @@ -371,8 +370,7 @@ done: Added a check for undefined reference pointer. --------------------------------------------------------------------------*/ hid_t -H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, - const void *_ref) +H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, const void *_ref) { H5O_loc_t oloc; /* Object location */ H5G_name_t path; /* Path of object */ @@ -381,7 +379,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, H5O_type_t obj_type; /* Type of object */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(_ref); HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE); @@ -459,7 +457,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, if((ret_value = H5I_register(H5I_GROUP, group, TRUE)) < 0) { H5G_close(group); HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register group") - } /* end if */ + } break; } @@ -475,7 +473,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) { H5T_close(type); HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register datatype") - } /* end if */ + } break; } @@ -492,7 +490,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) { H5D_close(dset); HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset") - } /* end if */ + } break; } @@ -504,7 +502,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, } /* end switch */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__dereference() */ @@ -536,9 +534,9 @@ H5R__get_region(H5F_t *file, const void *_ref) const uint8_t *p; /* Pointer to OID to store */ H5HG_t hobjid; /* Heap object ID */ uint8_t *buf = NULL; /* Buffer to store serialized selection in */ - H5S_t *ret_value; /* Return value */ + H5S_t *ret_value; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(_ref); HDassert(file); @@ -573,8 +571,8 @@ done: if(buf) H5MM_xfree(buf); - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5R__get_region() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5R__get_region() */ /*-------------------------------------------------------------------------- @@ -607,7 +605,7 @@ H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, unsigned rc; /* Reference count of object */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(file); HDassert(_ref); @@ -662,7 +660,7 @@ H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_obj_type() */ @@ -694,14 +692,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ ssize_t -H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref, +H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, char *name, size_t size) { - hid_t file_id = H5I_INVALID_HID; /* ID for file that the reference is in */ H5O_loc_t oloc; /* Object location describing object for reference */ ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(f); @@ -731,7 +728,7 @@ H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref, UINT32DECODE(p, hobjid.idx); /* Get the dataset region from the heap (allocate inside routine) */ - if ((buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)) == NULL) + if((buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)) == NULL) HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, (-1), "Unable to read dataset region information") /* Get the object oid for the dataset */ @@ -750,19 +747,11 @@ H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref, HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, (-1), "internal error (unknown reference type)") } /* end switch */ - /* Retrieve file ID for name search */ - if ((file_id = H5F_get_id(f, FALSE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get file ID") - /* Get name, length, etc. */ - if ((ret_value = H5G_get_name_by_addr(file_id, &oloc, name, size)) < 0) + if((ret_value = H5G_get_name_by_addr(f, &oloc, name, size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't determine name") done: - /* Close file ID used for search */ - if (file_id > 0 && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, (-1), "can't decrement ref count of temp ID") - - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_name() */ diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index fbbff50..1c1c8eb 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -50,15 +50,11 @@ /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5R__create(void *ref, H5G_loc_t *loc, const char *name, - H5R_type_t ref_type, H5S_t *space); -H5_DLL hid_t H5R__dereference(H5F_t *file, hid_t dapl_id, H5R_type_t ref_type, - const void *_ref); +H5_DLL herr_t H5R__create(void *ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space); +H5_DLL hid_t H5R__dereference(H5F_t *file, hid_t dapl_id, H5R_type_t ref_type, const void *_ref); H5_DLL H5S_t *H5R__get_region(H5F_t *file, const void *_ref); -H5_DLL herr_t H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, - const void *_ref, H5O_type_t *obj_type); -H5_DLL ssize_t H5R__get_name(H5F_t *file, hid_t id, H5R_type_t ref_type, - const void *_ref, char *name, size_t size); +H5_DLL herr_t H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, H5O_type_t *obj_type); +H5_DLL ssize_t H5R__get_name(H5F_t *file, H5R_type_t ref_type, const void *_ref, char *name, size_t size); #endif /* _H5Rpkg_H */ diff --git a/src/H5Rprivate.h b/src/H5Rprivate.h index 8c0ba8f..1bf2e92 100644 --- a/src/H5Rprivate.h +++ b/src/H5Rprivate.h @@ -20,11 +20,6 @@ #include "H5Rpublic.h" /* Private headers needed by this file */ -#include "H5Fprivate.h" /* Files */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Sprivate.h" /* Dataspaces */ - /**************************/ /* Library Private Macros */ @@ -45,6 +40,5 @@ /* Library Private Prototypes */ /******************************/ - #endif /* _H5Rprivate_H */ @@ -1974,7 +1974,7 @@ done: /*------------------------------------------------------------------------- * Function: H5S_set_extent * - * Purpose: Modify the dimensions of a dataspace. Based on H5S_extend + * Purpose: Modify the dimensions of a dataspace. * * Return: Success: Non-negative * Failure: Negative @@ -2055,7 +2055,7 @@ H5S_has_extent(const H5S_t *ds) /*------------------------------------------------------------------------- * Function: H5S_set_extent_real * - * Purpose: Modify the dimensions of a dataspace. Based on H5S_extend + * Purpose: Modify the dimensions of a dataspace. * * Return: Success: Non-negative * Failure: Negative @@ -142,7 +142,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc) /* Initialize master table */ if(NULL == (table = H5FL_CALLOC(H5SM_master_table_t))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table") table->num_indexes = H5F_SOHM_NINDEXES(f); table->table_size = H5SM_TABLE_SIZE(f); @@ -209,11 +209,11 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc) /* Allocate space for the table on disk */ if(HADDR_UNDEF == (table_addr = H5MF_alloc(f, H5FD_MEM_SOHM_TABLE, (hsize_t)table->table_size))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table") /* Cache the new table */ if(H5AC_insert_entry(f, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, FAIL, "can't add SOHM table to cache") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, FAIL, "can't add SOHM table to cache") /* Record the address of the master table in the file */ H5F_SET_SOHM_ADDR(f, table_addr); @@ -386,7 +386,7 @@ H5SM_type_shared(H5F_t *f, unsigned type_id) done: /* Release the master SOHM table */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_type_shared() */ @@ -424,11 +424,11 @@ H5SM_get_fheap_addr(H5F_t *f, unsigned type_id, haddr_t *fheap_addr) /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Look up index for message type */ if((index_num = H5SM_get_index(table, type_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to find correct SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to find correct SOHM index") /* Retrieve heap address for index */ *fheap_addr = table->indexes[index_num].heap_addr; @@ -436,7 +436,7 @@ H5SM_get_fheap_addr(H5F_t *f, unsigned type_id, haddr_t *fheap_addr) done: /* Release the master SOHM table */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_get_fheap_addr() */ @@ -648,9 +648,9 @@ H5SM__create_list(H5F_t *f, H5SM_index_header_t *header) /* Allocate list in memory */ if(NULL == (list = H5FL_CALLOC(H5SM_list_t))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") if(NULL == (list->messages = (H5SM_sohm_t *)H5FL_ARR_CALLOC(H5SM_sohm_t, num_entries))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") /* Initialize messages in list */ for(x = 0; x < num_entries; x++) @@ -661,11 +661,11 @@ H5SM__create_list(H5F_t *f, H5SM_index_header_t *header) /* Allocate space for the list on disk */ if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_SOHM_INDEX, (hsize_t)header->list_size))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") /* Put the list into the cache */ if(H5AC_insert_entry(f, H5AC_SOHM_LIST, addr, list, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, HADDR_UNDEF, "can't add SOHM list to cache") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, HADDR_UNDEF, "can't add SOHM list to cache") /* Set return value */ ret_value = addr; @@ -773,7 +773,7 @@ H5SM__convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header, /* Unprotect list in cache and release heap */ if(H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list") *_list = list = NULL; /* Delete the old list index (but not its heap, which the new index is @@ -973,7 +973,7 @@ H5SM_can_share(H5F_t *f, H5SM_master_table_t *table, done: /* Release the master SOHM table, if we protected it */ if(my_table && my_table != table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), my_table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_can_share() */ @@ -1081,7 +1081,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* "complex" sharing checks */ if((tri_ret = H5SM_can_share(f, table, &index_num, type_id, mesg)) < 0) @@ -1103,7 +1103,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, */ if(H5SM__write_mesg(f, open_oh, &(table->indexes[index_num]), (defer_flags & H5SM_DEFER) != 0, type_id, mesg, &cache_flags) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "can't write shared message") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "can't write shared message") /* Set flags if this message was "written" without error and wasn't a * 'defer' attempt; it is now either fully shared or "shareable". @@ -1130,7 +1130,7 @@ done: /* Release the master SOHM table */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_try_share() */ @@ -1254,15 +1254,15 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* Encode the message to be written */ if((buf_size = H5O_msg_raw_size(f, type_id, TRUE, mesg)) == 0) - HGOTO_ERROR(H5E_SOHM, H5E_BADSIZE, FAIL, "can't find message size") + HGOTO_ERROR(H5E_SOHM, H5E_BADSIZE, FAIL, "can't find message size") if(NULL == (encoding_buf = H5MM_malloc(buf_size))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "can't allocate buffer for encoding") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "can't allocate buffer for encoding") if(H5O_msg_encode(f, type_id, TRUE, (unsigned char *)encoding_buf, mesg) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, FAIL, "can't encode message to be shared") + HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, FAIL, "can't encode message to be shared") /* Open the fractal heap for this index */ if(NULL == (fheap = H5HF_open(f, header->heap_addr))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Set up a key for the message to be written */ key.file = f; @@ -1285,14 +1285,14 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* The index is a list; get it from the cache */ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &cache_udata, defer ? H5AC__READ_ONLY_FLAG : H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") /* See if the message is already in the index and get its location. * Also record the first empty list position we find in case we need it * later. */ if(H5SM__find_in_list(list, &key, &empty_pos, &list_pos) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list") if(defer) { if(list_pos != UFAIL) @@ -1503,7 +1503,7 @@ done: /* If we got a list out of the cache, release it (it is always dirty after writing a message) */ if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, defer ? H5AC__NO_FLAGS_SET : H5AC__DIRTIED_FLAG) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") if(encoding_buf) encoding_buf = H5MM_xfree(encoding_buf); @@ -1557,11 +1557,11 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Find the correct index and try to delete from it */ if((index_num = H5SM_get_index(table, type_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") /* If mesg_buf is not NULL, the message's reference count has reached * zero and any file space it uses needs to be freed. mesg_buf holds the @@ -1572,7 +1572,7 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) /* Release the master SOHM table */ if(H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") table = NULL; /* If buf was allocated, delete the message it holds. This message may @@ -1590,7 +1590,7 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) done: /* Release the master SOHM table (should only happen on error) */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") /* Release any native message we decoded */ if(native_mesg) @@ -1794,7 +1794,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* Open the heap for this type of message. */ if(NULL == (fheap = H5HF_open(f, header->heap_addr))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Get the message size and encoded message for the message to be deleted, * either from its OH or from the heap. @@ -1813,7 +1813,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* Get the encoded message */ if(H5SM__read_mesg(f, &key.message, fheap, open_oh, &buf_size, &encoding_buf) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Set up key for message to be deleted. */ key.file = f; @@ -1833,13 +1833,13 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* If the index is stored as a list, get it from the cache */ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") /* Find the message in the list */ if(H5SM__find_in_list(list, &key, NULL, &list_pos) < 0) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list") if(list_pos == UFAIL) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") if(list->messages[list_pos].location == H5SM_IN_HEAP) --(list->messages[list_pos].u.heap_loc.ref_count); @@ -1859,7 +1859,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, * If it succeeds, a copy of the modified message will be returned. */ if(H5B2_modify(bt2, &key, H5SM__decr_ref, &message) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") /* Point to the message */ message_ptr = &message; @@ -1893,7 +1893,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* Remove the message from the heap if it was stored in the heap*/ if(old_loc == H5SM_IN_HEAP) if(H5HF_remove(fheap, &(message_ptr->u.heap_loc.fheap_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to remove message from heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to remove message from heap") /* Return the message's encoding so anything it references can be freed */ @@ -1905,7 +1905,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* Unprotect cache and release heap */ if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list") list = NULL; HDassert(fheap); @@ -1929,7 +1929,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, done: /* Release the SOHM list */ if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DIRTIED_FLAG) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") /* Release the fractal heap & v2 B-tree if we opened them */ if(fheap && H5HF_close(fheap) < 0) @@ -2068,7 +2068,7 @@ done: /* Release the master SOHM table if we took it out of the cache */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_get_info() */ @@ -2180,16 +2180,16 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &tbl_cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Find the correct index and find the message in it */ if((index_num = H5SM_get_index(table, type_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") header = &(table->indexes[index_num]); /* Open the heap for this message type */ if(NULL == (fheap = H5HF_open(f, header->heap_addr))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Set up a SOHM message to correspond to the shared message passed in */ key.message.location = H5SM_IN_HEAP; @@ -2198,7 +2198,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, /* Get the encoded message */ if(H5SM__read_mesg(f, &key.message, fheap, NULL, &buf_size, &encoding_buf) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Set up key for message to locate */ key.file = f; @@ -2218,13 +2218,13 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, /* If the index is stored as a list, get it from the cache */ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &lst_cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") /* Find the message in the list */ if(H5SM__find_in_list(list, &key, NULL, &list_pos) < 0) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list") if(list_pos == UFAIL) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") /* Copy the message */ message = list->messages[list_pos]; @@ -2243,7 +2243,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, if((msg_exists = H5B2_find(bt2, &key, H5SM_get_refcount_bt2_cb, &message)) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "error finding message in index") if(!msg_exists) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") } /* end else */ /* Set the refcount for the message */ @@ -2253,9 +2253,9 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, done: /* Release resources */ if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") if(fheap && H5HF_close(fheap) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") if(bt2 && H5B2_close(bt2) < 0) @@ -2418,11 +2418,11 @@ H5SM__read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, oloc.file = f; oloc.addr = mesg->u.mesg_loc.oh_addr; if(H5O_open(&oloc) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to open object header") + HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to open object header") /* Load the object header from the cache */ if(NULL == (oh = H5O_protect(&oloc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load object header") } /* end if */ else oh = open_oh; @@ -2559,11 +2559,11 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, if(table_vers == UFAIL) table_vers = H5F_SOHM_VERS(f); else if(table_vers != H5F_SOHM_VERS(f)) - HDfprintf(stream, "*** SOHM TABLE VERSION DOESN'T MATCH VERSION IN SUPERBLOCK!\n"); + HDfprintf(stream, "*** SOHM TABLE VERSION DOESN'T MATCH VERSION IN SUPERBLOCK!\n"); if(num_indexes == UFAIL) num_indexes = H5F_SOHM_NINDEXES(f); else if(num_indexes != H5F_SOHM_NINDEXES(f)) - HDfprintf(stream, "*** NUMBER OF SOHM INDEXES DOESN'T MATCH VALUE IN SUPERBLOCK!\n"); + HDfprintf(stream, "*** NUMBER OF SOHM INDEXES DOESN'T MATCH VALUE IN SUPERBLOCK!\n"); /* Check arguments. Version must be 0, the only version implemented so far */ if(table_vers > HDF5_SHAREDHEADER_VERSION) @@ -2576,7 +2576,7 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, table_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") HDfprintf(stream, "%*sShared Message Master Table...\n", indent, ""); for(x = 0; x < num_indexes; ++x) { @@ -2604,7 +2604,7 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, done: if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_table_debug() */ @@ -2650,7 +2650,7 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, table_addr, &tbl_cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Determine which index the list is part of */ index_num = table->num_indexes; @@ -2708,11 +2708,11 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, done: if(fh && H5HF_close(fh) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close SOHM heap") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close SOHM heap") if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, list_addr, list, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_list_debug() */ @@ -2757,7 +2757,7 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Get SOHM header size */ *hdr_size = table->table_size; @@ -2771,7 +2771,7 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) if(NULL == (bt2 = H5B2_open(f, table->indexes[u].index_addr, f))) HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index") - if(H5B2_size(bt2, &(ih_info->index_size)) < 0) + if(H5B2_size(bt2, &(ih_info->index_size)) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info") /* Close the v2 B-tree */ @@ -2792,8 +2792,8 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Get heap storage size */ - if(H5HF_size(fheap, &(ih_info->heap_size)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info") + if(H5HF_size(fheap, &(ih_info->heap_size)) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info") /* Close the fractal heap */ if(H5HF_close(fheap) < 0) diff --git a/src/H5SMtest.c b/src/H5SMtest.c index 490265c..0a6149d 100644 --- a/src/H5SMtest.c +++ b/src/H5SMtest.c @@ -113,7 +113,7 @@ H5SM__get_mesg_count_test(H5F_t *f, unsigned type_id, size_t *mesg_count) done: /* Release resources */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM__get_mesg_count_test() */ diff --git a/src/H5Sall.c b/src/H5Sall.c index 28395b1..3b77b98 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -46,7 +46,7 @@ static int H5S__all_unlim_dim(const H5S_t *space); static htri_t H5S__all_is_contiguous(const H5S_t *space); static htri_t H5S__all_is_single(const H5S_t *space); static htri_t H5S__all_is_regular(const H5S_t *space); -static void H5S__all_adjust_u(H5S_t *space, const hsize_t *offset); +static herr_t H5S__all_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S__all_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S__all_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); static herr_t H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); @@ -785,11 +785,11 @@ H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space) PURPOSE Adjust an "all" selection by subtracting an offset USAGE - void H5S__all_adjust_u(space, offset) + herr_t H5S__all_adjust_u(space, offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS - None + Non-negative on success, negative on failure DESCRIPTION Moves selection by subtracting an offset from it. GLOBAL VARIABLES @@ -797,7 +797,7 @@ H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static void +static herr_t H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset) { FUNC_ENTER_STATIC_NOERR @@ -806,7 +806,7 @@ H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off HDassert(space); HDassert(offset); - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S__all_adjust_u() */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 7a6d1be..ed3fa45 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -92,7 +92,7 @@ static herr_t H5S__hyper_num_elem_non_unlim(const H5S_t *space, static htri_t H5S__hyper_is_contiguous(const H5S_t *space); static htri_t H5S__hyper_is_single(const H5S_t *space); static htri_t H5S__hyper_is_regular(const H5S_t *space); -static void H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset); +static herr_t H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S__hyper_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); static herr_t H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); @@ -4203,7 +4203,7 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS - None + Non-negative on success, negative on failure DESCRIPTION Moves a hyperslab selection by subtracting an offset from it. GLOBAL VARIABLES @@ -4211,7 +4211,7 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static void +static herr_t H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset) { FUNC_ENTER_STATIC_NOERR @@ -4238,7 +4238,7 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset) H5S__hyper_span_scratch(space->select.sel_info.hslab->span_lst); } /* end if */ - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_adjust_u() */ diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 2bd275a..935d279 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -879,7 +879,14 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) } - MPI_Type_extent (inner_type, &inner_extent); + /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default, + * so we're using the MPI-2 version even though we don't need the lb + * value. + */ + { + MPI_Aint unused_lb_arg; + MPI_Type_get_extent(inner_type, &unused_lb_arg, &inner_extent); + } stride_in_bytes = inner_extent * (MPI_Aint)d[i].strid; /* If the element count is larger than what a 32 bit integer can hold, @@ -1500,7 +1507,14 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements, } } - MPI_Type_extent (old_type, &old_extent); + /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default, + * so we're using the MPI-2 version even though we don't need the lb + * value. + */ + { + MPI_Aint unused_lb_arg; + MPI_Type_get_extent(old_type, &unused_lb_arg, &old_extent); + } /* Set up the arguments for MPI_Type_struct constructor */ type[0] = outer_type; diff --git a/src/H5Snone.c b/src/H5Snone.c index a46a71a..a8aaf7e 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -47,7 +47,7 @@ static int H5S__none_unlim_dim(const H5S_t *space); static htri_t H5S_none_is_contiguous(const H5S_t *space); static htri_t H5S_none_is_single(const H5S_t *space); static htri_t H5S_none_is_regular(const H5S_t *space); -static void H5S_none_adjust_u(H5S_t *space, const hsize_t *offset); +static herr_t H5S_none_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S_none_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S_none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); static herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); @@ -744,11 +744,11 @@ H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space) PURPOSE Adjust an "none" selection by subtracting an offset USAGE - void H5S_none_adjust_u(space, offset) + herr_t H5S_none_adjust_u(space, offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS - None + Non-negative on success, negative on failure DESCRIPTION Moves selection by subtracting an offset from it. GLOBAL VARIABLES @@ -756,7 +756,7 @@ H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static void +static herr_t H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -765,7 +765,7 @@ H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off HDassert(space); HDassert(offset); - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_none_adjust_u() */ diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 6ded287..d895f40 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -161,7 +161,7 @@ typedef htri_t (*H5S_sel_is_single_func_t)(const H5S_t *space); /* Method to determine if current selection is "regular" */ typedef htri_t (*H5S_sel_is_regular_func_t)(const H5S_t *space); /* Method to adjust a selection by an offset */ -typedef void (*H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset); +typedef herr_t (*H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset); /* Method to construct single element projection onto scalar dataspace */ typedef herr_t (*H5S_sel_project_scalar)(const H5S_t *space, hsize_t *offset); /* Method to construct selection projection onto/into simple dataspace */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index fb8e311..9924920 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -48,7 +48,7 @@ static int H5S__point_unlim_dim(const H5S_t *space); static htri_t H5S_point_is_contiguous(const H5S_t *space); static htri_t H5S_point_is_single(const H5S_t *space); static htri_t H5S_point_is_regular(const H5S_t *space); -static void H5S_point_adjust_u(H5S_t *space, const hsize_t *offset); +static herr_t H5S_point_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S_point_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S_point_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); static herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); @@ -686,7 +686,7 @@ done: static htri_t H5S_point_is_valid (const H5S_t *space) { - H5S_pnt_node_t *curr; /* Point information nodes */ + H5S_pnt_node_t *curr; /* Point information nodes */ unsigned u; /* Counter */ htri_t ret_value = TRUE; /* Return value */ @@ -1354,11 +1354,11 @@ H5S_point_is_regular(const H5S_t *space) PURPOSE Adjust a "point" selection by subtracting an offset USAGE - void H5S_point_adjust_u(space, offset) + herr_t H5S_point_adjust_u(space, offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS - None + Non-negative on success, negative on failure DESCRIPTION Moves a point selection by subtracting an offset from it. GLOBAL VARIABLES @@ -1366,7 +1366,7 @@ H5S_point_is_regular(const H5S_t *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static void +static herr_t H5S_point_adjust_u(H5S_t *space, const hsize_t *offset) { H5S_pnt_node_t *node; /* Point node */ @@ -1396,7 +1396,7 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset) node = node->next; } /* end while */ - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_adjust_u() */ diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 15ce75d..32ac51a 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -259,7 +259,7 @@ H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p); H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space); H5_DLL htri_t H5S_select_is_single(const H5S_t *space); H5_DLL htri_t H5S_select_is_regular(const H5S_t *space); -H5_DLL void H5S_select_adjust_u(H5S_t *space, const hsize_t *offset); +H5_DLL herr_t H5S_select_adjust_u(H5S_t *space, const hsize_t *offset); H5_DLL herr_t H5S_select_project_scalar(const H5S_t *space, hsize_t *offset); H5_DLL herr_t H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); H5_DLL herr_t H5S_select_project_intersection(const H5S_t *src_space, diff --git a/src/H5Spublic.h b/src/H5Spublic.h index 09b474a..d7a5d29 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -131,6 +131,7 @@ H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id); H5_DLL herr_t H5Sset_extent_none(hid_t space_id); H5_DLL herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id); H5_DLL htri_t H5Sextent_equal(hid_t sid1, hid_t sid2); +H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id); H5_DLL herr_t H5Sselect_all(hid_t spaceid); H5_DLL herr_t H5Sselect_none(hid_t spaceid); H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index ec74523..ea10517 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -89,6 +89,52 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset) /*-------------------------------------------------------------------------- NAME + H5Sselect_copy + PURPOSE + Copy a selection from one dataspace to another + USAGE + herr_t H5Sselect_copy(dst, src) + hid_t dst; OUT: ID of the destination dataspace + hid_t src; IN: ID of the source dataspace + + RETURNS + Non-negative on success/Negative on failure + DESCRIPTION + Copies all the selection information (including offset) from the source + dataspace to the destination dataspace. + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5Sselect_copy(hid_t dst_id, hid_t src_id) +{ + H5S_t *src; + H5S_t *dst; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ii", dst_id, src_id); + + /* Check args */ + if(NULL == (src = (H5S_t *)H5I_object_verify(src_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + if(NULL == (dst = (H5S_t *)H5I_object_verify(dst_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + + /* Copy */ + if(H5S_select_copy(dst, src, FALSE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy selection") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Sselect_copy() */ + + +/*-------------------------------------------------------------------------- + NAME H5S_select_copy PURPOSE Copy a selection from one dataspace to another @@ -893,11 +939,11 @@ H5S_select_is_regular(const H5S_t *space) PURPOSE Adjust a selection by subtracting an offset USAGE - void H5S_select_adjust_u(space, offset) + herr_t H5S_select_adjust_u(space, offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS - None + Non-negative on success, negative on failure DESCRIPTION Moves a selection by subtracting an offset from it. GLOBAL VARIABLES @@ -908,18 +954,20 @@ H5S_select_is_regular(const H5S_t *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -void +herr_t H5S_select_adjust_u(H5S_t *space, const hsize_t *offset) { + herr_t ret_value = FAIL; /* Return value */ + FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ HDassert(space); HDassert(offset); - (*space->select.type->adjust_u)(space, offset); + ret_value = (*space->select.type->adjust_u)(space, offset); - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_select_adjust_u() */ @@ -28,24 +28,20 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5Tpkg.h" /* Datatypes */ - -/* Check for header needed for SGI floating-point code */ -#ifdef H5_HAVE_SYS_FPU_H -#include <sys/fpu.h> -#endif /* H5_HAVE_SYS_FPU_H */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Tpkg.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -292,17 +288,13 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, - H5T_t *dst, H5T_lib_conv_t func); -static herr_t H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, - H5T_t *dst, H5T_conv_func_t *conv); -static herr_t H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, - H5T_t *dst, H5T_conv_t func); +static herr_t H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_lib_conv_t func); +static herr_t H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_conv_func_t *conv); +static herr_t H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_conv_t func); static htri_t H5T__compiler_conv(H5T_t *src, H5T_t *dst); static herr_t H5T__set_size(H5T_t *dt, size_t size); static herr_t H5T__close_cb(H5T_t *dt); -static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst, - const char *name, H5T_conv_func_t *conv); +static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_conv_func_t *conv); /*****************************/ @@ -1391,7 +1383,7 @@ H5T_top_term_package(void) if((path->conv.u.app_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { - fprintf(H5DEBUG(T), "H5T: conversion function " + HDfprintf(H5DEBUG(T), "H5T: conversion function " "0x%08lx failed to free private data for " "%s (ignored)\n", (unsigned long)(path->conv.u.app_func), path->name); @@ -1597,6 +1589,49 @@ H5T_term_package(void) /*------------------------------------------------------------------------- + * Function: H5T__close_cb + * + * Purpose: Called when the ref count reaches zero on the datatype's ID + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5T__close_cb(H5T_t *dt) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(dt); + HDassert(dt->shared); + + /* If this datatype is VOL-managed (i.e.: has a VOL object), + * close it through the VOL connector. + */ + if(NULL != dt->vol_obj) { + /* Close the connector-managed datatype data */ + if(H5VL_datatype_close(dt->vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype") + + /* Free the VOL object */ + if(H5VL_free_object(dt->vol_obj) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object") + dt->vol_obj = NULL; + } /* end if */ + + /* Close the datatype */ + if(H5T_close(dt) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__close_cb() */ + + +/*------------------------------------------------------------------------- * Function: H5Tcreate * * Purpose: Create a new type and initialize it to reasonable values. @@ -1626,15 +1661,15 @@ H5Tcreate(H5T_class_t type, size_t size) /* check args. We support string (fixed-size or variable-length) now. */ if(size <= 0 && size != H5T_VARIABLE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive") /* create the type */ if(NULL == (dt = H5T__create(type, size))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create type") /* Get an ID for the datatype */ if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype ID") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype ID") done: FUNC_LEAVE_API(ret_value) @@ -1644,33 +1679,27 @@ done: /*------------------------------------------------------------------------- * Function: H5Tcopy * - * Purpose: Copies a datatype. The resulting datatype is not locked. - * The datatype should be closed when no longer needed by - * calling H5Tclose(). + * Purpose: Copies a datatype. The resulting datatype is not locked. + * The datatype should be closed when no longer needed by + * calling H5Tclose(). * - * Return: Success: The ID of a new datatype. + * Return: Success: The ID of a new datatype * - * Failure: Negative + * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * - * Modifications: - * - * Robb Matzke, 4 Jun 1998 - * The returned type is always transient and unlocked. If the TYPE_ID - * argument is a dataset instead of a datatype then this function - * returns a transient, modifiable datatype which is a copy of the - * dataset's datatype. + * Note: The returned type is always transient and unlocked. If the + * TYPE_ID argument is a dataset instead of a datatype then + * this function returns a transient, modifiable datatype + * which is a copy of the dataset's datatype. * *------------------------------------------------------------------------- */ hid_t H5Tcopy(hid_t type_id) { - H5T_t *dt; /* Pointer to the datatype to copy */ - H5T_t *new_dt = NULL; - hid_t ret_value; /* Return value */ + H5T_t *dt = NULL; /* Pointer to the datatype to copy */ + H5T_t *new_dt = NULL; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", type_id); @@ -1687,7 +1716,7 @@ H5Tcopy(hid_t type_id) H5D_t *dset; /* Dataset for datatype */ /* The argument is a dataset handle */ - if(NULL == (dset = (H5D_t *)H5I_object(type_id))) + if(NULL == (dset = (H5D_t *)H5VL_object(type_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") if(NULL == (dt = H5D_typeof(dset))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the dataset datatype") @@ -1702,6 +1731,7 @@ H5Tcopy(hid_t type_id) case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -1714,14 +1744,14 @@ H5Tcopy(hid_t type_id) /* Copy datatype */ if(NULL == (new_dt = H5T_copy(dt, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy") /* Atomize result */ if((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype atom") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(new_dt && H5T_close_real(new_dt) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release datatype info") @@ -1835,9 +1865,9 @@ H5Tlock(hid_t type_id) H5TRACE1("e", "i", type_id); /* Check args */ - if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - if(H5T_STATE_NAMED==dt->shared->state || H5T_STATE_OPEN==dt->shared->state) + if(H5T_STATE_NAMED == dt->shared->state || H5T_STATE_OPEN == dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to lock named datatype") if(H5T_lock(dt, TRUE) < 0) @@ -1972,15 +2002,6 @@ done: * Programmer: Quincey Koziol * Wednesday, November 29, 2000 * - * Modifications: - * Raymond Lu - * 4 December 2009 - * Added a flag as a parameter to indicate whether the caller is - * H5Tdetect_class. I also added the check for VL string type - * just like the public function. Because we want to tell users - * VL string is a string type but we treat it as a VL type - * internally, H5T_detect_class needs to know where the caller - * is from. *------------------------------------------------------------------------- */ htri_t @@ -2213,7 +2234,7 @@ H5Tget_super(hid_t type) { H5T_t *dt; /* Datatype to query */ H5T_t *super = NULL; /* Supertype */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", type); @@ -2226,7 +2247,7 @@ H5Tget_super(hid_t type) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register parent datatype") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(super && H5T_close_real(super) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release super datatype info") @@ -2242,30 +2263,30 @@ done: * the return value is an integer type. * * Return: Success: Data type for base data type. - * * Failure: NULL * * Programmer: Raymond Lu - * October 9, 2002 + * October 9, 2002 + * *------------------------------------------------------------------------- */ H5T_t * H5T_get_super(const H5T_t *dt) { - H5T_t *ret_value=NULL; + H5T_t *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) HDassert(dt); - if (!dt->shared->parent) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type"); - if (NULL==(ret_value=H5T_copy(dt->shared->parent, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy parent data type"); + if(!dt->shared->parent) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type") + if(NULL == (ret_value = H5T_copy(dt->shared->parent, H5T_COPY_ALL))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy parent data type") done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_get_super() */ /*------------------------------------------------------------------------- @@ -2289,7 +2310,7 @@ H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, FUNC_ENTER_STATIC /* Check args */ - HDassert(H5T_PERS_HARD==pers || H5T_PERS_SOFT==pers); + HDassert(H5T_PERS_HARD == pers || H5T_PERS_SOFT == pers); HDassert(name && *name); HDassert(src); HDassert(dst); @@ -2354,8 +2375,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if(NULL == (new_path = H5T__path_find_real(src, dst, name, conv))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to locate/allocate conversion path") - /* - * Notify all other functions to recalculate private data since some + /* Notify all other functions to recalculate private data since some * functions might cache a list of conversion functions. For * instance, the compound type converter caches a list of conversion * functions for the members, so adding a new function should cause @@ -2445,7 +2465,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((old_path->conv.u.app_func)(tmp_sid, tmp_did, &(old_path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx " + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx " "failed to free private data for %s (ignored)\n", (unsigned long)(old_path->conv.u.app_func), old_path->name); #endif @@ -2455,7 +2475,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((old_path->conv.u.lib_func)(tmp_sid, tmp_did, &(old_path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx " + HDfprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx " "failed to free private data for %s (ignored)\n", (unsigned long)(old_path->conv.u.lib_func), old_path->name); #endif @@ -2627,7 +2647,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((path->conv.u.app_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " "to free private data for %s (ignored)\n", (unsigned long)(path->conv.u.app_func), path->name); #endif @@ -2637,7 +2657,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((path->conv.u.lib_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " "to free private data for %s (ignored)\n", (unsigned long)(path->conv.u.lib_func), path->name); #endif @@ -3035,6 +3055,8 @@ H5T_decode(size_t buf_size, const unsigned char *buf) if(H5T_set_loc(ret_value, NULL, H5T_LOC_MEMORY) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") + /* No VOL object */ + ret_value->vol_obj = NULL; done: /* Release fake file structure */ if(f && H5F_fake_free(f) < 0) @@ -3085,7 +3107,7 @@ H5T__create(H5T_class_t type, size_t size) /* Copy the default string datatype */ if(NULL == (dt = H5T_copy(origin_dt, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy") /* Modify the datatype */ if(H5T__set_size(dt, size) < 0) @@ -3151,13 +3173,16 @@ H5T__create(H5T_class_t type, size_t size) case H5T_REFERENCE: case H5T_NCLASSES: default: - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, NULL, "unknown data type class") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "unknown data type class") } /* end switch */ /* Set the size except VL string */ if(H5T_STRING != type || H5T_VARIABLE != size) dt->shared->size = size; + /* No VOL object */ + dt->vol_obj = NULL; + /* Set return value */ ret_value = dt; @@ -3166,8 +3191,8 @@ done: if(dt) { dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); dt = H5FL_FREE(H5T_t, dt); - } /* end if */ - } /* end if */ + } + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__create() */ @@ -3186,27 +3211,6 @@ done: * Programmer: Robb Matzke * Thursday, December 4, 1997 * - * Modifications: - * - * Robb Matzke, 4 Jun 1998 - * Added the METHOD argument. If it's H5T_COPY_TRANSIENT then the - * result will be an unlocked transient type. Otherwise if it's - * H5T_COPY_ALL then the result is a named type if the original is a - * named type, but the result is not opened. Finally, if it's - * H5T_COPY_REOPEN and the original type is a named type then the result - * is a named type and the type object header is opened again. The - * H5T_COPY_REOPEN method is used when returning a named type to the - * application. - * - * Robb Matzke, 22 Dec 1998 - * Now able to copy enumeration data types. - * - * Robb Matzke, 20 May 1999 - * Now able to copy opaque types. - * - * Pedro Vicente, <pvn@ncsa.uiuc.edu> 21 Sep 2002 - * Added a deep copy of the symbol table entry - * *------------------------------------------------------------------------- */ H5T_t * @@ -3225,13 +3229,16 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* Allocate space */ if(NULL == (new_dt = H5FL_MALLOC(H5T_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") if(NULL == (new_dt->shared = H5FL_MALLOC(H5T_shared_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy shared information (entry information is copied last) */ *(new_dt->shared) = *(old_dt->shared); + /* No VOL object */ + new_dt->vol_obj = NULL; + /* Check what sort of copy we are making */ switch (method) { case H5T_COPY_TRANSIENT: @@ -3265,7 +3272,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* Open named datatype again */ if(H5O_open(&old_dt->oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type") /* Insert opened named datatype into opened object list for the file */ if(H5FO_insert(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr, new_dt->shared, FALSE)<0) @@ -3329,7 +3336,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) new_dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_malloc(new_dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t)); if (NULL == new_dt->shared->u.compnd.memb) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb, new_dt->shared->u.compnd.nmembs * sizeof(H5T_cmemb_t)); @@ -3347,7 +3354,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* Range check against compound member's offset */ if ((accum_change < 0) && ((ssize_t) new_dt->shared->u.compnd.memb[i].offset < accum_change)) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype") /* Apply the accumulated size change to the offset of the field */ new_dt->shared->u.compnd.memb[i].offset += (size_t) accum_change; @@ -3362,7 +3369,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* check if we couldn't find a match */ if(old_match < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "fields in datatype corrupted"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "fields in datatype corrupted") } /* end if */ else old_match = (int) i; @@ -3378,7 +3385,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* Range check against datatype size */ if ((accum_change < 0) && ((ssize_t) new_dt->shared->size < accum_change)) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype") /* Apply the accumulated size change to the size of the compound struct */ new_dt->shared->size += (size_t) accum_change; @@ -3396,7 +3403,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) new_dt->shared->u.enumer.value = (uint8_t *)H5MM_malloc(new_dt->shared->u.enumer.nalloc * new_dt->shared->size); if(NULL == new_dt->shared->u.enumer.value) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value, new_dt->shared->u.enumer.nmembs * new_dt->shared->size); for(i = 0; i < new_dt->shared->u.enumer.nmembs; i++) { @@ -3410,7 +3417,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) if(method == H5T_COPY_TRANSIENT || method == H5T_COPY_REOPEN) { /* H5T_copy converts any type into a memory type */ if(H5T_set_loc(new_dt, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") } /* end if */ break; @@ -3498,9 +3505,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_lock (H5T_t *dt, hbool_t immutable) +H5T_lock(H5T_t *dt, hbool_t immutable) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3511,7 +3518,8 @@ H5T_lock (H5T_t *dt, hbool_t immutable) dt->shared->state = immutable ? H5T_STATE_IMMUTABLE : H5T_STATE_RDONLY; break; case H5T_STATE_RDONLY: - if (immutable) dt->shared->state = H5T_STATE_IMMUTABLE; + if(immutable) + dt->shared->state = H5T_STATE_IMMUTABLE; break; case H5T_STATE_IMMUTABLE: case H5T_STATE_NAMED: @@ -3559,6 +3567,9 @@ H5T__alloc(void) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") dt->shared->version = H5O_DTYPE_VERSION_1; + /* No VOL object initially */ + dt->vol_obj = NULL; + /* Assign return value */ ret_value = dt; @@ -3601,10 +3612,8 @@ H5T__free(H5T_t *dt) /* Free the ID to name info */ H5G_name_free(&(dt->path)); - /* - * Don't free locked datatypes. - */ - if(H5T_STATE_IMMUTABLE==dt->shared->state) + /* Don't free locked datatypes */ + if(H5T_STATE_IMMUTABLE == dt->shared->state) HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close immutable datatype") /* Close the datatype */ @@ -3613,7 +3622,7 @@ H5T__free(H5T_t *dt) for(i = 0; i < dt->shared->u.compnd.nmembs; i++) { dt->shared->u.compnd.memb[i].name = (char *)H5MM_xfree(dt->shared->u.compnd.memb[i].name); (void)H5T_close_real(dt->shared->u.compnd.memb[i].type); - } /* end for */ + } dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_xfree(dt->shared->u.compnd.memb); dt->shared->u.compnd.nmembs = 0; break; @@ -3661,7 +3670,8 @@ done: * * Purpose: Frees a datatype and all associated memory. * - * Hote: Does _not_ deal with open hamed datatypes, etc. + * Note: Does _not_ deal with open named datatypes, etc. so this + * should never see a type managed by a VOL connector. * * Return: Non-negative on success/Negative on failure * @@ -3683,7 +3693,7 @@ H5T_close_real(H5T_t *dt) /* Clean up resources, depending on shared state */ if(dt->shared->state != H5T_STATE_OPEN) { if(H5T__free(dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype") dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); } /* end if */ @@ -3700,41 +3710,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__close_cb - * - * Purpose: Callback routine for closing a datatype ID. Closes the datatype - * object that was attached to the ID. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -static herr_t -H5T__close_cb(H5T_t *dt) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* check args */ - HDassert(dt && dt->shared); - - /* Call actual datatype close routine */ - if(H5T_close(dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype"); - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5T__close_cb() */ - - -/*------------------------------------------------------------------------- - * Function: H5T_close + * Function: H5T_close * - * Purpose: Frees a data type and all associated memory. Deals with - * open named datatypes appropriately. + * Purpose: Frees a data type and all associated memory. Deals with + * open named datatypes appropriately. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Monday, December 8, 1997 @@ -3749,7 +3730,8 @@ H5T_close(H5T_t *dt) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(dt && dt->shared); + HDassert(dt); + HDassert(dt->shared); /* Named datatype cleanups */ if(dt->shared->state == H5T_STATE_OPEN) { @@ -3761,8 +3743,7 @@ H5T_close(H5T_t *dt) HDassert(H5F_addr_defined(dt->sh_loc.u.loc.oh_addr)); HDassert(H5F_addr_defined(dt->oloc.addr)); - /* - * If a named type is being closed then close the object header and + /* If a named type is being closed then close the object header and * remove from the list of open objects in the file. */ @@ -3806,7 +3787,7 @@ H5T_close(H5T_t *dt) /* Clean up resources */ if(H5T_close_real(dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to free datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to free datatype") done: FUNC_LEAVE_NOAPI(ret_value) @@ -3855,14 +3836,14 @@ H5T__set_size(H5T_t *dt, size_t size) if(dt->shared->parent) { if(H5T__set_size(dt->shared->parent, size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for parent data type"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for parent data type") /* Adjust size of datatype appropriately */ if(dt->shared->type==H5T_ARRAY) dt->shared->size = dt->shared->parent->shared->size * dt->shared->u.array.nelem; else if(dt->shared->type!=H5T_VLEN) dt->shared->size = dt->shared->parent->shared->size; - } /* end if */ + } else { if (H5T_IS_ATOMIC(dt->shared)) { offset = dt->shared->u.atomic.offset; @@ -3876,7 +3857,7 @@ H5T__set_size(H5T_t *dt, size_t size) offset = 8 * size - prec; if (prec > 8*size) prec = 8 * size; - } /* end if */ + } else prec = offset = 0; @@ -3897,7 +3878,7 @@ H5T__set_size(H5T_t *dt, size_t size) size_t max_size; if((num_membs = H5T_get_nmembers(dt)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get number of members"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get number of members") if(num_membs) { for(i = 0; i < (unsigned)num_membs; i++) { @@ -3911,7 +3892,7 @@ H5T__set_size(H5T_t *dt, size_t size) max_size = H5T__get_member_size(dt, max_index); if(size < (max_offset + max_size)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size shrinking will cut off last member "); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size shrinking will cut off last member ") } /* end if */ /* Compound must not have been packed previously */ @@ -3931,7 +3912,7 @@ H5T__set_size(H5T_t *dt, size_t size) /* Get a copy of unsigned char type as the base/parent type */ if(NULL == (base = (H5T_t *)H5I_object(H5T_NATIVE_UCHAR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid base datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid base datatype") dt->shared->parent=H5T_copy(base,H5T_COPY_ALL); /* change this datatype into a VL string */ @@ -3957,7 +3938,7 @@ H5T__set_size(H5T_t *dt, size_t size) /* Set up VL information */ if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") } /* end if */ else { prec = 8 * size; @@ -3973,8 +3954,8 @@ H5T__set_size(H5T_t *dt, size_t size) if(dt->shared->u.atomic.u.f.sign >= prec+offset || dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec+offset || dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec+offset) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first"); - } /* end if */ + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first") + } break; case H5T_ENUM: @@ -4000,7 +3981,7 @@ H5T__set_size(H5T_t *dt, size_t size) if (H5T_IS_ATOMIC(dt->shared)) { dt->shared->u.atomic.offset = offset; dt->shared->u.atomic.prec = prec; - } /* end if */ + } } /* end if */ /* Check if the new compound type is packed */ @@ -4038,7 +4019,7 @@ H5T_get_size(const H5T_t *dt) HDassert(dt); FUNC_LEAVE_NOAPI(dt->shared->size) -} +} /* end H5T_get_size() */ /*------------------------------------------------------------------------- @@ -4113,7 +4094,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) /* Build an index for each type so the names are sorted */ if(NULL == (idx1 = (unsigned *)H5MM_malloc(dt1->shared->u.compnd.nmembs * sizeof(unsigned))) || NULL == (idx2 = (unsigned *)H5MM_malloc(dt2->shared->u.compnd.nmembs * sizeof(unsigned)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed") for(u = 0; u < dt1->shared->u.compnd.nmembs; u++) idx1[u] = idx2[u] = u; if(dt1->shared->u.enumer.nmembs > 1) { @@ -4199,7 +4180,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) /* Build an index for each type so the names are sorted */ if(NULL == (idx1 = (unsigned *)H5MM_malloc(dt1->shared->u.enumer.nmembs * sizeof(unsigned))) || NULL == (idx2 = (unsigned *)H5MM_malloc(dt2->shared->u.enumer.nmembs * sizeof(unsigned)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed") for(u=0; u<dt1->shared->u.enumer.nmembs; u++) idx1[u] = u; if(dt1->shared->u.enumer.nmembs > 1) { @@ -4615,7 +4596,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, if(H5T__conv_noop((hid_t)FAIL, (hid_t)FAIL, &(H5T_g.path[0]->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n"); + HDfprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n"); #endif H5E_clear_stack(NULL); /*ignore the error*/ } /* end if */ @@ -4623,8 +4604,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_g.npaths = 1; } /* end if */ - /* - * Find the conversion path. If source and destination types are equal + /* Find the conversion path. If source and destination types are equal * then use entry[0], otherwise do a binary search over the * remaining entries. * @@ -4663,8 +4643,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, */ old_npaths = H5T_g.npaths; - /* - * If we didn't find the path, if the caller is an API function specifying + /* If we didn't find the path, if the caller is an API function specifying * a new hard conversion function, or if the caller is a private function * specifying a new hard conversion and the path is a soft conversion, then * create a new path and add the new function to the path. @@ -4686,8 +4665,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, else path = table; - /* - * If a hard conversion function is specified and none is defined for the + /* If a hard conversion function is specified and none is defined for the * path, or the caller is an API function, or the caller is a private function but * the existing path is a soft function, then add the new conversion to the path * and initialize its conversion data. @@ -4793,7 +4771,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, if((table->conv.u.app_func)((hid_t)FAIL, (hid_t)FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", (unsigned long)(path->conv.u.app_func), path->name); #endif H5E_clear_stack(NULL); /*ignore the failure*/ @@ -4803,7 +4781,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, if((table->conv.u.lib_func)((hid_t)FAIL, (hid_t)FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", (unsigned long)(path->conv.u.lib_func), path->name); #endif H5E_clear_stack(NULL); /*ignore the failure*/ @@ -5028,7 +5006,7 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, H5_timer_end(&(tpath->stats.timer), &timer); tpath->stats.ncalls++; tpath->stats.nelmts += nelmts; - } /* end if */ + } #endif done: @@ -5091,7 +5069,7 @@ done: *------------------------------------------------------------------------- */ H5G_name_t * -H5T_nameof(H5T_t *dt) +H5T_nameof(const H5T_t *dt) { H5G_name_t *ret_value = NULL; @@ -5150,14 +5128,10 @@ done: /*------------------------------------------------------------------------- * Function: H5T_is_named * - * Purpose: Check if a datatype is named. - * - * Return: TRUE + * Purpose: Check if a datatype is named/committed. * - * FALSE + * Return: TRUE/FALSE/FAIL * - * Programmer: Pedro Vicente - * Tuesday, Sep 3, 2002 *------------------------------------------------------------------------- */ htri_t @@ -5169,8 +5143,10 @@ H5T_is_named(const H5T_t *dt) HDassert(dt); - if(dt->shared->state == H5T_STATE_OPEN || dt->shared->state == H5T_STATE_NAMED) + if(dt->vol_obj) ret_value = TRUE; + else + ret_value = (H5T_STATE_OPEN == dt->shared->state || H5T_STATE_NAMED == dt->shared->state); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5212,6 +5188,20 @@ H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f) if(H5G_name_free(&dt->path) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path") + /* If the datatype is committed through the VOL, close it */ + if(NULL != dt->vol_obj) { + H5VL_object_t *vol_obj = dt->vol_obj; + + /* Close the datatype through the VOL*/ + if(H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype") + + /* Free the datatype and set the VOL object pointer to NULL */ + if(H5VL_free_object(vol_obj) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object") + dt->vol_obj = NULL; + } /* end if */ + dt->shared->state = H5T_STATE_TRANSIENT; } /* end if */ @@ -5358,7 +5348,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Mark the VL, compound or array type */ if((changed=H5T_set_loc(dt->shared->parent,f,loc))<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location") if(changed>0) ret_value=changed; @@ -5382,7 +5372,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Range check against compound member's offset */ if ((accum_change < 0) && ((ssize_t) dt->shared->u.compnd.memb[i].offset < accum_change)) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype") /* Apply the accumulated size change to the offset of the field */ dt->shared->u.compnd.memb[i].offset += (size_t) accum_change; @@ -5398,7 +5388,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Mark the VL, compound, enum or array type */ if((changed = H5T_set_loc(memb_type,f,loc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location") if(changed > 0) ret_value = changed; @@ -5407,7 +5397,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Fail if the old_size is zero */ if (0 == old_size) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "old_size of zero would cause division by zero"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "old_size of zero would cause division by zero") /* Adjust the size of the member */ dt->shared->u.compnd.memb[i].size = (dt->shared->u.compnd.memb[i].size*memb_type->shared->size)/old_size; @@ -5420,7 +5410,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Range check against datatype size */ if ((accum_change < 0) && ((ssize_t) dt->shared->size < accum_change)) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype") /* Apply the accumulated size change to the datatype */ dt->shared->size += (size_t) accum_change; @@ -5432,14 +5422,14 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* (If the force_conv flag is _not_ set, the type cannot change in size, so don't recurse) */ if(dt->shared->parent->shared->force_conv && H5T_IS_COMPLEX(dt->shared->parent->shared->type)) { if((changed = H5T_set_loc(dt->shared->parent,f,loc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location") if(changed > 0) ret_value = changed; } /* end if */ /* Mark this VL sequence */ if((changed = H5T__vlen_set_loc(dt, f, loc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location") if(changed > 0) ret_value = changed; break; @@ -359,7 +359,6 @@ H5TS_win32_process_enter(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContex) ret_value = FALSE; #endif /* H5_HAVE_CODESTACK */ - /* Set up thread local storage */ if(TLS_OUT_OF_INDEXES == (H5TS_apictx_key_g = TlsAlloc())) ret_value = FALSE; @@ -428,12 +427,9 @@ H5TS_win32_process_exit(void) /* Clean up per-process thread local storage */ TlsFree(H5TS_errstk_key_g); - #ifdef H5_HAVE_CODESTACK TlsFree(H5TS_funcstk_key_g); #endif /* H5_HAVE_CODESTACK */ - - /* Clean up per-process thread local storage */ TlsFree(H5TS_apictx_key_g); return; @@ -479,7 +475,6 @@ H5TS_win32_thread_exit(void) LocalFree((HLOCAL)lpvData); #endif /* H5_HAVE_CODESTACK */ - /* Clean up per-thread thread local storage */ lpvData = TlsGetValue(H5TS_apictx_key_g); if(lpvData) LocalFree((HLOCAL)lpvData); @@ -534,3 +529,4 @@ H5TS_create_thread(void *(*func)(void *), H5TS_attr_t *attr, void *udata) } /* H5TS_create_thread */ #endif /* H5_HAVE_THREADSAFE */ + diff --git a/src/H5TSprivate.h b/src/H5TSprivate.h index 8d74676..9e093a6 100644 --- a/src/H5TSprivate.h +++ b/src/H5TSprivate.h @@ -128,3 +128,4 @@ H5_DLL H5TS_thread_t H5TS_create_thread(void *(*func)(void *), H5TS_attr_t * att #endif /* c_plusplus || __cplusplus */ #endif /* H5TSprivate_H_ */ + diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 1719f8f..712b264 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -30,12 +30,15 @@ #include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ #include "H5FOprivate.h" /* File objects */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory Management */ +#include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property lists */ #include "H5Tpkg.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -56,11 +59,7 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id); -static hid_t H5T__get_create_plist(const H5T_t *type); static H5T_t *H5T__open_oid(const H5G_loc_t *loc); -static herr_t H5T__flush(H5T_t *dt, hid_t type_id); -static herr_t H5T__refresh(H5T_t *dt, hid_t type_id); /*********************/ @@ -82,18 +81,21 @@ static herr_t H5T__refresh(H5T_t *dt, hid_t type_id); /* Local Variables */ /*******************/ +/* Declare a free list to manage the H5VL_t struct */ +H5FL_EXTERN(H5VL_t); + +/* Declare a free list to manage the H5VL_object_t struct */ +H5FL_EXTERN(H5VL_object_t); + /*------------------------------------------------------------------------- - * Function: H5Tcommit2 + * Function: H5Tcommit2 * - * Purpose: Save a transient datatype to a file and turn the type handle - * into a "named", immutable type. + * Purpose: Save a transient datatype to a file and turn the type handle + * into a "named", immutable type. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * April 5, 2007 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -101,20 +103,25 @@ herr_t H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id) { - H5G_loc_t loc; /* Location to create datatype */ - H5T_t *type; /* Datatype for ID */ + void *data = NULL; /* VOL-managed datatype data */ + H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */ + H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*siiii", loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_is_named(dt)) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") /* Get correct property list */ if(H5P_DEFAULT == lcpl_id) @@ -124,7 +131,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list") /* Get correct property list */ - if(H5P_DEFAULT == tcpl_id) + if (H5P_DEFAULT == tcpl_id) tcpl_id = H5P_DATATYPE_CREATE_DEFAULT; else if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE)) @@ -134,9 +141,27 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the object from the loc_id */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + /* Commit the type */ - if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + if(NULL == (data = H5VL_datatype_commit(vol_obj, &loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + + /* Set up VOL object */ + if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate top object structure") + new_obj->connector = vol_obj->connector; + new_obj->connector->nrefs ++; + new_obj->data = data; + + /* Set the committed type object to the VOL connector pointer in the H5T_t struct */ + dt->vol_obj = new_obj; done: FUNC_LEAVE_API(ret_value) @@ -165,7 +190,7 @@ H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, H5T_state_t old_state; /* The state of the datatype before H5T__commit. */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(loc); @@ -196,7 +221,7 @@ done: * to return it to the state it was in before it was committed. */ if(ret_value < 0 && (NULL != ocrt_info.new_obj)) { - if(dt->shared->state == H5T_STATE_OPEN && dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { + if(dt->shared->state == H5T_STATE_OPEN && dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { /* Remove the datatype from the list of opened objects in the file */ if(H5FO_top_decr(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object") @@ -214,49 +239,49 @@ done: /* Mark datatype as being back in memory */ if(H5T_set_loc(dt, dt->sh_loc.file, H5T_LOC_MEMORY)) HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to return datatype to memory") - dt->sh_loc.type = H5O_SHARE_TYPE_UNSHARED; + dt->sh_loc.type = H5O_SHARE_TYPE_UNSHARED; dt->shared->state = old_state; - } /* end if */ + } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__commit_named() */ /*------------------------------------------------------------------------- - * Function: H5Tcommit_anon + * Function: H5Tcommit_anon * - * Purpose: Save a transient datatype to a file and turn the type handle - * into a "named", immutable type. + * Purpose: Save a transient datatype to a file and turn the type handle + * into a "named", immutable type. * * The resulting ID should be linked into the file with * H5Olink or it will be deleted when closed. * - * Note: Datatype access property list is unused currently, but is - * checked for sanity anyway. + * Note: The datatype access property list is unused currently, but + * is checked for sanity anyway. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Peter Cao - * May 17, 2005 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) { - H5G_loc_t loc; /* Group location for location */ - H5T_t *type = NULL; /* Datatype created */ + 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_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "iiii", loc_id, type_id, tcpl_id, tapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_is_named(type)) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") /* Get correct property list */ if(H5P_DEFAULT == tcpl_id) @@ -269,9 +294,27 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Commit the type */ - if(H5T__commit_anon(loc.oloc->file, type, tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + + /* Commit the datatype */ + if(NULL == (dt = H5VL_datatype_commit(vol_obj, &loc_params, NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + + /* Setup VOL object */ + if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate top object structure") + new_obj->connector = vol_obj->connector; + new_obj->connector->nrefs ++; + new_obj->data = dt; + + /* Set the committed type object to the VOL connector pointer in the H5T_t struct */ + type->vol_obj = new_obj; done: FUNC_LEAVE_API(ret_value) @@ -279,24 +322,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__commit_anon + * Function: H5T__commit_anon * - * Purpose: Create an anonymous committed datatype. + * Purpose: Create an anonymous committed datatype. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 12, 2017 * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) { H5O_loc_t *oloc; /* Object location for datatype */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(file); @@ -305,7 +348,7 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) /* Commit the type */ if(H5T__commit(file, type, tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Release the datatype's object header */ @@ -318,7 +361,7 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5T__commit_anon() */ @@ -394,9 +437,9 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id) * type message and then give the object header a name. */ if(H5O_create(file, dtype_size, (size_t)1, tcpl_id, &temp_oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header") if(H5O_msg_create(&temp_oloc, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, type) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message") /* Copy the new object header's location into the datatype, taking ownership of it */ if(H5O_loc_copy(&(type->oloc), &temp_oloc, H5_COPY_SHALLOW) < 0) @@ -444,23 +487,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Tcommitted - * - * Purpose: Determines if a datatype is committed or not. + * Function: H5Tcommitted * - * Return: Success: TRUE if committed, FALSE otherwise. + * Purpose: Determines if a datatype is committed or not. * - * Failure: Negative - * - * Programmer: Robb Matzke - * Thursday, June 4, 1998 + * Return: TRUE/FALSE/FAIL * *------------------------------------------------------------------------- */ htri_t H5Tcommitted(hid_t type_id) { - H5T_t *type; /* Datatype to query */ + H5T_t *type; /* Datatype to query */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -468,10 +506,10 @@ H5Tcommitted(hid_t type_id) /* Check arguments */ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Set return value */ - ret_value = H5T_committed(type); + ret_value = H5T_is_named(type); done: FUNC_LEAVE_API(ret_value) @@ -479,30 +517,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_committed - * - * Purpose: Determines if a datatype is committed or not. - * - * Return: Success: TRUE if committed, FALSE otherwise. - * - * Programmer: Quincey Koziol - * Wednesday, September 24, 2003 - * - *------------------------------------------------------------------------- - */ -htri_t -H5T_committed(const H5T_t *type) -{ - /* Use no-init for efficiency */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(type); - - FUNC_LEAVE_NOAPI(H5T_STATE_OPEN == type->shared->state || H5T_STATE_NAMED == type->shared->state) -} /* end H5T_committed() */ - - -/*------------------------------------------------------------------------- * Function: H5T_link * * Purpose: Adjust the link count for an object header by adding @@ -521,14 +535,14 @@ H5T_link(const H5T_t *type, int adjust) { int ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) HDassert(type); HDassert(type->sh_loc.type == H5O_SHARE_TYPE_COMMITTED); /* Adjust the link count on the named datatype */ if((ret_value = H5O_link(&type->oloc, adjust)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_LINKCOUNT, FAIL, "unable to adjust named datatype link count") + HGOTO_ERROR(H5E_DATATYPE, H5E_LINKCOUNT, (-1), "unable to adjust named datatype link count") done: FUNC_LEAVE_NOAPI(ret_value) @@ -536,99 +550,118 @@ done: /*------------------------------------------------------------------------- - * Function: H5Topen2 + * Function: H5Topen2 * - * Purpose: Opens a named datatype using a Datatype Access Property + * Purpose: Opens a named datatype using a Datatype Access Property * List. * - * Return: Success: Object ID of the named datatype. - * Failure: Negative + * Return: Success: Object ID of the named datatype * - * Programmer: James Laird - * Thursday July 27, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) { - H5T_t *type = NULL; /* Datatype opened in file */ - H5G_loc_t loc; /* Group location of object to open */ + void *dt = NULL; /* datatype token created by VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, tapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Open it */ - if(NULL == (type = H5T__open_name(&loc, name))) + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") + + /* Open the datatype */ + if(NULL == (dt = H5VL_datatype_open(vol_obj, &loc_params, name, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ - if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Cleanup on error */ - if(ret_value < 0) - if(type != NULL) - (void)H5T_close(type); + if(H5I_INVALID_HID == ret_value) + if(dt && H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") FUNC_LEAVE_API(ret_value) } /* end H5Topen2() */ /*------------------------------------------------------------------------- - * Function: H5Tget_create_plist - * - * Purpose: Returns a copy of the datatype creation property list. + * Function: H5Tget_create_plist * - * Note: There are no datatype creation properties currently, just - * object creation ones. + * Purpose: Returns a copy of the datatype creation property list. * - * Return: Success: ID for a copy of the datatype creation - * property list. The property list ID should be - * released by calling H5Pclose(). + * Note: There are no datatype creation properties currently, just + * object creation ones. * - * Failure: FAIL + * Return: Success: ID for a copy of the datatype creation + * property list. The property list ID should be + * released by calling H5Pclose(). * - * Programmer: Quincey Koziol - * Tuesday, November 28, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Tget_create_plist(hid_t dtype_id) { - H5T_t *type; /* Datatype object for ID */ - herr_t status; /* Generic status value */ - hid_t ret_value = FAIL; /* Return value */ + H5T_t *type = NULL; /* Datatype object for ID */ + htri_t is_named = FAIL; /* Is the datatype named? */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dtype_id); /* Check arguments */ if(NULL == (type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype") /* Check if the datatype is committed */ - if((status = H5T_committed(type)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check whether datatype is committed") + if(FAIL == (is_named = H5T_is_named(type))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't check whether datatype is committed") - /* Retrieve further information, if the datatype is committed */ - if(status > 0) - /* Retrieve datatype creation properties */ - if((ret_value = H5T__get_create_plist(type)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info") + /* If the datatype is not committed/named, just copy the default + * creation property list and return that. + */ + if(FALSE == is_named) { + H5P_genplist_t *tcpl_plist = NULL; + + /* Copy the default datatype creation property list */ + if(NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_ID_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get default creation property list") + if((ret_value = H5P_copy_plist(tcpl_plist, TRUE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list") + } /* end if */ + /* If the datatype is committed, retrieve further information */ + else { + H5VL_object_t *vol_obj = type->vol_obj; + + /* Get the property list through the VOL */ + if(H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_TCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") + } /* end else */ done: FUNC_LEAVE_API(ret_value) @@ -667,8 +700,9 @@ H5Tflush(hid_t type_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Flush metadata for named datatype */ - if(H5T__flush(dt, type_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") + if(dt->vol_obj) + if(H5VL_datatype_specific(dt->vol_obj, H5VL_DATATYPE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") done: FUNC_LEAVE_API(ret_value) @@ -706,9 +740,10 @@ H5Trefresh(hid_t type_id) if(H5CX_set_loc(type_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call private function to refresh datatype object */ - if((H5T__refresh(dt, type_id)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") + /* Refresh the datatype's metadata */ + if(dt->vol_obj) + if(H5VL_datatype_specific(dt->vol_obj, H5VL_DATATYPE_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") done: FUNC_LEAVE_API(ret_value) @@ -716,50 +751,50 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__get_create_plist + * Function: H5T__get_create_plist * - * Purpose: Returns a copy of the datatype creation property list. + * Purpose: Returns a copy of the datatype creation property list. * - * Note: There are no datatype creation properties currently, just - * object creation ones. + * Note: There are no datatype creation properties currently, just + * object creation ones. * - * Return: Success: ID for a copy of the datatype creation - * property list. The property list ID should be - * released by calling H5Pclose(). + * Return: Success: ID for a copy of the datatype creation + * property list. The property list ID should be + * released by calling H5Pclose(). * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * Wednesday, December 13, 2017 * *------------------------------------------------------------------------- */ -static hid_t +hid_t H5T__get_create_plist(const H5T_t *type) { H5P_genplist_t *tcpl_plist; /* Existing datatype creation propertty list */ H5P_genplist_t *new_plist; /* New datatype creation property list */ hid_t new_tcpl_id = FAIL; /* New datatype creation property list */ - hid_t ret_value = FAIL; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(type); /* Copy the default datatype creation property list */ if(NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_ID_g))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "can't get default creation property list") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "can't get default creation property list") if((new_tcpl_id = H5P_copy_plist(tcpl_plist, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to copy the creation property list") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list") /* Get property list object for new TCPL */ if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_tcpl_id))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "can't get property list") /* Retrieve any object creation properties */ if(H5O_get_create_plist(&type->oloc, new_plist) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") /* Set the return value */ ret_value = new_tcpl_id; @@ -768,9 +803,9 @@ done: if(ret_value < 0) if(new_tcpl_id > 0) if(H5I_dec_app_ref(new_tcpl_id) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to close temporary object") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, H5I_INVALID_HID, "unable to close temporary object") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_create_plist() */ @@ -798,7 +833,7 @@ H5T__open_name(const H5G_loc_t *loc, const char *name) hbool_t obj_found = FALSE; /* Object at 'name' found */ H5T_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(loc); @@ -836,7 +871,7 @@ done: if(H5G_loc_free(&type_loc) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, NULL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__open_name() */ @@ -891,6 +926,7 @@ H5T_open(const H5G_loc_t *loc) else { if(NULL == (dt = H5FL_MALLOC(H5T_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype") + dt->vol_obj = NULL; #if defined(H5_USING_MEMCHECKER) || !defined(NDEBUG) /* Clear object location */ @@ -983,11 +1019,11 @@ H5T__open_oid(const H5G_loc_t *loc) /* Open named datatype object in file */ if(H5O_open(loc->oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype") /* Deserialize the datatype message into a datatype in memory */ if(NULL == (dt = (H5T_t *)H5O_msg_read(loc->oloc, H5O_DTYPE_ID, NULL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header") /* Mark the type as named and open */ dt->shared->state = H5T_STATE_OPEN; @@ -1042,71 +1078,204 @@ H5T_update_shared(H5T_t *dt) /*------------------------------------------------------------------------- - * Function: H5T__flush + * Function: H5T_construct_datatype * - * Purpose: Internal routine to flushes a named datatype to disk. + * Purpose: Create a Library datatype with a connector specific datatype object * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). + * Return: Success: A type structure + * Failure: NULL * - * Return: Success: Non-negative - * Failure: Negative + *------------------------------------------------------------------------- + */ +H5T_t * +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 *ret_value = NULL; + + FUNC_ENTER_NOAPI(NULL) + + /* get required buf size for encoding the datatype */ + if(H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, NULL, 0) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get datatype serialized size") + + /* allocate buffer to store binary description of the datatype */ + if(NULL == (buf = (void *)H5MM_calloc((size_t)nalloc))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype") + + /* get binary description of the datatype */ + if(H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, buf, (size_t)nalloc) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get serialized datatype") + + if(NULL == (dt = H5T_decode((size_t)nalloc, (const unsigned char *)buf))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't decode datatype") + + dt->vol_obj = vol_obj; + + ret_value = dt; + +done: + if(buf) + buf = H5MM_xfree(buf); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_construct_datatype() */ + + +/*------------------------------------------------------------------------- + * Function: H5T_get_named_type * - * Programmer: Quincey Koziol - * December 18, 2017 + * Purpose: Returns the VOL object for the named datatype if it exists + * + * Return: Success: Pointer to the VOL object for the datatype + * Failure: NULL * *------------------------------------------------------------------------- */ -static herr_t -H5T__flush(H5T_t *dt, hid_t type_id) +H5VL_object_t * +H5T_get_named_type(const H5T_t *dt) { - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Sanity check */ - HDassert(dt); + if(NULL != dt->vol_obj) + ret_value = dt->vol_obj; - /* To flush metadata and invoke flush callback if there is */ - if(H5O_flush_common(&dt->oloc, type_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype and object flush callback") + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_get_named_type() */ -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5T__flush */ + +/*------------------------------------------------------------------------- + * Function: H5T_get_actual_type + * + * Purpose: Returns underlying native datatype created by native connector + * if datatype is committed, otherwise return the datatype + * object associate with the ID. + * + * Return: Success: Pointer to the VOL-managed data for this datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5T_t * +H5T_get_actual_type(H5T_t *dt) +{ + H5T_t *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Check if the datatype is committed */ + if(NULL == dt->vol_obj) + ret_value = dt; + else + ret_value = (H5T_t *)H5VL_object_data(dt->vol_obj); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_get_actual_type() */ /*------------------------------------------------------------------------- - * Function: H5T__refresh + * Function: H5T_save_refresh_state + * + * Purpose: Save state for datatype reconstuction after a refresh. * - * Purpose: Internal routine to refresh a named datatype. + * Return: SUCCEED/FAIL * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). + *------------------------------------------------------------------------- + */ +herr_t +H5T_save_refresh_state(hid_t tid, H5O_shared_t *cached_H5O_shared) +{ + H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */ + H5T_t *vol_dt = NULL; /* H5T_t pointer stored in the datatype's vol_obj field */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(cached_H5O_shared); + + if(NULL == (dt = (H5T_t *)H5I_object_verify(tid, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not a datatype ID") + vol_dt = (H5T_t *)(dt->vol_obj->data); + if(NULL == vol_dt) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not not a named datatype ID") + + /* Increase the count on the file object */ + vol_dt->shared->fo_count += 1; + + /* Increment object count for the object in the top file */ + if(H5FO_top_incr(vol_dt->sh_loc.file, vol_dt->sh_loc.u.loc.oh_addr) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, FAIL, "can't increment object count") + + /* Cache the H5O_shared_t data */ + HDmemcpy(cached_H5O_shared, &(vol_dt->sh_loc), sizeof(H5O_shared_t)); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_save_refresh_state() */ + + +/*------------------------------------------------------------------------- + * Function: H5T_restore_refresh_state * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Restore state for datatype reconstuction after a refresh. * - * Programmer: Quincey Koziol - * December 18, 2017 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static herr_t -H5T__refresh(H5T_t *dt, hid_t type_id) +herr_t +H5T_restore_refresh_state(hid_t tid, H5O_shared_t *cached_H5O_shared) { + H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */ + H5T_t *vol_dt = NULL; /* H5T_t pointer stored in the datatype's vol_obj field */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_NOAPI(FAIL) - /* Sanity check */ - HDassert(dt); + HDassert(cached_H5O_shared); + + if(NULL == (dt = (H5T_t *)H5I_object_verify(tid, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid not a datatype ID") + vol_dt = (H5T_t *)(dt->vol_obj->data); + if(NULL == vol_dt) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not not a named datatype ID") + + /* Restore the H5O_shared_t data */ + HDmemcpy(&(vol_dt->sh_loc), cached_H5O_shared, sizeof(H5O_shared_t)); - /* Call private function to refresh datatype object */ - if((H5O_refresh_metadata(type_id, dt->oloc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") + /* Decrement the ref. count for this object in the top file */ + if(H5FO_top_decr(vol_dt->sh_loc.file, vol_dt->sh_loc.u.loc.oh_addr) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "can't decrement object count") + + /* Decrease the count on the file object */ + vol_dt->shared->fo_count -= 1; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5T__refresh */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_restore_refresh_state() */ + + +/*------------------------------------------------------------------------- + * Function: H5T_already_vol_managed + * + * Purpose: Check if the committed datatype is already VOL managed + * + * Return: TRUE / FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +H5T_already_vol_managed(const H5T_t *dt) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(dt); + + FUNC_LEAVE_NOAPI( dt->vol_obj != NULL ) +} /* end H5T_already_vol_managed() */ diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index feece57..d4f1008 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -202,7 +202,7 @@ done: * modifying the returned datatype does not * modify the member type. * - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Wednesday, January 7, 1998 @@ -221,17 +221,17 @@ H5Tget_member_type(hid_t type_id, unsigned membno) /* Check args */ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a compound datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a compound datatype") if(membno >= dt->shared->u.compnd.nmembs) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid member number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid member number") /* Retrieve the datatype for the member */ if(NULL == (memb_dt = H5T_get_member_type(dt, membno, H5T_COPY_REOPEN))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to retrieve member type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to retrieve member type") /* Get an ID for the datatype */ if((ret_value = H5I_register(H5I_DATATYPE, memb_dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable register datatype atom") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable register datatype atom") done: if(ret_value < 0) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 803a6da..e6d83bb 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2962,7 +2962,7 @@ H5T__conv_enum_numeric(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne src_parent = src->shared->parent; if(NULL == (tpath = H5T_path_find(src_parent, dst))) { - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype") } else if(!H5T_path_noop(tpath)) { if((src_parent_id = H5I_register(H5I_DATATYPE, H5T_copy(src_parent, H5T_COPY_ALL), FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") @@ -7480,7 +7480,7 @@ H5T__conv_llong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * *------------------------------------------------------------------------- */ -#if H5T_CONV_INTERNAL_LLONG_LDOUBLE +#ifdef H5T_CONV_INTERNAL_LLONG_LDOUBLE herr_t H5T__conv_llong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, @@ -7548,7 +7548,7 @@ H5T__conv_ullong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * *------------------------------------------------------------------------- */ -#if H5T_CONV_INTERNAL_ULLONG_LDOUBLE +#ifdef H5T_CONV_INTERNAL_ULLONG_LDOUBLE herr_t H5T__conv_ullong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, @@ -8244,7 +8244,7 @@ H5_GCC_DIAG_ON(float-equal) * *------------------------------------------------------------------------- */ -#if H5T_CONV_INTERNAL_LDOUBLE_LLONG +#ifdef H5T_CONV_INTERNAL_LDOUBLE_LLONG herr_t H5T__conv_ldouble_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, @@ -8295,14 +8295,6 @@ H5_GCC_DIAG_ON(float-equal) * Programmer: Raymond Lu * Wednesday, Jan 21, 2004 * - * Raymond Lu - * Wednesday, April 21, 2004 - * There is a new design for exception handling like overflow, - * which is passed in as a transfer property. - * - * Raymond Lu - * Monday, March 13, 2006 - * Added support for VAX floating-point types. *------------------------------------------------------------------------- */ herr_t @@ -9008,8 +9000,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } #endif - /* - * Put the data in little endian order so our loops aren't so + /* Put the data in little endian order so our loops aren't so * complicated. We'll do all the conversion stuff assuming * little endian and then we'll fix the order at the end. */ @@ -9022,26 +9013,23 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } } - /*zero-set all destination bits*/ + /* Zero-set all destination bits*/ H5T__bit_set (d, dst.offset, dst.prec, FALSE); /* Copy source into a temporary buffer */ H5T__bit_copy(int_buf, (size_t)0, s, src.offset, src.prec); - /* - * Find the sign bit value of the source. - */ + /* Find the sign bit value of the source */ if(H5T_SGN_2 == src.u.i.sign) sign = (size_t)H5T__bit_get_d(int_buf, src.prec - 1, (size_t)1); - /* - * What is the bit position(starting from 0 as first one) for the most significant - * bit(MSB) of S which is set? + /* What is the bit position(starting from 0 as first one) for the most significant + * bit(MSB) of S which is set? */ if(H5T_SGN_2 == src.u.i.sign) { sfirst = H5T__bit_find(int_buf, (size_t)0, src.prec - 1, H5T_BIT_MSB, TRUE); if(sign && sfirst < 0) - /* The case 0x80...00, which is negative with maximal value */ + /* The case 0x80...00, which is negative with maximal value */ is_max_neg = 1; } else if(H5T_SGN_NONE == src.u.i.sign) sfirst = H5T__bit_find(int_buf, (size_t)0, src.prec, H5T_BIT_MSB, TRUE); @@ -9050,9 +9038,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(!sign && sfirst < 0) goto padding; - /* - * Convert source integer if it's negative - */ + /* Convert source integer if it's negative */ if(H5T_SGN_2 == src.u.i.sign && sign) { if(!is_max_neg) { /* Equivalent to ~(i - 1) */ @@ -9060,10 +9046,10 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T__bit_neg(int_buf, (size_t)0, buf_size * 8); sfirst = H5T__bit_find(int_buf, (size_t)0, src.prec - 1, H5T_BIT_MSB, TRUE); } else { - /* If it's maximal negative number 0x80...000, treat it as if it overflowed - * (create a carry) to help conversion. i.e. a character type number 0x80 - * is treated as 0x100. - */ + /* If it's maximal negative number 0x80...000, treat it as if it overflowed + * (create a carry) to help conversion. i.e. a character type number 0x80 + * is treated as 0x100. + */ sfirst = (ssize_t)(src.prec - 1); is_max_neg = 0; } @@ -9072,7 +9058,8 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Sign bit has been negated if bit vector isn't 0x80...00. Set all bits in front of * sign bit to 0 in the temporary buffer because they're all negated from the previous - * step. */ + * step. + */ H5T__bit_set(int_buf, src.prec, (buf_size * 8) - src.prec, 0); /* Set sign bit in destination */ @@ -9081,14 +9068,14 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, first = (size_t)sfirst; - /* - * Calculate the true destination exponent by adjusting according to + /* Calculate the true destination exponent by adjusting according to * the destination exponent bias. Implied and non-implied normalization * should be the same. */ if (H5T_NORM_NONE==dst.u.f.norm || H5T_NORM_IMPLIED==dst.u.f.norm) { expo = first + dst.u.f.ebias; - } else { + } + else { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "normalization method not implemented yet") } @@ -9096,13 +9083,14 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (H5T_NORM_IMPLIED==dst.u.f.norm) { /* Imply first bit */ H5T__bit_set(int_buf, first, (size_t)1, 0); - } else if (H5T_NORM_NONE==dst.u.f.norm) { - first++; + } + else if (H5T_NORM_NONE==dst.u.f.norm) { + first++; } /* Roundup for mantissa */ if(first > dst.u.f.msize) { - /* If the bit sequence is bigger than the mantissa part, there'll be some + /* If the bit sequence is bigger than the mantissa part, there'll be some * precision loss. Let user's handler deal with the case if it's present */ if(cb_struct.func) { @@ -9114,14 +9102,15 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(except_ret == H5T_CONV_HANDLED) { reverse = FALSE; goto padding; - } else if(except_ret == H5T_CONV_ABORT) + } + else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") - /* If user's exception handler does deal with it, we do it by dropping off the - * extra bits at the end and do rounding. If we have .50...0(decimal) after radix - * point, we do roundup when the least significant digit before radix is odd, we do - * rounddown if it's even. - */ + /* If user's exception handler does deal with it, we do it by dropping off the + * extra bits at the end and do rounding. If we have .50...0(decimal) after radix + * point, we do roundup when the least significant digit before radix is odd, we do + * rounddown if it's even. + */ /* Check 1st dropoff bit, see if it's set. */ if(H5T__bit_get_d(int_buf, ((first - dst.u.f.msize) - 1), (size_t)1)) { diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 13d2f5f..6ee0cd7 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -43,6 +43,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Ppublic.h" /* Property Lists */ #include "H5Tpkg.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -79,6 +80,12 @@ /* Local Variables */ /*******************/ +/* Declare a free list to manage the H5VL_t struct */ +H5FL_EXTERN(H5VL_t); + +/* Declare a free list to manage the H5VL_object_t struct */ +H5FL_EXTERN(H5VL_object_t); + #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -100,28 +107,48 @@ herr_t H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) { - H5G_loc_t loc; /* Location to create datatype */ - H5T_t *type; /* Datatype for ID */ + void *data = NULL; /* VOL-managed datatype data */ + H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */ + H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*si", loc_id, name, type_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_is_named(dt)) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Commit the datatype to the file, using default property list values */ - if(H5T__commit_named(&loc, name, type, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the object from the loc_id */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + /* Commit the datatype */ + if(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 */ + if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) + HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") + new_obj->connector = vol_obj->connector; + new_obj->connector->nrefs ++; + new_obj->data = data; + + /* Set the committed type object to the VOL connector pointer in the H5T_t struct */ + dt->vol_obj = new_obj; done: FUNC_LEAVE_API(ret_value) @@ -137,7 +164,7 @@ done: * * Return: Success: Object ID of the named datatype. * - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Monday, June 1, 1998 @@ -147,32 +174,38 @@ done: hid_t H5Topen1(hid_t loc_id, const char *name) { - H5T_t *type = NULL; - H5G_loc_t loc; - hid_t ret_value = H5I_INVALID_HID; + void *dt = NULL; /* Datatype token created by VOL connector */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") - /* Open it */ - if(NULL == (type = H5T__open_name(&loc, name))) + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Open the datatype */ + if(NULL == (dt = H5VL_datatype_open(vol_obj, &loc_params, name, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ - if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Cleanup on error */ - if(ret_value < 0) - if(type && H5T_close(type) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close datatype") + if(H5I_INVALID_HID == ret_value) + if(dt && H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to close datatype") FUNC_LEAVE_API(ret_value) } /* end H5Topen1() */ diff --git a/src/H5Tenum.c b/src/H5Tenum.c index ade7d08..0ed1775 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -46,8 +46,6 @@ static herr_t H5T_enum_valueof(const H5T_t *dt, const char *name, * Programmer: Robb Matzke * Tuesday, December 22, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t diff --git a/src/H5Toh.c b/src/H5Toh.c index c0139fe..b21ce72 100644 --- a/src/H5Toh.c +++ b/src/H5Toh.c @@ -44,7 +44,7 @@ /********************/ static htri_t H5O__dtype_isa(const H5O_t *loc); -static hid_t H5O__dtype_open(const H5G_loc_t *obj_loc, hbool_t app_ref); +static void *H5O__dtype_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type); static void *H5O__dtype_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc); static H5O_loc_t *H5O__dtype_get_oloc(hid_t obj_id); @@ -125,28 +125,28 @@ done: * *------------------------------------------------------------------------- */ -static hid_t -H5O__dtype_open(const H5G_loc_t *obj_loc, hbool_t app_ref) +static void * +H5O__dtype_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) { - H5T_t *type = NULL; /* Datatype opened */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5T_t *type = NULL; /* Datatype opened */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC HDassert(obj_loc); + *opened_type = H5I_DATATYPE; + /* Open the datatype */ if(NULL == (type = H5T_open(obj_loc))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to open datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open datatype") - /* Register an ID for the datatype */ - if((ret_value = H5I_register(H5I_DATATYPE, type, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") + ret_value = (void *)type; done: - if(ret_value < 0) + if(NULL == ret_value) if(type && H5T_close(type) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release datatype") + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, NULL, "unable to release datatype") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__dtype_open() */ @@ -180,7 +180,7 @@ H5O__dtype_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc) /* Commit the type to the file */ if(H5T__commit(f, crt_info->dt, crt_info->tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") /* Set up the new named datatype's location */ if(NULL == (obj_loc->oloc = H5T_oloc(crt_info->dt))) @@ -212,14 +212,17 @@ done: static H5O_loc_t * H5O__dtype_get_oloc(hid_t obj_id) { - H5T_t *type; /* Datatype opened */ + H5T_t *type = NULL; /* Datatype opened */ + H5T_t *dt = NULL; H5O_loc_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC /* Get the datatype */ - if(NULL == (type = (H5T_t *)H5I_object(obj_id))) + if(NULL == (dt = (H5T_t *)H5I_object(obj_id))) HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID") + /* If this is a named datatype, get the VOL driver pointer to the datatype */ + type = (H5T_t *)H5T_get_actual_type(dt); /* Get the datatype's object header location */ if(NULL == (ret_value = H5T_oloc(type))) diff --git a/src/H5Torder.c b/src/H5Torder.c index 877316d..d687d03 100644 --- a/src/H5Torder.c +++ b/src/H5Torder.c @@ -199,7 +199,7 @@ done: herr_t H5Tset_order(hid_t type_id, H5T_order_t order) { - H5T_t *dt; /* Datatype to modify */ + H5T_t *dt = NULL; /* Datatype to modify */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -207,15 +207,17 @@ H5Tset_order(hid_t type_id, H5T_order_t order) /* Check args */ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") if(order < H5T_ORDER_LE || order > H5T_ORDER_NONE || order == H5T_ORDER_MIXED) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order") + if(NULL != dt->vol_obj) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") if(H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype is read-only") /* Call internal routine to set the order */ if(H5T_set_order(dt, order) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't set order") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't set order") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index e1b996c..c909f18 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -167,7 +167,7 @@ struct H5T_path_t { char name[H5T_NAMELEN]; /*name for debugging only */ H5T_t *src; /*source datatype */ H5T_t *dst; /*destination datatype */ - H5T_conv_func_t conv; /* Conversion funcion */ + H5T_conv_func_t conv; /* Conversion function */ hbool_t is_hard; /*is it a hard function? */ hbool_t is_noop; /*is it the noop conversion? */ hbool_t are_compounds; /*are source and dest both compounds?*/ @@ -320,6 +320,7 @@ struct H5T_t { H5T_shared_t *shared; /* all other information */ H5O_loc_t oloc; /* Object location, if the type is a named type */ H5G_name_t path; /* group hier. path if the type is a named type */ + H5VL_object_t *vol_obj; /* pointer to VOL object when working with committed datatypes */ }; /* The master list of soft conversion functions */ @@ -447,10 +448,12 @@ H5_DLL herr_t H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, H5_DLL herr_t H5T__upgrade_version(H5T_t *dt, unsigned new_version); /* Committed / named datatype routines */ +H5_DLL herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id); H5_DLL herr_t H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id); H5_DLL herr_t H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, hid_t lcpl_id, hid_t tcpl_id); H5_DLL H5T_t *H5T__open_name(const H5G_loc_t *loc, const char *name); +H5_DLL hid_t H5T__get_create_plist(const H5T_t *type); /* Conversion functions */ H5_DLL herr_t H5T__conv_noop(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c index 59bac8b..bd28fc2 100644 --- a/src/H5Tprecis.c +++ b/src/H5Tprecis.c @@ -154,6 +154,8 @@ H5Tset_precision(hid_t type_id, size_t prec) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (H5T_STATE_TRANSIENT!=dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") + if (NULL != dt->vol_obj) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is committed") if (prec == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "precision must be positive") if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0) diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 89cdcfd..6b6446f 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -30,6 +30,7 @@ typedef struct H5T_t H5T_t; #include "H5private.h" /* Generic Functions */ #include "H5Gprivate.h" /* Groups */ #include "H5Rprivate.h" /* References */ +#include "H5VLprivate.h" /* VOL Drivers */ /* Macro for size of temporary buffers to contain a single element */ #define H5T_ELEM_BUF_SIZE 256 @@ -98,7 +99,7 @@ typedef struct H5T_subset_info_t { } H5T_subset_info_t; /* Forward declarations for prototype arguments */ -struct H5O_t; +struct H5O_shared_t; /* The native endianness of the platform */ H5_DLLVAR H5T_order_t H5T_native_order_g; @@ -118,7 +119,7 @@ H5_DLL herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc); H5_DLL H5T_t *H5T_decode(size_t buf_size, const unsigned char *buf); H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE * stream); H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt); -H5_DLL H5G_name_t *H5T_nameof(H5T_t *dt); +H5_DLL H5G_name_t *H5T_nameof(const H5T_t *dt); H5_DLL htri_t H5T_is_immutable(const H5T_t *dt); H5_DLL htri_t H5T_is_named(const H5T_t *dt); H5_DLL herr_t H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f); @@ -138,13 +139,18 @@ H5_DLL herr_t H5T_set_version(H5F_t *f, H5T_t *dt); H5_DLL herr_t H5T_patch_file(H5T_t *dt, H5F_t *f); H5_DLL herr_t H5T_patch_vlen_file(H5T_t *dt, H5F_t *f); H5_DLL htri_t H5T_is_variable_str(const H5T_t *dt); +H5_DLL H5T_t *H5T_construct_datatype(H5VL_object_t *dt_obj); +H5_DLL H5VL_object_t *H5T_get_named_type(const H5T_t *dt); +H5_DLL H5T_t *H5T_get_actual_type(H5T_t *dt); +H5_DLL herr_t H5T_save_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared); +H5_DLL herr_t H5T_restore_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared); +H5_DLL hbool_t H5T_already_vol_managed(const H5T_t *dt); /* Reference specific functions */ H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt); /* Operations on named datatypes */ H5_DLL H5T_t *H5T_open(const H5G_loc_t *loc); -H5_DLL htri_t H5T_committed(const H5T_t *type); H5_DLL int H5T_link(const H5T_t *type, int adjust); H5_DLL herr_t H5T_update_shared(H5T_t *type); diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index ba31cd1..841637d 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -204,7 +204,7 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) dt->shared->u.vlen.read = H5T_vlen_seq_mem_read; dt->shared->u.vlen.write = H5T_vlen_seq_mem_write; dt->shared->u.vlen.setnull = H5T_vlen_seq_mem_setnull; - } /* end if */ + } else if(dt->shared->u.vlen.type == H5T_VLEN_STRING) { /* size in memory, disk size is different */ dt->shared->size = sizeof(char *); @@ -216,9 +216,10 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) dt->shared->u.vlen.read = H5T_vlen_str_mem_read; dt->shared->u.vlen.write = H5T_vlen_str_mem_write; dt->shared->u.vlen.setnull = H5T_vlen_str_mem_setnull; - } /* end else-if */ - else + } + else { HDassert(0 && "Invalid VL type"); + } /* Reset file ID (since this VL is in memory) */ dt->shared->u.vlen.f = NULL; @@ -530,7 +531,7 @@ H5T_vlen_str_mem_getlen(const void *_vl) #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const char *s=*(const char * const *)_vl; /* Pointer to the user's string information */ #else - const char *s; /* Pointer to the user's string information */ + const char *s = NULL; /* Pointer to the user's string information */ #endif FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -565,7 +566,7 @@ H5T_vlen_str_mem_getptr(void *_vl) #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s=*(char **)_vl; /* Pointer to the user's string information */ #else - char *s; /* Pointer to the user's string information */ + char *s = NULL; /* Pointer to the user's string information */ #endif FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -600,7 +601,7 @@ H5T_vlen_str_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl) #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s=*(char **)_vl; /* Pointer to the user's string information */ #else - char *s; /* Pointer to the user's string information */ + char *s = NULL; /* Pointer to the user's string information */ #endif FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -667,8 +668,7 @@ H5T_vlen_str_mem_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len) */ static herr_t H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_alloc_info, - void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, - size_t base_size) + void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size) { char *t; /* Pointer to temporary buffer allocated */ size_t len; /* Maximum length of the string to copy */ @@ -847,10 +847,11 @@ H5T_vlen_disk_read(H5F_t *f, void *_vl, void *buf, size_t H5_ATTR_UNUSED len) UINT32DECODE(vl, hobjid.idx); /* Check if this sequence actually has any data */ - if(hobjid.addr > 0) + if(hobjid.addr > 0) { /* Read the VL information from disk */ if(NULL == H5HG_read(f, &hobjid, buf, NULL)) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "Unable to read VL information") + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -898,10 +899,11 @@ H5T_vlen_disk_write(H5F_t *f, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_all UINT32DECODE(bg, bg_hobjid.idx); /* Free heap object for old data */ - if(bg_hobjid.addr > 0) + if(bg_hobjid.addr > 0) { /* Free heap object */ if(H5HG_remove(f, &bg_hobjid) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object") + } } /* end if */ /* Set the length of the sequence */ @@ -1159,6 +1161,10 @@ done: * * Purpose: Alternative method to reclaim any VL data for a buffer element. * + * Use this function when the datatype is already available, but + * the allocation info is needed from the context before jumping + * into recursion. + * * Return: Non-negative on success/Negative on failure * * Programmer: Mike McGreevy @@ -1169,8 +1175,8 @@ done: herr_t H5T_vlen_reclaim_elmt(void *elem, H5T_t *dt) { - H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */ - herr_t ret_value = SUCCEED; /* return value */ + H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */ + herr_t ret_value = SUCCEED; /* return value */ HDassert(dt); HDassert(elem); diff --git a/src/H5VL.c b/src/H5VL.c new file mode 100644 index 0000000..eedf68d --- /dev/null +++ b/src/H5VL.c @@ -0,0 +1,522 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: The Virtual Object Layer as described in documentation. + * The pupose is to provide an abstraction on how to access the + * underlying HDF5 container, whether in a local file with + * a specific file format, or remotely on other machines, etc... + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5VLmodule.h" /* This source code file is part of the H5VL module */ + + +/***********/ +/* Headers */ +/***********/ + +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5PLprivate.h" /* Plugins */ +#include "H5VLpkg.h" /* Virtual Object Layer */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + +/* Information needed for iterating over the registered VOL connector hid_t IDs. + * The name or value of the new VOL connector that is being registered is + * stored in the name (or value) field and the found_id field is initialized to + * H5I_INVALID_HID (-1). If we find a VOL connector with the same name / value, + * we set the found_id field to the existing ID for return to the function. + */ +typedef struct { + /* IN */ + H5VL_get_connector_kind_t kind; /* Which kind of connector search to make */ + union { + const char *name; /* The name of the VOL connector to check */ + H5VL_class_value_t value; /* The value of the VOL connector to check */ + } u; + + /* OUT */ + hid_t found_id; /* The connector ID, if we found a match */ +} H5VL_get_connector_ud_t; + + +/********************/ +/* Local Prototypes */ +/********************/ +static int H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data); + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5VL__get_connector_cb + * + * Purpose: Callback routine to search through registered VOLs + * + * Return: Success: H5_ITER_STOP if the class and op_data name + * members match. H5_ITER_CONT otherwise. + * + * Failure: Can't fail + * + *------------------------------------------------------------------------- + */ +static int +H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data) +{ + H5VL_get_connector_ud_t *op_data = (H5VL_get_connector_ud_t *)_op_data; /* User data for callback */ + H5VL_class_t *cls = (H5VL_class_t *)obj; + int ret_value = H5_ITER_CONT; /* Callback return value */ + + FUNC_ENTER_STATIC_NOERR + + if(H5VL_GET_CONNECTOR_BY_NAME == op_data->kind) { + if(0 == HDstrcmp(cls->name, op_data->u.name)) { + op_data->found_id = id; + ret_value = H5_ITER_STOP; + } /* end if */ + } /* end if */ + else { + HDassert(H5VL_GET_CONNECTOR_BY_VALUE == op_data->kind); + if(cls->value == op_data->u.value) { + op_data->found_id = id; + ret_value = H5_ITER_STOP; + } /* end if */ + } /* end else */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__get_connector_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLregister_connector + * + * Purpose: Registers a new VOL connector as a member of the virtual object + * layer class. + * + * Return: Success: A VOL connector ID which is good until the + * library is closed or the connector is + * unregistered. + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id) +{ + H5VL_get_connector_ud_t op_data; /* Callback info for connector search */ + hid_t ret_value = H5I_INVALID_HID; + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE2("i", "*xi", cls, vipl_id); + + /* Check arguments */ + if (!cls) + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "VOL connector class pointer cannot be NULL") + if (!cls->name) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the NULL pointer") + if (0 == HDstrlen(cls->name)) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the empty string") + if (cls->info_copy && !cls->info_free) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for VOL info objects when a copy callback is provided") + if (cls->get_wrap_ctx && !cls->free_wrap_ctx) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for object wrapping contexts when a get callback is provided") + + op_data.kind = H5VL_GET_CONNECTOR_BY_NAME; + op_data.u.name = cls->name; + op_data.found_id = H5I_INVALID_HID; + + /* check if connector is already registered */ + if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL IDs") + + /* Increment the ref count on the existing VOL connector ID, if it's already registered */ + if(op_data.found_id != H5I_INVALID_HID) { + if (H5I_inc_ref(op_data.found_id, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") + ret_value = op_data.found_id; + } /* end if */ + else { + /* Create a new class ID */ + if ((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector") + } /* end else */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLregister_connector() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLregister_connector_by_name + * + * Purpose: Registers a new VOL connector as a member of the virtual object + * layer class. + * + * Return: Success: A VOL connector ID which is good until the + * library is closed or the connector is + * unregistered. + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5VLregister_connector_by_name(const char *name, hid_t vipl_id) +{ + H5VL_get_connector_ud_t op_data; /* Callback info for connector search */ + hid_t ret_value = H5I_INVALID_HID; + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE2("i", "*si", name, vipl_id); + + /* Check arguments */ + if (!name) + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL connector name is disallowed") + if (0 == HDstrlen(name)) + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL connector name is disallowed") + + op_data.kind = H5VL_GET_CONNECTOR_BY_NAME; + op_data.u.name = name; + op_data.found_id = H5I_INVALID_HID; + + /* Check if connector is already registered */ + if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids") + + /* If connector alread registered, increment ref count on ID and return ID */ + if(op_data.found_id != H5I_INVALID_HID) { + if(H5I_inc_ref(op_data.found_id, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") + ret_value = op_data.found_id; + } /* end if */ + else { + H5PL_key_t key; + const H5VL_class_t *cls; + + /* Try loading the connector */ + key.vol.kind = H5VL_GET_CONNECTOR_BY_NAME; + key.vol.u.name = name; + if(NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, &key))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector") + + /* Register the connector we loaded */ + if((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID") + } /* end else */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLregister_connector_by_name() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLregister_connector_by_value + * + * Purpose: Registers a new VOL connector as a member of the virtual object + * layer class. + * + * Return: Success: A VOL connector ID which is good until the + * library is closed or the connector is + * unregistered. + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id) +{ + H5VL_get_connector_ud_t op_data; /* Callback info for connector search */ + hid_t ret_value = H5I_INVALID_HID; + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE2("i", "VCi", value, vipl_id); + + /* Check arguments */ + if(value < 0) + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "negative VOL connector value is disallowed") + + op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE; + op_data.u.value = value; + op_data.found_id = H5I_INVALID_HID; + + /* Check if connector is already registered */ + if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids") + + /* If connector alread registered, increment ref count on ID and return ID */ + if(op_data.found_id != H5I_INVALID_HID) { + if(H5I_inc_ref(op_data.found_id, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") + ret_value = op_data.found_id; + } /* end if */ + else { + H5PL_key_t key; + const H5VL_class_t *cls; + + /* Try loading the connector */ + key.vol.kind = H5VL_GET_CONNECTOR_BY_NAME; + key.vol.u.value = value; + if(NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, &key))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector") + + /* Register the connector we loaded */ + if((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID") + } /* end else */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLregister_connector_by_value() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLis_connector_registered + * + * Purpose: Tests whether a VOL class has been registered or not + * + * Return: Positive if the VOL class has been registered + * + * Zero if it is unregistered + * + * Negative on error (if the class is not a valid class ID) + * + *------------------------------------------------------------------------- + */ +htri_t +H5VLis_connector_registered(const char *name) +{ + H5VL_get_connector_ud_t op_data; /* Callback info for connector search */ + htri_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("t", "*s", name); + + op_data.kind = H5VL_GET_CONNECTOR_BY_NAME; + op_data.u.name = name; + op_data.found_id = H5I_INVALID_HID; + + /* Check arguments */ + if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL ids") + + if (op_data.found_id != H5I_INVALID_HID) + ret_value = TRUE; + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLis_connector_registered() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLget_connector_id + * + * Purpose: Retrieves the ID for a registered VOL connector. + * + * Return: Positive if the VOL class has been registered + * Negative on error (if the class is not a valid class or not registered) + * + *------------------------------------------------------------------------- + */ +hid_t +H5VLget_connector_id(const char *name) +{ + H5VL_get_connector_ud_t op_data; /* Callback info for connector search */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE1("i", "*s", name); + + op_data.kind = H5VL_GET_CONNECTOR_BY_NAME; + op_data.u.name = name; + op_data.found_id = H5I_INVALID_HID; + + /* Check arguments */ + if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL connector IDs") + + if (op_data.found_id != H5I_INVALID_HID) { + if (H5I_inc_ref(op_data.found_id, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") + ret_value = op_data.found_id; + } /* end if */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLget_connector_id() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLget_connector_name + * + * Purpose: Returns the connector name for the VOL associated with the + * object or file ID + * + * Return: Success: The length of the connector name + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +ssize_t +H5VLget_connector_name(hid_t obj_id, char *name/*out*/, size_t size) +{ + ssize_t ret_value = -1; + + FUNC_ENTER_API(FAIL) + H5TRACE3("Zs", "ixz", obj_id, name, size); + + if ((ret_value = H5VL_get_connector_name(obj_id, name, size)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get connector name") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLget_connector_name() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLclose + * + * Purpose: Closes a VOL connector ID. This in no way affects + * file access property lists which have been defined to use + * this VOL connector or files which are already opened under with + * this connector. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLclose(hid_t vol_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", vol_id); + + /* Check args */ + if(NULL == H5I_object_verify(vol_id, H5I_VOL)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector") + + /* Decrement the ref count on the ID, possibly releasing the VOL connector */ + if(H5I_dec_app_ref(vol_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close VOL connector ID") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLclose() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLunregister_connector + * + * Purpose: Removes a VOL connector ID from the library. This in no way affects + * file access property lists which have been defined to use + * this VOL connector or files which are already opened under with + * this connector. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLunregister_connector(hid_t vol_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", vol_id); + + /* Check arguments */ + if(NULL == H5I_object_verify(vol_id, H5I_VOL)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector") + + /* The H5VL_class_t struct will be freed by this function */ + if (H5I_dec_app_ref(vol_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL connector") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLunregister_connector() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLcmp_connector_cls + * + * Purpose: Compares two connector classes + * + * Return: Success: Non-negative, with *cmp set to positive if + * connector_id1 is greater than connector_id2, negative if connector_id2 + * is greater than connector_id1 and zero if connector_id1 and connector_id2 + * are equal. + * + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2) +{ + H5VL_class_t *cls1, *cls2; /* connectors for IDs */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "*Isii", cmp, connector_id1, connector_id2); + + /* Check args and get class pointers */ + if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(connector_id1, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(connector_id2, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Compare the two VOL connector classes */ + if(H5VL_cmp_connector_cls(cmp, cls1, cls2) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5VLcmp_connector_cls() */ + diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c new file mode 100644 index 0000000..2828262 --- /dev/null +++ b/src/H5VLcallback.c @@ -0,0 +1,6535 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: The Virtual Object Layer as described in documentation. + * The pupose is to provide an abstraction on how to access the + * underlying HDF5 container, whether in a local file with + * a specific file format, or remotely on other machines, etc... + */ + + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5VLmodule.h" /* This source code file is part of the H5VL module */ + + +/***********/ +/* Headers */ +/***********/ + +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5VLpkg.h" /* Virtual Object Layer */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ +static void *H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, const char *name, hid_t acpl_id, hid_t aapl_id, + hid_t dxpl_id, void **req); +static void *H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id, + void **req); +static herr_t H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, + 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, + 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_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req); +static void *H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, const char *name, hid_t dcpl_id, hid_t dapl_id, + hid_t dxpl_id, void **req); +static void *H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id, + void **req); +static herr_t H5VL__dataset_read(void *dset, const H5VL_class_t *cls, + hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, + void *buf, void **req); +static herr_t H5VL__dataset_write(void *obj, const H5VL_class_t *cls, + hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, + const void *buf, void **req); +static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, + H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req); +static herr_t H5VL__file_cache_connector(void *obj, const H5VL_class_t *cls, + hid_t dxpl_id, void **req, ...); +static void * H5VL__file_create(const H5VL_class_t *cls, const char *name, + unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +static void * H5VL__file_open(const H5VL_class_t *cls, const char *name, + unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req); +static void *H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, const char *name, hid_t gcpl_id, hid_t gapl_id, + hid_t dxpl_id, void **req); +static void *H5VL__group_open(void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, + void **req); +static herr_t H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, 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, + const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, H5VL_link_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, H5VL_link_specific_t specific_type, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments); +static void *H5VL__object_open(void *obj, const H5VL_loc_params_t *params, const H5VL_class_t *cls, + H5I_type_t *opened_type, hid_t dxpl_id, void **req); +static herr_t H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, + const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, + const char *dst_name, const H5VL_class_t *cls, hid_t ocpypl_id, + hid_t lcpl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, H5VL_object_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__object_specific(void *obj, 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__request_wait(void *req, const H5VL_class_t *cls, + uint64_t timeout, H5ES_status_t *status); +static herr_t H5VL__request_notify(void *req, const H5VL_class_t *cls, + H5VL_request_notify_t cb, void *ctx); +static herr_t H5VL__request_cancel(void *req, const H5VL_class_t *cls); +static herr_t H5VL__request_specific(void *req, const H5VL_class_t *cls, + H5VL_request_specific_t specific_type, va_list arguments); +static herr_t H5VL__request_optional(void *req, const H5VL_class_t *cls, + va_list arguments); +static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls); + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5VLinitialize + * + * Purpose: Calls the connector-specific callback to initialize the connector. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLinitialize(hid_t connector_id, hid_t vipl_id) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "ii", connector_id, vipl_id); + + /* Check args */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Invoke class' callback, if there is one */ + if(cls->initialize && cls->initialize(vipl_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not initialize") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLinitialize() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLterminate + * + * Purpose: Calls the connector-specific callback to terminate the connector. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLterminate(hid_t connector_id) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE1("e", "i", connector_id); + + /* Check args */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Invoke class' callback, if there is one */ + if(cls->terminate && cls->terminate() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLterminate() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLget_cap_flags + * + * Purpose: Retrieves the capability flag for a connector + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "i*Iu", connector_id, cap_flags); + + /* Check args */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Retrieve capability flags */ + if(cap_flags) + *cap_flags = cls->cap_flags; + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLget_cap_flags */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLget_value + * + * Purpose: Retrieves the 'value' for a connector + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLget_value(hid_t connector_id, H5VL_class_value_t *value) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "i*VC", connector_id, value); + + /* Check args */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Retrieve connector value */ + if(value) + *value = cls->value; + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLget_value */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_copy_connector_info + * + * Purpose: Copy the VOL info for a connector + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info, + const void *src_info) +{ + void *new_connector_info = NULL; /* Copy of connector info */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(connector); + + /* Check for actual source info */ + if(src_info) { + /* Allow the connector to copy or do it ourselves */ + if(connector->info_copy) { + if(NULL == (new_connector_info = (connector->info_copy)(src_info))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "connector info copy callback failed") + } /* end if */ + else if(connector->info_size > 0) { + if(NULL == (new_connector_info = H5MM_malloc(connector->info_size))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "connector info allocation failed") + HDmemcpy(new_connector_info, src_info, connector->info_size); + } /* end else-if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "no way to copy connector info") + } /* end if */ + + /* Set the connector info for the copy */ + *dst_info = new_connector_info; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_copy_connector_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLcopy_connector_info + * + * Purpose: Copies a VOL connector's info object + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_info) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "i**x*x", connector_id, dst_vol_info, src_vol_info); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Copy the VOL connector's info object */ + if(H5VL_copy_connector_info(cls, dst_vol_info, src_vol_info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy VOL connector info object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLcopy_connector_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_cmp_connector_info + * + * Purpose: Compare VOL info for a connector. Sets *cmp_value to + * positive if INFO1 is greater than INFO2, negative if + * INFO2 is greater than INFO1 and zero if INFO1 and + * INFO2 are equal. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value, + const void *info1, const void *info2) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(connector); + HDassert(cmp_value); + + /* Take care of cases where one or both pointers is NULL */ + if(info1 == NULL && info2 != NULL) { + *cmp_value = -1; + HGOTO_DONE(SUCCEED); + } /* end if */ + if(info1 != NULL && info2 == NULL) { + *cmp_value = 1; + HGOTO_DONE(SUCCEED); + } /* end if */ + if(info1 == NULL && info2 == NULL) { + *cmp_value = 0; + HGOTO_DONE(SUCCEED); + } /* end if */ + + /* Use the class's info comparison routine to compare the info objects, + * if there is a a callback, otherwise just compare the info objects as + * memory buffers + */ + if(connector->info_cmp) { + if((connector->info_cmp)(cmp_value, info1, info2) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector info") + } /* end if */ + else { + HDassert(connector->info_size > 0); + *cmp_value = HDmemcmp(info1, info2, connector->info_size); + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_cmp_connector_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLcmp_connector_info + * + * Purpose: Compares two connector info objects + * + * Note: Both info objects must be from the same VOL connector class + * + * Return: Success: Non-negative, with *cmp set to positive if + * info1 is greater than info2, negative if info2 + * is greater than info1 and zero if info1 and info2 + * are equal. + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1, const void *info2) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "*Isi*x*x", cmp, connector_id, info1, info2); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Compare the two VOL connector info objects */ + if(cmp) + H5VL_cmp_connector_info(cls, cmp, info1, info2); + +done: + FUNC_LEAVE_API(ret_value) +} /* H5VLcmp_connector_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_free_connector_info + * + * Purpose: Free VOL info for a connector + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_free_connector_info(const H5VL_class_t *connector, void *info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(connector); + + /* Only free info object, if it's non-NULL */ + if(info) { + /* Allow the connector to free info or do it ourselves */ + if(connector->info_free) { + if((connector->info_free)(info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed") + } /* end if */ + else + H5MM_xfree(info); + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_free_connector_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLfree_connector_info + * + * Purpose: Free VOL connector info object + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLfree_connector_info(hid_t connector_id, void *info) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "i*x", connector_id, info); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Free the VOL connector info object */ + if(H5VL_free_connector_info(cls, info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLfree_connector_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLconnector_info_to_str + * + * Purpose: Serialize a connector's info into a string + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "*xi**s", info, connector_id, str); + + /* Only serialize info object, if it's non-NULL */ + if(info) { + H5VL_class_t *cls; /* VOL connector's class struct */ + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Allow the connector to serialize info */ + if(cls->info_to_str) { + if((cls->info_to_str)(info, str) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "can't serialize connector info") + } /* end if */ + else + *str = NULL; + } /* end if */ + else + *str = NULL; + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLconnector_info_to_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLconnector_str_to_info + * + * Purpose: Deserialize a string into a connector's info + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "*si**x", str, connector_id, info); + + /* Only deserialize string, if it's non-NULL */ + if(str) { + H5VL_class_t *cls; /* VOL connector's class struct */ + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Allow the connector to deserialize info */ + if(cls->str_to_info) { + if((cls->str_to_info)(str, info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize connector info") + } /* end if */ + else + *info = NULL; + } /* end if */ + else + *info = NULL; + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLconnector_str_to_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLget_object + * + * Purpose: Retrieves an underlying object. + * + * Return: Success: Non-NULL + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +void * +H5VLget_object(void *obj, hid_t connector_id) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("*x", "*xi", obj, connector_id); + + /* Check args */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Check for 'get_object' callback in connector */ + if(cls->get_object) + ret_value = (cls->get_object)(obj); + else + ret_value = obj; + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLget_object */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_get_wrap_ctx + * + * Purpose: Retrieve the VOL object wrapping context for a connector + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, void **wrap_ctx) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(connector); + HDassert(obj); + HDassert(wrap_ctx); + + /* Allow the connector to copy or do it ourselves */ + if(connector->get_wrap_ctx) { + /* Sanity check */ + HDassert(connector->free_wrap_ctx); + + /* Invoke connector's callback */ + if((connector->get_wrap_ctx)(obj, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "connector wrap context callback failed") + } /* end if */ + else + *wrap_ctx = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_get_wrap_ctx() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLget_wrap_ctx + * + * Purpose: Get a VOL connector's object wrapping context + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "*xi**x", obj, connector_id, wrap_ctx); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Get the VOL connector's object wrapper */ + if(H5VL_get_wrap_ctx(cls, obj, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to retrieve VOL connector object wrap context") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLget_wrap_ctx() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_free_wrap_ctx + * + * Purpose: Free object wrapping context for a connector + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(connector); + + /* Only free wrap context, if it's non-NULL */ + if(wrap_ctx) { + /* Free the connector's object wrapping context */ + if((connector->free_wrap_ctx)(wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector wrap context free request failed") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_free_wrap_ctx() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLfree_wrap_ctx + * + * Purpose: Release a VOL connector's object wrapping context + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "*xi", wrap_ctx, connector_id); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Release the VOL connector's object wrapper */ + if(H5VL_free_wrap_ctx(cls, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector object wrap context") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLfree_wrap_ctx() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_wrap_object + * + * Purpose: Wrap an object with connector + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +void * +H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj) +{ + void *ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Sanity checks */ + HDassert(connector); + HDassert(obj); + + /* Only wrap object if there's a wrap context */ + if(wrap_ctx) { + /* Ask the connector to wrap the object */ + if(NULL == (ret_value = (connector->wrap_object)(obj, wrap_ctx))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") + } /* end if */ + else + ret_value = obj; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_wrap_object() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLwrap_object + * + * Purpose: Asks a connector to wrap an underlying object. + * + * Return: Success: Non-NULL + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +void * +H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("*x", "*xi*x", obj, connector_id, wrap_ctx); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Wrap the object */ + if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLwrap_object */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_create + * + * Purpose: Creates an attribute through the VOL + * + * Return: Success: Pointer to the new attribute + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, + const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr create' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->attr_cls.create)(obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_create + * + * Purpose: Creates an attribute through the VOL + * + * Return: Success: Pointer to the new attribute + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + 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__attr_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, acpl_id, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_create + * + * Purpose: Creates an attribute + * + * Return: Success: Pointer to the new attribute + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, + const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, acpl_id, + aapl_id, dxpl_id, req); + + /* Check args and get class pointer */ + 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__attr_create(obj, loc_params, cls, name, acpl_id, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create attribute") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_open + * + * Purpose: Opens an attribute through the VOL + * + * Return: Success: Pointer to the attribute + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, + hid_t aapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr open' method") + + /* Call the corresponding VOL open callback */ + if(NULL == (ret_value = (cls->attr_cls.open)(obj, loc_params, name, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_open + * + * Purpose: Opens an attribute through the VOL + * + * Return: Success: Pointer to the attribute + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_attr_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + 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__attr_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_open + * + * Purpose: Opens an attribute + * + * Return: Success: Pointer to the attribute + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, + const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + 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, aapl_id, + dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__attr_open(obj, loc_params, cls, name, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open attribute") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_read + * + * Purpose: Reads data from attr through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, + hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.read) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr read' method") + + /* Call the corresponding VOL callback */ + if((cls->attr_cls.read)(obj, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_read + * + * Purpose: Reads data from attr through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, void *buf, + hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_read + * + * Purpose: Reads data from an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_read(void *obj, hid_t connector_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xii*xi**x", obj, connector_id, mem_type_id, buf, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + 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__attr_read(obj, cls, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read attribute") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_write + * + * Purpose: Writes data to attr through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, + hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.write) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr write' method") + + /* Call the corresponding VOL callback */ + if((cls->attr_cls.write)(obj, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_write + * + * Purpose: Writes data to attr through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, const void *buf, + hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_write + * + * Purpose: Writes data to an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_write(void *obj, hid_t connector_id, hid_t mem_type_id, const void *buf, + hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xii*xi**x", obj, connector_id, mem_type_id, buf, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + 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__attr_write(obj, cls, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write attribute") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_get + * + * Purpose: Get specific information about the attribute through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr get' method") + + /* Call the corresponding VOL callback */ + if((cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_get + * + * Purpose: Get specific information about the attribute through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* 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 */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__attr_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_get + * + * Purpose: Gets information about the attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVai**xx", obj, 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") + + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get attribute information") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_specific + * + * Purpose: Specific operation on attributes through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr specific' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_specific + * + * Purpose: Specific operation on attributes through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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, ...) +{ + 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 */ + va_start(arguments, req); + arg_started = TRUE; + if((ret_value = H5VL__attr_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_specific + * + * Purpose: Performs a connector-specific operation on an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*x*xiVbi**xx", obj, loc_params, connector_id, specific_type, + dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__attr_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_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->attr_cls.optional) + 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) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + 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 */ + va_start(arguments, req); + arg_started = TRUE; + if((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_optional + * + * Purpose: Performs an optional connector-specific operation on an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_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") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__attr_optional(obj, cls, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_close + * + * Purpose: Closes an attribute through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + 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") + + /* Call the corresponding VOL callback */ + if((cls->attr_cls.close)(obj, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_close + * + * Purpose: Closes an attribute through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_close + * + * Purpose: Closes an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_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__attr_close(obj, cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close attribute") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_create + * + * Purpose: Creates a dataset through the VOL + * + * Return: Success: Pointer to new dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset create' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->dataset_cls.create)(obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_create + * + * Purpose: Creates a dataset through the VOL + * + * Return: Success: Pointer to new dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + 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__dataset_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, dcpl_id, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_create + * + * Purpose: Creates a dataset + * + * Return: Success: Pointer to the new dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, dcpl_id, + dapl_id, dxpl_id, req); + + /* Check args and get class pointer */ + 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__dataset_create(obj, loc_params, cls, name, dcpl_id, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create dataset") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_open + * + * Purpose: Opens a dataset through the VOL + * + * Return: Success: Pointer to dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, + hid_t dapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset open' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->dataset_cls.open)(obj, loc_params, name, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_open + * + * Purpose: Opens a dataset through the VOL + * + * Return: Success: Pointer to dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_dataset_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + 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__dataset_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_open + * + * Purpose: Opens a dataset + * + * Return: Success: Pointer to the new dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, + const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + 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, dapl_id, + dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open dataset") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_read + * + * Purpose: Reads data from dataset through the VOL +* + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, + hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, + void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.read) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset read' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.read)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_read + * + * Purpose: Reads data from dataset through the VOL +* + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, + hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, + void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_read + * + * Purpose: Reads data from a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, void *buf, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("e", "*xiiiii*x**x", obj, connector_id, mem_type_id, mem_space_id, + file_space_id, plist_id, buf, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_read(obj, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_write + * + * Purpose: Writes data from dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, + hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, + void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.write) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset write' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.write)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_write + * + * Purpose: Writes data from dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, + hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, + void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_write + * + * Purpose: Writes data to a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_write(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, const void *buf, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("e", "*xiiiii*x**x", obj, connector_id, mem_type_id, mem_space_id, + file_space_id, plist_id, buf, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_write(obj, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_get + * + * Purpose: Get specific information about the dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset get' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_get + * + * Purpose: Get specific information about the dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* 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 */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__dataset_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_get + * + * Purpose: Gets information about a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVci**xx", obj, connector_id, get_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_specific + * + * Purpose: Specific operation on datasets through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset specific' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_specific + * + * Purpose: Specific operation on datasets through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* 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 */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__dataset_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_specific + * + * Purpose: Performs a connector-specific operation on a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVdi**xx", obj, 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__dataset_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset optional' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, + void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Call the corresponding VOL callback */ + /* 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 */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_optional + * + * Purpose: Performs an optional connector-specific operation on a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_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") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_optional(obj, cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_close + * + * Purpose: Closes a dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(obj); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset close' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.close)(obj, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "dataset close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_close + * + * Purpose: Closes a dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + HDassert(vol_obj->data); + HDassert(vol_obj->connector); + HDassert(vol_obj->connector->cls); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "dataset close failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_close + * + * Purpose: Closes a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_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__dataset_close(obj, cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close dataset") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__file_cache_connector + * + * Purpose: Wrap varargs and reissue 'cache VOL connector' operation + * to file specific call + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_cache_connector(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Re-issue call to internal file specific callback routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__file_specific(obj, cls, H5VL_FILE_CACHE_VOL_CONN, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_cache_connector() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__file_create + * + * Purpose: Creates a file through the VOL + * + * Note: Does not have a 'static' version of the routine, since there's + * no objects in the container before this operation completes. + * + * Return: Success: Pointer to new file + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__file_create(const H5VL_class_t *cls, const char *name, + unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'file create' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_create + * + * Purpose: Creates a file through the VOL + * + * Note: Does not have a 'static' version of the routine, since there's + * no objects in the container before this operation completes. + * + * Return: Success: Pointer to new file + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name, + unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL Class structure for callback info */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Get the connector's class */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop->connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed") + + /* Cache the connector ID & info */ + if(H5VL__file_cache_connector(ret_value, cls, dxpl_id, req, connector_prop->connector_id, connector_prop->connector_info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "caching VOL connector ID & info failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_create + * + * Purpose: Creates a file + * + * Return: Success: Pointer to the new file + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, + hid_t dxpl_id, void **req) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("*x", "*sIuiii**x", name, flags, fcpl_id, fapl_id, dxpl_id, req); + + /* Get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info") + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create file") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__file_open + * + * Purpose: Opens a file through the VOL. + * + * Return: Success: Pointer to file. + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__file_open(const H5VL_class_t *cls, const char *name, unsigned flags, + hid_t fapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'file open' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_open + * + * Purpose: Opens a file through the VOL. + * + * Note: Does not have a 'static' version of the routine, since there's + * no objects in the container before this operation completes. + * + * Return: Success: Pointer to file. + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_file_open(const H5VL_connector_prop_t *connector_prop, const char *name, + unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL Class structure for callback info */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Get the connector's class */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop->connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + + /* Cache the connector ID & info */ + if(H5VL__file_cache_connector(ret_value, cls, dxpl_id, req, connector_prop->connector_id, connector_prop->connector_info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "caching VOL connector ID & info failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_open + * + * Purpose: Opens a file + * + * Return: Success: Pointer to the file + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, + void **req) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("*x", "*sIuii**x", name, flags, fapl_id, dxpl_id, req); + + /* Get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info") + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open file") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__file_get + * + * Purpose: Get specific information about the file through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file get' method") + + /* Call the corresponding VOL callback */ + if((cls->file_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_get + * + * Purpose: Get specific information about the file through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* 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 */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__file_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_get + * + * Purpose: Gets information about the file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVgi**xx", obj, connector_id, get_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__file_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute file get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__file_specific + * + * Purpose: Perform File specific operations through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file specific' method") + + /* Call the corresponding VOL callback */ + if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_specific + * + * Purpose: Perform File specific operations through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + const H5VL_class_t *cls; /* VOL connector's class struct */ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Start access to the varargs, so they are available in all situations below */ + va_start(arguments, req); + arg_started = TRUE; + + /* Special treatment of file access check */ + if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + va_list tmp_args; /* argument list passed from the API call */ + hid_t fapl_id; /* File access property list for accessing the file */ + + /* Get the file access property list to access the file */ + va_copy(tmp_args, arguments); + fapl_id = va_arg(tmp_args, hid_t); + va_end(tmp_args); + + /* Get the VOL info from the FAPL */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list") + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info") + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID") + } /* end if */ + /* Set wrapper info in API context, for all other operations */ + else { + /* Sanity check */ + HDassert(vol_obj); + + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Set the VOL connector class pointer */ + cls = vol_obj->connector->cls; + } /* end else */ + + /* Call the corresponding internal VOL routine */ + if(H5VL__file_specific(vol_obj ? vol_obj->data : NULL, cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_specific + * + * Purpose: Performs a connector-specific operation on a file + * + * Note: The 'obj' parameter is allowed to be NULL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVhi**xx", obj, connector_id, specific_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__file_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__file_optional + * + * Purpose: Perform a connector specific operation + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.optional) + 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) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_optional + * + * Purpose: Perform a connector specific operation + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* 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 */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_optional + * + * Purpose: Performs an optional connector-specific operation on a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_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") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__file_optional(obj, cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__file_close + * + * Purpose: Closes a file through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(obj); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file close' method") + + /* Call the corresponding VOL callback */ + if((cls->file_cls.close)(obj, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_close + * + * Purpose: Closes a file through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__file_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_close + * + * Purpose: Closes a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_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__file_close(obj, cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__group_create + * + * Purpose: Creates a group through the VOL + * + * Return: Success: Pointer to new group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, + const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group create' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->group_cls.create)(obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_create + * + * Purpose: Creates a group through the VOL + * + * Return: Success: Pointer to new group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + 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__group_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, gcpl_id, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_create + * + * Purpose: Creates a group + * + * Return: Success: Pointer to the new group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, + hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, gcpl_id, + gapl_id, dxpl_id, req); + + /* Check args and get class pointer */ + 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__group_create(obj, loc_params, cls, name, gcpl_id, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create group") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__group_open + * + * Purpose: Opens a group through the VOL + * + * Return: Success: Pointer to group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +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) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group open' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->group_cls.open)(obj, loc_params, name, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_open + * + * Purpose: Opens a group through the VOL + * + * Return: Success: Pointer to group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_group_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + 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__group_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_open + * + * Purpose: Opens a group + * + * Return: Success: Pointer to the group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +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) +{ + 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, gapl_id, + dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__group_open(obj, loc_params, cls, name, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__group_get + * + * Purpose: Get specific information about the group through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group get' method") + + /* Call the corresponding VOL callback */ + if((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_get + * + * Purpose: Get specific information about the group through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* 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 */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__group_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_get + * + * Purpose: Gets information about the group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVii**xx", obj, 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") + + /* Call the corresponding internal VOL routine */ + if(H5VL__group_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__group_specific + * + * Purpose: Specific operation on groups through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group specific' method") + + /* Call the corresponding VOL callback */ + if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_specific + * + * Purpose: Specific operation on groups through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* 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 */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__group_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_specific + * + * Purpose: Performs a connector-specific operation on a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVji**xx", obj, 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__group_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__group_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group optional' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* 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 */ + va_start(arguments, req); + arg_started = TRUE; + if((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_optional + * + * Purpose: Performs an optional connector-specific operation on a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_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") + 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__group_optional(obj, cls, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__group_close + * + * Purpose: Closes a group through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + /* Sanity check */ + HDassert(obj); + HDassert(cls); + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group close' method") + + /* Call the corresponding VOL callback */ + if((cls->group_cls.close)(obj, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_close + * + * Purpose: Closes a group through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__group_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_close + * + * Purpose: Closes a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_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__group_close(obj, cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close group") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__link_create + * + * Purpose: Creates a link through the VOL + * + * Note: The 'obj' parameter is allowed to be NULL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link create' method") + + /* Call the corresponding VOL callback */ + if((cls->link_cls.create)(create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_create + * + * Purpose: Creates a link through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj, + 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 */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Special case for hard links */ + if(H5VL_LINK_CREATE_HARD == create_type && NULL == vol_obj->data) { + H5P_genplist_t *plist; /* Property list pointer */ + + /* Get the VOL data pointer from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list") + if(H5P_peek(plist, H5VL_PROP_LINK_TARGET, &tmp_vol_obj.data) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info") + } /* end if */ + else + /* Use the VOL object passed in */ + tmp_vol_obj.data = vol_obj->data; + 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) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_create(create_type, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_create + * + * Purpose: Creates a link + * + * Note: The 'obj' parameter is allowed to be NULL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, + hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("e", "Vk*x*xiiii**x", create_type, obj, loc_params, connector_id, + lcpl_id, lapl_id, dxpl_id, req); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__link_copy + * + * Purpose: Copys a link from src to dst. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.copy) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link copy' method") + + /* Call the corresponding VOL callback */ + if((cls->link_cls.copy)(src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_copy + * + * Purpose: Copys a link from src to dst. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, + const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + const H5VL_object_t *vol_obj; /* VOL object for object with data */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + vol_obj = (src_vol_obj->data ? src_vol_obj : dst_vol_obj); + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_copy((src_vol_obj->data ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_copy + * + * Purpose: Copies a link to a new location + * + * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, + const H5VL_loc_params_t *loc_params2, hid_t connector_id, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE9("e", "*x*x*x*xiiii**x", src_obj, loc_params1, dst_obj, loc_params2, + connector_id, lcpl_id, lapl_id, dxpl_id, req); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__link_move + * + * Purpose: Moves a link from src to dst. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.move) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link move' method") + + /* Call the corresponding VOL callback */ + if((cls->link_cls.move)(src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_move + * + * Purpose: Moves a link from src to dst. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, + const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + const H5VL_object_t *vol_obj; /* VOL object for object with data */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + vol_obj = (src_vol_obj ? src_vol_obj : dst_vol_obj); + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_move((src_vol_obj ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_move + * + * Purpose: Moves a link to another location + * + * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, + const H5VL_loc_params_t *loc_params2, hid_t connector_id, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE9("e", "*x*x*x*xiiii**x", src_obj, loc_params1, dst_obj, loc_params2, + connector_id, lcpl_id, lapl_id, dxpl_id, req); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_move(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "unable to move object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__link_get + * + * Purpose: Get specific information about the link through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, + H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link get' method") + + /* Call the corresponding VOL callback */ + if((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_get + * + * Purpose: Get specific information about the link through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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, ...) +{ + 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 */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__link_get(vol_obj->data, loc_params, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_get + * + * Purpose: Gets information about a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*x*xiVli**xx", obj, loc_params, connector_id, get_type, dxpl_id, + req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__link_specific + * + * Purpose: Specific operation on links through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_specific(void *obj, 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 */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link specific' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_specific + * + * Purpose: Specific operation on links through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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, ...) +{ + 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 */ + va_start(arguments, req); + arg_started = TRUE; + if((ret_value = H5VL__link_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_specific + * + * Purpose: Performs a connector-specific operation on a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*x*xiVmi**xx", obj, loc_params, connector_id, specific_type, + dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__link_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__link_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link optional' method") + + /* Call the corresponding VOL callback */ + if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* 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 */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__link_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_optional + * + * Purpose: Performs an optional connector-specific operation on a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_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") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_optional(obj, cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__object_open + * + * Purpose: Opens a object through the VOL + * + * Return: Success: Pointer to the object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +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) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'object open' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->object_cls.open)(obj, params, opened_type, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_open + * + * Purpose: Opens a object through the VOL + * + * Return: Success: Pointer to the object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params, + H5I_type_t *opened_type, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + 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__object_open(vol_obj->data, params, vol_obj->connector->cls, opened_type, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_open + * + * Purpose: Opens an object + * + * Return: Success: Pointer to the object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLobject_open(void *obj, const H5VL_loc_params_t *params, hid_t connector_id, H5I_type_t *opened_type, + hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("*x", "*x*xi*Iti**x", obj, params, connector_id, opened_type, dxpl_id, + req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__object_open(obj, params, cls, opened_type, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLobject_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__object_copy + * + * Purpose: Copies an object to another destination through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, + void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, + const H5VL_class_t *cls, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, + void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.copy) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object copy' method") + + /* Call the corresponding VOL callback */ + if((cls->object_cls.copy)(src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, ocpypl_id, lcpl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_copy + * + * Purpose: Copies an object to another destination through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Make sure that the VOL connectors are the same */ + if(src_obj->connector->cls->value != dst_obj->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "objects are accessed through different VOL connectors and can't be copied") + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(src_obj->data, src_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__object_copy(src_obj->data, src_loc_params, src_name, dst_obj->data, dst_loc_params, dst_name, src_obj->connector->cls, ocpypl_id, lcpl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_copy + * + * Purpose: Copies an object to another location + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, + const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, + const char *dst_name, hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id, + hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE11("e", "*x*x*s*x*x*siiii**x", src_obj, src_loc_params, src_name, + dst_obj, dst_loc_params, dst_name, connector_id, ocpypl_id, lcpl_id, + dxpl_id, req); + + /* Check args and get class pointers */ + if(NULL == src_obj || NULL == dst_obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__object_copy(src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, cls, ocpypl_id, lcpl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLobject_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__object_get + * + * Purpose: Get specific information about the object through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, + H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object get' method") + + /* Call the corresponding VOL callback */ + if((cls->object_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_get + * + * Purpose: Get specific information about the object through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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, ...) +{ + 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 */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__object_get(vol_obj->data, loc_params, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_get + * + * Purpose: Gets information about an object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*x*xiVni**xx", obj, loc_params, connector_id, get_type, dxpl_id, + req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__object_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLobject_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__object_specific + * + * Purpose: Specific operation on objects through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_specific(void *obj, 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) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object specific' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_specific + * + * Purpose: Specific operation on objects through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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, ...) +{ + 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 */ + va_start(arguments, req); + arg_started = TRUE; + if((ret_value = H5VL__object_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_specific + * + * Purpose: Performs a connector-specific operation on an object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*x*xiVoi**xx", obj, loc_params, connector_id, specific_type, + dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `object specific' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLobject_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__object_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object optional' method") + + /* Call the corresponding VOL callback */ + if((cls->object_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* 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 */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__object_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_optional + * + * Purpose: Performs an optional connector-specific operation on an object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_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") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__object_optional(obj, cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLobject_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__datatype_commit + * + * Purpose: Commits a datatype to the file through the VOL + * + * Return: Success: 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->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 + * + * 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->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__datatype_get(vol_obj->data, vol_obj->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) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_get() */ + + +/*------------------------------------------------------------------------- + * 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->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__datatype_specific(vol_obj->data, vol_obj->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) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_specific() */ + + +/*------------------------------------------------------------------------- + * 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, 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 */ + va_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) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_optional() */ + + +/*------------------------------------------------------------------------- + * 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") + 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") + +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->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_close(vol_obj->data, vol_obj->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__request_wait + * + * Purpose: Waits on an asychronous request through the VOL + * + * Note: Releases the request if the operation has completed and the + * connector callback succeeds + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_wait(void *req, const H5VL_class_t *cls, uint64_t timeout, + H5ES_status_t *status) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(req); + HDassert(cls); + HDassert(status); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->request_cls.wait) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async wait' method") + + /* Call the corresponding VOL callback */ + if((cls->request_cls.wait)(req, timeout, status) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__request_wait() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_wait + * + * Purpose: Waits on an asychronous request through the VOL + * + * Note: Releases the request if the operation has completed and the + * connector callback succeeds + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, + H5ES_status_t *status) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_wait(vol_obj->data, vol_obj->connector->cls, timeout, status) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_wait() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_wait + * + * Purpose: Waits on a request + * + * Note: Releases the request if the operation has completed and the + * connector callback succeeds + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_status_t *status) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xiUL*Es", req, connector_id, timeout, status); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_wait(req, cls, timeout, status) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_wait() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__request_notify + * + * Purpose: Registers a user callback to be invoked when an asynchronous + * operation completes + * + * Note: Releases the request, if connector callback succeeds + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_notify(void *req, const H5VL_class_t *cls, H5VL_request_notify_t cb, + void *ctx) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(req); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->request_cls.notify) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async notify' method") + + /* Call the corresponding VOL callback */ + if((cls->request_cls.notify)(req, cb, ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request notify failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__request_notify() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_notify + * + * Purpose: Registers a user callback to be invoked when an asynchronous + * operation completes + * + * Note: Releases the request, if connector callback succeeds + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb, + void *ctx) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_notify(vol_obj->data, vol_obj->connector->cls, cb, ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "request notify failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_notify() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_notify + * + * Purpose: Registers a user callback to be invoked when an asynchronous + * operation completes + * + * Note: Releases the request, if connector callback succeeds + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb, + void *ctx) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xix*x", req, connector_id, cb, ctx); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_notify(req, cls, cb, ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to register notify callback for request") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_notify() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__request_cancel + * + * Purpose: Cancels an asynchronous request through the VOL + * + * Note: Releases the request, if connector callback succeeds + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_cancel(void *req, const H5VL_class_t *cls) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(req); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->request_cls.cancel) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async cancel' method") + + /* Call the corresponding VOL callback */ + if((cls->request_cls.cancel)(req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__request_cancel() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_cancel + * + * Purpose: Cancels an asynchronous request through the VOL + * + * Note: Releases the request, if connector callback succeeds + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_cancel(const H5VL_object_t *vol_obj) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_cancel(vol_obj->data, vol_obj->connector->cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_cancel() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_cancel + * + * Purpose: Cancels a request + * + * Note: Releases the request, if connector callback succeeds + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_cancel(void *req, hid_t connector_id) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "*xi", req, connector_id); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_cancel(req, cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_cancel() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__request_specific + * + * Purpose: Specific operation on asynchronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_specific(void *req, const H5VL_class_t *cls, + H5VL_request_specific_t specific_type, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(req); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->request_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async specific' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->request_cls.specific)(req, specific_type, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__request_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_specific + * + * Purpose: Specific operation on asynchronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_specific(const H5VL_object_t *vol_obj, + H5VL_request_specific_t specific_type, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, specific_type); + arg_started = TRUE; + if((ret_value = H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, specific_type, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_specific + * + * Purpose: Performs a connector-specific operation on an asynchronous request + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type, + va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xiVrx", req, connector_id, specific_type, arguments); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__request_specific(req, cls, specific_type, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__request_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_optional(void *req, const H5VL_class_t *cls, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(req); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->request_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async optional' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->request_cls.optional)(req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__request_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_optional(const H5VL_object_t *vol_obj, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, vol_obj); + arg_started = TRUE; + if((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_optional + * + * Purpose: Performs an optional connector-specific operation on an asynchronous request + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_optional(void *req, hid_t connector_id, 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); + + /* 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) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__request_free + * + * Purpose: Frees an asynchronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_free(void *req, const H5VL_class_t *cls) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(req); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->request_cls.free) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async free' method") + + /* Call the corresponding VOL callback */ + if((cls->request_cls.free)(req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__request_free() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_free + * + * Purpose: Frees an asynchronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_free(const H5VL_object_t *vol_obj) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding VOL callback */ + if(H5VL__request_free(vol_obj->data, vol_obj->connector->cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_free() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_free + * + * Purpose: Frees a request + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_free(void *req, hid_t connector_id) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "*xi", req, connector_id); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_free(req, cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to free request") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_free() */ + diff --git a/src/H5VLint.c b/src/H5VLint.c new file mode 100644 index 0000000..82886cd --- /dev/null +++ b/src/H5VLint.c @@ -0,0 +1,1114 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: The Virtual Object Layer as described in documentation. + * The pupose is to provide an abstraction on how to access the + * underlying HDF5 container, whether in a local file with + * a specific file format, or remotely on other machines, etc... + */ + + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5VLmodule.h" /* This source code file is part of the H5VL module */ + + +/***********/ +/* Headers */ +/***********/ + +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Tprivate.h" /* Datatypes */ +#include "H5VLpkg.h" /* Virtual Object Layer */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + +/* Object wrapping context info */ +typedef struct H5VL_wrap_ctx_t { + unsigned rc; /* Ref. count for the # of times the context was set / reset */ + const H5VL_t *connector; /* VOL connector for "outermost" class to start wrap */ + void *obj_wrap_ctx; /* "wrap context" for outermost connector */ +} H5VL_wrap_ctx_t; + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ +static herr_t H5VL__free_cls(H5VL_class_t *cls); +static void *H5VL__wrap_obj(void *obj); +static H5VL_object_t *H5VL__new_vol_obj(H5I_type_t type, void *object, + H5VL_t *vol_connector, hbool_t wrap_obj); +static void *H5VL__object(hid_t id, H5I_type_t obj_type); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + +/* VOL ID class */ +static const H5I_class_t H5I_VOL_CLS[1] = {{ + H5I_VOL, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5VL__free_cls /* Callback routine for closing objects of this class */ +}}; + +/* Declare a free list to manage the H5VL_class_t struct */ +H5FL_DEFINE_STATIC(H5VL_class_t); + +/* Declare a free list to manage the H5VL_t struct */ +H5FL_DEFINE(H5VL_t); + +/* Declare a free list to manage the H5VL_object_t struct */ +H5FL_DEFINE(H5VL_object_t); + +/* Declare a free list to manage the H5VL_wrap_ctx_t struct */ +H5FL_DEFINE_STATIC(H5VL_wrap_ctx_t); + + + +/*------------------------------------------------------------------------- + * Function: H5VL_init + * + * Purpose: Initialize the interface from some other package + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_init(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* FUNC_ENTER() does all the work */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_init() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__init_package + * + * Purpose: Initialize interface-specific information + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL__init_package(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Initialize the atom group for the VL IDs */ + if (H5I_register_type(H5I_VOL_CLS) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize H5VL interface") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__init_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_term_package + * + * Purpose: Terminate various H5VL objects + * + * Return: Success: Positive if anything was done that might + * affect other interfaces; zero otherwise. + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +int +H5VL_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + if (H5I_nmembers(H5I_VOL) > 0) { + (void)H5I_clear_type(H5I_VOL, FALSE, FALSE); + n++; + } /* end if */ + else { + /* Destroy the VOL connector ID group */ + n += (H5I_dec_type_ref(H5I_VOL) > 0); + + /* Mark interface as closed */ + if (0 == n) + H5_PKG_INIT_VAR = FALSE; + } /* end else */ + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5VL_term_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__free_cls + * + * Purpose: Frees a file VOL class struct and returns an indication of + * success. This function is used as the free callback for the + * virtual object layer object identifiers + * (c.f.: H5VL_init_interface). + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__free_cls(H5VL_class_t *cls) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(cls); + + /* Shut down the VOL connector */ + if(cls->terminate && cls->terminate() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly") + + /* Release the class */ + H5MM_xfree((void *)cls->name); /* Casting away const OK -QAK */ + H5FL_FREE(H5VL_class_t, cls); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__free_cls() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__wrap_obj + * + * Purpose: Wraps a library object with possible VOL connector wrappers, to + * match the VOL connector stack for the file. + * + * Return: Success: Wrapped object pointer + * Failure: NULL + * + * Programmer: Quincey Koziol + * Friday, October 7, 2018 + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__wrap_obj(void *obj) +{ + H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check arguments */ + HDassert(obj); + + /* Retrieve the VOL object wrapping context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't get VOL object wrap context") + + /* If there is a VOL object wrapping context, wrap the object */ + if(vol_wrap_ctx) { + /* Wrap object, using the VOL callback */ + if(NULL == (ret_value = H5VL_wrap_object(vol_wrap_ctx->connector->cls, vol_wrap_ctx->obj_wrap_ctx, obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") + } /* end if */ + else + ret_value = obj; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__wrap_obj() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__new_vol_obj + * + * Purpose: Creates a new VOL object, to use when registering an ID. + * + * Return: Success: VOL object pointer + * Failure: NULL + * + * Programmer: Quincey Koziol + * Friday, October 7, 2018 + * + *------------------------------------------------------------------------- + */ +static H5VL_object_t * +H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t wrap_obj) +{ + H5VL_object_t *new_vol_obj = NULL; /* Pointer to new VOL object */ + H5VL_object_t *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check arguments */ + HDassert(object); + HDassert(vol_connector); + + /* Make sure type number is valid */ + if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE && type != H5I_FILE && type != H5I_GROUP) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, NULL, "invalid type number") + + /* Create the new VOL object */ + if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate memory for VOL object") + new_vol_obj->connector = vol_connector; + if(wrap_obj) { + if(NULL == (new_vol_obj->data = H5VL__wrap_obj(object))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't wrap library object") + } /* end if */ + else + new_vol_obj->data = object; + + /* Bump the reference count on the VOL connector */ + vol_connector->nrefs++; + + /* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */ + if(H5I_DATATYPE == type) { + if(NULL == (ret_value = (H5VL_object_t *)H5T_construct_datatype(new_vol_obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "can't construct datatype object") + } /* end if */ + else + ret_value = (H5VL_object_t *)new_vol_obj; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__new_vol_obj() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_conn_copy + * + * Purpose: Copy VOL connector ID & info. + * + * Note: This is an "in-place" copy. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_conn_copy(H5VL_connector_prop_t *connector_prop) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + if(connector_prop) { + /* Copy the connector ID & info, if there is one */ + if(connector_prop->connector_id > 0) { + /* Increment the reference count on connector ID and copy connector info */ + if(H5I_inc_ref(connector_prop->connector_id, FALSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID") + + /* Copy connector info, if it exists */ + if(connector_prop->connector_info) { + H5VL_class_t *connector; /* Pointer to connector */ + void *new_connector_info = NULL; /* Copy of connector info */ + + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop->connector_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Allocate and copy connector info */ + if(H5VL_copy_connector_info(connector, &new_connector_info, connector_prop->connector_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed") + + /* Set the connector info to the copy */ + connector_prop->connector_info = new_connector_info; + } /* end if */ + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_conn_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_conn_free + * + * Purpose: Free VOL connector ID & info. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_conn_free(const H5VL_connector_prop_t *info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + if(info) { + /* Free the connector info (if it exists) and decrement the ID */ + if(info->connector_id > 0) { + if(info->connector_info) { + H5VL_class_t *connector; /* Pointer to connector */ + + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(info->connector_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Free the connector info */ + if(H5VL_free_connector_info(connector, (void *)info->connector_info) < 0) /* Casting away const OK - QAK */ + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") + } /* end if */ + + /* Decrement reference count for connector ID */ + if(H5I_dec_ref(info->connector_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID") + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_conn_free() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_register + * + * Purpose: VOL-aware version of H5I_register. Constructs an H5VL_object_t + * from the passed-in object and registers that. Does the right + * thing with datatypes, which are complicated under the VOL. + * + * Return: Success: A valid HDF5 ID + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref) +{ + H5VL_object_t *vol_obj = NULL; /* VOL object wrapper for library object */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Check arguments */ + HDassert(object); + HDassert(vol_connector); + + /* Set up VOL object for the passed-in data */ + /* (Does not wrap object, since it's from a VOL callback) */ + if(NULL == (vol_obj = H5VL__new_vol_obj(type, object, vol_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") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_register() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_register_using_existing_id + * + * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it. + * This routine will check to ensure the supplied ID is not already + * in use, and ensure that it is a valid ID for the given type, + * but will NOT check to ensure the OBJECT is not already + * registered (thus, it is possible to register one object under + * multiple IDs). + * + * NOTE: Intended for use in refresh calls, where we have to close + * and re-open the underlying data, then hook the VOL object back + * up to the original ID. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref, hid_t existing_id) +{ + H5VL_object_t *new_vol_obj = NULL; /* Pointer to new VOL object */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ + HDassert(object); + HDassert(vol_connector); + + /* Set up VOL object for the passed-in data */ + /* (Wraps object, since it's a library object) */ + if(NULL == (new_vol_obj = H5VL__new_vol_obj(type, object, vol_connector, TRUE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object") + + /* Call the underlying H5I function to complete the registration */ + if(H5I_register_using_existing_id(type, new_vol_obj, app_ref, existing_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register object under existing ID") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_register_using_existing_id() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_register_using_vol_id + * + * Purpose: Utility function to create a user ID for an object created + * or opened through the VOL. Uses the VOL connector's ID to + * get the connector information instead of it being passed in. + * + * Return: Success: A valid HDF5 ID + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref) +{ + H5VL_class_t *cls = NULL; + H5VL_t *connector = NULL; /* VOL connector struct */ + hid_t ret_value = H5I_INVALID_HID; + + FUNC_ENTER_NOAPI(FAIL) + + /* Get the VOL class object from the connector's ID */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL connector ID") + + /* Setup VOL info struct */ + if(NULL == (connector = H5FL_CALLOC(H5VL_t))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate VOL info struct") + connector->cls = cls; + connector->id = connector_id; + if(H5I_inc_ref(connector->id, FALSE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") + + /* Get an ID for the VOL object */ + if((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_register_using_vol_id() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_free_object + * + * Purpose: Wrapper to unregister an object ID with a VOL aux struct + * and decrement ref count on VOL connector ID + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_free_object(H5VL_object_t *vol_obj) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(SUCCEED) + + /* Check arguments */ + HDassert(vol_obj); + + vol_obj->connector->nrefs --; + + if(0 == vol_obj->connector->nrefs) { + if(H5I_dec_ref(vol_obj->connector->id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector") + vol_obj->connector = H5FL_FREE(H5VL_t, vol_obj->connector); + } /* end if */ + + vol_obj = H5FL_FREE(H5VL_object_t, vol_obj); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_free_object() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_register_connector + * + * Purpose: Registers a new VOL connector as a member of the virtual object + * layer class. + * + * Return: Success: A VOL connector ID which is good until the + * library is closed or the connector is unregistered. + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5VL_register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id) +{ + const H5VL_class_t *cls = (const H5VL_class_t *)_cls; + H5VL_class_t *saved = NULL; + hid_t ret_value = H5I_INVALID_HID; + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Check arguments */ + HDassert(cls); + + /* Copy the class structure so the caller can reuse or free it */ + if (NULL == (saved = H5FL_CALLOC(H5VL_class_t))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL connector class struct") + HDmemcpy(saved, cls, sizeof(H5VL_class_t)); + if(NULL == (saved->name = H5MM_strdup(cls->name))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL connector name") + + /* Initialize the VOL connector */ + if(cls->initialize && cls->initialize(vipl_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to init VOL connector") + + /* Create the new class ID */ + if ((ret_value = H5I_register(H5I_VOL, saved, app_ref)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID") + +done: + if (ret_value < 0) + if (saved) + H5FL_FREE(H5VL_class_t, saved); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_register_connector() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_get_connector_name + * + * Purpose: Private version of H5VLget_connector_name + * + * Return: Success: The length of the connector name + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +ssize_t +H5VL_get_connector_name(hid_t id, char *name /*out*/, size_t size) +{ + H5VL_object_t *vol_obj; + const H5VL_class_t *cls; + size_t len; + ssize_t ret_value = -1; + + FUNC_ENTER_NOAPI(FAIL) + + /* get the object pointer */ + if (NULL == (vol_obj = H5VL_vol_object(id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid VOL identifier") + + cls = vol_obj->connector->cls; + + len = HDstrlen(cls->name); + if(name) { + HDstrncpy(name, cls->name, MIN(len + 1, size)); + if(len >= size) + name[size - 1] = '\0'; + } /* end if */ + + /* Set the return value for the API call */ + ret_value = (ssize_t)len; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_get_connector_name() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_vol_object + * + * Purpose: Utility function to return the object pointer associated with + * a hid_t. This routine is the same as H5I_object for all types + * except for named datatypes, where the vol_obj is returned that + * is attached to the H5T_t struct. + * + * Return: Success: object pointer + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5VL_object_t * +H5VL_vol_object(hid_t id) +{ + void *obj = NULL; + H5I_type_t obj_type; + H5VL_object_t *ret_value = NULL; + + FUNC_ENTER_NOAPI(NULL) + + obj_type = H5I_get_type(id); + if (H5I_FILE == obj_type || H5I_GROUP == obj_type || H5I_ATTR == obj_type || + H5I_DATASET == obj_type || H5I_DATATYPE == obj_type) { + /* Get the object */ + if (NULL == (obj = H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") + + /* if this is a datatype, get the VOL object attached to the H5T_t struct */ + if (H5I_DATATYPE == obj_type) + if (NULL == (obj = H5T_get_named_type((H5T_t *)obj))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype") + } /* end if */ + else + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier type to function") + + ret_value = (H5VL_object_t *)obj; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_vol_object() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_data + * + * Purpose: Correctly retrieve the 'data' field for a VOL object (H5VL_object), + * even for nested / stacked VOL connectors. + * + * Return: Success: object pointer + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_object_data(const H5VL_object_t *vol_obj) +{ + void *ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Check for 'get_object' callback in connector */ + if(vol_obj->connector->cls->get_object) + ret_value = (vol_obj->connector->cls->get_object)(vol_obj->data); + else + ret_value = vol_obj->data; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_data() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__object + * + * Purpose: Internal function to return the VOL object pointer associated + * with an hid_t. + * + * Return: Success: object pointer + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__object(hid_t id, H5I_type_t obj_type) +{ + H5VL_object_t *vol_obj = NULL; + void *ret_value = NULL; + + FUNC_ENTER_STATIC + + /* Get the underlying object */ + switch(obj_type) { + case H5I_GROUP: + case H5I_DATASET: + case H5I_FILE: + case H5I_ATTR: + /* get the object */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") + break; + + case H5I_DATATYPE: + { + H5T_t *dt = NULL; + + /* get the object */ + if (NULL == (dt = (H5T_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") + + /* Get the actual datatype object that should be the vol_obj */ + if (NULL == (vol_obj = H5T_get_named_type(dt))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype") + break; + } + + case H5I_UNINIT: + case H5I_BADID: + case H5I_DATASPACE: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_VOL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type") + } /* end switch */ + + /* Set the return value */ + ret_value = H5VL_object_data(vol_obj); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object + * + * Purpose: Utility function to return the VOL object pointer associated with + * a hid_t. + * + * Return: Success: object pointer + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_object(hid_t id) +{ + void *ret_value = NULL; + + FUNC_ENTER_NOAPI(NULL) + + /* Get the underlying object */ + if(NULL == (ret_value = H5VL__object(id, H5I_get_type(id)))) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_verify + * + * Purpose: Utility function to return the VOL object pointer associated + * with an identifier. + * + * Return: Success: object pointer + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_object_verify(hid_t id, H5I_type_t obj_type) +{ + void *ret_value = NULL; + + FUNC_ENTER_NOAPI(NULL) + + /* Check of ID of correct type */ + if(obj_type != H5I_get_type(id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") + + /* Get the underlying object */ + if(NULL == (ret_value = H5VL__object(id, obj_type))) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_verify() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_cmp_connector_cls + * + * Purpose: Compare VOL class for a connector + * + * Return: Positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_class_t *cls2) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cls1); + HDassert(cls2); + + /* Compare connector "values" */ + if(cls1->value < cls2->value) { + *cmp_value = -1; + HGOTO_DONE(SUCCEED) + } /* end if */ + if(cls1->value > cls2->value) { + *cmp_value = 1; + HGOTO_DONE(SUCCEED) + } /* end if */ + HDassert(cls1->value == cls2->value); + + /* Compare connector names */ + if(cls1->name == NULL && cls2->name != NULL) { + *cmp_value = -1; + HGOTO_DONE(SUCCEED) + } /* end if */ + if(cls1->name != NULL && cls2->name == NULL) { + *cmp_value = 1; + HGOTO_DONE(SUCCEED) + } /* end if */ + if(0 != (*cmp_value = HDstrcmp(cls1->name, cls2->name))) + HGOTO_DONE(SUCCEED) + + /* Compare connector VOL API versions */ + if(cls1->version < cls2->version) { + *cmp_value = -1; + HGOTO_DONE(SUCCEED) + } /* end if */ + if(cls1->version > cls2->version) { + *cmp_value = 1; + HGOTO_DONE(SUCCEED) + } /* end if */ + HDassert(cls1->version == cls2->version); + + /* Compare connector info */ + if(cls1->info_size < cls2->info_size) { + *cmp_value = -1; + HGOTO_DONE(SUCCEED) + } /* end if */ + if(cls1->info_size > cls2->info_size) { + *cmp_value = 1; + HGOTO_DONE(SUCCEED) + } /* end if */ + HDassert(cls1->info_size == cls2->info_size); + + /* Set comparison value to 'equal' */ + *cmp_value = 0; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_cmp_connector_cls() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_set_vol_wrapper + * + * Purpose: Set up object wrapping context for current VOL connector + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_set_vol_wrapper(void *obj, const H5VL_t *connector) +{ + H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ + void *obj_wrap_ctx = NULL; /* VOL connector's wrapping context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(obj); + HDassert(connector); + + /* Retrieve the VOL object wrap context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context") + + /* Check for existing wrapping context */ + if(NULL == vol_wrap_ctx) { + /* Check if the connector can create a wrap context */ + if(connector->cls->get_wrap_ctx) { + /* Sanity check */ + HDassert(connector->cls->free_wrap_ctx); + + /* Get the wrap context from the connector */ + if((connector->cls->get_wrap_ctx)(obj, &obj_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL connector's object wrap context") + } /* end if */ + + /* Allocate VOL object wrapper context */ + if(NULL == (vol_wrap_ctx = H5FL_MALLOC(H5VL_wrap_ctx_t))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate VOL wrap context") + + /* Set up VOL object wrapper context */ + vol_wrap_ctx->rc = 1;; + vol_wrap_ctx->connector = connector; + vol_wrap_ctx->obj_wrap_ctx = obj_wrap_ctx; + } /* end if */ + else + /* Incremeent ref count on existing wrapper context */ + vol_wrap_ctx->rc++; + + /* Save the wrapper context */ + if(H5CX_set_vol_wrap_ctx(vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context") + +done: + if(ret_value < 0 && vol_wrap_ctx) + /* Release object wrapping context */ + H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_set_vol_wrapper() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_reset_vol_wrapper + * + * Purpose: Reset object wrapping context for current VOL connector + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_reset_vol_wrapper(void) +{ + H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Retrieve the VOL object wrap context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context") + + /* Check for VOL object wrap context */ + if(NULL == vol_wrap_ctx) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "no VOL object wrap context?") + + /* Decrement ref count on wrapping context */ + vol_wrap_ctx->rc--; + + /* Release context if the ref count drops to zero */ + if(0 == vol_wrap_ctx->rc) { + /* If there is a VOL connector object wrapping context, release it */ + if(vol_wrap_ctx->obj_wrap_ctx) { + /* Release the VOL connector's object wrapping context */ + if((*vol_wrap_ctx->connector->cls->free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release connector's object wrapping context") + } /* end if */ + + /* Release object wrapping context */ + H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx); + + /* Reset the wrapper context */ + if(H5CX_set_vol_wrap_ctx(NULL) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context") + } /* end if */ + else { + /* Save the updated wrapper context */ + if(H5CX_set_vol_wrap_ctx(vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context") + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_reset_vol_wrapper() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_wrap_register + * + * Purpose: Wrap an object and register an ID for it + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +hid_t +H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref) +{ + H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ + void *new_obj; /* Newly wrapped object */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Sanity check */ + HDassert(obj); + + /* If the datatype is already VOL-managed, the datatype's vol_obj + * field will get clobbered later, so disallow this. + */ + if(type == H5I_DATATYPE) + if(TRUE == H5T_already_vol_managed((const H5T_t *)obj)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype") + + /* Wrap the object with VOL connector info */ + if(NULL == (new_obj = H5VL__wrap_obj(obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't wrap library object") + + /* Retrieve the VOL object wrapping context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") + if(NULL == vol_wrap_ctx || NULL == vol_wrap_ctx->connector) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "VOL object wrap context or its connector is NULL???") + + /* Get an ID for the object */ + if((ret_value = H5VL_register_using_vol_id(type, new_obj, vol_wrap_ctx->connector->id, app_ref)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_wrap_register() */ + diff --git a/src/H5HLpublic.h b/src/H5VLmodule.h index 143bb78..1ae0d61 100644 --- a/src/H5HLpublic.h +++ b/src/H5VLmodule.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,27 +10,22 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/*------------------------------------------------------------------------- - * - * Created: H5HLpublic.h - * Jul 16 1997 - * Robb Matzke <matzke@llnl.gov> - * - * Purpose: Public declarations for the H5HL (local heap) package. - * - *------------------------------------------------------------------------- +/* + * Purpose: This file contains declarations which define macros for the + * H5VL package. Including this header means that the source file + * is part of the H5VL package. */ -#ifndef _H5HLpublic_H -#define _H5HLpublic_H -/* Public headers needed by this file */ -#include "H5public.h" +#ifndef _H5VLmodule_H +#define _H5VLmodule_H -#ifdef __cplusplus -extern "C" { -#endif +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5VL_MODULE +#define H5_MY_PKG H5VL +#define H5_MY_PKG_ERR H5E_VOL +#define H5_MY_PKG_INIT YES + +#endif /* _H5VLmodule_H */ -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/H5VLnative.c b/src/H5VLnative.c new file mode 100644 index 0000000..5368d41 --- /dev/null +++ b/src/H5VLnative.c @@ -0,0 +1,3655 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: The native VOL connector where access is to a single HDF5 file + * using HDF5 VFDs. + */ + +#define H5A_FRIEND /* Suppress error about including H5Apkg */ +#define H5D_FRIEND /* Suppress error about including H5Dpkg */ +#define H5F_FRIEND /* Suppress error about including H5Fpkg */ +#define H5G_FRIEND /* Suppress error about including H5Gpkg */ +#define H5L_FRIEND /* Suppress error about including H5Lpkg */ +#define H5O_FRIEND /* Suppress error about including H5Opkg */ +#define H5R_FRIEND /* Suppress error about including H5Rpkg */ +#define H5T_FRIEND /* Suppress error about including H5Tpkg */ + + +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* Files */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lpkg.h" /* Links */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Rpkg.h" /* References */ +#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5Tpkg.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative.h" /* Native VOL connector */ + +/* + * The VOL connector identification number. + */ +static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID; + + +/* Prototypes */ +static herr_t H5VL__native_term(void); + +/* Atrribute callbacks */ +static void *H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_attr_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req); + +/* Dataset callbacks */ +static void *H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, void *buf, void **req); +static herr_t H5VL__native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +static herr_t H5VL__native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_dataset_optional(void *dset, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_dataset_close(void *dset, hid_t dxpl_id, void **req); + +/* File callbacks */ +static void *H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req); + +/* Group callbacks */ +static void *H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_group_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req); + +/* Link callbacks */ +static herr_t H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, + const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); + +/* Object callbacks */ +static void *H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +static herr_t H5VL__native_object_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name, + void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); + +/* Datatype callbacks */ +static void *H5VL__native_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req); + +/* Native VOL connector class struct */ +static H5VL_class_t H5VL_native_cls_g = { + H5VL_NATIVE_VERSION, /* version */ + H5VL_NATIVE_VALUE, /* value */ + H5VL_NATIVE_NAME, /* name */ + 0, /* capability flags */ + NULL, /* initialize */ + H5VL__native_term, /* terminate */ + (size_t)0, /* info size */ + NULL, /* info copy */ + NULL, /* info compare */ + NULL, /* info free */ + NULL, /* info to str */ + NULL, /* str to info */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* wrap_object */ + NULL, /* free_wrap_ctx */ + { /* attribute_cls */ + H5VL__native_attr_create, /* create */ + H5VL__native_attr_open, /* open */ + H5VL__native_attr_read, /* read */ + H5VL__native_attr_write, /* write */ + H5VL__native_attr_get, /* get */ + H5VL__native_attr_specific, /* specific */ + H5VL__native_attr_optional, /* optional */ + H5VL__native_attr_close /* close */ + }, + { /* dataset_cls */ + H5VL__native_dataset_create, /* create */ + H5VL__native_dataset_open, /* open */ + H5VL__native_dataset_read, /* read */ + H5VL__native_dataset_write, /* write */ + H5VL__native_dataset_get, /* get */ + H5VL__native_dataset_specific, /* specific */ + H5VL__native_dataset_optional, /* optional */ + H5VL__native_dataset_close /* close */ + }, + { /* datatype_cls */ + H5VL__native_datatype_commit, /* commit */ + H5VL__native_datatype_open, /* open */ + H5VL__native_datatype_get, /* get */ + H5VL__native_datatype_specific, /* specific */ + NULL, /* optional */ + H5VL__native_datatype_close /* close */ + }, + { /* file_cls */ + H5VL__native_file_create, /* create */ + H5VL__native_file_open, /* open */ + H5VL__native_file_get, /* get */ + H5VL__native_file_specific, /* specific */ + H5VL__native_file_optional, /* optional */ + H5VL__native_file_close /* close */ + }, + { /* group_cls */ + H5VL__native_group_create, /* create */ + H5VL__native_group_open, /* open */ + H5VL__native_group_get, /* get */ + H5VL__native_group_specific, /* specific */ + H5VL__native_group_optional, /* optional */ + H5VL__native_group_close /* close */ + }, + { /* link_cls */ + H5VL__native_link_create, /* create */ + H5VL__native_link_copy, /* copy */ + H5VL__native_link_move, /* move */ + H5VL__native_link_get, /* get */ + H5VL__native_link_specific, /* specific */ + NULL /* optional */ + }, + { /* object_cls */ + H5VL__native_object_open, /* open */ + H5VL__native_object_copy, /* copy */ + H5VL__native_object_get, /* get */ + H5VL__native_object_specific, /* specific */ + H5VL__native_object_optional /* optional */ + }, + { /* request_cls */ + NULL, /* wait */ + NULL, /* notify */ + NULL, /* cancel */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* free */ + }, + NULL /* optional */ +}; + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_register + * + * Purpose: Register the native VOL connector and retrieve an ID for it. + * + * Return: Success: The ID for the native connector + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5VL_native_register(void) +{ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + 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) + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL connector") + + /* Set return value */ + ret_value = H5VL_NATIVE_ID_g; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_register() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL__native_term + * + * Purpose: Shut down the native VOL + * + * Returns: SUCCEED (Can't fail) + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_term(void) +{ + FUNC_ENTER_STATIC_NOERR + + /* Reset VOL ID */ + H5VL_NATIVE_ID_g = H5I_INVALID_HID; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__native_term() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_attr_create + * + * Purpose: Creates an attribute on an object. + * + * Return: Success: Pointer to attribute object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, + hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) +{ + H5G_loc_t loc; /* Object location */ + H5G_loc_t obj_loc; /* Location used to open group */ + hbool_t loc_found = FALSE; + H5P_genplist_t *plist; /* Property list pointer */ + hid_t type_id, space_id; + H5T_t *type, *dt; /* Datatype to use for attribute */ + H5S_t *space; /* Dataspace to use for attribute */ + H5A_t *attr = NULL; + void *ret_value = NULL; + + FUNC_ENTER_STATIC + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID") + + /* get creation properties */ + if(H5P_get(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for datatype id") + if(H5P_get(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id") + + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) + HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, NULL, "no write intent on file") + + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") + /* If this is a named datatype, get the connector's pointer to the datatype */ + type = H5T_get_actual_type(dt); + + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data space") + + if(loc_params->type == H5VL_OBJECT_BY_SELF) { + /* H5Acreate */ + /* Go do the real work for attaching the attribute to the dataset */ + if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { + /* H5Acreate_by_name */ + if(NULL == (attr = H5A__create_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name, type, space, acpl_id))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") + } /* end else-if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute create parameters") + + ret_value = (void *)attr; + +done: + /* Release resources */ + if(loc_found && H5G_loc_free(&obj_loc) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_attr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_attr_open + * + * Purpose: Opens an attr inside a native H5 file. + * + * Return: Success: Pointer to attribute object + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, + hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5G_loc_t loc; /* Object location */ + H5A_t *attr = NULL; /* Attribute opened */ + void *ret_value; + + FUNC_ENTER_STATIC + + /* check arguments */ + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + + if(loc_params->type == H5VL_OBJECT_BY_SELF) { + /* H5Aopen */ + /* Open the attribute */ + if(NULL == (attr = H5A__open(&loc, attr_name))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute: '%s'", attr_name) + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { + /* H5Aopen_by_name */ + /* Open the attribute on the object header */ + if(NULL == (attr = H5A__open_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute") + } /* end else-if */ + else if(loc_params->type == H5VL_OBJECT_BY_IDX) { + /* H5Aopen_by_idx */ + /* Open the attribute in the object header */ + if(NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, + loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, + loc_params->loc_data.loc_by_idx.n))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute") + } /* end else-if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute open parameters") + + ret_value = (void *)attr; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_attr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_attr_read + * + * Purpose: Reads data from attribute. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5T_t *mem_type; /* Memory datatype */ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_STATIC + + if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + + /* Go write the actual data to the attribute */ + if((ret_value = H5A__read((H5A_t*)attr, mem_type, buf)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_attr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_attr_write + * + * Purpose: Writes data to attribute. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5T_t *mem_type; /* Memory datatype */ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_STATIC + + if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + + /* Go write the actual data to the attribute */ + if((ret_value = H5A__write((H5A_t*)attr, mem_type, buf)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_attr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_attr_get + * + * Purpose: Gets information about an attribute + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + switch(get_type) { + /* H5Aget_space */ + case H5VL_ATTR_GET_SPACE: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + H5A_t *attr = (H5A_t *)obj; + + if((*ret_id = H5A_get_space(attr)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute") + break; + } + + /* H5Aget_type */ + case H5VL_ATTR_GET_TYPE: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + H5A_t *attr = (H5A_t *)obj; + + if((*ret_id = H5A__get_type(attr)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute") + break; + } + + /* H5Aget_create_plist */ + case H5VL_ATTR_GET_ACPL: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + H5A_t *attr = (H5A_t *)obj; + + if((*ret_id = H5A__get_create_plist(attr)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for attr") + + break; + } + + /* H5Aget_name */ + case H5VL_ATTR_GET_NAME: + { + const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *); + size_t buf_size = va_arg(arguments, size_t); + char *buf = va_arg(arguments, char *); + ssize_t *ret_val = va_arg(arguments, ssize_t *); + H5A_t *attr = NULL; + + if(H5VL_OBJECT_BY_SELF == loc_params->type) { + attr = (H5A_t *)obj; + /* Call private function in turn */ + if(0 > (*ret_val = H5A__get_name(attr, buf_size, buf))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name") + } + else if(H5VL_OBJECT_BY_IDX == loc_params->type) { + H5G_loc_t loc; + + /* check arguments */ + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Open the attribute on the object header */ + if(NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, + loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, + loc_params->loc_data.loc_by_idx.n))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + + /* Get the length of the name */ + *ret_val = (ssize_t)HDstrlen(attr->shared->name); + + /* Copy the name into the user's buffer, if given */ + if(buf) { + HDstrncpy(buf, attr->shared->name, MIN((size_t)(*ret_val + 1), buf_size)); + if((size_t)(*ret_val) >= buf_size) + buf[buf_size - 1]='\0'; + } /* end if */ + + /* Release resources */ + if(attr && H5A__close(attr) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + } + else + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr") + + break; + } + + /* H5Aget_info */ + case H5VL_ATTR_GET_INFO: + { + const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *); + H5A_info_t *ainfo = va_arg(arguments, H5A_info_t *); + H5A_t *attr = NULL; + + if(H5VL_OBJECT_BY_SELF == loc_params->type) { + attr = (H5A_t *)obj; + if(H5A__get_info(attr, ainfo) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get attribute info") + } + else if(H5VL_OBJECT_BY_NAME == loc_params->type) { + char *attr_name = va_arg(arguments, char *); + H5G_loc_t loc; + + /* check arguments */ + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Open the attribute on the object header */ + if(NULL == (attr = H5A__open_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + + /* Get the attribute information */ + if(H5A__get_info(attr, ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + + /* Release resources */ + if(attr && H5A__close(attr) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + } + else if(H5VL_OBJECT_BY_IDX == loc_params->type) { + H5G_loc_t loc; + + /* check arguments */ + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Open the attribute on the object header */ + if(NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, + loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, + loc_params->loc_data.loc_by_idx.n))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + + /* Get the attribute information */ + if(H5A__get_info(attr, ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + + /* Release resources */ + if(attr && H5A__close(attr) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + } + else + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr") + + break; + } + + case H5VL_ATTR_GET_STORAGE_SIZE: + { + hsize_t *ret = va_arg(arguments, hsize_t *); + H5A_t *attr = (H5A_t *)obj; + + /* Set return value */ + *ret = attr->shared->data_size; + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from attr") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_attr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_attr_specific + * + * Purpose: Specific operation on attribute + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * August, 2014 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5G_loc_t loc; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Get location for passed-in object */ + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + switch(specific_type) { + case H5VL_ATTR_DELETE: + { + char *attr_name = va_arg(arguments, char *); + + if(H5VL_OBJECT_BY_SELF == loc_params->type) { + /* H5Adelete */ + /* Delete the attribute from the location */ + if(H5O__attr_remove(loc.oloc, attr_name) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + } /* end if */ + else if(H5VL_OBJECT_BY_NAME == loc_params->type) { + /* H5Adelete_by_name */ + /* Delete the attribute */ + if(H5A__delete_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + } /* end else-if */ + else if(H5VL_OBJECT_BY_IDX == loc_params->type) { + /* H5Adelete_by_idx */ + /* Delete the attribute from the location */ + if(H5A__delete_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + } /* end else-if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute remove parameters") + break; + } + + case H5VL_ATTR_EXISTS: + { + const char *attr_name = va_arg(arguments, const char *); + htri_t *ret = va_arg(arguments, htri_t *); + + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Aexists */ + /* Check if the attribute exists */ + if((*ret = H5O__attr_exists(loc.oloc, attr_name)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Aexists_by_name */ + /* Check if the attribute exists */ + if((*ret = H5A__exists_by_name(loc, loc_params->loc_data.loc_by_name.name, attr_name)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") + } /* end else-if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters") + break; + } + + case H5VL_ATTR_ITER: + { + H5_index_t idx_type = va_arg(arguments, H5_index_t); + H5_iter_order_t order = va_arg(arguments, H5_iter_order_t); + hsize_t *idx = va_arg(arguments, hsize_t *); + H5A_operator2_t op = va_arg(arguments, H5A_operator2_t); + void *op_data = va_arg(arguments, void *); + + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Aiterate2 */ + /* Iterate over attributes */ + if((ret_value = H5A__iterate(&loc, ".", idx_type, order, idx, op, op_data)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Aiterate_by_name */ + /* Iterate over attributes by name */ + if((ret_value = H5A__iterate(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, idx, op, op_data)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "attribute iteration failed"); + } /* end else-if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters") + break; + } + + /* H5Arename/rename_by_name */ + case H5VL_ATTR_RENAME: + { + const char *old_name = va_arg(arguments, const char *); + const char *new_name = va_arg(arguments, const char *); + + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Arename */ + /* Call attribute rename routine */ + if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Arename_by_name */ + /* Call attribute rename routine */ + if(H5A__rename_by_name(loc, loc_params->loc_data.loc_by_name.name, old_name, new_name) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") + } /* end else-if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute rename parameters") + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_attr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_attr_optional + * + * Purpose: Perform a connector-specific operation on a native attribute + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_attr_optional(void H5_ATTR_UNUSED *obj, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5VL_attr_optional_t optional_type; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + optional_type = va_arg(arguments, H5VL_attr_optional_t); + switch(optional_type) { +#ifndef H5_NO_DEPRECATED_SYMBOLS + case H5VL_ATTR_ITERATE_OLD: + { + hid_t loc_id = va_arg(arguments, hid_t); + unsigned *attr_num = va_arg(arguments, unsigned *); + H5A_operator1_t op = va_arg(arguments, H5A_operator1_t); + void *op_data = va_arg(arguments, void *); + + /* Call the actual iteration routine */ + if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0) + HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes"); + + break; + } +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_attr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_attr_close + * + * Purpose: Closes an attribute. + * + * Return: Success: 0 + * Failure: -1, attr not closed. + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_attr_close(void *attr, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + if(H5A__close((H5A_t*)attr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_attr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_dataset_create + * + * Purpose: Creates a dataset in a native HDF5 file + * + * Return: Success: Pointer to a dataset struct + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5G_loc_t loc; /* Object location to insert dataset into */ + hid_t type_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t lcpl_id = H5I_INVALID_HID; + H5D_t *dset = NULL; /* New dataset's info */ + const H5S_t *space; /* Dataspace for dataset */ + void *ret_value; + + FUNC_ENTER_STATIC + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID") + + /* Get creation properties */ + if(H5P_get(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for datatype id") + if(H5P_get(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id") + if(H5P_get(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id") + + /* Check arguments */ + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + if(H5I_DATATYPE != H5I_get_type(type_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype ID") + if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a dataspace ID") + + /* H5Dcreate_anon */ + if(NULL == name) { + /* build and open the new dataset */ + if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") + } /* end if */ + /* H5Dcreate2 */ + else { + /* Create the new dataset & get its ID */ + if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") + } /* end else */ + + ret_value = (void *)dset; + +done: + if(NULL == name) { + /* Release the dataset's object header, if it was created */ + if(dset) { + H5O_loc_t *oloc; /* Object location for dataset */ + + /* Get the new dataset's object location */ + if(NULL == (oloc = H5D_oloc(dset))) + HDONE_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get object location of dataset") + + /* Decrement refcount on dataset's object header in memory */ + if(H5O_dec_rc_by_loc(oloc) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") + } /* end if */ + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_dataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_dataset_open + * + * Purpose: Opens a dataset in a native HDF5 file. + * + * Return: Success: Pointer to a dataset struct + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__native_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, + hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5D_t *dset = NULL; + H5G_loc_t loc; /* Object location of group */ + void *ret_value = NULL; + + FUNC_ENTER_STATIC + + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + + /* Open the dataset */ + if(NULL == (dset = H5D__open_name(&loc, name, dapl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open dataset") + + ret_value = (void *)dset; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_dataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_dataset_read + * + * Purpose: Reads raw data from a dataset into a buffer. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, void *buf, + void H5_ATTR_UNUSED **req) +{ + H5D_t *dset = (H5D_t *)obj; + const H5S_t *mem_space = NULL; + const H5S_t *file_space = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check arguments */ + if(NULL == dset->oloc.file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + + /* Get validated dataspace pointers */ + if(H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id") + if(H5S_get_validated_dataspace(file_space_id, &file_space) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id") + + /* Read raw data */ + if(H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_dataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_dataset_write + * + * Purpose: Writes raw data from a buffer into a dataset. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, const void *buf, + void H5_ATTR_UNUSED **req) +{ + H5D_t *dset = (H5D_t *)obj; + const H5S_t *mem_space = NULL; + const H5S_t *file_space = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* check arguments */ + if(NULL == dset->oloc.file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + + /* Get validated dataspace pointers */ + if(H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id") + if(H5S_get_validated_dataspace(file_space_id, &file_space) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id") + + /* Write the data */ + if(H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_dataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_dataset_get + * + * Purpose: Gets certain information about a dataset + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_dataset_get(void *obj, H5VL_dataset_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5D_t *dset = (H5D_t *)obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + switch(get_type) { + /* H5Dget_space */ + case H5VL_DATASET_GET_SPACE: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + + if((*ret_id = H5D__get_space(dset)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of dataset") + + break; + } + + /* H5Dget_space_statuc */ + case H5VL_DATASET_GET_SPACE_STATUS: + { + H5D_space_status_t *allocation = va_arg(arguments, H5D_space_status_t *); + + /* Read data space address and return */ + if(H5D__get_space_status(dset, allocation) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status") + + break; + } + + /* H5Dget_type */ + case H5VL_DATASET_GET_TYPE: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + + if((*ret_id = H5D__get_type(dset)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of dataset") + + break; + } + + /* H5Dget_create_plist */ + case H5VL_DATASET_GET_DCPL: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + + if((*ret_id = H5D_get_create_plist(dset)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for dataset") + + break; + } + + /* H5Dget_access_plist */ + case H5VL_DATASET_GET_DAPL: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + + if((*ret_id = H5D_get_access_plist(dset)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get access property list for dataset") + + break; + } + + /* H5Dget_storage_size */ + case H5VL_DATASET_GET_STORAGE_SIZE: + { + hsize_t *ret = va_arg(arguments, hsize_t *); + + /* Set return value */ + if(H5D__get_storage_size(dset, ret) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage") + break; + } + + /* H5Dget_offset */ + case H5VL_DATASET_GET_OFFSET: + { + haddr_t *ret = va_arg(arguments, haddr_t *); + + /* Set return value */ + *ret = H5D__get_offset(dset); + if(!H5F_addr_defined(*ret)) + *ret = HADDR_UNDEF; + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_dataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_dataset_specific + * + * Purpose: Specific operation on dataset + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5D_t *dset = (H5D_t *)obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + switch(specific_type) { + /* H5Dspecific_space */ + case H5VL_DATASET_SET_EXTENT: + { + const hsize_t *size = va_arg(arguments, const hsize_t *); + + if(H5D__set_extent(dset, size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extent of dataset") + break; + } + + case H5VL_DATASET_FLUSH: + { + hid_t dset_id = va_arg(arguments, hid_t); + + /* Flush the dataset */ + if(H5D__flush(dset, dset_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset") + + break; + } + + case H5VL_DATASET_REFRESH: + { + hid_t dset_id = va_arg(arguments, hid_t); + + /* Refresh the dataset */ + if((H5D__refresh(dset_id, dset)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset") + + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_dataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_dataset_optional + * + * Purpose: Perform a connector-specific operation on a native dataset + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5D_t *dset = NULL; /* Dataset */ + H5VL_dataset_optional_t optional_type = va_arg(arguments, H5VL_dataset_optional_t); + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + switch(optional_type) { + case H5VL_DATASET_FORMAT_CONVERT: + { + dset = (H5D_t *)obj; + + switch(dset->shared->layout.type) { + case H5D_CHUNKED: + /* Convert the chunk indexing type to version 1 B-tree if not */ + if(dset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE) + if((H5D__format_convert(dset)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade chunk indexing type for dataset") + break; + + case H5D_CONTIGUOUS: + case H5D_COMPACT: + /* Downgrade the layout version to 3 if greater than 3 */ + if(dset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT) + if((H5D__format_convert(dset)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade layout version for dataset") + break; + + case H5D_VIRTUAL: + /* Nothing to do even though layout is version 4 */ + break; + + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type") + + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type") + } /* end switch */ + + break; + } + + case H5VL_DATASET_GET_CHUNK_INDEX_TYPE: + { + H5D_chunk_index_t *idx_type = va_arg(arguments, H5D_chunk_index_t *); + + dset = (H5D_t *)obj; + + /* Make sure the dataset is chunked */ + if(H5D_CHUNKED != dset->shared->layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + + /* Get the chunk indexing type */ + *idx_type = dset->shared->layout.u.chunk.idx_type; + + break; + } + + case H5VL_DATASET_GET_CHUNK_STORAGE_SIZE: + { + hsize_t *offset = va_arg(arguments, hsize_t *); + hsize_t *chunk_nbytes = va_arg(arguments, hsize_t *); + + dset = (H5D_t *)obj; + + /* Make sure the dataset is chunked */ + if(H5D_CHUNKED != dset->shared->layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + + /* Call private function */ + if(H5D__get_chunk_storage_size(dset, offset, chunk_nbytes) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") + + break; + } + + case H5VL_DATASET_CHUNK_READ: + { + const hsize_t *offset = va_arg(arguments, hsize_t *); + uint32_t *filters = va_arg(arguments, uint32_t *); + void *buf = va_arg(arguments, void *); + hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ + + dset = (H5D_t *)obj; + + /* Check arguments */ + if(NULL == dset->oloc.file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + if(H5D_CHUNKED != dset->shared->layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + + /* Copy the user's offset array so we can be sure it's terminated properly. + * (we don't want to mess with the user's buffer). + */ + if(H5D__get_offset_copy(dset, offset, offset_copy) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array") + + /* Read the raw chunk */ + if(H5D__chunk_direct_read(dset, offset_copy, filters, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") + + break; + } + + case H5VL_DATASET_CHUNK_WRITE: + { + uint32_t filters = va_arg(arguments, uint32_t); + const hsize_t *offset = va_arg(arguments, const hsize_t *); + uint32_t data_size_32 = va_arg(arguments, uint32_t); + const void *buf = va_arg(arguments, const void *); + hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ + + dset = (H5D_t *)obj; + + /* Check arguments */ + if(NULL == dset->oloc.file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + if(H5D_CHUNKED != dset->shared->layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + + /* Copy the user's offset array so we can be sure it's terminated properly. + * (we don't want to mess with the user's buffer). + */ + if(H5D__get_offset_copy(dset, offset, offset_copy) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array") + + /* Write chunk */ + if(H5D__chunk_direct_write(dset, filters, offset_copy, data_size_32, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") + + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_dataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_dataset_close + * + * Purpose: Closes a dataset. + * + * Return: Success: SUCCEED + * Failure: FAIL (dataset will not be closed) + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_dataset_close(void *dset, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + if(H5D_close((H5D_t*)dset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close dataset") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_dataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_file_create + * + * Purpose: Creates a file as a native HDF5 file. + * + * Return: Success: A pointer to an H5F_t file struct + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5F_t *new_file = NULL; + void *ret_value = NULL; + + FUNC_ENTER_STATIC + + /* Adjust bit flags by turning on the creation bit and making sure that + * the EXCL or TRUNC bit is set. All newly-created files are opened for + * reading and writing. + */ + if(0 == (flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC))) + flags |= H5F_ACC_EXCL; /*default*/ + flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; + + /* Create the file */ + if(NULL == (new_file = H5F_open(name, flags, fcpl_id, fapl_id))) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file") + new_file->id_exists = TRUE; + + ret_value = (void *)new_file; + +done: + if(NULL == ret_value && new_file) + if(H5F__close(new_file) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_file_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_file_open + * + * Purpose: Opens a file as a native HDF5 file. + * + * Return: Success: A pointer to an H5F_t file struct + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5F_t *new_file = NULL; + void *ret_value = NULL; + + FUNC_ENTER_STATIC + + /* Open the file */ + if(NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") + new_file->id_exists = TRUE; + + ret_value = (void *)new_file; + +done: + if(NULL == ret_value && new_file && H5F_try_close(new_file, NULL) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_file_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_file_get + * + * Purpose: Get info about a file + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5F_t *f = NULL; /* File struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + switch(get_type) { + /* H5Fget_access_plist */ + case H5VL_FILE_GET_FAPL: + { + H5P_genplist_t *new_plist; /* New property list */ + hid_t *plist_id = va_arg(arguments, hid_t *); + + f = (H5F_t *)obj; + + /* Retrieve the file's access property list */ + if((*plist_id = H5F_get_access_plist(f, TRUE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file access property list") + + if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(*plist_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + break; + } + + /* H5Fget_create_plist */ + case H5VL_FILE_GET_FCPL: + { + H5P_genplist_t *plist; /* Property list */ + hid_t *plist_id = va_arg(arguments, hid_t *); + + f = (H5F_t *)obj; + if(NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Create the property list object to return */ + if((*plist_id = H5P_copy_plist(plist, TRUE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy file creation properties") + + break; + } + + /* H5Fget_obj_count */ + case H5VL_FILE_GET_OBJ_COUNT: + { + unsigned types = va_arg(arguments, unsigned); + ssize_t *ret = va_arg(arguments, ssize_t *); + size_t obj_count = 0; /* Number of opened objects */ + + f = (H5F_t *)obj; + /* Perform the query */ + if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed") + + /* Set the return value */ + *ret = (ssize_t)obj_count; + break; + } + + /* H5Fget_obj_ids */ + case H5VL_FILE_GET_OBJ_IDS: + { + unsigned types = va_arg(arguments, unsigned); + size_t max_objs = va_arg(arguments, size_t); + hid_t *oid_list = va_arg(arguments, hid_t *); + ssize_t *ret = va_arg(arguments, ssize_t *); + size_t obj_count = 0; /* Number of opened objects */ + + f = (H5F_t *)obj; + /* Perform the query */ + if(H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_count) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed") + + /* Set the return value */ + *ret = (ssize_t)obj_count; + break; + } + + /* H5Fget_intent */ + case H5VL_FILE_GET_INTENT: + { + unsigned *intent_flags = va_arg(arguments, unsigned *); + + f = (H5F_t *)obj; + + /* HDF5 uses some flags internally that users don't know about. + * Simplify things for them so that they only get either H5F_ACC_RDWR + * or H5F_ACC_RDONLY and any SWMR flags. + */ + if(H5F_INTENT(f) & H5F_ACC_RDWR) { + *intent_flags = H5F_ACC_RDWR; + + /* Check for SWMR write access on the file */ + if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) + *intent_flags |= H5F_ACC_SWMR_WRITE; + } /* end if */ + else { + *intent_flags = H5F_ACC_RDONLY; + + /* Check for SWMR read access on the file */ + if(H5F_INTENT(f) & H5F_ACC_SWMR_READ) + *intent_flags |= H5F_ACC_SWMR_READ; + } /* end else */ + + break; + } + + /* H5Fget_name */ + case H5VL_FILE_GET_NAME: + { + H5I_type_t type = va_arg(arguments, H5I_type_t); + size_t size = va_arg(arguments, size_t); + char *name = va_arg(arguments, char *); + ssize_t *ret = va_arg(arguments, ssize_t *); + size_t len; + + if(NULL == (f = H5F__get_file(obj, type))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + len = HDstrlen(H5F_OPEN_NAME(f)); + + if(name) { + HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1,size)); + if(len >= size) + name[size-1]='\0'; + } /* end if */ + + /* Set the return value for the API call */ + *ret = (ssize_t)len; + break; + } + + case H5VL_FILE_GET_MIN_DSET_OHDR_FLAG: + { + hbool_t *minimize = va_arg(arguments, hbool_t*); + f = (H5F_t*)obj; + if (NULL == f) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + *minimize = H5F_MIN_DSET_OHDR(f); + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_file_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_file_specific + * + * Purpose: Specific operation on file + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + switch(specific_type) { + /* H5Fflush */ + case H5VL_FILE_FLUSH: + { + H5I_type_t type = va_arg(arguments, H5I_type_t); + H5F_scope_t scope = va_arg(arguments, H5F_scope_t); + H5F_t *f = NULL; /* File to flush */ + + /* Get the file for the object */ + if(NULL == (f = H5F__get_file(obj, type))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Nothing to do if the file is read only. This determination is + * made at the shared open(2) flags level, implying that opening a + * file twice, once for read-only and once for read-write, and then + * calling H5Fflush() with the read-only handle, still causes data + * to be flushed. + */ + if(H5F_ACC_RDWR & H5F_INTENT(f)) { + /* Flush other files, depending on scope */ + if(H5F_SCOPE_GLOBAL == scope) { + /* Call the flush routine for mounted file hierarchies */ + if(H5F_flush_mounts(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") + } /* end if */ + else { + /* Call the flush routine, for this file */ + if(H5F__flush(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") + } /* end else */ + } /* end if */ + break; + } + + /* H5Freopen */ + case H5VL_FILE_REOPEN: + { + void **ret = va_arg(arguments, void **); + H5F_t *new_file = NULL; + + /* Reopen the file through the VOL connector */ + if(NULL == (new_file = H5F__reopen((H5F_t *)obj))) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") + new_file->id_exists = TRUE; + + *ret = (void *)new_file; + break; + } + + /* H5Fmount */ + case H5VL_FILE_MOUNT: + { + H5I_type_t type = va_arg(arguments, H5I_type_t); + const char *name = va_arg(arguments, const char *); + H5F_t *child = va_arg(arguments, H5F_t *); + hid_t plist_id = va_arg(arguments, hid_t); + H5G_loc_t loc; + + if(H5G_loc_real(obj, type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Do the mount */ + if(H5F__mount(&loc, name, child, plist_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") + + break; + } + + /* H5Funmount */ + case H5VL_FILE_UNMOUNT: + { + H5I_type_t type = va_arg(arguments, H5I_type_t); + const char *name = va_arg(arguments, const char *); + H5G_loc_t loc; + + if(H5G_loc_real(obj, type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Unmount */ + if(H5F__unmount(&loc, name) < 0) + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") + + break; + } + + /* H5Fis_accessible */ + case H5VL_FILE_IS_ACCESSIBLE: + { + hid_t fapl_id = va_arg(arguments, hid_t); + const char *name = va_arg(arguments, const char *); + htri_t *ret = va_arg(arguments, htri_t *); + + /* Call private routine */ + if((*ret = H5F__is_hdf5(name, fapl_id)) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "error in HDF5 file check") + break; + } + + /* H5Fcreate / H5Fopen */ + case H5VL_FILE_CACHE_VOL_CONN: + { + hid_t vol_id = va_arg(arguments, hid_t); + void *vol_info = va_arg(arguments, void *); + + /* Call private routine */ + if(H5F__set_vol_conn((H5F_t *)obj, vol_id, vol_info) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cache VOL connector ID & info failed") + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_file_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_file_optional + * + * Purpose: Perform a connector-specific operation on a native file + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5F_t *f = NULL; /* File */ + H5VL_file_optional_t optional_type = va_arg(arguments, H5VL_file_optional_t); + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + f = (H5F_t *)obj; + switch(optional_type) { + /* H5Fget_filesize */ + case H5VL_FILE_GET_SIZE: + { + haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */ + haddr_t base_addr; /* Base address for the file */ + hsize_t *size = va_arg(arguments, hsize_t *); + + /* Go get the actual file size */ + if(H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") + + base_addr = H5FD_get_base_addr(f->shared->lf); + + if(size) + *size = (hsize_t)(max_eof_eoa + base_addr); /* Convert relative base address for file to absolute address */ + + break; + } + + /* H5Fget_file_image */ + case H5VL_FILE_GET_FILE_IMAGE: + { + void *buf_ptr = va_arg(arguments, void *); + ssize_t *ret = va_arg(arguments, ssize_t *); + size_t buf_len = va_arg(arguments, size_t ); + + /* Do the actual work */ + if((*ret = H5F__get_file_image(f, buf_ptr, buf_len)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get file image failed") + break; + } + + /* H5Fget_freespace */ + case H5VL_FILE_GET_FREE_SPACE: + { + hsize_t tot_space; /* Amount of free space in the file */ + hssize_t *ret = va_arg(arguments, hssize_t *); + + /* Go get the actual amount of free space in the file */ + if(H5MF_get_freespace(f, &tot_space, NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + *ret = (hssize_t)tot_space; + break; + } + + case H5VL_FILE_GET_FREE_SECTIONS: + { + H5F_sect_info_t *sect_info = va_arg(arguments, H5F_sect_info_t *); + ssize_t *ret = va_arg(arguments, ssize_t *); + H5F_mem_t type = va_arg(arguments, H5F_mem_t); + size_t nsects = va_arg(arguments, size_t); + + /* Go get the free-space section information in the file */ + if((*ret = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + break; + } + + /* H5Fget_info2 */ + case H5VL_FILE_GET_INFO: + { + H5I_type_t type = va_arg(arguments, H5I_type_t); + H5F_info2_t *finfo = va_arg(arguments, H5F_info2_t *); + + /* Get the file struct. This call is careful to not return the file pointer + * for the top file in a mount hierarchy. + */ + if(NULL == (f = H5F__get_file(obj, type))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct") + + /* Get the file info */ + if(H5F__get_info(f, finfo) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") + + break; + } + + /* H5Fget_mdc_config */ + case H5VL_FILE_GET_MDC_CONF: + { + H5AC_cache_config_t *config_ptr = va_arg(arguments, H5AC_cache_config_t *); + + /* Go get the resize configuration */ + if(H5AC_get_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.") + break; + } + + /* H5Fget_mdc_hit_rate */ + case H5VL_FILE_GET_MDC_HR: + { + double *hit_rate_ptr = va_arg(arguments, double *); + + /* Go get the current hit rate */ + if(H5AC_get_cache_hit_rate(f->shared->cache, hit_rate_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.") + break; + } + + /* H5Fget_mdc_size */ + case H5VL_FILE_GET_MDC_SIZE: + { + size_t *max_size_ptr = va_arg(arguments, size_t *); + size_t *min_clean_size_ptr = va_arg(arguments, size_t *); + size_t *cur_size_ptr = va_arg(arguments, size_t *); + int *cur_num_entries_ptr = va_arg(arguments, int *); + uint32_t cur_num_entries; + + /* Go get the size data */ + if(H5AC_get_cache_size(f->shared->cache, max_size_ptr, min_clean_size_ptr, + cur_size_ptr, &cur_num_entries) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.") + + if(cur_num_entries_ptr != NULL) + *cur_num_entries_ptr = (int)cur_num_entries; + break; + } + + /* H5Fget_vfd_handle */ + case H5VL_FILE_GET_VFD_HANDLE: + { + void **file_handle = va_arg(arguments, void **); + hid_t fapl_id = va_arg(arguments, hid_t); + + /* Retrieve the VFD handle for the file */ + if(H5F_get_vfd_handle(f, fapl_id, file_handle) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle") + break; + } + + /* H5Iget_file_id */ + case H5VL_FILE_GET_FILE_ID: + { + H5I_type_t type = va_arg(arguments, H5I_type_t); + hid_t *file_id = va_arg(arguments, hid_t *); + + if(NULL == (f = H5F__get_file(obj, type))) + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file or file object") + if((*file_id = H5F__get_file_id(f)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file ID") + break; + } + + /* H5Fclear_elink_file_cache */ + case H5VL_FILE_CLEAR_ELINK_CACHE: + { + /* Release the EFC */ + if(f->shared->efc) + if(H5F__efc_release(f->shared->efc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") + break; + } + + /* H5Freset_mdc_hit_rate_stats */ + case H5VL_FILE_RESET_MDC_HIT_RATE: + { + /* Reset the hit rate statistic */ + if(H5AC_reset_cache_hit_rate_stats(f->shared->cache) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate") + break; + } + + case H5VL_FILE_SET_MDC_CONFIG: + { + H5AC_cache_config_t *config_ptr = va_arg(arguments, H5AC_cache_config_t *); + + /* set the resize configuration */ + if(H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed") + break; + } + + case H5VL_FILE_GET_METADATA_READ_RETRY_INFO: + { + H5F_retry_info_t *info = va_arg(arguments, H5F_retry_info_t *); + + if(H5F_get_metadata_read_retry_info(f, info) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't get metadata read retry info") + + break; + } + + case H5VL_FILE_START_SWMR_WRITE: + { + if(H5F__start_swmr_write(f) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't start SWMR write") + + break; + } + + case H5VL_FILE_START_MDC_LOGGING: + { + /* Call mdc logging function */ + if(H5C_start_logging(f->shared->cache) < 0) + HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging") + + break; + } + + case H5VL_FILE_STOP_MDC_LOGGING: + { + /* Call mdc logging function */ + if(H5C_stop_logging(f->shared->cache) < 0) + HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") + + break; + } + + case H5VL_FILE_GET_MDC_LOGGING_STATUS: + { + hbool_t *is_enabled = va_arg(arguments, hbool_t *); + hbool_t *is_currently_logging = va_arg(arguments, hbool_t *); + + /* Call mdc logging function */ + if(H5C_get_logging_status(f->shared->cache, is_enabled, is_currently_logging) < 0) + HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status") + + break; + } + + case H5VL_FILE_FORMAT_CONVERT: + { + /* Convert the format */ + if(H5F__format_convert(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") + + break; + } + + case H5VL_FILE_RESET_PAGE_BUFFERING_STATS: + { + /* Sanity check */ + if(NULL == f->shared->page_buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file") + + /* Reset the statistics */ + if (H5PB_reset_stats(f->shared->page_buf) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't reset stats for page buffering") + + break; + } + + case H5VL_FILE_GET_PAGE_BUFFERING_STATS: + { + unsigned *accesses = va_arg(arguments, unsigned *); + unsigned *hits = va_arg(arguments, unsigned *); + unsigned *misses = va_arg(arguments, unsigned *); + unsigned *evictions = va_arg(arguments, unsigned *); + unsigned *bypasses = va_arg(arguments, unsigned *); + + /* Sanity check */ + if(NULL == f->shared->page_buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file") + + /* Get the statistics */ + if(H5PB_get_stats(f->shared->page_buf, accesses, hits, misses, evictions, bypasses) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering") + + break; + } + + case H5VL_FILE_GET_MDC_IMAGE_INFO: + { + haddr_t *image_addr = va_arg(arguments, haddr_t *); + hsize_t *image_len = va_arg(arguments, hsize_t *); + + /* Go get the address and size of the cache image */ + if(H5AC_get_mdc_image_info(f->shared->cache, image_addr, image_len) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info") + + break; + } + + case H5VL_FILE_GET_EOA: + { + haddr_t *eoa = va_arg(arguments, haddr_t *); + haddr_t rel_eoa; /* Relative address of EOA */ + + /* Sanity check */ + HDassert(eoa); + + /* This routine will work only for drivers with this feature enabled.*/ + /* We might introduce a new feature flag in the future */ + if(!H5F_HAS_FEATURE(f, H5FD_FEAT_SUPPORTS_SWMR_IO)) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") + + /* The real work */ + if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed") + + /* Set return value */ + /* (Note compensating for base address subtraction in internal routine) */ + *eoa = rel_eoa + H5F_get_base_addr(f); + + break; + } + + case H5VL_FILE_INCR_FILESIZE: + { + hsize_t increment = va_arg(arguments, hsize_t); + haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */ + + /* This public routine will work only for drivers with this feature enabled.*/ + /* We might introduce a new feature flag in the future */ + if(!H5F_HAS_FEATURE(f, H5FD_FEAT_SUPPORTS_SWMR_IO)) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") + + /* Get the maximum of EOA and EOF */ + if(H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") + + /* Set EOA to the maximum value + increment */ + if(H5F__set_eoa(f, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") + + break; + } + + case H5VL_FILE_SET_LIBVER_BOUNDS: + { + H5F_libver_t low = va_arg(arguments, H5F_libver_t); + H5F_libver_t high = va_arg(arguments, H5F_libver_t); + + /* Call internal set_libver_bounds function */ + if(H5F__set_libver_bounds(f, low, high) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") + + break; + } + + case H5VL_FILE_SET_MIN_DSET_OHDR_FLAG: + { + int minimize = va_arg(arguments, int); /* int to satisfy va_arg */ + if (0 > H5F_set_min_dset_ohdr(f, (hbool_t)minimize)) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, + "cannot set file's dataset object header minimization flag") + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_file_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_file_close + * + * Purpose: Closes a file. + * + * Return: SUCCEED/FAIL (the file will not be closed on failure) + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) +{ + int nref; + H5F_t *f = (H5F_t *)file; + hid_t file_id = H5I_INVALID_HID; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* This routine should only be called when a file ID's ref count drops to zero */ + HDassert(H5F_ID_EXISTS(f)); + + /* Flush file if this is the last reference to this id and we have write + * intent, unless it will be flushed by the "shared" file being closed. + * This is only necessary to replicate previous behaviour, and could be + * disabled by an option/property to improve performance. + */ + if((H5F_NREFS(f) > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) { + /* Get the file ID corresponding to the H5F_t struct */ + if(H5I_find_id(f, H5I_FILE, &file_id) < 0 || H5I_INVALID_HID == file_id) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "invalid atom") + + /* Get the number of references outstanding for this file ID */ + if((nref = H5I_get_ref(file_id, FALSE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count") + if(nref == 1) + if(H5F__flush(f) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") + } /* end if */ + + /* Close the file */ + if(H5F__close(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_file_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_group_create + * + * Purpose: Creates a group inside a native h5 file. + * + * Return: Success: Pointer to a group struct + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, + hid_t gcpl_id, hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5G_loc_t loc; /* Location to create group */ + H5G_t *grp = NULL; /* New group created */ + hid_t lcpl_id; + void *ret_value; + + FUNC_ENTER_STATIC + + /* Get the property list structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID") + + /* Get creation properties */ + if(H5P_get(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id") + + /* Set up the location */ + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + + /* if name is NULL then this is from H5Gcreate_anon */ + if(name == NULL) { + H5G_obj_create_t gcrt_info; /* Information for group creation */ + + /* Set up group creation info */ + gcrt_info.gcpl_id = gcpl_id; + gcrt_info.cache_type = H5G_NOTHING_CACHED; + HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); + + /* Create the new group & get its ID */ + if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") + } /* end if */ + /* otherwise it's from H5Gcreate */ + else { + /* Create the new group & get its ID */ + if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") + } /* end else */ + + ret_value = (void *)grp; + +done: + if(name == NULL) { + /* Release the group's object header, if it was created */ + if(grp) { + H5O_loc_t *oloc; /* Object location for group */ + + /* Get the new group's object location */ + if(NULL == (oloc = H5G_oloc(grp))) + HDONE_ERROR(H5E_SYM, H5E_CANTGET, NULL, "unable to get object location of group") + + /* Decrement refcount on group's object header in memory */ + if(H5O_dec_rc_by_loc(oloc) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") + } /* end if */ + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_group_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_group_open + * + * Purpose: Opens a group inside a native h5 file. + * + * Return: Success: Pointer to a group struct + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, + hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5G_loc_t loc; /* Location to open group */ + H5G_t *grp = NULL; /* New group opend */ + void *ret_value; + + FUNC_ENTER_STATIC + + /* Set up the location */ + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + + /* Open the group */ + if((grp = H5G__open_name(&loc, name)) == NULL) + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group") + + ret_value = (void *)grp; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_group_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_group_get + * + * Purpose: Get info about a group + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + switch(get_type) { + /* H5Gget_create_plist */ + case H5VL_GROUP_GET_GCPL: + { + hid_t *new_gcpl_id = va_arg(arguments, hid_t *); + H5G_t *grp = (H5G_t *)obj; + + if((*new_gcpl_id = H5G_get_create_plist(grp)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for group") + break; + } + + /* H5Gget_info */ + case H5VL_GROUP_GET_INFO: + { + const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *); + H5G_info_t *group_info = va_arg(arguments, H5G_info_t *); + H5G_loc_t loc; + + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + if(loc_params->type == H5VL_OBJECT_BY_SELF) { + /* H5Gget_info */ + + /* Retrieve the group's information */ + if(H5G__obj_info(loc.oloc, group_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { + /* H5Gget_info_by_name */ + + /* Retrieve the group's information */ + if(H5G__get_info_by_name(&loc, loc_params->loc_data.loc_by_name.name, group_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + } /* end else-if */ + else if(loc_params->type == H5VL_OBJECT_BY_IDX) { + /* H5Gget_info_by_idx */ + + /* Retrieve the group's information */ + if(H5G__get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, group_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + } /* end else-if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_group_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_group_specific + * + * Purpose: Specific operations for groups + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5G_t *grp = (H5G_t *)obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + switch(specific_type) { + case H5VL_GROUP_FLUSH: + { + hid_t group_id = va_arg(arguments, hid_t); + + /* Flush object's metadata to file */ + if(H5O_flush_common(&grp->oloc, group_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") + + break; + } + + case H5VL_GROUP_REFRESH: + { + hid_t group_id = va_arg(arguments, hid_t); + + /* Call private function to refresh group object */ + if((H5O_refresh_metadata(group_id, grp->oloc)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") + + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_group_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_group_optional + * + * Purpose: Perform a connector-specific operation on a native group + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_group_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5VL_group_optional_t optional_type; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + optional_type = va_arg(arguments, H5VL_group_optional_t); + switch(optional_type) { +#ifndef H5_NO_DEPRECATED_SYMBOLS + /* H5Giterate (deprecated) */ + case H5VL_GROUP_ITERATE_OLD: + { + const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *); + hsize_t idx = va_arg(arguments, hsize_t); + hsize_t *last_obj = va_arg(arguments, hsize_t *); + const H5G_link_iterate_t *lnk_op = va_arg(arguments, const H5G_link_iterate_t *); + void *op_data = va_arg(arguments, void *); + H5G_loc_t grp_loc; + + /* Get the location struct for the object */ + if(H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Call the actual iteration routine */ + if((ret_value = H5G_iterate(&grp_loc, loc_params->loc_data.loc_by_name.name, H5_INDEX_NAME, H5_ITER_INC, idx, last_obj, lnk_op, op_data)) < 0) + HERROR(H5E_VOL, H5E_BADITER, "error iterating over group's links"); + + break; + } + + /* H5Gget_objinfo (deprecated) */ + case H5VL_GROUP_GET_OBJINFO: + { + const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *); + hbool_t follow_link = va_arg(arguments, unsigned); + H5G_stat_t *statbuf = va_arg(arguments, H5G_stat_t *); + H5G_loc_t grp_loc; + + /* Get the location struct for the object */ + if(H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Call the actual group objinfo routine */ + if(H5G__get_objinfo(&grp_loc, loc_params->loc_data.loc_by_name.name, follow_link, statbuf) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") + + break; + } +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_group_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_group_close + * + * Purpose: Closes a group. + * + * Return: SUCCEED/FAIL (the group will not be closed on failure) + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_group_close(void *grp, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + if(H5G_close((H5G_t *)grp) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close group") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_group_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_link_create + * + * Purpose: Creates an hard/soft/UD/external links. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, + const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + switch(create_type) { + case H5VL_LINK_CREATE_HARD: + { + H5G_loc_t cur_loc; + H5G_loc_t link_loc; + void *cur_obj; + H5VL_loc_params_t cur_params; + + if(H5P_get(plist, H5VL_PROP_LINK_TARGET, &cur_obj) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for current location id") + if(H5P_get(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &cur_params) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for current name") + + if(NULL != cur_obj && H5G_loc_real(cur_obj, cur_params.obj_type, &cur_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + if(NULL != obj && H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* H5Lcreate_hard */ + if(H5VL_OBJECT_BY_NAME == cur_params.type) { + H5G_loc_t *cur_loc_p, *link_loc_p; + + /* Set up current & new location pointers */ + cur_loc_p = &cur_loc; + link_loc_p = &link_loc; + if(NULL == cur_obj) + cur_loc_p = link_loc_p; + else if(NULL == obj) + link_loc_p = cur_loc_p; + else if(cur_loc_p->oloc->file != link_loc_p->oloc->file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") + + /* Create the link */ + if((ret_value = H5L_create_hard(cur_loc_p, cur_params.loc_data.loc_by_name.name, + link_loc_p, loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + } /* end if */ + else { /* H5Olink */ + /* Link to the object */ + if(H5L_link(&link_loc, loc_params->loc_data.loc_by_name.name, &cur_loc, lcpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") + } /* end else */ + break; + } + + case H5VL_LINK_CREATE_SOFT: + { + char *target_name; + H5G_loc_t link_loc; /* Group location for new link */ + + if(H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + if(H5P_get(plist, H5VL_PROP_LINK_TARGET_NAME, &target_name) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for targe name") + + /* Create the link */ + if((ret_value = H5L_create_soft(target_name, &link_loc, loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + break; + } + + case H5VL_LINK_CREATE_UD: + { + H5G_loc_t link_loc; /* Group location for new link */ + H5L_type_t link_type; + void *udata; + size_t udata_size; + + if(H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + if(H5P_get(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for link type") + if(H5P_get(plist, H5VL_PROP_LINK_UDATA, &udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for udata") + if(H5P_get(plist, H5VL_PROP_LINK_UDATA_SIZE, &udata_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for udata size") + + /* Create link */ + if(H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, udata, udata_size, + link_type, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + break; + } + + default: + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "invalid link creation call") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_link_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_link_copy + * + * Purpose: Renames an object within an HDF5 file and copies it to a new + * group. The original name SRC is unlinked from the group graph + * and then inserted with the new name DST (which can specify a + * new path for the object) as an atomic operation. The names + * are interpreted relative to SRC_LOC_ID and + * DST_LOC_ID, which are either file IDs or group ID. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, + hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) +{ + H5G_loc_t src_loc, *src_loc_p; + H5G_loc_t dst_loc, *dst_loc_p; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + if(NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Set up src & dst location pointers */ + src_loc_p = &src_loc; + dst_loc_p = &dst_loc; + if(NULL == src_obj) + src_loc_p = dst_loc_p; + else if(NULL == dst_obj) + dst_loc_p = src_loc_p; + + /* Copy the link */ + if(H5L_move(src_loc_p, loc_params1->loc_data.loc_by_name.name, + dst_loc_p, loc_params2->loc_data.loc_by_name.name, + TRUE, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_link_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_link_move + * + * Purpose: Renames an object within an HDF5 file and moves it to a new + * group. The original name SRC is unlinked from the group graph + * and then inserted with the new name DST (which can specify a + * new path for the object) as an atomic operation. The names + * are interpreted relative to SRC_LOC_ID and + * DST_LOC_ID, which are either file IDs or group ID. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, + hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) +{ + H5G_loc_t src_loc, *src_loc_p; + H5G_loc_t dst_loc, *dst_loc_p; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + if(NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Set up src & dst location pointers */ + src_loc_p = &src_loc; + dst_loc_p = &dst_loc; + if(NULL == src_obj) + src_loc_p = dst_loc_p; + else if(NULL == dst_obj) + dst_loc_p = src_loc_p; + + /* Move the link */ + if(H5L_move(src_loc_p, loc_params1->loc_data.loc_by_name.name, + dst_loc_p, loc_params2->loc_data.loc_by_name.name, + FALSE, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_link_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_link_get + * + * Purpose: Get info about a link + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5G_loc_t loc; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + switch(get_type) { + /* H5Lget_info/H5Lget_info_by_idx */ + case H5VL_LINK_GET_INFO: + { + H5L_info_t *linfo = va_arg(arguments, H5L_info_t *); + + /* Get the link information */ + if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_info */ + if(H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, linfo) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_info_by_idx */ + if(H5L_get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, linfo) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") + } /* end else-if */ + else + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") + break; + } + + /* H5Lget_name_by_idx */ + case H5VL_LINK_GET_NAME: + { + char *name = va_arg(arguments, char *); + size_t size = va_arg(arguments, size_t); + ssize_t *ret = va_arg(arguments, ssize_t *); + + /* Get the link name */ + if((*ret = H5L_get_name_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, name, size)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") + + break; + } + + /* H5Lget_val/H5Lget_val_by_idx */ + case H5VL_LINK_GET_VAL: + { + void *buf = va_arg(arguments, void *); + size_t size = va_arg(arguments, size_t); + + /* Get the link information */ + if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_val */ + if(H5L_get_val(&loc, loc_params->loc_data.loc_by_name.name, buf, size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link value") + } + else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_val_by_idx */ + + if(H5L_get_val_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, buf, size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val") + } + else + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val") + + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from link") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_link_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_link_specific + * + * Purpose: Specific operation on a link + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + switch(specific_type) { + case H5VL_LINK_EXISTS: + { + htri_t *ret = va_arg(arguments, htri_t *); + H5G_loc_t loc; + + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Check for the existence of the link */ + if((*ret = H5L_exists(&loc, loc_params->loc_data.loc_by_name.name)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info") + break; + } + + case H5VL_LINK_ITER: + { + H5G_loc_t loc; + hbool_t recursive = va_arg(arguments, int); + H5_index_t idx_type = va_arg(arguments, H5_index_t); + H5_iter_order_t order = va_arg(arguments, H5_iter_order_t); + hsize_t *idx_p = va_arg(arguments, hsize_t *); + H5L_iterate_t op = va_arg(arguments, H5L_iterate_t); + void *op_data = va_arg(arguments, void *); + + /* Get the location */ + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + + /* Visit or iterate over the links */ + if(loc_params->type == H5VL_OBJECT_BY_SELF) { + if(recursive) { + /* H5Lvisit */ + if((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + } /* end if */ + else { + /* H5Literate */ + if((ret_value = H5L_iterate(&loc, ".", idx_type, order, idx_p, op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links") + } /* end else */ + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { + if(recursive) { + /* H5Lvisit_by_name */ + if((ret_value = H5G_visit(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + } /* end if */ + else { + /* H5Literate_by_name */ + if((ret_value = H5L_iterate(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, idx_p, op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links") + } /* end else */ + } /* end else-if */ + else + HGOTO_ERROR(H5E_LINK, H5E_UNSUPPORTED, FAIL, "unknown link iterate params") + + break; + } + + case H5VL_LINK_DELETE: + { + H5G_loc_t loc; + + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Unlink */ + if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Ldelete */ + if(H5L_delete(&loc, loc_params->loc_data.loc_by_name.name) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Ldelete_by_idx */ + if(H5L_delete_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + } /* end else-if */ + else + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_link_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_object_open + * + * Purpose: Opens an object inside a native h5 file. + * + * Return: Success: object id. + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5G_loc_t loc; + void *ret_value = NULL; + + FUNC_ENTER_STATIC + + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + + switch(loc_params->type) { + case H5VL_OBJECT_BY_NAME: + { + /* Open the object */ + if(NULL == (ret_value = H5O_open_name(&loc, loc_params->loc_data.loc_by_name.name, opened_type))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by name") + break; + } + + case H5VL_OBJECT_BY_IDX: + { + /* Open the object */ + if(NULL == (ret_value = H5O_open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, opened_type))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by index") + break; + } + + case H5VL_OBJECT_BY_ADDR: + { + /* Open the object */ + if(NULL == (ret_value = H5O_open_by_addr(&loc, loc_params->loc_data.loc_by_addr.addr, opened_type))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by address") + break; + } + + case H5VL_OBJECT_BY_REF: + { + hid_t temp_id = H5I_INVALID_HID; + H5F_t *file = NULL; + + /* Get the file pointer from the entry */ + file = loc.oloc->file; + + /* Create reference */ + if((temp_id = H5R__dereference(file, loc_params->loc_data.loc_by_ref.lapl_id, + loc_params->loc_data.loc_by_ref.ref_type, + loc_params->loc_data.loc_by_ref._ref)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, NULL, "unable to dereference object") + + *opened_type = H5I_get_type(temp_id); + if(NULL == (ret_value = H5I_remove(temp_id))) + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object") + break; + } + + case H5VL_OBJECT_BY_SELF: + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown open parameters") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_object_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_object_copy + * + * Purpose: Copies an object inside a native h5 file. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_object_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name, + void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5G_loc_t src_loc; /* Source object group location */ + H5G_loc_t dst_loc; /* Destination group location */ + herr_t ret_value = FAIL; + + FUNC_ENTER_STATIC + + /* get location for objects */ + if(H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + if(H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Copy the object */ + if((ret_value = H5O_copy(&src_loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_object_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_object_get + * + * Purpose: Gets certain data about an object + * + * Return: SUCCEED/FAIL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_t loc; /* Location of group */ + + FUNC_ENTER_STATIC + + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + switch(get_type) { + /* H5Rget_region */ + case H5VL_REF_GET_REGION: + { + hid_t *ret = va_arg(arguments, hid_t *); + H5R_type_t H5_ATTR_UNUSED ref_type = va_arg(arguments, H5R_type_t); + void *ref = va_arg(arguments, void *); + H5S_t *space = NULL; /* Dataspace object */ + + /* Get the dataspace with the correct region selected */ + if((space = H5R__get_region(loc.oloc->file, ref)) == NULL) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve region") + + /* Atomize */ + if((*ret = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") + + break; + } + + /* H5Rget_obj_type2 */ + case H5VL_REF_GET_TYPE: + { + H5O_type_t *obj_type = va_arg(arguments, H5O_type_t *); + H5R_type_t ref_type = va_arg(arguments, H5R_type_t); + void *ref = va_arg(arguments, void *); + + /* Get the object information */ + if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, obj_type) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") + break; + } + + /* H5Rget_name */ + case H5VL_REF_GET_NAME: + { + ssize_t *ret = va_arg(arguments, ssize_t *); + char *name = va_arg(arguments, char *); + size_t size = va_arg(arguments, size_t); + H5R_type_t ref_type = va_arg(arguments, H5R_type_t); + void *ref = va_arg(arguments, void *); + + /* Get name */ + if((*ret = H5R__get_name(loc.oloc->file, ref_type, ref, name, size)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object path") + break; + } + + /* H5Iget_name */ + case H5VL_ID_GET_NAME: + { + ssize_t *ret = va_arg(arguments, ssize_t *); + char *name = va_arg(arguments, char *); + size_t size = va_arg(arguments, size_t); + + /* Retrieve object's name */ + if((*ret = H5G_get_name(&loc, name, size, NULL)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") + + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_object_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_object_specific + * + * Purpose: Specific operation on an object + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5G_loc_t loc; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + switch(specific_type) { + /* H5Oincr_refcount / H5Odecr_refcount */ + case H5VL_OBJECT_CHANGE_REF_COUNT: + { + int update_ref = va_arg(arguments, int); + H5O_loc_t *oloc = loc.oloc; + + if(H5O_link(oloc, update_ref) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") + + break; + } + + /* H5Oexists_by_name */ + case H5VL_OBJECT_EXISTS: + { + htri_t *ret = va_arg(arguments, htri_t *); + + if(loc_params->type == H5VL_OBJECT_BY_NAME) { + /* Check if the object exists */ + if((*ret = H5G_loc_exists(&loc, loc_params->loc_data.loc_by_name.name)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", loc_params->loc_data.loc_by_name.name) + } /* end if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters") + break; + } + + case H5VL_OBJECT_VISIT: + { + H5_index_t idx_type = va_arg(arguments, H5_index_t); + H5_iter_order_t order = va_arg(arguments, H5_iter_order_t); + H5O_iterate_t op = va_arg(arguments, H5O_iterate_t); + void *op_data = va_arg(arguments, void *); + unsigned fields = va_arg(arguments, unsigned); + + /* Call internal object visitation routine */ + if(loc_params->type == H5VL_OBJECT_BY_SELF) { + /* H5Ovisit */ + if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, fields)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { + /* H5Ovisit_by_name */ + if((ret_value = H5O__visit(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, op, op_data, fields)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + } /* end else-if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object visit params"); + break; + } + + case H5VL_OBJECT_FLUSH: + { + hid_t oid = va_arg(arguments, hid_t); + + /* Flush the object's metadata */ + if(H5O_flush(loc.oloc, oid) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") + + break; + } + + case H5VL_OBJECT_REFRESH: + { + hid_t oid = va_arg(arguments, hid_t); + H5O_loc_t *oloc = loc.oloc; + + /* Refresh the metadata */ + if(H5O_refresh_metadata(oid, *oloc) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") + + break; + } + + case H5VL_REF_CREATE: + { + void *ref = va_arg(arguments, void *); + const char *name = va_arg(arguments, char *); + H5R_type_t ref_type = va_arg(arguments, H5R_type_t); + hid_t space_id = va_arg(arguments, hid_t); + H5S_t *space = NULL; /* Pointer to dataspace containing region */ + + if(space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + + /* Create reference */ + if(H5R__create(ref, &loc, name, ref_type, space) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference") + + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_object_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_object_optional + * + * Purpose: Perform a connector-specific operation for an objectibute + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5VL_object_optional_t optional_type = va_arg(arguments, H5VL_object_optional_t); + H5VL_loc_params_t *loc_params = va_arg(arguments, H5VL_loc_params_t *); + H5G_loc_t loc; /* Location of group */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + switch(optional_type) { + /* H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx */ + case H5VL_OBJECT_GET_INFO: + { + H5O_info_t *obj_info = va_arg(arguments, H5O_info_t *); + unsigned fields = va_arg(arguments, unsigned); + + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */ + /* Retrieve the object's information */ + if(H5G_loc_info(&loc, ".", obj_info, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } /* 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_OBJECT_GET_COMMENT: + { + char *comment = va_arg(arguments, char *); + size_t bufsize = va_arg(arguments, size_t); + ssize_t *ret = va_arg(arguments, ssize_t *); + + /* Retrieve the object's comment */ + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_comment */ + if((*ret = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_comment_by_name */ + if((*ret = H5G_loc_get_comment(&loc, loc_params->loc_data.loc_by_name.name, comment/*out*/, bufsize)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } /* end else-if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters") + break; + } + + /* H5Oset_comment */ + case H5VL_OBJECT_SET_COMMENT: + { + const char *comment = va_arg(arguments, char *); + + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oset_comment */ + /* (Re)set the object's comment */ + if(H5G_loc_set_comment(&loc, ".", comment) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oset_comment_by_name */ + /* (Re)set the object's comment */ + if(H5G_loc_set_comment(&loc, loc_params->loc_data.loc_by_name.name, comment) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } /* end else-if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters") + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object"); + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_object_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_datatype_commit + * + * Purpose: Commits a datatype inside a native h5 file. + * + * Return: Success: datatype id. + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__native_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, + hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t H5_ATTR_UNUSED tapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5G_loc_t loc; /* Location to commit datatype */ + H5T_t *dt; /* Datatype for ID */ + H5T_t *type = NULL; /* copy of the original type which will be committed */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* check arguments */ + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") + + /* Check arguments. We cannot commit an immutable type because H5Tclose() + * normally fails on such types (try H5Tclose(H5T_NATIVE_INT)) but closing + * a named type should always succeed. + */ + if(H5T_STATE_NAMED == dt->shared->state || H5T_STATE_OPEN == dt->shared->state) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is already committed") + if(H5T_STATE_IMMUTABLE == dt->shared->state) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is immutable") + + /* Check for a "sensible" datatype to store on disk */ + if(H5T_is_sensible(dt) <= 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "datatype is not sensible") + + /* Copy the datatype - the copied one will be the type that is + * committed, and attached to original datatype above the VOL + * layer + */ + if(NULL == (type = H5T_copy(dt, H5T_COPY_TRANSIENT))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy"); + + /* Commit the datatype */ + if(NULL != name) { + /* H5Tcommit */ + if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") + } /* end if */ + else { + /* H5Tcommit_anon */ + if(H5T__commit_anon(loc.oloc->file, type, tcpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") + } /* end else */ + + ret_value = (void *)type; + +done: + if(NULL == ret_value && type) + H5T_close(type); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_datatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_datatype_open + * + * Purpose: Opens a named datatype inside a native h5 file. + * + * Return: Success: datatype pointer + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, + hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5T_t *type = NULL; /* Datatype opened in file */ + H5G_loc_t loc; /* Group location of object to open */ + void *ret_value = NULL; + + FUNC_ENTER_STATIC + + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + + /* Open the datatype */ + if(NULL == (type = H5T__open_name(&loc, name))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype") + + type->vol_obj = NULL; + + ret_value = (void *)type; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_datatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_datatype_get + * + * Purpose: Get information about a datatype + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * June, 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_datatype_get(void *obj, H5VL_datatype_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5T_t *dt = (H5T_t *)obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + switch (get_type) { + case H5VL_DATATYPE_GET_BINARY: + { + ssize_t *nalloc = va_arg(arguments, ssize_t *); + void *buf = va_arg(arguments, void *); + size_t size = va_arg(arguments, size_t); + + if(H5T_encode(dt, (unsigned char *)buf, &size) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't determine serialized length of datatype") + + *nalloc = (ssize_t) size; + break; + } + + /* H5Tget_create_plist */ + case H5VL_DATATYPE_GET_TCPL: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + + if(H5I_INVALID_HID == (*ret_id = H5T__get_create_plist(dt))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info"); + + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from datatype") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_datatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_datatype_specific + * + * Purpose: Specific operations for datatype + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5T_t *dt = (H5T_t *)obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + switch(specific_type) { + case H5VL_DATATYPE_FLUSH: + { + hid_t type_id = va_arg(arguments, hid_t); + + /* To flush metadata and invoke flush callback if there is */ + if (H5O_flush_common(&dt->oloc, type_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") + + break; + } + + case H5VL_DATATYPE_REFRESH: + { + hid_t type_id = va_arg(arguments, hid_t); + + /* Call private function to refresh datatype object */ + if ((H5O_refresh_metadata(type_id, dt->oloc)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") + + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_datatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_datatype_close + * + * Purpose: Closes a datatype. + * + * Return: Success: 0 + * Failure: -1, datatype not closed. + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_datatype_close(void *dt, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + if(H5T_close((H5T_t*)dt) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close datatype") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_datatype_close() */ + diff --git a/src/H5HGpublic.h b/src/H5VLnative.h index fcec593..8ae3a66 100644 --- a/src/H5HGpublic.h +++ b/src/H5VLnative.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,20 +11,31 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> - * Friday, March 27, 1998 + * Purpose: The public header file for the native VOL connector. */ -#ifndef _H5HGpublic_H -#define _H5HGpublic_H -/* Public headers needed by this file */ -#include "H5public.h" +#ifndef _H5VLnative_H +#define _H5VLnative_H + +/* Identifier for the native VOL connector */ +#define H5VL_NATIVE (H5VL_native_register()) + +/* Characteristics of the native VOL connector */ +#define H5VL_NATIVE_NAME "native" +#define H5VL_NATIVE_VALUE H5_VOL_NATIVE /* enum value */ +#define H5VL_NATIVE_VERSION 0 + #ifdef __cplusplus extern "C" { #endif +H5_DLL hid_t H5VL_native_register(void); + + #ifdef __cplusplus } #endif -#endif + +#endif /* _H5VLnative_H */ + diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c new file mode 100644 index 0000000..a93ac9a --- /dev/null +++ b/src/H5VLpassthru.c @@ -0,0 +1,2693 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: This is a "pass through" VOL connector, which forwards each + * VOL callback to an underlying connector. + * + * It is designed as an example VOL connector for developers to + * use when creating new connectors, especially connectors that + * are outside of the HDF5 library. As such, it should _NOT_ + * include _any_ private HDF5 header files. This connector should + * therefore only make public HDF5 API calls and use standard C / + * POSIX calls. + */ + + +/* Header files needed */ +/* (Public HDF5 and standard C / POSIX only) */ +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "hdf5.h" +#include "H5VLpassthru.h" + + +/**********/ +/* Macros */ +/**********/ + +/* Whether to display log messge when callback is invoked */ +/* (Uncomment to enable) */ +/* #define ENABLE_LOGGING */ + + +/************/ +/* Typedefs */ +/************/ + +/* The pass through VOL info object */ +typedef struct H5VL_pass_through_t { + hid_t under_vol_id; /* ID for underlying VOL connector */ + void *under_object; /* Info object for underlying VOL connector */ +} H5VL_pass_through_t; + +/* The pass through VOL wrapper context */ +typedef struct H5VL_pass_through_wrap_ctx_t { + hid_t under_vol_id; /* VOL ID for under VOL */ + void *under_wrap_ctx; /* Object wrapping context for under VOL */ +} H5VL_pass_through_wrap_ctx_t; + + +/********************* */ +/* Function prototypes */ +/********************* */ + +/* Helper routines */ +static herr_t H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id, + H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); +static herr_t H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id, + H5VL_request_specific_t specific_type, ...); +static H5VL_pass_through_t *H5VL_pass_through_new_obj(void *under_obj, + hid_t under_vol_id); +static herr_t H5VL_pass_through_free_obj(H5VL_pass_through_t *obj); + +/* "Management" callbacks */ +static herr_t H5VL_pass_through_init(hid_t vipl_id); +static herr_t H5VL_pass_through_term(void); +static void *H5VL_pass_through_info_copy(const void *info); +static herr_t H5VL_pass_through_info_cmp(int *cmp_value, const void *info1, const void *info2); +static herr_t H5VL_pass_through_info_free(void *info); +static herr_t H5VL_pass_through_info_to_str(const void *info, char **str); +static herr_t H5VL_pass_through_str_to_info(const char *str, void **info); +static void *H5VL_pass_through_get_object(const void *obj); +static herr_t H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx); +static herr_t H5VL_pass_through_free_wrap_ctx(void *obj); +static void *H5VL_pass_through_wrap_object(void *obj, void *wrap_ctx); + +/* Attribute callbacks */ +static void *H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +static void *H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req); + +/* Dataset callbacks */ +static void *H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +static void *H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, void *buf, void **req); +static herr_t H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +static herr_t H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req); + +/* Datatype callbacks */ +static void *H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +static void *H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_datatype_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req); + +/* File callbacks */ +static void *H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +static void *H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req); + +/* Group callbacks */ +static void *H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +static void *H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req); + +/* Link callbacks */ +static herr_t H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_link_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); + +/* Object callbacks */ +static void *H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); + +/* Async request callbacks */ +static herr_t H5VL_pass_through_request_wait(void *req, uint64_t timeout, H5ES_status_t *status); +static herr_t H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx); +static herr_t H5VL_pass_through_request_cancel(void *req); +static herr_t H5VL_pass_through_request_specific(void *req, H5VL_request_specific_t specific_type, va_list arguments); +static herr_t H5VL_pass_through_request_optional(void *req, va_list arguments); +static herr_t H5VL_pass_through_request_free(void *req); + +/*******************/ +/* Local variables */ +/*******************/ + +/* Pass through VOL connector class struct */ +static const H5VL_class_t H5VL_pass_through_g = { + H5VL_PASSTHRU_VERSION, /* version */ + (H5VL_class_value_t)H5VL_PASSTHRU_VALUE, /* value */ + H5VL_PASSTHRU_NAME, /* name */ + 0, /* capability flags */ + H5VL_pass_through_init, /* initialize */ + H5VL_pass_through_term, /* terminate */ + sizeof(H5VL_pass_through_t), /* info size */ + H5VL_pass_through_info_copy, /* info copy */ + H5VL_pass_through_info_cmp, /* info compare */ + H5VL_pass_through_info_free, /* info free */ + H5VL_pass_through_info_to_str, /* info to str */ + H5VL_pass_through_str_to_info, /* str to info */ + H5VL_pass_through_get_object, /* get_object */ + H5VL_pass_through_get_wrap_ctx, /* get_wrap_ctx */ + H5VL_pass_through_wrap_object, /* wrap_object */ + H5VL_pass_through_free_wrap_ctx, /* free_wrap_ctx */ + { /* attribute_cls */ + H5VL_pass_through_attr_create, /* create */ + H5VL_pass_through_attr_open, /* open */ + H5VL_pass_through_attr_read, /* read */ + H5VL_pass_through_attr_write, /* write */ + H5VL_pass_through_attr_get, /* get */ + H5VL_pass_through_attr_specific, /* specific */ + H5VL_pass_through_attr_optional, /* optional */ + H5VL_pass_through_attr_close /* close */ + }, + { /* dataset_cls */ + H5VL_pass_through_dataset_create, /* create */ + H5VL_pass_through_dataset_open, /* open */ + H5VL_pass_through_dataset_read, /* read */ + H5VL_pass_through_dataset_write, /* write */ + H5VL_pass_through_dataset_get, /* get */ + H5VL_pass_through_dataset_specific, /* specific */ + H5VL_pass_through_dataset_optional, /* optional */ + H5VL_pass_through_dataset_close /* close */ + }, + { /* datatype_cls */ + H5VL_pass_through_datatype_commit, /* commit */ + H5VL_pass_through_datatype_open, /* open */ + H5VL_pass_through_datatype_get, /* get_size */ + H5VL_pass_through_datatype_specific, /* specific */ + H5VL_pass_through_datatype_optional, /* optional */ + H5VL_pass_through_datatype_close /* close */ + }, + { /* file_cls */ + H5VL_pass_through_file_create, /* create */ + H5VL_pass_through_file_open, /* open */ + H5VL_pass_through_file_get, /* get */ + H5VL_pass_through_file_specific, /* specific */ + H5VL_pass_through_file_optional, /* optional */ + H5VL_pass_through_file_close /* close */ + }, + { /* group_cls */ + H5VL_pass_through_group_create, /* create */ + H5VL_pass_through_group_open, /* open */ + H5VL_pass_through_group_get, /* get */ + H5VL_pass_through_group_specific, /* specific */ + H5VL_pass_through_group_optional, /* optional */ + H5VL_pass_through_group_close /* close */ + }, + { /* link_cls */ + H5VL_pass_through_link_create, /* create */ + H5VL_pass_through_link_copy, /* copy */ + H5VL_pass_through_link_move, /* move */ + H5VL_pass_through_link_get, /* get */ + H5VL_pass_through_link_specific, /* specific */ + H5VL_pass_through_link_optional, /* optional */ + }, + { /* object_cls */ + H5VL_pass_through_object_open, /* open */ + H5VL_pass_through_object_copy, /* copy */ + H5VL_pass_through_object_get, /* get */ + H5VL_pass_through_object_specific, /* specific */ + H5VL_pass_through_object_optional, /* optional */ + }, + { /* request_cls */ + H5VL_pass_through_request_wait, /* wait */ + H5VL_pass_through_request_notify, /* notify */ + H5VL_pass_through_request_cancel, /* cancel */ + H5VL_pass_through_request_specific, /* specific */ + H5VL_pass_through_request_optional, /* optional */ + H5VL_pass_through_request_free /* free */ + }, + NULL /* optional */ +}; + +/* The connector identification number, initialized at runtime */ +static hid_t H5VL_PASSTHRU_g = H5I_INVALID_HID; + + +/*------------------------------------------------------------------------- + * Function: H5VL__pass_through_new_obj + * + * Purpose: Create a new pass through object for an underlying object + * + * Return: Success: Pointer to the new pass through object + * Failure: NULL + * + * Programmer: Quincey Koziol + * Monday, December 3, 2018 + * + *------------------------------------------------------------------------- + */ +static H5VL_pass_through_t * +H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id) +{ + H5VL_pass_through_t *new_obj; + + new_obj = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + new_obj->under_object = under_obj; + new_obj->under_vol_id = under_vol_id; + H5Iinc_ref(new_obj->under_vol_id); + + return(new_obj); +} /* end H5VL__pass_through_new_obj() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__pass_through_free_obj + * + * Purpose: Release a pass through object + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Quincey Koziol + * Monday, December 3, 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_free_obj(H5VL_pass_through_t *obj) +{ + H5Idec_ref(obj->under_vol_id); + free(obj); + + return(0); +} /* end H5VL__pass_through_free_obj() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_register + * + * Purpose: Register the pass-through VOL connector and retrieve an ID + * for it. + * + * Return: Success: The ID for the pass-through VOL connector + * Failure: -1 + * + * Programmer: Quincey Koziol + * Wednesday, November 28, 2018 + * + *------------------------------------------------------------------------- + */ +hid_t +H5VL_pass_through_register(void) +{ + /* Clear the error stack */ + H5Eclear2(H5E_DEFAULT); + + /* Singleton register the pass-through VOL connector ID */ + if(H5I_VOL != H5Iget_type(H5VL_PASSTHRU_g)) + H5VL_PASSTHRU_g = H5VLregister_connector(&H5VL_pass_through_g, H5P_DEFAULT); + + return(H5VL_PASSTHRU_g); +} /* end H5VL_pass_through_register() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_init + * + * Purpose: Initialize this VOL connector, performing any necessary + * operations for the connector that will apply to all containers + * accessed with the connector. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_init(hid_t vipl_id) +{ +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL INIT\n"); +#endif + + /* Shut compiler up about unused parameter */ + vipl_id = vipl_id; + + return(0); +} /* end H5VL_pass_through_init() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_term + * + * Purpose: Terminate this VOL connector, performing any necessary + * operations for the connector that release connector-wide + * resources (usually created / initialized with the 'init' + * callback). + * + * Return: Success: 0 + * Failure: (Can't fail) + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_term(void) +{ +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL TERM\n"); +#endif + + /* Reset VOL ID */ + H5VL_PASSTHRU_g = H5I_INVALID_HID; + + return(0); +} /* end H5VL_pass_through_term() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_info_copy + * + * Purpose: Duplicate the connector's info object. + * + * Returns: Success: New connector info object + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_info_copy(const void *_info) +{ + const H5VL_pass_through_info_t *info = (const H5VL_pass_through_info_t *)_info; + H5VL_pass_through_info_t *new_info; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL INFO Copy\n"); +#endif + + /* Allocate new VOL info struct for the pass through connector */ + new_info = (H5VL_pass_through_info_t *)calloc(1, sizeof(H5VL_pass_through_info_t)); + + /* Increment reference count on underlying VOL ID, and copy the VOL info */ + new_info->under_vol_id = info->under_vol_id; + H5Iinc_ref(new_info->under_vol_id); + if(info->under_vol_info) + H5VLcopy_connector_info(new_info->under_vol_id, &(new_info->under_vol_info), info->under_vol_info); + + return(new_info); +} /* end H5VL_pass_through_info_copy() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_info_cmp + * + * Purpose: Compare two of the connector's info objects, setting *cmp_value, + * following the same rules as strcmp(). + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_info_cmp(int *cmp_value, const void *_info1, const void *_info2) +{ + const H5VL_pass_through_info_t *info1 = (const H5VL_pass_through_info_t *)_info1; + const H5VL_pass_through_info_t *info2 = (const H5VL_pass_through_info_t *)_info2; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL INFO Compare\n"); +#endif + + /* Sanity checks */ + assert(info1); + assert(info2); + + /* Initialize comparison value */ + *cmp_value = 0; + + /* Compare under VOL connector classes */ + H5VLcmp_connector_cls(cmp_value, info1->under_vol_id, info2->under_vol_id); + if(*cmp_value != 0) + return(0); + + /* Compare under VOL connector info objects */ + H5VLcmp_connector_info(cmp_value, info1->under_vol_id, info1->under_vol_info, info2->under_vol_info); + if(*cmp_value != 0) + return(0); + + return(0); +} /* end H5VL_pass_through_info_cmp() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_info_free + * + * Purpose: Release an info object for the connector. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_info_free(void *_info) +{ + H5VL_pass_through_info_t *info = (H5VL_pass_through_info_t *)_info; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL INFO Free\n"); +#endif + + /* Release underlying VOL ID and info */ + if(info->under_vol_info) + H5VLfree_connector_info(info->under_vol_id, info->under_vol_info); + H5Idec_ref(info->under_vol_id); + + /* Free pass through info object itself */ + free(info); + + return(0); +} /* end H5VL_pass_through_info_free() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_info_to_str + * + * Purpose: Serialize an info object for this connector into a string + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_info_to_str(const void *_info, char **str) +{ + const H5VL_pass_through_info_t *info = (const H5VL_pass_through_info_t *)_info; + H5VL_class_value_t under_value = (H5VL_class_value_t)-1; + char *under_vol_string = NULL; + size_t under_vol_str_len = 0; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL INFO To String\n"); +#endif + + /* Get value and string for underlying VOL connector */ + H5VLget_value(info->under_vol_id, &under_value); + H5VLconnector_info_to_str(info->under_vol_info, info->under_vol_id, &under_vol_string); + + /* Determine length of underlying VOL info string */ + if(under_vol_string) + under_vol_str_len = strlen(under_vol_string); + + /* Allocate space for our info */ + *str = (char *)H5allocate_memory(32 + under_vol_str_len, (hbool_t)0); + assert(*str); + + /* Encode our info */ + snprintf(*str, 32 + under_vol_str_len, "under_vol=%u;under_info={%s}", (unsigned)under_value, (under_vol_string ? under_vol_string : "")); + + return(0); +} /* end H5VL_pass_through_info_to_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_str_to_info + * + * Purpose: Deserialize a string into an info object for this connector. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_str_to_info(const char *str, void **_info) +{ + H5VL_pass_through_info_t *info; + unsigned under_vol_value; + const char *under_vol_info_start, *under_vol_info_end; + hid_t under_vol_id; + void *under_vol_info = NULL; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL INFO String To Info\n"); +#endif + + /* Retrieve the underlying VOL connector value and info */ + sscanf(str, "under_vol=%u;", &under_vol_value); + under_vol_id = H5VLregister_connector_by_value((H5VL_class_value_t)under_vol_value, H5P_DEFAULT); + under_vol_info_start = strchr(str, '{'); + under_vol_info_end = strrchr(str, '}'); + assert(under_vol_info_end > under_vol_info_start); + if(under_vol_info_end != (under_vol_info_start + 1)) { + char *under_vol_info_str; + + under_vol_info_str = (char *)malloc((size_t)(under_vol_info_end - under_vol_info_start)); + memcpy(under_vol_info_str, under_vol_info_start + 1, (size_t)((under_vol_info_end - under_vol_info_start) - 1)); + *(under_vol_info_str + (under_vol_info_end - under_vol_info_start)) = '\0'; + + H5VLconnector_str_to_info(under_vol_info_str, under_vol_id, &under_vol_info); + + free(under_vol_info_str); + } /* end else */ + + /* Allocate new pass-through VOL connector info and set its fields */ + info = (H5VL_pass_through_info_t *)calloc(1, sizeof(H5VL_pass_through_info_t)); + info->under_vol_id = under_vol_id; + info->under_vol_info = under_vol_info; + + /* Set return value */ + *_info = info; + + return(0); +} /* end H5VL_pass_through_str_to_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_get_object + * + * Purpose: Retrieve the 'data' for a VOL object. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_get_object(const void *obj) +{ + const H5VL_pass_through_t *o = (const H5VL_pass_through_t *)obj; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL Get object\n"); +#endif + + return(H5VLget_object(o->under_object, o->under_vol_id)); +} /* end H5VL_pass_through_get_object() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_get_wrap_ctx + * + * Purpose: Retrieve a "wrapper context" for an object + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx) +{ + const H5VL_pass_through_t *o = (const H5VL_pass_through_t *)obj; + H5VL_pass_through_wrap_ctx_t *new_wrap_ctx; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL WRAP CTX Get\n"); +#endif + + /* Allocate new VOL object wrapping context for the pass through connector */ + new_wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)calloc(1, sizeof(H5VL_pass_through_wrap_ctx_t)); + + /* Increment reference count on underlying VOL ID, and copy the VOL info */ + new_wrap_ctx->under_vol_id = o->under_vol_id; + H5Iinc_ref(new_wrap_ctx->under_vol_id); + H5VLget_wrap_ctx(o->under_object, o->under_vol_id, &new_wrap_ctx->under_wrap_ctx); + + /* Set wrap context to return */ + *wrap_ctx = new_wrap_ctx; + + return(0); +} /* end H5VL_pass_through_get_wrap_ctx() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_wrap_object + * + * Purpose: Use a "wrapper context" to wrap a data object + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_wrap_object(void *obj, void *_wrap_ctx) +{ + H5VL_pass_through_wrap_ctx_t *wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)_wrap_ctx; + H5VL_pass_through_t *new_obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL WRAP Object\n"); +#endif + + /* Wrap the object with the underlying VOL */ + under = H5VLwrap_object(obj, wrap_ctx->under_vol_id, wrap_ctx->under_wrap_ctx); + if(under) + new_obj = H5VL_pass_through_new_obj(under, wrap_ctx->under_vol_id); + else + new_obj = NULL; + + return(new_obj); +} /* end H5VL_pass_through_wrap_object() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_free_wrap_ctx + * + * Purpose: Release a "wrapper context" for an object + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_free_wrap_ctx(void *_wrap_ctx) +{ + H5VL_pass_through_wrap_ctx_t *wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)_wrap_ctx; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL WRAP CTX Free\n"); +#endif + + /* Release underlying VOL ID and wrap context */ + if(wrap_ctx->under_wrap_ctx) + H5VLfree_wrap_ctx(wrap_ctx->under_wrap_ctx, wrap_ctx->under_vol_id); + H5Idec_ref(wrap_ctx->under_vol_id); + + /* Free pass through wrap context object itself */ + free(wrap_ctx); + + return(0); +} /* end H5VL_pass_through_free_wrap_ctx() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_create + * + * Purpose: Creates an attribute on an object. + * + * Return: Success: Pointer to attribute object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *attr; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Create\n"); +#endif + + under = H5VLattr_create(o->under_object, loc_params, o->under_vol_id, name, acpl_id, aapl_id, dxpl_id, req); + if(under) { + attr = H5VL_pass_through_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + } /* end if */ + else + attr = NULL; + + return((void*)attr); +} /* end H5VL_pass_through_attr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_open + * + * Purpose: Opens an attribute on an object. + * + * Return: Success: Pointer to attribute object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *attr; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Open\n"); +#endif + + under = H5VLattr_open(o->under_object, loc_params, o->under_vol_id, name, aapl_id, dxpl_id, req); + if(under) { + attr = H5VL_pass_through_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + } /* end if */ + else + attr = NULL; + + return((void *)attr); +} /* end H5VL_pass_through_attr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_read + * + * Purpose: Reads data from attribute. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf, + hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Read\n"); +#endif + + ret_value = H5VLattr_read(o->under_object, o->under_vol_id, mem_type_id, buf, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_attr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_write + * + * Purpose: Writes data to attribute. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, + hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Write\n"); +#endif + + ret_value = H5VLattr_write(o->under_object, o->under_vol_id, mem_type_id, buf, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_attr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_get + * + * Purpose: Gets information about an attribute + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Get\n"); +#endif + + ret_value = H5VLattr_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_attr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_specific + * + * Purpose: Specific operation on attribute + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, + H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Specific\n"); +#endif + + ret_value = H5VLattr_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_attr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_optional + * + * Purpose: Perform a connector-specific operation on an attribute + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Optional\n"); +#endif + + ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_attr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_close + * + * Purpose: Closes an attribute. + * + * Return: Success: 0 + * Failure: -1, attr not closed. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Close\n"); +#endif + + ret_value = H5VLattr_close(o->under_object, o->under_vol_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + /* Release our wrapper, if underlying attribute was closed */ + if(ret_value >= 0) + H5VL_pass_through_free_obj(o); + + return(ret_value); +} /* end H5VL_pass_through_attr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_create + * + * Purpose: Creates a dataset in a container + * + * Return: Success: Pointer to a dataset object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *dset; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATASET Create\n"); +#endif + + under = H5VLdataset_create(o->under_object, loc_params, o->under_vol_id, name, dcpl_id, dapl_id, dxpl_id, req); + if(under) { + dset = H5VL_pass_through_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + } /* end if */ + else + dset = NULL; + + return((void *)dset); +} /* end H5VL_pass_through_dataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_open + * + * Purpose: Opens a dataset in a container + * + * Return: Success: Pointer to a dataset object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *dset; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATASET Open\n"); +#endif + + under = H5VLdataset_open(o->under_object, loc_params, o->under_vol_id, name, dapl_id, dxpl_id, req); + if(under) { + dset = H5VL_pass_through_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + } /* end if */ + else + dset = NULL; + + return((void *)dset); +} /* end H5VL_pass_through_dataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_read + * + * Purpose: Reads data elements from a dataset into a buffer. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, void *buf, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATASET Read\n"); +#endif + + ret_value = H5VLdataset_read(o->under_object, o->under_vol_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_dataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_write + * + * Purpose: Writes data elements from a buffer into a dataset. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, const void *buf, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATASET Write\n"); +#endif + + ret_value = H5VLdataset_write(o->under_object, o->under_vol_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_dataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_get + * + * Purpose: Gets information about a dataset + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATASET Get\n"); +#endif + + ret_value = H5VLdataset_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_dataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_specific + * + * Purpose: Specific operation on a dataset + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL H5Dspecific\n"); +#endif + + ret_value = H5VLdataset_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_dataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_optional + * + * Purpose: Perform a connector-specific operation on a dataset + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATASET Optional\n"); +#endif + + ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_dataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_close + * + * Purpose: Closes a dataset. + * + * Return: Success: 0 + * Failure: -1, dataset not closed. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATASET Close\n"); +#endif + + ret_value = H5VLdataset_close(o->under_object, o->under_vol_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + /* Release our wrapper, if underlying dataset was closed */ + if(ret_value >= 0) + H5VL_pass_through_free_obj(o); + + return(ret_value); +} /* end H5VL_pass_through_dataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_datatype_commit + * + * Purpose: Commits a datatype inside a container. + * + * Return: Success: Pointer to datatype object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, + hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *dt; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATATYPE Commit\n"); +#endif + + under = H5VLdatatype_commit(o->under_object, loc_params, o->under_vol_id, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); + if(under) { + dt = H5VL_pass_through_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + } /* end if */ + else + dt = NULL; + + return((void *)dt); +} /* end H5VL_pass_through_datatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_datatype_open + * + * Purpose: Opens a named datatype inside a container. + * + * Return: Success: Pointer to datatype object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *dt; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATATYPE Open\n"); +#endif + + under = H5VLdatatype_open(o->under_object, loc_params, o->under_vol_id, name, tapl_id, dxpl_id, req); + if(under) { + dt = H5VL_pass_through_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + } /* end if */ + else + dt = NULL; + + return((void *)dt); +} /* end H5VL_pass_through_datatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_datatype_get + * + * Purpose: Get information about a datatype + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)dt; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATATYPE Get\n"); +#endif + + ret_value = H5VLdatatype_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_datatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_datatype_specific + * + * Purpose: Specific operations for datatypes + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATATYPE Specific\n"); +#endif + + ret_value = H5VLdatatype_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_datatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_datatype_optional + * + * Purpose: Perform a connector-specific operation on a datatype + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_datatype_optional(void *obj, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATATYPE Optional\n"); +#endif + + ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_datatype_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_datatype_close + * + * Purpose: Closes a datatype. + * + * Return: Success: 0 + * Failure: -1, datatype not closed. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)dt; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATATYPE Close\n"); +#endif + + assert(o->under_object); + + ret_value = H5VLdatatype_close(o->under_object, o->under_vol_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + /* Release our wrapper, if underlying datatype was closed */ + if(ret_value >= 0) + H5VL_pass_through_free_obj(o); + + return(ret_value); +} /* end H5VL_pass_through_datatype_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_file_create + * + * Purpose: Creates a container using this connector + * + * Return: Success: Pointer to a file object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id, + hid_t fapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_info_t *info; + H5VL_pass_through_t *file; + hid_t under_fapl_id; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL FILE Create\n"); +#endif + + /* Get copy of our VOL info from FAPL */ + H5Pget_vol_info(fapl_id, (void **)&info); + + /* Copy the FAPL */ + under_fapl_id = H5Pcopy(fapl_id); + + /* Set the VOL ID and info for the underlying FAPL */ + H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info); + + /* Open the file with the underlying VOL connector */ + under = H5VLfile_create(name, flags, fcpl_id, under_fapl_id, dxpl_id, req); + if(under) { + file = H5VL_pass_through_new_obj(under, info->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, info->under_vol_id); + } /* end if */ + else + file = NULL; + + /* Close underlying FAPL */ + H5Pclose(under_fapl_id); + + /* Release copy of our VOL info */ + H5VL_pass_through_info_free(info); + + return((void *)file); +} /* end H5VL_pass_through_file_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_file_open + * + * Purpose: Opens a container created with this connector + * + * Return: Success: Pointer to a file object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, + hid_t dxpl_id, void **req) +{ + H5VL_pass_through_info_t *info; + H5VL_pass_through_t *file; + hid_t under_fapl_id; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL FILE Open\n"); +#endif + + /* Get copy of our VOL info from FAPL */ + H5Pget_vol_info(fapl_id, (void **)&info); + + /* Copy the FAPL */ + under_fapl_id = H5Pcopy(fapl_id); + + /* Set the VOL ID and info for the underlying FAPL */ + H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info); + + /* Open the file with the underlying VOL connector */ + under = H5VLfile_open(name, flags, under_fapl_id, dxpl_id, req); + if(under) { + file = H5VL_pass_through_new_obj(under, info->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, info->under_vol_id); + } /* end if */ + else + file = NULL; + + /* Close underlying FAPL */ + H5Pclose(under_fapl_id); + + /* Release copy of our VOL info */ + H5VL_pass_through_info_free(info); + + return((void *)file); +} /* end H5VL_pass_through_file_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_file_get + * + * Purpose: Get info about a file + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)file; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL FILE Get\n"); +#endif + + ret_value = H5VLfile_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_file_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_file_specific_reissue + * + * Purpose: Re-wrap vararg arguments into a va_list and reissue the + * file specific callback to the underlying VOL connector. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id, + H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; + herr_t ret_value; + + va_start(arguments, req); + ret_value = H5VLfile_specific(obj, connector_id, specific_type, dxpl_id, req, arguments); + va_end(arguments); + + return(ret_value); +} /* end H5VL_pass_through_file_specific_reissue() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_file_specific + * + * Purpose: Specific operation on file + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)file; + hid_t under_vol_id = -1; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL FILE Specific\n"); +#endif + + /* Unpack arguments to get at the child file pointer when mounting a file */ + if(specific_type == H5VL_FILE_MOUNT) { + H5I_type_t loc_type; + const char *name; + H5VL_pass_through_t *child_file; + hid_t plist_id; + + /* Retrieve parameters for 'mount' operation, so we can unwrap the child file */ + loc_type = va_arg(arguments, H5I_type_t); + name = va_arg(arguments, const char *); + child_file = (H5VL_pass_through_t *)va_arg(arguments, void *); + plist_id = va_arg(arguments, hid_t); + + /* Keep the correct underlying VOL ID for possible async request token */ + under_vol_id = o->under_vol_id; + + /* Re-issue 'file specific' call, using the unwrapped pieces */ + ret_value = H5VL_pass_through_file_specific_reissue(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, loc_type, name, child_file->under_object, plist_id); + } /* end if */ + else if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { + H5VL_pass_through_info_t *info; + hid_t fapl_id, under_fapl_id; + const char *name; + htri_t *ret; + + /* Get the arguments for the 'is accessible' check */ + fapl_id = va_arg(arguments, hid_t); + name = va_arg(arguments, const char *); + ret = va_arg(arguments, htri_t *); + + /* Get copy of our VOL info from FAPL */ + H5Pget_vol_info(fapl_id, (void **)&info); + + /* Copy the FAPL */ + under_fapl_id = H5Pcopy(fapl_id); + + /* Set the VOL ID and info for the underlying FAPL */ + H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info); + + /* Keep the correct underlying VOL ID for possible async request token */ + under_vol_id = info->under_vol_id; + + /* Re-issue 'file specific' call */ + ret_value = H5VL_pass_through_file_specific_reissue(NULL, info->under_vol_id, specific_type, dxpl_id, req, under_fapl_id, name, ret); + + /* Close underlying FAPL */ + H5Pclose(under_fapl_id); + + /* Release copy of our VOL info */ + H5VL_pass_through_info_free(info); + } /* end else-if */ + else { + va_list my_arguments; + + /* Make a copy of the argument list for later, if reopening */ + if(specific_type == H5VL_FILE_REOPEN) + va_copy(my_arguments, arguments); + + /* Keep the correct underlying VOL ID for possible async request token */ + under_vol_id = o->under_vol_id; + + ret_value = H5VLfile_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Wrap file struct pointer, if we reopened one */ + if(specific_type == H5VL_FILE_REOPEN) { + if(ret_value >= 0) { + void **ret = va_arg(my_arguments, void **); + + if(ret && *ret) + *ret = H5VL_pass_through_new_obj(*ret, o->under_vol_id); + } /* end if */ + + /* Finish use of copied vararg list */ + va_end(my_arguments); + } /* end if */ + } /* end else */ + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_file_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_file_optional + * + * Purpose: Perform a connector-specific operation on a file + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)file; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL File Optional\n"); +#endif + + ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_file_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_file_close + * + * Purpose: Closes a file. + * + * Return: Success: 0 + * Failure: -1, file not closed. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)file; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL FILE Close\n"); +#endif + + ret_value = H5VLfile_close(o->under_object, o->under_vol_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + /* Release our wrapper, if underlying file was closed */ + if(ret_value >= 0) + H5VL_pass_through_free_obj(o); + + return(ret_value); +} /* end H5VL_pass_through_file_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_group_create + * + * Purpose: Creates a group inside a container + * + * Return: Success: Pointer to a group object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *group; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL GROUP Create\n"); +#endif + + under = H5VLgroup_create(o->under_object, loc_params, o->under_vol_id, name, gcpl_id, gapl_id, dxpl_id, req); + if(under) { + group = H5VL_pass_through_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + } /* end if */ + else + group = NULL; + + return((void *)group); +} /* end H5VL_pass_through_group_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_group_open + * + * Purpose: Opens a group inside a container + * + * Return: Success: Pointer to a group object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *group; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL GROUP Open\n"); +#endif + + under = H5VLgroup_open(o->under_object, loc_params, o->under_vol_id, name, gapl_id, dxpl_id, req); + if(under) { + group = H5VL_pass_through_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + } /* end if */ + else + group = NULL; + + return((void *)group); +} /* end H5VL_pass_through_group_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_group_get + * + * Purpose: Get info about a group + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL GROUP Get\n"); +#endif + + ret_value = H5VLgroup_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_group_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_group_specific + * + * Purpose: Specific operation on a group + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL GROUP Specific\n"); +#endif + + ret_value = H5VLgroup_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_group_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_group_optional + * + * Purpose: Perform a connector-specific operation on a group + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL GROUP Optional\n"); +#endif + + ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_group_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_group_close + * + * Purpose: Closes a group. + * + * Return: Success: 0 + * Failure: -1, group not closed. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)grp; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL H5Gclose\n"); +#endif + + ret_value = H5VLgroup_close(o->under_object, o->under_vol_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + /* Release our wrapper, if underlying file was closed */ + if(ret_value >= 0) + H5VL_pass_through_free_obj(o); + + return(ret_value); +} /* end H5VL_pass_through_group_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_link_create + * + * Purpose: Creates a hard / soft / UD / external link. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + hid_t under_vol_id = -1; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL LINK Create\n"); +#endif + + /* Try to retrieve the "under" VOL id */ + if(o) + under_vol_id = o->under_vol_id; + + /* Fix up the link target object for hard link creation */ + if(H5VL_LINK_CREATE_HARD == create_type) { + void *cur_obj; + + /* Retrieve the object for the link target */ + H5Pget(lcpl_id, H5VL_PROP_LINK_TARGET, &cur_obj); + + /* If it's a non-NULL pointer, find the 'under object' and re-set the property */ + if(cur_obj) { + /* Check if we still need the "under" VOL ID */ + if(under_vol_id < 0) + under_vol_id = ((H5VL_pass_through_t *)cur_obj)->under_vol_id; + + /* Set the object for the link target */ + H5Pset(lcpl_id, H5VL_PROP_LINK_TARGET, &(((H5VL_pass_through_t *)cur_obj)->under_object)); + } /* end if */ + } /* end if */ + + ret_value = H5VLlink_create(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_link_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_link_copy + * + * Purpose: Renames an object within an HDF5 container and copies it to a new + * group. The original name SRC is unlinked from the group graph + * and then inserted with the new name DST (which can specify a + * new path for the object) as an atomic operation. The names + * are interpreted relative to SRC_LOC_ID and + * DST_LOC_ID, which are either file IDs or group ID. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o_src = (H5VL_pass_through_t *)src_obj; + H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj; + hid_t under_vol_id = -1; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL LINK Copy\n"); +#endif + + /* Retrieve the "under" VOL id */ + if(o_src) + under_vol_id = o_src->under_vol_id; + else if(o_dst) + under_vol_id = o_dst->under_vol_id; + assert(under_vol_id > 0); + + ret_value = H5VLlink_copy((o_src ? o_src->under_object : NULL), loc_params1, (o_dst ? o_dst->under_object : NULL), loc_params2, under_vol_id, lcpl_id, lapl_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_link_copy() */ + + +/*------------------------------------------------------------------------- + * Function: +H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, + * + * Purpose: Moves a link within an HDF5 file to a new group. The original + * name SRC is unlinked from the group graph + * and then inserted with the new name DST (which can specify a + * new path for the object) as an atomic operation. The names + * are interpreted relative to SRC_LOC_ID and + * DST_LOC_ID, which are either file IDs or group ID. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o_src = (H5VL_pass_through_t *)src_obj; + H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj; + hid_t under_vol_id = -1; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL LINK Move\n"); +#endif + + /* Retrieve the "under" VOL id */ + if(o_src) + under_vol_id = o_src->under_vol_id; + else if(o_dst) + under_vol_id = o_dst->under_vol_id; + assert(under_vol_id > 0); + + ret_value = H5VLlink_move((o_src ? o_src->under_object : NULL), loc_params1, (o_dst ? o_dst->under_object : NULL), loc_params2, under_vol_id, lcpl_id, lapl_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_link_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_link_get + * + * Purpose: Get info about a link + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, + H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL LINK Get\n"); +#endif + + ret_value = H5VLlink_get(o->under_object, loc_params, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_link_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_link_specific + * + * Purpose: Specific operation on a link + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params, + H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL LINK Specific\n"); +#endif + + ret_value = H5VLlink_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_link_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_link_optional + * + * Purpose: Perform a connector-specific operation on a link + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_link_optional(void *obj, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL LINK Optional\n"); +#endif + + ret_value = H5VLlink_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_link_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_object_open + * + * Purpose: Opens an object inside a container. + * + * Return: Success: Pointer to object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params, + H5I_type_t *opened_type, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *new_obj; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL OBJECT Open\n"); +#endif + + under = H5VLobject_open(o->under_object, loc_params, o->under_vol_id, opened_type, dxpl_id, req); + if(under) { + new_obj = H5VL_pass_through_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + } /* end if */ + else + new_obj = NULL; + + return((void *)new_obj); +} /* end H5VL_pass_through_object_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_object_copy + * + * Purpose: Copies an object inside a container. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, + const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, + const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, + void **req) +{ + H5VL_pass_through_t *o_src = (H5VL_pass_through_t *)src_obj; + H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL OBJECT Copy\n"); +#endif + + ret_value = H5VLobject_copy(o_src->under_object, src_loc_params, src_name, o_dst->under_object, dst_loc_params, dst_name, o_src->under_vol_id, ocpypl_id, lcpl_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o_src->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_object_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_object_get + * + * Purpose: Get info about an object + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL OBJECT Get\n"); +#endif + + ret_value = H5VLobject_get(o->under_object, loc_params, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_object_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_object_specific + * + * Purpose: Specific operation on an object + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params, + H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL OBJECT Specific\n"); +#endif + + ret_value = H5VLobject_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_object_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_object_optional + * + * Purpose: Perform a connector-specific operation for an object + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL OBJECT Optional\n"); +#endif + + ret_value = H5VLobject_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + + return(ret_value); +} /* end H5VL_pass_through_object_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_request_wait + * + * Purpose: Wait (with a timeout) for an async operation to complete + * + * Note: Releases the request if the operation has completed and the + * connector callback succeeds + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_request_wait(void *obj, uint64_t timeout, + H5ES_status_t *status) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL REQUEST Wait\n"); +#endif + + ret_value = H5VLrequest_wait(o->under_object, o->under_vol_id, timeout, status); + + if(ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS) + H5VL_pass_through_free_obj(o); + + return(ret_value); +} /* end H5VL_pass_through_request_wait() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_request_notify + * + * Purpose: Registers a user callback to be invoked when an asynchronous + * operation completes + * + * Note: Releases the request, if connector callback succeeds + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL REQUEST Wait\n"); +#endif + + ret_value = H5VLrequest_notify(o->under_object, o->under_vol_id, cb, ctx); + + if(ret_value >= 0) + H5VL_pass_through_free_obj(o); + + return(ret_value); +} /* end H5VL_pass_through_request_notify() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_request_cancel + * + * Purpose: Cancels an asynchronous operation + * + * Note: Releases the request, if connector callback succeeds + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_request_cancel(void *obj) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL REQUEST Cancel\n"); +#endif + + ret_value = H5VLrequest_cancel(o->under_object, o->under_vol_id); + + if(ret_value >= 0) + H5VL_pass_through_free_obj(o); + + return(ret_value); +} /* end H5VL_pass_through_request_cancel() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_request_specific_reissue + * + * Purpose: Re-wrap vararg arguments into a va_list and reissue the + * request specific callback to the underlying VOL connector. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id, + H5VL_request_specific_t specific_type, ...) +{ + va_list arguments; + herr_t ret_value; + + va_start(arguments, specific_type); + ret_value = H5VLrequest_specific(obj, connector_id, specific_type, arguments); + va_end(arguments); + + return(ret_value); +} /* end H5VL_pass_through_request_specific_reissue() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_request_specific + * + * Purpose: Specific operation on a request + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_type, + va_list arguments) +{ + herr_t ret_value = -1; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL REQUEST Specific\n"); +#endif + + if(H5VL_REQUEST_WAITANY == specific_type || + H5VL_REQUEST_WAITSOME == specific_type || + H5VL_REQUEST_WAITALL == specific_type) { + va_list tmp_arguments; + size_t req_count; + + /* Sanity check */ + assert(obj == NULL); + + /* Get enough info to call the underlying connector */ + va_copy(tmp_arguments, arguments); + req_count = va_arg(tmp_arguments, size_t); + + /* Can only use a request to invoke the underlying VOL connector when there's >0 requests */ + if(req_count > 0) { + void **req_array; + void **under_req_array; + uint64_t timeout; + H5VL_pass_through_t *o; + size_t u; /* Local index variable */ + + /* Get the request array */ + req_array = va_arg(tmp_arguments, void **); + + /* Get a request to use for determining the underlying VOL connector */ + o = (H5VL_pass_through_t *)req_array[0]; + + /* Create array of underlying VOL requests */ + under_req_array = (void **)malloc(req_count * sizeof(void **)); + for(u = 0; u < req_count; u++) + under_req_array[u] = ((H5VL_pass_through_t *)req_array[u])->under_object; + + /* Remove the timeout value from the vararg list (it's used in all the calls below) */ + timeout = va_arg(tmp_arguments, uint64_t); + + /* Release requests that have completed */ + if(H5VL_REQUEST_WAITANY == specific_type) { + size_t *index; /* Pointer to the index of completed request */ + H5ES_status_t *status; /* Pointer to the request's status */ + + /* Retrieve the remaining arguments */ + index = va_arg(tmp_arguments, size_t *); + assert(*index <= req_count); + status = va_arg(tmp_arguments, H5ES_status_t *); + + /* Reissue the WAITANY 'request specific' call */ + ret_value = H5VL_pass_through_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout, index, status); + + /* Release the completed request, if it completed */ + if(ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS) { + H5VL_pass_through_t *tmp_o; + + tmp_o = (H5VL_pass_through_t *)req_array[*index]; + H5VL_pass_through_free_obj(tmp_o); + } /* end if */ + } /* end if */ + else if(H5VL_REQUEST_WAITSOME == specific_type) { + size_t *outcount; /* # of completed requests */ + unsigned *array_of_indices; /* Array of indices for completed requests */ + H5ES_status_t *array_of_statuses; /* Array of statuses for completed requests */ + + /* Retrieve the remaining arguments */ + outcount = va_arg(tmp_arguments, size_t *); + assert(*outcount <= req_count); + array_of_indices = va_arg(tmp_arguments, unsigned *); + array_of_statuses = va_arg(tmp_arguments, H5ES_status_t *); + + /* Reissue the WAITSOME 'request specific' call */ + ret_value = H5VL_pass_through_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout, outcount, array_of_indices, array_of_statuses); + + /* If any requests completed, release them */ + if(ret_value >= 0 && *outcount > 0) { + unsigned *idx_array; /* Array of indices of completed requests */ + + /* Retrieve the array of completed request indices */ + idx_array = va_arg(tmp_arguments, unsigned *); + + /* Release the completed requests */ + for(u = 0; u < *outcount; u++) { + H5VL_pass_through_t *tmp_o; + + tmp_o = (H5VL_pass_through_t *)req_array[idx_array[u]]; + H5VL_pass_through_free_obj(tmp_o); + } /* end for */ + } /* end if */ + } /* end else-if */ + else { /* H5VL_REQUEST_WAITALL == specific_type */ + H5ES_status_t *array_of_statuses; /* Array of statuses for completed requests */ + + /* Retrieve the remaining arguments */ + array_of_statuses = va_arg(tmp_arguments, H5ES_status_t *); + + /* Reissue the WAITALL 'request specific' call */ + ret_value = H5VL_pass_through_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout, array_of_statuses); + + /* Release the completed requests */ + if(ret_value >= 0) { + for(u = 0; u < req_count; u++) { + if(array_of_statuses[u] != H5ES_STATUS_IN_PROGRESS) { + H5VL_pass_through_t *tmp_o; + + tmp_o = (H5VL_pass_through_t *)req_array[u]; + H5VL_pass_through_free_obj(tmp_o); + } /* end if */ + } /* end for */ + } /* end if */ + } /* end else */ + + /* Release array of requests for underlying connector */ + free(under_req_array); + } /* end if */ + + /* Finish use of copied vararg list */ + va_end(tmp_arguments); + } /* end if */ + else + assert(0 && "Unknown 'specific' operation"); + + return(ret_value); +} /* end H5VL_pass_through_request_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_request_optional + * + * Purpose: Perform a connector-specific operation for a request + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_request_optional(void *obj, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL REQUEST Optional\n"); +#endif + + ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, arguments); + + return(ret_value); +} /* end H5VL_pass_through_request_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_request_free + * + * Purpose: Releases a request, allowing the operation to complete without + * application tracking + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_request_free(void *obj) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL REQUEST Free\n"); +#endif + + ret_value = H5VLrequest_free(o->under_object, o->under_vol_id); + + if(ret_value >= 0) + H5VL_pass_through_free_obj(o); + + return(ret_value); +} /* end H5VL_pass_through_request_free() */ + diff --git a/src/H5Bpublic.h b/src/H5VLpassthru.h index 1764f61..e640636 100644 --- a/src/H5Bpublic.h +++ b/src/H5VLpassthru.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,29 +10,37 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/*------------------------------------------------------------------------- - * - * Created: H5Bproto.h - * Jul 10 1997 - * Robb Matzke <matzke@llnl.gov> - * - * Purpose: Public declarations for the H5B package. - * - * Modifications: - * - *------------------------------------------------------------------------- +/* + * Purpose: The public header file for the pass-through VOL connector. */ -#ifndef _H5Bpublic_H -#define _H5Bpublic_H -/* Public headers needed by this file */ -#include "H5public.h" +#ifndef _H5VLpassthru_H +#define _H5VLpassthru_H + +/* Identifier for the pass-through VOL connector */ +#define H5VL_PASSTHRU (H5VL_pass_through_register()) + +/* Characteristics of the pass-through VOL connector */ +#define H5VL_PASSTHRU_NAME "pass_through" +#define H5VL_PASSTHRU_VALUE 505 /* VOL connector ID */ +#define H5VL_PASSTHRU_VERSION 0 + +/* Pass-through VOL connector info */ +typedef struct H5VL_pass_through_info_t { + hid_t under_vol_id; /* VOL ID for under VOL */ + void *under_vol_info; /* VOL info for under VOL */ +} H5VL_pass_through_info_t; + #ifdef __cplusplus extern "C" { #endif +H5_DLL hid_t H5VL_pass_through_register(void); + #ifdef __cplusplus } #endif -#endif + +#endif /* _H5VLpassthru_H */ + diff --git a/src/H5VLpkg.h b/src/H5VLpkg.h new file mode 100644 index 0000000..bbdb0cc --- /dev/null +++ b/src/H5VLpkg.h @@ -0,0 +1,48 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: This file contains declarations which are visible only within + * the H5VL package. Source files outside the H5VL package should + * include H5VLprivate.h instead. + */ + +#if !(defined H5VL_FRIEND || defined H5VL_MODULE) +#error "Do not include this file outside the H5VL package!" +#endif + +#ifndef _H5VLpkg_H +#define _H5VLpkg_H + +/* Get package's private header */ +#include "H5VLprivate.h" /* Generic Functions */ + +/* Other private headers needed by this file */ + +/**************************/ +/* Package Private Macros */ +/**************************/ + +/****************************/ +/* Package Private Typedefs */ +/****************************/ + +/*****************************/ +/* Package Private Variables */ +/*****************************/ + +/******************************/ +/* Package Private Prototypes */ +/******************************/ + +#endif /* _H5VLpkg_H */ + diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h new file mode 100644 index 0000000..ef5a81e --- /dev/null +++ b/src/H5VLprivate.h @@ -0,0 +1,185 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef _H5VLprivate_H +#define _H5VLprivate_H + +/* Include package's public header */ +#include "H5VLpublic.h" /* Generic Functions */ + +/* Private headers needed by this file */ + +/**************************/ +/* Library Private Macros */ +/**************************/ + +/****************************/ +/* Library Private Typedefs */ +/****************************/ + +/* Internal struct to track VOL connector information for objects */ +typedef struct H5VL_t { + const H5VL_class_t *cls; /* Pointer to connector class struct */ + int64_t nrefs; /* Number of references by objects using this struct */ + hid_t id; /* Identifier for the VOL connector */ +} H5VL_t; + +/* Internal vol object structure returned to the API */ +typedef struct H5VL_object_t { + void *data; /* Pointer to connector-managed data for this object */ + H5VL_t *connector; /* Pointer to VOL connector struct */ +} H5VL_object_t; + +/* Internal structure to hold the connector ID & info for FAPLs */ +typedef struct H5VL_connector_prop_t { + hid_t connector_id; /* VOL connector's ID */ + const void *connector_info; /* VOL connector info, for open callbacks */ +} H5VL_connector_prop_t; + +/* Which kind of VOL connector field to use for searching */ +typedef enum H5VL_get_connector_kind_t { + H5VL_GET_CONNECTOR_BY_NAME, /* Name field is set */ + H5VL_GET_CONNECTOR_BY_VALUE /* Value field is set */ +} H5VL_get_connector_kind_t; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/******************************/ +/* Library Private Prototypes */ +/******************************/ + +/* Utility functions */ +H5_DLL herr_t H5VL_init(void); +H5_DLL herr_t H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_class_t *cls2); +H5_DLL herr_t H5VL_conn_copy(H5VL_connector_prop_t *value); +H5_DLL herr_t H5VL_conn_free(const H5VL_connector_prop_t *info); + +/* Functions that deal with VOL connectors */ +H5_DLL hid_t H5VL_register_connector(const void *cls, hbool_t app_ref, hid_t vipl_id); +H5_DLL ssize_t H5VL_get_connector_name(hid_t id, char *name/*out*/, size_t size); + +/* NOTE: The object and ID functions below deal in VOL objects (i.e.; + * H5VL_object_t). Similar non-VOL calls exist in H5Iprivate.h. Use + * the H5VL calls with objects that go through the VOL, such as + * datasets and groups, and the H5I calls with objects + * that do not, such as property lists and dataspaces. Datatypes + * are can be either named, where they will use the VOL, or not, + * and thus require special treatment. See the datatype docs for + * how to handle this. + */ + +/* Functions that manipulate VOL objects */ +H5_DLL void *H5VL_object(hid_t id); +H5_DLL void *H5VL_object_data(const H5VL_object_t *vol_obj); +H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type); +H5_DLL H5VL_object_t *H5VL_vol_object(hid_t id); +H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj); + +/* Functions that wrap / unwrap VOL objects */ +H5_DLL herr_t H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, + void **wrap_ctx); +H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx); +H5_DLL herr_t H5VL_set_vol_wrapper(void *obj, const H5VL_t *vol_connector); +H5_DLL herr_t H5VL_reset_vol_wrapper(void); +H5_DLL void * H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, + void *obj); + +/* ID registration functions */ +H5_DLL hid_t H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref); +H5_DLL hid_t H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref); +H5_DLL hid_t H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref); +H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref, hid_t existing_id); + +/********************************** + * VOL connector callback wrappers + *********************************/ + +/* Connector "management" functions */ +H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info, + const void *src_info); +H5_DLL herr_t H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value, + const void *info1, const void *info2); +H5_DLL herr_t H5VL_free_connector_info(const H5VL_class_t *connector, void *info); + +/* Attribute functions */ +H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_attr_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); + +/* Dataset functions */ +H5_DLL void *H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_dataset_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); +H5_DLL herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +H5_DLL herr_t H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_specific(const H5VL_object_t *cls, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); + +/* File functions */ +H5_DLL void *H5VL_file_create(const H5VL_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_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); + +/* Group functions */ +H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_group_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); + +/* Link functions */ +H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); + +/* Object functions */ +H5_DLL void *H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, const H5VL_object_t *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); + +/* Datatype functions */ +H5_DLL void *H5VL_datatype_commit(const H5VL_object_t *vol_obj, 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); + +/* 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_free(const H5VL_object_t *vol_obj); + +#endif /* _H5VLprivate_H */ + diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h new file mode 100644 index 0000000..5531395 --- /dev/null +++ b/src/H5VLpublic.h @@ -0,0 +1,534 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This file contains public declarations for the H5VL (VOL) module. + */ + +#ifndef _H5VLpublic_H +#define _H5VLpublic_H + +/* Public headers needed by this file */ +#include "H5public.h" /* Generic Functions */ +#include "H5Apublic.h" /* Attributes */ +#include "H5ESpublic.h" /* Event Stack */ +#include "H5Fpublic.h" /* Files */ +#include "H5Lpublic.h" /* Links */ +#include "H5Opublic.h" /* Objects */ +#include "H5Rpublic.h" /* References */ + + +/*****************/ +/* Public Macros */ +/*****************/ + +/* Dataset creation property names */ +#define H5VL_PROP_DSET_TYPE_ID "dataset_type_id" +#define H5VL_PROP_DSET_SPACE_ID "dataset_space_id" +#define H5VL_PROP_DSET_LCPL_ID "dataset_lcpl_id" + +/* Attribute creation property names */ +#define H5VL_PROP_ATTR_TYPE_ID "attr_type_id" +#define H5VL_PROP_ATTR_SPACE_ID "attr_space_id" +#define H5VL_PROP_ATTR_LOC_PARAMS "attr_location" + +/* Link creation property names */ +#define H5VL_PROP_LINK_TARGET "target_location_object" +#define H5VL_PROP_LINK_TARGET_LOC_PARAMS "target_params" +#define H5VL_PROP_LINK_TARGET_NAME "target_name" +#define H5VL_PROP_LINK_TYPE "link type" +#define H5VL_PROP_LINK_UDATA "udata" +#define H5VL_PROP_LINK_UDATA_SIZE "udata size" + +/* Group creation property names */ +#define H5VL_PROP_GRP_LCPL_ID "group_lcpl_id" + +/* Default VOL connector value */ +#define H5VL_VOL_DEFAULT 0 + + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/* types for attribute GET callback */ +typedef enum H5VL_attr_get_t { + H5VL_ATTR_GET_ACPL, /* creation property list */ + H5VL_ATTR_GET_INFO, /* info */ + H5VL_ATTR_GET_NAME, /* access property list */ + H5VL_ATTR_GET_SPACE, /* dataspace */ + H5VL_ATTR_GET_STORAGE_SIZE, /* storage size */ + H5VL_ATTR_GET_TYPE /* datatype */ +} H5VL_attr_get_t; + +/* types for attribute SPECFIC callback */ +typedef enum H5VL_attr_specific_t { + H5VL_ATTR_DELETE, /* H5Adelete(_by_name/idx) */ + H5VL_ATTR_EXISTS, /* H5Aexists(_by_name) */ + H5VL_ATTR_ITER, /* H5Aiterate(_by_name) */ + H5VL_ATTR_RENAME /* H5Arename(_by_name) */ +} H5VL_attr_specific_t; + +/* types for dataset GET callback */ +typedef enum H5VL_dataset_get_t { + H5VL_DATASET_GET_DAPL, /* access property list */ + H5VL_DATASET_GET_DCPL, /* creation property list */ + H5VL_DATASET_GET_OFFSET, /* offset */ + H5VL_DATASET_GET_SPACE, /* dataspace */ + H5VL_DATASET_GET_SPACE_STATUS, /* space status */ + H5VL_DATASET_GET_STORAGE_SIZE, /* storage size */ + H5VL_DATASET_GET_TYPE /* datatype */ +} H5VL_dataset_get_t; + +/* types for dataset SPECFIC callback */ +typedef enum H5VL_dataset_specific_t { + H5VL_DATASET_SET_EXTENT, /* H5Dset_extent */ + H5VL_DATASET_FLUSH, /* H5Dflush */ + H5VL_DATASET_REFRESH /* H5Drefresh */ +} H5VL_dataset_specific_t; + +/* types for datatype GET callback */ +typedef enum H5VL_datatype_get_t { + H5VL_DATATYPE_GET_BINARY, /* get serialized form of transient type */ + H5VL_DATATYPE_GET_TCPL /* datatype creation property list */ +} H5VL_datatype_get_t; + +/* types for datatype SPECFIC callback */ +typedef enum H5VL_datatype_specific_t { + H5VL_DATATYPE_FLUSH, + H5VL_DATATYPE_REFRESH +} H5VL_datatype_specific_t; + +/* types for file GET callback */ +typedef enum H5VL_file_get_t { + H5VL_FILE_GET_FAPL, /* file access property list */ + H5VL_FILE_GET_FCPL, /* file creation property list */ + H5VL_FILE_GET_INTENT, /* file intent */ + H5VL_FILE_GET_NAME, /* file name */ + H5VL_FILE_GET_OBJ_COUNT, /* object count in file */ + H5VL_FILE_GET_OBJ_IDS, /* object ids in file */ + H5VL_FILE_GET_MIN_DSET_OHDR_FLAG /* minimize dataset object headers? */ +} H5VL_file_get_t; + +/* types for file SPECIFIC callback */ +typedef enum H5VL_file_specific_t { + H5VL_FILE_FLUSH, /* Flush file */ + H5VL_FILE_REOPEN, /* Reopen the file */ + H5VL_FILE_MOUNT, /* Mount a file */ + H5VL_FILE_UNMOUNT, /* Unmount a file */ + H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */ + H5VL_FILE_CACHE_VOL_CONN /* Cache VOL connector ID & info */ +} H5VL_file_specific_t; + +/* types for group GET callback */ +typedef enum H5VL_group_get_t { + H5VL_GROUP_GET_GCPL, /* group creation property list */ + H5VL_GROUP_GET_INFO /* group info */ +} H5VL_group_get_t; + +/* types for group SPECFIC callback */ +typedef enum H5VL_group_specific_t { + H5VL_GROUP_FLUSH, + H5VL_GROUP_REFRESH +} H5VL_group_specific_t; + +/* link create types for VOL */ +typedef enum H5VL_link_create_type_t { + H5VL_LINK_CREATE_HARD, + H5VL_LINK_CREATE_SOFT, + H5VL_LINK_CREATE_UD +} H5VL_link_create_type_t; + +/* types for link GET callback */ +typedef enum H5VL_link_get_t { + H5VL_LINK_GET_INFO, /* link info */ + H5VL_LINK_GET_NAME, /* link name */ + H5VL_LINK_GET_VAL /* link value */ +} H5VL_link_get_t; + +/* types for link SPECIFIC callback */ +typedef enum H5VL_link_specific_t { + H5VL_LINK_DELETE, /* H5Ldelete(_by_idx) */ + H5VL_LINK_EXISTS, /* link existence */ + H5VL_LINK_ITER /* H5Literate/visit(_by_name) */ +} H5VL_link_specific_t; + +/* types for object GET callback */ +typedef enum H5VL_object_get_t { + H5VL_REF_GET_NAME, /* object name, for reference */ + H5VL_REF_GET_REGION, /* dataspace of region */ + H5VL_REF_GET_TYPE, /* type of object */ + H5VL_ID_GET_NAME /* object name, for hid_t */ +} H5VL_object_get_t; + +/* types for object SPECIFIC callback */ +typedef enum H5VL_object_specific_t { + H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */ + H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */ + H5VL_OBJECT_VISIT, /* H5Ovisit(_by_name) */ + H5VL_REF_CREATE, /* H5Rcreate */ + H5VL_OBJECT_FLUSH, /* H5{D|G|O|T}flush */ + H5VL_OBJECT_REFRESH /* H5{D|G|O|T}refresh */ +} H5VL_object_specific_t; + +/* types for async request SPECIFIC callback */ +typedef enum H5VL_request_specific_t { + H5VL_REQUEST_WAITANY, /* Wait until any request completes */ + H5VL_REQUEST_WAITSOME, /* Wait until at least one requesst completes */ + H5VL_REQUEST_WAITALL /* Wait until all requests complete */ +} H5VL_request_specific_t; + +/* types for different ways that objects are located in an HDF5 container */ +typedef enum H5VL_loc_type_t { + H5VL_OBJECT_BY_SELF, + H5VL_OBJECT_BY_NAME, + H5VL_OBJECT_BY_IDX, + H5VL_OBJECT_BY_ADDR, + H5VL_OBJECT_BY_REF +} H5VL_loc_type_t; + +struct H5VL_loc_by_name { + const char *name; + hid_t lapl_id; +}; + +struct H5VL_loc_by_idx { + const char *name; + H5_index_t idx_type; + H5_iter_order_t order; + hsize_t n; + hid_t lapl_id; +}; + +struct H5VL_loc_by_addr { + haddr_t addr; +}; + +struct H5VL_loc_by_ref { + H5R_type_t ref_type; + const void *_ref; + hid_t lapl_id; +}; + +/* Structure to hold parameters for object locations. + * either: BY_ADDR, BY_ID, BY_NAME, BY_IDX, BY_REF + * + * Note: Leave loc_by_addr as the first union member so we + * can perform the simplest initialization of the struct + * without raising warnings. + */ +typedef struct H5VL_loc_params_t { + H5I_type_t obj_type; + H5VL_loc_type_t type; + union{ + struct H5VL_loc_by_addr loc_by_addr; + struct H5VL_loc_by_name loc_by_name; + struct H5VL_loc_by_idx loc_by_idx; + struct H5VL_loc_by_ref loc_by_ref; + } loc_data; +} H5VL_loc_params_t; + +/* H5A routines */ +typedef struct H5VL_attr_class_t { + void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, + hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); + void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, + hid_t aapl_id, hid_t dxpl_id, void **req); + herr_t (*read)(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req); + herr_t (*write)(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req); + herr_t (*get)(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*close) (void *attr, hid_t dxpl_id, void **req); +} H5VL_attr_class_t; + +/* H5D routines */ +typedef struct H5VL_dataset_class_t { + void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, + hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); + void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, + hid_t dapl_id, hid_t dxpl_id, void **req); + herr_t (*read)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, + hid_t xfer_plist_id, void * buf, void **req); + herr_t (*write)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, + hid_t xfer_plist_id, const void * buf, void **req); + herr_t (*get)(void *obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*close) (void *dset, hid_t dxpl_id, void **req); +} H5VL_dataset_class_t; + +/* H5T routines*/ +typedef struct H5VL_datatype_class_t { + void *(*commit)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, + hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); + void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char * name, + hid_t tapl_id, hid_t dxpl_id, void **req); + herr_t (*get) (void *obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*close) (void *dt, hid_t dxpl_id, void **req); +} H5VL_datatype_class_t; + +/* H5F routines */ +typedef struct H5VL_file_class_t { + void *(*create)(const char *name, unsigned flags, hid_t fcpl_id, + hid_t fapl_id, hid_t dxpl_id, void **req); + void *(*open)(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); + herr_t (*get)(void *obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*close) (void *file, hid_t dxpl_id, void **req); +} H5VL_file_class_t; + +/* H5G routines */ +typedef struct H5VL_group_class_t { + void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, + hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); + void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, + hid_t gapl_id, hid_t dxpl_id, void **req); + herr_t (*get)(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*close) (void *grp, hid_t dxpl_id, void **req); +} H5VL_group_class_t; + +/* H5L routines */ +typedef struct H5VL_link_class_t { + herr_t (*create)(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); + herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, + hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req); + herr_t (*move)(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, + hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req); + herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); +} H5VL_link_class_t; + +/* H5O routines */ +typedef struct H5VL_object_class_t { + void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, + hid_t dxpl_id, void **req); + herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name, + void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); + herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, 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); + +/* 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 (*free)(void *req); +} H5VL_request_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; + +/* VOL connector identifier values */ +#define H5_VOL_INVALID (-1) /* Invalid ID for VOL connector iD */ +#define H5_VOL_NATIVE 0 /* Native HDF5 file formnat 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 */ + +/* Capability flags for connector */ +#define H5VL_CAP_FLAG_NONE 0 /* No special connector capabilities */ +#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Connector is threadsafe */ + +/* Class information for each VOL connector */ +typedef struct H5VL_class_t { + unsigned int version; /* VOL connector class struct version # */ + H5VL_class_value_t value; /* Value to identify connector */ + const char *name; /* Connector name (MUST be unique!) */ + unsigned cap_flags; /* Capability flags for connector */ + herr_t (*initialize)(hid_t vipl_id); /* Connector initialization callback */ + herr_t (*terminate)(void); /* Connector termination callback */ + size_t info_size; /* Size of the VOL info */ + void * (*info_copy)(const void *info); /* Callback to create a copy of the VOL info */ + herr_t (*info_cmp)(int *cmp_value, const void *info1, const void *info2); /* Callback to compare VOL info */ + herr_t (*info_free)(void *info); /* Callback to release the VOL info copy */ + herr_t (*info_to_str)(const void *info, char **str); /* Callback to serialize connector's info into a string */ + herr_t (*str_to_info)(const char *str, void **info); /* Callback to deserialize a string into connector's info */ + void * (*get_object)(const void *obj); /* Callback to retrieve underlying object */ + herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* Callback to retrieve the object wrapping context for the connector */ + void* (*wrap_object)(void *obj, void *wrap_ctx); /* Callback to wrap a library object */ + herr_t (*free_wrap_ctx)(void *wrap_ctx); /* Callback to release the object wrapping context for the connector */ + + /* Data Model */ + H5VL_attr_class_t attr_cls; /* attribute class callbacks */ + H5VL_dataset_class_t dataset_cls; /* dataset class callbacks */ + H5VL_datatype_class_t datatype_cls; /* datatype class callbacks */ + H5VL_file_class_t file_cls; /* file class callbacks */ + H5VL_group_class_t group_cls; /* group class callbacks */ + H5VL_link_class_t link_cls; /* link class callbacks */ + H5VL_object_class_t object_cls; /* object class callbacks */ + + /* Services */ + H5VL_request_class_t request_cls; /* asynchronous request class callbacks */ + + /* Catch-all */ + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */ +} H5VL_class_t; + + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* VOL Connector Functionality */ +H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id); +H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id); +H5_DLL hid_t H5VLregister_connector_by_value(H5VL_class_value_t connector_value, hid_t vipl_id); +H5_DLL htri_t H5VLis_connector_registered(const char *name); +H5_DLL hid_t H5VLget_connector_id(const char *name); +H5_DLL ssize_t H5VLget_connector_name(hid_t id, char *name/*out*/, size_t size); +H5_DLL herr_t H5VLclose(hid_t connector_id); +H5_DLL herr_t H5VLunregister_connector(hid_t connector_id); + + +/***************************************************************************** + * VOL callback wrappers and helper routines, for _VOL_connector_ authors only! * + * (Not part of the public API for _application_ developers) * + *****************************************************************************/ + +/* Helper routines for VOL connector authors */ +H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2); + + +/* Public wrappers for generic callbacks */ +H5_DLL herr_t H5VLinitialize(hid_t connector_id, hid_t vipl_id); +H5_DLL herr_t H5VLterminate(hid_t connector_id); +H5_DLL herr_t H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags); +H5_DLL herr_t H5VLget_value(hid_t connector_id, H5VL_class_value_t *conn_value); +H5_DLL herr_t H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_info); +H5_DLL herr_t H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1, + const void *info2); +H5_DLL herr_t H5VLfree_connector_info(hid_t connector_id, void *vol_info); +H5_DLL herr_t H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str); +H5_DLL herr_t H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info); +H5_DLL void *H5VLget_object(void *obj, hid_t connector_id); +H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx); +H5_DLL void *H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx); +H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id); + +/* Public wrappers for attribute callbacks */ +H5_DLL void *H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_read(void *attr, hid_t connector_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_write(void *attr, hid_t connector_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_close(void *attr, hid_t connector_id, hid_t dxpl_id, void **req); + +/* Public wrappers for dataset callbacks */ +H5_DLL void *H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLdataset_read(void *dset, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); +H5_DLL herr_t H5VLdataset_write(void *dset, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +H5_DLL herr_t H5VLdataset_get(void *dset, hid_t connector_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_close(void *dset, hid_t connector_id, hid_t dxpl_id, void **req); + +/* Public wrappers for file callbacks */ +H5_DLL void *H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLfile_get(void *file, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_close(void *file, hid_t connector_id, hid_t dxpl_id, void **req); + +/* Public wrappers for group callbacks */ +H5_DLL void *H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_close(void *grp, hid_t connector_id, hid_t dxpl_id, void **req); + +/* Public wrappers for link callbacks */ +H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t connector_id, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t connector_id, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); + +/* Public wrappers for object callbacks */ +H5_DLL void *H5VLobject_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name, + void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name, + hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); + +/* Public wrappers for named datatype callbacks */ +H5_DLL void *H5VLdatatype_commit(void *obj, 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 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_free(void *req, hid_t connector_id); + +#ifdef __cplusplus +} +#endif + +#endif /* _H5VLpublic_H */ + @@ -43,10 +43,10 @@ typedef struct H5Z_stats_t { #endif /* H5Z_DEBUG */ typedef struct H5Z_object_t { - H5Z_filter_t filter_id; /* ID of the filter we're looking for */ - htri_t found; /* Whether we find an object using the filter */ + H5Z_filter_t filter_id; /* ID of the filter we're looking for */ + htri_t found; /* Whether we find an object using the filter */ #ifdef H5_HAVE_PARALLEL - hbool_t sanity_checked; /* Whether the sanity check for collectively calling H5Zunregister has been done */ + hbool_t sanity_checked; /* Whether the sanity check for collectively calling H5Zunregister has been done */ #endif /* H5_HAVE_PARALLEL */ } H5Z_object_t; @@ -339,12 +339,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Zunregister + * Function: H5Zunregister * - * Purpose: This function unregisters a filter. + * Purpose: This function unregisters a filter. + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success - * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -371,13 +371,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__unregister + * Function: H5Z__unregister * - * Purpose: Same as the public version except this one allows filters - * to be unset for predefined method numbers <H5Z_FILTER_RESERVED + * Purpose: Same as the public version except this one allows filters + * to be unset for predefined method numbers <H5Z_FILTER_RESERVED + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success - * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -387,9 +387,9 @@ H5Z__unregister(H5Z_filter_t filter_id) H5Z_object_t object; /* Object to pass to callbacks */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE - HDassert(filter_id>=0 && filter_id<=H5Z_FILTER_MAX); + HDassert(filter_id >= 0 && filter_id <= H5Z_FILTER_MAX); /* Is the filter already registered? */ for (filter_index = 0; filter_index < H5Z_table_used_g; filter_index++) @@ -401,10 +401,10 @@ H5Z__unregister(H5Z_filter_t filter_id) HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter is not registered") /* Initialize the structure object for iteration */ - object.filter_id = filter_id; - object.found = FALSE; + object.filter_id = filter_id; + object.found = FALSE; #ifdef H5_HAVE_PARALLEL - object.sanity_checked = FALSE; + object.sanity_checked = FALSE; #endif /* H5_HAVE_PARALLEL */ /* Iterate through all opened datasets, returns a failure if any of them uses the filter */ @@ -434,17 +434,19 @@ H5Z__unregister(H5Z_filter_t filter_id) H5Z_table_used_g--; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__unregister() */ /*------------------------------------------------------------------------- - * Function: H5Z__check_unregister + * Function: H5Z__check_unregister * - * Purpose: Check if an object uses the filter to be unregistered. + * Purpose: Check if an object uses the filter to be unregistered. + * + * Return: TRUE if the object uses the filter + * FALSE if not + * NEGATIVE on error * - * Return: TRUE if the object uses the filter. - * FALSE if not, NEGATIVE on error. *------------------------------------------------------------------------- */ static htri_t @@ -469,15 +471,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__check_unregister_group_cb + * Function: H5Z__check_unregister_group_cb + * + * Purpose: The callback function for H5Z__unregister. It iterates + * through all opened objects. If the object is a dataset + * or a group and it uses the filter to be unregistered, the + * function returns TRUE. * - * Purpose: The callback function for H5Z__unregister. It iterates - * through all opened objects. If the object is a dataset - * or a group and it uses the filter to be unregistered, the - * function returns TRUE. + * Return: TRUE if the object uses the filter + * FALSE if not + * NEGATIVE on error * - * Return: TRUE if the object uses the filter. - * FALSE otherwise. *------------------------------------------------------------------------- */ static int @@ -506,7 +510,7 @@ H5Z__check_unregister_group_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void if (filter_in_pline) { object->found = TRUE; ret_value = TRUE; - } /* end if */ + } done: if (ocpl_id > 0) @@ -518,15 +522,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__check_unregister_dset_cb + * Function: H5Z__check_unregister_dset_cb + * + * Purpose: The callback function for H5Z__unregister. It iterates + * through all opened objects. If the object is a dataset + * or a group and it uses the filter to be unregistered, the + * function returns TRUE. * - * Purpose: The callback function for H5Z__unregister. It iterates - * through all opened objects. If the object is a dataset - * or a group and it uses the filter to be unregistered, the - * function returns TRUE. + * Return: TRUE if the object uses the filter + * FALSE if not + * NEGATIVE on error * - * Return: TRUE if the object uses the filter. - * FALSE otherwise. *------------------------------------------------------------------------- */ static int @@ -555,7 +561,7 @@ H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void * if (filter_in_pline) { object->found = TRUE; ret_value = TRUE; - } /* end if */ + } done: if (ocpl_id > 0) @@ -567,27 +573,29 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__flush_file_cb + * Function: H5Z__flush_file_cb * - * Purpose: The callback function for H5Z__unregister. It iterates - * through all opened files and flush them. + * Purpose: The callback function for H5Z__unregister. It iterates + * through all opened files and flush them. * - * Return: FALSE if finishes flushing and moves on - * FAIL if there is an error + * Return: NON-NEGATIVE if finishes flushing and moves on + * NEGATIVE if there is an error *------------------------------------------------------------------------- */ static int H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key) { - H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */ - H5Z_object_t *object = (H5Z_object_t *)key; - int ret_value = FALSE; /* Return value */ + H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */ +#ifdef H5_HAVE_PARALLEL + H5Z_object_t *object = (H5Z_object_t *)key; +#endif /* H5_HAVE_PARALLEL */ + int ret_value = FALSE; /* Return value */ FUNC_ENTER_STATIC /* Sanity checks */ - HDassert(f); - HDassert(object); + HDassert(obj_ptr); + HDassert(key); /* Do a global flush if the file is opened for write */ if(H5F_ACC_RDWR & H5F_INTENT(f)) { @@ -689,11 +697,11 @@ H5Z_filter_avail(H5Z_filter_t id) HGOTO_DONE(TRUE) key.id = (int)id; - if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, key))) { - if (H5Z_register(filter_info) < 0) + if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) { + if(H5Z_register(filter_info) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter") HGOTO_DONE(TRUE) - } + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -817,11 +825,11 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* Get dataset creation property list object */ if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") /* Peek at the layout information */ if (H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, dcpl_layout) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") /* Check if the dataset is chunked */ if (H5D_CHUNKED == dcpl_layout->type) { @@ -829,7 +837,7 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* Get I/O pipeline information */ if (H5P_peek(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") /* Check if the chunks have filters */ if (dcpl_pline.nused > 0) { @@ -846,12 +854,12 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* Get ID for dataspace to pass to filter routines */ if ((space_id = H5I_register(H5I_DATASPACE, space, FALSE)) < 0) { (void)H5S_close(space); - HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") } /* Make the callbacks */ if (H5Z_prelude_callback(&dcpl_pline, dcpl_id, type_id, space_id, prelude_type) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") } } } @@ -1281,7 +1289,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, /* Try loading the filter */ key.id = (int)(pline->filter[idx].id); - if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, key))) { + if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) { /* Register the filter we loaded */ if(H5Z_register(filter_info) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") @@ -1519,13 +1527,13 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) /* if the pipeline has no filters, just return */ if (pline->nused == 0) - HGOTO_DONE (SUCCEED) + HGOTO_DONE(SUCCEED) /* Delete all filters */ if (H5Z_FILTER_ALL == filter) { if (H5O_msg_reset(H5O_PLINE_ID, pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFREE, FAIL, "can't release pipeline info") - } /* end if */ + } /* Delete filter */ else { size_t idx; /* Index of filter in pipeline */ @@ -1568,7 +1576,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) pline->nused--; /* Reset information for previous last filter in pipeline */ - HDmemset (&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t)); + HDmemset(&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t)); } /* end else */ done: @@ -1596,7 +1604,7 @@ H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags) /* Get the filter info */ if (H5Z_get_filter_info(filter, filter_config_flags) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h index 0df05f0..a2a44fa 100644 --- a/src/H5Zpublic.h +++ b/src/H5Zpublic.h @@ -25,7 +25,7 @@ * Filter identifiers. Values 0 through 255 are for filters 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 hdf5dev@ncsa.uiuc.edu. These values will never change because they + * team at help@hdfgroup.org. These values will never change because they * appear in the HDF5 files. */ typedef int H5Z_filter_t; diff --git a/src/H5detect.c b/src/H5detect.c index 2d33a3d..4424009 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -26,11 +26,6 @@ static const char *FileHeader = "\n\ * help@hdfgroup.org. *\n\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"; /* - * - * Created: H5detect.c - * 10 Aug 1997 - * Robb Matzke - * * Purpose: This code was borrowed heavily from the `detect.c' * program in the AIO distribution from Lawrence * Livermore National Laboratory. @@ -44,9 +39,6 @@ static const char *FileHeader = "\n\ * features which aren't available. We're not * running on a Vax or other machine with mixed * endianness. - * - * Modifications: - * *------------------------------------------------------------------------- */ #undef NDEBUG @@ -117,6 +109,8 @@ typedef struct malign_t { unsigned int comp_align; /* alignment for structure */ } malign_t; +FILE *rawoutstream = NULL; + /* global variables types detection code */ H5_GCC_DIAG_OFF(larger-than=) static detected_t d_g[MAXDETECT]; @@ -143,9 +137,9 @@ static void detect_C99_integers32(void); static void detect_C99_integers64(void); static void detect_alignments(void); static unsigned int align_g[] = {1, 2, 4, 8, 16}; -static int align_status_g = 0; /* ALIGNMENT Signal Status */ +static int align_status_g = 0; /* ALIGNMENT Signal Status */ static int sigbus_handler_called_g = 0; /* how many times called */ -static int sigsegv_handler_called_g = 0;/* how many times called */ +static int sigsegv_handler_called_g = 0; /* how many times called */ static int sigill_handler_called_g = 0; /* how many times called */ static int signal_handler_tested_g = 0; /* how many times tested */ #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) @@ -156,18 +150,13 @@ static H5JMP_BUF jbuf_g; #endif + /*------------------------------------------------------------------------- * Function: precision * - * Purpose: Determine the precision and offset. - * - * Return: void - * - * Programmer: Robb Matzke - * Thursday, June 18, 1998 - * - * Modifications: + * Purpose: Determine the precision and offset. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -175,21 +164,22 @@ precision (detected_t *d) { unsigned int n; - if (0 == d->msize) { + if(0 == d->msize) { /* * An integer. The permutation can have negative values at the * beginning or end which represent padding of bytes. We must adjust * the precision and offset accordingly. */ - if (d->perm[0] < 0) { + if(d->perm[0] < 0) { /* * Lower addresses are padded. */ - for (n = 0; n < d->size && d->perm[n] < 0; n++) + for(n = 0; n < d->size && d->perm[n] < 0; n++) /*void*/; d->precision = 8 * (d->size - n); d->offset = 0; - } else if (d->perm[d->size - 1] < 0) { + } + else if(d->perm[d->size - 1] < 0) { /* * Higher addresses are padded. */ @@ -197,36 +187,34 @@ precision (detected_t *d) /*void*/; d->precision = 8 * (d->size - n); d->offset = 8 * n; - } else { + } + else { /* * No padding. */ d->precision = 8 * d->size; d->offset = 0; } - } else { + } + else { /* A floating point */ d->offset = MIN3(d->mpos, d->epos, d->sign); d->precision = d->msize + d->esize + 1; } } - + /*------------------------------------------------------------------------- * Function: DETECT_I/DETECT_BYTE * - * Purpose: These macro takes a type like `int' and a base name like - * `nati' and detects the byte order. The VAR is used to - * construct the names of the C variables defined. + * Purpose: These macro takes a type like `int' and a base name like + * `nati' and detects the byte order. The VAR is used to + * construct the names of the C variables defined. * * DETECT_I is used for types that are larger than one byte, * DETECT_BYTE is used for types that are exactly one byte. * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12 1996 + * Return: void * * Modifications: * @@ -244,7 +232,7 @@ precision (detected_t *d) * * Neil Fortner, 6 Sep 2013 * Split macro into DETECT_I and DETECT_BYTE macros, extracted - * common cod einto DETECT_I_BYTE_CORE. This was done to remove + * common code into DETECT_I_BYTE_CORE. This was done to remove * "will never be executed" warnings. * *------------------------------------------------------------------------- @@ -289,22 +277,15 @@ precision (detected_t *d) DETECT_I_BYTE_CORE(TYPE,VAR,INFO,TYPE) \ } - + /*------------------------------------------------------------------------- * Function: DETECT_F * - * Purpose: This macro takes a floating point type like `double' and - * a base name like `natd' and detects byte order, mantissa - * location, exponent location, sign bit location, presence or - * absence of implicit mantissa bit, and exponent bias and - * initializes a detected_t structure with those properties. - * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12 1996 - * + * Purpose: This macro takes a floating point type like `double' and + * a base name like `natd' and detects byte order, mantissa + * location, exponent location, sign bit location, presence or + * absence of implicit mantissa bit, and exponent bias and + * initializes a detected_t structure with those properties. *------------------------------------------------------------------------- */ #define DETECT_F(TYPE,VAR,INFO) { \ @@ -393,22 +374,15 @@ precision (detected_t *d) } \ } - + /*------------------------------------------------------------------------- * Function: DETECT_M * - * Purpose: This macro takes only miscellaneous structures or pointer + * Purpose: This macro takes only miscellaneous structures or pointer * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It - * constructs the names and decides the alignment in structure. - * - * Return: void - * - * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu - * Dec 9, 2002 - * - * Modifications: + * constructs the names and decides the alignment in structure. * + * Return: void *------------------------------------------------------------------------- */ #define DETECT_M(TYPE,VAR,INFO) { \ @@ -438,29 +412,29 @@ precision (detected_t *d) _buf = (char*)HDmalloc(sizeof(TYPE) + align_g[NELMTS(align_g) - 1]); \ if(H5SETJMP(jbuf_g)) _ano++; \ if(_ano < NELMTS(align_g)) { \ - *((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \ - _val2 = *((TYPE*)(_buf+align_g[_ano])); /*possible SIGBUS or SEGSEGV*/\ - /* Cray Check: This section helps detect alignment on Cray's */ \ + *((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \ + _val2 = *((TYPE*)(_buf+align_g[_ano])); /*possible SIGBUS or SEGSEGV*/\ + /* Cray Check: This section helps detect alignment on Cray's */ \ /* vector machines (like the SV1) which mask off */ \ - /* pointer values when pointing to non-word aligned */ \ - /* locations with pointers that are supposed to be */ \ - /* word aligned. -QAK */ \ - HDmemset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \ - /*How to handle VAX types?*/ \ - if(INFO.perm[0]) /* Big-Endian */ \ - HDmemcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char *)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(size_t)(INFO.precision/8)); \ - else /* Little-Endian */ \ - HDmemcpy(_buf+align_g[_ano]+(INFO.offset/8),((char *)&_val)+(INFO.offset/8),(size_t)(INFO.precision/8)); \ - _val2 = *((TYPE*)(_buf+align_g[_ano])); \ - H5_GCC_DIAG_OFF(float-equal) \ - if(_val!=_val2) \ - H5LONGJMP(jbuf_g, 1); \ - H5_GCC_DIAG_ON(float-equal) \ - /* End Cray Check */ \ - (INFO.align)=align_g[_ano]; \ + /* pointer values when pointing to non-word aligned */ \ + /* locations with pointers that are supposed to be */ \ + /* word aligned. -QAK */ \ + HDmemset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \ + /*How to handle VAX types?*/ \ + if(INFO.perm[0]) /* Big-Endian */ \ + HDmemcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char *)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(size_t)(INFO.precision/8)); \ + else /* Little-Endian */ \ + HDmemcpy(_buf+align_g[_ano]+(INFO.offset/8),((char *)&_val)+(INFO.offset/8),(size_t)(INFO.precision/8)); \ + _val2 = *((TYPE*)(_buf+align_g[_ano])); \ + H5_GCC_DIAG_OFF(float-equal) \ + if(_val!=_val2) \ + H5LONGJMP(jbuf_g, 1); \ + H5_GCC_DIAG_ON(float-equal) \ + /* End Cray Check */ \ + (INFO.align)=align_g[_ano]; \ } else { \ (INFO.align)=0; \ - fprintf(stderr, "unable to calculate alignment for %s\n", #TYPE); \ + fprintf(stderr, "unable to calculate alignment for %s\n", #TYPE); \ } \ HDfree(_buf); \ HDsignal(SIGBUS, _handler); /*restore original handler*/ \ @@ -476,21 +450,16 @@ precision (detected_t *d) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) + /*------------------------------------------------------------------------- * Function: sigsegv_handler * - * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. - * - * Return: Returns via H5LONGJMP to jbuf_g. - * - * Programmer: Robb Matzke - * Thursday, March 18, 1999 - * - * Modifications: + * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -514,21 +483,16 @@ sigsegv_handler(int H5_ATTR_UNUSED signo) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) + /*------------------------------------------------------------------------- * Function: sigbus_handler * - * Purpose: Handler for SIGBUS. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. - * - * Return: Returns via H5LONGJMP to jbuf_g. - * - * Programmer: Robb Matzke - * Thursday, March 18, 1999 - * - * Modifications: + * Purpose: Handler for SIGBUS. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -552,19 +516,16 @@ sigbus_handler(int H5_ATTR_UNUSED signo) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) + /*------------------------------------------------------------------------- * Function: sigill_handler * - * Purpose: Handler for SIGILL. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. - * - * Return: Returns via H5LONGJMP to jbuf_g. - * - * Programmer: Raymond Lu - * 28 October 2013 + * Purpose: Handler for SIGILL. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -586,20 +547,13 @@ sigill_handler(int H5_ATTR_UNUSED signo) } #endif - + /*------------------------------------------------------------------------- * Function: print_results * - * Purpose: Prints information about the detected data types. - * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 14, 1996 - * - * Modifications: + * Purpose: Prints information about the detected data types. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -609,7 +563,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) int i, j; /* Include files */ - printf("\ + fprintf(rawoutstream, "\ /****************/\n\ /* Module Setup */\n\ /****************/\n\ @@ -662,7 +616,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) /*********************/\n\ \n\ \n"); - printf("\n\ + fprintf(rawoutstream, "\n\ /*******************/\n\ /* Local Variables */\n\ /*******************/\n\ @@ -670,7 +624,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) /* The interface initialization function */ - printf("\n\ + fprintf(rawoutstream, "\n\ \n\ /*-------------------------------------------------------------------------\n\ * Function: H5T__init_native\n\ @@ -713,12 +667,12 @@ H5T__init_native(void)\n\ } /* Print a comment to describe this section of definitions. */ - printf("\n /*\n"); + fprintf(rawoutstream, "\n /*\n"); iprint(d+i); - printf(" */\n"); + fprintf(rawoutstream, " */\n"); /* The part common to fixed and floating types */ - printf("\ + fprintf(rawoutstream, "\ if(NULL == (dt = H5T__alloc()))\n\ HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, \"datatype allocation failed\")\n\ dt->shared->state = H5T_STATE_IMMUTABLE;\n\ @@ -728,16 +682,16 @@ H5T__init_native(void)\n\ d[i].size); /*size */ if(byte_order==-1) - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.order = H5T_ORDER_VAX;\n"); else if(byte_order==0) - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.order = H5T_ORDER_LE;\n"); else - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.order = H5T_ORDER_BE;\n"); - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.offset = %d;\n\ dt->shared->u.atomic.prec = %d;\n\ dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;\n\ @@ -746,14 +700,15 @@ H5T__init_native(void)\n\ d[i].precision); /*precision */ /*HDassert((d[i].perm[0]>0)==(byte_order>0));*/ /* Double-check that byte-order doesn't change */ - if (0 == d[i].msize) { + if(0 == d[i].msize) { /* The part unique to fixed point types */ - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.u.i.sign = H5T_SGN_%s;\n", d[i].sign ? "2" : "NONE"); - } else { + } + else { /* The part unique to floating point types */ - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.u.f.sign = %d;\n\ dt->shared->u.atomic.u.f.epos = %d;\n\ dt->shared->u.atomic.u.f.esize = %d;\n\ @@ -772,11 +727,11 @@ H5T__init_native(void)\n\ } /* Atomize the type */ - printf("\ + fprintf(rawoutstream, "\ if((H5T_NATIVE_%s_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)\n\ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \"can't register ID for built-in datatype\")\n", d[i].varname); - printf(" H5T_NATIVE_%s_ALIGN_g = %lu;\n", + fprintf(rawoutstream, " H5T_NATIVE_%s_ALIGN_g = %lu;\n", d[i].varname, (unsigned long)(d[i].align)); /* Variables for alignment of compound datatype */ @@ -784,28 +739,29 @@ H5T__init_native(void)\n\ !HDstrcmp(d[i].varname, "INT") || !HDstrcmp(d[i].varname, "LONG") || !HDstrcmp(d[i].varname, "LLONG") || !HDstrcmp(d[i].varname, "FLOAT") || !HDstrcmp(d[i].varname, "DOUBLE") || !HDstrcmp(d[i].varname, "LDOUBLE")) { - printf(" H5T_NATIVE_%s_COMP_ALIGN_g = %lu;\n", + fprintf(rawoutstream, " H5T_NATIVE_%s_COMP_ALIGN_g = %lu;\n", d[i].varname, (unsigned long)(d[i].comp_align)); } } /* Consider VAX a little-endian machine */ if(byte_order==0 || byte_order==-1) { - printf("\n\ + fprintf(rawoutstream, "\n\ /* Set the native order for this machine */\n\ H5T_native_order_g = H5T_ORDER_%s;\n", "LE"); - } else { - printf("\n\ + } + else { + fprintf(rawoutstream, "\n\ /* Set the native order for this machine */\n\ H5T_native_order_g = H5T_ORDER_%s;\n", "BE"); } /* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */ - printf("\n /* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */\n"); + fprintf(rawoutstream, "\n /* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */\n"); for(j=0; j<na; j++) - printf(" H5T_%s_COMP_ALIGN_g = %lu;\n", misc_align[j].name, (unsigned long)(misc_align[j].comp_align)); + fprintf(rawoutstream, " H5T_%s_COMP_ALIGN_g = %lu;\n", misc_align[j].name, (unsigned long)(misc_align[j].comp_align)); - printf("\ + fprintf(rawoutstream, "\ \n\ done:\n\ if(ret_value < 0) {\n\ @@ -818,73 +774,66 @@ done:\n\ FUNC_LEAVE_NOAPI(ret_value);\n} /* end H5T__init_native() */\n"); /* Print the ALIGNMENT and signal-handling status as comments */ - printf("\n" + fprintf(rawoutstream, "\n" "/****************************************/\n" "/* ALIGNMENT and signal-handling status */\n" "/****************************************/\n"); if (align_status_g & STA_NoALIGNMENT) - printf("/* ALIGNAMENT test is not available */\n"); + fprintf(rawoutstream, "/* ALIGNAMENT test is not available */\n"); if (align_status_g & STA_NoHandlerVerify) - printf("/* Signal handlers verify test is not available */\n"); + fprintf(rawoutstream, "/* Signal handlers verify test is not available */\n"); /* The following is available in H5pubconf.h. Printing them here for */ /* convenience. */ #ifdef H5_HAVE_SIGNAL - printf("/* Signal() support: yes */\n"); + fprintf(rawoutstream, "/* Signal() support: yes */\n"); #else - printf("/* Signal() support: no */\n"); + fprintf(rawoutstream, "/* Signal() support: no */\n"); #endif #ifdef H5_HAVE_SETJMP - printf("/* setjmp() support: yes */\n"); + fprintf(rawoutstream, "/* setjmp() support: yes */\n"); #else - printf("/* setjmp() support: no */\n"); + fprintf(rawoutstream, "/* setjmp() support: no */\n"); #endif #ifdef H5_HAVE_LONGJMP - printf("/* longjmp() support: yes */\n"); + fprintf(rawoutstream, "/* longjmp() support: yes */\n"); #else - printf("/* longjmp() support: no */\n"); + fprintf(rawoutstream, "/* longjmp() support: no */\n"); #endif #ifdef H5_HAVE_SIGSETJMP - printf("/* sigsetjmp() support: yes */\n"); + fprintf(rawoutstream, "/* sigsetjmp() support: yes */\n"); #else - printf("/* sigsetjmp() support: no */\n"); + fprintf(rawoutstream, "/* sigsetjmp() support: no */\n"); #endif #ifdef H5_HAVE_SIGLONGJMP - printf("/* siglongjmp() support: yes */\n"); + fprintf(rawoutstream, "/* siglongjmp() support: yes */\n"); #else - printf("/* siglongjmp() support: no */\n"); + fprintf(rawoutstream, "/* siglongjmp() support: no */\n"); #endif #ifdef H5_HAVE_SIGPROCMASK - printf("/* sigprocmask() support: yes */\n"); + fprintf(rawoutstream, "/* sigprocmask() support: yes */\n"); #else - printf("/* sigprocmask() support: no */\n"); + fprintf(rawoutstream, "/* sigprocmask() support: no */\n"); #endif /* Print the statics of signal handlers called for debugging */ - printf("\n" + fprintf(rawoutstream, "\n" "/******************************/\n" "/* signal handlers statistics */\n" "/******************************/\n"); - printf("/* signal_handlers tested: %d times */\n", signal_handler_tested_g); - printf("/* sigbus_handler called: %d times */\n", sigbus_handler_called_g); - printf("/* sigsegv_handler called: %d times */\n", sigsegv_handler_called_g); - printf("/* sigill_handler called: %d times */\n", sigill_handler_called_g); + fprintf(rawoutstream, "/* signal_handlers tested: %d times */\n", signal_handler_tested_g); + fprintf(rawoutstream, "/* sigbus_handler called: %d times */\n", sigbus_handler_called_g); + fprintf(rawoutstream, "/* sigsegv_handler called: %d times */\n", sigsegv_handler_called_g); + fprintf(rawoutstream, "/* sigill_handler called: %d times */\n", sigill_handler_called_g); } /* end print_results() */ - + /*------------------------------------------------------------------------- * Function: iprint * - * Purpose: Prints information about the fields of a floating point - * format. - * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 13, 1996 - * - * Modifications: + * Purpose: Prints information about the fields of a floating point format. * + * Return: void + *------------------------------------------------------------------------- */ static void @@ -892,88 +841,92 @@ iprint(detected_t *d) { unsigned int pass; - for (pass = (d->size - 1) / 4; ; --pass) { + for(pass = (d->size - 1) / 4; ; --pass) { unsigned int i, k; /* * Print the byte ordering above the bit fields. */ - printf(" * "); - for (i = MIN(pass * 4 + 3, d->size - 1); i >= pass * 4; --i) { - printf("%4d", d->perm[i]); - if (i > pass * 4) HDfputs(" ", stdout); - if (!i) break; + fprintf(rawoutstream, " * "); + for(i = MIN(pass * 4 + 3, d->size - 1); i >= pass * 4; --i) { + fprintf(rawoutstream, "%4d", d->perm[i]); + if(i > pass * 4) + HDfputs(" ", stdout); + if(!i) + break; } /* * Print the bit fields */ - printf("\n * "); - for (i = MIN(pass * 4 + 3, d->size - 1), k = MIN(pass * 32 + 31, + fprintf(rawoutstream, "\n * "); + for(i = MIN(pass * 4 + 3, d->size - 1), k = MIN(pass * 32 + 31, 8 * d->size - 1); i >= pass * 4; --i) { unsigned int j; - for (j = 8; j > 0; --j) { - if (k == d->sign && d->msize) { - HDputchar('S'); - } else if (k >= d->epos && k < d->epos + d->esize) { - HDputchar('E'); - } else if (k >= d->mpos && k < d->mpos + d->msize) { - HDputchar('M'); - } else if (d->msize) { - HDputchar('?'); /*unknown floating point bit */ - } else if (d->sign) { - HDputchar('I'); - } else { - HDputchar('U'); + for(j = 8; j > 0; --j) { + if(k == d->sign && d->msize) { + HDfputc('S', rawoutstream); + } + else if(k >= d->epos && k < d->epos + d->esize) { + HDfputc('E', rawoutstream); + } + else if(k >= d->mpos && k < d->mpos + d->msize) { + HDfputc('M', rawoutstream); + } + else if(d->msize) { + HDfputc('?', rawoutstream); /*unknown floating point bit */ + } + else if(d->sign) { + HDfputc('I', rawoutstream); + } + else { + HDfputc('U', rawoutstream); } --k; } - if (i > pass * 4) HDputchar(' '); - if (!i) break; + if(i > pass * 4) + HDfputc(' ', rawoutstream); + if(!i) + break; } - HDputchar('\n'); - if (!pass) break; + HDfputc('\n', rawoutstream); + if(!pass) + break; } /* * Is there an implicit bit in the mantissa. */ - if (d->msize) { - printf(" * Implicit bit? %s\n", d->imp ? "yes" : "no"); + if(d->msize) { + fprintf(rawoutstream, " * Implicit bit? %s\n", d->imp ? "yes" : "no"); } /* * Alignment */ - if (0 == d->align) { - printf(" * Alignment: NOT CALCULATED\n"); - } else if (1 == d->align) { - printf(" * Alignment: none\n"); - } else { - printf(" * Alignment: %lu\n", (unsigned long) (d->align)); + if(0 == d->align) { + fprintf(rawoutstream, " * Alignment: NOT CALCULATED\n"); + } + else if(1 == d->align) { + fprintf(rawoutstream, " * Alignment: none\n"); + } + else { + fprintf(rawoutstream, " * Alignment: %lu\n", (unsigned long) (d->align)); } } - + /*------------------------------------------------------------------------- * Function: byte_cmp * - * Purpose: Compares two chunks of memory A and B and returns the - * byte index into those arrays of the first byte that - * differs between A and B. Ignores differences where the + * Purpose: Compares two chunks of memory A and B and returns the + * byte index into those arrays of the first byte that + * differs between A and B. Ignores differences where the * corresponding bit in pad_mask is set to 0. * - * Return: Success: Index of differing byte. - * - * Failure: -1 if all bytes are the same. - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12, 1996 - * - * Modifications: - * + * Return: Success: Index of differing byte. + * Failure: -1 if all bytes are the same. *------------------------------------------------------------------------- */ static int @@ -990,17 +943,17 @@ byte_cmp(int n, const void *_a, const void *_b, const unsigned char *pad_mask) return -1; } - + /*------------------------------------------------------------------------- * Function: bit_cmp * - * Purpose: Compares two bit vectors and returns the index for the - * first bit that differs between the two vectors. The - * size of the vector is NBYTES. PERM is a mapping from - * actual order to little endian. Ignores differences where + * Purpose: Compares two bit vectors and returns the index for the + * first bit that differs between the two vectors. The + * size of the vector is NBYTES. PERM is a mapping from + * actual order to little endian. Ignores differences where * the corresponding bit in pad_mask is set to 0. * - * Return: Index of first differing bit. + * Return: Index of first differing bit. * *------------------------------------------------------------------------- */ @@ -1013,14 +966,14 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, unsigned char *b = (unsigned char *) _b; unsigned char aa, bb; - for (i = 0; i < nbytes; i++) { + for(i = 0; i < nbytes; i++) { HDassert(perm[i] < (int) nbytes); - if ((aa = (unsigned char) (a[perm[i]] & pad_mask[perm[i]])) + if((aa = (unsigned char) (a[perm[i]] & pad_mask[perm[i]])) != (bb = (unsigned char) (b[perm[i]] & pad_mask[perm[i]]))) { unsigned int j; - for (j = 0; j < 8; j++, aa >>= 1, bb >>= 1) { - if ((aa & 1) != (bb & 1)) return i * 8 + j; + for(j = 0; j < 8; j++, aa >>= 1, bb >>= 1) { + if((aa & 1) != (bb & 1)) return i * 8 + j; } fprintf(stderr, "INTERNAL ERROR"); HDabort(); @@ -1031,26 +984,19 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, return 0; } - + /*------------------------------------------------------------------------- * Function: fix_order * - * Purpose: Given an array PERM with elements FIRST through LAST - * initialized with zero origin byte numbers, this function - * creates a permutation vector that maps the actual order - * of a floating point number to little-endian. - * - * This function assumes that the mantissa byte ordering - * implies the total ordering. - * - * Return: void + * Purpose: Given an array PERM with elements FIRST through LAST + * initialized with zero origin byte numbers, this function + * creates a permutation vector that maps the actual order + * of a floating point number to little-endian. * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 13, 1996 - * - * Modifications: + * This function assumes that the mantissa byte ordering + * implies the total ordering. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -1058,79 +1004,79 @@ fix_order(int n, int last, int *perm, const char **mesg) { int i; - if (last > 1) { - /* - * We have at least three points to consider. - */ - if (perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { + if(last > 1) { /* - * Little endian. - */ - if (mesg) *mesg = "Little-endian"; - for (i = 0; i < n; i++) perm[i] = i; + * We have at least three points to consider. + */ + if(perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { + /* + * Little endian. + */ + if(mesg) + *mesg = "Little-endian"; + for(i = 0; i < n; i++) + perm[i] = i; - } else if (perm[last] > perm[last-1] && perm[last-1] > perm[last-2]) { - /* - * Big endian. - */ - if (mesg) *mesg = "Big-endian"; - for (i = 0; i < n; i++) perm[i] = (n - 1) - i; + } + else if(perm[last] > perm[last - 1] + && perm[last - 1] > perm[last - 2]) { + /* + * Big endian. + */ + if(mesg) + *mesg = "Big-endian"; + for(i = 0; i < n; i++) + perm[i] = (n - 1) - i; - } else { - /* - * Bi-endian machines like VAX. + } + else { + /* + * Bi-endian machines like VAX. * (NOTE: This is not an actual determination of the VAX-endianness. * It could have some other endianness and fall into this * case - JKM & QAK) - */ - HDassert(0 == n % 2); - if (mesg) *mesg = "VAX"; - for (i = 0; i < n; i += 2) { - perm[i] = (n - 2) - i; - perm[i + 1] = (n - 1) - i; + */ + HDassert(0 == n % 2); + if(mesg) + *mesg = "VAX"; + for(i = 0; i < n; i += 2) { + perm[i] = (n - 2) - i; + perm[i + 1] = (n - 1) - i; + } } } - } else { - fprintf(stderr, - "Failed to detect byte order of %d-byte floating point.\n", n); - HDexit(1); + else { + fprintf(stderr, + "Failed to detect byte order of %d-byte floating point.\n", n); + HDexit(1); } } - + /*------------------------------------------------------------------------- * Function: imp_bit * - * Purpose: Looks for an implicit bit in the mantissa. The value - * of _A should be 1.0 and the value of _B should be 0.5. - * Some floating-point formats discard the most significant - * bit of the mantissa after normalizing since it will always - * be a one (except for 0.0). If this is true for the native - * floating point values stored in _A and _B then the function - * returns non-zero. + * Purpose: Looks for an implicit bit in the mantissa. The value + * of _A should be 1.0 and the value of _B should be 0.5. + * Some floating-point formats discard the most significant + * bit of the mantissa after normalizing since it will always + * be a one (except for 0.0). If this is true for the native + * floating point values stored in _A and _B then the function + * returns non-zero. * - * This function assumes that the exponent occupies higher - * order bits than the mantissa and that the most significant - * bit of the mantissa is next to the least significant bit - * of the exponent. + * This function assumes that the exponent occupies higher + * order bits than the mantissa and that the most significant + * bit of the mantissa is next to the least significant bit + * of the exponent. * * - * Return: Success: Non-zero if the most significant bit - * of the mantissa is discarded (ie, the - * mantissa has an implicit `one' as the - * most significant bit). Otherwise, - * returns zero. + * Return: Success: Non-zero if the most significant bit + * of the mantissa is discarded (ie, the + * mantissa has an implicit `one' as the + * most significant bit). Otherwise, + * returns zero. * - * Failure: exit(1) - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 13, 1996 - * - * Modifications: - * - * Robb Matzke, 6 Nov 1996 - * Fixed a bug that occurs with non-implicit architectures. + * Failure: 1 * *------------------------------------------------------------------------- */ @@ -1160,26 +1106,14 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_ return (a[perm[major]] >> minor) & 0x01 ? 0 : 1; } - + /*------------------------------------------------------------------------- - * Function: find_bias - * - * Purpose: Determines the bias of the exponent. This function should - * be called with _A having a value of `1'. + * Function: find_bias * - * Return: Success: The exponent bias. + * Purpose: Determines the bias of the exponent. This function should + * be called with _A having a value of `1'. * - * Failure: - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 13, 1996 - * - * Modifications: - * - * Robb Matzke, 6 Nov 1996 - * Fixed a bug with non-implicit architectures returning the - * wrong exponent bias. + * Return: The exponent bias. * *------------------------------------------------------------------------- */ @@ -1190,7 +1124,7 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) unsigned char mask; unsigned int b, shift = 0, nbits, bias = 0; - while (esize > 0) { + while(esize > 0) { nbits = MIN(esize, (8 - epos % 8)); mask = (unsigned char) ((1 << nbits) - 1); b = (unsigned int) (a[perm[epos / 8]] >> (epos % 8)) & mask; @@ -1203,34 +1137,27 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) return bias; } - + /*------------------------------------------------------------------------- * Function: print_header * - * Purpose: Prints the C file header for the generated file. - * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Mar 12 1997 - * - * Modifications: + * Purpose: Prints the C file header for the generated file. * + * Return: void *------------------------------------------------------------------------- */ static void print_header(void) { - time_t now = HDtime(NULL); - struct tm *tm = HDlocaltime(&now); - char real_name[30]; - char host_name[256]; + time_t now = HDtime(NULL); + struct tm *tm = HDlocaltime(&now); + char real_name[30]; + char host_name[256]; int i; - const char *s; + const char *s; #ifdef H5_HAVE_GETPWUID - struct passwd *pwd = NULL; + struct passwd *pwd = NULL; #else int pwd = 1; #endif @@ -1281,20 +1208,21 @@ bit.\n"; */ #ifdef H5_HAVE_GETPWUID { - size_t n; - char *comma; - if ((pwd = HDgetpwuid(HDgetuid()))) { - if ((comma = HDstrchr(pwd->pw_gecos, ','))) { - n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos)); - HDstrncpy(real_name, pwd->pw_gecos, n); - real_name[n] = '\0'; - } else { - HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name)); - real_name[sizeof(real_name) - 1] = '\0'; + size_t n; + char *comma; + if((pwd = HDgetpwuid(HDgetuid()))) { + if((comma = HDstrchr(pwd->pw_gecos, ','))) { + n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos)); + HDstrncpy(real_name, pwd->pw_gecos, n); + real_name[n] = '\0'; + } + else { + HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name)); + real_name[sizeof(real_name) - 1] = '\0'; + } } - } else { - real_name[0] = '\0'; - } + else + real_name[0] = '\0'; } #else real_name[0] = '\0'; @@ -1304,8 +1232,8 @@ bit.\n"; * The FQDM of this host or the empty string. */ #ifdef H5_HAVE_GETHOSTNAME - if (HDgethostname(host_name, sizeof(host_name)) < 0) { - host_name[0] = '\0'; + if(HDgethostname(host_name, sizeof(host_name)) < 0) { + host_name[0] = '\0'; } #else host_name[0] = '\0'; @@ -1314,78 +1242,71 @@ bit.\n"; /* * The file header: warning, copyright notice, build information. */ - printf("/* Generated automatically by H5detect -- do not edit */\n\n\n"); - HDputs(FileHeader); /*the copyright notice--see top of this file */ + fprintf(rawoutstream, "/* Generated automatically by H5detect -- do not edit */\n\n\n"); + HDfputs(FileHeader, rawoutstream); /*the copyright notice--see top of this file */ - printf(" *\n * Created:\t\t%s %2d, %4d\n", + fprintf(rawoutstream, " *\n * Created:\t\t%s %2d, %4d\n", month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year); - if (pwd || real_name[0] || host_name[0]) { - printf(" *\t\t\t"); - if (real_name[0]) printf("%s <", real_name); + if(pwd || real_name[0] || host_name[0]) { + fprintf(rawoutstream, " *\t\t\t"); + if(real_name[0]) + fprintf(rawoutstream, "%s <", real_name); #ifdef H5_HAVE_GETPWUID - if (pwd) HDfputs(pwd->pw_name, stdout); + if(pwd) HDfputs(pwd->pw_name, rawoutstream); #endif - if (host_name[0]) printf("@%s", host_name); - if (real_name[0]) printf(">"); - HDputchar('\n'); + if(host_name[0]) + fprintf(rawoutstream, "@%s", host_name); + if(real_name[0]) + fprintf(rawoutstream, ">"); + HDfputc('\n', rawoutstream); } - printf(" *\n * Purpose:\t\t"); - for (s = purpose; *s; s++) { - HDputchar(*s); - if ('\n' == *s && s[1]) printf(" *\t\t\t"); + fprintf(rawoutstream, " *\n * Purpose:\t\t"); + for(s = purpose; *s; s++) { + HDfputc(*s, rawoutstream); + if('\n' == *s && s[1]) + fprintf(rawoutstream, " *\t\t\t"); } - printf(" *\n * Modifications:\n *\n"); - printf(" *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); - printf(" *\tIt was generated by code in `H5detect.c'.\n"); + fprintf(rawoutstream, " *\n * Modifications:\n *\n"); + fprintf(rawoutstream, " *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); + fprintf(rawoutstream, " *\tIt was generated by code in `H5detect.c'.\n"); - printf(" *\n *"); - for (i = 0; i < 73; i++) HDputchar('-'); - printf("\n */\n\n"); + fprintf(rawoutstream, " *\n *"); + for(i = 0; i < 73; i++) + HDfputc('-', rawoutstream); + fprintf(rawoutstream, "\n */\n\n"); } - + /*------------------------------------------------------------------------- * Function: detect_C89_integers * - * Purpose: Detect C89 integer types - * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Purpose: Detect C89 integer types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN detect_C89_integers(void) { - DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++; - DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++; - DETECT_I(short, SHORT, d_g[nd_g]); nd_g++; - DETECT_I(unsigned short, USHORT, d_g[nd_g]); nd_g++; - DETECT_I(int, INT, d_g[nd_g]); nd_g++; - DETECT_I(unsigned int, UINT, d_g[nd_g]); nd_g++; - DETECT_I(long, LONG, d_g[nd_g]); nd_g++; - DETECT_I(unsigned long, ULONG, d_g[nd_g]); nd_g++; + DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++; + DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++; + DETECT_I(short, SHORT, d_g[nd_g]); nd_g++; + DETECT_I(unsigned short, USHORT, d_g[nd_g]); nd_g++; + DETECT_I(int, INT, d_g[nd_g]); nd_g++; + DETECT_I(unsigned int, UINT, d_g[nd_g]); nd_g++; + DETECT_I(long, LONG, d_g[nd_g]); nd_g++; + DETECT_I(unsigned long, ULONG, d_g[nd_g]); nd_g++; } - + /*------------------------------------------------------------------------- * Function: detect_C89_floats * - * Purpose: Detect C89 floating point types - * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Purpose: Detect C89 floating point types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1395,19 +1316,13 @@ detect_C89_floats(void) DETECT_F(double, DOUBLE, d_g[nd_g]); nd_g++; } - + /*------------------------------------------------------------------------- * Function: detect_C99_integers8 * - * Purpose: Detect C99 8 bit integer types - * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Purpose: Detect C99 8 bit integer types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1415,61 +1330,55 @@ detect_C99_integers8(void) { #if H5_SIZEOF_INT8_T>0 #if H5_SIZEOF_INT8_T==1 - DETECT_BYTE(int8_t, INT8, d_g[nd_g]); nd_g++; + DETECT_BYTE(int8_t, INT8, d_g[nd_g]); nd_g++; #else - DETECT_I(int8_t, INT8, d_g[nd_g]); nd_g++; + DETECT_I(int8_t, INT8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_UINT8_T>0 #if H5_SIZEOF_UINT8_T==1 - DETECT_BYTE(uint8_t, UINT8, d_g[nd_g]); nd_g++; + DETECT_BYTE(uint8_t, UINT8, d_g[nd_g]); nd_g++; #else - DETECT_I(uint8_t, UINT8, d_g[nd_g]); nd_g++; + DETECT_I(uint8_t, UINT8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_INT_LEAST8_T>0 #if H5_SIZEOF_INT_LEAST8_T==1 - DETECT_BYTE(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; + DETECT_BYTE(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; #else - DETECT_I(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; + DETECT_I(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_UINT_LEAST8_T>0 #if H5_SIZEOF_UINT_LEAST8_T==1 - DETECT_BYTE(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; + DETECT_BYTE(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; #else - DETECT_I(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; + DETECT_I(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_INT_FAST8_T>0 #if H5_SIZEOF_INT_FAST8_T==1 - DETECT_BYTE(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; + DETECT_BYTE(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; #else DETECT_I(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_UINT_FAST8_T>0 #if H5_SIZEOF_UINT_FAST8_T==1 - DETECT_BYTE(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; + DETECT_BYTE(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; #else - DETECT_I(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; + DETECT_I(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; #endif #endif } - + /*------------------------------------------------------------------------- * Function: detect_C99_integers16 * - * Purpose: Detect C99 16 bit integer types - * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Purpose: Detect C99 16 bit integer types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1479,35 +1388,29 @@ detect_C99_integers16(void) DETECT_I(int16_t, INT16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT16_T>0 - DETECT_I(uint16_t, UINT16, d_g[nd_g]); nd_g++; + DETECT_I(uint16_t, UINT16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_LEAST16_T>0 - DETECT_I(int_least16_t, INT_LEAST16, d_g[nd_g]); nd_g++; + DETECT_I(int_least16_t, INT_LEAST16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_LEAST16_T>0 - DETECT_I(uint_least16_t, UINT_LEAST16, d_g[nd_g]); nd_g++; + DETECT_I(uint_least16_t, UINT_LEAST16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_FAST16_T>0 - DETECT_I(int_fast16_t, INT_FAST16, d_g[nd_g]); nd_g++; + DETECT_I(int_fast16_t, INT_FAST16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_FAST16_T>0 - DETECT_I(uint_fast16_t, UINT_FAST16, d_g[nd_g]); nd_g++; + DETECT_I(uint_fast16_t, UINT_FAST16, d_g[nd_g]); nd_g++; #endif } - + /*------------------------------------------------------------------------- * Function: detect_C99_integers32 * - * Purpose: Detect C99 32 bit integer types - * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Purpose: Detect C99 32 bit integer types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1517,34 +1420,29 @@ detect_C99_integers32(void) DETECT_I(int32_t, INT32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT32_T>0 - DETECT_I(uint32_t, UINT32, d_g[nd_g]); nd_g++; + DETECT_I(uint32_t, UINT32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_LEAST32_T>0 - DETECT_I(int_least32_t, INT_LEAST32, d_g[nd_g]); nd_g++; + DETECT_I(int_least32_t, INT_LEAST32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_LEAST32_T>0 - DETECT_I(uint_least32_t, UINT_LEAST32, d_g[nd_g]); nd_g++; + DETECT_I(uint_least32_t, UINT_LEAST32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_FAST32_T>0 - DETECT_I(int_fast32_t, INT_FAST32, d_g[nd_g]); nd_g++; + DETECT_I(int_fast32_t, INT_FAST32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_FAST32_T>0 - DETECT_I(uint_fast32_t, UINT_FAST32, d_g[nd_g]); nd_g++; + DETECT_I(uint_fast32_t, UINT_FAST32, d_g[nd_g]); nd_g++; #endif } - + /*------------------------------------------------------------------------- * Function: detect_C99_integers64 * - * Purpose: Detect C99 64 bit integer types + * Purpose: Detect C99 64 bit integer types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1555,24 +1453,24 @@ detect_C99_integers64(void) DETECT_I(int64_t, INT64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT64_T>0 - DETECT_I(uint64_t, UINT64, d_g[nd_g]); nd_g++; + DETECT_I(uint64_t, UINT64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_LEAST64_T>0 - DETECT_I(int_least64_t, INT_LEAST64, d_g[nd_g]); nd_g++; + DETECT_I(int_least64_t, INT_LEAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_LEAST64_T>0 - DETECT_I(uint_least64_t, UINT_LEAST64, d_g[nd_g]); nd_g++; + DETECT_I(uint_least64_t, UINT_LEAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_FAST64_T>0 - DETECT_I(int_fast64_t, INT_FAST64, d_g[nd_g]); nd_g++; + DETECT_I(int_fast64_t, INT_FAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_FAST64_T>0 - DETECT_I(uint_fast64_t, UINT_FAST64, d_g[nd_g]); nd_g++; + DETECT_I(uint_fast64_t, UINT_FAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_LONG_LONG>0 DETECT_I(long long, LLONG, d_g[nd_g]); nd_g++; - DETECT_I(unsigned long long, ULLONG, d_g[nd_g]); nd_g++; + DETECT_I(unsigned long long, ULLONG, d_g[nd_g]); nd_g++; #else /* * This architecture doesn't support an integer type larger than `long' @@ -1580,23 +1478,17 @@ detect_C99_integers64(void) * `long long' is probably equivalent to `long' here anyway. */ DETECT_I(long, LLONG, d_g[nd_g]); nd_g++; - DETECT_I(unsigned long, ULLONG, d_g[nd_g]); nd_g++; + DETECT_I(unsigned long, ULLONG, d_g[nd_g]); nd_g++; #endif } - + /*------------------------------------------------------------------------- * Function: detect_C99_integers * - * Purpose: Detect C99 integer types - * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Purpose: Detect C99 integer types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1610,19 +1502,13 @@ detect_C99_integers(void) detect_C99_integers64(); } - + /*------------------------------------------------------------------------- * Function: detect_C99_floats * - * Purpose: Detect C99 floating point types - * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Purpose: Detect C99 floating point types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1641,19 +1527,13 @@ detect_C99_floats(void) #endif } - + /*------------------------------------------------------------------------- * Function: detect_alignments * - * Purpose: Detect structure alignments - * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Purpose: Detect structure alignments * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1685,60 +1565,54 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) #endif void (*save_handler)(int) = HDsignal(signum, handler); volatile int i, val; - int ntries=5; - volatile int nfailures=0; - volatile int nsuccesses=0; - - for (i=0;i<ntries; i++){ - val=H5SETJMP(jbuf_g); - if (val==0) - { - /* send self the signal to trigger the handler */ - signal_handler_tested_g++; - HDraise(signum); - /* Should not reach here. Record error. */ - nfailures++; - }else{ - if (val==signum){ - /* return from signum handler. Record a sucess. */ - nsuccesses++; - }else{ - fprintf(stderr, "Unknown return value (%d) from H5SETJMP", - val); - nfailures++; + int ntries = 5; + volatile int nfailures = 0; + volatile int nsuccesses = 0; + + for(i=0;i<ntries; i++) { + val=H5SETJMP(jbuf_g); + if(val==0) { + /* send self the signal to trigger the handler */ + signal_handler_tested_g++; + HDraise(signum); + /* Should not reach here. Record error. */ + nfailures++; + } + else { + if(val==signum) { + /* return from signum handler. Record a sucess. */ + nsuccesses++; + } + else { + fprintf(stderr, "Unknown return value (%d) from H5SETJMP", val); + nfailures++; + } } - } } /* restore save handler, check results and report failures */ HDsignal(signum, save_handler); - if (nfailures>0 || nsuccesses != ntries){ - fprintf(stderr, "verify_signal_handlers for signal %d did %d tries. " - "Found %d failures and %d successes\n", - signum, ntries, nfailures, nsuccesses); - return(-1); - }else{ - /* all succeeded */ - return(0); + if(nfailures>0 || nsuccesses != ntries) { + fprintf(stderr, "verify_signal_handlers for signal %d did %d tries. " + "Found %d failures and %d successes\n", + signum, ntries, nfailures, nsuccesses); + return -1; + } + else { + /* all succeeded */ + return 0; } } #endif - + /*------------------------------------------------------------------------- * Function: main * - * Purpose: Main entry point. - * - * Return: Success: exit(0) + * Purpose: Main entry point. * - * Failure: exit(1) - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12, 1996 + * Return: Success: EXIT_SUCCESS * * Modifications: - * Albert Cheng, 2004/05/20 * Some compilers, e.g., Intel C v7.0, took a long time to compile * with optimization when a module routine contains many code lines. * Divide up all those types detections macros into subroutines, both @@ -1747,8 +1621,23 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) *------------------------------------------------------------------------- */ int HDF_NO_UBSAN -main(void) +main(int argc, char *argv[]) { + char *fname = NULL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawoutstream is changed only when succeeded */ + + if(argc > 1) + fname = argv[1]; + + /* First check if filename is string "NULL" */ + if(fname != NULL) { + /* binary output */ + if((f = HDfopen(fname, "w")) != NULL) + rawoutstream = f; + } + if(!rawoutstream) + rawoutstream = stdout; #if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS) #if defined(UAC_NOPRINT) && defined(UAC_SIGBUS) @@ -1759,8 +1648,8 @@ main(void) int nvpairs[2]; nvpairs[0] = SSIN_UACPROC; nvpairs[1] = UAC_NOPRINT | UAC_SIGBUS; - if (setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0)<0) { - fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", + if(setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0)<0) { + fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", HDstrerror(errno)); } #endif @@ -1768,15 +1657,15 @@ main(void) #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) /* verify the SIGBUS and SIGSEGV handlers work properly */ - if (verify_signal_handlers(SIGBUS, sigbus_handler) != 0) { + if(verify_signal_handlers(SIGBUS, sigbus_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigbus_handler", SIGBUS); } - if (verify_signal_handlers(SIGSEGV, sigsegv_handler) != 0) { + if(verify_signal_handlers(SIGSEGV, sigsegv_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigsegv_handler", SIGSEGV); } - if (verify_signal_handlers(SIGILL, sigill_handler) != 0) { + if(verify_signal_handlers(SIGILL, sigill_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigill_handler", SIGILL); } @@ -1803,5 +1692,13 @@ main(void) print_results (nd_g, d_g, na_g, m_g); - return 0; + if(rawoutstream && rawoutstream != stdout) { + if(HDfclose(rawoutstream)) + fprintf(stderr, "closing rawoutstream"); + else + rawoutstream = NULL; + } + + return EXIT_SUCCESS; } + diff --git a/src/H5err.txt b/src/H5err.txt index 19374cd..3965242 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -46,7 +46,7 @@ MAJOR, H5E_ARGS, Invalid arguments to routine MAJOR, H5E_RESOURCE, Resource unavailable MAJOR, H5E_INTERNAL, Internal error (too specific to document in detail) -MAJOR, H5E_FILE, File accessibilty +MAJOR, H5E_FILE, File accessibility MAJOR, H5E_IO, Low-level I/O MAJOR, H5E_FUNC, Function entry/exit MAJOR, H5E_ATOM, Object atom @@ -66,6 +66,7 @@ MAJOR, H5E_PLINE, Data filters MAJOR, H5E_EFL, External file list MAJOR, H5E_REFERENCE, References MAJOR, H5E_VFL, Virtual File Layer +MAJOR, H5E_VOL, Virtual Object Layer MAJOR, H5E_TST, Ternary Search Trees MAJOR, H5E_RS, Reference Counted Strings MAJOR, H5E_ERROR, Error API @@ -82,7 +83,7 @@ MAJOR, H5E_NONE_MAJOR, No error # Sections (for grouping minor errors) SECTION, ARGS, Argument errors SECTION, RESOURCE, Resource errors -SECTION, FILEACC, File accessibilty errors +SECTION, FILEACC, File accessibility errors SECTION, FILE, Generic low-level file I/O errors SECTION, FUNC, Function entry/exit interface errors SECTION, ATOM, Object atom related errors @@ -123,7 +124,7 @@ MINOR, RESOURCE, H5E_CANTGC, Unable to garbage collect MINOR, RESOURCE, H5E_CANTGETSIZE, Unable to compute size MINOR, RESOURCE, H5E_OBJOPEN, Object is already open -# File accessibilty errors +# File accessibility errors MINOR, FILEACC, H5E_FILEEXISTS, File already exists MINOR, FILEACC, H5E_FILEOPEN, File already open MINOR, FILEACC, H5E_CANTCREATE, Unable to create file diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c index 1892806..da7c8d9 100644 --- a/src/H5make_libsettings.c +++ b/src/H5make_libsettings.c @@ -26,13 +26,8 @@ static const char *FileHeader = "\n\ * help@hdfgroup.org. *\n\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"; /* - * - * Created: H5make_libsettings.c - * 17 Mar 2010 - * Quincey Koziol - * - * Purpose: Generate the H5libsettings.c file from the - * libhdf5.settings file. + * Purpose: Generate the H5libsettings.c file from the + * libhdf5.settings file. * *------------------------------------------------------------------------- */ @@ -43,33 +38,31 @@ static const char *FileHeader = "\n\ #define LIBSETTINGSFNAME "libhdf5.settings" +FILE *rawoutstream = NULL; + /*------------------------------------------------------------------------- - * Function: insert_libhdf5_settings - * - * Purpose: insert the contents of libhdf5.settings into a file - * represented by flibinfo. - * Make it an empty string if H5_HAVE_EMBEDDED_LIBINFO is not - * defined, i.e., not enabled. + * Function: insert_libhdf5_settings * - * Return: void - * - * Programmer: Albert Cheng - * Apr 20, 2009 + * Purpose: insert the contents of libhdf5.settings into a file + * represented by flibinfo. + * Make it an empty string if H5_HAVE_EMBEDDED_LIBINFO is not + * defined, i.e., not enabled. * + * Return: void *------------------------------------------------------------------------- */ static void insert_libhdf5_settings(FILE *flibinfo) { #ifdef H5_HAVE_EMBEDDED_LIBINFO - FILE *fsettings; /* for files libhdf5.settings */ + FILE *fsettings; /* for files libhdf5.settings */ int inchar; - int bol = 0; /* indicates the beginning of a new line */ + int bol = 0; /* indicates the beginning of a new line */ if(NULL == (fsettings = HDfopen(LIBSETTINGSFNAME, "r"))) { HDperror(LIBSETTINGSFNAME); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* print variable definition and the string */ @@ -77,33 +70,33 @@ insert_libhdf5_settings(FILE *flibinfo) fprintf(flibinfo, "char H5libhdf5_settings[]=\n"); bol++; while(EOF != (inchar = HDgetc(fsettings))) { - if(bol) { - /* Start a new line */ - fprintf(flibinfo, "\t\""); - bol = 0; - } /* end if */ - if(inchar == '\n') { - /* end of a line */ - fprintf(flibinfo, "\\n\"\n"); - bol++; + if(bol) { + /* Start a new line */ + fprintf(flibinfo, "\t\""); + bol = 0; + } /* end if */ + if(inchar == '\n') { + /* end of a line */ + fprintf(flibinfo, "\\n\"\n"); + bol++; } /* end if */ - else - HDputc(inchar, flibinfo); + else + HDputc(inchar, flibinfo); } /* end while */ if(HDfeof(fsettings)) { - /* wrap up */ - if(!bol) - /* EOF found without a new line */ - fprintf(flibinfo, "\\n\"\n"); - fprintf(flibinfo, ";\n\n"); + /* wrap up */ + if(!bol) + /* EOF found without a new line */ + fprintf(flibinfo, "\\n\"\n"); + fprintf(flibinfo, ";\n\n"); } /* end if */ else { - fprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME); - HDexit(1); + fprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME); + HDexit(EXIT_FAILURE); } /* end else */ if(0 != HDfclose(fsettings)) { - HDperror(LIBSETTINGSFNAME); - HDexit(1); + HDperror(LIBSETTINGSFNAME); + HDexit(EXIT_FAILURE); } /* end if */ #else /* print variable definition and an empty string */ @@ -114,59 +107,50 @@ insert_libhdf5_settings(FILE *flibinfo) /*------------------------------------------------------------------------- - * Function: make_libinfo - * - * Purpose: Create the embedded library information definition. - * This sets up for a potential extension that the declaration - * is printed to a file different from stdout. - * - * Return: void + * Function: make_libinfo * - * Programmer: Albert Cheng - * Sep 15, 2009 + * Purpose: Create the embedded library information definition. + * This sets up for a potential extension that the declaration + * is printed to a file different from stdout. * + * Return: void *------------------------------------------------------------------------- */ static void make_libinfo(void) { /* print variable definition and then the string as a macro. */ - insert_libhdf5_settings(stdout); + insert_libhdf5_settings(rawoutstream); } /*------------------------------------------------------------------------- - * Function: print_header + * Function: print_header * - * Purpose: Prints the header for the generated file. - * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Mar 12 1997 + * Purpose: Prints the header for the generated file. * + * Return: void *------------------------------------------------------------------------- */ static void print_header(void) { - time_t now = HDtime(NULL); - struct tm *tm = HDlocaltime(&now); - char real_name[30]; - char host_name[256]; - int i; - const char *s; + time_t now = HDtime(NULL); + struct tm *tm = HDlocaltime(&now); + char real_name[30]; + char host_name[256]; + int i; + const char *s; #ifdef H5_HAVE_GETPWUID - struct passwd *pwd = NULL; + struct passwd *pwd = NULL; #else - int pwd = 1; + int pwd = 1; #endif - static const char *month_name[] = + static const char *month_name[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; - static const char *purpose = "\ + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + static const char *purpose = "\ This machine-generated source code contains\n\ information about the library build configuration\n"; @@ -175,22 +159,22 @@ information about the library build configuration\n"; */ #ifdef H5_HAVE_GETPWUID { - size_t n; - char *comma; + size_t n; + char *comma; - if((pwd = HDgetpwuid(HDgetuid()))) { - if((comma = HDstrchr(pwd->pw_gecos, ','))) { - n = MIN(sizeof(real_name) - 1, (unsigned)(comma - pwd->pw_gecos)); - HDstrncpy(real_name, pwd->pw_gecos, n); - real_name[n] = '\0'; - } /* end if */ + if((pwd = HDgetpwuid(HDgetuid()))) { + if((comma = HDstrchr(pwd->pw_gecos, ','))) { + n = MIN(sizeof(real_name) - 1, (unsigned)(comma - pwd->pw_gecos)); + HDstrncpy(real_name, pwd->pw_gecos, n); + real_name[n] = '\0'; + } /* end if */ else { - HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name)); - real_name[sizeof(real_name) - 1] = '\0'; - } /* end else */ - } /* end if */ + HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name)); + real_name[sizeof(real_name) - 1] = '\0'; + } /* end else */ + } /* end if */ else - real_name[0] = '\0'; + real_name[0] = '\0'; } #else real_name[0] = '\0'; @@ -201,7 +185,7 @@ information about the library build configuration\n"; */ #ifdef H5_HAVE_GETHOSTNAME if(HDgethostname(host_name, sizeof(host_name)) < 0) - host_name[0] = '\0'; + host_name[0] = '\0'; #else host_name[0] = '\0'; #endif @@ -209,54 +193,49 @@ information about the library build configuration\n"; /* * The file header: warning, copyright notice, build information. */ - printf("/* Generated automatically by H5make_libsettings -- do not edit */\n\n\n"); - HDputs(FileHeader); /*the copyright notice--see top of this file */ + fprintf(rawoutstream, "/* Generated automatically by H5make_libsettings -- do not edit */\n\n\n"); + HDfputs(FileHeader, rawoutstream); /*the copyright notice--see top of this file */ - printf(" *\n * Created:\t\t%s %2d, %4d\n", - month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year); + fprintf(rawoutstream, " *\n * Created:\t\t%s %2d, %4d\n", + month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year); if(pwd || real_name[0] || host_name[0]) { - printf(" *\t\t\t"); - if(real_name[0]) - printf("%s <", real_name); + fprintf(rawoutstream, " *\t\t\t"); + if(real_name[0]) + fprintf(rawoutstream, "%s <", real_name); #ifdef H5_HAVE_GETPWUID - if(pwd) - HDfputs(pwd->pw_name, stdout); + if(pwd) + HDfputs(pwd->pw_name, rawoutstream); #endif - if(host_name[0]) - printf("@%s", host_name); - if(real_name[0]) - printf(">"); - HDputchar('\n'); + if(host_name[0]) + fprintf(rawoutstream, "@%s", host_name); + if(real_name[0]) + fprintf(rawoutstream, ">"); + HDfputc('\n', rawoutstream); } /* end if */ - printf(" *\n * Purpose:\t\t"); + fprintf(rawoutstream, " *\n * Purpose:\t\t"); for(s = purpose; *s; s++) { - HDputchar(*s); - if('\n' == *s && s[1]) - printf(" *\t\t\t"); + HDfputc(*s, rawoutstream); + if('\n' == *s && s[1]) + fprintf(rawoutstream, " *\t\t\t"); } /* end for */ - printf(" *\n * Modifications:\n *\n"); - printf(" *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); - printf(" *\tIt was generated by code in `H5make_libsettings.c'.\n"); + fprintf(rawoutstream, " *\n * Modifications:\n *\n"); + fprintf(rawoutstream, " *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); + fprintf(rawoutstream, " *\tIt was generated by code in `H5make_libsettings.c'.\n"); - printf(" *\n *"); + fprintf(rawoutstream, " *\n *"); for(i = 0; i < 73; i++) - HDputchar('-'); - printf("\n */\n\n"); + HDfputc('-', rawoutstream); + fprintf(rawoutstream, "\n */\n\n"); } /*------------------------------------------------------------------------- - * Function: print_footer + * Function: print_footer * - * Purpose: Prints the file footer for the generated file. - * - * Return: void - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Mar 31 2010 + * Purpose: Prints the file footer for the generated file. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -267,22 +246,33 @@ print_footer(void) /*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Main entry point. - * - * Return: Success: exit(0) + * Function: main * - * Failure: exit(1) - * - * Programmer: Albert Cheng - * 2010/4/1 + * Purpose: Main entry point. * + * Return: Success: EXIT_SUCCESS *------------------------------------------------------------------------- */ int -main(void) +main(int argc, char *argv[]) { + char *fname = NULL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawoutstream is changed only when succeeded + */ + + if(argc > 1) + fname = argv[1]; + + /* First check if filename is string "NULL" */ + if(fname != NULL) { + /* binary output */ + if((f = HDfopen(fname, "w")) != NULL) + rawoutstream = f; + } + if(!rawoutstream) + rawoutstream = stdout; + print_header(); /* Generate embedded library information variable definition */ @@ -290,5 +280,13 @@ main(void) print_footer(); - HDexit(0); + if(rawoutstream && rawoutstream != stdout) { + if(HDfclose(rawoutstream)) + fprintf(stderr, "closing rawoutstream"); + else + rawoutstream = NULL; + } + + HDexit(EXIT_SUCCESS); } + diff --git a/src/H5private.h b/src/H5private.h index 8974e46..b654bae 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -169,6 +169,9 @@ */ #define H5_DEFAULT_VFD H5FD_SEC2 +/* Define the default VOL driver */ +#define H5_DEFAULT_VOL H5VL_NATIVE + #ifdef H5_HAVE_WIN32_API /* The following two defines must be before any windows headers are included */ #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */ @@ -510,6 +513,11 @@ # define H5_INC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)+1)) #endif +/* Represents an empty asynchronous request handle. + * Used in the VOL code. + */ +#define H5_REQUEST_NULL NULL + /* * A macro to portably decrement enumerated types. */ @@ -1704,6 +1712,7 @@ typedef enum { H5_PKG_S, /* Dataspaces */ H5_PKG_T, /* Datatypes */ H5_PKG_V, /* Vector functions */ + H5_PKG_VL, /* VOL functions */ H5_PKG_Z, /* Raw data filters */ H5_NPKGS /* Must be last */ } H5_pkg_t; @@ -1992,7 +2001,6 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ H5_DLL herr_t H5CX_push(void); H5_DLL herr_t H5CX_pop(void); - #ifndef NDEBUG #define FUNC_ENTER_CHECK_NAME(asrt) \ { \ @@ -2031,7 +2039,7 @@ H5_DLL herr_t H5CX_pop(void); /* Local variables for API routines */ #define FUNC_ENTER_API_VARS \ MPE_LOG_VARS \ - H5TRACE_DECL \ + H5TRACE_DECL #define FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_VARS \ @@ -2078,10 +2086,11 @@ H5_DLL herr_t H5CX_pop(void); /* * Use this macro for API functions that shouldn't perform _any_ initialization * of the library or an interface, just perform tracing, etc. Examples - * are: H5allocate_memory, H5is_library_threadsafe, etc. + * are: H5allocate_memory, H5is_library_threadsafe, public VOL callback + * wrappers (e.g. H5VLfile_create, H5VLdataset_read, etc.), etc. * */ -#define FUNC_ENTER_API_NOINIT {{ \ +#define FUNC_ENTER_API_NOINIT {{{ \ FUNC_ENTER_API_COMMON \ H5_PUSH_FUNC \ BEGIN_MPE_LOG \ @@ -2094,7 +2103,7 @@ H5_DLL herr_t H5CX_pop(void); * are: H5close, H5check_version, etc. * */ -#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{ \ +#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{{{ \ FUNC_ENTER_API_VARS \ FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \ FUNC_ENTER_API_THREADSAFE; \ @@ -2199,12 +2208,6 @@ H5_DLL herr_t H5CX_pop(void); H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use this macro for all package-level functions that are VOL entry-points */ -#define FUNC_ENTER_PACKAGE_VOL { \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /* Use this macro for package-level functions which propgate errors, but don't issue them */ #define FUNC_ENTER_PACKAGE_NOERR { \ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ @@ -2221,29 +2224,12 @@ H5_DLL herr_t H5CX_pop(void); H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use the following macro as replacement for the FUNC_ENTER_PACKAGE - * macro when the function needs to set up a metadata tag and is also a - * VOL entry-point. */ -#define FUNC_ENTER_PACKAGE_VOL_TAG(tag) { \ - haddr_t prev_tag = HADDR_UNDEF; \ - \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5AC_tag(tag, &prev_tag); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /* Use this macro for all "normal" staticly-scoped functions */ #define FUNC_ENTER_STATIC { \ FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use this macro for all "normal" staticly-scoped functions that are VOL entry-points */ -#define FUNC_ENTER_STATIC_VOL { \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /* Use this macro for staticly-scoped functions which propgate errors, but don't issue them */ #define FUNC_ENTER_STATIC_NOERR { \ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ @@ -2266,17 +2252,6 @@ H5_DLL herr_t H5CX_pop(void); H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use the following macro as replacement for the FUNC_ENTER_STATIC - * macro when the function needs to set up a metadata tag and is a VOL - * entry-point. */ -#define FUNC_ENTER_STATIC_VOL_TAG(tag) { \ - haddr_t prev_tag = HADDR_UNDEF; \ - \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5AC_tag(tag, &prev_tag); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /*------------------------------------------------------------------------- * Purpose: Register function exit for code profiling. This should be @@ -2315,14 +2290,14 @@ H5_DLL herr_t H5CX_pop(void); (void)H5E_dump_api_stack(TRUE); \ FUNC_LEAVE_API_THREADSAFE \ return(ret_value); \ -}} /*end scope from beginning of FUNC_ENTER*/ +}}} /*end scope from beginning of FUNC_ENTER*/ /* Use this macro to match the FUNC_ENTER_API_NOINIT_NOERR_NOFS macro */ #define FUNC_LEAVE_API_NOFS(ret_value) \ FUNC_LEAVE_API_COMMON(ret_value); \ FUNC_LEAVE_API_THREADSAFE \ return(ret_value); \ -}} /*end scope from beginning of FUNC_ENTER*/ +}}}} /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI(ret_value) \ ; \ @@ -2331,13 +2306,6 @@ H5_DLL herr_t H5CX_pop(void); return(ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ -#define FUNC_LEAVE_NOAPI_VOL(ret_value) \ - ; \ - } /*end scope from end of FUNC_ENTER*/ \ - H5_POP_FUNC \ - return(ret_value); \ -} /*end scope from beginning of FUNC_ENTER*/ - #define FUNC_LEAVE_NOAPI_VOID \ ; \ } /*end scope from end of FUNC_ENTER*/ \ @@ -2365,15 +2333,6 @@ H5_DLL herr_t H5CX_pop(void); return(ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ -/* Use this macro when exiting a VOL entry-point function that set up a metadata tag */ -#define FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) \ - ; \ - } /*end scope from end of FUNC_ENTER*/ \ - H5AC_tag(prev_tag, NULL); \ - H5_POP_FUNC \ - return(ret_value); \ -} /*end scope from beginning of FUNC_ENTER*/ - /****************************************/ /* Revisions to FUNC_ENTER/LEAVE Macros */ @@ -2671,6 +2630,7 @@ H5_DLL int H5S_top_term_package(void); H5_DLL int H5SL_term_package(void); H5_DLL int H5T_term_package(void); H5_DLL int H5T_top_term_package(void); +H5_DLL int H5VL_term_package(void); H5_DLL int H5Z_term_package(void); /* Checksum functions */ diff --git a/src/H5public.h b/src/H5public.h index a4c80cd..353ff16 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -93,10 +93,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 11 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 2 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 4 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.11.2" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.11.4" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/H5system.c b/src/H5system.c index 186d8fa..2d29650 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -294,13 +294,13 @@ HDfprintf(FILE *stream, const char *fmt, ...) unsigned short x = (unsigned short)va_arg(ap, unsigned int); n = fprintf(stream, format_templ, x); } else if(!*modifier) { - unsigned int x = va_arg(ap, unsigned int); /*lint !e732 Loss of sign not really occurring */ + unsigned int x = va_arg(ap, unsigned int); n = fprintf(stream, format_templ, x); } else if(!HDstrcmp(modifier, "l")) { - unsigned long x = va_arg(ap, unsigned long); /*lint !e732 Loss of sign not really occurring */ + unsigned long x = va_arg(ap, unsigned long); n = fprintf(stream, format_templ, x); } else { - uint64_t x = va_arg(ap, uint64_t); /*lint !e732 Loss of sign not really occurring */ + uint64_t x = va_arg(ap, uint64_t); n = fprintf(stream, format_templ, x); } break; @@ -333,7 +333,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 'a': { - haddr_t x = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occurring */ + haddr_t x = va_arg(ap, haddr_t); if(H5F_addr_defined(x)) { len = 0; @@ -387,7 +387,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 's': case 'p': { - char *x = va_arg(ap, char*); /*lint !e64 Type mismatch not really occurring */ + char *x = va_arg(ap, char*); n = fprintf(stream, format_templ, x); } break; diff --git a/src/H5trace.c b/src/H5trace.c index eef268c..a628da3 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -36,6 +36,7 @@ #include "H5FDprivate.h" /* File drivers */ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ +#include "H5VLprivate.h" /* Virtual Object Layer */ #ifdef H5_HAVE_PARALLEL /* datatypes of predefined drivers needed by H5_trace() */ @@ -813,6 +814,37 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end else */ break; + case 's': + if(ptr) { + if(vp) + HDfprintf(out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5ES_status_t status = (H5ES_status_t)va_arg(ap, int); + + switch(status) { + case H5ES_STATUS_IN_PROGRESS: + HDfprintf(out, "H5ES_STATUS_IN_PROGRESS"); + break; + case H5ES_STATUS_SUCCEED: + HDfprintf(out, "H5ES_STATUS_SUCCEED"); + break; + case H5ES_STATUS_FAIL: + HDfprintf(out, "H5ES_STATUS_FAIL"); + break; + case H5ES_STATUS_CANCELED: + HDfprintf(out, "H5ES_STATUS_CANCELED"); + break; + + default: + HDfprintf(out, "%ld", (long)status); + break; + } /* end switch */ + } /* end else */ + break; + case 't': if(ptr) { if(vp) @@ -1331,6 +1363,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "%ld (file driver)", (long)obj); break; + case H5I_VOL: + HDfprintf(out, "%ld (VOL plugin)", (long)obj); + break; + case H5I_GENPROP_CLS: HDfprintf(out, "%ld (genprop class)", (long)obj); break; @@ -1512,6 +1548,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "H5I_VFL"); break; + case H5I_VOL: + HDfprintf(out, "H5I_VOL"); + break; + case H5I_GENPROP_CLS: HDfprintf(out, "H5I_GENPROP_CLS"); break; @@ -2466,6 +2506,491 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ break; + case 'V': + switch(type[1]) { + case 'a': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_attr_get_t get = (H5VL_attr_get_t)va_arg(ap, int); + + switch(get) { + case H5VL_ATTR_GET_SPACE: + HDfprintf(out, "H5VL_ATTR_GET_SPACE"); + break; + case H5VL_ATTR_GET_TYPE: + HDfprintf(out, "H5VL_ATTR_GET_TYPE"); + break; + case H5VL_ATTR_GET_ACPL: + HDfprintf(out, "H5VL_ATTR_GET_ACPL"); + break; + case H5VL_ATTR_GET_NAME: + HDfprintf(out, "H5VL_ATTR_GET_NAME"); + break; + case H5VL_ATTR_GET_STORAGE_SIZE: + HDfprintf(out, "H5VL_ATTR_GET_STORAGE_SIZE"); + break; + case H5VL_ATTR_GET_INFO: + HDfprintf(out, "H5VL_ATTR_GET_INFO"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'b': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_attr_specific_t specific = (H5VL_attr_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_ATTR_DELETE: + HDfprintf(out, "H5VL_ATTR_DELETE"); + break; + case H5VL_ATTR_EXISTS: + HDfprintf(out, "H5VL_ATTR_EXISTS"); + break; + case H5VL_ATTR_ITER: + HDfprintf(out, "H5VL_ATTR_ITER"); + break; + case H5VL_ATTR_RENAME: + HDfprintf(out, "H5VL_ATTR_RENAME"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'C': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_class_value_t class_val = (H5VL_class_value_t)va_arg(ap, H5VL_class_value_t); + + if(H5_VOL_NATIVE == class_val) + HDfprintf(out, "H5_VOL_NATIVE"); + else + HDfprintf(out, "%ld", (long)class_val); + } /* end else */ + break; + case 'c': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_dataset_get_t get = (H5VL_dataset_get_t)va_arg(ap, int); + + switch(get) { + case H5VL_DATASET_GET_SPACE: + HDfprintf(out, "H5VL_DATASET_GET_SPACE"); + break; + case H5VL_DATASET_GET_SPACE_STATUS: + HDfprintf(out, "H5VL_DATASET_GET_SPACE_STATUS"); + break; + case H5VL_DATASET_GET_TYPE: + HDfprintf(out, "H5VL_DATASET_GET_TYPE"); + break; + case H5VL_DATASET_GET_DCPL: + HDfprintf(out, "H5VL_DATASET_GET_DCPL"); + break; + case H5VL_DATASET_GET_DAPL: + HDfprintf(out, "H5VL_DATASET_GET_DAPL"); + break; + case H5VL_DATASET_GET_STORAGE_SIZE: + HDfprintf(out, "H5VL_DATASET_GET_STORAGE_SIZE"); + break; + case H5VL_DATASET_GET_OFFSET: + HDfprintf(out, "H5VL_DATASET_GET_OFFSET"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'd': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_dataset_specific_t specific = (H5VL_dataset_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_DATASET_SET_EXTENT: + HDfprintf(out, "H5VL_DATASET_SET_EXTENT"); + break; + case H5VL_DATASET_FLUSH: + HDfprintf(out, "H5VL_DATASET_FLUSH"); + break; + case H5VL_DATASET_REFRESH: + HDfprintf(out, "H5VL_DATASET_REFRESH"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'e': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_datatype_get_t get = (H5VL_datatype_get_t)va_arg(ap, int); + + switch(get) { + case H5VL_DATATYPE_GET_BINARY: + HDfprintf(out, "H5VL_DATATYPE_GET_BINARY"); + break; + case H5VL_DATATYPE_GET_TCPL: + HDfprintf(out, "H5VL_DATATYPE_GET_TCPL"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'f': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_datatype_specific_t specific = (H5VL_datatype_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_DATATYPE_FLUSH: + HDfprintf(out, "H5VL_DATATYPE_FLUSH"); + break; + case H5VL_DATATYPE_REFRESH: + HDfprintf(out, "H5VL_DATATYPE_REFRESH"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'g': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_file_get_t get = (H5VL_file_get_t)va_arg(ap, int); + + switch(get) { + case H5VL_FILE_GET_FAPL: + HDfprintf(out, "H5VL_FILE_GET_FAPL"); + break; + case H5VL_FILE_GET_FCPL: + HDfprintf(out, "H5VL_FILE_GET_FCPL"); + break; + case H5VL_FILE_GET_INTENT: + HDfprintf(out, "H5VL_FILE_GET_INTENT"); + break; + case H5VL_FILE_GET_NAME: + HDfprintf(out, "H5VL_FILE_GET_NAME"); + break; + case H5VL_FILE_GET_OBJ_COUNT: + HDfprintf(out, "H5VL_FILE_GET_OBJ_COUNT"); + break; + case H5VL_FILE_GET_OBJ_IDS: + HDfprintf(out, "H5VL_FILE_GET_OBJ_IDS"); + break; + case H5VL_FILE_GET_MIN_DSET_OHDR_FLAG: + HDfprintf(out, "H5VL_FILE_GET_MIN_DSET_OHDR_FLAG"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'h': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_file_specific_t specific = (H5VL_file_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_FILE_FLUSH: + HDfprintf(out, "H5VL_FILE_FLUSH"); + break; + case H5VL_FILE_REOPEN: + HDfprintf(out, "H5VL_FILE_REOPEN"); + break; + case H5VL_FILE_MOUNT: + HDfprintf(out, "H5VL_FILE_MOUNT"); + break; + case H5VL_FILE_UNMOUNT: + HDfprintf(out, "H5VL_FILE_UNMOUNT"); + break; + case H5VL_FILE_IS_ACCESSIBLE: + HDfprintf(out, "H5VL_FILE_IS_ACCESSIBLE"); + break; + case H5VL_FILE_CACHE_VOL_CONN: + HDfprintf(out, "H5VL_FILE_CACHE_VOL_CONN"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'i': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_group_get_t get = (H5VL_group_get_t)va_arg(ap, int); + + switch(get) { + case H5VL_GROUP_GET_GCPL: + HDfprintf(out, "H5VL_GROUP_GET_GCPL"); + break; + case H5VL_GROUP_GET_INFO: + HDfprintf(out, "H5VL_GROUP_GET_INFO"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'j': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_group_specific_t specific = (H5VL_group_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_GROUP_FLUSH: + HDfprintf(out, "H5VL_GROUP_FLUSH"); + break; + case H5VL_GROUP_REFRESH: + HDfprintf(out, "H5VL_GROUP_REFRESH"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'k': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_link_create_type_t create = (H5VL_link_create_type_t)va_arg(ap, int); + + switch(create) { + case H5VL_LINK_CREATE_HARD: + HDfprintf(out, "H5VL_LINK_CREATE_HARD"); + break; + case H5VL_LINK_CREATE_SOFT: + HDfprintf(out, "H5VL_LINK_CREATE_SOFT"); + break; + case H5VL_LINK_CREATE_UD: + HDfprintf(out, "H5VL_LINK_CREATE_UD"); + break; + default: + HDfprintf(out, "%ld", (long)create); + break; + } /* end switch */ + } /* end else */ + break; + case 'l': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_link_get_t get = (H5VL_link_get_t)va_arg(ap, int); + + switch(get) { + case H5VL_LINK_GET_INFO: + HDfprintf(out, "H5VL_LINK_GET_INFO"); + break; + case H5VL_LINK_GET_NAME: + HDfprintf(out, "H5VL_LINK_GET_NAME"); + break; + case H5VL_LINK_GET_VAL: + HDfprintf(out, "H5VL_LINK_GET_VAL"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'm': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_link_specific_t specific = (H5VL_link_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_LINK_DELETE: + HDfprintf(out, "H5VL_LINK_DELETE"); + break; + case H5VL_LINK_EXISTS: + HDfprintf(out, "H5VL_LINK_EXISTS"); + break; + case H5VL_LINK_ITER: + HDfprintf(out, "H5VL_LINK_ITER"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'n': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_object_get_t get = (H5VL_object_get_t)va_arg(ap, int); + + switch(get) { + case H5VL_REF_GET_REGION: + HDfprintf(out, "H5VL_REF_GET_REGION"); + break; + case H5VL_REF_GET_TYPE: + HDfprintf(out, "H5VL_REF_GET_TYPE"); + break; + case H5VL_REF_GET_NAME: + HDfprintf(out, "H5VL_REF_GET_NAME"); + break; + case H5VL_ID_GET_NAME: + HDfprintf(out, "H5VL_ID_GET_NAME"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'o': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_object_specific_t specific = (H5VL_object_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_OBJECT_CHANGE_REF_COUNT: + HDfprintf(out, "H5VL_OBJECT_CHANGE_REF_COUNT"); + break; + case H5VL_OBJECT_EXISTS: + HDfprintf(out, "H5VL_OBJECT_EXISTS"); + break; + case H5VL_OBJECT_VISIT: + HDfprintf(out, "H5VL_OBJECT_VISIT"); + break; + case H5VL_REF_CREATE: + HDfprintf(out, "H5VL_REF_CREATE"); + break; + case H5VL_OBJECT_FLUSH: + HDfprintf(out, "H5VL_OBJECT_FLUSH"); + break; + case H5VL_OBJECT_REFRESH: + HDfprintf(out, "H5VL_OBJECT_REFRESH"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'r': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_request_specific_t specific = (H5VL_request_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_REQUEST_WAITANY: + HDfprintf(out, "H5VL_REQUEST_WAITANY"); + break; + case H5VL_REQUEST_WAITSOME: + HDfprintf(out, "H5VL_REQUEST_WAITSOME"); + break; + case H5VL_REQUEST_WAITALL: + HDfprintf(out, "H5VL_REQUEST_WAITALL"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + default: + HDfprintf(out, "BADTYPE(Z%c)", type[1]); + goto error; + } /* end switch */ + break; + case 'x': if(ptr) { if(vp) { diff --git a/src/Makefile.am b/src/Makefile.am index a0defad..69b51b2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -113,7 +113,9 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c \ H5Topaque.c \ H5Torder.c \ - H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5VM.c H5WB.c H5Z.c \ + H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \ + H5VL.c H5VLcallback.c H5VLint.c H5VLnative.c H5VLpassthru.c \ + H5VM.c H5WB.c H5Z.c \ H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ H5Zscaleoffset.c H5Zszip.c H5Ztrans.c @@ -131,15 +133,15 @@ endif include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5version.h \ H5Apublic.h H5ACpublic.h \ H5Cpublic.h H5Dpublic.h \ - H5Epubgen.h H5Epublic.h H5Fpublic.h \ + H5Epubgen.h H5Epublic.h H5ESpublic.h H5Fpublic.h \ H5FDpublic.h H5FDcore.h H5FDdirect.h \ H5FDfamily.h H5FDlog.h H5FDmpi.h H5FDmpio.h \ - H5FDmulti.h H5FDsec2.h H5FDstdio.h \ + H5FDmulti.h H5FDsec2.h H5FDstdio.h H5FDwindows.h \ H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5MMpublic.h H5Opublic.h H5Ppublic.h \ H5PLextern.h H5PLpublic.h \ - H5Rpublic.h H5Spublic.h \ - H5Tpublic.h H5Zpublic.h + H5Rpublic.h H5Spublic.h H5Tpublic.h \ + H5VLnative.h H5VLpassthru.h H5VLpublic.h H5Zpublic.h # install libhdf5.settings in lib directory settingsdir=$(libdir) @@ -153,7 +155,7 @@ settings_DATA=libhdf5.settings H5Tinit.c: H5detect$(EXEEXT) LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \ sed -e 's/-L/:/g' -e 's/ //g'`" \ - $(RUNSERIAL) ./H5detect$(EXEEXT) > $@ || \ + $(RUNSERIAL) ./H5detect$(EXEEXT) $@ || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ ($(RM) $@ ; exit 1) @@ -165,7 +167,7 @@ H5Tinit.c: H5detect$(EXEEXT) H5lib_settings.c: H5make_libsettings$(EXEEXT) libhdf5.settings LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \ sed -e 's/-L/:/g' -e 's/ //g'`" \ - $(RUNSERIAL) ./H5make_libsettings$(EXEEXT) > $@ || \ + $(RUNSERIAL) ./H5make_libsettings$(EXEEXT) $@ || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ ($(RM) $@ ; exit 1) @@ -36,6 +36,7 @@ #include "H5Rpublic.h" /* References */ #include "H5Spublic.h" /* Dataspaces */ #include "H5Tpublic.h" /* Datatypes */ +#include "H5VLpublic.h" /* Virtual Object Layer */ #include "H5Zpublic.h" /* Data filters */ /* Predefined file drivers */ @@ -51,4 +52,8 @@ #include "H5FDwindows.h" /* Win32 I/O */ #endif +/* Virtual object layer (VOL) connectors */ +#include "H5VLnative.h" /* Native VOL connector */ +#include "H5VLpassthru.h" /* Pass-through VOL connector */ + #endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2a8a588..fcee7e8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -62,6 +62,7 @@ endif () ################################################################################# # If filter plugin tests can be tested ################################################################################# +if (BUILD_SHARED_LIBS) # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/filter_plugin_dir1") file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/filter_plugin_dir2") @@ -128,6 +129,39 @@ endif () ) endforeach () + #----------------------------------------------------------------------------- + # Define VOL Plugin Test Sources + #----------------------------------------------------------------------------- + set (VOL_PLUGIN_LIBS + echo_vol + ) + + foreach (vol_lib ${VOL_PLUGIN_LIBS}) + set (HDF5_VOL_PLUGIN_LIB_CORENAME "${vol_lib}") + set (HDF5_VOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_VOL_PLUGIN_LIB_CORENAME}") + set (HDF5_VOL_PLUGIN_LIB_TARGET ${HDF5_VOL_PLUGIN_LIB_CORENAME}) + + add_library (${HDF5_VOL_PLUGIN_LIB_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${vol_lib}.c) + target_include_directories(${HDF5_VOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${HDF5_VOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${HDF5_VOL_PLUGIN_LIB_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_VOL_PLUGIN_LIB_TARGET} ${HDF5_VOL_PLUGIN_LIB_NAME} SHARED "LIB") + set_target_properties (${HDF5_VOL_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) + + #----------------------------------------------------------------------------- + # Copy VOL plugin to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_VOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$<TARGET_FILE:${HDF5_VOL_PLUGIN_LIB_TARGET}>" + "${CMAKE_BINARY_DIR}/vol/$<TARGET_FILE_NAME:${HDF5_VOL_PLUGIN_LIB_TARGET}>" + ) + endforeach () +endif () + ################################################################################# # Test program sources ################################################################################# @@ -224,7 +258,7 @@ set (H5_TESTS ntypes dangle dtransform - reserved + # reserved disabled cross_read freespace mf @@ -235,6 +269,7 @@ set (H5_TESTS cork swmr ohdr_mindset + vol ) macro (ADD_H5_EXE file) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 44494e9..d0b6de5 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -441,14 +441,6 @@ set (test_CLEANFILES tvlstr.h5 tvlstr2.h5 twriteorder.dat - flush.h5 - flush-swmr.h5 - noflush.h5 - noflush-swmr.h5 - flush_extend.h5 - flush_extend-swmr.h5 - noflush_extend.h5 - noflush_extend-swmr.h5 enum1.h5 titerate.h5 ttsafe.h5 @@ -537,6 +529,7 @@ set (test_CLEANFILES vds_swmr_src_*.h5 tmp/vds_src_2.h5 direct_chunk.h5 + native_vol_test.h5 ) # Remove any output file left over from previous test run @@ -553,6 +546,8 @@ set (H5TEST_SEPARATE_TESTS testhdf5 cache cache_image + flush1 + flush2 ) foreach (test ${H5_TESTS}) if (NOT ${test} IN_LIST H5TEST_SEPARATE_TESTS) @@ -589,7 +584,6 @@ foreach (test ${H5_TESTS}) endif () endforeach () -set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1) set_tests_properties (H5TEST-fheap PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-big PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-btree2 PROPERTIES TIMEOUT 1800) @@ -632,7 +626,6 @@ if (BUILD_SHARED_LIBS) endif () endforeach () - set_tests_properties (H5TEST-shared-flush2 PROPERTIES DEPENDS H5TEST-shared-flush1) set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-shared-btree2 PROPERTIES TIMEOUT 1800) @@ -722,6 +715,54 @@ if (BUILD_SHARED_LIBS) endif () endif () +#-- Adding test for flush1/2 +add_test (NAME H5TEST-clear-flush-objects + COMMAND ${CMAKE_COMMAND} + -E remove + flush.h5 + flush-swmr.h5 + noflush.h5 + noflush-swmr.h5 + flush_extend.h5 + flush_extend-swmr.h5 + noflush_extend.h5 + noflush_extend-swmr.h5 + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-flush1 COMMAND $<TARGET_FILE:flush1>) +else () + add_test (NAME H5TEST-flush1 COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:flush1>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=flush1.txt" + -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () +set_tests_properties (H5TEST-flush1 PROPERTIES + DEPENDS H5TEST-clear-flush-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-flush2 COMMAND $<TARGET_FILE:flush2>) +else () + add_test (NAME H5TEST-flush2 COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:flush2>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=flush2.txt" + -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () +set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1) + #-- Adding test for tcheck_version add_test (NAME H5TEST-tcheck_version-major COMMAND $<TARGET_FILE:tcheck_version> "-tM") set_tests_properties (H5TEST-tcheck_version-major PROPERTIES @@ -828,9 +869,10 @@ add_test (NAME H5TEST-clear-error_test-objects set_tests_properties (H5TEST-clear-error_test-objects PROPERTIES FIXTURES_SETUP error_test_clear_objects) if (HDF5_USE_16_API_DEFAULT) add_test ( - NAME H5TEST-error_test-SKIPPED + NAME H5TEST-error_test COMMAND ${CMAKE_COMMAND} -E echo "SKIP $<TARGET_FILE:error_test>" ) + set_property(TEST H5TEST-error_test PROPERTY DISABLED) else () add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:error_test>" @@ -927,9 +969,10 @@ if (BUILD_SHARED_LIBS) set_tests_properties (H5TEST-shared-clear-error_test-objects PROPERTIES FIXTURES_SETUP shared_error_test_clear_objects) if (HDF5_USE_16_API_DEFAULT) add_test ( - NAME H5TEST-shared-error_test-SKIPPED + NAME H5TEST-shared-error_test COMMAND ${CMAKE_COMMAND} -E echo "SKIP $<TARGET_FILE:error_test-shared>" ) + set_property(TEST H5TEST-shared-error_test PROPERTY DISABLED) else () add_test (NAME H5TEST-shared-error_test COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:error_test-shared>" @@ -989,42 +1032,44 @@ endif () ############################################################################## ### F I L T E R P L U G I N T E S T S ############################################################################## -if (WIN32) - set (CMAKE_SEP "\;") - set (BIN_REL_PATH "../../") -else () - set (CMAKE_SEP ":") - set (BIN_REL_PATH "../") -endif () +if (BUILD_SHARED_LIBS) + if (WIN32) + set (CMAKE_SEP "\;") + set (BIN_REL_PATH "../../") + else () + set (CMAKE_SEP ":") + set (BIN_REL_PATH "../") + endif () -add_test (NAME H5PLUGIN-filter_plugin COMMAND $<TARGET_FILE:filter_plugin>) -set_tests_properties (H5PLUGIN-filter_plugin PROPERTIES - ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/filter_plugin_dir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/filter_plugin_dir2;srcdir=${HDF5_TEST_BINARY_DIR}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} -) + add_test (NAME H5PLUGIN-filter_plugin COMMAND $<TARGET_FILE:filter_plugin>) + set_tests_properties (H5PLUGIN-filter_plugin PROPERTIES + ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/filter_plugin_dir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/filter_plugin_dir2;srcdir=${HDF5_TEST_BINARY_DIR}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} + ) ############################################################################## # HDFFV-9655 relative plugin test disabled # -#add_test (NAME H5PLUGIN-pluginRelative COMMAND $<TARGET_FILE:plugin>) -#set_tests_properties (H5PLUGIN-pluginRelative PROPERTIES -# ENVIRONMENT "HDF5_PLUGIN_PATH=@/${BIN_REL_PATH}testdir1${CMAKE_SEP}@/${BIN_REL_PATH}testdir2;srcdir=${HDF5_TEST_BINARY_DIR}" -# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} -#) +# add_test (NAME H5PLUGIN-pluginRelative COMMAND $<TARGET_FILE:plugin>) +# set_tests_properties (H5PLUGIN-pluginRelative PROPERTIES +# ENVIRONMENT "HDF5_PLUGIN_PATH=@/${BIN_REL_PATH}testdir1${CMAKE_SEP}@/${BIN_REL_PATH}testdir2;srcdir=${HDF5_TEST_BINARY_DIR}" +# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} +# ) ############################################################################## +endif () if (TEST_SHELL_SCRIPTS) include (ShellTests.cmake) endif() if (ENABLE_EXTENDED_TESTS) - ############################################################################## - ### S W M R T E S T S - ############################################################################## - # testflushrefresh.sh: flushrefresh - # test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes - # testswmr.sh: swmr* - # testvdsswmr.sh: vds_swmr* +############################################################################## +### S W M R T E S T S +############################################################################## +# testflushrefresh.sh: flushrefresh +# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes +# testswmr.sh: swmr* +# testvdsswmr.sh: vds_swmr* # add_test (NAME H5Test-swmr_check_compat_vfd COMMAND $<TARGET_FILE:swmr_check_compat_vfd>) diff --git a/test/Makefile.am b/test/Makefile.am index 80e9c76..cb2156e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -60,7 +60,7 @@ TEST_PROG= testhdf5 \ flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \ enc_dec_plist_cross_platform getname vfd ntypes dangle dtransform \ reserved cross_read freespace mf vds file_image unregister \ - cache_logging cork swmr + cache_logging cork swmr vol # List programs to be built when testing here. # error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh. @@ -106,7 +106,9 @@ if HAVE_SHARED_CONDITIONAL # The libh5test library provides common support code for the tests. # The filter_plugin* libraries are for use in filter_plugin.c. # Build them as shared libraries if that option was enabled in configure. - noinst_LTLIBRARIES=libh5test.la libfilter_plugin1_dsets.la libfilter_plugin2_dsets.la libfilter_plugin3_dsets.la libfilter_plugin4_groups.la + # + # echo_vol is used for testing VOL plugin functionality. + noinst_LTLIBRARIES=libh5test.la libfilter_plugin1_dsets.la libfilter_plugin2_dsets.la libfilter_plugin3_dsets.la libfilter_plugin4_groups.la echo_vol.la libfilter_plugin1_dsets_la_SOURCES=filter_plugin1_dsets.c libfilter_plugin2_dsets_la_SOURCES=filter_plugin2_dsets.c libfilter_plugin3_dsets_la_SOURCES=filter_plugin3_dsets.c @@ -117,6 +119,11 @@ if HAVE_SHARED_CONDITIONAL libfilter_plugin4_groups_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere libfilter_plugin3_dsets_la_LIBADD=$(LIBHDF5) libfilter_plugin4_groups_la_LIBADD=$(LIBHDF5) + + # VOL plugin test libraries + echo_vol_la_SOURCES=echo_vol.c + echo_vol_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere + else # The libh5test library provides common support code for the tests. noinst_LTLIBRARIES=libh5test.la @@ -137,6 +144,11 @@ if DIRECT_VFD_CONDITIONAL VFD_LIST += direct endif +# Test with just the native connector, with a single pass-through connector +# and with a doubly-stacked pass-through. +VOL_LIST = native "pass_through under_vol=0;under_info={}" \ + "pass_through under_vol=505;under_info={under_vol=0;under_info={}}" + # Additional target for running timing test timings _timings: testmeta @for timing in $(TIMINGS) dummy; do \ @@ -194,7 +206,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse flushrefresh_VERIFICATION_DONE atomic_data accum_swmr_big.h5 ohdr_swmr.h5 \ test_swmr*.h5 cache_logging.h5 cache_logging.out vds_swmr.h5 vds_swmr_src_*.h5 \ swmr[0-2].h5 swmr_writer.out swmr_writer.log.* swmr_reader.out.* swmr_reader.log.* \ - tbogus.h5.copy cache_image_test.h5 direct_chunk.h5 + tbogus.h5.copy cache_image_test.h5 direct_chunk.h5 native_vol_test.h5 # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ diff --git a/test/accum.c b/test/accum.c index 19006b6..87628d8 100644 --- a/test/accum.c +++ b/test/accum.c @@ -23,6 +23,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Filename */ #define FILENAME "accum.h5" @@ -90,21 +91,30 @@ main(void) unsigned nerrors = 0; /* track errors */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t fid = -1; + hid_t fapl = -1; /* File access property list */ H5F_t * f = NULL; /* File for all tests */ /* Test Setup */ puts("Testing the metadata accumulator"); + /* File access property list */ + if((fapl = h5_fileaccess()) < 0) + FAIL_STACK_ERROR + /* Create a test file */ - if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR + + /* Closing and remove the file */ + if(H5Pclose(fapl) < 0) + FAIL_STACK_ERROR /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR api_ctx_pushed = TRUE; /* Get H5F_t * to internal file structure */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR /* We'll be writing lots of garbage data, so extend the file a ways. 10MB should do. */ @@ -1846,11 +1856,11 @@ test_swmr_write_big(hbool_t newest_format) * by the environment variable. */ driver = HDgetenv("HDF5_DRIVER"); - if (!H5FD_supports_swmr_test(driver)) { + if(!H5FD__supports_swmr_test(driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); return 0; - } /* end if */ + } /* File access property list */ if((fapl = h5_fileaccess()) < 0) @@ -1863,7 +1873,8 @@ test_swmr_write_big(hbool_t newest_format) if((fid = H5Fcreate(SWMR_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - } else { /* non-latest-format */ + } + else { /* non-latest-format */ if((fid = H5Fcreate(SWMR_FILENAME, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR } /* end if */ @@ -1881,7 +1892,7 @@ test_swmr_write_big(hbool_t newest_format) api_ctx_pushed = TRUE; /* Get H5F_t * to internal file structure */ - if(NULL == (rf = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR + if(NULL == (rf = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR /* We'll be writing lots of garbage data, so extend the file a ways. 10MB should do. */ @@ -1951,10 +1962,11 @@ test_swmr_write_big(hbool_t newest_format) if((pid = HDfork()) < 0) { HDperror("fork"); FAIL_STACK_ERROR; - } else if(0 == pid) { /* Child process */ + } + else if(0 == pid) { /* Child process */ /* Run the reader */ status = HDexecv(SWMR_READER, new_argv); - printf("errno from execv = %s\n", strerror(errno)); + HDprintf("errno from execv = %s\n", strerror(errno)); FAIL_STACK_ERROR; } /* end if */ @@ -2030,18 +2042,19 @@ accum_printf(const H5F_t *f) { H5F_meta_accum_t * accum = &f->shared->accum; - printf("\n"); - printf("Current contents of accumulator:\n"); - if (accum->alloc_size == 0) { - printf("=====================================================\n"); - printf(" No accumulator allocated.\n"); - printf("=====================================================\n"); - } else { - printf("=====================================================\n"); - printf(" accumulator allocated size == %zu\n", accum->alloc_size); - printf(" accumulated data size == %zu\n", accum->size); + HDprintf("\n"); + HDprintf("Current contents of accumulator:\n"); + if(accum->alloc_size == 0) { + HDprintf("=====================================================\n"); + HDprintf(" No accumulator allocated.\n"); + HDprintf("=====================================================\n"); + } + else { + HDprintf("=====================================================\n"); + HDprintf(" accumulator allocated size == %zu\n", accum->alloc_size); + HDprintf(" accumulated data size == %zu\n", accum->size); HDfprintf(stdout, " accumulator dirty? == %t\n", accum->dirty); - printf("=====================================================\n"); + HDprintf("=====================================================\n"); HDfprintf(stdout, " start of accumulated data, loc = %a\n", accum->loc); if(accum->dirty) { HDfprintf(stdout, " start of dirty region, loc = %a\n", (haddr_t)(accum->loc + accum->dirty_off)); @@ -2049,8 +2062,8 @@ accum_printf(const H5F_t *f) } /* end if */ HDfprintf(stdout, " end of accumulated data, loc = %a\n", (haddr_t)(accum->loc + accum->size)); HDfprintf(stdout, " end of accumulator allocation, loc = %a\n", (haddr_t)(accum->loc + accum->alloc_size)); - printf("=====================================================\n"); + HDprintf("=====================================================\n"); } - printf("\n\n"); + HDprintf("\n\n"); } /* accum_printf() */ diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c index 5bda46a..16e0ddc 100644 --- a/test/accum_swmr_reader.c +++ b/test/accum_swmr_reader.c @@ -20,6 +20,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Filename: this is the same as the define in accum.c used by test_swmr_write_big() */ #define SWMR_FILENAME "accum_swmr_big.h5" @@ -56,9 +57,8 @@ main(void) * by the environment variable. */ driver = HDgetenv("HDF5_DRIVER"); - if(!H5FD_supports_swmr_test(driver)) { + if(!H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS; - } /* Initialize buffers */ for(u = 0; u < 1024; u++) { @@ -78,7 +78,7 @@ main(void) api_ctx_pushed = TRUE; /* Get H5F_t * to internal file structure */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR /* Should read in [1024, 2024] with buf data */ @@ -101,8 +101,11 @@ main(void) return EXIT_SUCCESS; -error: - H5Fclose(fid); +error: + H5E_BEGIN_TRY { + H5Pclose(fapl); + H5Fclose(fid); + } H5E_END_TRY; if(api_ctx_pushed) H5CX_pop(); diff --git a/test/btree2.c b/test/btree2.c index d26fed5..8d77438 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -26,7 +26,7 @@ /* Other private headers that this test requires */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ const char *FILENAME[] = { "btree2", @@ -117,7 +117,7 @@ create_file(hid_t *file, H5F_t **f, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5VL_object(*file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -191,7 +191,7 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5VL_object(*file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3017,7 +3017,7 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3055,7 +3055,7 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -8568,7 +8568,7 @@ gen_l4_btree2(const char *filename, hid_t fapl, const H5B2_create_t *cparam, STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -8722,7 +8722,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -8817,7 +8817,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -8905,7 +8905,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -8990,7 +8990,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -9338,7 +9338,7 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -9382,7 +9382,7 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -9439,7 +9439,7 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -9496,7 +9496,7 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -9826,7 +9826,7 @@ test_open_twice_diff(hid_t fapl, const H5B2_create_t *cparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -9880,7 +9880,7 @@ test_open_twice_diff(hid_t fapl, const H5B2_create_t *cparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) + if(NULL == (f2 = (H5F_t *)H5VL_object(file2))) FAIL_STACK_ERROR /* Open the B-tree through the second file handle */ diff --git a/test/cache_api.c b/test/cache_api.c index 7c0ffa3..4f29009 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -230,7 +230,7 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -378,7 +378,7 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { diff --git a/test/cache_common.c b/test/cache_common.c index 2cc188e..94d3f59 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -20,6 +20,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5MFprivate.h" #include "H5MMprivate.h" + #include "cache_common.h" @@ -3276,23 +3277,24 @@ setup_cache(size_t max_cache_size, FUNC, mile_stone++, (int)pass); if(pass) { - HDassert(fid >= 0); - saved_fid = fid; + HDassert(fid >= 0); + saved_fid = fid; if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) { pass = FALSE; failure_mssg = "H5Fflush() failed."; if(verbose) HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC); - } else { - file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE); - if(file_ptr == NULL) { + } + else { + file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE); + if(file_ptr == NULL) { pass = FALSE; failure_mssg = "Can't get file_ptr."; if(verbose) HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC); - } + } } } @@ -3303,36 +3305,36 @@ setup_cache(size_t max_cache_size, if(pass) { /* A bit of fancy footwork here: - * - * The call to H5Fcreate() allocates an instance of H5C_t, - * initializes it, and stores its address in f->shared->cache. - * - * We don't want to use this cache, as it has a bunch of extra - * initialization that may change over time, and in any case - * it will not in general be configured the way we want it. - * - * We used to deal with this problem by storing the file pointer - * in another instance of H5C_t, and then ignoring the original - * version. However, this strategy doesn't work any more, as - * we can't store the file pointer in the instance of H5C_t, - * and we have modified many cache routines to use a file - * pointer to look up the target cache. - * - * Thus we now make note of the address of the instance of - * H5C_t created by the call to H5Fcreate(), set - * file_ptr->shared->cache to NULL, call H5C_create() - * to allocate a new instance of H5C_t for test purposes, - * and store than new instance's address in - * file_ptr->shared->cache. - * - * On shut down, we call H5C_dest on our instance of H5C_t, - * set file_ptr->shared->cache to point to the original - * instance, and then close the file normally. - */ + * + * The call to H5Fcreate() allocates an instance of H5C_t, + * initializes it, and stores its address in f->shared->cache. + * + * We don't want to use this cache, as it has a bunch of extra + * initialization that may change over time, and in any case + * it will not in general be configured the way we want it. + * + * We used to deal with this problem by storing the file pointer + * in another instance of H5C_t, and then ignoring the original + * version. However, this strategy doesn't work any more, as + * we can't store the file pointer in the instance of H5C_t, + * and we have modified many cache routines to use a file + * pointer to look up the target cache. + * + * Thus we now make note of the address of the instance of + * H5C_t created by the call to H5Fcreate(), set + * file_ptr->shared->cache to NULL, call H5C_create() + * to allocate a new instance of H5C_t for test purposes, + * and store than new instance's address in + * file_ptr->shared->cache. + * + * On shut down, we call H5C_dest on our instance of H5C_t, + * set file_ptr->shared->cache to point to the original + * instance, and then close the file normally. + */ HDassert(saved_cache == NULL); - saved_cache = file_ptr->shared->cache; - file_ptr->shared->cache = NULL; + saved_cache = file_ptr->shared->cache; + file_ptr->shared->cache = NULL; cache_ptr = H5C_create(max_cache_size, min_clean_size, @@ -3351,19 +3353,20 @@ setup_cache(size_t max_cache_size, FUNC, mile_stone++, (int)pass); if(pass) { - if(cache_ptr == NULL) { + if(cache_ptr == NULL) { pass = FALSE; failure_mssg = "H5C_create() failed."; if(verbose) HDfprintf(stdout, "%s: H5C_create() failed.\n", FUNC); - } else if(cache_ptr->magic != H5C__H5C_T_MAGIC) { + } + else if(cache_ptr->magic != H5C__H5C_T_MAGIC) { pass = FALSE; - failure_mssg = "Bad cache_ptr magic."; + failure_mssg = "Bad cache_ptr magic."; if(verbose) HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", FUNC); - } + } } if(show_progress) /* 7 */ @@ -3446,7 +3449,7 @@ takedown_cache(H5F_t * file_ptr, H5C_stats(cache_ptr, "test cache", dump_detailed_stats); } - if ( H5C_prep_for_file_close(file_ptr) < 0 ) { + if ( H5C_prep_for_file_close(file_ptr) < 0 ) { pass = FALSE; failure_mssg = "unexpected failure of prep for file close.\n"; @@ -3456,23 +3459,23 @@ takedown_cache(H5F_t * file_ptr, H5C_dest(file_ptr); - if ( saved_cache != NULL ) { + if ( saved_cache != NULL ) { - file_ptr->shared->cache = saved_cache; - saved_cache = NULL; - } + file_ptr->shared->cache = saved_cache; + saved_cache = NULL; + } } if ( saved_fapl_id != H5P_DEFAULT ) { H5Pclose(saved_fapl_id); - saved_fapl_id = H5P_DEFAULT; + saved_fapl_id = H5P_DEFAULT; } if ( saved_fcpl_id != H5P_DEFAULT ) { H5Pclose(saved_fcpl_id); - saved_fcpl_id = H5P_DEFAULT; + saved_fcpl_id = H5P_DEFAULT; } if ( saved_fid != -1 ) { @@ -3480,7 +3483,7 @@ takedown_cache(H5F_t * file_ptr, if ( H5F_addr_defined(saved_actual_base_addr) ) { if ( NULL == file_ptr ) { - file_ptr = (H5F_t *)H5I_object_verify(saved_fid, H5I_FILE); + file_ptr = (H5F_t *)H5VL_object_verify(saved_fid, H5I_FILE); HDassert ( file_ptr ); } @@ -3489,21 +3492,21 @@ takedown_cache(H5F_t * file_ptr, saved_actual_base_addr = HADDR_UNDEF; } - if ( H5Fclose(saved_fid) < 0 ) { + if ( H5Fclose(saved_fid) < 0 ) { pass = FALSE; - failure_mssg = "couldn't close test file."; + failure_mssg = "couldn't close test file."; - } else { + } else { - saved_fid = -1; + saved_fid = -1; } /* Pop API context */ H5CX_pop(); - if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { + if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { @@ -3515,10 +3518,10 @@ takedown_cache(H5F_t * file_ptr, if ( HDremove(filename) < 0 ) { pass = FALSE; - failure_mssg = "couldn't delete test file."; + failure_mssg = "couldn't delete test file."; - } - } + } + } } return; @@ -6030,7 +6033,7 @@ check_and_validate_cache_hit_rate(hid_t file_id, /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -6167,7 +6170,7 @@ check_and_validate_cache_size(hid_t file_id, /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -6349,7 +6352,7 @@ validate_mdc_config(hid_t file_id, /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { diff --git a/test/cache_common.h b/test/cache_common.h index 9c66357..2604567 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -28,6 +28,7 @@ #include "H5Cpkg.h" #include "H5Fpkg.h" #include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Include test header files */ #include "h5test.h" diff --git a/test/cache_image.c b/test/cache_image.c index 5967ecc..10e9a8a 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -586,12 +586,12 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, /* create a file access propertly list. */ if ( pass ) { - fapl_id = H5Pcreate(H5P_FILE_ACCESS); + fapl_id = h5_fileaccess(); if ( fapl_id < 0 ) { pass = FALSE; - failure_mssg = "H5Pcreate() failed.\n"; + failure_mssg = "h5_fileaccess() failed.\n"; } } @@ -720,7 +720,7 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, } else { - file_ptr = (struct H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -928,12 +928,12 @@ attempt_swmr_open_hdf5_file(const hbool_t create_file, /* create a file access propertly list. */ if ( pass ) { - fapl_id = H5Pcreate(H5P_FILE_ACCESS); + fapl_id = h5_fileaccess(); if ( fapl_id < 0 ) { pass = FALSE; - failure_mssg = "H5Pcreate() failed.\n"; + failure_mssg = "h5_fileaccess() failed.\n"; } } @@ -6688,12 +6688,12 @@ cache_image_api_error_check_4(void) */ if ( pass ) { - fapl_id = H5Pcreate(H5P_FILE_ACCESS); + fapl_id = h5_fileaccess(); if ( fapl_id < 0 ) { pass = FALSE; - failure_mssg = "H5Pcreate() failed.\n"; + failure_mssg = "h5_fileaccess() failed.\n"; } } @@ -6732,7 +6732,7 @@ cache_image_api_error_check_4(void) } else { - file_ptr = (struct H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -6882,7 +6882,7 @@ cache_image_api_error_check_4(void) } else { - file_ptr = (struct H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -6960,7 +6960,7 @@ cache_image_api_error_check_4(void) } else { - file_ptr = (struct H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { diff --git a/test/cache_logging.c b/test/cache_logging.c index b4ed53b..6fd48d8 100644 --- a/test/cache_logging.c +++ b/test/cache_logging.c @@ -40,8 +40,8 @@ test_logging_api(void) char *location = NULL; size_t size; - hid_t fid; - hid_t gid; + hid_t fid = -1; + hid_t gid = -1; hbool_t is_currently_logging; char group_name[8]; char filename[1024]; @@ -65,16 +65,16 @@ test_logging_api(void) start_on_access_out = TRUE; location = NULL; size = 999; - if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size, + if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size, &start_on_access_out) < 0) TEST_ERROR; - if(size != strlen(LOG_LOCATION) + 1) + if(size != HDstrlen(LOG_LOCATION) + 1) TEST_ERROR; /* Check to make sure that the property list getter works */ if(NULL == (location = (char *)HDcalloc(size, sizeof(char)))) TEST_ERROR; - if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size, + if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size, &start_on_access_out) < 0) TEST_ERROR; if((is_enabled != is_enabled_out) @@ -159,17 +159,18 @@ main(void) /* Reset library */ h5_reset(); - printf("Testing basic metadata cache logging functionality.\n"); + HDprintf("Testing basic metadata cache logging functionality.\n"); nerrors += test_logging_api(); if(nerrors) { - printf("***** %d Metadata cache logging TEST%s FAILED! *****\n", + HDprintf("***** %d Metadata cache logging TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); - return 1; + HDexit(EXIT_FAILURE); } - printf("All Metadata Cache Logging tests passed.\n"); - return 0; + HDprintf("All Metadata Cache Logging tests passed.\n"); + + HDexit(EXIT_SUCCESS); } diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 119ba62..752dd27 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -119,7 +119,7 @@ static int dump_cache(hid_t fid) H5F_t *f; /* File Pointer */ /* Get Internal File / Cache Pointers */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR; /* Dump the cache */ @@ -159,7 +159,7 @@ verify_no_unknown_tags(hid_t fid) int i; /* Iterator */ /* Get Internal File / Cache Pointers */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR; cache_ptr = f->shared->cache; @@ -207,7 +207,7 @@ mark_all_entries_investigated(hid_t fid) int i; /* Iterator */ /* Get Internal File / Cache Pointers */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR; cache_ptr = f->shared->cache; @@ -253,7 +253,7 @@ reset_all_entries_investigated(hid_t fid) int i; /* Iterator */ /* Get Internal File / Cache Pointers */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR; cache_ptr = f->shared->cache; @@ -301,7 +301,7 @@ verify_tag(hid_t fid, int id, haddr_t tag) int i; /* Iterator */ /* Get Internal File / Cache Pointers */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR; cache_ptr = f->shared->cache; @@ -341,7 +341,7 @@ evict_entries(hid_t fid) H5F_t *f; /* File Pointer */ /* Get Internal File / Cache Pointers */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR; /* Mark all entries investigated */ @@ -394,7 +394,7 @@ error: * Function: get_sbe_tag() * * Purpose: This function retrieves the tag associated with the superblock - * extension (the object header address stored in the superblock) + * extension (the object header address stored in the superblock) * * Return: 0 on Success; 1 on Failure * @@ -407,7 +407,7 @@ static int get_sbe_tag(hid_t fid, haddr_t *tag) { /* Retrieve the superblock extension's object header address for the file */ - if(H5F_get_sbe_addr_test(fid, tag) < 0) + if(H5F__get_sbe_addr_test(fid, tag) < 0) TEST_ERROR; return 0; @@ -440,14 +440,20 @@ check_file_creation_tags(hid_t fcpl_id, int type) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ int verbose = FALSE; /* verbose test outout */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t sbe_tag = 0; /* Testing Macro */ TESTING("tag application during file creation"); + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; #ifndef NDEBUG /* if verbose, print cache index to screen before verification . */ @@ -521,6 +527,7 @@ check_file_open_tags(hid_t fcpl, int type) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ int verbose = FALSE; /* verbose file outout */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag; /* Root Group Tag */ haddr_t sbe_tag; /* Sblock Extension Tag */ @@ -531,8 +538,13 @@ check_file_open_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -628,6 +640,7 @@ check_group_creation_tags(void) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ int verbose = FALSE; /* verbose file outout */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; /* Root Group Tag */ haddr_t g_tag; /* Group Tag */ @@ -638,8 +651,13 @@ check_group_creation_tags(void) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -733,7 +751,7 @@ check_multi_group_creation_tags(void) TESTING("tag application during multiple group creation"); /* Create Fapl */ - if ( (fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; /* Set latest version of library */ if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR; @@ -816,6 +834,7 @@ check_multi_group_creation_tags(void) /* Close open objects and file */ /* =========================== */ + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; if ( H5Fclose(fid) < 0 ) TEST_ERROR; /* ========================================== */ @@ -855,15 +874,21 @@ check_link_iteration_tags(void) haddr_t root_tag = 0; /* Root Group Tag Value */ char dsetname[500]; /* Name of dataset */ H5G_info_t ginfo; /* Group Info Struct */ + hid_t fapl = -1; /* File access prop list */ hid_t root_group = -1; /* Root Group Identifier */ /* Testing Macro */ TESTING("tag application during iteration over links in a group"); + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* =========== */ /* Create File */ /* =========== */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* Get root group tag */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -975,7 +1000,7 @@ check_dense_attribute_tags(void) TESTING("tag application during dense attribute manipulation"); /* Create Fapl */ - if ( (fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR; /* Create Dcpl */ @@ -986,6 +1011,8 @@ check_dense_attribute_tags(void) /* =========== */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; + /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -1145,6 +1172,7 @@ check_group_open_tags(void) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ int verbose = FALSE; /* verbose file output */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; haddr_t g_tag; @@ -1155,8 +1183,13 @@ check_group_open_tags(void) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -1248,6 +1281,7 @@ check_attribute_creation_tags(hid_t fcpl, int type) hid_t gid = -1; /* Group Identifier */ hid_t sid = -1; /* Dataspace Identifier */ int verbose = FALSE; /* verbose file outout */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; /* Root group tag */ haddr_t g_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -1260,8 +1294,11 @@ check_attribute_creation_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -1341,6 +1378,7 @@ check_attribute_creation_tags(hid_t fcpl, int type) if ( H5Aclose(aid) < 0 ) TEST_ERROR; if ( H5Gclose(gid) < 0 ) TEST_ERROR; + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; if ( H5Fclose(fid) < 0 ) TEST_ERROR; /* ========================================== */ @@ -1377,6 +1415,7 @@ check_attribute_open_tags(hid_t fcpl, int type) hid_t gid = -1; /* Group Identifier */ hid_t sid = -1; /* Dataspace Identifier */ int verbose = FALSE; /* verbose file outout */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t g_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -1389,8 +1428,13 @@ check_attribute_open_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -1510,6 +1554,7 @@ check_attribute_rename_tags(hid_t fcpl, int type) int verbose = FALSE; /* verbose file outout */ int *data = NULL; /* data buffer */ int i,j,k = 0; /* iterators */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t g_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -1530,8 +1575,13 @@ check_attribute_rename_tags(hid_t fcpl, int type) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -1689,6 +1739,7 @@ check_attribute_delete_tags(hid_t fcpl, int type) int verbose = FALSE; /* verbose file outout */ int *data = NULL; /* data buffer */ int i,j,k = 0; /* iterators */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t g_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -1709,8 +1760,13 @@ check_attribute_delete_tags(hid_t fcpl, int type) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -1847,6 +1903,7 @@ check_dataset_creation_tags(hid_t fcpl, int type) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -1859,7 +1916,12 @@ check_dataset_creation_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -1974,6 +2036,7 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -1987,7 +2050,12 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -2105,6 +2173,7 @@ check_dataset_open_tags(void) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -2117,8 +2186,13 @@ check_dataset_open_tags(void) /* Open File */ /* ========= */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -2225,6 +2299,7 @@ check_dataset_write_tags(void) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -2242,8 +2317,13 @@ check_dataset_write_tags(void) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -2360,6 +2440,7 @@ check_attribute_write_tags(hid_t fcpl, int type) int verbose = FALSE; /* verbose file outout */ int *data = NULL; /* data buffer */ int i,j,k = 0; /* iterators */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t g_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -2375,8 +2456,13 @@ check_attribute_write_tags(hid_t fcpl, int type) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -2508,6 +2594,7 @@ check_dataset_read_tags(void) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -2525,8 +2612,13 @@ check_dataset_read_tags(void) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -2639,6 +2731,7 @@ check_dataset_size_retrieval(void) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -2657,8 +2750,13 @@ check_dataset_size_retrieval(void) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -2772,6 +2870,7 @@ check_dataset_extend_tags(void) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -2790,8 +2889,13 @@ check_dataset_extend_tags(void) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -2900,6 +3004,7 @@ check_object_info_tags(void) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ int verbose = FALSE; /* verbose file output */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; haddr_t g_tag; H5O_info_t oinfo; /* Object info struct */ @@ -2911,8 +3016,13 @@ check_object_info_tags(void) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -3003,6 +3113,7 @@ check_object_copy_tags(void) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ int verbose = FALSE; /* verbose file output */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; haddr_t g_tag; haddr_t copy_tag; @@ -3014,8 +3125,13 @@ check_object_copy_tags(void) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -3121,6 +3237,7 @@ check_link_removal_tags(hid_t fcpl, int type) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; haddr_t g_tag = 0; @@ -3139,8 +3256,13 @@ check_link_removal_tags(hid_t fcpl, int type) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -3274,6 +3396,7 @@ check_link_getname_tags(void) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; haddr_t g_tag = 0; @@ -3292,8 +3415,13 @@ check_link_getname_tags(void) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -3414,6 +3542,7 @@ check_external_link_creation_tags(void) hid_t fid2 = -1; /* File Identifier */ hid_t gid = -1; /* Dataspace Identifier */ int verbose = FALSE; /* verbose file outout */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; /* Testing Macro */ @@ -3423,21 +3552,26 @@ check_external_link_creation_tags(void) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; /* Close and Reopen the file */ if ( H5Fclose(fid) < 0 ) TEST_ERROR; - if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl)) < 0 ) TEST_ERROR; /* Evict as much as we can from the cache so we can track full tag path */ if ( evict_entries(fid) < 0 ) TEST_ERROR; /* Create a second file */ - if ( (fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* Create group in second file */ if ( (gid = H5Gcreate2(fid2, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; @@ -3514,6 +3648,7 @@ check_external_link_open_tags(void) hid_t gid = -1; /* Dataspace Identifier */ hid_t xid = -1; /* Dataspace Identifier */ int verbose = FALSE; /* verbose file outout */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t root2_tag = 0; @@ -3524,14 +3659,19 @@ check_external_link_open_tags(void) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; /* Create a second file */ - if ( (fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid2, &root2_tag) < 0 ) TEST_ERROR; @@ -3599,7 +3739,7 @@ check_external_link_open_tags(void) /* =========================== */ /* Close open objects and file */ /* =========================== */ - if ( (H5Gclose(xid)) < 0 ) TEST_ERROR; + if ( H5Gclose(xid) < 0 ) TEST_ERROR; if ( H5Fclose(fid) < 0 ) TEST_ERROR; if ( H5Fclose(fid2) < 0 ) TEST_ERROR; @@ -3638,6 +3778,7 @@ check_invalid_tag_application(void) hid_t fid = -1; haddr_t addr; H5HL_t * lheap = NULL; + hid_t fapl = -1; /* File access prop list */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ #endif /* H5C_DO_TAGGING_SANITY_CHECKS */ @@ -3645,15 +3786,20 @@ check_invalid_tag_application(void) TESTING("failure on invalid tag application"); #if H5C_DO_TAGGING_SANITY_CHECKS + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* Push API context */ if(H5CX_push() < 0) TEST_ERROR api_ctx_pushed = TRUE; /* Get internal file pointer*/ - if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR; + if ( NULL == (f = (H5F_t *)H5VL_object(fid)) ) TEST_ERROR; /* Call H5HL_create, an internal function that calls H5AC_insert_entry without setting up a tag */ /* Ensure this returns FAILURE, as a tag has not been set up. */ @@ -3672,7 +3818,7 @@ check_invalid_tag_application(void) /* This should fail as no tag is set up during the protect call */ if (( lheap = H5HL_protect(f, addr, H5AC__NO_FLAGS_SET)) != NULL ) TEST_ERROR; - /* Again, set up a valid tag in the DXPL */ + /* Again, set up a valid tag in the API context */ H5AC_tag((haddr_t)25, NULL); /* Call H5HL_protect again to protect the local heap. This should succeed. */ @@ -3711,9 +3857,7 @@ error: * * Purpose: Run tests on library's ability to tag metadata entries. * - * Return: Success: - * - * Failure: + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Mike McGreevy * January 15, 2009 @@ -3755,12 +3899,12 @@ main(void) /* Run tests on each fcpl set up above. */ if (test_type == TEST_DEFAULT) { - if (!nerrs) printf("Testing standard tag application cases w/ default fcpl:\n"); + if (!nerrs) HDprintf("Testing standard tag application cases w/ default fcpl:\n"); fcpl = fcpl_default; } else if (test_type == TEST_SHMESG) { - if (!nerrs) printf("Testing standard tag application cases w/ shared messages:\n"); + if (!nerrs) HDprintf("Testing standard tag application cases w/ shared messages:\n"); fcpl = fcpl_shmesg_all; } else { @@ -3780,7 +3924,7 @@ main(void) if (!nerrs) nerrs += check_link_removal_tags(fcpl, test_type); } /* end for */ - if (!nerrs) printf("Testing other specific tag application cases:\n"); + if (!nerrs) HDprintf("Testing other specific tag application cases:\n"); if (!nerrs) nerrs += check_group_creation_tags(); if (!nerrs) nerrs += check_multi_group_creation_tags(); if (!nerrs) nerrs += check_group_open_tags(); @@ -3804,10 +3948,13 @@ main(void) HDremove(FILENAME2); /* Return Errors */ - return nerrs > 0; + if (nerrs > 0) + return EXIT_FAILURE; + else + return EXIT_SUCCESS; error: /* Return with Error */ - return 1; + return EXIT_FAILURE; } /* main */ diff --git a/test/chunk_info.c b/test/chunk_info.c deleted file mode 100644 index e3006cc..0000000 --- a/test/chunk_info.c +++ /dev/null @@ -1,150 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Programmer: Pedro Vicente <pvn@hdfgroup.edu> - * April 7, 2008 - * - * Purpose: Tests the H5Dget_chunk_info API function - * This program writes a 4x4 dataset by iterating on 2x2 chunks - * at a time - */ - - -#include "h5test.h" - -#define PRINT_DATA -#define H5FILE_NAME "chunk_info.h5" -#define DATASETNAME "2d" -#define RANK 2 - - -int main( void ) -{ - - hid_t fid; /* file ID */ - hid_t did; /* dataset ID */ - hid_t f_sid; /* file space ID */ - hid_t m_sid; /* memory space ID */ - hid_t pid; /* property list ID */ - hsize_t start[2]; /* chunk location to start writing */ - hsize_t dims[2] = { 4, 4}; - hsize_t chunk_dims[2] = { 2, 2 }; - int chunk_data[2][2] = { {1, 1}, {1, 1} }; - int buf[4][4]; - int fillvalue = 0; - int i, j, ii, jj; - - /* create a new file using default properties. */ - if ((fid = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; - /* create the file space */ - if ((f_sid = H5Screate_simple(RANK, dims, dims)) < 0) TEST_ERROR; - /* create the memory space with chunk dimensions */ - if ((m_sid = H5Screate_simple(RANK, chunk_dims, chunk_dims)) < 0) TEST_ERROR; - start[0] = 0; - start[1] = 0; - if (H5Sselect_hyperslab(m_sid, H5S_SELECT_SET, start, NULL, chunk_dims, NULL) < 0) TEST_ERROR; - - TESTING("chunk info"); - - /*------------------------------------------------------------------------- - * create a dataset - *------------------------------------------------------------------------- - */ - - /* modify dataset creation properties, i.e. enable chunking. */ - if ((pid = H5Pcreate (H5P_DATASET_CREATE)) < 0) TEST_ERROR; - if (H5Pset_chunk(pid, RANK, chunk_dims) < 0) TEST_ERROR; - if (H5Pset_fill_value(pid, H5T_NATIVE_INT, &fillvalue) < 0) TEST_ERROR; - - /* create a new dataset */ - if((did = H5Dcreate2(fid , DATASETNAME, H5T_NATIVE_INT, f_sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR; - - - /*------------------------------------------------------------------------- - * write the dataset in 2x2 chunks - *------------------------------------------------------------------------- - */ - - /* iterate in dim 0 */ - for (j = 0; j < chunk_dims[0]; j++) - { - - /* reset start in dim 1 */ - start[1] = 0; - - /* iterate in dim 1 */ - for (i = 0; i < chunk_dims[1]; i++) - { - - /* select file hyperslab to save a 2x2 chunk */ - if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, chunk_dims, NULL) < 0) TEST_ERROR; - - /* write the data to the hyperslab. */ - if (H5Dwrite(did, H5T_NATIVE_INT, m_sid, f_sid, H5P_DEFAULT, chunk_data) < 0) TEST_ERROR; - - /* read back and display complete dataset 4x4 */ - if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR; - - -#if defined (PRINT_DATA) - printf("\n"); - printf("dataset: \n"); - for (jj = 0; jj < dims[0]; jj++) { - for (ii = 0; ii < dims[1]; ii++) printf("%d ", buf[jj][ii]); - printf("\n"); - } -#endif - - - /* increment start in dim 1 */ - start[1] += 2; - - - } - - /* increment start in dim 0 */ - start[0] += 2; - } - - - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - - if (H5Dclose(did) < 0) TEST_ERROR - if (H5Sclose(f_sid) < 0) TEST_ERROR - if (H5Sclose(m_sid) < 0) TEST_ERROR - if (H5Pclose(pid) < 0) TEST_ERROR - if (H5Fclose(fid) < 0) TEST_ERROR - - PASSED(); - - puts("All chunk info tests passed."); - return 0; - - -error: - H5Dclose( did ); - H5Sclose( f_sid ); - H5Sclose( m_sid ); - H5Pclose( pid ); - H5Fclose( fid ); - H5_FAILED(); - return 1; -} - - - diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 5d6cfc7..b011bc2 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -2032,7 +2032,7 @@ error: *------------------------------------------------------------------------- */ static unsigned -test_ooo_order(char *filename) +test_ooo_order(char *filename, hid_t fapl_id) { hid_t file = -1; /* File ID */ hid_t dtype = -1; /* Datatype IDs */ @@ -2042,7 +2042,7 @@ test_ooo_order(char *filename) TESTING("that compound member insertion order is preserved") /* Create the file */ - if ((file = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((file = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR /* Create the compound */ @@ -2242,7 +2242,7 @@ main (int argc, char *argv[]) nerrors += test_pack_ooo(); puts("Testing compound member ordering:"); - nerrors += test_ooo_order(fname); + nerrors += test_ooo_order(fname, fapl_id); /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); diff --git a/test/dangle.c b/test/dangle.c index 75e9c84..9f30f10 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -602,7 +602,8 @@ test_dangle_force(void) TEST_ERROR; /* Allocate the array of object IDs */ - objs = (hid_t*)HDmalloc(sizeof(hid_t) * (size_t)count); + if(NULL == (objs = (hid_t *)HDcalloc((size_t)count, sizeof(hid_t)))) + TEST_ERROR; /* Get the list of open IDs */ if(H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)count, objs) < 0) diff --git a/test/dsets.c b/test/dsets.c index 092b616..292ea06 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -27,7 +27,6 @@ #include "testhdf5.h" #include "H5srcdir.h" -#include "H5Bprivate.h" #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" #include "H5Pprivate.h" @@ -827,7 +826,7 @@ test_compact_io(hid_t fapl) **************************************/ /* Create a copy of file access property list */ - if((new_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR + if((new_fapl = new_fapl = h5_fileaccess()) < 0) TEST_ERROR /* Loop through all the combinations of low/high library format bounds, skipping invalid combinations. @@ -878,10 +877,10 @@ test_compact_io(hid_t fapl) } /* end */ /* Get the internal file pointer */ - if((fp = (H5F_t *)H5I_object(verfile)) == NULL) TEST_ERROR + if((fp = (H5F_t *)H5VL_object(verfile)) == NULL) TEST_ERROR /* Get the internal dataset pointer */ - if((dsetp = (H5D_t *)H5I_object(dataset)) == NULL) TEST_ERROR + if((dsetp = (H5D_t *)H5VL_object(dataset)) == NULL) TEST_ERROR /* Verify the dataset's layout and fill message versions */ if(fp->shared->low_bound == H5F_LIBVER_EARLIEST) { @@ -1335,6 +1334,19 @@ test_conv_buffer(hid_t fid) return 0; error: + H5E_BEGIN_TRY { + H5Pclose(xfer_list); + H5Sclose(space); + H5Tclose(arr_type1); + H5Tclose(arr_type2); + H5Tclose(arr_type3); + H5Tclose(ctype1); + H5Tclose(ctype2); + H5Tclose(arr_type4); + H5Tclose(arr_type5); + H5Dclose(dataset); + } H5E_END_TRY; + return -1; } @@ -2517,8 +2529,7 @@ error: * * Purpose: Tests library behavior when filter is missing * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -2543,7 +2554,7 @@ test_missing_filter(hid_t file) /* Verify deflate filter is registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) { H5_FAILED(); - printf(" Line %d: Deflate filter not available\n",__LINE__); + HDprintf(" Line %d: Deflate filter not available\n",__LINE__); goto error; } /* end if */ @@ -2555,31 +2566,31 @@ test_missing_filter(hid_t file) /* (Use private routine, to avoid range checking on filter ID) */ if(H5Z__unregister(H5Z_FILTER_DEFLATE) < 0) { H5_FAILED(); - printf(" Line %d: Can't unregister deflate filter\n",__LINE__); + HDprintf(" Line %d: Can't unregister deflate filter\n",__LINE__); goto error; } /* end if */ #endif /* H5_HAVE_FILTER_DEFLATE */ /* Verify deflate filter is not registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=FALSE) { H5_FAILED(); - printf(" Line %d: Deflate filter available\n",__LINE__); + HDprintf(" Line %d: Deflate filter available\n",__LINE__); goto error; } /* end if */ /* Create dcpl with deflate filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Pset_deflate(dcpl, 9) < 0) { H5_FAILED(); - printf(" Line %d: Can't set deflate filter\n",__LINE__); + HDprintf(" Line %d: Can't set deflate filter\n",__LINE__); goto error; } /* end if */ @@ -2587,47 +2598,47 @@ test_missing_filter(hid_t file) ret=H5Pall_filters_avail(dcpl); if(ret<0) { H5_FAILED(); - printf(" Line %d: Can't check filter availability\n",__LINE__); + HDprintf(" Line %d: Can't check filter availability\n",__LINE__); goto error; } /* end if */ if(ret!=FALSE) { H5_FAILED(); - printf(" Line %d: Filter shouldn't be available\n",__LINE__); + HDprintf(" Line %d: Filter shouldn't be available\n",__LINE__); goto error; } /* end if */ /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_MISSING_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Flush the file (to clear the cache) */ if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) { H5_FAILED(); - printf(" Line %d: Error flushing file\n",__LINE__); + HDprintf(" Line %d: Error flushing file\n",__LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if(0 == (dset_size = H5Dget_storage_size(dsid))) { H5_FAILED(); - printf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ @@ -2635,14 +2646,14 @@ test_missing_filter(hid_t file) /* (i.e. the deflation filter we asked for was silently ignored) */ if((H5Tget_size(H5T_NATIVE_INT) * DSET_DIM1 * DSET_DIM2) != dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; } /* end if */ @@ -2652,10 +2663,10 @@ test_missing_filter(hid_t file) for(j=0; j<(size_t)dims[1]; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Line %d: Read different values than written.\n",__LINE__); - printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); - printf(" At original: %d\n",points[i][j]); - printf(" At returned: %d\n",check[i][j]); + HDprintf(" Line %d: Read different values than written.\n",__LINE__); + HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); + HDprintf(" At original: %d\n",points[i][j]); + HDprintf(" At returned: %d\n",check[i][j]); goto error; } /* end if */ } /* end for */ @@ -2664,21 +2675,21 @@ test_missing_filter(hid_t file) /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ @@ -2688,14 +2699,14 @@ test_missing_filter(hid_t file) /* Open existing file */ if((fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open existing deflated file\n", __LINE__); + HDprintf(" Line %d: Can't open existing deflated file\n", __LINE__); goto error; } /* end if */ /* Open dataset */ if((dsid = H5Dopen2(fid, "Dataset1", H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataset\n", __LINE__); + HDprintf(" Line %d: Can't open dataset\n", __LINE__); goto error; } /* end if */ @@ -2705,21 +2716,21 @@ test_missing_filter(hid_t file) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf(" Line %d: Should not be able to read dataset data\n", __LINE__); + HDprintf(" Line %d: Should not be able to read dataset data\n", __LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n", __LINE__); + HDprintf(" Line %d: Can't close dataset\n", __LINE__); goto error; } /* end if */ /* Close existing file */ if(H5Fclose(fid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close file\n", __LINE__); + HDprintf(" Line %d: Can't close file\n", __LINE__); goto error; } /* end if */ @@ -2727,21 +2738,21 @@ test_missing_filter(hid_t file) /* Verify deflate filter is not registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=FALSE) { H5_FAILED(); - printf(" Line %d: Deflate filter available\n",__LINE__); + HDprintf(" Line %d: Deflate filter available\n",__LINE__); goto error; } /* end if */ #ifdef H5_HAVE_FILTER_DEFLATE /* Register deflate filter (use internal function to avoid range checks) */ if(H5Z_register(H5Z_DEFLATE) < 0) { H5_FAILED(); - printf(" Line %d: Can't unregister deflate filter\n",__LINE__); + HDprintf(" Line %d: Can't unregister deflate filter\n",__LINE__); goto error; } /* end if */ /* Verify deflate filter is registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) { H5_FAILED(); - printf(" Line %d: Deflate filter not available\n",__LINE__); + HDprintf(" Line %d: Deflate filter not available\n",__LINE__); goto error; } /* end if */ #endif /* H5_HAVE_FILTER_DEFLATE */ @@ -2751,13 +2762,13 @@ test_missing_filter(hid_t file) api_ctx_pushed = FALSE; PASSED(); - return 0; + return SUCCEED; error: if(api_ctx_pushed) H5CX_pop(); - return -1; -} + return FAIL; +} /* end test_missing_filter() */ /*------------------------------------------------------------------------- @@ -8301,25 +8312,25 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) /* Loop over using SWMR access to write */ for(swmr = 0; swmr <= 1; swmr++) { - int compress; /* Whether chunks should be compressed */ + int compress; /* Whether chunks should be compressed */ /* SWMR is now supported with/without latest format: */ - /* (1) write+latest-format (2) SWMR-write+non-latest-format */ + /* (1) write+latest-format (2) SWMR-write+non-latest-format */ /* Skip this iteration if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if(swmr && !H5FD_supports_swmr_test(env_h5_driver)) + if(swmr && !H5FD__supports_swmr_test(env_h5_driver)) continue; #ifdef H5_HAVE_FILTER_DEFLATE /* Loop over compressing chunks */ for(compress = 0; compress <= 1; compress++) #else - /* Loop over without compression */ + /* Loop over without compression */ for(compress = 0; compress <= 0; compress++) #endif /* H5_HAVE_FILTER_DEFLATE */ - { + { H5D_alloc_time_t alloc_time; /* Storage allocation time */ /* Loop over storage allocation time */ @@ -10412,11 +10423,11 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if(!H5FD_supports_swmr_test(env_h5_driver)) { + if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); return 0; - } /* end if */ + } /* Check if we are using the latest version of the format */ if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) @@ -10428,7 +10439,8 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) /* Create file with write+latest-format */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - } else { + } + else { /* Create file with SWMR-write+non-latest-format */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -10661,11 +10673,11 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if(!H5FD_supports_swmr_test(env_h5_driver)) { + if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); return 0; - } /* end if */ + } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; @@ -10781,11 +10793,11 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if(!H5FD_supports_swmr_test(env_h5_driver)) { + if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); return 0; - } /* end if */ + } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; @@ -10901,11 +10913,11 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if(!H5FD_supports_swmr_test(env_h5_driver)) { + if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); return 0; - } /* end if */ + } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; @@ -12904,7 +12916,7 @@ error: #define SRC_DSET "src_dset" #define V_DSET "v_dset" static herr_t -test_versionbounds() +test_versionbounds(void) { hid_t fapl = -1; hid_t srcfile = -1; /* Files with source dsets */ diff --git a/test/dtypes.c b/test/dtypes.c index 3253d6c..7e5a992 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -6957,13 +6957,13 @@ test_delete_obj_named_fileid(hid_t fapl) /* Verify file ID from dataset matches correct file */ dset_fid = H5Iget_file_id(dset); - if(dset_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(dset_fid, filea1)) TEST_ERROR H5Fclose(dset_fid); /* Verify file ID from datatype (from dataset) matches correct file */ type = H5Dget_type(dset); type_fid = H5Iget_file_id(type); - if(type_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR H5Fclose(type_fid); H5Tclose(type); @@ -6979,13 +6979,13 @@ test_delete_obj_named_fileid(hid_t fapl) /* Verify file ID from dataset matches correct file */ dset_fid = H5Iget_file_id(dset); - if(dset_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(dset_fid, filea1)) TEST_ERROR H5Fclose(dset_fid); /* Verify file ID from datatype (from dataset) matches correct file */ type = H5Dget_type(dset); type_fid = H5Iget_file_id(type); - if(type_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR H5Fclose(type_fid); H5Tclose(type); @@ -7007,13 +7007,13 @@ test_delete_obj_named_fileid(hid_t fapl) /* Verify file ID from dataset matches correct file */ attr_fid = H5Iget_file_id(attr); - if(attr_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(attr_fid, filea1)) TEST_ERROR H5Fclose(attr_fid); /* Verify file ID from datatype (from dataset) matches correct file */ type = H5Aget_type(attr); type_fid = H5Iget_file_id(type); - if(type_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR H5Fclose(type_fid); H5Tclose(type); @@ -7029,13 +7029,13 @@ test_delete_obj_named_fileid(hid_t fapl) /* Verify file ID from dataset matches correct file */ attr_fid = H5Iget_file_id(attr); - if(attr_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(attr_fid, filea1)) TEST_ERROR H5Fclose(attr_fid); /* Verify file ID from datatype (from dataset) matches correct file */ type = H5Aget_type(attr); type_fid = H5Iget_file_id(type); - if(type_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR H5Fclose(type_fid); H5Tclose(type); diff --git a/test/earray.c b/test/earray.c index d72b3f5..bb258c7 100644 --- a/test/earray.c +++ b/test/earray.c @@ -27,6 +27,7 @@ /* Other private headers that this test requires */ #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5VMprivate.h" /* Vectors and arrays */ @@ -300,7 +301,7 @@ create_file(unsigned flags, hid_t fapl, hid_t *file, H5F_t **f) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5VL_object(*file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -433,7 +434,7 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5VL_object(*file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -521,18 +522,18 @@ verify_cparam(const H5EA_t *ea, const H5EA_create_t *cparam) /* Retrieve creation parameters */ HDmemset(&test_cparam, 0, sizeof(H5EA_create_t)); - if(H5EA_get_cparam_test(ea, &test_cparam) < 0) + if(H5EA__get_cparam_test(ea, &test_cparam) < 0) FAIL_STACK_ERROR /* Verify creation parameters */ - if(H5EA_cmp_cparam_test(cparam, &test_cparam)) + if(H5EA__cmp_cparam_test(cparam, &test_cparam)) TEST_ERROR /* Success */ - return(0); + return 0; error: - return(-1); + return -1; } /* verify_cparam() */ @@ -943,7 +944,7 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) + if(NULL == (f2 = (H5F_t *)H5VL_object(file2))) FAIL_STACK_ERROR /* Open the extensible array through the second file handle */ @@ -1089,7 +1090,7 @@ test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tpa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) + if(NULL == (f2 = (H5F_t *)H5VL_object(file2))) FAIL_STACK_ERROR /* Open the extensible array through the second file handle */ @@ -2398,7 +2399,7 @@ error: H5E_BEGIN_TRY { if(ea) H5EA_close(ea); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; diff --git a/test/echo_vol.c b/test/echo_vol.c new file mode 100644 index 0000000..7f59832 --- /dev/null +++ b/test/echo_vol.c @@ -0,0 +1,127 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: A simple virtual object layer (VOL) plugin that just echoes + * the name of the API call. + */ + +#include "H5PLextern.h" + +/* The VOL class struct. + */ +static const H5VL_class_t echo_vol_g = { + 0, /* version */ + (H5VL_class_value_t)501, /* value */ + "echo", /* name */ + 0, /* capability flags */ + NULL, /* initialize */ + NULL, /* terminate */ + (size_t)0, /* info size */ + NULL, /* info copy */ + NULL, /* info compare */ + NULL, /* info free */ + NULL, /* info to str */ + NULL, /* str to info */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* wrap_object */ + NULL, /* free_wrap_ctx */ + { /* attribute_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* dataset_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* datatype_cls */ + NULL, /* commit */ + NULL, /* open */ + NULL, /* get_size */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* file_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* group_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* link_cls */ + NULL, /* create */ + NULL, /* copy */ + NULL, /* move */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { /* object_cls */ + NULL, /* open */ + NULL, /* copy */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { /* request_cls */ + NULL, /* wait */ + NULL, /* notify */ + NULL, /* cancel */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* free */ + }, + NULL /* optional */ +}; + + + +/* These two functions are necessary to load this plugin using + * the HDF5 library. + */ + +H5PL_type_t +H5PLget_plugin_type(void) +{ + return H5PL_TYPE_VOL; +} + + +const void* +H5PLget_plugin_info(void) +{ + return &echo_vol_g; +} + @@ -2885,8 +2885,7 @@ error: * * Purpose: Test the external file cache code * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Neil Fortner * December 16, 2010 @@ -2900,7 +2899,7 @@ main(void) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Test Setup */ - puts("Testing the external file cache"); + HDputs("Testing the external file cache"); /* Create property lists */ fcpl_id = H5Pcreate(H5P_FILE_CREATE); @@ -2937,14 +2936,14 @@ main(void) if(nerrors) goto error; - puts("All external file cache tests passed."); + HDputs("All external file cache tests passed."); h5_clean_files(FILENAME, fapl_id); - return 0; + return EXIT_SUCCESS; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Pclose(fapl_id); @@ -2952,6 +2951,6 @@ error: if(api_ctx_pushed) H5CX_pop(); - return 1; + return EXIT_FAILURE; } /* end main() */ diff --git a/test/enc_dec_plist_cross_platform.c b/test/enc_dec_plist_cross_platform.c index 1fbb41b..15c7391 100644 --- a/test/enc_dec_plist_cross_platform.c +++ b/test/enc_dec_plist_cross_platform.c @@ -28,7 +28,7 @@ int main(void) { if(VERBOSE_MED) - printf("Encode/Decode property list endianess\n"); + HDprintf("Encode/Decode property list endianess\n"); /******* ENCODE/DECODE DCPLS *****/ TESTING("Default DCPL Encoding/Decoding"); @@ -227,7 +227,7 @@ test_plists(const char *filename_prefix) return 1; error: - printf("***** Plist Encode/Decode tests FAILED! *****\n"); + HDprintf("***** Plist Encode/Decode tests FAILED! *****\n"); return -1; } diff --git a/test/err_compat.c b/test/err_compat.c index eee150b..4860a3c 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -469,7 +469,7 @@ main(void) char filename[1024]; const char *FUNC_main="main"; - fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There're supposed to be some error messages\n"); + fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n"); fapl = h5_fileaccess(); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); diff --git a/test/evict_on_close.c b/test/evict_on_close.c index 6536837..9918829 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Dana Robinson - * Spring 2016 - * - * Purpose: Tests the basic operation of the evict-on-close cache +/* Purpose: Tests the basic operation of the evict-on-close cache * behavior. Tests that ensure the tagging is handled correctly * are located in cache.c. */ @@ -36,6 +32,7 @@ #include "H5Fpkg.h" #include "H5Gpkg.h" #include "H5Ipkg.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Evict on close is not supported under parallel at this time. * In the meantime, we just run a simple check that EoC can't be @@ -91,9 +88,6 @@ static herr_t check_group_layout(hid_t fid, const char *group_name); * * Return: TRUE/FALSE * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static hbool_t @@ -114,8 +108,8 @@ verify_tag_not_in_cache(H5F_t *f, haddr_t tag) return TRUE; else entry_ptr = entry_ptr->ht_next; - } /* end while */ - } /* end for */ + } + } return FALSE; } /* end verify_tag_not_in_cache() */ @@ -129,9 +123,6 @@ verify_tag_not_in_cache(H5F_t *f, haddr_t tag) * Return: Success: The file ID of the created file * Failure: -1 * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static hid_t @@ -207,7 +198,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; if(H5Gclose(gid2) < 0) TEST_ERROR; - } /* end for */ + } if(H5Gclose(gid1) < 0) TEST_ERROR; @@ -303,7 +294,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; if(H5Gclose(gid2) < 0) TEST_ERROR; - } /* end for */ + } if(H5Gclose(gid1) < 0) TEST_ERROR; @@ -593,9 +584,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -611,7 +599,7 @@ check_group_layout(hid_t fid, const char *group_name) /* NOTE: The TESTING() macro is called in main() */ /* Get a pointer to the file struct */ - if(NULL == (file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE))) + if(NULL == (file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE))) TEST_ERROR; /* Record the number of cache entries */ @@ -627,7 +615,7 @@ check_group_layout(hid_t fid, const char *group_name) /* Open the main group and get its tag */ if((gid1 = H5Gopen2(fid, group_name, H5P_DEFAULT)) < 0) TEST_ERROR; - if(NULL == (grp_ptr = (H5G_t *)H5I_object_verify(gid1, H5I_GROUP))) + if(NULL == (grp_ptr = (H5G_t *)H5VL_object_verify(gid1, H5I_GROUP))) TEST_ERROR; tag1 = grp_ptr->oloc.addr; @@ -644,7 +632,7 @@ check_group_layout(hid_t fid, const char *group_name) if((gid2 = H5Gopen2(gid1, subgroup_name, H5P_DEFAULT)) < 0) TEST_ERROR; - if(NULL == (grp_ptr = (H5G_t *)H5I_object_verify(gid2, H5I_GROUP))) + if(NULL == (grp_ptr = (H5G_t *)H5VL_object_verify(gid2, H5I_GROUP))) TEST_ERROR; tag2 = grp_ptr->oloc.addr; @@ -710,9 +698,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -728,7 +713,7 @@ check_dset_scheme(hid_t fid, const char *dset_name) /* NOTE: The TESTING() macro is called in main() */ /* Get a pointer to the file struct */ - if(NULL == (file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE))) + if(NULL == (file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE))) TEST_ERROR; /* Create the data buffer */ @@ -748,7 +733,7 @@ check_dset_scheme(hid_t fid, const char *dset_name) /* Open dataset and get the metadata tag */ if((did = H5Dopen2(fid, dset_name, H5P_DEFAULT)) < 0) TEST_ERROR; - if(NULL == (dset_ptr = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset_ptr = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) TEST_ERROR; tag = dset_ptr->oloc.addr; @@ -815,9 +800,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -873,7 +855,7 @@ check_evict_on_close_api(void) /* ensure an invalid plist fails */ H5E_BEGIN_TRY { - status = H5Pget_evict_on_close((hid_t)-1, &evict_on_close); + status = H5Pget_evict_on_close(H5I_INVALID_HID, &evict_on_close); } H5E_END_TRY; if(status >= 0) FAIL_PUTS_ERROR("H5Pget_evict_on_close() accepted invalid hid_t."); @@ -897,9 +879,6 @@ error: * * Return: EXIT_FAILURE/EXIT_SUCCESS * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ int @@ -979,7 +958,7 @@ main(void) HDprintf("All evict-on-close tests passed.\n"); - return EXIT_SUCCESS; + HDexit(EXIT_SUCCESS); error: @@ -992,7 +971,7 @@ error: H5Pclose(fapl_id); } H5E_END_TRY; - return EXIT_FAILURE; + HDexit(EXIT_FAILURE); } /* end main() */ @@ -1007,9 +986,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Spring 2017 - * *------------------------------------------------------------------------- */ static herr_t @@ -1052,9 +1028,6 @@ error: * * Return: EXIT_FAILURE/EXIT_SUCCESS * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ int @@ -1076,14 +1049,14 @@ main(void) HDprintf("All evict-on-close tests passed.\n"); HDprintf("Note that EoC is not supported under parallel so most tests are skipped.\n"); - return EXIT_SUCCESS; + HDexit(EXIT_SUCCESS); error: HDprintf("***** %u evict-on-close test%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); - return EXIT_FAILURE; + HDexit(EXIT_FAILURE); } /* main() - parallel */ diff --git a/test/farray.c b/test/farray.c index 383cb32..c9584b8 100644 --- a/test/farray.c +++ b/test/farray.c @@ -25,9 +25,10 @@ #include "H5FApkg.h" /* Fixed Arrays */ /* Other private headers that this test requires */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Iprivate.h" /* IDs */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Iprivate.h" /* IDs */ +#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Local macros */ @@ -113,121 +114,116 @@ h5_stat_size_t empty_size_g; /*------------------------------------------------------------------------- - * Function: init_cparam + * Function: init_cparam * - * Purpose: Initialize array creation parameter structure + * Purpose: Initialize array creation parameter structure * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t init_cparam(H5FA_create_t *cparam, farray_test_param_t *tparam) { /* Wipe out background */ HDmemset(cparam, 0, sizeof(*cparam)); - cparam->cls = H5FA_CLS_TEST; - cparam->raw_elmt_size = ELMT_SIZE; - cparam->max_dblk_page_nelmts_bits = MAX_DBLOCK_PAGE_NELMTS_BITS; - cparam->nelmts = tparam->nelmts; + cparam->cls = H5FA_CLS_TEST; + cparam->raw_elmt_size = ELMT_SIZE; + cparam->max_dblk_page_nelmts_bits = MAX_DBLOCK_PAGE_NELMTS_BITS; + cparam->nelmts = tparam->nelmts; - return(0); + return SUCCEED; } /* init_cparam() */ /*------------------------------------------------------------------------- - * Function: create_file + * Function: create_file * - * Purpose: Create file and retrieve pointer to internal file object - * - * Return: Success: 0 - * Failure: -1 + * Purpose: Create file and retrieve pointer to internal file object * + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ -static int -create_file(hid_t fapl, hid_t *file, H5F_t **f) +static herr_t +create_file(hid_t fapl_id, hid_t *fid, H5F_t **f) { /* Create the file to work on */ - if((*file = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR + if ((*fid = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) - FAIL_STACK_ERROR + if (NULL == (*f = (H5F_t *)H5VL_object(*fid))) + FAIL_STACK_ERROR; /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(*f) < 0) - FAIL_STACK_ERROR + if (H5AC_ignore_tags(*f) < 0) + FAIL_STACK_ERROR; /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* create_file() */ /*------------------------------------------------------------------------- - * Function: check_stats + * Function: check_stats * - * Purpose: Verify stats for a fixed array + * Purpose: Verify stats for a fixed array * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t check_stats(const H5FA_t *fa, const farray_state_t *state) { H5FA_stat_t farray_stats; /* Statistics about the array */ /* Get statistics for fixed array and verify they are correct */ - if(H5FA_get_stats(fa, &farray_stats) < 0) + if (H5FA_get_stats(fa, &farray_stats) < 0) FAIL_STACK_ERROR /* Compare information */ - if(farray_stats.hdr_size != state->hdr_size) { + if (farray_stats.hdr_size != state->hdr_size) { HDfprintf(stdout, "farray_stats.hdr_size = %Hu, state->hdr_size = %Hu\n", farray_stats.hdr_size, state->hdr_size); TEST_ERROR - } /* end if */ + } - if(farray_stats.dblk_size != state->dblk_size) { + if (farray_stats.dblk_size != state->dblk_size) { HDfprintf(stdout, "farray_stats.dblk_size = %Hu, state->dblk_size = %Hu\n", farray_stats.dblk_size, state->dblk_size); TEST_ERROR - } /* end if */ + } - if(farray_stats.nelmts != state->nelmts) { + if (farray_stats.nelmts != state->nelmts) { HDfprintf(stdout, "farray_stats.nelmts = %Hu, state->nelmts = %Hu\n", farray_stats.nelmts, state->nelmts); TEST_ERROR - } /* end if */ + } - /* All tests passed */ - return(0); + /* Success */ + return SUCCEED; error: - return(-1); + return FAIL; } /* check_stats() */ /*------------------------------------------------------------------------- - * Function: set_fa_state - * - * Purpose: Set the state of the Fixed Array + * Function: set_fa_state * - * Return: does not fail + * Purpose: Set the state of the Fixed Array * - * Programmer: Vailin Choi; 5th August, 2009 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t set_fa_state(const H5FA_create_t *cparam, farray_state_t *state) { size_t dblk_page_nelmts; /* # of elements per page */ @@ -241,190 +237,190 @@ set_fa_state(const H5FA_create_t *cparam, farray_state_t *state) state->nelmts = cparam->nelmts; dblk_page_nelmts = (size_t)1 << cparam->max_dblk_page_nelmts_bits; - if(state->nelmts > dblk_page_nelmts) { - size_t npages = (size_t)(((state->nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); - size_t dblk_page_init_size = (npages + 7) / 8; - hsize_t checksum_size = npages * 4; + if (state->nelmts > dblk_page_nelmts) { + size_t npages = (size_t)(((state->nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); + size_t dblk_page_init_size = (npages + 7) / 8; + hsize_t checksum_size = npages * 4; - state->dblk_size = DBLOCK_PREFIX + dblk_page_init_size + checksum_size + + state->dblk_size = DBLOCK_PREFIX + dblk_page_init_size + checksum_size + state->nelmts * cparam->raw_elmt_size; - } else - state->dblk_size = DBLOCK_PREFIX + state->nelmts * cparam->raw_elmt_size; + } + else + state->dblk_size = DBLOCK_PREFIX + state->nelmts * cparam->raw_elmt_size; - return(0); + return SUCCEED; } /* end set_fa_state() */ /*------------------------------------------------------------------------- - * Function: reopen_file + * Function: reopen_file * - * Purpose: Perform common "re-open" operations on file & array for testing + * Purpose: Perform common "re-open" operations on file & array for testing * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static int -reopen_file(hid_t *file, H5F_t **f, hid_t fapl, +reopen_file(hid_t *fid, H5F_t **f, hid_t fapl_id, H5FA_t **fa, haddr_t fa_addr, const farray_test_param_t *tparam) { /* Check for closing & re-opening the array */ /* (actually will close & re-open the file as well) */ - if(tparam->reopen_array) { + if (tparam->reopen_array) { + /* Close array, if given */ - if(fa && *fa) { - if(H5FA_close(*fa) < 0) + if (fa && *fa) { + if (H5FA_close(*fa) < 0) FAIL_STACK_ERROR *fa = NULL; - } /* end if */ + } /* Close file */ - if(*file) { - if(H5Fclose(*file) < 0) + if (*fid) { + if (H5Fclose(*fid) < 0) FAIL_STACK_ERROR - *file = (-1); + *fid = H5I_INVALID_HID; *f = NULL; - } /* end if */ + } /* Re-open the file */ - if((*file = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + if ((*fid = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) - FAIL_STACK_ERROR + if (NULL == (*f = (H5F_t *)H5VL_object(*fid))) + FAIL_STACK_ERROR; /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(*f) < 0) + if (H5AC_ignore_tags(*f) < 0) FAIL_STACK_ERROR /* Re-open array, if given */ - if(fa) - if(NULL == (*fa = H5FA_open(*f, fa_addr, NULL))) + if (fa) + if (NULL == (*fa = H5FA_open(*f, fa_addr, NULL))) FAIL_STACK_ERROR - } /* end if */ + } /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* reopen_file() */ /*------------------------------------------------------------------------- - * Function: create_array + * Function: create_array * - * Purpose: Create a fixed array and perform initial checks + * Purpose: Create a fixed array and perform initial checks * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t create_array(H5F_t *f, const H5FA_create_t *cparam, H5FA_t **fa, haddr_t *fa_addr) { farray_state_t state; /* State of extensible array */ /* Create array */ - if(NULL == (*fa = H5FA_create(f, cparam, NULL))) + if (NULL == (*fa = H5FA_create(f, cparam, NULL))) FAIL_STACK_ERROR /* Check status of array */ - if(H5FA_get_addr(*fa, fa_addr) < 0) + if (H5FA_get_addr(*fa, fa_addr) < 0) FAIL_STACK_ERROR - if(!H5F_addr_defined(*fa_addr)) + if (!H5F_addr_defined(*fa_addr)) TEST_ERROR + + /* Check array stats */ HDmemset(&state, 0, sizeof(state)); - state.hdr_size = FA_HDR_SIZE; - state.nelmts = cparam->nelmts; - if(check_stats(*fa, &state)) + state.hdr_size = FA_HDR_SIZE; + state.nelmts = cparam->nelmts; + if (check_stats(*fa, &state)) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* create_array() */ /*------------------------------------------------------------------------- - * Function: verify_cparam + * Function: verify_cparam * - * Purpose: Verify creation parameters are correct + * Purpose: Verify creation parameters are correct * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t verify_cparam(const H5FA_t *fa, const H5FA_create_t *cparam) { H5FA_create_t test_cparam; /* Creation parameters for array */ /* Retrieve creation parameters */ HDmemset(&test_cparam, 0, sizeof(H5FA_create_t)); - if(H5FA_get_cparam_test(fa, &test_cparam) < 0) + if (H5FA__get_cparam_test(fa, &test_cparam) < 0) FAIL_STACK_ERROR /* Verify creation parameters */ - if(H5FA_cmp_cparam_test(cparam, &test_cparam)) + if (H5FA__cmp_cparam_test(cparam, &test_cparam)) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* verify_cparam() */ /*------------------------------------------------------------------------- - * Function: finish + * Function: finish * - * Purpose: Close array, delete array, close file and verify that file + * Purpose: Close array, delete array, close file and verify that file * is empty size * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int -finish(hid_t file, hid_t fapl, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) +static herr_t +finish(hid_t fid, hid_t fapl_id, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) { h5_stat_size_t file_size; /* File size, after deleting array */ /* Close the fixed array */ - if(H5FA_close(fa) < 0) + if (H5FA_close(fa) < 0) FAIL_STACK_ERROR /* Delete array */ - if(H5FA_delete(f, fa_addr, NULL) < 0) + if (H5FA_delete(f, fa_addr, NULL) < 0) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(file) < 0) + if (H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size = h5_get_file_size(filename_g, fapl)) < 0) + if ((file_size = h5_get_file_size(filename_g, fapl_id)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size != empty_size_g) + if (file_size != empty_size_g) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* finish() */ @@ -627,66 +623,64 @@ error: *------------------------------------------------------------------------- */ static unsigned -test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) +test_open_twice(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - hid_t file2 = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5F_t *f2 = NULL; /* Internal file object pointer */ - H5FA_t *fa = NULL; /* Fixed array wrapper */ - H5FA_t *fa2 = NULL; /* Fixed array wrapper */ - haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ + H5FA_t *fa = NULL; /* Fixed array wrapper */ + H5FA_t *fa2 = NULL; /* Fixed array wrapper */ + haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ /* Create file & retrieve pointer to internal file object */ - if(create_file(fapl, &file, &f) < 0) + if (create_file(fapl_id, &fid, &f) < 0) TEST_ERROR - /* - * Display testing message - */ + /* Display testing message */ TESTING("open fixed array twice"); /* Create array */ - if(create_array(f, cparam, &fa, &fa_addr) < 0) + if (create_array(f, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Open the array again, through the first file handle */ - if(NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa, cparam) < 0) + if (verify_cparam(fa, cparam) < 0) TEST_ERROR - if(verify_cparam(fa2, cparam) < 0) + if (verify_cparam(fa2, cparam) < 0) TEST_ERROR /* Close the second fixed array wrapper */ - if(H5FA_close(fa2) < 0) + if (H5FA_close(fa2) < 0) FAIL_STACK_ERROR fa2 = NULL; /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0) + if (reopen_file(&fid, &f, fapl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Re-open the file */ - if((file2 = H5Freopen(file)) < 0) + if ((fid2 = H5Freopen(fid)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) - FAIL_STACK_ERROR + if (NULL == (f2 = (H5F_t *)H5VL_object(fid2))) + FAIL_STACK_ERROR; /* Open the fixed array through the second file handle */ - if(NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa, cparam) < 0) + if (verify_cparam(fa, cparam) < 0) TEST_ERROR /* Close the first extensible array wrapper */ - if(H5FA_close(fa) < 0) + if (H5FA_close(fa) < 0) FAIL_STACK_ERROR fa = NULL; @@ -694,11 +688,11 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) /* (close before second file, to detect error on internal array header's * shared file information) */ - if(H5Fclose(file) < 0) + if (H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Close array, delete array, close file & verify file is empty */ - if(finish(file2, fapl, f2, fa2, fa_addr) < 0) + if (finish(fid2, fapl_id, f2, fa2, fa_addr) < 0) TEST_ERROR /* All tests passed */ @@ -708,12 +702,12 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) error: H5E_BEGIN_TRY { - if(fa) + if (fa) H5FA_close(fa); - if(fa2) + if (fa2) H5FA_close(fa2); - H5Fclose(file); - H5Fclose(file2); + H5Fclose(fid); + H5Fclose(fid2); } H5E_END_TRY; return 1; @@ -736,44 +730,42 @@ error: *------------------------------------------------------------------------- */ static unsigned -test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) +test_open_twice_diff(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tparam) { - char filename_tmp[FARRAY_FILENAME_LEN]; /* Temporary file name */ - hid_t file = -1; /* File ID */ - hid_t file2 = -1; /* File ID */ - hid_t file0 = -1; /* File ID */ - hid_t file00 = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5F_t *f2 = NULL; /* Internal file object pointer */ - H5FA_t *fa = NULL; /* Fixed array wrapper */ - H5FA_t *fa2 = NULL; /* Fixed array wrapper */ - haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ - - /* - * Display testing message - */ + char filename_tmp[FARRAY_FILENAME_LEN]; /* Temporary file name */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + hid_t fid0 = H5I_INVALID_HID; /* File ID */ + hid_t fid00 = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ + H5FA_t *fa = NULL; /* Fixed array wrapper */ + H5FA_t *fa2 = NULL; /* Fixed array wrapper */ + haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ + + /* Display testing message */ TESTING("open fixed array twice, through different file handles"); /* Create file & retrieve pointer to internal file object */ - if(create_file(fapl, &file, &f) < 0) + if (create_file(fapl_id, &fid, &f) < 0) TEST_ERROR /* Create array */ - if(create_array(f, cparam, &fa, &fa_addr) < 0) + if (create_array(f, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Open the array again, through the first file handle */ - if(NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa, cparam) < 0) + if (verify_cparam(fa, cparam) < 0) TEST_ERROR - if(verify_cparam(fa2, cparam) < 0) + if (verify_cparam(fa2, cparam) < 0) TEST_ERROR /* Close the second fixed array wrapper */ - if(H5FA_close(fa2) < 0) + if (H5FA_close(fa2) < 0) FAIL_STACK_ERROR fa2 = NULL; @@ -781,15 +773,15 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa /* (So that there is something holding the file open when the extensible * array is closed) */ - if((file0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + if ((fid0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0) + if (reopen_file(&fid, &f, fapl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Close the first fixed array wrapper */ - if(H5FA_close(fa) < 0) + if (H5FA_close(fa) < 0) FAIL_STACK_ERROR fa = NULL; @@ -797,44 +789,43 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa /* (close before second file, to detect error on internal array header's * shared file information) */ - if(H5Fclose(file) < 0) + if (H5Fclose(fid) < 0) FAIL_STACK_ERROR - file = -1; + fid = H5I_INVALID_HID; /* Open a different file */ /* (This re-allocates the 'top' file pointer and assigns it a different * 'shared' file pointer, making the file pointer in the fixed array's * header stale) */ - h5_fixname(FILENAME[1], fapl, filename_tmp, sizeof(filename_tmp)); - if((file00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + h5_fixname(FILENAME[1], fapl_id, filename_tmp, sizeof(filename_tmp)); + if ((fid00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) FAIL_STACK_ERROR - /* Re-open the file with the fixed array */ - if((file2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + if ((fid2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) - FAIL_STACK_ERROR + if (NULL == (f2 = (H5F_t *)H5VL_object(fid2))) + FAIL_STACK_ERROR; /* Open the fixed array through the second file handle */ - if(NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa2, cparam) < 0) + if (verify_cparam(fa2, cparam) < 0) TEST_ERROR /* Close the extra file handles */ - if(H5Fclose(file0) < 0) + if (H5Fclose(fid0) < 0) FAIL_STACK_ERROR - if(H5Fclose(file00) < 0) + if (H5Fclose(fid00) < 0) FAIL_STACK_ERROR /* Close array, delete array, close file & verify file is empty */ - if(finish(file2, fapl, f2, fa2, fa_addr) < 0) + if (finish(fid2, fapl_id, f2, fa2, fa_addr) < 0) TEST_ERROR /* All tests passed */ @@ -844,14 +835,14 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa error: H5E_BEGIN_TRY { - if(fa) + if (fa) H5FA_close(fa); - if(fa2) + if (fa2) H5FA_close(fa2); - H5Fclose(file); - H5Fclose(file2); - H5Fclose(file0); - H5Fclose(file00); + H5Fclose(fid); + H5Fclose(fid2); + H5Fclose(fid0); + H5Fclose(fid00); } H5E_END_TRY; return 1; @@ -966,7 +957,7 @@ error: H5FA_close(fa); if(fa2) H5FA_close(fa2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; @@ -1666,7 +1657,7 @@ main(void) fapl = h5_fileaccess(); ExpressMode = GetTestExpress(); if(ExpressMode > 1) - printf("***Express test mode on. Some tests may be skipped\n"); + HDprintf("***Express test mode on. Some tests may be skipped\n"); /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g)); @@ -1706,12 +1697,12 @@ main(void) switch(curr_test) { /* "Normal" testing parameters */ case FARRAY_TEST_NORMAL: - puts("Testing with NORMAL PARAMETERS"); + HDputs("Testing with NORMAL PARAMETERS"); break; /* "Re-open array" testing parameters */ case FARRAY_TEST_REOPEN: - puts("Testing with reopen array flag set"); + HDputs("Testing with reopen array flag set"); tparam.reopen_array = FARRAY_TEST_REOPEN; break; @@ -1738,25 +1729,25 @@ main(void) switch(curr_iter) { /* "Forward" testing parameters */ case FARRAY_ITER_FW: - puts("Testing with forward iteration"); + HDputs("Testing with forward iteration"); tparam.fiter = &fa_iter_fw; break; /* "Reverse" testing parameters */ case FARRAY_ITER_RV: - puts("Testing with reverse iteration"); + HDputs("Testing with reverse iteration"); tparam.fiter = &fa_iter_rv; break; /* "Random" testing parameters */ case FARRAY_ITER_RND: - puts("Testing with random iteration"); + HDputs("Testing with random iteration"); tparam.fiter = &fa_iter_rnd; break; /* "Cyclic" testing parameters */ case FARRAY_ITER_CYC: - puts("Testing with cyclic iteration"); + HDputs("Testing with cyclic iteration"); tparam.fiter = &fa_iter_cyc; break; @@ -1772,22 +1763,26 @@ main(void) nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)tparam.nelmts, "setting all the array elements"); } /* end for */ - /* Check skipping elements */ + /* Check skipping elements */ nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)1, TRUE, "skipping to first element"); nerrors += test_skip_elmts(fapl, &cparam, &tparam, ((hsize_t)1 << cparam.max_dblk_page_nelmts_bits), TRUE, "skipping to first element in data block page"); nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), TRUE, "skipping to last element"); - /* Create Fixed Array of MAX_NELMTS elements */ - /* - * MAX_NELMTS succeeds on jam and smirom. - * The value was adjusted for linew due to the following: - Linew failed with "H5FD_sec2_truncate(): unable to extend file properly" - Linew failed with "H5FD_sec2_truncate(): File too large" - */ + /* Create Fixed Array */ + /* MAX_NELMTS succeeds on some platforms buy may fail on others: + * + * "H5FD_sec2_truncate(): unable to extend file properly" + * + * and + * + * "H5FD_sec2_truncate(): File too large" + * + * have both been seen. + */ tparam.nelmts = MAX_NELMTS/17; - init_cparam(&cparam, &tparam); + init_cparam(&cparam, &tparam); - /* Set the last element in the Fixed Array */ + /* Set the last element in the Fixed Array */ nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), FALSE, "skipping to last element"); } /* end for */ @@ -1800,22 +1795,22 @@ main(void) if(nerrors) goto error; - puts("All fixed array tests passed."); + HDputs("All fixed array tests passed."); /* Clean up file used */ h5_cleanup(FILENAME, fapl); - return 0; + HDexit(EXIT_SUCCESS); error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { - H5Pclose(fapl); + H5Pclose(fapl); } H5E_END_TRY; if(api_ctx_pushed) H5CX_pop(); - return 1; + HDexit(EXIT_FAILURE); } /* end main() */ diff --git a/test/fheap.c b/test/fheap.c index e38d263..c7f6ff0 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -30,9 +30,9 @@ /* Other private headers that this test requires */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VMprivate.h" /* Vectors and arrays */ /* Max. testfile name length */ #define FHEAP_FILENAME_LEN 1024 @@ -605,7 +605,7 @@ reopen_file(hid_t *file, H5F_t **f, const char *filename, hid_t fapl, FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5VL_object(*file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -656,7 +656,7 @@ open_heap(char *filename, hid_t fapl, const H5HF_create_t *cparam, /* Check for deleting the entire heap */ if(tparam->del_dir != FHEAP_DEL_HEAP) { /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5VL_object(*file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -698,7 +698,7 @@ open_heap(char *filename, hid_t fapl, const H5HF_create_t *cparam, FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5VL_object(*file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -1868,7 +1868,7 @@ test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -1986,7 +1986,7 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR if(f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE) @@ -2032,7 +2032,7 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2140,7 +2140,7 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR if(f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE) @@ -2195,7 +2195,7 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) + if(NULL == (f2 = (H5F_t *)H5VL_object(file2))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2314,7 +2314,7 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2387,7 +2387,7 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2472,7 +2472,7 @@ test_id_limits(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2814,7 +2814,7 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2857,7 +2857,7 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2936,7 +2936,7 @@ test_size(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2990,7 +2990,7 @@ test_size(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3037,7 +3037,7 @@ error: H5E_BEGIN_TRY { if(fh) H5HF_close(fh); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_size() */ @@ -3078,7 +3078,7 @@ test_reopen_hdr(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file1))) + if(NULL == (f = (H5F_t *)H5VL_object(file1))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3122,7 +3122,7 @@ test_reopen_hdr(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) FAIL_STACK_ERROR /* Get a pointer to the internal file object (file1) */ - if(NULL == (f = (H5F_t *)H5I_object(file1))) + if(NULL == (f = (H5F_t *)H5VL_object(file1))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3144,7 +3144,7 @@ test_reopen_hdr(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) /* Get a pointer to the internal file object (file2) */ - if(NULL == (f = (H5F_t *)H5I_object(file2))) + if(NULL == (f = (H5F_t *)H5VL_object(file2))) FAIL_STACK_ERROR /* Reopen the heap */ @@ -3216,7 +3216,7 @@ test_man_insert_weird(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3325,7 +3325,7 @@ test_man_insert_first(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3425,7 +3425,7 @@ test_man_insert_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3521,7 +3521,7 @@ test_man_insert_root_mult(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3619,7 +3619,7 @@ test_man_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_par TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3724,7 +3724,7 @@ test_man_insert_fill_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3830,7 +3830,7 @@ test_man_insert_third_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3940,7 +3940,7 @@ test_man_fill_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4035,7 +4035,7 @@ test_man_start_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4137,7 +4137,7 @@ test_man_fill_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4237,7 +4237,7 @@ test_man_start_third_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4347,7 +4347,7 @@ test_man_fill_fourth_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4443,7 +4443,7 @@ test_man_fill_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4538,7 +4538,7 @@ test_man_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_ TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4639,7 +4639,7 @@ test_man_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhe TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4748,7 +4748,7 @@ test_man_fill_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_ TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4850,7 +4850,7 @@ test_man_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4960,7 +4960,7 @@ test_man_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5067,7 +5067,7 @@ test_man_fill_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fheap_te TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Create absolute heap */ @@ -5164,7 +5164,7 @@ test_man_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5272,7 +5272,7 @@ test_man_recursive_indirect_two_deep(hid_t fapl, H5HF_create_t *cparam, fheap_te TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5374,7 +5374,7 @@ test_man_start_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5483,7 +5483,7 @@ test_man_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5593,7 +5593,7 @@ test_man_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5699,7 +5699,7 @@ test_man_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5806,7 +5806,7 @@ test_man_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5920,7 +5920,7 @@ test_man_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6039,7 +6039,7 @@ test_man_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6150,7 +6150,7 @@ test_man_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6264,7 +6264,7 @@ test_man_start_5th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6397,7 +6397,7 @@ test_man_remove_bogus(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6549,7 +6549,7 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6590,7 +6590,7 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6712,7 +6712,7 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6753,7 +6753,7 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6904,7 +6904,7 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6945,7 +6945,7 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -7072,7 +7072,7 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -7113,7 +7113,7 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -7315,7 +7315,7 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -7356,7 +7356,7 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -7613,7 +7613,7 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -13774,7 +13774,7 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -14950,7 +14950,7 @@ test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -15135,7 +15135,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -15199,7 +15199,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -15235,7 +15235,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -15272,7 +15272,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -15308,7 +15308,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -15946,7 +15946,7 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -16013,7 +16013,7 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -16177,7 +16177,7 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -16207,7 +16207,7 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ diff --git a/test/file_image.c b/test/file_image.c index 12f0a18..0dba236 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -579,7 +579,8 @@ test_core(void) reset_udata(udata); file = H5Fopen(copied_filename, H5F_ACC_RDONLY, fapl); VERIFY(file >= 0, "H5Fopen failed"); - VERIFY(udata->used_callbacks == MALLOC, "opening a core file used the wrong callbacks"); + VERIFY((udata->used_callbacks == MALLOC) || + (udata->used_callbacks == MALLOC | UDATA_COPY | UDATA_FREE), "opening a core file used the wrong callbacks"); VERIFY(udata->malloc_src == H5FD_FILE_IMAGE_OP_FILE_OPEN, "Malloc callback came from wrong sourc in core open"); /* Close file */ diff --git a/test/fillval.c b/test/fillval.c index 8c8e902..5b95de9 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -762,15 +762,17 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, comp_datatype *buf_c=NULL; H5D_space_status_t allocation; - if(datatype==H5T_INTEGER) + if(datatype == H5T_INTEGER) { fillval = *(int*)_fillval; - else if(datatype==H5T_COMPOUND) { - fill_c.a=((comp_datatype*)_fillval)->a; + } + else if(datatype == H5T_COMPOUND) { + fill_c.a=((comp_datatype*)_fillval)->a; fill_c.x=((comp_datatype*)_fillval)->x; fill_c.y=((comp_datatype*)_fillval)->y; fill_c.z=((comp_datatype*)_fillval)->z; - } else { - puts("Invalid type for test"); + } + else { + HDputs("Invalid type for test"); goto error; } @@ -806,7 +808,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, goto error; } /* case for compound datatype */ - } else if(datatype==H5T_COMPOUND) { + } + else if(datatype==H5T_COMPOUND) { if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, &rd_c) < 0) goto error; if(fill_time != H5D_FILL_TIME_NEVER && (!H5_FLT_ABS_EQUAL(rd_c.a, fill_c.a) || @@ -828,10 +831,10 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, /* Select all odd data locations in the file dataset */ for (i=0, nelmts=1; i<5; i++) { - hs_size[i] = cur_size[i]/2; - hs_offset[i] = 0; - hs_stride[i] = 2; - nelmts *= hs_size[i]; + hs_size[i] = cur_size[i]/2; + hs_offset[i] = 0; + hs_stride[i] = 2; + nelmts *= hs_size[i]; } if((mspace=H5Screate_simple(5, hs_size, hs_size)) < 0) goto error; if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, @@ -1089,17 +1092,23 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) } h5_fixname(base_name, fapl, filename, sizeof filename); - if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5D_CHUNKED==layout) { - if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error; - } else if(H5D_COMPACT==layout) { - if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if(H5D_CHUNKED == layout) { + if(H5Pset_chunk(dcpl, 5, ch_size) < 0) + goto error; + } + else if(H5D_COMPACT == layout) { + if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) + goto error; } - if((ctype_id=create_compound_type()) < 0) goto error; + if((ctype_id = create_compound_type()) < 0) + goto error; /* I. Test H5D_ALLOC_TIME_LATE space allocation cases */ if(H5D_COMPACT != layout) { @@ -2359,8 +2368,6 @@ test_partalloc(hid_t fapl, const char *base_name) * Programmer: Robb Matzke * Thursday, October 1, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -2380,8 +2387,8 @@ main(int argc, char *argv[]) else if(!strcmp(argv[argno], "compact")) test_compact =1; else { - fprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]); - exit(EXIT_FAILURE); + HDfprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]); + HDexit(EXIT_FAILURE); } } /* end for */ } /* end if */ @@ -2444,15 +2451,15 @@ main(int argc, char *argv[]) if(nerrors) goto error; - puts("All fill value tests passed."); + HDputs("All fill value tests passed."); if(h5_cleanup(FILENAME, fapl)) HDremove(FILE_NAME_RAW); - return 0; + HDexit(EXIT_SUCCESS); error: - puts("***** FILL VALUE TESTS FAILED *****"); - return 1; + HDputs("***** FILL VALUE TESTS FAILED *****"); + HDexit(EXIT_FAILURE); } diff --git a/test/flush1.c b/test/flush1.c index bdbd731..fefa8d0 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -209,7 +209,7 @@ main(void) /* Check if the current VFD supports SWMR */ driver = HDgetenv("HDF5_DRIVER"); - vfd_supports_swmr = H5FD_supports_swmr_test(driver); + vfd_supports_swmr = H5FD__supports_swmr_test(driver); /*************************************************/ /* NOTE: Not closing the file ID is intentional! */ diff --git a/test/flush2.c b/test/flush2.c index 9fdf6c1..6e8aee7 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -258,7 +258,7 @@ main(void) /* Check if the current VFD supports SWMR */ driver = HDgetenv("HDF5_DRIVER"); - vfd_supports_swmr = H5FD_supports_swmr_test(driver); + vfd_supports_swmr = H5FD__supports_swmr_test(driver); /* TEST 1 */ /* Check the case where the file was flushed */ diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 4196d85..92c9f87 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -130,7 +130,7 @@ herr_t end_verification(void); * it will time out waiting for a signal from the test script * which will never come. * - * Return: 0 on Success, 1 on Failure + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Mike McGreevy * July 1, 2010 @@ -155,7 +155,7 @@ int main(int argc, const char *argv[]) /* Determine driver being used */ envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL || H5FD_supports_swmr_test(envval)) { + if(envval == NULL || H5FD__supports_swmr_test(envval)) { if(test_flush() != SUCCEED) TEST_ERROR; if(test_refresh() != SUCCEED) TEST_ERROR; } /* end if */ @@ -166,23 +166,26 @@ int main(int argc, const char *argv[]) if(end_verification() < 0) TEST_ERROR; if(end_verification() < 0) TEST_ERROR; } /* end else */ - } else if(argc == 3) { + } + else if(argc == 3) { /* Two arguments supplied. Pass them to flush verification routine. */ if(flush_verification(argv[1], argv[2]) != 0) PROCESS_ERROR; - } else if(argc == 2) { + } + else if(argc == 2) { /* One argument supplied. Pass it to refresh verification routine. */ if(refresh_verification(argv[1]) != 0) PROCESS_ERROR; - } else { + } + else { /* Illegal number of arguments supplied. Error. */ HDfprintf(stderr, "Error. %d is an Invalid number of arguments to main().\n", argc); PROCESS_ERROR } /* end if */ - return SUCCEED; + return EXIT_SUCCESS; error: /* Return */ - return FAIL; + return EXIT_FAILURE; } /* main */ @@ -695,7 +698,6 @@ herr_t test_refresh(void) /* ================= */ /* Refresh Datatypes */ /* ================= */ - TESTING("to ensure that H5Trefresh correctly refreshes single datatypes"); /* Verify First Committed Datatype can be refreshed with H5Trefresh */ @@ -715,7 +717,6 @@ herr_t test_refresh(void) if(H5Oflush(tid2) < 0) TEST_ERROR; if(end_refresh_verification_process() != 0) TEST_ERROR; - PASSED(); /* =============== */ @@ -995,7 +996,7 @@ herr_t refresh_verification(const char * obj_pathname) check to ensure we didn't erroneously flush the attribute before starting the verification. */ if(flushed_oinfo.num_attrs != 0) - PROCESS_ERROR; + PROCESS_ERROR; /* Send Signal to MAIN PROCESS indicating that it can go ahead and modify the object. */ @@ -1027,55 +1028,57 @@ herr_t refresh_verification(const char * obj_pathname) * test cases is easy). */ do { - if((HDstrcmp(obj_pathname, D1) == 0) || (HDstrcmp(obj_pathname, D2) == 0)) { - if(H5Drefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else if((HDstrcmp(obj_pathname, G1) == 0) || (HDstrcmp(obj_pathname, G2) == 0)) { - if(H5Grefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else if((HDstrcmp(obj_pathname, T1) == 0) || (HDstrcmp(obj_pathname, T2) == 0)) { - if(H5Trefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else if((HDstrcmp(obj_pathname, D3) == 0) || (HDstrcmp(obj_pathname, G3) == 0) || + if((HDstrcmp(obj_pathname, D1) == 0) || (HDstrcmp(obj_pathname, D2) == 0)) { + if(H5Drefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else if((HDstrcmp(obj_pathname, G1) == 0) || (HDstrcmp(obj_pathname, G2) == 0)) { + if(H5Grefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else if((HDstrcmp(obj_pathname, T1) == 0) || (HDstrcmp(obj_pathname, T2) == 0)) { + if(H5Trefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else if((HDstrcmp(obj_pathname, D3) == 0) || (HDstrcmp(obj_pathname, G3) == 0) || (HDstrcmp(obj_pathname, T3) == 0)) { - if(H5Orefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else { - HDfprintf(stdout, "Error. %s is an unrecognized object.\n", obj_pathname); - PROCESS_ERROR; - } /* end else */ - - /* Get object info. This should now accurately reflect the refreshed object on disk. */ - if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; - - /* Confirm following (first 4) attributes are the same: */ - /* Confirm following (last 4) attributes are different */ - if( (flushed_oinfo.addr == refreshed_oinfo.addr) && - (flushed_oinfo.type == refreshed_oinfo.type) && - (flushed_oinfo.hdr.version == refreshed_oinfo.hdr.version) && - (flushed_oinfo.hdr.flags == refreshed_oinfo.hdr.flags) && - (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) && - (flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) && - (flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) && - (flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) ) { - ok = TRUE; - break; - } - if(tries == sleep_tries) - HDsleep(1); + if(H5Orefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else { + HDfprintf(stdout, "Error. %s is an unrecognized object.\n", obj_pathname); + PROCESS_ERROR; + } /* end else */ + + /* Get object info. This should now accurately reflect the refreshed object on disk. */ + if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) + PROCESS_ERROR; + + /* Confirm following (first 4) attributes are the same: */ + /* Confirm following (last 4) attributes are different */ + if( (flushed_oinfo.addr == refreshed_oinfo.addr) && + (flushed_oinfo.type == refreshed_oinfo.type) && + (flushed_oinfo.hdr.version == refreshed_oinfo.hdr.version) && + (flushed_oinfo.hdr.flags == refreshed_oinfo.hdr.flags) && + (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) && + (flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) && + (flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) && + (flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) ) { + ok = TRUE; + break; + } + + if(tries == sleep_tries) + HDsleep(1); } while(--tries); - + if(!ok) { - printf("FLUSHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", - (int)flushed_oinfo.num_attrs, (int)flushed_oinfo.hdr.nmesgs, - (int)flushed_oinfo.hdr.nchunks, (int)flushed_oinfo.hdr.space.total); - printf("REFRESHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", - (int)refreshed_oinfo.num_attrs, (int)refreshed_oinfo.hdr.nmesgs, - (int)refreshed_oinfo.hdr.nchunks, (int)refreshed_oinfo.hdr.space.total); - PROCESS_ERROR; + HDprintf("FLUSHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", + (int)flushed_oinfo.num_attrs, (int)flushed_oinfo.hdr.nmesgs, + (int)flushed_oinfo.hdr.nchunks, (int)flushed_oinfo.hdr.space.total); + HDprintf("REFRESHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", + (int)refreshed_oinfo.num_attrs, (int)refreshed_oinfo.hdr.nmesgs, + (int)refreshed_oinfo.hdr.nchunks, (int)refreshed_oinfo.hdr.space.total); + PROCESS_ERROR; } - + /* Close objects */ if(H5Oclose(oid) < 0) PROCESS_ERROR; if(H5Fclose(fid) < 0) PROCESS_ERROR; diff --git a/test/freespace.c b/test/freespace.c index 33a6f89..947b2ce 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -24,8 +24,9 @@ #define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "H5Fpkg.h" -#include "H5CXprivate.h" /* API Contexts */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5VMprivate.h" #define FILENAME_LEN 1024 @@ -480,7 +481,7 @@ test_fs_create(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* initialize creation parameters for free-space manager */ @@ -496,7 +497,7 @@ test_fs_create(hid_t fapl) if(!H5F_addr_defined(fs_addr)) TEST_ERROR - if (frsp->nclasses != nclasses) + if(frsp->nclasses != nclasses) TEST_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -504,9 +505,9 @@ test_fs_create(hid_t fapl) TEST_ERROR HDmemset(&test_cparam, 0, sizeof(H5FS_create_t)); - if(H5FS_get_cparam_test(frsp, &test_cparam) < 0) + if(H5FS__get_cparam_test(frsp, &test_cparam) < 0) FAIL_STACK_ERROR - if (H5FS_cmp_cparam_test(&cparam, &test_cparam)) + if(H5FS__cmp_cparam_test(&cparam, &test_cparam)) FAIL_STACK_ERROR /* Close the free space manager */ @@ -622,7 +623,7 @@ test_fs_sect_add(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -686,7 +687,7 @@ test_fs_sect_add(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -756,7 +757,7 @@ test_fs_sect_add(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */ @@ -825,7 +826,7 @@ test_fs_sect_add(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */ @@ -946,7 +947,7 @@ test_fs_sect_find(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -1334,7 +1335,7 @@ test_fs_sect_merge(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -1464,7 +1465,7 @@ test_fs_sect_merge(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -1566,7 +1567,7 @@ test_fs_sect_merge(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -1801,7 +1802,7 @@ test_fs_sect_shrink(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -1857,14 +1858,14 @@ test_fs_sect_shrink(hid_t fapl) * Re-add section A that allow shrinking and its section class type defines "can_shrink" */ if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t)))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); can_shrink = FALSE; if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* should have nothing in free-space */ HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -1875,18 +1876,18 @@ test_fs_sect_shrink(hid_t fapl) /* section A should not be there in free-space */ if((node_found = H5FS_sect_find(f, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if (node_found) TEST_ERROR /* Close the free space manager */ if(H5FS_close(f, frsp) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ if(H5FS_delete(f, fs_addr) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; /* Close the file */ @@ -1903,7 +1904,7 @@ test_fs_sect_shrink(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -2004,7 +2005,7 @@ test_fs_sect_shrink(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -2082,7 +2083,7 @@ test_fs_sect_shrink(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2142,7 +2143,7 @@ test_fs_sect_change_class(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -2251,7 +2252,7 @@ test_fs_sect_change_class(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -2357,7 +2358,7 @@ test_fs_sect_change_class(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2433,7 +2434,7 @@ test_fs_sect_extend(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Tag with the global free space tag */ @@ -2787,7 +2788,7 @@ test_fs_sect_iterate(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -2861,14 +2862,8 @@ main(void) { hid_t fapl = -1; /* File access property list for data files */ unsigned nerrors = 0; /* Cumulative error count */ - const char *env_h5_drvr = NULL; /* File Driver value from environment */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ - /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); - if(env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; - h5_reset(); if((fapl = h5_fileaccess()) < 0) { diff --git a/test/genall5.c b/test/genall5.c index 37bab7a..4cc0a2d 100644 --- a/test/genall5.c +++ b/test/genall5.c @@ -12,11 +12,11 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Programmer: John Mainzer - * 9/23/15 + * 9/23/15 * - * This file contains a heavily edited and functionaly reduce - * version of the test code first written by Quincey in a file - * of the same name. + * This file contains a heavily edited and functionaly reduce + * version of the test code first written by Quincey in a file + * of the same name. */ #include "cache_common.h" @@ -32,7 +32,7 @@ * Function: ns_grp_0 * * Purpose: Create an empty "new style" group at the specified location - * in the specified file. + * in the specified file. * * If pass is false on entry, do nothing. * @@ -48,70 +48,59 @@ */ void -ns_grp_0(hid_t fid, const char *group_name) -{ +ns_grp_0(hid_t fid, const char *group_name) { hid_t gid = -1; hid_t gcpl = -1; herr_t ret; - if ( pass ) { - + if (pass) { gcpl = H5Pcreate(H5P_GROUP_CREATE); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_0: H5Pcreate() failed"; - } - assert(gcpl > 0); + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "ns_grp_0: H5Pcreate() failed"; + } + HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_0: H5Pset_link_creation_order() failed"; - } - assert(ret >= 0); + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_0: H5Pset_link_creation_order() failed"; + } + HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, gcpl, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_0: H5Gcreate2() failed"; + if (gid <= 0) { + pass = FALSE; + failure_mssg = "ns_grp_0: H5Gcreate2() failed"; } - assert(gid > 0); + HDassert(gid > 0); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_0: H5Pclose(gcpl) failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_0: H5Pclose(gcpl) failed"; } - assert(ret >= 0); + HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_0: H5Gclose(gid) failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_0: H5Gclose(gid) failed"; } - assert(ret >= 0); + HDassert(ret >= 0); } return; @@ -138,97 +127,81 @@ ns_grp_0(hid_t fid, const char *group_name) *------------------------------------------------------------------------- */ -void vrfy_ns_grp_0(hid_t fid, const char *group_name) -{ +void vrfy_ns_grp_0(hid_t fid, const char *group_name) { hid_t gid = -1; hid_t gcpl = -1; H5G_info_t grp_info; unsigned crt_order_flags = 0; herr_t ret; - if ( pass ) { - + if (pass) { gid = H5Gopen2(fid, group_name, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_0: H5Gopen2() failed"; + if (gid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Gopen2() failed"; } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { gcpl = H5Gget_create_plist(gid); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_0: H5Gget_create_plist() failed"; + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Gget_create_plist() failed"; } HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_0: H5Pget_link_creation_order() failed"; + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Pget_link_creation_order() failed"; } - else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_0: H5P_CRT_ORDER_TRACKED != crt_order_flags"; + else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags) { + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_0: H5P_CRT_ORDER_TRACKED != crt_order_flags"; } HDassert(ret >= 0); HDassert(H5P_CRT_ORDER_TRACKED == crt_order_flags); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_0: H5Pclose() failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Pclose() failed"; } HDassert(ret >= 0); } - if ( pass ) { - - memset(&grp_info, 0, sizeof(grp_info)); + if (pass) { + HDmemset(&grp_info, 0, sizeof(grp_info)); ret = H5Gget_info(gid, &grp_info); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_0: H5Gget_info() failed"; } - else if ( H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type ) { - + else if (H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_0: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type"; + failure_mssg = + "vrfy_ns_grp_0: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type"; } - else if ( 0 != grp_info.nlinks ) { - + else if (0 != grp_info.nlinks) { pass = FALSE; failure_mssg = "vrfy_ns_grp_0: 0 != grp_info.nlinks"; } - else if ( 0 != grp_info.max_corder ) { - + else if (0 != grp_info.max_corder) { pass = FALSE; failure_mssg = "vrfy_ns_grp_0: 0 != grp_info.max_corder"; } - else if ( FALSE != grp_info.mounted ) { - + else if ( FALSE != grp_info.mounted) { pass = FALSE; failure_mssg = "vrfy_ns_grp_0: FALSE != grp_info.mounted"; } @@ -240,12 +213,10 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) HDassert(false == grp_info.mounted); } - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_0: H5Gclose() failed"; } @@ -253,15 +224,14 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) } return; - } /* vrfy_ns_grp_0() */ /*------------------------------------------------------------------------- * Function: ns_grp_c * - * Purpose: Create a compact "new style" group, with 'nlinks' - * soft/hard/external links in it in the specified file. + * Purpose: Create a compact "new style" group, with 'nlinks' + * soft/hard/external links in it in the specified file. * * If pass is false on entry, do nothing. * @@ -276,68 +246,57 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) *------------------------------------------------------------------------- */ -void -ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) -{ +void +ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { hid_t gid = -1; hid_t gcpl = -1; unsigned max_compact; unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { gcpl = H5Pcreate(H5P_GROUP_CREATE); - if ( gcpl <= 0 ) { - + if (gcpl <= 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Pcreate(H5P_GROUP_CREATE) failed"; } HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Pset_link_creation_order() failed"; } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, gcpl, H5P_DEFAULT); - if ( gid <= 0 ) { - + if (gid <= 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Gcreate2() failed"; } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { max_compact = 0; ret = H5Pget_link_phase_change(gcpl, &max_compact, NULL); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Pget_link_phase_change() failed"; } - else if ( nlinks <= 0 ) { - + else if (nlinks <= 0) { pass = FALSE; failure_mssg = "ns_grp_c: nlinks <= 0"; } - else if ( nlinks >= max_compact ) { - + else if (nlinks >= max_compact) { pass = FALSE; failure_mssg = "ns_grp_c: nlinks >= max_compact"; } @@ -348,72 +307,59 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) } u = 0; - while ( ( pass ) && ( u < nlinks ) ) { - + while ((pass) && (u < nlinks)) { char linkname[16]; - sprintf(linkname, "%u", u); - - if(0 == (u % 3)) { - - ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, - H5P_DEFAULT); + HDsprintf(linkname, "%u", u); - if ( ret < 0 ) { + if (0 == (u % 3)) { + ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, H5P_DEFAULT); + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Lcreate_soft() failed"; } HDassert(ret >= 0); } /* end if */ - else if(1 == (u % 3)) { - - ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, - H5P_DEFAULT); - - if ( ret < 0 ) { + else if (1 == (u % 3)) { + ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, + H5P_DEFAULT); + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Lcreate_hard() failed"; } HDassert(ret >= 0); } /* end else-if */ else { - HDassert(2 == (u % 3)); - ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, - H5P_DEFAULT, H5P_DEFAULT); - - if ( ret < 0 ) { + ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Lcreate_external() failed"; } HDassert(ret >= 0); } /* end else */ - u++; - + u++; } /* end while() */ - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Pclose(gcpl) failed"; } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Gclose(gid) failed"; } @@ -428,8 +374,8 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) /*------------------------------------------------------------------------- * Function: vrfy_ns_grp_c * - * Purpose: Verify a compact "new style" group, with 'nlinks' - * soft/hard/external links in it in the specified file. + * Purpose: Verify a compact "new style" group, with 'nlinks' + * soft/hard/external links in it in the specified file. * * If pass is false on entry, do nothing. * @@ -445,8 +391,7 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) */ void -vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) -{ +vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { hid_t gid = -1; hid_t gcpl = -1; H5G_info_t grp_info; @@ -454,89 +399,73 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { gid = H5Gopen2(fid, group_name, H5P_DEFAULT); - if ( gid <= 0 ) { - + if (gid <= 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Gopen2() failed"; } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { gcpl = H5Gget_create_plist(gid); - if ( gcpl <= 0 ) { - + if (gcpl <= 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Gget_create_plist(gid) failed"; } - assert(gcpl > 0); + HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Pget_link_creation_order() failed"; } - else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags ) { - + else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: H5P_CRT_ORDER_TRACKED != crt_order_flags"; + failure_mssg = "vrfy_ns_grp_c: H5P_CRT_ORDER_TRACKED != crt_order_flags"; } HDassert(ret >= 0); HDassert(H5P_CRT_ORDER_TRACKED == crt_order_flags); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Pclose() failed"; } HDassert(ret >= 0); } - if ( pass ) { - - memset(&grp_info, 0, sizeof(grp_info)); + if (pass) { + HDmemset(&grp_info, 0, sizeof(grp_info)); ret = H5Gget_info(gid, &grp_info); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Gget_info() failed"; } - else if ( H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type ) { - + else if (H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type"; + failure_mssg = + "vrfy_ns_grp_c: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type"; } - else if ( nlinks != grp_info.nlinks ) { - + else if (nlinks != grp_info.nlinks) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: nlinks != grp_info.nlinks"; } - else if ( nlinks != grp_info.max_corder ) { - + else if (nlinks != grp_info.max_corder) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: nlinks != grp_info.max_corder"; } - else if ( FALSE != grp_info.mounted ) { - + else if ( FALSE != grp_info.mounted) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: FALSE != grp_info.mounted"; } @@ -549,42 +478,36 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) } u = 0; - while ( ( pass ) && ( u < nlinks ) ) { - + while ((pass) && (u < nlinks)) { H5L_info_t lnk_info; char linkname[16]; htri_t link_exists; - sprintf(linkname, "%u", u); + HDsprintf(linkname, "%u", u); link_exists = H5Lexists(gid, linkname, H5P_DEFAULT); - if ( link_exists < 0 ) { - + if (link_exists < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Lexists() failed"; } HDassert(link_exists >= 0); - memset(&lnk_info, 0, sizeof(grp_info)); + HDmemset(&lnk_info, 0, sizeof(grp_info)); ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Lget_info() failed"; } - else if ( TRUE != lnk_info.corder_valid ) { - + else if ( TRUE != lnk_info.corder_valid) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: TRUE != lnk_info.corder_valid"; } - else if ( u != lnk_info.corder ) { - + else if (u != lnk_info.corder) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: u != lnk_info.corder"; } - else if ( H5T_CSET_ASCII != lnk_info.cset ) { - + else if (H5T_CSET_ASCII != lnk_info.cset) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5T_CSET_ASCII != lnk_info.cset"; } @@ -593,75 +516,62 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) HDassert(u == lnk_info.corder); HDassert(H5T_CSET_ASCII == lnk_info.cset); - if ( 0 == (u % 3) ) { - + if (0 == (u % 3)) { char *slinkval; - if ( H5L_TYPE_SOFT != lnk_info.type ) { - + if (H5L_TYPE_SOFT != lnk_info.type) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5L_TYPE_SOFT != lnk_info.type"; } - else if ( (strlen(group_name) + 1) != lnk_info.u.val_size ) { - + else if ((HDstrlen(group_name) + 1) != lnk_info.u.val_size) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: (strlen(group_name) + 1) != lnk_info.u.val_size"; + failure_mssg = "vrfy_ns_grp_c: (HDstrlen(group_name) + 1) != lnk_info.u.val_size"; } HDassert(H5L_TYPE_SOFT == lnk_info.type); - HDassert((strlen(group_name) + 1) == lnk_info.u.val_size); + HDassert((HDstrlen(group_name) + 1) == lnk_info.u.val_size); - slinkval = (char *)malloc(lnk_info.u.val_size); - - if ( ! slinkval ) { + slinkval = (char *) HDmalloc(lnk_info.u.val_size); + if (!slinkval) { pass = FALSE; - failure_mssg = "vrfy_ns_grp_c: malloc of slinkval failed"; + failure_mssg = "vrfy_ns_grp_c: HDmalloc of slinkval failed"; } HDassert(slinkval); - ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, - H5P_DEFAULT); - if ( ret < 0 ) { - + ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Lget_val() failed"; } - else if ( 0 != strcmp(slinkval, group_name) ) { - + else if (0 != HDstrcmp(slinkval, group_name)) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: 0 != strcmp(slinkval, group_name)"; + failure_mssg = "vrfy_ns_grp_c: 0 != HDstrcmp(slinkval, group_name)"; } HDassert(ret >= 0); - HDassert(0 == strcmp(slinkval, group_name)); + HDassert(0 == HDstrcmp(slinkval, group_name)); - free(slinkval); + HDfree(slinkval); } /* end if */ - else if(1 == (u % 3)) { - + else if (1 == (u % 3)) { H5O_info_t root_oinfo; - if ( H5L_TYPE_HARD != lnk_info.type ) { - + if (H5L_TYPE_HARD != lnk_info.type) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5L_TYPE_HARD != lnk_info.type"; } HDassert(H5L_TYPE_HARD == lnk_info.type); - memset(&root_oinfo, 0, sizeof(root_oinfo)); + HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Oget_info() failed."; } - else if ( root_oinfo.addr != lnk_info.u.address ) { - + else if (root_oinfo.addr != lnk_info.u.address) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: root_oinfo.addr != lnk_info.u.address"; + failure_mssg = "vrfy_ns_grp_c: root_oinfo.addr != lnk_info.u.address"; } HDassert(ret >= 0); HDassert(root_oinfo.addr == lnk_info.u.address); @@ -673,83 +583,70 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) HDassert(2 == (u % 3)); - if ( H5L_TYPE_EXTERNAL != lnk_info.type ) { - + if (H5L_TYPE_EXTERNAL != lnk_info.type) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: H5L_TYPE_EXTERNAL != lnk_info.type"; + failure_mssg = "vrfy_ns_grp_c: H5L_TYPE_EXTERNAL != lnk_info.type"; } HDassert(H5L_TYPE_EXTERNAL == lnk_info.type); - elinkval = malloc(lnk_info.u.val_size); - - if ( ! elinkval ) { + elinkval = HDmalloc(lnk_info.u.val_size); + if (!elinkval) { pass = FALSE; - failure_mssg = "vrfy_ns_grp_c: malloc of elinkval failed."; + failure_mssg = "vrfy_ns_grp_c: HDmalloc of elinkval failed."; } HDassert(elinkval); - ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, - H5P_DEFAULT); - if ( ret < 0 ) { - + ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Lget_val() failed."; } HDassert(ret >= 0); - ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, - NULL, &file, &path); - if ( ret < 0 ) { - + ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, NULL, &file, &path); + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Lunpack_elink_val() failed."; } - else if ( 0 != strcmp(file, "external.h5") ) { - + else if (0 != HDstrcmp(file, "external.h5")) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: 0 != strcmp(file, \"external.h5\")"; + failure_mssg = "vrfy_ns_grp_c: 0 != HDstrcmp(file, \"external.h5\")"; } - else if ( 0 != strcmp(path, "/ext") ) { - + else if (0 != HDstrcmp(path, "/ext")) { pass = FALSE; - failure_mssg = "vrfy_ns_grp_c: 0 != strcmp(path, \"/ext\")"; + failure_mssg = "vrfy_ns_grp_c: 0 != HDstrcmp(path, \"/ext\")"; } HDassert(ret >= 0); - HDassert(0 == strcmp(file, "external.h5")); - HDassert(0 == strcmp(path, "/ext")); + HDassert(0 == HDstrcmp(file, "external.h5")); + HDassert(0 == HDstrcmp(path, "/ext")); - free(elinkval); + HDfree(elinkval); } /* end else */ - u++; - + u++; } /* end while */ - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Gclose() failed."; } - assert(ret >= 0); + HDassert(ret >= 0); } return; - } /* vrfy_ns_grp_c() */ /*------------------------------------------------------------------------- * Function: ns_grp_d * - * Purpose: Create a dense "new style" group, with 'nlinks' - * (soft/hard/external) links in it in the specified file. + * Purpose: Create a dense "new style" group, with 'nlinks' + * (soft/hard/external) links in it in the specified file. * * If pass is false on entry, do nothing. * @@ -765,153 +662,130 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) */ void -ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) -{ +ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { hid_t gid = -1; hid_t gcpl = -1; unsigned max_compact; unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { gcpl = H5Pcreate(H5P_GROUP_CREATE); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Pcreate() failed."; - } + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pcreate() failed."; + } HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Pset_link_creation_order() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pset_link_creation_order() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, gcpl, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Gcreate2() failed."; - } + if (gid <= 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Gcreate2() failed."; + } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { max_compact = 0; ret = H5Pget_link_phase_change(gcpl, &max_compact, NULL); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Pget_link_phase_change() failed."; - } - else if ( nlinks <= max_compact ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: nlinks <= max_compact"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pget_link_phase_change() failed."; + } + else if (nlinks <= max_compact) { + pass = FALSE; + failure_mssg = "ns_grp_d: nlinks <= max_compact"; + } HDassert(ret >= 0); HDassert(nlinks > max_compact); } u = 0; - while ( ( pass ) && ( u < nlinks ) ) { - + while ((pass) && (u < nlinks)) { char linkname[16]; - sprintf(linkname, "%u", u); - - if(0 == (u % 3)) { + HDsprintf(linkname, "%u", u); - ret = H5Lcreate_soft(group_name, gid, linkname, - H5P_DEFAULT, H5P_DEFAULT); + if (0 == (u % 3)) { + ret = H5Lcreate_soft(group_name, gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Lcreate_soft() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Lcreate_soft() failed."; + } HDassert(ret >= 0); } /* end if */ - else if(1 == (u % 3)) { - - ret = H5Lcreate_hard(fid, "/", gid, linkname, - H5P_DEFAULT, H5P_DEFAULT); + else if (1 == (u % 3)) { + ret = H5Lcreate_hard(fid, "/", gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Lcreate_hard() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Lcreate_hard() failed."; + } HDassert(ret >= 0); } /* end else-if */ else { - HDassert(2 == (u % 3)); - ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, - H5P_DEFAULT, H5P_DEFAULT); + ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Lcreate_external() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Lcreate_external() failed."; + } HDassert(ret >= 0); } /* end else */ u++; - } /* end while */ - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Gclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Gclose() failed."; + } HDassert(ret >= 0); } return; - } /* ns_grp_d() */ /*------------------------------------------------------------------------- * Function: vrfy_ns_grp_d * - * Purpose: Verify a dense "new style" group, with 'nlinks' - * soft/hard/external links in it in the specified file. + * Purpose: Verify a dense "new style" group, with 'nlinks' + * soft/hard/external links in it in the specified file. * * If pass is false on entry, do nothing. * @@ -928,8 +802,7 @@ ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) void -vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) -{ +vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { hid_t gid = -1; hid_t gcpl = -1; H5G_info_t grp_info; @@ -937,93 +810,75 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { gid = H5Gopen2(fid, group_name, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Gopen2() failed."; + if (gid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gopen2() failed."; } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { gcpl = H5Gget_create_plist(gid); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Gget_create_plist() failed."; + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gget_create_plist() failed."; } - assert(gcpl > 0); + HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: H5Pget_link_creation_order() failed."; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Pget_link_creation_order() failed."; } - else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: H5P_CRT_ORDER_TRACKED != crt_order_flags"; + else if (H5P_CRT_ORDER_TRACKED != crt_order_flags) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5P_CRT_ORDER_TRACKED != crt_order_flags"; } HDassert(ret >= 0); HDassert(H5P_CRT_ORDER_TRACKED == crt_order_flags); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - - memset(&grp_info, 0, sizeof(grp_info)); + if (pass) { + HDmemset(&grp_info, 0, sizeof(grp_info)); ret = H5Gget_info(gid, &grp_info); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Gget_info() failed."; - } - else if ( H5G_STORAGE_TYPE_DENSE != grp_info.storage_type ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: H5G_STORAGE_TYPE_DENSE != grp_info.storage_type"; - } - else if ( nlinks != grp_info.nlinks ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.nlinks"; - } - else if ( nlinks != grp_info.max_corder ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.max_corder"; - } - else if ( FALSE != grp_info.mounted ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: FALSE != grp_info.mounted"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gget_info() failed."; + } + else if (H5G_STORAGE_TYPE_DENSE != grp_info.storage_type) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5G_STORAGE_TYPE_DENSE != grp_info.storage_type"; + } + else if (nlinks != grp_info.nlinks) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.nlinks"; + } + else if (nlinks != grp_info.max_corder) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.max_corder"; + } + else if ( FALSE != grp_info.mounted) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: FALSE != grp_info.mounted"; + } HDassert(ret >= 0); HDassert(H5G_STORAGE_TYPE_DENSE == grp_info.storage_type); HDassert(nlinks == grp_info.nlinks); @@ -1032,116 +887,100 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) } u = 0; - while ( ( pass ) && ( u < nlinks ) ) { - + while ((pass) && (u < nlinks)) { H5L_info_t lnk_info; char linkname[16]; htri_t link_exists; - sprintf(linkname, "%u", u); + HDsprintf(linkname, "%u", u); link_exists = H5Lexists(gid, linkname, H5P_DEFAULT); - if ( link_exists < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Lexists() failed."; - } + if (link_exists < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Lexists() failed."; + } HDassert(link_exists >= 0); - memset(&lnk_info, 0, sizeof(grp_info)); + HDmemset(&lnk_info, 0, sizeof(grp_info)); ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Lget_info() failed."; - } - else if ( TRUE != lnk_info.corder_valid ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: TRUE != lnk_info.corder_valid"; - } - else if ( u != lnk_info.corder ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: u != lnk_info.corder"; - } - else if ( H5T_CSET_ASCII != lnk_info.cset ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5T_CSET_ASCII != lnk_info.cset"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Lget_info() failed."; + } + else if (TRUE != lnk_info.corder_valid) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: TRUE != lnk_info.corder_valid"; + } + else if (u != lnk_info.corder) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: u != lnk_info.corder"; + } + else if (H5T_CSET_ASCII != lnk_info.cset) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5T_CSET_ASCII != lnk_info.cset"; + } HDassert(ret >= 0); HDassert(true == lnk_info.corder_valid); HDassert(u == lnk_info.corder); HDassert(H5T_CSET_ASCII == lnk_info.cset); - if(0 == (u % 3)) { + if (0 == (u % 3)) { char *slinkval; - if ( H5L_TYPE_SOFT != lnk_info.type ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type"; - } - else if ( (strlen(group_name) + 1) != lnk_info.u.val_size ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type"; - } + if (H5L_TYPE_SOFT != lnk_info.type) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type"; + } + else if ((HDstrlen(group_name) + 1) != lnk_info.u.val_size) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type"; + } HDassert(H5L_TYPE_SOFT == lnk_info.type); - HDassert((strlen(group_name) + 1) == lnk_info.u.val_size); - - slinkval = (char *)malloc(lnk_info.u.val_size); + HDassert((HDstrlen(group_name) + 1) == lnk_info.u.val_size); - if ( ! slinkval ) { + slinkval = (char *) HDmalloc(lnk_info.u.val_size); - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: malloc of slinkval failed"; - } + if (!slinkval) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: HDmalloc of slinkval failed"; + } HDassert(slinkval); - ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, - H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Lget_val() failed"; - } - else if ( 0 != strcmp(slinkval, group_name) ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: 0 != strcmp(slinkval, group_name)"; - } + ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Lget_val() failed"; + } + else if (0 != HDstrcmp(slinkval, group_name)) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: 0 != HDstrcmp(slinkval, group_name)"; + } HDassert(ret >= 0); - HDassert(0 == strcmp(slinkval, group_name)); + HDassert(0 == HDstrcmp(slinkval, group_name)); - free(slinkval); + HDfree(slinkval); } /* end if */ - else if(1 == (u % 3)) { + else if (1 == (u % 3)) { H5O_info_t root_oinfo; - if ( H5L_TYPE_HARD != lnk_info.type ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_HARD != lnk_info.type"; - } + if (H5L_TYPE_HARD != lnk_info.type) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_HARD != lnk_info.type"; + } HDassert(H5L_TYPE_HARD == lnk_info.type); - memset(&root_oinfo, 0, sizeof(root_oinfo)); + HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Oget_info() failed."; - } - else if ( root_oinfo.addr != lnk_info.u.address ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: root_oinfo.addr != lnk_info.u.address"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Oget_info() failed."; + } + else if (root_oinfo.addr != lnk_info.u.address) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: root_oinfo.addr != lnk_info.u.address"; + } HDassert(ret >= 0); HDassert(root_oinfo.addr == lnk_info.u.address); } /* end else-if */ @@ -1152,72 +991,58 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) HDassert(2 == (u % 3)); - if ( H5L_TYPE_EXTERNAL != lnk_info.type ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: H5L_TYPE_EXTERNAL != lnk_info.type"; - } + if (H5L_TYPE_EXTERNAL != lnk_info.type) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_EXTERNAL != lnk_info.type"; + } HDassert(H5L_TYPE_EXTERNAL == lnk_info.type); - elinkval = malloc(lnk_info.u.val_size); + elinkval = HDmalloc(lnk_info.u.val_size); - if ( ! elinkval ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: malloc of elinkval failed."; - } + if (!elinkval) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: HDmalloc of elinkval failed."; + } HDassert(elinkval); - ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, - H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; + ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if (ret < 0) { + pass = FALSE; failure_mssg = "vrfy_ns_grp_d: H5Lget_val failed."; } HDassert(ret >= 0); - ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, NULL, - &file, &path); - if ( ret < 0 ) { - - pass = FALSE; + ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, NULL, &file, &path); + if (ret < 0) { + pass = FALSE; failure_mssg = "vrfy_ns_grp_d: H5Lunpack_elink_val failed."; } - else if ( 0 != strcmp(file, "external.h5") ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: 0 != strcmp(file, \"external.h5\")."; + else if (0 != HDstrcmp(file, "external.h5")) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: 0 != HDstrcmp(file, \"external.h5\")."; + } + else if (0 != HDstrcmp(path, "/ext")) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: 0 != HDstrcmp(path, \"/ext\")"; } - else if ( 0 != strcmp(path, "/ext") ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: 0 != strcmp(path, \"/ext\")"; - } HDassert(ret >= 0); - HDassert(0 == strcmp(file, "external.h5")); - HDassert(0 == strcmp(path, "/ext")); - - free(elinkval); + HDassert(0 == HDstrcmp(file, "external.h5")); + HDassert(0 == HDstrcmp(path, "/ext")); + HDfree(elinkval); } /* end else */ - u++; - + u++; } /* end while() */ - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Gclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gclose() failed."; + } HDassert(ret >= 0); } @@ -1254,21 +1079,17 @@ os_grp_0(hid_t fid, const char *group_name) herr_t ret; if ( pass ) { /* get the file's file access property list */ - fapl = H5Fget_access_plist(fid); if ( fapl <= 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Fget_access_plist() failed."; } HDassert(fapl > 0); } - - if ( pass ) { /* get low and high bounds from fapl */ + if ( pass ) { /* get low and high bounds from fapl */ ret = H5Pget_libver_bounds(fapl, &low, &high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Pget_libver_bounds() failed(1)."; } @@ -1276,11 +1097,9 @@ os_grp_0(hid_t fid, const char *group_name) } if ( pass ) { /* turn file format latest off */ - if(low >= H5F_LIBVER_V18) { ret = H5Fset_libver_bounds(fid, H5F_LIBVER_EARLIEST, high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1)."; } @@ -1289,11 +1108,8 @@ os_grp_0(hid_t fid, const char *group_name) } if ( pass ) { - - gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, - H5P_DEFAULT); + gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if ( gid <= 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Gcreate2() failed."; } @@ -1301,11 +1117,9 @@ os_grp_0(hid_t fid, const char *group_name) } if ( pass ) { - ret = H5Gclose(gid); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Gclose() failed."; } @@ -1313,11 +1127,9 @@ os_grp_0(hid_t fid, const char *group_name) } if ( pass ) { /* restore low and high bounds */ - if(low >= H5F_LIBVER_V18) { ret = H5Fset_libver_bounds(fid, low, high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1)."; } @@ -1326,7 +1138,6 @@ os_grp_0(hid_t fid, const char *group_name) } return; - } /* os_grp_0() */ @@ -1349,98 +1160,83 @@ os_grp_0(hid_t fid, const char *group_name) */ void -vrfy_os_grp_0(hid_t fid, const char *group_name) -{ +vrfy_os_grp_0(hid_t fid, const char *group_name) { hid_t gid = -1; hid_t gcpl = -1; H5G_info_t grp_info; unsigned crt_order_flags = 0; herr_t ret; - if ( pass ) { - + if (pass) { gid = H5Gopen2(fid, group_name, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Gopen2() failed."; - } + if (gid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gopen2() failed."; + } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { gcpl = H5Gget_create_plist(gid); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Gget_create_plist() failed."; - } + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gget_create_plist() failed."; + } HDassert(gcpl > 0); } - if ( pass ) { + if (pass) { ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Pget_link_creation_order() failed"; - } - else if ( 0 != crt_order_flags ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: 0 != crt_order_flags"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Pget_link_creation_order() failed"; + } + else if (0 != crt_order_flags) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: 0 != crt_order_flags"; + } HDassert(ret >= 0); HDassert(0 == crt_order_flags); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - - memset(&grp_info, 0, sizeof(grp_info)); + if (pass) { + HDmemset(&grp_info, 0, sizeof(grp_info)); ret = H5Gget_info(gid, &grp_info); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Gget_info() failed."; - } - else if ( H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type"; - } - else if ( 0 != grp_info.nlinks ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: 0 != grp_info.nlinks"; - } - else if ( 0 != grp_info.max_corder ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: 0 != grp_info.max_corder"; - } - else if ( FALSE != grp_info.mounted ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: FALSE != grp_info.mounted"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gget_info() failed."; + } + else if (H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type"; + } + else if (0 != grp_info.nlinks) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: 0 != grp_info.nlinks"; + } + else if (0 != grp_info.max_corder) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: 0 != grp_info.max_corder"; + } + else if ( FALSE != grp_info.mounted) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: FALSE != grp_info.mounted"; + } HDassert(ret >= 0); HDassert(H5G_STORAGE_TYPE_SYMBOL_TABLE == grp_info.storage_type); HDassert(0 == grp_info.nlinks); @@ -1448,28 +1244,25 @@ vrfy_os_grp_0(hid_t fid, const char *group_name) HDassert(false == grp_info.mounted); } - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Gclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gclose() failed."; + } HDassert(ret >= 0); } return; - } /* vrfy_os_grp_0() */ /*------------------------------------------------------------------------- * Function: os_grp_n * - * Purpose: Create an "old style" group, with 'nlinks' soft/hard - * links in it. + * Purpose: Create an "old style" group, with 'nlinks' soft/hard + * links in it. * * If pass is false on entry, do nothing. * @@ -1484,7 +1277,7 @@ vrfy_os_grp_0(hid_t fid, const char *group_name) *------------------------------------------------------------------------- */ -void +void os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) { hid_t gid = -1; @@ -1494,10 +1287,8 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) herr_t ret; if ( pass ) { /* get the file's file access property list */ - fapl = H5Fget_access_plist(fid); if ( fapl <= 0 ) { - pass = FALSE; failure_mssg = "os_grp_n: H5Fget_access_plist() failed."; } @@ -1505,10 +1296,8 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) } if ( pass ) { /* get low and high bounds from fapl */ - ret = H5Pget_libver_bounds(fapl, &low, &high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Pget_libver_bounds() failed(1)."; } @@ -1516,11 +1305,9 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) } if ( pass ) { /* turn file format latest off */ - if(low >= H5F_LIBVER_V18) { ret = H5Fset_libver_bounds(fid, H5F_LIBVER_EARLIEST, high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1)."; } @@ -1529,11 +1316,8 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) } if ( pass ) { - - gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, - H5P_DEFAULT); + gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if ( gid <= 0 ) { - pass = FALSE; failure_mssg = "os_grp_n: H5Gcreate2() failed."; } @@ -1544,58 +1328,46 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) u = 0; while ( ( pass ) && ( u < nlinks ) ) { - char linkname[32]; - sprintf(linkname, "ln%d_%u", proc_num, u); + HDsprintf(linkname, "ln%d_%u", proc_num, u); if(0 == (u % 2)) { - - ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, - H5P_DEFAULT); + ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, H5P_DEFAULT); if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "os_grp_n: H5Lcreate_soft() failed."; + pass = FALSE; + failure_mssg = "os_grp_n: H5Lcreate_soft() failed."; } HDassert(ret >= 0); } /* end if */ else { - HDassert(1 == (u % 2)); - ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, - H5P_DEFAULT); + ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, H5P_DEFAULT); if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "os_grp_n: H5Lcreate_hard() failed."; + pass = FALSE; + failure_mssg = "os_grp_n: H5Lcreate_hard() failed."; } HDassert(ret >= 0); } /* end else */ - u++; - + u++; } /* end while */ if ( pass ) { - ret = H5Gclose(gid); if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "os_grp_n: H5Gclose() failed."; + pass = FALSE; + failure_mssg = "os_grp_n: H5Gclose() failed."; } - assert(ret >= 0); + HDassert(ret >= 0); } if ( pass ) { /* restore low and high bounds */ - if(low >= H5F_LIBVER_V18) { ret = H5Fset_libver_bounds(fid, low, high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_n: H5Fset_libver_bounds() failed(2)."; } @@ -1626,8 +1398,8 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) *------------------------------------------------------------------------- */ void -vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) -{ +vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, + unsigned nlinks) { hid_t gid = -1; hid_t gcpl = -1; H5G_info_t grp_info; @@ -1635,92 +1407,76 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { gid = H5Gopen2(fid, group_name, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Gopen2() failed"; - } + if (gid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gopen2() failed"; + } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { gcpl = H5Gget_create_plist(gid); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Gget_create_plist() failed"; - } + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gget_create_plist() failed"; + } HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Pget_link_creation_order"; - } - else if ( 0 != crt_order_flags ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: 0 != crt_order_flags"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Pget_link_creation_order"; + } + else if (0 != crt_order_flags) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: 0 != crt_order_flags"; + } HDassert(ret >= 0); HDassert(0 == crt_order_flags); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Pclose() failed"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Pclose() failed"; + } HDassert(ret >= 0); } - if ( pass ) { - - memset(&grp_info, 0, sizeof(grp_info)); + if (pass) { + HDmemset(&grp_info, 0, sizeof(grp_info)); ret = H5Gget_info(gid, &grp_info); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Gget_info() failed"; - } - else if ( H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type ) { - - pass = FALSE; - failure_mssg = - "vrfy_os_grp_n: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type"; - } - else if ( nlinks != grp_info.nlinks ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: nlinks != grp_info.nlinks"; - } - else if ( 0 != grp_info.max_corder ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: 0 != grp_info.max_corder"; - } - else if ( FALSE != grp_info.mounted ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: FALSE != grp_info.mounted"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gget_info() failed"; + } + else if (H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type"; + } + else if (nlinks != grp_info.nlinks) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: nlinks != grp_info.nlinks"; + } + else if (0 != grp_info.max_corder) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: 0 != grp_info.max_corder"; + } + else if ( FALSE != grp_info.mounted) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: FALSE != grp_info.mounted"; + } HDassert(ret >= 0); HDassert(H5G_STORAGE_TYPE_SYMBOL_TABLE == grp_info.storage_type); HDassert(nlinks == grp_info.nlinks); @@ -1729,137 +1485,117 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) } u = 0; - while ( ( pass ) && ( u < nlinks ) ) { - + while ((pass) && (u < nlinks)) { H5L_info_t lnk_info; char linkname[32]; htri_t link_exists; - sprintf(linkname, "ln%d_%u", proc_num, u); + HDsprintf(linkname, "ln%d_%u", proc_num, u); link_exists = H5Lexists(gid, linkname, H5P_DEFAULT); - if ( link_exists < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Lexists() failed"; + if (link_exists < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Lexists() failed"; } HDassert(link_exists >= 0); - memset(&lnk_info, 0, sizeof(grp_info)); + HDmemset(&lnk_info, 0, sizeof(grp_info)); ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Lget_info() failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Lget_info() failed"; } - else if ( FALSE != lnk_info.corder_valid ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: FALSE != lnk_info.corder_valid"; + else if ( FALSE != lnk_info.corder_valid) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: FALSE != lnk_info.corder_valid"; } - else if ( H5T_CSET_ASCII != lnk_info.cset ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5T_CSET_ASCII != lnk_info.cset"; + else if (H5T_CSET_ASCII != lnk_info.cset) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5T_CSET_ASCII != lnk_info.cset"; } HDassert(ret >= 0); HDassert(false == lnk_info.corder_valid); HDassert(H5T_CSET_ASCII == lnk_info.cset); - if(0 == (u % 2)) { + if (0 == (u % 2)) { char *slinkval; - if ( H5L_TYPE_SOFT != lnk_info.type ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5L_TYPE_SOFT != lnk_info.type"; + if (H5L_TYPE_SOFT != lnk_info.type) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5L_TYPE_SOFT != lnk_info.type"; } - else if ( (strlen(group_name) + 1) != lnk_info.u.val_size ) { - - pass = FALSE; - failure_mssg = - "vrfy_os_grp_n: (strlen(group_name) + 1) != lnk_info.u.val_size"; + else if ((HDstrlen(group_name) + 1) != lnk_info.u.val_size) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: (HDstrlen(group_name) + 1) != lnk_info.u.val_size"; } HDassert(H5L_TYPE_SOFT == lnk_info.type); - HDassert((strlen(group_name) + 1) == lnk_info.u.val_size); - - slinkval = (char *)malloc(lnk_info.u.val_size); + HDassert((HDstrlen(group_name) + 1) == lnk_info.u.val_size); - if ( ! slinkval ) { + slinkval = (char *) HDmalloc(lnk_info.u.val_size); - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: malloc of slinkval failed"; + if (!slinkval) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: HDmalloc of slinkval failed"; } HDassert(slinkval); - ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, - H5P_DEFAULT); - - if ( ret < 0 ) { + ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, + H5P_DEFAULT); - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Lget_val() failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Lget_val() failed"; } - else if ( 0 != strcmp(slinkval, group_name) ) { - - pass = FALSE; - failure_mssg = - "vrfy_os_grp_n: 0 != strcmp(slinkval, group_name)"; + else if (0 != HDstrcmp(slinkval, group_name)) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: 0 != HDstrcmp(slinkval, group_name)"; } HDassert(ret >= 0); - HDassert(0 == strcmp(slinkval, group_name)); + HDassert(0 == HDstrcmp(slinkval, group_name)); - free(slinkval); + HDfree(slinkval); } /* end if */ else { H5O_info_t root_oinfo; HDassert(1 == (u % 2)); - if ( H5L_TYPE_HARD != lnk_info.type ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5L_TYPE_HARD != lnk_info.type"; + if (H5L_TYPE_HARD != lnk_info.type) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5L_TYPE_HARD != lnk_info.type"; } HDassert(H5L_TYPE_HARD == lnk_info.type); - memset(&root_oinfo, 0, sizeof(root_oinfo)); + HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Oget_info() failed."; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Oget_info() failed."; } - else if ( root_oinfo.addr != lnk_info.u.address ) { - - pass = FALSE; - failure_mssg = - "vrfy_os_grp_n: root_oinfo.addr != lnk_info.u.address"; + else if (root_oinfo.addr != lnk_info.u.address) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: root_oinfo.addr != lnk_info.u.address"; } HDassert(ret >= 0); HDassert(root_oinfo.addr == lnk_info.u.address); } /* end else */ - u++; - + u++; } /* end while */ - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Gclose() failed."; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gclose() failed."; } HDassert(ret >= 0); } return; - } /* vrfy_os_grp_n() */ @@ -1867,8 +1603,8 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) * Function: ds_ctg_i * * Purpose: Create a contiguous dataset w/int datatype. Write data - * to the data set or not as indicated by the write_data - * parameter. + * to the data set or not as indicated by the write_data + * parameter. * * If pass is false on entry, do nothing. * @@ -1882,106 +1618,91 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) * *------------------------------------------------------------------------- */ -void -ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *wdata = NULL; unsigned u; hid_t dsid = -1; hid_t sid = -1; - hsize_t dims[1] = {DSET_DIMS}; + hsize_t dims[1] = { DSET_DIMS }; herr_t ret; - if ( pass ) { - + if (pass) { sid = H5Screate_simple(1, dims, NULL); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_i: H5Screate_simple() failed"; + if (sid <= 0) { + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Screate_simple() failed"; } HDassert(sid > 0); } - if ( pass ) { - - dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); + if (pass) { + dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_i: H5Dcreate2() failed"; + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Dcreate2() failed"; } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_i: H5Sclose() failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Sclose() failed"; } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - wdata = (int *)malloc(sizeof(int) * DSET_DIMS); - - if ( ! wdata ) { + if ((pass) && (write_data)) { + wdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS); - pass = FALSE; - failure_mssg = "ds_ctg_i: malloc of wdata failed."; + if (!wdata) { + pass = FALSE; + failure_mssg = "ds_ctg_i: HDmalloc of wdata failed."; } HDassert(wdata); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_DIMS; u++) - - wdata[u] = (int)u; - - ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, wdata); + if ((pass) && (write_data)) { + for (u = 0; u < DSET_DIMS; u++) + wdata[u] = (int) u; - if ( ret < 0 ) { + ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, wdata); - pass = FALSE; - failure_mssg = "ds_ctg_i: H5Dwrite() failed."; + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Dwrite() failed."; } HDassert(ret >= 0); - free(wdata); - } - - if ( pass ) { + HDfree(wdata); + } + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_i: H5Dclose() failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Dclose() failed"; } HDassert(ret >= 0); } return; - } /* ds_ctg_i */ /*------------------------------------------------------------------------- * Function: vrfy_ds_ctg_i * - * Purpose: Validate a contiguous datasets w/int datatypes. Validate - * data if indicated via the write_data parameter. + * Purpose: Validate a contiguous datasets w/int datatypes. Validate + * data if indicated via the write_data parameter. * * If pass is false on entry, do nothing. * @@ -1995,9 +1716,8 @@ ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *rdata = NULL; unsigned u; hid_t dsid = -1; @@ -2011,225 +1731,187 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) htri_t type_equal; herr_t ret; - if ( pass ) { - + if (pass) { dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dopen2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dopen2() failed."; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { sid = H5Dget_space(dsid); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dget_space() failed."; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_space() failed."; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { ndims = H5Sget_simple_extent_ndims(sid); - if ( 1 != ndims ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: 1 != ndims"; - } + if (1 != ndims) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: 1 != ndims"; + } HDassert(1 == ndims); } - if ( pass ) { - + if (pass) { ret = H5Sget_simple_extent_dims(sid, dims, max_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Sget_simple_extent_dims() failed"; - } - else if ( DSET_DIMS != dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != dims[0]"; - } - else if ( DSET_DIMS != max_dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != max_dims[0]"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Sget_simple_extent_dims() failed"; + } + else if ( DSET_DIMS != dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != dims[0]"; + } + else if ( DSET_DIMS != max_dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != max_dims[0]"; + } HDassert(ret >= 0); HDassert(DSET_DIMS == dims[0]); HDassert(DSET_DIMS == max_dims[0]); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { tid = H5Dget_type(dsid); - if ( tid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dget_type() failed."; - } + if (tid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_type() failed."; + } HDassert(tid > 0); } - if ( pass ) { - + if (pass) { type_equal = H5Tequal(tid, H5T_NATIVE_INT); - if ( 1 != type_equal ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: type not H5T_NATIVE_INT"; - } + if (1 != type_equal) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: type not H5T_NATIVE_INT"; + } HDassert(1 == type_equal); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Tclose() failed."; - } - assert(ret >= 0); + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Tclose() failed."; + } + HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dget_space_status(dsid, &allocation); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dget_space_status() failed."; - } - else if ( write_data && ( allocation != H5D_SPACE_STATUS_ALLOCATED ) ) { - - pass = FALSE; - failure_mssg = - "vrfy_ds_ctg_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; - } - else if ( !write_data && - ( allocation != H5D_SPACE_STATUS_NOT_ALLOCATED ) ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_space_status() failed."; + } + else if (write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED)) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; + } + else if (!write_data + && (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED)) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; + } HDassert(ret >= 0); - HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) || - (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); + HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) + || (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); } - if ( pass ) { - + if (pass) { dcpl = H5Dget_create_plist(dsid); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dget_create_plist() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_create_plist() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { layout = H5Pget_layout(dcpl); - if ( H5D_CONTIGUOUS != layout ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5D_CONTIGUOUS != layout"; - } + if (H5D_CONTIGUOUS != layout) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5D_CONTIGUOUS != layout"; + } HDassert(H5D_CONTIGUOUS == layout); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - rdata = (int *)malloc(sizeof(int) * DSET_DIMS); + if ((pass) && (write_data)) { + rdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS); - if ( ! rdata ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: malloc of rdata failed."; - } + if (!rdata) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: HDmalloc of rdata failed."; + } HDassert(rdata); } - if ( ( pass ) && ( write_data ) ) { - - ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, rdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dread() failed."; - } + if ((pass) && (write_data)) { + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, rdata); + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dread() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_DIMS; u++) { - - if ( (int)u != rdata[u] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: u != rdata[u]."; - break; - } - HDassert((int)u == rdata[u]); - } + if ((pass) && (write_data)) { + for (u = 0; u < DSET_DIMS; u++) { + if ((int) u != rdata[u]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: u != rdata[u]."; + break; + } + HDassert((int )u == rdata[u]); + } - free(rdata); + HDfree(rdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dclose() failed"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dclose() failed"; + } HDassert(ret >= 0); } @@ -2242,8 +1924,8 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) * Function: ds_chk_i * * Purpose: Create a chunked dataset w/int datatype. Write data - * to the data set or not as indicated by the write_data - * parameter. + * to the data set or not as indicated by the write_data + * parameter. * * If pass is false on entry, do nothing. * @@ -2257,142 +1939,121 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *wdata = NULL; unsigned u; hid_t dsid = -1; hid_t dcpl = -1; hid_t sid = -1; - hsize_t dims[1] = {DSET_DIMS}; - hsize_t chunk_dims[1] = {DSET_CHUNK_DIMS}; + hsize_t dims[1] = { DSET_DIMS }; + hsize_t chunk_dims[1] = { DSET_CHUNK_DIMS }; herr_t ret; - if ( pass ) { - + if (pass) { sid = H5Screate_simple(1, dims, NULL); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Screate_simple() failed."; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Screate_simple() failed."; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { dcpl = H5Pcreate(H5P_DATASET_CREATE); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Pcreate() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Pcreate() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pset_chunk(dcpl, 1, chunk_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Pset_chunk() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Pset_chunk() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - - dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, - H5P_DEFAULT, dcpl, H5P_DEFAULT); + if (pass) { + dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, + H5P_DEFAULT, dcpl, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Dcreate2() failed"; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Dcreate2() failed"; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - wdata = (int *)malloc(sizeof(int) * DSET_DIMS); + if ((pass) && (write_data)) { + wdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS); - if ( ! wdata ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: malloc of wdata failed."; - } + if (!wdata) { + pass = FALSE; + failure_mssg = "ds_chk_i: HDmalloc of wdata failed."; + } HDassert(wdata); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_DIMS; u++) - wdata[u] = (int)u; + if ((pass) && (write_data)) { + for (u = 0; u < DSET_DIMS; u++) + wdata[u] = (int) u; - ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, wdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Dwrite() failed."; - } + ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, wdata); + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Dwrite() failed."; + } HDassert(ret >= 0); - - free(wdata); + HDfree(wdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Dclose() failed."; + } HDassert(ret >= 0); } return; - } /* ds_chk_i */ /*------------------------------------------------------------------------- * Function: vrfy_ds_chk_i * - * Purpose: Validate a chunked datasets w/int datatypes. Validate - * data if indicated via the write_data parameter. + * Purpose: Validate a chunked datasets w/int datatypes. Validate + * data if indicated via the write_data parameter. * * If pass is false on entry, do nothing. * @@ -2406,9 +2067,8 @@ ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *rdata = NULL; unsigned u; hid_t dsid = -1; @@ -2422,249 +2082,204 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) htri_t type_equal; herr_t ret; - if ( pass ) { - + if (pass) { dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dopen2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dopen2() failed."; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { sid = H5Dget_space(dsid); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dget_space() failed."; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_space() failed."; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { ndims = H5Sget_simple_extent_ndims(sid); - if ( 1 != ndims ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: 1 != ndims"; - } + if (1 != ndims) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: 1 != ndims"; + } HDassert(1 == ndims); } - if ( pass ) { - + if (pass) { ret = H5Sget_simple_extent_dims(sid, dims, max_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Sget_simple_extent_dims() failed"; - } - else if ( DSET_DIMS != dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != dims[0]"; - } - else if ( DSET_DIMS != max_dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != max_dims[0]"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Sget_simple_extent_dims() failed"; + } + else if ( DSET_DIMS != dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != dims[0]"; + } + else if ( DSET_DIMS != max_dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != max_dims[0]"; + } HDassert(ret >= 0); HDassert(DSET_DIMS == dims[0]); HDassert(DSET_DIMS == max_dims[0]); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { tid = H5Dget_type(dsid); - if ( tid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dget_type() failed."; - } + if (tid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_type() failed."; + } HDassert(tid > 0); } - if ( pass ) { - + if (pass) { type_equal = H5Tequal(tid, H5T_NATIVE_INT); - if ( 1 != type_equal ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: tid != H5T_NATIVE_INT"; - } + if (1 != type_equal) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: tid != H5T_NATIVE_INT"; + } HDassert(1 == type_equal); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Tclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Tclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dget_space_status(dsid, &allocation); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dget_space_status() failed."; - } - else if ( write_data && ( allocation != H5D_SPACE_STATUS_ALLOCATED ) ) { - - pass = FALSE; - failure_mssg = - "vrfy_ds_chk_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; - } - else if ( !write_data && - ( allocation != H5D_SPACE_STATUS_NOT_ALLOCATED ) ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_space_status() failed."; + } + else if (write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED)) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; + } + else if (!write_data && (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED)) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; + } HDassert(ret >= 0); - HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) || - (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); + HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) + || (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); } - if ( pass ) { - + if (pass) { dcpl = H5Dget_create_plist(dsid); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dget_create_plist() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_create_plist() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { layout = H5Pget_layout(dcpl); - if ( H5D_CHUNKED != layout ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5D_CHUNKED != layout"; - } + if (H5D_CHUNKED != layout) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5D_CHUNKED != layout"; + } HDassert(H5D_CHUNKED == layout); } - if ( pass ) { - + if (pass) { ret = H5Pget_chunk(dcpl, 1, chunk_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Pget_chunk"; - } - else if ( DSET_CHUNK_DIMS != chunk_dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: "; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Pget_chunk"; + } + else if ( DSET_CHUNK_DIMS != chunk_dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: "; + } HDassert(ret >= 0); HDassert(DSET_CHUNK_DIMS == chunk_dims[0]); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - rdata = (int *)malloc(sizeof(int) * DSET_DIMS); + if ((pass) && (write_data)) { + rdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS); - if ( ! rdata ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: malloc of rdata failed."; - } + if (!rdata) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: HDmalloc of rdata failed."; + } HDassert(rdata); } - if ( ( pass ) && ( write_data ) ) { - - ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - rdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dread() failed."; - } + if ((pass) && (write_data)) { + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dread() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_DIMS; u++) { - - if ( (int)u != rdata[u] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: u != rdata[u]"; - break; - } - HDassert((int)u == rdata[u]); + if ((pass) && (write_data)) { + for (u = 0; u < DSET_DIMS; u++) { + if ((int) u != rdata[u]) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: u != rdata[u]"; + break; + } + HDassert((int )u == rdata[u]); } - free(rdata); + HDfree(rdata); } /* end if */ - - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dclose() failed."; + } HDassert(ret >= 0); } return; - } /* vrfy_ds_chk_i() */ @@ -2672,8 +2287,8 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) * Function: ds_cpt_i * * Purpose: Create a compact dataset w/int datatype. Write data - * to the data set or not as indicated by the write_data - * parameter. + * to the data set or not as indicated by the write_data + * parameter. * * If pass is false on entry, do nothing. * @@ -2687,129 +2302,110 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *wdata = NULL; unsigned u; hid_t dsid = -1; hid_t dcpl = -1; hid_t sid = -1; - hsize_t dims[1] = {DSET_COMPACT_DIMS}; + hsize_t dims[1] = { DSET_COMPACT_DIMS }; herr_t ret; - if ( pass ) { - + if (pass) { sid = H5Screate_simple(1, dims, NULL); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Screate_simple() failed."; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Screate_simple() failed."; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { dcpl = H5Pcreate(H5P_DATASET_CREATE); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Pcreate() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Pcreate() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pset_layout(dcpl, H5D_COMPACT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Pset_layout() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Pset_layout() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - - dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, - H5P_DEFAULT, dcpl, H5P_DEFAULT); + if (pass) { + dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, + H5P_DEFAULT, dcpl, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Dcreate2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Dcreate2() failed."; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - wdata = (int *)malloc(sizeof(int) * DSET_COMPACT_DIMS); + if ((pass) && (write_data)) { + wdata = (int *) HDmalloc(sizeof(int) * DSET_COMPACT_DIMS); - if ( ! wdata ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: malloc of wdata failed."; - } + if (!wdata) { + pass = FALSE; + failure_mssg = "ds_cpt_i: HDmalloc of wdata failed."; + } HDassert(wdata); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_COMPACT_DIMS; u++) - wdata[u] = (int)u; + if ((pass) && (write_data)) { + for (u = 0; u < DSET_COMPACT_DIMS; u++) + wdata[u] = (int) u; - ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, wdata); + ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, wdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Dwrite() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Dwrite() failed."; + } HDassert(ret >= 0); - free(wdata); + HDfree(wdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Dclose() failed."; + } HDassert(ret >= 0); } @@ -2821,8 +2417,8 @@ ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) /*------------------------------------------------------------------------- * Function: vrfy_ds_cpt_i * - * Purpose: Validate a compact datasets w/int datatypes. Validate - * data if indicated via the write_data parameter. + * Purpose: Validate a compact datasets w/int datatypes. Validate + * data if indicated via the write_data parameter. * * If pass is false on entry, do nothing. * @@ -2836,9 +2432,8 @@ ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *rdata = NULL; unsigned u; hid_t dsid = -1; @@ -2852,232 +2447,195 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) htri_t type_equal; herr_t ret; - if ( pass ) { - + if (pass) { dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dopen2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dopen2() failed."; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { sid = H5Dget_space(dsid); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dget_space() failed."; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_space() failed."; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { ndims = H5Sget_simple_extent_ndims(sid); - if ( 1 != ndims ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: 1 != ndims"; - } + if (1 != ndims) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: 1 != ndims"; + } HDassert(1 == ndims); } - if ( pass ) { - + if (pass) { ret = H5Sget_simple_extent_dims(sid, dims, max_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Sget_simple_extent_dims() failed"; - } - else if ( DSET_COMPACT_DIMS != dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != dims[0]"; - } - else if ( DSET_COMPACT_DIMS != max_dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != max_dims[0]"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Sget_simple_extent_dims() failed"; + } + else if ( DSET_COMPACT_DIMS != dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != dims[0]"; + } + else if ( DSET_COMPACT_DIMS != max_dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != max_dims[0]"; + } HDassert(ret >= 0); HDassert(DSET_COMPACT_DIMS == dims[0]); HDassert(DSET_COMPACT_DIMS == max_dims[0]); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { tid = H5Dget_type(dsid); - if ( tid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dget_type() failed."; - } + if (tid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_type() failed."; + } HDassert(tid > 0); } - if ( pass ) { - + if (pass) { type_equal = H5Tequal(tid, H5T_NATIVE_INT); - if ( 1 != type_equal ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: type != H5T_NATIVE_INT"; - } + if (1 != type_equal) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: type != H5T_NATIVE_INT"; + } HDassert(1 == type_equal); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Tclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Tclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dget_space_status(dsid, &allocation); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dget_space_status() failed."; - } - else if ( H5D_SPACE_STATUS_ALLOCATED != allocation ) { - - pass = FALSE; - failure_mssg = - "vrfy_ds_cpt_i: H5D_SPACE_STATUS_ALLOCATED != allocation"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_space_status() failed."; + } + else if (H5D_SPACE_STATUS_ALLOCATED != allocation) { + pass = FALSE; + failure_mssg = + "vrfy_ds_cpt_i: H5D_SPACE_STATUS_ALLOCATED != allocation"; + } HDassert(ret >= 0); HDassert(H5D_SPACE_STATUS_ALLOCATED == allocation); } - if ( pass ) { - + if (pass) { dcpl = H5Dget_create_plist(dsid); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dget_create_plist() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_create_plist() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { layout = H5Pget_layout(dcpl); - if ( H5D_COMPACT != layout ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5D_COMPACT != layout"; - } + if (H5D_COMPACT != layout) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5D_COMPACT != layout"; + } HDassert(H5D_COMPACT == layout); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Pclose() failed."; + } HDassert(ret >= 0); - } - - if ( ( pass ) && ( write_data ) ) { - - rdata = (int *)malloc(sizeof(int) * DSET_COMPACT_DIMS); + } - if ( ! rdata ) { + if ((pass) && (write_data)) { + rdata = (int *) HDmalloc(sizeof(int) * DSET_COMPACT_DIMS); - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: malloc of rdata failed."; - } + if (!rdata) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: HDmalloc of rdata failed."; + } HDassert(rdata); } - if ( ( pass ) && ( write_data ) ) { - - ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, rdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dread() failed."; - } + if ((pass) && (write_data)) { + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, rdata); + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dread() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_COMPACT_DIMS; u++) { - - if ( (int)u != rdata[u] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: (int)u != rdata[u]"; - break; - } - HDassert((int)u == rdata[u]); + if ((pass) && (write_data)) { + for (u = 0; u < DSET_COMPACT_DIMS; u++) { + if ((int) u != rdata[u]) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: (int)u != rdata[u]"; + break; + } + HDassert((int )u == rdata[u]); } - free(rdata); + HDfree(rdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dclose() failed."; + } HDassert(ret >= 0); } return; - } /* vrfy_ds_cpt_i() */ /*------------------------------------------------------------------------- * Function: ds_ctg_v * - * Purpose: Create a contiguous dataset w/variable-length datatype. - * Write data to the data set or not as indicated by the - * write_data parameter. + * Purpose: Create a contiguous dataset w/variable-length datatype. + * Write data to the data set or not as indicated by the + * write_data parameter. * * If pass is false on entry, do nothing. * @@ -3091,166 +2649,142 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) { hid_t dsid = -1; hid_t sid = -1; hid_t tid = -1; - hsize_t dims[1] = {DSET_SMALL_DIMS}; + hsize_t dims[1] = { DSET_SMALL_DIMS }; herr_t ret; hvl_t *wdata = NULL; unsigned u; - if ( pass ) { - + if (pass) { sid = H5Screate_simple(1, dims, NULL); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Screate_simple"; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Screate_simple"; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { tid = H5Tvlen_create(H5T_NATIVE_INT); - if ( tid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Tvlen_create() failed."; - } + if (tid <= 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Tvlen_create() failed."; + } HDassert(tid > 0); } - if ( pass ) { - - dsid = H5Dcreate2(fid, dset_name, tid, sid, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); + if (pass) { + dsid = H5Dcreate2(fid, dset_name, tid, sid, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Dcreate2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dcreate2() failed."; + } HDassert(dsid > 0); } - if ( ( pass ) && ( write_data ) ) { - - wdata = (hvl_t *)malloc(sizeof(hvl_t) * DSET_SMALL_DIMS); + if ((pass) && (write_data)) { + wdata = (hvl_t *) HDmalloc(sizeof(hvl_t) * DSET_SMALL_DIMS); - if ( ! wdata ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: malloc of wdata failed."; - } + if (!wdata) { + pass = FALSE; + failure_mssg = "ds_ctg_v: HDmalloc of wdata failed."; + } HDassert(wdata); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_SMALL_DIMS; u++) { - + if ((pass) && (write_data)) { + for (u = 0; u < DSET_SMALL_DIMS; u++) { int *tdata; unsigned len; unsigned v; len = (u % 10) + 1; - tdata = (int *)malloc(sizeof(int) * len); - - if ( !tdata ) { + tdata = (int *) HDmalloc(sizeof(int) * len); - pass = FALSE; - failure_mssg = "ds_ctg_v: malloc of tdata failed."; - break; - } + if (!tdata) { + pass = FALSE; + failure_mssg = "ds_ctg_v: HDmalloc of tdata failed."; + break; + } HDassert(tdata); - for(v = 0; v < len; v++) - tdata[v] = (int)(u + v); + for (v = 0; v < len; v++) + tdata[v] = (int) (u + v); - wdata[u].len = len; - wdata[u].p = tdata; + wdata[u].len = len; + wdata[u].p = tdata; } /* end for */ } - if ( ( pass ) && ( write_data ) ) { - + if ((pass) && (write_data)) { ret = H5Dwrite(dsid, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Dwrite() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dwrite() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - + if ((pass) && (write_data)) { ret = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, wdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Dvlen_reclaim() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dvlen_reclaim() failed."; + } HDassert(ret >= 0); - free(wdata); - + HDfree(wdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( sid < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Sclose() failed."; - } + if (sid < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tid); - if ( tid < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Tclose() failed."; - } + if (tid < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Tclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dclose() failed."; + } HDassert(ret >= 0); } return; - } /* ds_ctg_v() */ /*------------------------------------------------------------------------- * Function: vrfy_ds_ctg_v * - * Purpose: Validate a contiguous datasets w/variable-length datatypes. - * Validate data if indicated via the write_data parameter. + * Purpose: Validate a contiguous datasets w/variable-length datatypes. + * Validate data if indicated via the write_data parameter. * * If pass is false on entry, do nothing. * @@ -3264,9 +2798,8 @@ ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) { hid_t dsid = -1; hid_t sid = -1; hid_t tid = -1; @@ -3281,283 +2814,240 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dopen2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dopen2() failed."; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { sid = H5Dget_space(dsid); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dget_space() failed"; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_space() failed"; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { ndims = H5Sget_simple_extent_ndims(sid); - if ( 1 != ndims ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: 1 != ndims"; - } + if (1 != ndims) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: 1 != ndims"; + } HDassert(1 == ndims); } - if ( pass ) { - + if (pass) { ret = H5Sget_simple_extent_dims(sid, dims, max_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Sget_simple_extent_dims() failed."; - } - else if ( DSET_SMALL_DIMS != dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != dims[0]"; - } - else if ( DSET_SMALL_DIMS != max_dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != max_dims[0]"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Sget_simple_extent_dims() failed."; + } + else if ( DSET_SMALL_DIMS != dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != dims[0]"; + } + else if ( DSET_SMALL_DIMS != max_dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != max_dims[0]"; + } HDassert(ret >= 0); HDassert(DSET_SMALL_DIMS == dims[0]); HDassert(DSET_SMALL_DIMS == max_dims[0]); } - if ( pass ) { - + if (pass) { tid = H5Dget_type(dsid); - if ( tid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dget_type() failed."; - } + if (tid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_type() failed."; + } HDassert(tid > 0); } - if ( pass ) { - + if (pass) { tmp_tid = H5Tvlen_create(H5T_NATIVE_INT); - if ( tmp_tid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Tvlen_create() failed."; - } + if (tmp_tid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Tvlen_create() failed."; + } HDassert(tmp_tid > 0); } - if ( pass ) { - + if (pass) { type_equal = H5Tequal(tid, tmp_tid); - if ( 1 != type_equal ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: type != vlen H5T_NATIVE_INT"; - } + if (1 != type_equal) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: type != vlen H5T_NATIVE_INT"; + } HDassert(1 == type_equal); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tmp_tid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dget_space_status(dsid, &allocation); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dget_space_status() failed"; - } - else if ( write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED) ) { - - pass = FALSE; - failure_mssg = - "vrfy_ds_ctg_v: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; - } - else if ( !write_data && - ( allocation != H5D_SPACE_STATUS_NOT_ALLOCATED ) ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_space_status() failed"; + } + else if (write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED)) { + pass = FALSE; + failure_mssg = + "vrfy_ds_ctg_v: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; + } + else if (!write_data + && (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED)) { + pass = FALSE; + failure_mssg = + "vrfy_ds_ctg_v: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; + } HDassert(ret >= 0); - HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) || - (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); + HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) + || (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); } - if ( pass ) { - + if (pass) { dcpl = H5Dget_create_plist(dsid); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dget_create_plist() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_create_plist() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { layout = H5Pget_layout(dcpl); - if ( H5D_CONTIGUOUS != layout ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5D_CONTIGUOUS != layout"; - } + if (H5D_CONTIGUOUS != layout) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5D_CONTIGUOUS != layout"; + } HDassert(H5D_CONTIGUOUS == layout); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { + if ((pass) && (write_data)) { + rdata = (hvl_t *) HDmalloc(sizeof(hvl_t) * DSET_SMALL_DIMS); - rdata = (hvl_t *)malloc(sizeof(hvl_t) * DSET_SMALL_DIMS); - - if ( !rdata ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: malloc of rdata failed."; - } + if (!rdata) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: HDmalloc of rdata failed."; + } HDassert(rdata); } - if ( ( pass ) && ( write_data ) ) { - + if ((pass) && (write_data)) { ret = H5Dread(dsid, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dread() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dread() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_SMALL_DIMS; u++) { + if ((pass) && (write_data)) { + for (u = 0; u < DSET_SMALL_DIMS; u++) { unsigned len; unsigned v; - len = (unsigned)rdata[u].len; - for(v = 0; v < len; v++) { - int *tdata = (int *)rdata[u].p; - - if ( !tdata ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: !tdata"; - break; - } - else if ( (int)(u + v) != tdata[v] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: (int)(u + v) != tdata[v]"; - break; - } + len = (unsigned) rdata[u].len; + for (v = 0; v < len; v++) { + int *tdata = (int *) rdata[u].p; + + if (!tdata) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: !tdata"; + break; + } + else if ((int) (u + v) != tdata[v]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: (int)(u + v) != tdata[v]"; + break; + } HDassert(tdata); - HDassert((int)(u + v) == tdata[v]); + HDassert((int )(u + v) == tdata[v]); } /* end for */ } /* end for */ } - if ( ( pass ) && ( write_data ) ) { - + if ((pass) && (write_data)) { ret = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, rdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dvlen_reclaim() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dvlen_reclaim() failed."; + } HDassert(ret >= 0); - free(rdata); + HDfree(rdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dclose() failed."; + } HDassert(ret >= 0); } return; - } /* vrfy_ds_ctg_v() */ - + /*------------------------------------------------------------------------- * Function: create_zoo * @@ -3596,203 +3086,202 @@ create_zoo(hid_t fid, const char *base_path, int proc_num) /* Add & verify an empty "new style" group */ if ( pass ) { - sprintf(full_path, "%s/A", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/A", base_path); + HDassert(HDstrlen(full_path) < 1024); ns_grp_0(fid, full_path); } if ( pass ) { - sprintf(full_path, "%s/A", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/A", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_0(fid, full_path); } /* Add & verify a compact "new style" group (3 link messages) */ if ( pass ) { - sprintf(full_path, "%s/B", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/B", base_path); + HDassert(HDstrlen(full_path) < 1024); ns_grp_c(fid, full_path, 3); } if ( pass ) { - sprintf(full_path, "%s/B", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/B", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_c(fid, full_path, 3); } - /* Add & verify a dense "new style" group (w/300 links, in v2 B-tree & + /* Add & verify a dense "new style" group (w/300 links, in v2 B-tree & * fractal heap) */ if ( pass ) { - sprintf(full_path, "%s/C", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/C", base_path); + HDassert(HDstrlen(full_path) < 1024); ns_grp_d(fid, full_path, 300); } if ( pass ) { - sprintf(full_path, "%s/C", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/C", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_d(fid, full_path, 300); } /* Add & verify an empty "old style" group to file */ if ( pass ) { - sprintf(full_path, "%s/D", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/D", base_path); + HDassert(HDstrlen(full_path) < 1024); os_grp_0(fid, full_path); } if ( pass ) { - sprintf(full_path, "%s/D", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/D", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_os_grp_0(fid, full_path); } - /* Add & verify an "old style" group (w/300 links, in v1 B-tree & - * local heap) to file + /* Add & verify an "old style" group (w/300 links, in v1 B-tree & + * local heap) to file */ if ( pass ) { - sprintf(full_path, "%s/E", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/E", base_path); + HDassert(HDstrlen(full_path) < 1024); os_grp_n(fid, full_path, proc_num, 300); } if ( pass ) { - sprintf(full_path, "%s/E", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/E", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_os_grp_n(fid, full_path, proc_num, 300); } - /* Add & verify a contiguous dataset w/integer datatype (but no data) - * to file + /* Add & verify a contiguous dataset w/integer datatype (but no data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/F", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/F", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_ctg_i(fid, full_path, FALSE); } if ( pass ) { - sprintf(full_path, "%s/F", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/F", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_i(fid, full_path, FALSE); } - /* Add & verify a contiguous dataset w/integer datatype (with data) - * to file + /* Add & verify a contiguous dataset w/integer datatype (with data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/G", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/G", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_ctg_i(fid, full_path, TRUE); } if ( pass ) { - sprintf(full_path, "%s/G", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/G", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_i(fid, full_path, TRUE); } - /* Add & verify a chunked dataset w/integer datatype (but no data) - * to file + /* Add & verify a chunked dataset w/integer datatype (but no data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/H", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/H", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_chk_i(fid, full_path, FALSE); } if ( pass ) { - sprintf(full_path, "%s/H", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/H", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_chk_i(fid, full_path, FALSE); } - /* Add & verify a chunked dataset w/integer datatype (and data) - * to file + /* Add & verify a chunked dataset w/integer datatype (and data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/I", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/I", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_chk_i(fid, full_path, TRUE); } if ( pass ) { - sprintf(full_path, "%s/I", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/I", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_chk_i(fid, full_path, TRUE); } - /* Add & verify a compact dataset w/integer datatype (but no data) - * to file + /* Add & verify a compact dataset w/integer datatype (but no data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/J", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/J", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_cpt_i(fid, full_path, FALSE); } if ( pass ) { - sprintf(full_path, "%s/J", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/J", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_cpt_i(fid, full_path, FALSE); } - /* Add & verify a compact dataset w/integer datatype (and data) - * to file + /* Add & verify a compact dataset w/integer datatype (and data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/K", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/K", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_cpt_i(fid, full_path, TRUE); } if ( pass ) { - sprintf(full_path, "%s/K", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/K", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_cpt_i(fid, full_path, TRUE); } - /* Add & verify a contiguous dataset w/variable-length datatype - * (but no data) to file + /* Add & verify a contiguous dataset w/variable-length datatype + * (but no data) to file */ if ( pass ) { - sprintf(full_path, "%s/L", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/L", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_ctg_v(fid, full_path, FALSE); } if ( pass ) { - sprintf(full_path, "%s/L", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/L", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_v(fid, full_path, FALSE); } - /* Add & verify a contiguous dataset w/variable-length datatype - * (and data) to file + /* Add & verify a contiguous dataset w/variable-length datatype + * (and data) to file */ if ( pass ) { - sprintf(full_path, "%s/M", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/M", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_ctg_v(fid, full_path, TRUE); } if ( pass ) { - sprintf(full_path, "%s/M", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/M", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_v(fid, full_path, TRUE); } return; - } /* create_zoo() */ - + /*------------------------------------------------------------------------- * Function: validate_zoo * - * Purpose: Given the path to a group in which a "zoo" has been - * constructed, validate the objects in the "zoo". + * Purpose: Given the path to a group in which a "zoo" has been + * constructed, validate the objects in the "zoo". * * If pass is false on entry, do nothing. * @@ -3824,116 +3313,115 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num) /* validate an empty "new style" group */ if ( pass ) { - sprintf(full_path, "%s/A", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/A", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_0(fid, full_path); } /* validate a compact "new style" group (3 link messages) */ if ( pass ) { - sprintf(full_path, "%s/B", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/B", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_c(fid, full_path, 3); } - /* validate a dense "new style" group (w/300 links, in v2 B-tree & + /* validate a dense "new style" group (w/300 links, in v2 B-tree & * fractal heap) */ if ( pass ) { - sprintf(full_path, "%s/C", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/C", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_d(fid, full_path, 300); } /* validate an empty "old style" group in file */ if ( pass ) { - sprintf(full_path, "%s/D", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/D", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_os_grp_0(fid, full_path); } - /* validate an "old style" group (w/300 links, in v1 B-tree & + /* validate an "old style" group (w/300 links, in v1 B-tree & * local heap) */ if ( pass ) { - sprintf(full_path, "%s/E", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/E", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_os_grp_n(fid, full_path, proc_num, 300); } - /* validate a contiguous dataset w/integer datatype (but no data) - * in file. + /* validate a contiguous dataset w/integer datatype (but no data) + * in file. */ if ( pass ) { - sprintf(full_path, "%s/F", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/F", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_i(fid, full_path, FALSE); } - /* validate a contiguous dataset w/integer datatype (with data) - * in file. + /* validate a contiguous dataset w/integer datatype (with data) + * in file. */ if ( pass ) { - sprintf(full_path, "%s/G", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/G", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_i(fid, full_path, TRUE); } - /* validate a chunked dataset w/integer datatype (but no data) - * in file + /* validate a chunked dataset w/integer datatype (but no data) + * in file */ if ( pass ) { - sprintf(full_path, "%s/H", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/H", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_chk_i(fid, full_path, FALSE); } - /* validate a chunked dataset w/integer datatype (and data) - * in file + /* validate a chunked dataset w/integer datatype (and data) + * in file */ if ( pass ) { - sprintf(full_path, "%s/I", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/I", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_chk_i(fid, full_path, TRUE); } - /* Validate a compact dataset w/integer datatype (but no data) - * in file + /* Validate a compact dataset w/integer datatype (but no data) + * in file */ if ( pass ) { - sprintf(full_path, "%s/J", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/J", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_cpt_i(fid, full_path, FALSE); } - /* validate a compact dataset w/integer datatype (and data) - * in file + /* validate a compact dataset w/integer datatype (and data) + * in file */ if ( pass ) { - sprintf(full_path, "%s/K", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/K", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_cpt_i(fid, full_path, TRUE); } - /* validate a contiguous dataset w/variable-length datatype - * (but no data) to file + /* validate a contiguous dataset w/variable-length datatype + * (but no data) to file */ if ( pass ) { - sprintf(full_path, "%s/L", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/L", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_v(fid, full_path, FALSE); } - /* validate a contiguous dataset w/variable-length datatype - * (and data) to file + /* validate a contiguous dataset w/variable-length datatype + * (and data) to file */ if ( pass ) { - sprintf(full_path, "%s/M", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/M", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_v(fid, full_path, TRUE); } return; - } /* validate_zoo() */ diff --git a/test/gheap.c b/test/gheap.c index bf0f18a..5b51c0e 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -15,9 +15,9 @@ * Programmer: Robb Matzke <matzke@llnl.gov> * Tuesday, March 31, 1998 * - * Purpose: Tests the global heap. The global heap is the set of all - * collections but the collections are not related to one - * another by anything that appears in the file format. + * Purpose: Tests the global heap. The global heap is the set of all + * collections but the collections are not related to one + * another by anything that appears in the file format. */ #include "h5test.h" #include "H5ACprivate.h" @@ -28,6 +28,7 @@ #include "H5HGprivate.h" #include "H5Iprivate.h" #include "H5Pprivate.h" +#include "H5VLprivate.h" /* Macros for printing error messages in loops. These print up to * GHEAP_REPEATED_ERR_LIM errors, and suppress the rest */ @@ -56,37 +57,35 @@ const char *FILENAME[] = { NULL }; - + /*------------------------------------------------------------------------- * Function: test_1 * - * Purpose: Writes a sequence of objects to the global heap where each - * object is larger than the one before. + * Purpose: Writes a sequence of objects to the global heap where each + * object is larger than the one before. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_1 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - uint8_t in[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - herr_t status; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + uint8_t in[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("monotonically increasing lengths"); @@ -97,10 +96,10 @@ test_1 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + goto error; + if(NULL == (f = (H5F_t *)H5VL_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; } @@ -116,11 +115,12 @@ test_1 (hid_t fapl) status = H5HG_insert(f, size, out, obj + u); if(status < 0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; - } else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) { + } + else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) { H5_FAILED(); - puts(" Collection addresses are not monotonically increasing"); + HDputs(" Collection addresses are not monotonically increasing"); nerrors++; } } @@ -134,11 +134,12 @@ test_1 (hid_t fapl) H5Eclear2(H5E_DEFAULT); if(NULL == H5HG_read(f, obj + u, in, NULL)) { H5_FAILED(); - puts(" Unable to read object"); + HDputs(" Unable to read object"); nerrors++; - } else if(HDmemcmp(in, out, size)) { + } + else if(HDmemcmp(in, out, size)) { H5_FAILED(); - puts(" Value read doesn't match value written"); + HDputs(" Value read doesn't match value written"); nerrors++; } } @@ -147,51 +148,51 @@ test_1 (hid_t fapl) HDfree(obj); obj = NULL; - if(H5Fclose(file) < 0) goto error; - if(nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_2 * - * Purpose: Writes a sequence of objects to the global heap where each - * object is smaller than the one before. + * Purpose: Writes a sequence of objects to the global heap where each + * object is smaller than the one before. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_2 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - uint8_t in[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + uint8_t in[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + int nerrors = 0; + char filename[1024]; TESTING("monotonically decreasing lengths"); @@ -202,10 +203,10 @@ test_2 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + goto error; + if(NULL == (f = (H5F_t *)H5VL_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; } @@ -216,9 +217,9 @@ test_2 (hid_t fapl) size = GHEAP_TEST_NOBJS - u; HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - if (H5HG_insert (f, size, out, obj + u) < 0) { + if(H5HG_insert(f, size, out, obj + u) < 0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; } } @@ -232,11 +233,12 @@ test_2 (hid_t fapl) H5Eclear2(H5E_DEFAULT); if(NULL == H5HG_read(f, obj + u, in, NULL)) { H5_FAILED(); - puts(" Unable to read object"); + HDputs(" Unable to read object"); nerrors++; - } else if (memcmp (in, out, size)) { + } + else if (memcmp (in, out, size)) { H5_FAILED(); - puts(" Value read doesn't match value written"); + HDputs(" Value read doesn't match value written"); nerrors++; } } @@ -245,51 +247,51 @@ test_2 (hid_t fapl) HDfree(obj); obj = NULL; - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_3 * - * Purpose: Creates a few global heap objects and then removes them all. - * The collection should also be removed. + * Purpose: Creates a few global heap objects and then removes them all. + * The collection should also be removed. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_3 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - herr_t status; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("complete object removal"); @@ -300,11 +302,11 @@ test_3 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[2], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { - H5_FAILED(); - puts(" Unable to create file"); - goto error; + goto error; + if(NULL == (f = (H5F_t *)H5VL_object(file))) { + H5_FAILED(); + HDputs(" Unable to create file"); + goto error; } /* Create some stuff */ @@ -315,7 +317,7 @@ test_3 (hid_t fapl) status = H5HG_insert(f, size, out, obj + u); if (status<0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; } } @@ -325,7 +327,7 @@ test_3 (hid_t fapl) status = H5HG_remove(f, obj + u); if (status<0) { H5_FAILED(); - puts(" Unable to remove object"); + HDputs(" Unable to remove object"); nerrors++; } } @@ -334,52 +336,52 @@ test_3 (hid_t fapl) HDfree(obj); obj = NULL; - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_4 * - * Purpose: Tests the H5HG_remove() feature by writing lots of objects - * and occassionally removing some. When we're done they're all - * removed. + * Purpose: Tests the H5HG_remove() feature by writing lots of objects + * and occassionally removing some. When we're done they're all + * removed. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_4 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - herr_t status; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("partial object removal"); @@ -390,10 +392,10 @@ test_4 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[3], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + goto error; + if(NULL == (f = (H5F_t *)H5VL_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; } @@ -405,21 +407,20 @@ test_4 (hid_t fapl) status = H5HG_insert(f, size, out, obj + u); if (status<0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; } - /* - * Remove every third one beginning with the second, but after the - * next one has already been inserted. That is, insert A, B, C; - * remove B, insert D, E, F; remove E; etc. - */ + /* Remove every third one beginning with the second, but after the + * next one has already been inserted. That is, insert A, B, C; + * remove B, insert D, E, F; remove E; etc. + */ if(1 == (u % 3)) { H5Eclear2(H5E_DEFAULT); status = H5HG_remove(f, obj + u - 1); if (status<0) { H5_FAILED(); - puts(" Unable to remove object"); + HDputs(" Unable to remove object"); nerrors++; } HDmemset(obj + u - 1, 0, sizeof *obj); @@ -430,51 +431,51 @@ test_4 (hid_t fapl) HDfree(obj); obj = NULL; - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_ooo_indices * - * Purpose: Tests that indices can be stored out of order. This can + * Purpose: Tests that indices can be stored out of order. This can * happen when the indices "wrap around" due to many * insertions and deletions (for example, from rewriting a * VL dataset). * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Monday, October 26, 2009 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_ooo_indices(hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; unsigned i, j; - H5HG_t *obj = NULL; - herr_t status; - int nerrors=0; - char filename[1024]; + H5HG_t *obj = NULL; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("out of order indices"); @@ -485,18 +486,20 @@ test_ooo_indices(hid_t fapl) h5_fixname(FILENAME[4], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + if(NULL == (f = (H5F_t *)H5VL_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; - } /* end if */ + } /* Alternately insert 1000 entries and remove the previous group of 1000 - * entries, until the indices wrap around */ - for(i=0; i<66; i++) { + * entries, until the indices wrap around. + */ + for(i = 0; i < 66; i++) { /* Insert 1000 entries. The index into the obj array will alternate up * and down by 1000 so the previous set of insertions is preserved and - * can be deleted. */ + * can be deleted. + */ for(j=1000*((~i&1)); j<1000*((~i&1)+1); j++) { H5Eclear2(H5E_DEFAULT); status = H5HG_insert(f, sizeof(j), &j, &obj[j]); @@ -506,7 +509,7 @@ test_ooo_indices(hid_t fapl) /* Check that the index is as expected */ if(obj[j].idx != ((1000 * i) + j - (1000 * ((~i & 1)))) % ((1u << 16) - 1) + 1) GHEAP_REPEATED_ERR(" Unexpected global heap index"); - } /* end for */ + } /* Remove the previous 1000 entries */ if(i>0) @@ -515,20 +518,21 @@ test_ooo_indices(hid_t fapl) status = H5HG_remove(f, &obj[j]); if (status<0) GHEAP_REPEATED_ERR(" Unable to remove object from global heap"); - } /* end for */ - } /* end for */ + } + } /* The indices should have "wrapped around" on the last iteration */ HDassert(obj[534].idx == 65535); HDassert(obj[535].idx == 1); /* Reopen the file */ - if (H5Fclose(file)<0) goto error; + if (H5Fclose(file) < 0) + goto error; if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + if(NULL == (f = (H5F_t *)H5VL_object(file))) { H5_FAILED(); - puts(" Unable to open file"); + HDputs(" Unable to open file"); goto error; } /* end if */ @@ -538,14 +542,15 @@ test_ooo_indices(hid_t fapl) goto error; if(i != j) { H5_FAILED(); - puts(" Incorrect read value"); + HDputs(" Incorrect read value"); goto error; - } /* end if */ - } /* end for */ - - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + } + } + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; HDfree(obj); obj = NULL; @@ -554,69 +559,67 @@ test_ooo_indices(hid_t fapl) error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); return MAX(1, nerrors); } /* end test_ooo_indices */ - + /*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Tests global heap. + * Function: main * - * Return: Success: zero - * - * Failure: non-zero - * - * Programmer: Robb Matzke - * Tuesday, March 31, 1998 + * Purpose: Tests global heap. * - * Modifications: + * Return: EXIT_SUCCESS/EXIT_FAILURE * *------------------------------------------------------------------------- */ int main (void) { - int nerrors=0; - hid_t fapl; + int nerrors = 0; + hid_t fapl_id = H5I_INVALID_HID; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_reset(); - fapl = h5_fileaccess(); + if ((fapl_id = h5_fileaccess()) < 0) + goto error; /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR api_ctx_pushed = TRUE; - nerrors += test_1(fapl); - nerrors += test_2(fapl); - nerrors += test_3(fapl); - nerrors += test_4(fapl); - nerrors += test_ooo_indices(fapl); + nerrors += test_1(fapl_id); + nerrors += test_2(fapl_id); + nerrors += test_3(fapl_id); + nerrors += test_4(fapl_id); + nerrors += test_ooo_indices(fapl_id); /* Verify symbol table messages are cached */ - nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); if (nerrors) goto error; - puts("All global heap tests passed."); + + HDputs("All global heap tests passed."); /* Pop API context */ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR api_ctx_pushed = FALSE; - h5_cleanup(FILENAME, fapl); - return 0; + h5_cleanup(FILENAME, fapl_id); + HDexit(EXIT_SUCCESS); error: - puts("*** TESTS FAILED ***"); + H5E_BEGIN_TRY { + H5Pclose(fapl_id); + } H5E_END_TRY; if(api_ctx_pushed) H5CX_pop(); - return 1; -} + HDputs("*** TESTS FAILED ***"); + HDexit(EXIT_FAILURE); +} /* end main() */ diff --git a/test/h5test.c b/test/h5test.c index 64a22b1..203e02a 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -42,7 +42,16 @@ * use for HDF5 file access. The first word in the * value is the name of the driver and subsequent data * is interpreted according to the driver. See - * h5_fileaccess() for details. + * h5_get_vfd_fapl() for details. + * + * HDF5_VOL_CONNECTOR: This string describes what VOL connector to + * use for HDF5 file access. The first word in the + * value is the name of the connector and subsequent data + * is interpreted according to the connector. See + * h5_get_vol_fapl() for details. + * + * HDF5_LIBVER_BOUNDS: This string describes what library version bounds to + * use for HDF5 file access. See h5_get_libver_fapl() for details. * * HDF5_PREFIX: A string to add to the beginning of all serial test * file names. This can be used to run tests in a @@ -753,8 +762,8 @@ h5_rmprefix(const char *filename) * Function: h5_fileaccess * * Purpose: Returns a file access template which is the default template - * but with a file driver set according to the constant or - * environment variable HDF5_DRIVER + * but with a file driver, VOL connector, or libver bound set + * according to a constant or environment variable * * Return: Success: A file access property list * Failure: -1 @@ -767,135 +776,34 @@ h5_rmprefix(const char *filename) hid_t h5_fileaccess(void) { - const char *val = NULL; - const char *name; - char s[1024]; hid_t fapl = -1; - /* First use the environment variable, then the constant */ - val = HDgetenv("HDF5_DRIVER"); -#ifdef HDF5_DRIVER - if(!val) - val = HDF5_DRIVER; -#endif - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) return -1; - if(!val || !*val) - return fapl; /* use default */ - - HDstrncpy(s, val, sizeof s); - s[sizeof(s)-1] = '\0'; - if(NULL == (name = HDstrtok(s, " \t\n\r"))) - return fapl; - - if(!HDstrcmp(name, "sec2")) { - /* Unix read() and write() system calls */ - if (H5Pset_fapl_sec2(fapl) < 0) - return -1; - } - else if(!HDstrcmp(name, "stdio")) { - /* Standard C fread() and fwrite() system calls */ - if (H5Pset_fapl_stdio(fapl) < 0) - return -1; - } - else if(!HDstrcmp(name, "core")) { - /* In-memory driver settings (backing store on, 1 MB increment) */ - if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) - return -1; - } - else if(!HDstrcmp(name, "core_paged")) { - /* In-memory driver with write tracking and paging on */ - if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) - return -1; - if(H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0) - return -1; - } - else if(!HDstrcmp(name, "split")) { - /* Split meta data and raw data each using default driver */ - if(H5Pset_fapl_split(fapl, - "-m.h5", H5P_DEFAULT, - "-r.h5", H5P_DEFAULT) < 0) - return -1; - } - else if(!HDstrcmp(name, "multi")) { - /* Multi-file driver, general case of the split driver */ - H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; - const char *memb_name[H5FD_MEM_NTYPES]; - char *sv[H5FD_MEM_NTYPES]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; - H5FD_mem_t mt; - HDmemset(memb_map, 0, sizeof memb_map); - HDmemset(memb_fapl, 0, sizeof memb_fapl); - HDmemset(memb_name, 0, sizeof memb_name); - HDmemset(memb_addr, 0, sizeof memb_addr); + /* Attempt to set up a file driver first */ + if(h5_get_vfd_fapl(fapl) < 0) + return -1; - HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { - memb_fapl[mt] = H5P_DEFAULT; - if(NULL == (sv[mt] = (char *)HDmalloc(H5TEST_MULTI_FILENAME_LEN))) - return -1; - HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); - memb_name[mt] = sv[mt]; - memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); - } /* end for */ - - if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) - return -1; - - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) - HDfree(sv[mt]); - } - else if(!HDstrcmp(name, "family")) { - hsize_t fam_size = 100*1024*1024; /*100 MB*/ - - /* Family of files, each 1MB and using the default driver */ - if((val = HDstrtok(NULL, " \t\n\r"))) - fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); - if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) - return -1; - } - else if(!HDstrcmp(name, "log")) { - unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; - - /* Log file access */ - if((val = HDstrtok(NULL, " \t\n\r"))) - log_flags = (unsigned)HDstrtol(val, NULL, 0); - if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) - return -1; - } - else if(!HDstrcmp(name, "direct")) { -#ifdef H5_HAVE_DIRECT - /* Linux direct read() and write() system calls. Set memory boundary, file block size, - * and copy buffer size to the default values. */ - if(H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0) - return -1; -#endif - } - else if(!HDstrcmp(name, "latest")) { - /* use the latest format */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - return -1; - } - else { - /* Unknown driver */ + /* Next, try to set up a VOL connector */ + if(h5_get_vol_fapl(fapl) < 0) return -1; - } - - return fapl; -} + + /* Finally, check for libver bounds */ + if(h5_get_libver_fapl(fapl) < 0) + return -1; + + return(fapl); +} /* end h5_fileaccess() */ /*------------------------------------------------------------------------- * Function: h5_get_vfd_fapl * - * Purpose: Returns a file access property list which is the default - * fapl but with a file driver set according to the constant or - * environment variable HDF5_DRIVER. + * Purpose: Sets the file driver for a FAPL according to the value specified + * in the constant or environment variable "HDF5_DRIVER". * - * Return: Success: A file access property list ID + * Return: Success: 0 * Failure: -1 * * Programmer: Dana Robinson @@ -903,60 +811,58 @@ h5_fileaccess(void) * *------------------------------------------------------------------------- */ -hid_t -h5_get_vfd_fapl(void) +herr_t +h5_get_vfd_fapl(hid_t fapl) { const char *env = NULL; /* HDF5_DRIVER environment variable */ const char *tok = NULL; /* strtok pointer */ char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ - hid_t fapl = -1; /* fapl to be returned */ /* Get the environment variable, if it exists */ env = HDgetenv("HDF5_DRIVER"); - - /* Create a default fapl */ - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - return -1; +#ifdef HDF5_DRIVER + /* Use the environment variable, then the compile-time constant */ + if(!env) + env = HDF5_DRIVER; +#endif /* If the environment variable was not set, just return - * the default fapl. + * without modifying the FAPL. */ if(!env || !*env) - return fapl; + goto done; /* Get the first 'word' of the environment variable. * If it's nothing (environment variable was whitespace) * just return the default fapl. */ HDstrncpy(buf, env, sizeof(buf)); - HDmemset(buf, 0, sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; if(NULL == (tok = HDstrtok(buf, " \t\n\r"))) - return fapl; + goto done; if(!HDstrcmp(tok, "sec2")) { /* POSIX (section 2) read() and write() system calls */ if(H5Pset_fapl_sec2(fapl) < 0) - return -1; + goto error; } else if(!HDstrcmp(tok, "stdio")) { /* Standard C fread() and fwrite() system calls */ if(H5Pset_fapl_stdio(fapl) < 0) - return -1; + goto error; } else if(!HDstrcmp(tok, "core")) { /* In-memory driver settings (backing store on, 1 MB increment) */ if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) - return -1; + goto error; } else if(!HDstrcmp(tok, "core_paged")) { /* In-memory driver with write tracking and paging on */ if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) - return -1; + goto error; if(H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0) - return -1; + goto error; } else if(!HDstrcmp(tok, "split")) { /* Split meta data and raw data each using default driver */ - if(H5Pset_fapl_split(fapl, - "-m.h5", H5P_DEFAULT, - "-r.h5", H5P_DEFAULT) < 0) - return -1; + if(H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) + goto error; } else if(!HDstrcmp(tok, "multi")) { /* Multi-file driver, general case of the split driver */ H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; @@ -982,19 +888,19 @@ h5_get_vfd_fapl(void) } /* end for */ if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) - return -1; + goto error; for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) HDfree(sv[mt]); } else if(!HDstrcmp(tok, "family")) { /* Family of files, each 1MB and using the default driver */ - hsize_t fam_size = 100*1024*1024; /*100 MB*/ + hsize_t fam_size = 100 * 1024 * 1024; /* 100 MB */ /* Was a family size specified in the environment variable? */ if((tok = HDstrtok(NULL, " \t\n\r"))) - fam_size = (hsize_t)(HDstrtod(tok, NULL) * 1024*1024); + fam_size = (hsize_t)(HDstrtod(tok, NULL) * 1024 * 1024); if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT) < 0) - return -1; + goto error; } else if(!HDstrcmp(tok, "log")) { /* Log file access */ unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; @@ -1004,25 +910,194 @@ h5_get_vfd_fapl(void) log_flags = (unsigned)HDstrtol(tok, NULL, 0); if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) - return -1; + goto error; #ifdef H5_HAVE_DIRECT } else if(!HDstrcmp(tok, "direct")) { /* Linux direct read() and write() system calls. Set memory boundary, * file block size, and copy buffer size to the default values. */ - if(H5Pset_fapl_direct(fapl, 1024, 4096, 8*4096)<0) - return -1; + if(H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0) + goto error; #endif } else { /* Unknown driver */ - return -1; + goto error; } /* end if */ - return fapl; +done: + return 0; + +error: + return -1; } /* end h5_get_vfd_fapl() */ /*------------------------------------------------------------------------- + * Function: h5_get_libver_fapl + * + * Purpose: Sets the library version bounds for a FAPL according to the + * value in the constant or environment variable "HDF5_LIBVER_BOUNDS". + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Quincey Koziol + * November 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +h5_get_libver_fapl(hid_t fapl) +{ + const char *env = NULL; /* HDF5_DRIVER environment variable */ + const char *tok = NULL; /* strtok pointer */ + char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ + + /* Get the environment variable, if it exists */ + env = HDgetenv("HDF5_LIBVER_BOUNDS"); +#ifdef HDF5_LIBVER_BOUNDS + /* Use the environment variable, then the compile-time constant */ + if(!env) + env = HDF5_LIBVER_BOUNDS; +#endif + + /* If the environment variable was not set, just return + * without modifying the FAPL. + */ + if(!env || !*env) + goto done; + + /* Get the first 'word' of the environment variable. + * If it's nothing (environment variable was whitespace) + * just return the default fapl. + */ + HDstrncpy(buf, env, sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; + if(NULL == (tok = HDstrtok(buf, " \t\n\r"))) + goto done; + + if(!HDstrcmp(tok, "latest")) { + /* use the latest format */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + goto error; + } /* end if */ + else { + /* Unknown setting */ + goto error; + } /* end else */ + +done: + return 0; + +error: + return -1; +} /* end h5_get_libver_fapl() */ + + +/*------------------------------------------------------------------------- + * Function: h5_get_vol_fapl + * + * Purpose: Returns a file access property list which is the default + * fapl but with a VOL connector set according to the constant + * or environment variable HDF5_VOL_CONNECTOR. + * + * Return: Success: A file access property list ID + * Failure: -1 + * + * Programmer: Jordan Henderson + * November 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +h5_get_vol_fapl(hid_t fapl) +{ + const char *env = NULL; + const char *tok = NULL; + htri_t connector_is_registered; + char buf[1024]; /* Buffer for tokenizing HDF5_VOL_CONNECTOR */ + void *vol_info = NULL; /* VOL connector info */ + hid_t connector_id = -1; + + /* Get the environment variable, if it exists */ + env = HDgetenv("HDF5_VOL_CONNECTOR"); +#ifdef HDF5_VOL_CONNECTOR + /* Use the environment variable, then the compile-time constant */ + if(!env) + env = HDF5_VOL_CONNECTOR; +#endif + + /* If the environment variable was not set, just return. */ + if(!env || !*env) + goto done; + + /* Get the first 'word' of the environment variable. + * If it's nothing (environment variable was whitespace) just return. + */ + HDstrncpy(buf, env, sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; + if(NULL == (tok = HDstrtok(buf, " \t\n\r"))) + goto done; + + /* First, check to see if the connector is already registered */ + if((connector_is_registered = H5VLis_connector_registered(tok)) < 0) + goto done; + else if(connector_is_registered) { + /* Retrieve the ID of the already-registered VOL connector */ + if((connector_id = H5VLget_connector_id(tok)) < 0) + goto error; + } /* end else-if */ + else { + /* Check for VOL connectors that ship with the library */ + if(!HDstrcmp(tok, "native")) { + connector_id = H5VL_NATIVE; + if(H5Iinc_ref(connector_id) < 0) + goto error; + } else if(!HDstrcmp(tok, "pass_through")) { + connector_id = H5VL_PASSTHRU; + if(H5Iinc_ref(connector_id) < 0) + goto error; + } else { + /* Register the VOL connector */ + /* (NOTE: No provisions for vipl_id currently) */ + if((connector_id = H5VLregister_connector_by_name(tok, H5P_DEFAULT)) < 0) + goto error; + } /* end else */ + } /* end else */ + + /* Was there any connector info specified in the environment variable? */ + if(NULL != (tok = HDstrtok(NULL, " \t\n\r"))) + if(H5VLconnector_str_to_info(tok, connector_id, &vol_info) < 0) + goto error; + + /* Set the VOL connector in the FAPL */ + if(H5Pset_vol(fapl, connector_id, vol_info) < 0) + goto error; + + /* Release VOL connector info, if there was any */ + if(vol_info) + if(H5VLfree_connector_info(connector_id, vol_info) < 0) + goto error; + + /* Close the connector ID */ + if(connector_id >= 0) + if(H5VLunregister_connector(connector_id) < 0) + goto error; + +done: + return 0; + +error: + if(vol_info) + H5VLfree_connector_info(connector_id, vol_info); + if(connector_id >= 0) + H5VLunregister_connector(connector_id); + + return -1; +} /* end h5_get_vol_fapl() */ + + +/*------------------------------------------------------------------------- * Function: h5_no_hwconv * * Purpose: Turn off hardware data type conversions. @@ -1594,15 +1669,11 @@ error: * * Purpose: Callback function for h5_verify_cached_stabs. * - * Return: Success: 0 - * - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * Tuesday, April 12, 2011 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1610,9 +1681,9 @@ h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name, const H5O_info_t *oinfo, void H5_ATTR_UNUSED *udata) { if(oinfo->type == H5O_TYPE_GROUP) - return(H5G__verify_cached_stabs_test(oid)); + return H5G__verify_cached_stabs_test(oid); else - return(0); + return SUCCEED; } /* end h5_verify_cached_stabs_cb() */ @@ -1866,3 +1937,46 @@ error: return NULL; } /* h5_get_dummy_vfd_class */ + +/*------------------------------------------------------------------------- + * Function: h5_get_dummy_vol_class() + * + * Purpose: Returns a disposable, generally non-functional, + * VOL class struct. + * + * In some of the test code, we need a disposable VOL connector + * but we don't want to mess with the real VFDs and we also + * don't have access to the internals of the real VOL connectors + * (which use static globals and functions) to easily duplicate + * them (e.g.: for testing VOL connector ID handling). + * + * This API call will return a pointer to a VOL class that + * can be used to construct a test VOL using H5VLregister_connector(). + * + * Return: Success: A pointer to a VOL class struct + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5VL_class_t * +h5_get_dummy_vol_class(void) +{ + H5VL_class_t *vol_class = NULL; /* Dummy VOL class that will be returned */ + + /* Create the class and initialize everything to zero/NULL */ + if(NULL == (vol_class = (H5VL_class_t *)HDcalloc((size_t)1, sizeof(H5VL_class_t)))) + TEST_ERROR; + + /* Fill in the minimum parameters to make a VOL connector class that + * can be registered. + */ + vol_class->name = "dummy"; + + return vol_class; + +error: + if(vol_class) + HDfree(vol_class); + return NULL; +} /* h5_get_dummy_vol_class */ + diff --git a/test/h5test.h b/test/h5test.h index 8e87192..c72f389 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -142,13 +142,12 @@ H5TEST_DLL int print_func(const char *format, ...); H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_copy_name); H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl); H5TEST_DLL H5FD_class_t *h5_get_dummy_vfd_class(void); +H5TEST_DLL H5VL_class_t *h5_get_dummy_vol_class(void); -/* Functions that will replace VFD-dependent functions that violate - * the single responsibility principle. Unlike their predecessors, - * these new functions do not have hidden side effects. - */ -/* h5_fileaccess() replacement */ -H5TEST_DLL hid_t h5_get_vfd_fapl(void); +/* Functions that will replace components of a FAPL */ +H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id); +H5TEST_DLL herr_t h5_get_vol_fapl(hid_t fapl_id); +H5TEST_DLL herr_t h5_get_libver_fapl(hid_t fapl_id); /* h5_clean_files() replacements */ H5TEST_DLL void h5_delete_test_file(const char *base_name, hid_t fapl); diff --git a/test/istore.c b/test/istore.c index b5bac2c..1d57a2a 100644 --- a/test/istore.c +++ b/test/istore.c @@ -216,7 +216,7 @@ test_create(hid_t f, const char *prefix) /* Create chunked dataset of this dimensionality */ HDsnprintf(name, sizeof name, "%s_%02u", prefix, u); - if ((dataset=new_object(f, name, (int)u, dims, my_chunk_dims)) < 0) + if((dataset = new_object(f, name, (int)u, dims, my_chunk_dims)) < 0) return FAIL; /* Close dataset created */ diff --git a/test/lheap.c b/test/lheap.c index 4f09b6e..e9e626f 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -23,6 +23,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5HLprivate.h" #include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ const char *FILENAME[] = { "lheap", @@ -41,9 +42,7 @@ const char *FILENAME[] = { * heap, close the file, open the file, read data out of the * local heap, close the file. * - * Return: Success: zero - * - * Failure: non-zero + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Robb Matzke * Tuesday, November 24, 1998 @@ -80,7 +79,7 @@ main(void) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if(FAIL == (file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))) goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + if(NULL == (f = (H5F_t *)H5VL_object(file))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -95,7 +94,7 @@ main(void) H5Eprint2(H5E_DEFAULT, stdout); goto error; } - if (NULL == (heap = H5HL_protect(f, heap_addr, H5AC__NO_FLAGS_SET))) { + if(NULL == (heap = H5HL_protect(f, heap_addr, H5AC__NO_FLAGS_SET))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -130,7 +129,7 @@ main(void) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if(FAIL == (file = H5Fopen(filename, H5F_ACC_RDONLY, fapl))) goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + if(NULL == (f = (H5F_t *)H5VL_object(file))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -147,7 +146,7 @@ main(void) if(j > 4) buf[j] = '\0'; - if (NULL == (heap = H5HL_protect(f, heap_addr, H5AC__READ_ONLY_FLAG))) { + if(NULL == (heap = H5HL_protect(f, heap_addr, H5AC__READ_ONLY_FLAG))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -211,7 +210,7 @@ main(void) HDputs("All local heap tests passed."); h5_cleanup(FILENAME, fapl); - return 0; + return EXIT_SUCCESS; error: HDputs("*** TESTS FAILED ***"); @@ -221,6 +220,6 @@ main(void) if(api_ctx_pushed) H5CX_pop(); - return 1; + return EXIT_FAILURE; } diff --git a/test/links.c b/test/links.c index 4d8b810..b1fd9a3 100644 --- a/test/links.c +++ b/test/links.c @@ -4059,7 +4059,7 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo if(H5Fclose(file1) < 0) TEST_ERROR /* Only run this part with VFDs that support SWMR */ - if(H5FD_supports_swmr_test(env_h5_drvr)) { + if(H5FD__supports_swmr_test(env_h5_drvr)) { /* Reopen file1, with read-write and SWMR-write access */ /* Only supported under the latest file format */ @@ -7756,6 +7756,7 @@ done: case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -7844,6 +7845,7 @@ done: case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -8365,9 +8367,9 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if (H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != 16) TEST_ERROR if (UD_CB_TYPE != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been a UD hard link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; } /* Fill the query buffer */ @@ -9015,9 +9017,9 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) gid = H5Oopen(fid, "soft5", plist); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Open object through lesser soft link */ @@ -15061,6 +15063,7 @@ main(void) /* New group revision feature tests */ nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0; + /* XXX: when creation order indexing is fully working, go back and add checks * to these tests to make certain that the creation order values are * correct. diff --git a/test/links_env.c b/test/links_env.c index b32fb32..0cd690a 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -148,11 +148,6 @@ main(void) { hid_t fapl; /* File access property lists */ int nerrors = 0; /* Error from tests */ - const char *env_h5_drvr; /* File Driver value from environment */ - - env_h5_drvr = HDgetenv("HDF5_DRIVER"); - if(env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; h5_reset(); fapl = h5_fileaccess(); @@ -36,6 +36,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5FLprivate.h" #include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5VMprivate.h" #define FILENAME_LEN 1024 @@ -255,7 +256,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -297,7 +298,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30); @@ -400,7 +401,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -432,7 +433,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -477,7 +478,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -526,7 +527,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -569,7 +570,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -681,7 +682,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -712,7 +713,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* should succeed */ @@ -759,7 +760,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -899,11 +900,11 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Retrieve the file's maxaddr */ - if(H5F_get_maxaddr_test(file, &maxaddr) < 0) + if(H5F__get_maxaddr_test(file, &maxaddr) < 0) FAIL_STACK_ERROR /* Allocate some temporary address space */ @@ -953,7 +954,7 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate 1/3 of the file as temporary address space */ @@ -1061,7 +1062,7 @@ test_mf_fs_start(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1173,7 +1174,7 @@ test_mf_fs_alloc_free(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1250,7 +1251,7 @@ test_mf_fs_alloc_free(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1325,7 +1326,7 @@ test_mf_fs_alloc_free(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1498,7 +1499,7 @@ test_mf_fs_extend(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1606,7 +1607,7 @@ test_mf_fs_extend(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1708,7 +1709,7 @@ test_mf_fs_extend(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1810,7 +1811,7 @@ test_mf_fs_extend(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1982,7 +1983,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -2038,7 +2039,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -2164,7 +2165,7 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) TEST_ERROR /* Allocate first block from meta_aggr */ @@ -2202,7 +2203,7 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) TEST_ERROR /* Free the two blocks: order matters because of H5F_FSPACE_STRATEGY_AGGR strategy */ @@ -2305,7 +2306,7 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; @@ -2351,7 +2352,7 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30+TBLOCK_SIZE50+TBLOCK_SIZE2058); @@ -2461,7 +2462,7 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate first block from meta_aggr */ @@ -2624,7 +2625,7 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate first block from meta_aggr */ @@ -2772,7 +2773,7 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate first block from meta_aggr */ @@ -2906,7 +2907,7 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; @@ -3073,7 +3074,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate the first block from meta_aggr */ @@ -3236,7 +3237,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate the first block from meta_aggr */ @@ -3327,7 +3328,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate the first block from meta_aggr */ @@ -3397,7 +3398,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate first block from meta_aggr */ @@ -3527,7 +3528,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate block A from meta_aggr */ @@ -3574,7 +3575,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate block A from meta_aggr */ @@ -3633,7 +3634,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate block A from meta_aggr */ @@ -3702,7 +3703,7 @@ error: * Alignment = 1024 or 4096 * * Test 1: - * Turn off using meta data aggregator + * Turn off using metadata aggregator * Allocate a block of 30 which should be from file allocation * Result: * The return address should be aligned @@ -3715,13 +3716,13 @@ error: * A fragment [1054, 994] or [4126, 4066] is freed to free-space * EOA is 2098 or 8242 * Test 2: - * Turn off using meta data aggregator + * Turn off using metadata aggregator * Allocate a block which should be from file allocation * The return address should be aligned * H5MF_try_shrink() the block with aligned address should succeed * * Test 3: - * Turn off using meta data aggregator + * Turn off using metadata aggregator * Allocate a block which should be from file allocation * The return address should be aligned * H5MF_try_extend() the block with aligned address should succeed @@ -3782,7 +3783,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* calculate fragment for alignment of block 30 */ @@ -3864,7 +3865,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* allocate a block of 50 from meta_aggr */ @@ -3886,7 +3887,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* shrink the block */ @@ -3919,7 +3920,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* allocate a block of 50 */ @@ -3941,7 +3942,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* try to extend the block */ @@ -4041,7 +4042,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -4104,7 +4105,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -4187,7 +4188,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -4407,7 +4408,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* calculate fragment for alignment of block 30 */ @@ -4663,7 +4664,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* calculate fragment for alignment of block 30 */ @@ -5002,7 +5003,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* calculate fragment for alignment of block 30 */ @@ -5303,7 +5304,7 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* get alignment setting */ @@ -5514,7 +5515,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* get alignment setting */ @@ -5778,7 +5779,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* get alignment setting */ @@ -5917,17 +5918,17 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + HDputs(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ - return(0); + return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; - return(1); + return 1; } /* test_mf_align_alloc6() */ /* @@ -6028,7 +6029,7 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) TEST_ERROR /* Allocate a block of size align from meta_aggr. This should create an @@ -6114,7 +6115,7 @@ test_mf_fs_persist_split(void) TESTING("File's free-space managers are persistent for split-file"); - /* for now, we don't support persistent free space managers + /* for now, we don't support persistent free space managers * with the split file driver. */ SKIPPED(); @@ -6124,7 +6125,7 @@ test_mf_fs_persist_split(void) /* File creation property list template */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - /* for now, we don't support persistent free space managers + /* for now, we don't support persistent free space managers * with the split file driver. */ SKIPPED(); @@ -6156,7 +6157,7 @@ test_mf_fs_persist_split(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate 4 blocks of type H5FD_MEM_SUPER */ @@ -6201,7 +6202,7 @@ test_mf_fs_persist_split(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that the H5FD_MEM_SUPER free-space manager is there */ @@ -6286,7 +6287,7 @@ test_mf_fs_persist_split(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that the free-space manager for H5FD_MEM_DRAW is not there */ @@ -6330,7 +6331,7 @@ test_mf_fs_persist_split(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that the H5FD_MEM_SUPER free-space manager is there */ @@ -6436,14 +6437,14 @@ test_mf_fs_persist_multi(void) TESTING("File's free-space managers are persistent for multi-file"); - /* for now, we don't support persistent free space managers + /* for now, we don't support persistent free space managers * with the multi file driver. */ SKIPPED(); HDfprintf(stdout, " Persistent FSMs disabled in multi file driver.\n"); return 0; /* <========== note return */ - /* for now, we don't support persistent free space managers + /* for now, we don't support persistent free space managers * with the multi file driver. */ SKIPPED(); @@ -6473,7 +6474,7 @@ test_mf_fs_persist_multi(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate 4 blocks of type H5FD_MEM_SUPER */ @@ -6518,7 +6519,7 @@ test_mf_fs_persist_multi(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that the H5FD_MEM_SUPER free-space manager is there */ @@ -6600,7 +6601,7 @@ test_mf_fs_persist_multi(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that the free-space manager for H5FD_MEM_SUPER is there */ @@ -6666,7 +6667,7 @@ test_mf_fs_persist_multi(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* If H5FD_MEM_SUPER is there, should not find block #1 & #3 */ @@ -6778,7 +6779,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate 6 blocks */ @@ -6812,7 +6813,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); @@ -6867,7 +6868,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that H5FD_MEM_SUPER free-space manager is there */ @@ -6959,7 +6960,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate 4 blocks */ @@ -6993,7 +6994,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE4, (H5F_mem_page_t *)&fs_type); @@ -7014,7 +7015,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that H5FD_MEM_SUPER free-space manager is there */ @@ -7027,7 +7028,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) * assertion failures on the first file space alloc / dealloc. */ if(f->shared->first_alloc_dealloc){ - if(SUCCEED!=H5MF_tidy_self_referential_fsm_hack(f)) + if(SUCCEED != H5MF_tidy_self_referential_fsm_hack(f)) FAIL_STACK_ERROR ran_H5MF_tidy_self_referential_fsm_hack = TRUE; } @@ -7071,7 +7072,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that the H5FD_MEM_SUPER free-space manager is not there */ if(H5F_addr_defined(f->shared->fs_addr[fs_type])) @@ -7169,7 +7170,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate 6 blocks */ @@ -7205,13 +7206,13 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR if(f->shared->fs_persist) { @@ -7341,7 +7342,7 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate 6 blocks */ @@ -7424,7 +7425,7 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Free-space manager should be empty */ @@ -7498,7 +7499,7 @@ test_dichotomy(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate the first block of type H5FD_MEM_SUPER */ @@ -7614,7 +7615,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) hid_t fcpl = -1; /* File creation property list */ hid_t fapl_new = -1; /* File access property list ID */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr2, addr3; /* Addresses for small meta data blocks */ + haddr_t addr2, addr3; /* Addresses for small metadata blocks */ haddr_t saddr1; /* Addresses for small raw data blocks */ haddr_t gaddr1; /* Addresses for large data blocks */ hbool_t split = FALSE, multi = FALSE; @@ -7658,10 +7659,10 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR - /* Allocate 3 small meta data blocks: addr1, addr2, addr3 */ + /* Allocate 3 small metadata blocks: addr1, addr2, addr3 */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034); addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); @@ -7673,7 +7674,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, TBLOCK_SIZE1034, (H5F_mem_page_t *)&fs_type); - /* Verify that the freed block with addr2 is found from the small meta data manager */ + /* Verify that the freed block with addr2 is found from the small metadata manager */ if(H5MF__find_sect(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034, f->shared->fs_man[fs_type], &found_addr) < 0) TEST_ERROR if(found_addr != addr2) @@ -7727,7 +7728,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR /* Verify that the large generic manager is there */ @@ -7735,7 +7736,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR - /* Verify that the small meta data manager is there */ + /* Verify that the small metadata manager is there */ H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, f->shared->fs_page_size - 1, (H5F_mem_page_t *)&fs_type); if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR @@ -7746,16 +7747,16 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) * assertion failures on the first file space alloc / dealloc. */ if(f->shared->first_alloc_dealloc){ - if(SUCCEED!=H5MF_tidy_self_referential_fsm_hack(f)) + if(SUCCEED != H5MF_tidy_self_referential_fsm_hack(f)) FAIL_STACK_ERROR } - /* Set up to use the small meta data manager */ + /* Set up to use the small metadata manager */ if(!(f->shared->fs_man[fs_type])) if(H5MF__open_fstype(f, fs_type) < 0) TEST_ERROR - /* Verify that the freed block with addr2 is found from the small meta data manager */ + /* Verify that the freed block with addr2 is found from the small metadata manager */ if(H5MF__find_sect(f, H5FD_MEM_OHDR, (hsize_t)(f->shared->fs_page_size-(addr3+TBLOCK_SIZE50)), f->shared->fs_man[fs_type], &found_addr) < 0) TEST_ERROR @@ -7838,7 +7839,7 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) hid_t fid = -1; /* File ID */ hid_t fcpl = -1; /* File creation property list */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr1; /* Address for small meta data block */ + haddr_t addr1; /* Address for small metadata block */ haddr_t saddr1; /* Address for small raw data block */ haddr_t gaddr1; /* Address for large data block */ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ @@ -7869,17 +7870,17 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR - /* Allocate a small meta data block with addr1 */ + /* Allocate a small metadata block with addr1 */ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); /* Try to shrink the block with addr1 */ if((status = H5MF_try_shrink(f, H5FD_MEM_OHDR, addr1, (hsize_t)TBLOCK_SIZE50)) < 0) FAIL_STACK_ERROR - /* Couldn't shrink due to the section (remaining space in the page) is in the small meta data free-space manager */ + /* Couldn't shrink due to the section (remaining space in the page) is in the small metadata free-space manager */ if(status == TRUE) TEST_ERROR /* Allocate a small raw data block with saddr1 */ @@ -7961,7 +7962,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) hid_t fid = -1; /* File ID */ hid_t fcpl = -1; /* File creation property list */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr1, addr2, addr3; /* Addresses for small meta data blocks */ + haddr_t addr1, addr2, addr3; /* Addresses for small metadata blocks */ haddr_t saddr1; /* Address for small raw data block */ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ htri_t was_extended; /* Whether the block can be extended or not */ @@ -7990,10 +7991,10 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR - /* Allocate a small meta data block with addr1 */ + /* Allocate a small metadata block with addr1 */ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE98); /* Try extending the block with addr1 at EOF not crossing page boundary */ @@ -8001,7 +8002,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) /* Should succeed */ if(was_extended != TRUE) TEST_ERROR - /* Allocate 2 small meta data blocks with addr2 and addr3--will be on another meta data page */ + /* Allocate 2 small metadata blocks with addr2 and addr3--will be on another metadata page */ addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE100); addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE150); @@ -8028,7 +8029,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) /* Free the block with addr1 */ H5MF_xfree(f, H5FD_MEM_OHDR, addr1, (hsize_t)TBLOCK_SIZE3248); - /* Allocate a new meta data block with addr1 */ + /* Allocate a new metadata block with addr1 */ /* There is a page end threshold of size H5F_FILE_SPACE_PGEND_META_THRES at the end of the block */ /* The block is right next to the threshold */ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3286); @@ -8144,7 +8145,7 @@ test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR /* Allocate a large data block with gaddr1 */ @@ -8286,7 +8287,7 @@ test_page_large(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR /* Allocate a large data block with gaddr1 */ @@ -8409,7 +8410,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) hid_t fcpl = -1; /* File creation property list */ H5F_t *f = NULL; /* Internal file object pointer */ haddr_t addr2, addr3, addr4, addr5; /* Addresses for blocks */ - haddr_t addr9, addr10, addr11; /* Address for small meta data blocks */ + haddr_t addr9, addr10, addr11; /* Address for small metadata blocks */ haddr_t saddr1, saddr2; /* Addresses for small raw data blocks */ H5FS_stat_t fs_stat; /* Information for free-space manager */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -8442,10 +8443,10 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR - /* Allocate 2 small meta data blocks: addr1, addr2 */ + /* Allocate 2 small metadata blocks: addr1, addr2 */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); @@ -8464,13 +8465,13 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(saddr2 != (saddr1 + TBLOCK_SIZE30)) TEST_ERROR - /* Allocate a small meta data block with addr3--there is no free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr3--there is no free-space section big enough to fulfill the request */ addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE4020); /* Should be on the third page and page aligned */ if(addr3 % TBLOCK_SIZE4096) TEST_ERROR - /* Allocate a small meta data block with addr4--there is a free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr4--there is a free-space section big enough to fulfill the request */ addr4 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE80); /* Should not be page aligned */ if(!(addr4 % TBLOCK_SIZE4096)) @@ -8479,7 +8480,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(addr4 != (addr2 + TBLOCK_SIZE50)) TEST_ERROR - /* Allocate a small meta data block with addr5--there is a free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr5--there is a free-space section big enough to fulfill the request */ addr5 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE40); /* Should not be page aligned */ if(!(addr5 % TBLOCK_SIZE4096)) @@ -8489,16 +8490,16 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(addr5 != (addr3 + TBLOCK_SIZE4020)) TEST_ERROR - /* Allocate a small meta data block with addr6--taking up the remaining space in the first page */ + /* Allocate a small metadata block with addr6--taking up the remaining space in the first page */ if(family) H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3080); else H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3088); - /* Allocate a small meta data block with addr7--taking up the remaining space in the third page */ + /* Allocate a small metadata block with addr7--taking up the remaining space in the third page */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE36); - /* Allocate 2 small meta data blocks: addr8, addr9--there is no free-space to fulfill the request */ + /* Allocate 2 small metadata blocks: addr8, addr9--there is no free-space to fulfill the request */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); addr9 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE80); @@ -8514,13 +8515,13 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(fs_stat.tot_space != TBLOCK_SIZE4096) TEST_ERROR - /* Allocate a small meta data block with addr10--there is a free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr10--there is a free-space section big enough to fulfill the request */ addr10 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3900); /* The block should be next to the block with addr9 */ if(addr10 != (addr9 + TBLOCK_SIZE80)) TEST_ERROR - /* Allocate a small meta data block with addr11 */ + /* Allocate a small metadata block with addr11 */ /* The current free-space section is unable to fulfill the request; obtain a page from the large manager */ addr11 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE80); /* The address of the block should be the same the freed block with saddr1 */ @@ -8575,7 +8576,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) hid_t fcpl2 = -1; /* File creation property list ID */ hid_t fapl_new = -1; /* File access property list ID */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr1, addr2; /* Addresses for small meta data blocks */ + haddr_t addr1, addr2; /* Addresses for small metadata blocks */ haddr_t saddr1, saddr2; /* Addresses for small raw data blocks */ haddr_t gaddr1, gaddr2; /* Addresses for blocks */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -8686,7 +8687,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR /* Allocate 2 small raw data blocks */ @@ -8729,7 +8730,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) /* Disable small data block mechanism */ if(H5Pset_small_data_block_size(fapl_new, (hsize_t)0) < 0) TEST_ERROR - /* Disable meta data block mechanism */ + /* Disable metadata block mechanism */ if(H5Pset_meta_block_size(fapl_new, (hsize_t)0) < 0) TEST_ERROR @@ -8738,10 +8739,10 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR - /* Allocate 2 small meta data blocks */ + /* Allocate 2 small metadata blocks */ addr1 = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE50); @@ -8799,7 +8800,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR /* Allocate 2 small raw data blocks */ diff --git a/test/objcopy.c b/test/objcopy.c index 18de027..6ee2f72 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -21,9 +21,9 @@ #include "testhdf5.h" #include "H5srcdir.h" -#include "H5Bprivate.h" #include "H5Iprivate.h" #include "H5Pprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ #define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING @@ -2151,7 +2151,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) buf[i][j] = 10000 + 100*i+j; /* Create a file access property list for destination file */ - if ((fapl_dst = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR + if ((fapl_dst = h5_fileaccess()) < 0) TEST_ERROR /* Initialize the filenames */ h5_fixname(FILENAME[4], fapl_src, src_fname, sizeof src_fname); @@ -2180,7 +2180,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) if (ret < 0) TEST_ERROR /* Get the internal dset ptr to get the fill version for verifying later */ - if ((dsetp = (H5D_t *)H5I_object(did_src)) == NULL) TEST_ERROR + if ((dsetp = (H5D_t *)H5VL_object(did_src)) == NULL) TEST_ERROR srcdset_fillversion = dsetp->shared->dcpl_cache.fill.version; /* Close dataspace */ @@ -7854,6 +7854,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t src_fapl = -1; /* Source file FAPL ID */ const char *src_filename = H5_get_srcdir_filename(FILE_OLD_LAYOUT); /* Corrected test file name */ char dst_filename[NAME_BUF_SIZE]; @@ -7869,8 +7870,14 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) /* Reset file address checking info */ addr_reset(); + /* Setup */ + if((src_fapl = h5_fileaccess()) < 0) TEST_ERROR + /* open source file (read-only) */ - if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR + + /* Close source FAPL */ + if(H5Pclose(src_fapl) < 0) TEST_ERROR /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR @@ -7914,6 +7921,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) error: H5E_BEGIN_TRY { + H5Pclose(src_fapl); H5Dclose(did2); H5Dclose(did); H5Fclose(fid_dst); diff --git a/test/ohdr.c b/test/ohdr.c index 146245f..cca7e7e 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -15,24 +15,25 @@ * Tuesday, November 24, 1998 */ #include "h5test.h" -#include "H5Iprivate.h" + +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Iprivate.h" /* Identifiers */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /* * This file needs to access private datatypes from the H5O package. * This file also needs to access the object header testing code. */ -#define H5O_FRIEND /*suppress error about including H5Opkg */ +#define H5O_FRIEND /* suppress error about including H5Opkg */ #define H5O_TESTING #include "H5Opkg.h" /* * This file needs to access private datatypes from the H5G package. */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /* suppress error about including H5Gpkg */ #include "H5Gpkg.h" -#include "H5CXprivate.h" /* API Contexts */ - const char *FILENAME[] = { "ohdr", NULL @@ -78,7 +79,7 @@ test_cont(char *filename, hid_t fapl) /* Create the file to operate on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR if (H5AC_ignore_tags(f) < 0) { H5_FAILED(); @@ -119,7 +120,7 @@ test_cont(char *filename, hid_t fapl) FAIL_STACK_ERROR if(H5AC_flush(f) < 0) FAIL_STACK_ERROR - if(H5O_expunge_chunks_test(&oh_locA) < 0) + if(H5O__expunge_chunks_test(&oh_locA) < 0) FAIL_STACK_ERROR if(H5O_get_hdr_info(&oh_locA, &hdr_info) < 0) @@ -200,7 +201,7 @@ test_ohdr_cache(char *filename, hid_t fapl) FAIL_STACK_ERROR if(H5Pclose(my_fapl) < 0) FAIL_STACK_ERROR - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR if(H5AC_ignore_tags(f) < 0) FAIL_STACK_ERROR @@ -220,7 +221,7 @@ test_ohdr_cache(char *filename, hid_t fapl) /* Query object header information */ rc = 0; - if(H5O_get_rc(&oh_loc, &rc) < 0) + if(H5O__get_rc_test(&oh_loc, &rc) < 0) FAIL_STACK_ERROR if(0 != rc) TEST_ERROR @@ -261,7 +262,7 @@ test_ohdr_cache(char *filename, hid_t fapl) * a non-invasive way -QAK) */ rc = 0; - if(H5O_get_rc(&oh_loc, &rc) < 0) + if(H5O__get_rc_test(&oh_loc, &rc) < 0) FAIL_STACK_ERROR if(0 != rc) TEST_ERROR @@ -303,17 +304,17 @@ error: static herr_t test_ohdr_swmr(hbool_t new_format) { - hid_t fid = -1; /* File ID */ - hid_t fapl = -1; /* File access property list */ - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t plist = -1; /* Dataset creation property list */ - size_t compact_size = 1024; /* The size of compact dataset */ - int *wbuf = NULL; /* Buffer for writing */ - hsize_t dims[1]; /* Dimension sizes */ - size_t u; /* Iterator */ - int n; /* Data variable */ - H5O_info_t obj_info; /* Information for the object */ + hid_t fid = -1; /* File ID */ + hid_t fapl = -1; /* File access property list */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t plist = -1; /* Dataset creation property list */ + size_t compact_size = 1024; /* The size of compact dataset */ + int *wbuf = NULL; /* Buffer for writing */ + hsize_t dims[1]; /* Dimension sizes */ + size_t u; /* Iterator */ + int n; /* Data variable */ + H5O_info_t obj_info; /* Information for the object */ if(new_format) { TESTING("exercise the coding for the re-read of the object header for SWMR access: latest-format"); @@ -470,8 +471,8 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) /* create a different name for a local copy of the data file to be opened with rd/wr file permissions in case build and test are done in the source directory. */ - HDstrncpy(testfile, FILE_BOGUS, strlen(FILE_BOGUS)); - testfile[strlen(FILE_BOGUS)]='\0'; + HDstrncpy(testfile, FILE_BOGUS, HDstrlen(FILE_BOGUS)); + testfile[HDstrlen(FILE_BOGUS)]='\0'; HDstrncat(testfile, ".copy", 5); /* Make a copy of the data file from svn. */ @@ -485,7 +486,7 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) FAIL_STACK_ERROR /* Open FILE_BOGUS */ - if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Set up location ID depending on bogus_id */ @@ -567,7 +568,7 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) FAIL_STACK_ERROR /* Check that the "unknown" message was _NOT_ marked */ - if(H5O_check_msg_marked_test(did, FALSE) < 0) + if(H5O__check_msg_marked_test(did, FALSE) < 0) FAIL_STACK_ERROR /* Close the dataset */ @@ -647,7 +648,7 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) FAIL_STACK_ERROR /* Check that the "unknown" message was marked */ - if(H5O_check_msg_marked_test(did, TRUE) < 0) + if(H5O__check_msg_marked_test(did, TRUE) < 0) FAIL_STACK_ERROR /* Close the dataset */ @@ -769,9 +770,9 @@ version_string(H5F_libver_t libver) /* Return the formed version bound string */ return str; -} /* end of version_string */ - +} /* end version_string() */ + /*------------------------------------------------------------------------- * Function: main * @@ -780,13 +781,9 @@ version_string(H5F_libver_t libver) * Return: Success: 0 * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, November 24, 1998 * - * Modification: - * - Added loop of combinations of low/high library format bounds - * (BMR, Feb 2018) - * *------------------------------------------------------------------------- */ int @@ -844,7 +841,7 @@ main(void) /* Create the file to operate on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR if(H5AC_ignore_tags(f) < 0) { H5_FAILED(); @@ -942,7 +939,7 @@ main(void) FAIL_STACK_ERROR if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR if (H5AC_ignore_tags(f) < 0) FAIL_STACK_ERROR diff --git a/test/page_buffer.c b/test/page_buffer.c index 3c61ab0..b9b31f8 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -21,6 +21,11 @@ #include "h5test.h" +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Iprivate.h" +#include "H5PBprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ + /* * This file needs to access private information from the H5F package. */ @@ -31,12 +36,8 @@ #define H5F_TESTING #include "H5Fpkg.h" -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Iprivate.h" -#include "H5PBprivate.h" - -#define FILENAME_LEN 1024 +#define FILENAME_LEN 1024 #define NUM_DSETS 5 #define NX 100 #define NY 50 @@ -241,7 +242,7 @@ open_file(char *filename, hid_t fapl, hsize_t page_size, FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; if(f->shared->page_buf == NULL) @@ -604,7 +605,7 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; /* opening the file inserts one or more pages into the page buffer. @@ -887,7 +888,7 @@ test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; /* opening the file inserts one or more pages into the page buffer. @@ -1146,7 +1147,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; /* opening the file inserts one or more pages into the page buffer. @@ -1281,7 +1282,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; /* opening the file inserts one or more pages into the page buffer. @@ -1411,7 +1412,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; /* opening the file inserts one or more pages into the page buffer. @@ -1552,7 +1553,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; page_buf = f->shared->page_buf; @@ -1776,7 +1777,7 @@ test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; /* opening the file inserts one or more pages into the page buffer. diff --git a/test/swmr.c b/test/swmr.c index 0b352e2..bab91bd 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -26,6 +26,7 @@ #include "h5test.h" #include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ /* * This file needs to access private information from the H5F package. @@ -1168,7 +1169,7 @@ test_metadata_read_retry_info(hid_t in_fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if((f = (H5F_t *)H5I_object(fid)) == NULL) + if((f = (H5F_t *)H5VL_object(fid)) == NULL) FAIL_STACK_ERROR /* @@ -1326,7 +1327,7 @@ test_metadata_read_retry_info(hid_t in_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if((f = (H5F_t *)H5I_object(fid)) == NULL) + if((f = (H5F_t *)H5VL_object(fid)) == NULL) FAIL_STACK_ERROR /* File's superblock: log retry 1 for 1 time */ @@ -1430,7 +1431,7 @@ test_metadata_read_retry_info(hid_t in_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object for fid */ - if((f = (H5F_t *)H5I_object(fid)) == NULL) + if((f = (H5F_t *)H5VL_object(fid)) == NULL) FAIL_STACK_ERROR /* Re-open fid */ @@ -1438,7 +1439,7 @@ test_metadata_read_retry_info(hid_t in_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object for fid1 */ - if((f1 = (H5F_t *)H5I_object(fid1)) == NULL) + if((f1 = (H5F_t *)H5VL_object(fid1)) == NULL) FAIL_STACK_ERROR /* For fid: fixed array data block page--log retry 9 for 500 times */ @@ -3015,7 +3016,7 @@ test_start_swmr_write_stress_ohdr(hid_t in_fapl) /* Retrieve the chunk # for the dataspace message */ chunk_num = UINT_MAX; - if(H5O_msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0) + if(H5O__msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0) FAIL_STACK_ERROR; /* Should be in chunk #0 for now */ if(0 != chunk_num) @@ -3072,7 +3073,7 @@ test_start_swmr_write_stress_ohdr(hid_t in_fapl) /* Retrieve the chunk # for the dataspace message */ chunk_num = UINT_MAX; - if(H5O_msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0) + if(H5O__msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0) FAIL_STACK_ERROR; /* Should be in chunk #0 for now */ if(1 != chunk_num) @@ -6288,7 +6289,7 @@ test_bug_refresh(hid_t in_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR /* Create groups: compact to dense storage */ @@ -6484,106 +6485,104 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format) if(childpid == 0) { /* Child process */ hid_t child_fid1 = -1; /* File ID */ hid_t child_fid2 = -1; /* File ID */ - hid_t child_did1 = -1, child_did2 = -1; - hid_t child_sid = -1; - hsize_t tdims[1]; - int rbuf[2] = {0, 0}; - int child_notify = 0; + hid_t child_did1 = -1, child_did2 = -1; + hid_t child_sid = -1; + hsize_t tdims[1]; + int rbuf[2] = {0, 0}; + int child_notify = 0; - /* Close unused write end for out_pdf */ - if(HDclose(out_pdf[1]) < 0) - HDexit(EXIT_FAILURE); + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) + HDexit(EXIT_FAILURE); - /* close unused read end for in_pdf */ - if(HDclose(in_pdf[0]) < 0) - HDexit(EXIT_FAILURE); + /* close unused read end for in_pdf */ + if(HDclose(in_pdf[0]) < 0) + HDexit(EXIT_FAILURE); - /* Wait for notification from parent process */ - while(child_notify != 1) { - if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) - HDexit(EXIT_FAILURE); - } + /* Wait for notification from parent process */ + while(child_notify != 1) + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); - /* Open the file 2 times */ - if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) - HDexit(EXIT_FAILURE); + /* Open the file 2 times */ + if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) + HDexit(EXIT_FAILURE); - if((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) - HDexit(EXIT_FAILURE); + if((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) + HDexit(EXIT_FAILURE); - /* Open the dataset 2 times */ - if((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0) - HDexit(EXIT_FAILURE); - if((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0) - HDexit(EXIT_FAILURE); + /* Open the dataset 2 times */ + if((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0) + HDexit(EXIT_FAILURE); + if((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0) + HDexit(EXIT_FAILURE); - /* Get the dataset's dataspace via did1 */ - if((child_sid = H5Dget_space(child_did1)) < 0) - HDexit(EXIT_FAILURE); - if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) - HDexit(EXIT_FAILURE); - if(tdims[0] != 1) - HDexit(EXIT_FAILURE); + /* Get the dataset's dataspace via did1 */ + if((child_sid = H5Dget_space(child_did1)) < 0) + HDexit(EXIT_FAILURE); + if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) + HDexit(EXIT_FAILURE); + if(tdims[0] != 1) + HDexit(EXIT_FAILURE); - /* Read from the dataset via did2 */ - if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - HDexit(EXIT_FAILURE); + /* Read from the dataset via did2 */ + if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + HDexit(EXIT_FAILURE); - /* Verify the data is correct */ - if(rbuf[0] != 99) - HDexit(EXIT_FAILURE); + /* Verify the data is correct */ + if(rbuf[0] != 99) + HDexit(EXIT_FAILURE); - /* Notify parent process */ - child_notify = 2; - if(HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0) - HDexit(EXIT_FAILURE); + /* Notify parent process */ + child_notify = 2; + if(HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); - /* Wait for notification from parent process */ - while(child_notify != 3) { - if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) - HDexit(EXIT_FAILURE); - } + /* Wait for notification from parent process */ + while(child_notify != 3) + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); - /* Refresh dataset via did1 */ - if(H5Drefresh(child_did1) < 0) - HDexit(EXIT_FAILURE); + /* Refresh dataset via did1 */ + if(H5Drefresh(child_did1) < 0) + HDexit(EXIT_FAILURE); - /* Get the dataset's dataspace and verify */ - if((child_sid = H5Dget_space(child_did1)) < 0) - HDexit(EXIT_FAILURE); - if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) - HDexit(EXIT_FAILURE); + /* Get the dataset's dataspace and verify */ + if((child_sid = H5Dget_space(child_did1)) < 0) + HDexit(EXIT_FAILURE); + if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) + HDexit(EXIT_FAILURE); - if(tdims[0] != 2) - HDexit(EXIT_FAILURE); + if(tdims[0] != 2) + HDexit(EXIT_FAILURE); - /* Read from the dataset */ - if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - HDexit(EXIT_FAILURE); + /* Read from the dataset */ + if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + HDexit(EXIT_FAILURE); - /* Verify the data is correct */ - if(rbuf[0] != 100 || rbuf[1] != 100) - HDexit(EXIT_FAILURE); + /* Verify the data is correct */ + if(rbuf[0] != 100 || rbuf[1] != 100) + HDexit(EXIT_FAILURE); - /* Close the 2 datasets */ - if(H5Dclose(child_did1) < 0) - HDexit(EXIT_FAILURE); - if(H5Dclose(child_did2) < 0) - HDexit(EXIT_FAILURE); + /* Close the 2 datasets */ + if(H5Dclose(child_did1) < 0) + HDexit(EXIT_FAILURE); + if(H5Dclose(child_did2) < 0) + HDexit(EXIT_FAILURE); - /* Close the 2 files */ - if(H5Fclose(child_fid1) < 0) - HDexit(EXIT_FAILURE); - if(H5Fclose(child_fid2) < 0) - HDexit(EXIT_FAILURE); + /* Close the 2 files */ + if(H5Fclose(child_fid1) < 0) + HDexit(EXIT_FAILURE); + if(H5Fclose(child_fid2) < 0) + HDexit(EXIT_FAILURE); - /* Close the pipes */ - if(HDclose(out_pdf[0]) < 0) - HDexit(EXIT_FAILURE); - if(HDclose(in_pdf[1]) < 0) - HDexit(EXIT_FAILURE); + /* Close the pipes */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + if(HDclose(in_pdf[1]) < 0) + HDexit(EXIT_FAILURE); - HDexit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); } /* Close unused read end for out_pdf */ @@ -6618,8 +6617,8 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format) /* Wait for notification from child process */ while(notify != 2) { - if(HDread(in_pdf[0], ¬ify, sizeof(int)) < 0) - FAIL_STACK_ERROR; + if(HDread(in_pdf[0], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; } /* Cork the metadata cache, to prevent the object header from being @@ -7042,8 +7041,8 @@ main(void) * by the environment variable. */ driver = HDgetenv("HDF5_DRIVER"); - if(!H5FD_supports_swmr_test(driver)) { - printf("This VFD does not support SWMR I/O\n"); + if(!H5FD__supports_swmr_test(driver)) { + HDprintf("This VFD does not support SWMR I/O\n"); return EXIT_SUCCESS; } /* end if */ @@ -7133,7 +7132,7 @@ main(void) if(nerrors) goto error; - printf("All tests passed.\n"); + HDprintf("All tests passed.\n"); h5_cleanup(FILENAME, fapl); @@ -7141,7 +7140,7 @@ main(void) error: nerrors = MAX(1, nerrors); - printf("***** %d SWMR TEST%s FAILED! *****\n", + HDprintf("***** %d SWMR TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return EXIT_FAILURE; diff --git a/test/swmr_check_compat_vfd.c b/test/swmr_check_compat_vfd.c index 1589f6e..e249e09 100644 --- a/test/swmr_check_compat_vfd.c +++ b/test/swmr_check_compat_vfd.c @@ -46,7 +46,7 @@ main(void) driver = HDgetenv("HDF5_DRIVER"); - if(H5FD_supports_swmr_test(driver)) + if(H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS; else return EXIT_FAILURE; diff --git a/test/swmr_generator.c b/test/swmr_generator.c index 1c2ec04..23620fb 100644 --- a/test/swmr_generator.c +++ b/test/swmr_generator.c @@ -230,12 +230,12 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t swmr_write, unsigned chunk_num; /* Object header chunk # for dataspace message */ /* Move the dataspace message to a new object header chunk */ - if(H5O_msg_move_to_new_chunk_test(dsid, H5O_SDSPACE_ID) < 0) + if(H5O__msg_move_to_new_chunk_test(dsid, H5O_SDSPACE_ID) < 0) return -1; /* Retrieve the chunk # for the dataspace message */ chunk_num = UINT_MAX; - if(H5O_msg_get_chunkno_test(dsid, H5O_SDSPACE_ID, &chunk_num) < 0) + if(H5O__msg_get_chunkno_test(dsid, H5O_SDSPACE_ID, &chunk_num) < 0) return -1; /* Should not be in chunk #0 for now */ if(0 == chunk_num) diff --git a/test/tarray.c b/test/tarray.c index 99f7bf8..d8ededf 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -26,8 +26,8 @@ #define TESTFILE "tarrold.h5" /* 1-D array datatype */ -#define ARRAY1_RANK 1 -#define ARRAY1_DIM1 4 +#define ARRAY1_RANK 1 +#define ARRAY1_DIM1 4 /* 3-D array datatype */ #define ARRAY2_RANK 3 @@ -65,7 +65,7 @@ typedef struct void *test_array_alloc_custom(size_t size, void *info); void test_array_free_custom(void *mem, void *info); - + /*------------------------------------------------------------------------- * Function: test_array_atomic_1d * @@ -189,7 +189,7 @@ test_array_atomic_1d(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_atomic_1d() */ - + /*------------------------------------------------------------------------- * Function: test_array_funcs * @@ -252,7 +252,7 @@ test_array_funcs(void) CHECK(ret, FAIL, "H5Tclose"); } /* end test_array_funcs() */ - + /*------------------------------------------------------------------------- * Function: test_array_atomic_3d * @@ -381,7 +381,7 @@ test_array_atomic_3d(void) } /* end test_array_atomic_3d() */ - + /*------------------------------------------------------------------------- * Function: test_array_array_atomic * @@ -540,7 +540,7 @@ test_array_array_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_array_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_compound_atomic * @@ -747,7 +747,7 @@ test_array_compound_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_compound_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_compound_array * @@ -1006,7 +1006,7 @@ test_array_compound_array(void) ** allocated. ** ****************************************************************/ - + /*------------------------------------------------------------------------- * Function: test_array_alloc_custom * @@ -1045,7 +1045,7 @@ test_array_alloc_custom(size_t size, void *info) return ret_value; } /* end test_array_alloc_custom() */ - + /*------------------------------------------------------------------------- * Function: test_array_free_custom * @@ -1081,7 +1081,7 @@ test_array_free_custom(void *_mem, void *info) return; } /* end test_array_free_custom() */ - + /*------------------------------------------------------------------------- * Function: test_array_vlen_atomic * @@ -1296,7 +1296,7 @@ test_array_vlen_atomic(void) } /* end test_array_vlen_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_vlen_array * @@ -1341,7 +1341,7 @@ test_array_vlen_array(void) for(k=0; k<(i+j+1); k++) for(l=0; l<ARRAY1_DIM1; l++) ((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l] = (unsigned int)(i*1000+j*100+k*10+l); - } /* end for */ + } /* Create file */ fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -1551,7 +1551,7 @@ test_array_vlen_array(void) } /* end test_array_vlen_array() */ - + /*------------------------------------------------------------------------- * Function: test_array_bkg * @@ -1580,9 +1580,9 @@ test_array_bkg(void) unsigned ndims[3] = {1,1,1}; typedef struct { - int a[ALEN]; - float b[ALEN]; - double c[ALEN]; + int a[ALEN]; + float b[ALEN]; + double c[ALEN]; } CmpField; CmpField cf[LENGTH]; @@ -1855,7 +1855,7 @@ test_array_bkg(void) HDfree(dtsinfo); } /* end test_array_bkg() */ - + /*------------------------------------------------------------------------- * Function: test_compat * @@ -2150,7 +2150,7 @@ test_compat(void) } /* end test_compat() */ - + /*------------------------------------------------------------------------- * Function: test_array * @@ -2183,7 +2183,7 @@ test_array(void) } /* end test_array() */ - + /*------------------------------------------------------------------------- * Function: cleanup_array * diff --git a/test/tattr.c b/test/tattr.c index 379ae87..20b88f6 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -160,7 +160,7 @@ static herr_t attr_op1(hid_t loc_id, const char *name, const H5A_info_t *ainfo, static hid_t dcpl_g = H5P_DEFAULT; - + /**************************************************************** ** ** test_attr_basic_write(): Test basic H5A (attribute) code. @@ -400,7 +400,7 @@ test_attr_basic_write(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_basic_write() */ - + /**************************************************************** ** ** test_attr_basic_read(): Test basic H5A (attribute) code. @@ -491,7 +491,7 @@ test_attr_basic_read(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_basic_read() */ - + /**************************************************************** ** ** test_attr_flush(): Test H5A (attribute) code for performing @@ -558,7 +558,7 @@ test_attr_flush(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_flush() */ - + /**************************************************************** ** ** test_attr_plist(): Test Attribute Creation Property Lists @@ -671,7 +671,7 @@ test_attr_plist(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_plist() */ - + /**************************************************************** ** ** test_attr_compound_write(): Test H5A (attribute) code. @@ -760,7 +760,7 @@ test_attr_compound_write(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_compound_write() */ - + /**************************************************************** ** ** test_attr_compound_read(): Test basic H5A (attribute) code. @@ -910,7 +910,7 @@ test_attr_compound_read(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_compound_read() */ - + /**************************************************************** ** ** test_attr_scalar_write(): Test scalar H5A (attribute) writing code. @@ -976,7 +976,7 @@ test_attr_scalar_write(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_scalar_write() */ - + /**************************************************************** ** ** test_attr_scalar_read(): Test scalar H5A (attribute) reading code. @@ -1047,7 +1047,7 @@ test_attr_scalar_read(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_scalar_read() */ - + /**************************************************************** ** ** test_attr_mult_write(): Test basic H5A (attribute) code. @@ -1168,7 +1168,7 @@ test_attr_mult_write(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_mult_write() */ - + /**************************************************************** ** ** test_attr_mult_read(): Test basic H5A (attribute) code. @@ -1390,7 +1390,7 @@ test_attr_mult_read(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_mult_read() */ - + /**************************************************************** ** ** attr_op1(): Attribute operator @@ -1430,7 +1430,7 @@ attr_op1(hid_t H5_ATTR_UNUSED loc_id, const char *name, const H5A_info_t H5_ATTR return(ret); } /* end attr_op1() */ - + /**************************************************************** ** ** test_attr_iterate(): Test H5A (attribute) iterator code. @@ -1502,7 +1502,7 @@ test_attr_iterate(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_iterate() */ - + /**************************************************************** ** ** test_attr_delete(): Test H5A (attribute) code for deleting objects. @@ -1622,7 +1622,7 @@ test_attr_delete(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_delete() */ - + /**************************************************************** ** ** test_attr_dtype_shared(): Test H5A (attribute) code for using @@ -1660,7 +1660,6 @@ test_attr_dtype_shared(hid_t fapl) if(empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); - /* Re-open file */ file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(file_id, FAIL, "H5Fopen"); @@ -1799,7 +1798,7 @@ test_attr_dtype_shared(hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dtype_shared() */ - + /**************************************************************** ** ** test_attr_duplicate_ids(): Test operations with more than @@ -2044,7 +2043,7 @@ test_attr_duplicate_ids(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_duplicate_ids() */ - + /**************************************************************** ** ** test_attr_dense_verify(): Test basic H5A (attribute) code. @@ -2114,7 +2113,7 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr) return(-1); } /* test_attr_dense_verify() */ - + /**************************************************************** ** ** test_attr_dense_create(): Test basic H5A (attribute) code. @@ -2184,8 +2183,8 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes, until just before converting to dense storage */ for(u = 0; u < max_compact; u++) { @@ -2204,8 +2203,8 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) } /* end for */ /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add one more attribute, to push into "dense" storage */ /* Create attribute */ @@ -2214,8 +2213,8 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Write data into the attribute */ ret = H5Awrite(attr, H5T_NATIVE_UINT, &u); @@ -2250,7 +2249,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dense_create() */ - + /**************************************************************** ** ** test_attr_dense_open(): Test basic H5A (attribute) code. @@ -2324,8 +2323,8 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes, until just before converting to dense storage */ for(u = 0; u < max_compact; u++) { @@ -2348,8 +2347,8 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) } /* end for */ /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add one more attribute, to push into "dense" storage */ /* Create attribute */ @@ -2358,8 +2357,8 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Write data into the attribute */ ret = H5Awrite(attr, H5T_NATIVE_UINT, &u); @@ -2394,7 +2393,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dense_open() */ - + /**************************************************************** ** ** test_attr_dense_delete(): Test basic H5A (attribute) code. @@ -2483,8 +2482,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes, until well into dense storage */ for(u = 0; u < (max_compact * 2); u++) { @@ -2508,8 +2507,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) } /* end for */ /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Close dataspace */ ret = H5Sclose(sid); @@ -2545,8 +2544,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) } /* end for */ /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Delete one more attribute, which should cause reversion to compact storage */ sprintf(attrname, "attr %02u", u); @@ -2554,8 +2553,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Verify attributes still left */ ret = test_attr_dense_verify(dataset, (u - 1)); @@ -2567,8 +2566,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Verify attributes still left */ ret = test_attr_dense_verify(dataset, (u - 2)); @@ -2591,7 +2590,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dense_delete() */ - + /**************************************************************** ** ** test_attr_dense_rename(): Test basic H5A (attribute) code. @@ -2677,8 +2676,8 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes, until well into dense storage */ for(u = 0; u < (max_compact * 2); u++) { @@ -2709,8 +2708,8 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) } /* end for */ /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Close dataspace */ ret = H5Sclose(sid); @@ -2769,7 +2768,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dense_rename() */ - + /**************************************************************** ** ** test_attr_dense_unlink(): Test basic H5A (attribute) code. @@ -2853,8 +2852,8 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes, until well into dense storage */ for(u = 0; u < (max_compact * 2); u++) { @@ -2878,8 +2877,8 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) } /* end for */ /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Close dataspace */ ret = H5Sclose(sid); @@ -2903,9 +2902,9 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Ldelete"); /* Check on dataset's attribute storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Close file */ ret = H5Fclose(fid); @@ -2916,7 +2915,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dense_unlink() */ - + /**************************************************************** ** ** test_attr_dense_limits(): Test basic H5A (attribute) code. @@ -2995,8 +2994,8 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add first attribute, which should be immediately in dense storage */ @@ -3016,8 +3015,8 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Add second attribute, to allow deletions to be checked easily */ @@ -3037,8 +3036,8 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Delete second attribute, attributes should still be stored densely */ @@ -3048,8 +3047,8 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Delete first attribute, attributes should not be stored densely */ @@ -3061,8 +3060,8 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Close dataspace */ @@ -3086,7 +3085,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dense_limits() */ - + /**************************************************************** ** ** test_attr_dense_dup_ids(): Test operations with multiple ID @@ -3158,8 +3157,8 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes, until just before converting to dense storage */ for(u = 0; u < max_compact; u++) { @@ -3178,8 +3177,8 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) } /* end for */ /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add one more attribute, to push into "dense" storage */ /* Create dataspace for attribute */ @@ -3192,8 +3191,8 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Open the attribute just created and get a second ID */ attr2 = H5Aopen(dataset, attrname, H5P_DEFAULT); @@ -3227,8 +3226,8 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Open first attribute for the dataset */ attr = H5Aopen(dataset, attrname, H5P_DEFAULT); @@ -3280,8 +3279,8 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Open first attribute for the dataset */ attr = H5Aopen(dataset, attrname, H5P_DEFAULT); @@ -3341,8 +3340,8 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Open first attribute for the dataset */ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4, @@ -3397,8 +3396,8 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Open attribute of the dataset for the first time */ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)2, @@ -3413,8 +3412,8 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) } /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Open attribute for the second time */ attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)2, @@ -3464,8 +3463,8 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Open attribute of the dataset for the first time */ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)3, @@ -3489,8 +3488,8 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) } /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Open attribute for the second time */ attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)3, @@ -3563,8 +3562,8 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Check on group's attribute storage status */ - is_dense = H5O_is_attr_dense_test(gid1); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(gid1); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Open the hard link just created */ gid2 = H5Gopen2(fid, GROUP2_NAME, H5P_DEFAULT); @@ -3614,7 +3613,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_dense_dup_ids() */ - + /**************************************************************** ** ** test_attr_big(): Test basic H5A (attribute) code. @@ -3702,10 +3701,10 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add first "small" attribute, which should be in compact storage */ @@ -3721,10 +3720,10 @@ test_attr_big(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add second "small" attribute, which should stay in compact storage */ @@ -3740,10 +3739,10 @@ test_attr_big(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add first "big" attribute, which should push storage into dense form */ @@ -3764,10 +3763,10 @@ test_attr_big(hid_t fcpl, hid_t fapl) * message heap instead of forcing the attribute storage into the dense * form - QAK) */ - is_empty = H5O_is_attr_empty_test(dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O__is_attr_dense_test"); /* Add second "big" attribute, which should leave storage in dense form */ @@ -3787,10 +3786,10 @@ test_attr_big(hid_t fcpl, hid_t fapl) * message heap instead of forcing the attribute storage into the dense * form - QAK) */ - is_empty = H5O_is_attr_empty_test(dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O__is_attr_dense_test"); /* Delete second "small" attribute, attributes should still be stored densely */ @@ -3802,10 +3801,10 @@ test_attr_big(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O__is_attr_dense_test"); /* Delete second "big" attribute, attributes should still be stored densely */ @@ -3817,10 +3816,10 @@ test_attr_big(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O__is_attr_dense_test"); /* Delete first "big" attribute, attributes should _not_ be stored densely */ @@ -3832,10 +3831,10 @@ test_attr_big(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Delete first "small" attribute, should be no attributes now */ @@ -3847,8 +3846,8 @@ test_attr_big(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); + is_empty = H5O__is_attr_empty_test(dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); } /* end if */ else { /* Shouldn't be able to create "big" attributes with older version of format */ @@ -3859,10 +3858,10 @@ test_attr_big(hid_t fcpl, hid_t fapl) * message heap instead of forcing the attribute storage into the dense * form - QAK) */ - is_empty = H5O_is_attr_empty_test(dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); } /* end else */ @@ -3889,7 +3888,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_big() */ - + /**************************************************************** ** ** test_attr_null_space(): Test basic H5A (attribute) code. @@ -4107,7 +4106,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_null_space() */ - + /**************************************************************** ** ** test_attr_deprec(): Test basic H5A (attribute) code. @@ -4150,7 +4149,6 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); - /* Close dataspaces */ ret = H5Sclose(sid); @@ -4216,7 +4214,7 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_attr_deprec() */ - + /**************************************************************** ** ** test_attr_many(): Test basic H5A (attribute) code. @@ -4345,7 +4343,7 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_many() */ - + /**************************************************************** ** ** test_attr_corder_create_empty(): Test basic H5A (attribute) code. @@ -4412,10 +4410,10 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Close Dataset */ ret = H5Dclose(dataset); @@ -4439,10 +4437,10 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Retrieve dataset creation property list for group */ dcpl = H5Dget_create_plist(dataset); @@ -4466,7 +4464,7 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_corder_create_basic() */ - + /**************************************************************** ** ** test_attr_corder_create_compact(): Test basic H5A (attribute) code. @@ -4548,10 +4546,10 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Create several attributes, but keep storage in compact form */ for(u = 0; u < max_compact; u++) { @@ -4569,13 +4567,13 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (u + 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (u + 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); } /* end for */ } /* end for */ @@ -4632,13 +4630,13 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Loop through attributes, checking their creation order values */ /* (the name index is used, but the creation order value is in the same order) */ @@ -4669,7 +4667,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_corder_create_compact() */ - + /**************************************************************** ** ** test_attr_corder_create_dense(): Test basic H5A (attribute) code. @@ -4753,10 +4751,10 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Create several attributes, but keep storage in compact form */ for(u = 0; u < max_compact; u++) { @@ -4774,13 +4772,13 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (u + 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (u + 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); } /* end for */ /* Create another attribute, to push into dense storage */ @@ -4797,18 +4795,18 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact + 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact + 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); } /* end for */ /* Close Datasets */ @@ -4864,13 +4862,13 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact + 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact + 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Loop through attributes, checking their creation order values */ /* (the name index is used, but the creation order value is in the same order) */ @@ -4901,7 +4899,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_corder_create_dense() */ - + /**************************************************************** ** ** test_attr_corder_create_reopen(): Test basic H5A (attribute) code. @@ -5009,7 +5007,7 @@ test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_corder_create_reopen() */ - + /**************************************************************** ** ** test_attr_corder_transition(): Test basic H5A (attribute) code. @@ -5097,10 +5095,10 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); } /* end for */ /* Close Datasets */ @@ -5167,13 +5165,13 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (u + 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (u + 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); } /* end for */ /* Create another attribute, to push into dense storage */ @@ -5190,18 +5188,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact + 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact + 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); /* Delete several attributes from object, until attribute storage resumes compact form */ for(u = max_compact; u >= min_dense; u--) { @@ -5210,18 +5208,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, u, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, u, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); } /* end for */ /* Delete another attribute, to push attribute storage into compact form */ @@ -5230,13 +5228,13 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (min_dense - 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (min_dense - 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Re-add attributes to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { @@ -5255,18 +5253,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact + 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact + 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); } /* end for */ /* Close Datasets */ @@ -5314,18 +5312,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact + 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact + 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); /* Delete several attributes from object, until attribute storage resumes compact form */ for(u = max_compact; u >= min_dense; u--) { @@ -5334,18 +5332,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, u, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, u, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); } /* end for */ /* Delete another attribute, to push attribute storage into compact form */ @@ -5354,13 +5352,13 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (min_dense - 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (min_dense - 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Re-add attributes to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { @@ -5379,18 +5377,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact + 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact + 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); /* Delete all attributes */ for(u = max_compact; u > 0; u--) { @@ -5420,7 +5418,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_corder_transition() */ - + /**************************************************************** ** ** test_attr_corder_delete(): Test basic H5A (attribute) code. @@ -5532,10 +5530,10 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Create attributes, until attribute storage is in dense form */ for(u = 0; u < max_compact * 2; u++) { @@ -5554,18 +5552,18 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); } /* end for */ /* Close Datasets */ @@ -5626,7 +5624,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_corder_delete() */ - + /*------------------------------------------------------------------------- * Function: attr_info_by_idx_check * @@ -5773,7 +5771,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, return(-1); } /* end attr_info_by_idx_check() */ - + /**************************************************************** ** ** test_attr_info_by_idx(): Test basic H5A (attribute) code. @@ -5867,10 +5865,10 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for query on non-existant attribute */ ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &ainfo, H5P_DEFAULT); @@ -5899,13 +5897,13 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound offset queries */ ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &ainfo, H5P_DEFAULT); @@ -5931,8 +5929,8 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Verify state of object */ - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); /* Verify information for new attribute */ ret = attr_info_by_idx_check(my_dataset, attrname, (hsize_t)u, use_index); @@ -5940,21 +5938,21 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for out of bound offset queries */ @@ -5988,7 +5986,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_info_by_idx() */ - + /**************************************************************** ** ** test_attr_delete_by_idx(): Test basic H5A (attribute) code. @@ -6112,10 +6110,10 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for deleting non-existant attribute */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); @@ -6142,13 +6140,13 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound deletions */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); @@ -6208,8 +6206,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete_by_idx"); /* Verify state of attribute storage (empty) */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); } /* end for */ /* Work on all the datasets */ @@ -6248,8 +6246,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -6258,21 +6256,21 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for out of bound deletion */ @@ -6333,8 +6331,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete_by_idx"); /* Verify state of attribute storage (empty) */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); /* Check for deletion on empty attribute storage again */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); @@ -6381,8 +6379,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -6493,8 +6491,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete_by_idx"); /* Verify state of attribute storage (empty) */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); /* Check for deletion on empty attribute storage again */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); @@ -6525,7 +6523,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_delete_by_idx() */ - + /**************************************************************** ** ** attr_iterate2_cb(): Revised attribute operator @@ -6599,7 +6597,7 @@ HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr); } /* end attr_iterate2_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /**************************************************************** ** ** attr_iterate1_cb(): Attribute operator @@ -6612,7 +6610,7 @@ attr_iterate1_cb(hid_t loc_id, const char *attr_name, void *_op_data) } /* end attr_iterate1_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: attr_iterate2_fail_cb * @@ -6634,7 +6632,7 @@ attr_iterate2_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED * return(H5_ITER_ERROR); } /* end attr_iterate2_fail_cb() */ - + /*------------------------------------------------------------------------- * Function: attr_iterate_check * @@ -6934,7 +6932,7 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id, return(-1); } /* end attr_iterate_check() */ - + /**************************************************************** ** ** test_attr_iterate2(): Test basic H5A (attribute) code. @@ -7069,10 +7067,10 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for iterating over object with no attributes (should be OK) */ ret = H5Aiterate2(my_dataset, idx_type, order, NULL, attr_iterate2_cb, NULL); @@ -7105,13 +7103,13 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound iteration */ idx = u; @@ -7171,8 +7169,8 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -7181,21 +7179,21 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for out of bound iteration */ @@ -7243,7 +7241,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) HDfree(visited); } /* test_attr_iterate2() */ - + /*------------------------------------------------------------------------- * Function: attr_open_by_idx_check * @@ -7303,7 +7301,7 @@ attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, return(-1); } /* end attr_open_by_idx_check() */ - + /**************************************************************** ** ** test_attr_open_by_idx(): Test basic H5A (attribute) code. @@ -7426,10 +7424,10 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for opening an attribute on an object with no attributes */ ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); @@ -7456,13 +7454,13 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound opening an attribute on an object */ ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT); @@ -7510,8 +7508,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -7520,21 +7518,21 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for out of bound opening an attribute on an object */ @@ -7570,7 +7568,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_open_by_idx() */ - + /*------------------------------------------------------------------------- * Function: attr_open_check * @@ -7656,7 +7654,7 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, return(-1); } /* end attr_open_check() */ - + /**************************************************************** ** ** test_attr_open_by_name(): Test basic H5A (attribute) code. @@ -7753,10 +7751,10 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for opening a non-existant attribute on an object with no attributes */ ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); @@ -7789,13 +7787,13 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for opening a non-existant attribute on an object with compact attribute storage */ ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); @@ -7852,8 +7850,8 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -7862,21 +7860,21 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for opening a non-existant attribute on an object with dense attribute storage */ @@ -7916,7 +7914,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_open_by_name() */ - + /**************************************************************** ** ** test_attr_create_by_name(): Test basic H5A (attribute) code. @@ -8012,10 +8010,10 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { @@ -8038,13 +8036,13 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Test opening attributes stored compactly */ ret = attr_open_check(fid, dsetname, my_dataset, u); @@ -8091,8 +8089,8 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -8101,21 +8099,21 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Test opening attributes stored compactly */ @@ -8274,14 +8272,14 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Check on dataset's message storage status */ if(test_shared != 0) { /* Datasets' datatypes can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Datasets' dataspace can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Retrieve limits for compact/dense attribute storage */ @@ -8293,10 +8291,10 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on datasets' attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); - is_dense = H5O_is_attr_dense_test(dataset2); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset2); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { @@ -8348,11 +8346,11 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); + is_dense = H5O__is_attr_dense_test(dataset); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Alternate between creating "small" & "big" attributes */ @@ -8400,11 +8398,11 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset2); + is_dense = H5O__is_attr_dense_test(dataset2); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); } /* end for */ /* Close attribute's datatype */ @@ -8421,15 +8419,15 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) if(test_shared != 0) { if(test_shared == 1) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Unlink datasets with attributes */ @@ -8445,20 +8443,20 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) } /* end if */ /* Check on attribute storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); if(test_shared != 0) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Close file */ @@ -8610,14 +8608,14 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Check on dataset's message storage status */ if(test_shared != 0) { /* Datasets' datatypes can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Datasets' dataspace can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Retrieve limits for compact/dense attribute storage */ @@ -8629,10 +8627,10 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on datasets' attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); - is_dense = H5O_is_attr_dense_test(dataset2); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset2); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { @@ -8684,11 +8682,11 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); + is_dense = H5O__is_attr_dense_test(dataset); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Alternate between creating "small" & "big" attributes */ @@ -8736,11 +8734,11 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset2); + is_dense = H5O__is_attr_dense_test(dataset2); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Create new attribute name */ @@ -8873,15 +8871,15 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) if(test_shared != 0) { if(test_shared == 1) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Unlink datasets with attributes */ @@ -8897,20 +8895,20 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) } /* end if */ /* Check on attribute storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); if(test_shared != 0) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Close file */ @@ -9061,14 +9059,14 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Check on dataset's message storage status */ if(test_shared != 0) { /* Datasets' datatypes can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Datasets' dataspace can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Retrieve limits for compact/dense attribute storage */ @@ -9080,10 +9078,10 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on datasets' attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); - is_dense = H5O_is_attr_dense_test(dataset2); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset2); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { @@ -9135,11 +9133,11 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); + is_dense = H5O__is_attr_dense_test(dataset); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Alternate between creating "small" & "big" attributes */ @@ -9179,7 +9177,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Check refcount for attribute */ ret = H5A__get_shared_rc_test(attr, &shared_refcount); CHECK(ret, FAIL, "H5A__get_shared_rc_test"); - VERIFY(shared_refcount, 2, "H5A_get_shared_rc_test"); + VERIFY(shared_refcount, 2, "H5A__get_shared_rc_test"); } /* end else */ /* Close attribute */ @@ -9187,11 +9185,11 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset2); + is_dense = H5O__is_attr_dense_test(dataset2); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); } /* end for */ @@ -9247,15 +9245,15 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) if(test_shared != 0) { if(test_shared == 1) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Unlink datasets with attributes */ @@ -9271,20 +9269,20 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) } /* end if */ /* Check on attribute storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); if(test_shared != 0) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Close file */ @@ -9435,14 +9433,14 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Check on dataset's message storage status */ if(test_shared != 0) { /* Datasets' datatypes can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Datasets' dataspace can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Retrieve limits for compact/dense attribute storage */ @@ -9454,10 +9452,10 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on datasets' attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); - is_dense = H5O_is_attr_dense_test(dataset2); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset2); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { @@ -9509,11 +9507,11 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); + is_dense = H5O__is_attr_dense_test(dataset); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Alternate between creating "small" & "big" attributes */ @@ -9561,11 +9559,11 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset2); + is_dense = H5O__is_attr_dense_test(dataset2); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); } /* end for */ @@ -9583,8 +9581,8 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Check on first dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Check ref count on attributes of first dataset */ for(u = 0; u < max_compact * 2; u++) { @@ -9631,20 +9629,20 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) } /* end if */ /* Check on attribute storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); if(test_shared != 0) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Close file */ @@ -11112,7 +11110,7 @@ test_attr(void) CHECK(ret, FAIL, "H5Pclose"); } /* test_attr() */ - + /*------------------------------------------------------------------------- * Function: cleanup_attr * diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index 8190665..fc99f77 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -1,5 +1,5 @@ Testing error API H5Eset/get_auto Testing error API based on data I/O All error API tests passed. - This program tests the Error API compatible with HDF5 version (number). There're supposed to be some error messages + This program tests the Error API compatible with HDF5 version (number). There are supposed to be some error messages ********* Print error stack in HDF5 default way ********* HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in main(): Error test failed @@ -12,18 +12,12 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Dcreate2(): not a location ID + #000: (file name) line (number) in H5Dcreate2(): invalid location identifier major: Invalid arguments to routine minor: Inappropriate type - #001: (file name) line (number) in H5G_loc(): invalid object ID - major: Invalid arguments to routine - minor: Bad value ********* Print error stack in customized way ********* - error #000: (file name) in H5G_loc(): line (number) - major: Invalid arguments to routine - minor: Bad value - error #001: (file name) in H5Dcreate2(): line (number) + error #000: (file name) in H5Dcreate2(): line (number) major: Invalid arguments to routine minor: Inappropriate type @@ -33,19 +27,13 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Can't get value ********* Print error stack in customized way ********* - error #000: (file name) in H5G_loc(): line (number) - major: Invalid arguments to routine - minor: Bad value - error #001: (file name) in H5Dcreate2(): line (number) + error #000: (file name) in H5Dcreate2(): line (number) major: Invalid arguments to routine minor: Inappropriate type HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Dcreate2(): not a location ID + #000: (file name) line (number) in H5Dcreate2(): invalid location identifier major: Invalid arguments to routine minor: Inappropriate type - #001: (file name) line (number) in H5G_loc(): invalid object ID - major: Invalid arguments to routine - minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in main(): Error test failed diff --git a/test/testfiles/error_test_1 b/test/testfiles/error_test_1 index 02cfed8..f0e4a62 100644 --- a/test/testfiles/error_test_1 +++ b/test/testfiles/error_test_1 @@ -41,19 +41,28 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dread(): can't read data major: Dataset minor: Read failed - #001: (file name) line (number) in H5D__read(): can't read data + #001: (file name) line (number) in H5VL_dataset_read(): dataset read failed + major: Virtual Object Layer + minor: Read failed + #002: (file name) line (number) in H5VL__dataset_read(): dataset read failed + major: Virtual Object Layer + minor: Read failed + #003: (file name) line (number) in H5VL__native_dataset_read(): can't read data + major: Dataset + minor: Read failed + #004: (file name) line (number) in H5D__read(): can't read data major: Dataset minor: Read failed - #002: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk + #005: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk major: Low-level I/O minor: Read failed - #003: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed + #006: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed major: Dataset minor: Filter operation failed - #004: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered + #007: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered major: Data filters minor: Read failed - #005: (file name) line (number) in H5PL_load(): filter plugins disabled + #008: (file name) line (number) in H5PL_load(): filter plugins disabled major: Plugin for dynamically loaded library minor: Unable to load metadata into cache diff --git a/test/testframe.c b/test/testframe.c index 21f9ea3..335118c 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -146,10 +146,10 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p * Record the program name and private routines if provided. */ TestProgName = ProgName; - if (NULL != private_usage) - TestPrivateUsage = private_usage; - if (NULL != private_parser) - TestPrivateParser = private_parser; + if(NULL != private_usage) + TestPrivateUsage = private_usage; + if(NULL != private_parser) + TestPrivateParser = private_parser; } diff --git a/test/testhdf5.c b/test/testhdf5.c index 713cccf..e136086 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -90,8 +90,8 @@ main(int argc, char *argv[]) /* Exit failure if errors encountered; else exit success. */ /* No need to print anything since PerformTests() already does. */ if (GetTestNumErrs() > 0) - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); else - exit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); } /* end main() */ diff --git a/test/tfile.c b/test/tfile.c index 619320a..b2c3e1b 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -22,9 +22,9 @@ #include "testhdf5.h" #include "H5srcdir.h" -#include "H5Bprivate.h" #include "H5Iprivate.h" #include "H5Pprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ /* * This file needs to access private information from the H5F package. @@ -896,15 +896,15 @@ test_file_close(void) CHECK(ret, FAIL, "H5Pget_fclose_degree"); switch(fc_degree) { - case H5F_CLOSE_STRONG: + case H5F_CLOSE_STRONG: /* Close first open */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); /* Close second open */ ret = H5Fclose(fid2); CHECK(ret, FAIL, "H5Fclose"); - break; - case H5F_CLOSE_SEMI: + break; + case H5F_CLOSE_SEMI: /* Close first open */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -919,8 +919,8 @@ test_file_close(void) /* Close second open */ ret = H5Fclose(fid2); CHECK(ret, FAIL, "H5Fclose"); - break; - case H5F_CLOSE_WEAK: + break; + case H5F_CLOSE_WEAK: /* Close first open */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -935,7 +935,7 @@ test_file_close(void) CHECK(ret, FAIL, "H5Gclose"); ret = H5Gclose(group_id3); CHECK(ret, FAIL, "H5Gclose"); - break; + break; case H5F_CLOSE_DEFAULT: default: CHECK(fc_degree, H5F_CLOSE_DEFAULT, "H5Pget_fclose_degree"); @@ -957,7 +957,7 @@ test_file_close(void) ****************************************************************/ static void create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1, - hid_t *ret_gid2, hid_t *ret_gid3) + hid_t *ret_gid2, hid_t *ret_gid3) { ssize_t oid_count; herr_t ret; @@ -1109,9 +1109,10 @@ test_get_obj_ids(void) oid_list = (hid_t *)HDcalloc((size_t)oid_list_size, sizeof(hid_t)); CHECK_PTR(oid_list, "HDcalloc"); - /* Call the public function H5F_get_obj_ids to use H5F_get_objects. User reported having problem here. + /* Call the public function H5F_get_obj_ids to use H5F__get_objects. User reported having problem here. * that the returned size (ret_count) from H5Fget_obj_ids is one greater than the size passed in - * (oid_list_size) */ + * (oid_list_size). + */ ret_count = H5Fget_obj_ids(fid, H5F_OBJ_ALL, (size_t)oid_list_size, oid_list); CHECK(ret_count, FAIL, "H5Fget_obj_ids"); VERIFY(ret_count, oid_list_size, "H5Fget_obj_count"); @@ -1431,6 +1432,7 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -1586,6 +1588,96 @@ test_file_perm2(void) } /* end test_file_perm2() */ +/**************************************************************** +** +** test_file_is_accessible(): low-level file test routine. +** Clone of test_file_ishdf5 but uses the newer VOL-enabled +** H5Fis_accessible() API call. +** +*****************************************************************/ +static void +test_file_is_accessible(void) +{ + hid_t fid; /* File opened with read-write permission */ + hid_t fcpl_id; /* File creation property list */ + hid_t fapl = -1; /* File access property list */ + int fd; /* POSIX file descriptor */ + ssize_t nbytes; /* Number of bytes written */ + unsigned u; /* Local index variable */ + unsigned char buf[1024]; /* Buffer of data to write */ + htri_t status; /* Whether a file is an HDF5 file */ + herr_t ret; + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Detection of HDF5 Files\n")); + + /* Get FAPL */ + fapl = h5_fileaccess(); + CHECK(fapl, FAIL, "H5Pcreate"); + + /* Create a file */ + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Verify that the file is an HDF5 file */ + status = H5Fis_accessible(FILE1, fapl); + VERIFY(status, TRUE, "H5Fis_accessible"); + + + /* Create a file creation property list with a non-default user block size */ + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + CHECK(fcpl_id, FAIL, "H5Pcreate"); + + ret = H5Pset_userblock(fcpl_id, (hsize_t)2048); + CHECK(ret, FAIL, "H5Pset_userblock"); + + /* Create file with non-default user block */ + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl_id, fapl); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Release file-creation property list */ + ret = H5Pclose(fcpl_id); + CHECK(ret, FAIL, "H5Pclose"); + + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Verify that the file is an HDF5 file */ + status = H5Fis_accessible(FILE1, fapl); + VERIFY(status, TRUE, "H5Fis_accessible"); + + + /* Create non-HDF5 file and check it */ + fd = HDopen(FILE1, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW); + CHECK(fd, FAIL, "HDopen"); + + /* Initialize information to write */ + for (u=0; u<1024; u++) + buf[u]=(unsigned char)u; + + /* Write some information */ + nbytes = HDwrite(fd, buf, (size_t)1024); + VERIFY(nbytes, 1024, "HDwrite"); + + /* Close the file */ + ret = HDclose(fd); + CHECK(ret, FAIL, "HDclose"); + + /* Verify that the file is not an HDF5 file */ + status = H5Fis_accessible(FILE1, fapl); + VERIFY(status, FALSE, "H5Fis_accessible"); + + /* Close property list */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + +} /* end test_file_is_accessible() */ + /**************************************************************** ** @@ -1594,11 +1686,13 @@ test_file_perm2(void) ** correctly in variuous situations. ** *****************************************************************/ +#ifndef H5_NO_DEPRECATED_SYMBOLS static void test_file_ishdf5(void) { hid_t file; /* File opened with read-write permission */ hid_t fcpl; /* File creation property list */ + hid_t fapl = -1; /* File access property list */ int fd; /* File Descriptor */ ssize_t nbytes; /* Number of bytes written */ unsigned u; /* Local index variable */ @@ -1607,10 +1701,14 @@ test_file_ishdf5(void) herr_t ret; /* Output message about test being performed */ - MESSAGE(5, ("Testing Detection of HDF5 Files\n")); + MESSAGE(5, ("Testing Detection of HDF5 Files (using deprecated H5Fis_hdf5() call)\n")); + + /* Get FAPL */ + fapl = h5_fileaccess(); + CHECK(fapl, FAIL, "H5Pcreate"); /* Create a file */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Close file */ @@ -1630,7 +1728,7 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "H5Pset_userblock"); /* Create file with non-default user block */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); + file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Release file-creation property list */ @@ -1666,7 +1764,12 @@ test_file_ishdf5(void) status = H5Fis_hdf5(FILE1); VERIFY(status, FALSE, "H5Fis_hdf5"); + /* Close property list */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + } /* end test_file_ishdf5() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /**************************************************************** ** @@ -2155,10 +2258,8 @@ test_file_double_file_dataset_open(hbool_t new_format) MESSAGE(5, ("Testing double file and dataset open/close\n")); /* Setting up test file */ - - fapl = H5Pcreate(H5P_FILE_ACCESS); + fapl = h5_fileaccess(); CHECK(fapl, FAIL, "H5Pcreate"); - if(new_format) { ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); CHECK(ret, FAIL, "H5Pset_libver_bounds"); @@ -2670,8 +2771,8 @@ test_cached_stab_info(void) CHECK(file_id, FAIL, "H5Fopen"); /* Verify the cached symbol table information */ - ret = H5F_check_cached_stab_test(file_id); - CHECK(ret, FAIL, "H5F_check_cached_stab_test"); + ret = H5F__check_cached_stab_test(file_id); + CHECK(ret, FAIL, "H5F__check_cached_stab_test"); /* Close file */ ret = H5Fclose(file_id); @@ -3941,14 +4042,6 @@ error: ** This routine checks the free space available in a file as ** returned by the public routine H5Fget_freespace(). ** -** Modifications: -** Vailin Choi; July 2012 -** Remove datasets in reverse order so that all file spaces are shrunk. -** (A change due to H5FD_FLMAP_DICHOTOMY.) -** -** Vailin Choi; Dec 2012 -** Add changes due to paged aggregation via new format: -** the amount of freespace is different. ** *****************************************************************/ static void @@ -4088,10 +4181,7 @@ test_file_freespace(const char *env_h5_drvr) /* Check that there is the right amount of free space in the file */ free_space = H5Fget_freespace(file); CHECK(free_space, FAIL, "H5Fget_freespace"); - if(new_format) - VERIFY(free_space, expected_fs_del, "H5Fget_freespace"); - else - VERIFY(free_space, expected_fs_del, "H5Fget_freespace"); + VERIFY(free_space, expected_fs_del, "H5Fget_freespace"); /* Close file */ ret = H5Fclose(file); @@ -5342,8 +5432,8 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) /* Get the internal file pointer if the create succeeds */ if((ok = fid >= 0)) { - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); } /* Retrieve the low/high bounds */ @@ -5360,7 +5450,8 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) } else /* Should fail */ VERIFY(ok, FALSE, "H5Fcreate"); - } else { /* Should succeed */ + } + else { /* Should succeed */ VERIFY(ok, TRUE, "H5Fcreate"); VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds"); @@ -5490,8 +5581,8 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) CHECK(fid, FAIL, "H5Fcreate"); /* Get the internal file pointer */ - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); /* The file's superblock version */ super_vers = f->shared->sblock->super_vers; @@ -5522,8 +5613,8 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) /* Get the internal file pointer if the open succeeds */ if((ok = fid >= 0)) { - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); } /* Verify the file open succeeds or fails */ @@ -5694,8 +5785,8 @@ test_libver_bounds_obj(hid_t fapl) if(fid >=0 ) { /* The file open succeeds */ /* Get the internal file pointer */ - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); /* Create a group in the file */ gid = H5Gcreate2(fid, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -5802,8 +5893,8 @@ test_libver_bounds_dataset(hid_t fapl) CHECK(did, FAIL, "H5Dcreate"); /* Get the internal dataset pointer */ - dset = (H5D_t *)H5I_object(did); - CHECK(dset, NULL, "H5I_object"); + dset = (H5D_t *)H5VL_object(did); + CHECK(dset, NULL, "H5VL_object"); /* Verify version for layout and fill value messages */ if(low == H5F_LIBVER_EARLIEST) { @@ -5847,8 +5938,8 @@ test_libver_bounds_dataset(hid_t fapl) if(did >= 0) { /* Get the internal dataset pointer */ - dset = (H5D_t *)H5I_object(did); - CHECK(dset, NULL, "H5I_object"); + dset = (H5D_t *)H5VL_object(did); + CHECK(dset, NULL, "H5VL_object"); /* Verify layout message version and chunk indexing type */ VERIFY(dset->shared->layout.version, H5O_LAYOUT_VERSION_4, "H5O_layout_ver_bounds"); @@ -5905,16 +5996,16 @@ test_libver_bounds_dataset(hid_t fapl) if(fid >=0 ) { /* The file open succeeds */ /* Get the internal file pointer */ - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETC, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); CHECK(did, FAIL, "H5Dcreate2"); /* Get the internal file pointer */ - dset = (H5D_t *)H5I_object(did); - CHECK(dset, NULL, "H5I_object"); + dset = (H5D_t *)H5VL_object(did); + CHECK(dset, NULL, "H5VL_object"); /* Verify the dataset's layout, fill value and filter pipeline message versions */ /* Also verify the chunk indexing type */ @@ -6121,8 +6212,8 @@ test_libver_bounds_dataspace(hid_t fapl) if(fid >=0 ) { /* The file open succeeds */ /* Get the internal file pointer */ - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -6443,14 +6534,14 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) if(fid >= 0 ) { /* The file open succeeds */ /* Get the internal file pointer */ - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); /* Open the committed datatype */ str_tid = H5Topen2(fid, "datatype", H5P_DEFAULT); CHECK(str_tid, FAIL, "H5Topen2"); - str_dtype = (H5T_t *)H5I_object(str_tid); - CHECK(str_dtype, NULL, "H5I_object"); + str_dtype = (H5T_t *)H5VL_object(str_tid); + CHECK(str_dtype, NULL, "H5VL_object"); /* Verify the committed datatype message version */ VERIFY(str_dtype->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST], "H5O_dtype_ver_bounds"); @@ -6601,8 +6692,8 @@ test_libver_bounds_attributes(hid_t fapl) CHECK(aid, FAIL, "H5Acreate2"); /* Get the internal attribute pointer */ - attr = (H5A_t *)H5I_object(aid); - CHECK(attr, NULL, "H5I_object"); + attr = (H5A_t *)H5VL_object(aid); + CHECK(attr, NULL, "H5VL_object"); /* Verify the attribute version */ if(low == H5F_LIBVER_EARLIEST) @@ -6620,8 +6711,8 @@ test_libver_bounds_attributes(hid_t fapl) CHECK(aid, FAIL, "H5Acreate2"); /* Get the internal attribute pointer */ - attr = (H5A_t *)H5I_object(aid); - CHECK(attr, NULL, "H5I_object"); + attr = (H5A_t *)H5VL_object(aid); + CHECK(attr, NULL, "H5VL_object"); /* Verify attribute version */ VERIFY(attr->shared->version, H5O_attr_ver_bounds[low], "H5O_attr_ver_bounds"); @@ -6641,8 +6732,8 @@ test_libver_bounds_attributes(hid_t fapl) CHECK(aid, FAIL, "H5Acreate2"); /* Get internal attribute pointer */ - attr = (H5A_t *)H5I_object(aid); - CHECK(attr, NULL, "H5I_object"); + attr = (H5A_t *)H5VL_object(aid); + CHECK(attr, NULL, "H5VL_object"); /* Verify attribute version */ if(low == H5F_LIBVER_EARLIEST) @@ -6706,8 +6797,8 @@ test_libver_bounds_attributes(hid_t fapl) CHECK(aid, FAIL, "H5Acreate2"); /* Get the internal attribute pointer */ - attr = (H5A_t *)H5I_object(aid); - CHECK(attr, NULL, "H5I_object"); + attr = (H5A_t *)H5VL_object(aid); + CHECK(attr, NULL, "H5VL_object"); /* Verify the attribute version */ if(low == H5F_LIBVER_EARLIEST) @@ -6764,8 +6855,8 @@ test_libver_bounds_attributes(hid_t fapl) if(fid >=0 ) { /* The file open succeeds */ /* Get the internal file pointer */ - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); /* Open the group */ gid = H5Gopen2(fid, GRP_NAME, H5P_DEFAULT); @@ -6776,8 +6867,8 @@ test_libver_bounds_attributes(hid_t fapl) CHECK(aid, FAIL, "H5Acreate2"); /* Get the internal attribute pointer */ - attr = (H5A_t *)H5I_object(aid); - CHECK(attr, NULL, "H5I_object"); + attr = (H5A_t *)H5VL_object(aid); + CHECK(attr, NULL, "H5VL_object"); /* Verify the attribute message version */ VERIFY(attr->shared->version, H5O_attr_ver_bounds[f->shared->low_bound], "H5O_attr_ver_bounds"); @@ -7443,7 +7534,7 @@ test_file(void) test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */ test_file_perm(); /* Test file access permissions */ test_file_perm2(); /* Test file access permission again */ - test_file_ishdf5(); /* Test detecting HDF5 files correctly */ + test_file_is_accessible(); /* Test detecting HDF5 files correctly */ test_file_open_dot(); /* Test opening objects with "." for a name */ test_file_open_overlap(); /* Test opening files in an overlapping manner */ test_file_getname(); /* Test basic H5Fget_name() functionality */ @@ -7479,11 +7570,12 @@ test_file(void) test_incr_filesize(); /* Test H5Fincrement_filesize() and H5Fget_eoa() */ test_min_dset_ohdr(); /* Test datset object header minimization */ #ifndef H5_NO_DEPRECATED_SYMBOLS + test_file_ishdf5(); /* Test detecting HDF5 files correctly */ test_deprec(); /* Test deprecated routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_file() */ - + /*------------------------------------------------------------------------- * Function: cleanup_file * diff --git a/test/tgenprop.c b/test/tgenprop.c index 5031846..151913c 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -1774,8 +1774,8 @@ test_genprop_path(void) CHECK_I(ret, "H5Pregister2"); /* Get full path for first class */ - path=H5P_get_class_path_test(cid1); - CHECK_PTR(path, "H5P_get_class_path_test"); + path = H5P__get_class_path_test(cid1); + CHECK_PTR(path, "H5P__get_class_path_test"); if(HDstrcmp(path,CLASS1_PATH)!=0) TestErrPrintf("Class names don't match!, path=%s, CLASS1_PATH=%s\n",path,CLASS1_PATH); H5free_memory(path); @@ -1789,14 +1789,14 @@ test_genprop_path(void) CHECK_I(ret, "H5Pregister2"); /* Get full path for second class */ - path=H5P_get_class_path_test(cid2); - CHECK_PTR(path, "H5P_get_class_path_test"); + path = H5P__get_class_path_test(cid2); + CHECK_PTR(path, "H5P__get_class_path_test"); if(HDstrcmp(path,CLASS2_PATH)!=0) TestErrPrintf("Class names don't match!, path=%s, CLASS2_PATH=%s\n",path,CLASS2_PATH); /* Open a copy of the class with the path name */ - cid3 = H5P_open_class_path_test(path); - CHECK_I(cid3, "H5Popen_class_path"); + cid3 = H5P__open_class_path_test(path); + CHECK_I(cid3, "H5P__open_class_path_test"); /* Check that the classes are equal */ ret = H5Pequal(cid2,cid3); diff --git a/test/th5s.c b/test/th5s.c index 0619571..14f5de9 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -22,7 +22,6 @@ #include "testhdf5.h" #include "H5srcdir.h" -#include "H5Bprivate.h" #include "H5Iprivate.h" #include "H5Pprivate.h" diff --git a/test/tmisc.c b/test/tmisc.c index 1e62302..fef94dd 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -2272,7 +2272,7 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char CHECK_PTR(user_block, "HDcalloc"); /* Copy in the user block data */ - HDmemcpy(user_block, str, strlen(str)); + HDmemcpy(user_block, str, HDstrlen(str)); /* Open the new file */ new_fp = HDfopen(new_name,"wb"); @@ -2713,16 +2713,16 @@ test_misc15(void) fapl = H5Fget_access_plist(file); CHECK(fapl, FAIL, "H5Fget_access_plist"); - ret = H5Pclose(fapl); - CHECK(ret, FAIL, "H5Pclose"); - ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is still OK */ - ret = H5Fis_hdf5(MISC15_FILE); + ret = H5Fis_accessible(MISC15_FILE, fapl); CHECK(ret, FAIL, "H5Fis_hdf5"); + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + file = H5Fopen(MISC15_FILE, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(file, FAIL, "H5Fopen"); @@ -3028,7 +3028,9 @@ test_misc19(void) hid_t emid = -1; /* Error Message ID */ hid_t esid = -1; /* Error Stack ID */ hid_t vfdid = -1; /* Virtual File Driver ID */ + hid_t volid = -1; /* Virtual Object Layer ID */ H5FD_class_t *vfd_cls = NULL; /* VFD class */ + H5VL_class_t *vol_cls = NULL; /* VOL class */ int rc; /* Reference count */ herr_t ret; /* Generic return value */ @@ -3479,6 +3481,44 @@ test_misc19(void) HDfree(vfd_cls); +/* Check H5I operations on virtual object connectors */ + + /* Get a VOL class to register */ + vol_cls = h5_get_dummy_vol_class(); + CHECK(vol_cls, NULL, "h5_get_dummy_vol_class"); + + /* Register a VOL connector */ + volid = H5VLregister_connector(vol_cls, H5P_DEFAULT); + CHECK(volid, FAIL, "H5VLregister_connector"); + + /* Check the reference count */ + rc = H5Iget_ref(volid); + VERIFY(rc, 1, "H5Iget_ref"); + + /* Increment the reference count */ + rc = H5Iinc_ref(volid); + VERIFY(rc, 2, "H5Iinc_ref"); + + /* Unregister the VOL connector normally */ + ret = H5VLunregister_connector(volid); + CHECK(ret, FAIL, "H5VLunregister_connector"); + + /* Check the reference count */ + rc = H5Iget_ref(volid); + VERIFY(rc, 1, "H5Iget_ref"); + + /* Unregister the VOL connector by decrementing the reference count */ + rc = H5Idec_ref(volid); + VERIFY(rc, 0, "H5Idec_ref"); + + /* Try unregistering the VOL connector again (should fail) */ + H5E_BEGIN_TRY { + ret = H5VLunregister_connector(volid); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5VLunregister_connector"); + + HDfree(vol_cls); + } /* end test_misc19() */ /**************************************************************** @@ -4721,6 +4761,7 @@ test_misc25a(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25a() */ + /**************************************************************** ** ** test_misc25b(): Exercise null object header message merge bug @@ -4756,7 +4797,7 @@ test_misc25b(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25b() */ - + /**************************************************************** ** ** test_misc25c(): Exercise another null object header message merge bug. @@ -4890,7 +4931,7 @@ test_misc25c(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25c() */ - + /**************************************************************** ** ** test_misc26(): Regression test: ensure that copying filter @@ -4976,7 +5017,7 @@ test_misc26(void) CHECK_I(ret, "H5Pclose"); } - + /**************************************************************** ** ** test_misc27(): Ensure that objects with incorrect # of object @@ -5021,7 +5062,7 @@ test_misc27(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc27() */ - + /**************************************************************** ** ** test_misc28(): Ensure that the dataset chunk cache will hold @@ -5198,7 +5239,7 @@ test_misc28(void) CHECK_I(ret, "H5Pclose"); } /* end test_misc28() */ - + /**************************************************************** ** ** test_misc29(): Ensure that speculative metadata reads don't @@ -5247,7 +5288,7 @@ test_misc30_get_info(hid_t loc_id) return H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, test_misc30_get_info_cb, NULL); } - + /**************************************************************** ** ** test_misc30(): Exercise local heap code that loads prefix @@ -5312,7 +5353,7 @@ test_misc30(void) VERIFY(file_size[0], file_size[1], "test_misc30"); } /* end test_misc30() */ - + /**************************************************************** ** ** test_misc31(): Test reentering library through deprecated @@ -5410,7 +5451,7 @@ test_misc31(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end test_misc31() */ - + /**************************************************************** * * test_misc32(): Simple test of filter memory allocation @@ -5584,7 +5625,7 @@ test_misc34(void) } /* end test_misc34() */ - + /**************************************************************** ** ** test_misc(): Main misc. test routine. @@ -5637,7 +5678,7 @@ test_misc(void) } /* test_misc() */ - + /*------------------------------------------------------------------------- * Function: cleanup_misc * @@ -5647,9 +5688,6 @@ test_misc(void) * * Programmer: Albert Cheng * July 2, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ void diff --git a/test/tsohm.c b/test/tsohm.c index b27a107..2df389e 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -3867,17 +3867,19 @@ test_sohm_external_dtype(void) file1 = H5Fcreate(FILENAME_SRC, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); CHECK_I(file1, "H5Fcreate"); - ret = H5F_get_sohm_mesg_count_test(file1, H5O_DTYPE_ID, &dmsg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(dmsg_count, 0, "H5F_get_sohm_mesg_count_test"); + /* Check on datatype storage status. It should be zero now. */ + ret = H5F__get_sohm_mesg_count_test(file1, H5O_DTYPE_ID, &dmsg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(dmsg_count, 0, "H5F__get_sohm_mesg_count_test"); dataset1 = H5Dcreate2(file1, "dataset_1", s1_tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK_I(dataset1, "H5Dcreate2"); - ret = H5F_get_sohm_mesg_count_test(file1, H5O_DTYPE_ID, &dmsg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(dmsg_count, 1, "H5F_get_sohm_mesg_count_test"); + /* Check on datatype storage status. It should be 1 now. */ + ret = H5F__get_sohm_mesg_count_test(file1, H5O_DTYPE_ID, &dmsg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(dmsg_count, 1, "H5F__get_sohm_mesg_count_test"); dset1_tid = H5Dget_type(dataset1); CHECK_I(dset1_tid, "H5Dget_type"); @@ -3902,17 +3904,19 @@ test_sohm_external_dtype(void) file2 = H5Fcreate(FILENAME_DST, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); CHECK_I(file2, "H5Fcreate"); - ret = H5F_get_sohm_mesg_count_test(file2, H5O_DTYPE_ID, &dmsg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(dmsg_count, 0, "H5F_get_sohm_mesg_count_test"); + /* Check on datatype storage status. It should be zero now. */ + ret = H5F__get_sohm_mesg_count_test(file2, H5O_DTYPE_ID, &dmsg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(dmsg_count, 0, "H5F__get_sohm_mesg_count_test"); dataset2 = H5Dcreate2(file2, "dataset_2", dset1_tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK_I(dataset2, "H5Dcreate2"); - ret = H5F_get_sohm_mesg_count_test(file2, H5O_DTYPE_ID, &dmsg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(dmsg_count, 1, "H5F_get_sohm_mesg_count_test"); + /* Check on datatype storage status. It should be 1 now. */ + ret = H5F__get_sohm_mesg_count_test(file2, H5O_DTYPE_ID, &dmsg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(dmsg_count, 1, "H5F__get_sohm_mesg_count_test"); ret = H5Dwrite(dataset2, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig); CHECK_I(ret, "H5Dwrite"); diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index 4160d3a..56d87ee 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -38,7 +38,7 @@ /* Having a common dataset name is an error */ #define DATASETNAME "commonname" -#define EXPECTED_ERROR_DEPTH 7 +#define EXPECTED_ERROR_DEPTH 9 #define WRITE_NUMBER 37 /* Typedefs */ @@ -73,23 +73,32 @@ tts_error(void) expected_g[0].maj_num = H5E_DATASET; expected_g[0].min_num = H5E_CANTINIT; - expected_g[1].maj_num = H5E_DATASET; - expected_g[1].min_num = H5E_CANTINIT; + expected_g[1].maj_num = H5E_VOL; + expected_g[1].min_num = H5E_CANTCREATE; - expected_g[2].maj_num = H5E_LINK; - expected_g[2].min_num = H5E_CANTINIT; + expected_g[2].maj_num = H5E_VOL; + expected_g[2].min_num = H5E_CANTCREATE; - expected_g[3].maj_num = H5E_LINK; - expected_g[3].min_num = H5E_CANTINSERT; + expected_g[3].maj_num = H5E_DATASET; + expected_g[3].min_num = H5E_CANTINIT; - expected_g[4].maj_num = H5E_SYM; - expected_g[4].min_num = H5E_NOTFOUND; + expected_g[4].maj_num = H5E_DATASET; + expected_g[4].min_num = H5E_CANTINIT; - expected_g[5].maj_num = H5E_SYM; - expected_g[5].min_num = H5E_CALLBACK; + expected_g[5].maj_num = H5E_LINK; + expected_g[5].min_num = H5E_CANTINIT; expected_g[6].maj_num = H5E_LINK; - expected_g[6].min_num = H5E_EXISTS; + expected_g[6].min_num = H5E_CANTINSERT; + + expected_g[7].maj_num = H5E_SYM; + expected_g[7].min_num = H5E_NOTFOUND; + + expected_g[8].maj_num = H5E_SYM; + expected_g[8].min_num = H5E_CALLBACK; + + expected_g[9].maj_num = H5E_LINK; + expected_g[9].min_num = H5E_EXISTS; /* set up mutex for global count of errors */ H5TS_mutex_init(&error_mutex_g); @@ -115,7 +124,7 @@ tts_error(void) H5TS_wait_for_thread(threads[i]); if (error_flag_g) { - TestErrPrintf("At least one thread reported a value that was different from the exected value\n"); + TestErrPrintf("At least one thread reported a value that was different from the expected value\n"); HDprintf("(Update this test if the error stack changed!)\n"); } diff --git a/test/tunicode.c b/test/tunicode.c index 85f5af0..5a60036 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -163,8 +163,8 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string) /* Fill the buffer with two copies of the UTF-8 string, each with a * terminating NULL. It will look like "abcdefg\0abcdefg\0". */ - strncpy(buf, new_string, big_len); - strncpy(&buf[big_len], new_string, big_len); + HDstrncpy(buf, new_string, big_len); + HDstrncpy(&buf[big_len], new_string, big_len); ret = H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tconvert"); @@ -226,8 +226,8 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string) /* Fill the buffer with two copies of the UTF-8 string. * It will look like "abcdefghabcdefgh". */ - strncpy(buf, new_string, big_len); - strncpy(&buf[big_len], new_string, big_len); + HDstrncpy(buf, new_string, big_len); + HDstrncpy(&buf[big_len], new_string, big_len); ret = H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tconvert"); diff --git a/test/tvlstr.c b/test/tvlstr.c index 3315d68..68d1070 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -23,12 +23,16 @@ #define DATAFILE "tvlstr.h5" #define DATAFILE2 "tvlstr2.h5" +#define DATAFILE3 "sel2el.h5" + +#define DATASET "1Darray" /* 1-D dataset with fixed dimensions */ #define SPACE1_RANK 1 #define SPACE1_DIM1 4 +#define NUMP 4 -#define VLSTR_TYPE "vl_string_type" +#define VLSTR_TYPE "vl_string_type" /* Definitions for the VL re-writing test */ #define REWRITE_NDATASETS 32 @@ -846,6 +850,101 @@ static void test_vl_rewrite(void) } /* end test_vl_rewrite() */ /**************************************************************** + ** + ** test_write_same_element(): + ** Tests writing to the same element of VL string using + ** H5Sselect_element. + ** + ****************************************************************/ +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"}; + 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"); + + dtype = H5Tcopy(H5T_C_S1); + CHECK(dtype, FAIL, "H5Tcopy"); + + ret = H5Tset_size(dtype, H5T_VARIABLE); + CHECK(ret, FAIL, "H5Tset_size"); + + fspace = H5Screate_simple(SPACE1_RANK, fdim, NULL); + CHECK(fspace, FAIL, "H5Screate_simple"); + + dataset1 = H5Dcreate(file1, DATASET, dtype, fspace, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); + CHECK(dataset1, FAIL, "H5Dcreate"); + + ret = H5Dwrite(dataset1, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); + CHECK(ret, FAIL, "H5Dwrite"); + + ret = H5Dclose(dataset1); + CHECK(ret, FAIL, "H5Dclose"); + + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + + ret = H5Sclose(fspace); + CHECK(ret, FAIL, "H5Sclose"); + + ret = H5Fclose(file1); + CHECK(ret, FAIL, "H5Fclose"); + + /* + * Open the file. Select the same points, write values to those point locations. + */ + file1 = H5Fopen(DATAFILE3, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file1, FAIL, "H5Fopen"); + + dataset1 = H5Dopen(file1, DATASET, H5P_DEFAULT); + CHECK(dataset1, FAIL, "H5Dopen"); + + fspace = H5Dget_space(dataset1); + CHECK(fspace, FAIL, "H5Dget_space"); + + dtype = H5Dget_type(dataset1); + CHECK(dtype, FAIL, "H5Dget_type"); + + mspace = H5Screate_simple(1, marray, NULL); + CHECK(mspace, FAIL, "H5Screate_simple"); + + coord[0][0] = 0; + coord[0][1] = 2; + coord[0][2] = 2; + coord[0][3] = 0; + + ret = H5Sselect_elements(fspace, H5S_SELECT_SET, NUMP, (const hsize_t *)&coord); + CHECK(ret, FAIL, "H5Sselect_elements"); + + ret = H5Dwrite(dataset1, dtype, mspace, fspace, H5P_DEFAULT, val); + CHECK(ret, FAIL, "H5Dwrite"); + + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + + ret = H5Dclose(dataset1); + CHECK(ret, FAIL, "H5Dclose"); + + ret = H5Sclose(fspace); + CHECK(ret, FAIL, "H5Dclose"); + + ret = H5Sclose(mspace); + CHECK(ret, FAIL, "H5Sclose"); + + ret = H5Fclose(file1); + CHECK(ret, FAIL, "H5Fclose"); +} /* test_write_same_element */ + +/**************************************************************** ** ** test_vlstrings(): Main VL string testing routine. ** @@ -869,9 +968,10 @@ test_vlstrings(void) /* Test writing VL datasets in files with lots of unlinking */ test_vl_rewrite(); + /* Test writing to the same element more than once using H5Sselect_elements */ + test_write_same_element(); } /* test_vlstrings() */ - /*------------------------------------------------------------------------- * Function: cleanup_vlstrings * @@ -891,5 +991,6 @@ cleanup_vlstrings(void) { HDremove(DATAFILE); HDremove(DATAFILE2); + HDremove(DATAFILE3); } diff --git a/test/tvltypes.c b/test/tvltypes.c index e5a3d34..8824066 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -467,7 +467,7 @@ test_vltypes_vlen_atomic(void) /* Try to call H5Dvlen_get_buf with bad dataspace */ H5E_BEGIN_TRY { - ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); + ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); } H5E_END_TRY VERIFY(ret, FAIL, "H5Dvlen_get_buf_size"); @@ -499,7 +499,7 @@ test_vltypes_vlen_atomic(void) /* Try to reclaim read data using "bad" dataspace with no extent * Should fail */ H5E_BEGIN_TRY { - ret=H5Dvlen_reclaim(tid1,sid2,xfer_pid,rdata); + ret=H5Dvlen_reclaim(tid1,sid2,xfer_pid,rdata); } H5E_END_TRY VERIFY(ret, FAIL, "H5Dvlen_reclaim"); @@ -1205,9 +1205,9 @@ test_vltypes_compound_vlstr(void) wdata[i].v.p=(s2*)HDmalloc((i+L3_INCM)*sizeof(s2)); wdata[i].v.len=i+L3_INCM; for(t1=(s2 *)((wdata[i].v).p), j=0; j<(i+L3_INCM); j++, t1++) { - strcat(str, "m"); - t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1); - strcpy(t1->string, str); + HDstrcat(str, "m"); + t1->string = (char*)HDmalloc(HDstrlen(str)*sizeof(char)+1); + HDstrcpy(t1->string, str); /*t1->color = red;*/ t1->color = blue; } @@ -1348,7 +1348,7 @@ test_vltypes_compound_vlstr(void) } /* end if */ for(t1=(s2 *)(wdata[i].v.p), t2=(s2 *)(rdata[i].v.p), j=0; j<rdata[i].v.len; j++, t1++, t2++) { - if( strcmp(t1->string, t2->string) ) { + if(HDstrcmp(t1->string, t2->string)) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ @@ -1368,14 +1368,14 @@ test_vltypes_compound_vlstr(void) CHECK(ret, FAIL, "H5Dvlen_reclaim"); /* Use this part for new data */ - strcpy(str, "bbbbbbbb\0"); + HDstrcpy(str, "bbbbbbbb\0"); for(i=0; i<SPACE1_DIM1; i++) { wdata2[i].v.p=(s2*)HDmalloc((i+1)*sizeof(s2)); wdata2[i].v.len=i+1; for(t1=(s2*)(wdata2[i].v).p, j=0; j<i+1; j++, t1++) { - strcat(str, "pp"); - t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1); - strcpy(t1->string, str); + HDstrcat(str, "pp"); + t1->string = (char*)HDmalloc(HDstrlen(str)*sizeof(char)+1); + HDstrcpy(t1->string, str); t1->color = green; } } /* end for */ @@ -1406,7 +1406,7 @@ test_vltypes_compound_vlstr(void) } /* end if */ for(t1=(s2 *)(wdata2[i].v.p), t2=(s2 *)(rdata2[i].v.p), j=0; j<rdata2[i].v.len; j++, t1++, t2++) { - if( strcmp(t1->string, t2->string) ) { + if(HDstrcmp(t1->string, t2->string)) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ diff --git a/test/unregister.c b/test/unregister.c index dbf6293..ff116cf 100644 --- a/test/unregister.c +++ b/test/unregister.c @@ -16,6 +16,7 @@ * Purpose: Tests H5Zunregister function */ #include "h5test.h" + #include "H5CXprivate.h" /* API Contexts */ const char *FILENAME[] = { @@ -24,8 +25,8 @@ const char *FILENAME[] = { NULL }; -#define GROUP_NAME "group" -#define DSET_NAME "dataset" +#define GROUP_NAME "test_group" +#define DSET_NAME "test_dataset" #define FILENAME_BUF_SIZE 1024 #define DSET_DIM1 100 #define DSET_DIM2 200 @@ -35,39 +36,34 @@ const char *FILENAME[] = { #define H5Z_FILTER_DUMMY 312 -static size_t filter_dummy(unsigned int flags, size_t cd_nelmts, +static size_t do_nothing(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); /* Dummy filter for test_unregister_filters only */ const H5Z_class2_t H5Z_DUMMY[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DUMMY, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dummy", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - filter_dummy, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DUMMY, /* Filter ID number */ + 1, 1, /* Encoding and decoding enabled */ + "dummy", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + do_nothing, /* The actual filter function */ }}; /*------------------------------------------------------------------------- - * Function: filter_dummy + * Function: do_nothing * - * Purpose: A dummy compression method that doesn't do anything. This - * filter is only for test_unregister_filters. Please don't + * Purpose: A dummy compression method that doesn't do anything. This + * filter is only for test_unregister_filters. Please don't * use it for other tests because it may mess up this test. * - * Return: Success: Data chunk size - * - * Failure: 0 - * - * Programmer: Raymond Lu - * April 24, 2013 + * Return: Data chunk size * *------------------------------------------------------------------------- */ static size_t -filter_dummy(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, +do_nothing(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) { @@ -75,194 +71,233 @@ filter_dummy(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, } /*------------------------------------------------------------------------- - * Function: test_unregister_filters - * - * Purpose: Tests unregistering filter before closing the file + * Function: test_unregister_filters * - * Return: Success: 0 - * Failure: -1 + * Purpose: Tests unregistering filter before closing the file * - * Programmer: Raymond Lu - * 11 April 2013 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -test_unregister_filters(hid_t my_fapl) +test_unregister_filters(hid_t fapl_id) { - hid_t file1, file2; - hid_t dc; - hid_t gcpl, gid, group; - hid_t dataset, space; - int i, j, n; - char gname[256]; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t dcpl_id = H5I_INVALID_HID; + hid_t gcpl_id = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t gid_loop = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + int i, j, n; + char group_name[32]; char filename[FILENAME_BUF_SIZE]; - const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */ - hsize_t dims[2]; - int points[DSET_DIM1][DSET_DIM2]; + const hsize_t chunk_dims[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */ + hsize_t dims[2]; + int data[DSET_DIM1][DSET_DIM2]; herr_t ret; TESTING("Unregistering filter"); /* Create first file */ - h5_fixname(FILENAME[0], my_fapl, filename, sizeof filename); - if((file1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) goto error; + h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename)); + if((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + goto error; /* Create second file */ - h5_fixname(FILENAME[1], my_fapl, filename, sizeof filename); - if((file2 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) goto error; + h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)); + if((fid2 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + goto error; /* Register DUMMY filter */ - if(H5Zregister(H5Z_DUMMY) < 0) goto error; - - if(H5Zfilter_avail(H5Z_FILTER_DUMMY)!=TRUE) goto error; + if (H5Zregister(H5Z_DUMMY) < 0) + goto error; + if (H5Zfilter_avail(H5Z_FILTER_DUMMY) != TRUE) + goto error; + + /******************* + * PART 1 - GROUPS * + *******************/ - if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) goto error; - /* Use DUMMY filter for creating groups */ - if(H5Pset_filter (gcpl, H5Z_FILTER_DUMMY, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) goto error; + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) + goto error; + if(H5Pset_filter(gcpl_id, H5Z_FILTER_DUMMY, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) + goto error; /* Create a group using this filter */ - if((gid = H5Gcreate2(file1, GROUP_NAME, H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) goto error; + if((gid = H5Gcreate2(fid1, GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Create multiple groups under the main group */ - for (i=0; i < GROUP_ITERATION; i++) { - sprintf(gname, "group_%d", i); - if((group = H5Gcreate2(gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if(H5Gclose(group) < 0) goto error; + for(i = 0; i < GROUP_ITERATION; i++) { + HDsprintf(group_name, "group_%d", i); + if((gid_loop = H5Gcreate2(gid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Gclose(gid_loop) < 0) + goto error; } - if(H5Fflush(file1, H5F_SCOPE_GLOBAL) < 0) goto error; + /* Flush the file containing the groups */ + if(H5Fflush(fid1, H5F_SCOPE_GLOBAL) < 0) + goto error; /* Unregister the filter before closing the group. It should fail */ H5E_BEGIN_TRY { ret = H5Zunregister(H5Z_FILTER_DUMMY); } H5E_END_TRY; - if(ret>=0) { + if(ret >= 0) { H5_FAILED(); - printf(" Line %d: Should not be able to unregister filter\n", __LINE__); + HDprintf(" Line %d: Should not be able to unregister filter\n", __LINE__); goto error; - } /* end if */ + } /* Close the group */ - if(H5Gclose(gid) < 0) goto error; + if(H5Gclose(gid) < 0) + goto error; /* Clean up objects used for this test */ - if(H5Pclose (gcpl) < 0) goto error; + if(H5Pclose (gcpl_id) < 0) + goto error; - if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; + /********************* + * PART 2 - DATASETS * + *********************/ - if(H5Pset_filter(dc, H5Z_FILTER_DUMMY, 0, (size_t)0, NULL) < 0) goto error; + /* Use DUMMY filter for creating datasets */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + if(H5Pset_chunk(dcpl_id, 2, chunk_dims) < 0) + goto error; + if(H5Pset_filter(dcpl_id, H5Z_FILTER_DUMMY, 0, (size_t)0, NULL) < 0) + goto error; - /* Initialize the dataset */ + /* Initialize the data for writing */ for(i = n = 0; i < DSET_DIM1; i++) for(j = 0; j < DSET_DIM2; j++) - points[i][j] = n++; + data[i][j] = n++; - /* Create the data space */ + /* Create the dataspace */ dims[0] = DSET_DIM1; dims[1] = DSET_DIM2; - if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) + goto error; /* Create a dataset in the first file */ - if((dataset = H5Dcreate2(file1, DSET_NAME, H5T_NATIVE_INT, space, - H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(fid1, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; /* Unregister the filter before closing the dataset. It should fail */ H5E_BEGIN_TRY { ret = H5Zunregister(H5Z_FILTER_DUMMY); } H5E_END_TRY; - if(ret>=0) { + if(ret >= 0) { H5_FAILED(); - printf(" Line %d: Should not be able to unregister filter\n", __LINE__); + HDprintf(" Line %d: Should not be able to unregister filter\n", __LINE__); goto error; - } /* end if */ + } - if(H5Dclose(dataset) < 0) goto error; + /* Close the dataset */ + if(H5Dclose(did) < 0) + goto error; /* Create a dataset in the second file */ - if((dataset = H5Dcreate2(file2, DSET_NAME, H5T_NATIVE_INT, space, - H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(fid2, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; - if(H5Dclose(dataset) < 0) goto error; + /* Close the dataset in the second file */ + if(H5Dclose(did) < 0) + goto error; /* Unregister the filter after closing all objects but before closing files. - * It should flush all files. */ - if(H5Zunregister(H5Z_FILTER_DUMMY) < 0) goto error; + * It should flush all files. + */ + if(H5Zunregister(H5Z_FILTER_DUMMY) < 0) + goto error; /* Clean up objects used for this test */ - if(H5Pclose (dc) < 0) goto error; - if(H5Fclose(file1) < 0) goto error; - if(H5Fclose(file2) < 0) goto error; + if(H5Pclose(dcpl_id) < 0) + goto error; + if(H5Fclose(fid1) < 0) + goto error; + if(H5Fclose(fid2) < 0) + goto error; PASSED(); - return 0; + return SUCCEED; error: - return -1; + H5E_BEGIN_TRY { + H5Fclose(fid1); + H5Fclose(fid2); + H5Pclose(dcpl_id); + H5Pclose(gcpl_id); + H5Gclose(gid); + H5Gclose(gid_loop); + H5Dclose(did); + H5Sclose(sid); + } H5E_END_TRY; + + return FAIL; } /*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Tests unregistering filter with H5Zunregister + * Function: main * - * Return: Success: exit(EXIT_SUCCESS) + * Purpose: Tests unregistering filter with H5Zunregister * - * Failure: exit(EXIT_FAILURE) - * - * Programmer: Raymond Lu - * 11 April 2013 + * Return: EXIT_SUCCESS/EXIT_FAILURE * *------------------------------------------------------------------------- */ int main(void) { - hid_t fapl; - int nerrors = 0; + hid_t fapl_id = H5I_INVALID_HID; + int nerrors = 0; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Testing setup */ h5_reset(); - fapl = h5_fileaccess(); + fapl_id = h5_fileaccess(); /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR api_ctx_pushed = TRUE; /* Test unregistering filter in its own file */ - nerrors += (test_unregister_filters(fapl) < 0 ? 1 : 0); + nerrors += (test_unregister_filters(fapl_id) < 0 ? 1 : 0); - if(nerrors) + h5_cleanup(FILENAME, fapl_id); + + if (nerrors) goto error; - printf("All filter unregistration tests passed.\n"); + HDprintf("All filter unregistration tests passed.\n"); /* Pop API context */ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR api_ctx_pushed = FALSE; - h5_cleanup(FILENAME, fapl); - return 0; + HDexit(EXIT_SUCCESS); error: nerrors = MAX(1, nerrors); - printf("***** %d FILTER UNREGISTRATION TEST%s FAILED! *****\n", + HDprintf("***** %d FILTER UNREGISTRATION TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); if(api_ctx_pushed) H5CX_pop(); - return 1; -} + HDexit(EXIT_FAILURE); +} /* end main() */ @@ -58,6 +58,6 @@ int setup_parameters(int argc, char * const argv[]); void show_parameters(void); void usage(const char *prog); int create_uc_file(void); -int write_uc_file(hbool_t tosend); +int write_uc_file(hbool_t tosend, hid_t fid); int read_uc_file(hbool_t towait); diff --git a/test/use_append_chunk.c b/test/use_append_chunk.c index 005eb51..4e8c672 100644 --- a/test/use_append_chunk.c +++ b/test/use_append_chunk.c @@ -124,10 +124,13 @@ main(int argc, char *argv[]) int ret_value = 0; int child_ret_value; hbool_t send_wait = FALSE; + hid_t fapl = -1; /* File access property list */ + hid_t fid = -1; /* File ID */ + char *name; /* Test file name */ /* initialization */ if (setup_parameters(argc, argv) < 0){ - Hgoto_error(1); + Hgoto_error(1); } /* Determine the need to send/wait message file*/ @@ -145,20 +148,20 @@ main(int argc, char *argv[]) /* Create file */ /* ============*/ if (UC_opts.launch != UC_READER){ - printf("Creating skeleton data file for test...\n"); - if (create_uc_file() < 0){ - fprintf(stderr, "***encounter error\n"); - Hgoto_error(1); - }else - printf("File created.\n"); + HDprintf("Creating skeleton data file for test...\n"); + if (create_uc_file() < 0){ + HDfprintf(stderr, "***encounter error\n"); + Hgoto_error(1); + }else + HDprintf("File created.\n"); } if (UC_opts.launch==UC_READWRITE){ - /* fork process */ - if((childpid = HDfork()) < 0) { - HDperror("fork"); - Hgoto_error(1); - }; + /* fork process */ + if((childpid = HDfork()) < 0) { + HDperror("fork"); + Hgoto_error(1); + }; }; mypid = HDgetpid(); @@ -166,53 +169,83 @@ main(int argc, char *argv[]) /* launch reader */ /* ============= */ if (UC_opts.launch != UC_WRITER){ - /* child process launch the reader */ - if(0 == childpid) { - printf("%d: launch reader process\n", mypid); - if (read_uc_file(send_wait) < 0){ - fprintf(stderr, "read_uc_file encountered error\n"); - exit(1); - } - exit(0); - } + /* child process launch the reader */ + if(0 == childpid) { + HDprintf("%d: launch reader process\n", mypid); + if (read_uc_file(send_wait) < 0){ + HDfprintf(stderr, "read_uc_file encountered error\n"); + HDexit(1); + } + HDexit(0); + } } /* ============= */ /* launch writer */ /* ============= */ /* this process continues to launch the writer */ - printf("%d: continue as the writer process\n", mypid); - if (write_uc_file(send_wait) < 0){ - fprintf(stderr, "write_uc_file encountered error\n"); - Hgoto_error(1); + HDprintf("%d: continue as the writer process\n", mypid); + + name = UC_opts.filename; + + /* Set file access proeprty list */ + if((fapl = h5_fileaccess()) < 0) + Hgoto_error(1); + + if(UC_opts.use_swmr) + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + Hgoto_error(1); + + /* Open the file */ + if((fid = H5Fopen(name, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0) { + HDfprintf(stderr, "H5Fopen failed\n"); + Hgoto_error(1); + } + + if(write_uc_file(send_wait, fid) < 0) { + HDfprintf(stderr, "write_uc_file encountered error\n"); + Hgoto_error(1); } /* ================================================ */ /* If readwrite, collect exit code of child process */ /* ================================================ */ if (UC_opts.launch == UC_READWRITE){ - if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0){ - HDperror("waitpid"); - Hgoto_error(1); - } - if (WIFEXITED(child_status)){ - if ((child_ret_value=WEXITSTATUS(child_status)) != 0){ - printf("%d: child process exited with non-zero code (%d)\n", - mypid, child_ret_value); - Hgoto_error(2); - } - } else { - printf("%d: child process terminated abnormally\n", mypid); - Hgoto_error(2); - } + if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0){ + HDperror("waitpid"); + Hgoto_error(1); + } + + /* Close the file */ + if(H5Fclose(fid) < 0) { + HDfprintf(stderr, "Failed to close file id\n"); + Hgoto_error(1); + } + + /* Close the property list */ + if(H5Pclose(fapl) < 0) { + HDfprintf(stderr, "Failed to close the property list\n"); + Hgoto_error(1); + } + + if (WIFEXITED(child_status)){ + if ((child_ret_value=WEXITSTATUS(child_status)) != 0){ + HDprintf("%d: child process exited with non-zero code (%d)\n", + mypid, child_ret_value); + Hgoto_error(2); + } + } else { + HDprintf("%d: child process terminated abnormally\n", mypid); + Hgoto_error(2); + } } done: /* Print result and exit */ if (ret_value != 0){ - printf("Error(s) encountered\n"); + HDprintf("Error(s) encountered\n"); }else{ - printf("All passed\n"); + HDprintf("All passed\n"); } return(ret_value); diff --git a/test/use_append_mchunks.c b/test/use_append_mchunks.c index 9ee37cb..0414628 100644 --- a/test/use_append_mchunks.c +++ b/test/use_append_mchunks.c @@ -117,10 +117,13 @@ main(int argc, char *argv[]) int ret_value = 0; int child_ret_value; hbool_t send_wait = 0; + hid_t fapl = -1; /* File access property list */ + hid_t fid = -1; /* File ID */ + char *name; /* Test file name */ /* initialization */ if (setup_parameters(argc, argv) < 0){ - Hgoto_error(1); + Hgoto_error(1); } /* Determine the need to send/wait message file*/ @@ -138,20 +141,20 @@ main(int argc, char *argv[]) /* Create file */ /* ============*/ if (UC_opts.launch != UC_READER){ - printf("Creating skeleton data file for test...\n"); + HDprintf("Creating skeleton data file for test...\n"); if (create_uc_file() < 0){ - fprintf(stderr, "***encounter error\n"); + HDfprintf(stderr, "***encounter error\n"); Hgoto_error(1); }else - printf("File created.\n"); + HDprintf("File created.\n"); } if (UC_opts.launch==UC_READWRITE){ - /* fork process */ - if((childpid = fork()) < 0) { - perror("fork"); - Hgoto_error(1); - }; + /* fork process */ + if((childpid = fork()) < 0) { + perror("fork"); + Hgoto_error(1); + }; }; mypid = getpid(); @@ -159,53 +162,84 @@ main(int argc, char *argv[]) /* launch reader */ /* ============= */ if (UC_opts.launch != UC_WRITER){ - /* child process launch the reader */ - if(0 == childpid) { - printf("%d: launch reader process\n", mypid); - if (read_uc_file(send_wait) < 0){ - fprintf(stderr, "read_uc_file encountered error\n"); - exit(1); - } - exit(0); - } + /* child process launch the reader */ + if(0 == childpid) { + HDprintf("%d: launch reader process\n", mypid); + if (read_uc_file(send_wait) < 0){ + HDfprintf(stderr, "read_uc_file encountered error\n"); + HDexit(1); + } + HDexit(0); + } } /* ============= */ /* launch writer */ /* ============= */ /* this process continues to launch the writer */ - printf("%d: continue as the writer process\n", mypid); - if (write_uc_file(send_wait) < 0){ - fprintf(stderr, "write_uc_file encountered error\n"); - Hgoto_error(1); + HDprintf("%d: continue as the writer process\n", mypid); + + name = UC_opts.filename; + + /* Set the file access property list */ + if((fapl = h5_fileaccess()) < 0) + Hgoto_error(1); + + if(UC_opts.use_swmr) + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + Hgoto_error(1); + + /* Open the file */ + if((fid = H5Fopen(name, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0) { + HDfprintf(stderr, "H5Fopen failed\n"); + Hgoto_error(1); + } + + if(write_uc_file(send_wait, fid) < 0) { + HDfprintf(stderr, "write_uc_file encountered error\n"); + Hgoto_error(1); } + /* ================================================ */ /* If readwrite, collect exit code of child process */ /* ================================================ */ if (UC_opts.launch == UC_READWRITE){ - if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0){ - perror("waitpid"); - Hgoto_error(1); - } - if (WIFEXITED(child_status)){ - if ((child_ret_value=WEXITSTATUS(child_status)) != 0){ - printf("%d: child process exited with non-zero code (%d)\n", - mypid, child_ret_value); - Hgoto_error(2); - } - } else { - printf("%d: child process terminated abnormally\n", mypid); - Hgoto_error(2); - } + if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0){ + perror("waitpid"); + Hgoto_error(1); + } + + /* Close the file */ + if(H5Fclose(fid) < 0) { + HDfprintf(stderr, "Failed to close file id\n"); + Hgoto_error(1); + } + + /* Close the property list */ + if(H5Pclose(fapl) < 0) { + HDfprintf(stderr, "Failed to close the property list\n"); + Hgoto_error(1); + } + + if (WIFEXITED(child_status)){ + if ((child_ret_value=WEXITSTATUS(child_status)) != 0){ + HDprintf("%d: child process exited with non-zero code (%d)\n", + mypid, child_ret_value); + Hgoto_error(1); + } + } else { + HDprintf("%d: child process terminated abnormally\n", mypid); + Hgoto_error(2); + } } done: /* Print result and exit */ if (ret_value != 0){ - printf("Error(s) encountered\n"); + HDprintf("Error(s) encountered\n"); }else{ - printf("All passed\n"); + HDprintf("All passed\n"); } return(ret_value); diff --git a/test/use_common.c b/test/use_common.c index 5aa6692..3ecb2e1 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -252,13 +252,10 @@ int create_uc_file(void) * * Return: 0 succeed; -1 fail. */ -int write_uc_file(hbool_t tosend) +int write_uc_file(hbool_t tosend, hid_t fid) { - hid_t fid; /* File ID for new HDF5 file */ hid_t dsid; /* dataset ID */ - hid_t fapl; /* File access property list */ hid_t dcpl; /* Dataset creation property list */ - char *name; UC_CTYPE *buffer, *bufptr; /* data buffer */ hsize_t cz=UC_opts.chunksize; /* Chunk size */ hid_t f_sid; /* dataset file space id */ @@ -270,19 +267,6 @@ int write_uc_file(hbool_t tosend) hsize_t start[3] = {0,0,0}, count[3]; /* Hyperslab selection values */ hsize_t i, j, k; - name = UC_opts.filename; - - /* Open the file */ - if((fapl = h5_fileaccess()) < 0) - return -1; - if(UC_opts.use_swmr) - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - return -1; - if((fid = H5Fopen(name, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0){ - fprintf(stderr, "H5Fopen failed\n"); - return -1; - } - if(tosend) /* Send a message that H5Fopen is complete--releasing the file lock */ h5_send_message(WRITER_MESSAGE, NULL, NULL); @@ -427,14 +411,6 @@ int write_uc_file(hbool_t tosend) fprintf(stderr, "Failed to close file space\n"); return -1; } - if (H5Pclose(fapl) < 0){ - fprintf(stderr, "Failed to property list\n"); - return -1; - } - if (H5Fclose(fid) < 0){ - fprintf(stderr, "Failed to close file id\n"); - return -1; - } return 0; } @@ -471,7 +447,7 @@ int read_uc_file(hbool_t towait) /* Before reading, wait for the message that H5Fopen is complete--file lock is released */ if(towait && h5_wait_message(WRITER_MESSAGE) < 0) { - fprintf(stderr, "Cannot find writer message file...failed\n"); + HDfprintf(stderr, "Cannot find writer message file...failed\n"); return -1; } @@ -481,19 +457,19 @@ int read_uc_file(hbool_t towait) if((fapl = h5_fileaccess()) < 0) return -1; if((fid = H5Fopen(name, H5F_ACC_RDONLY | (UC_opts.use_swmr ? H5F_ACC_SWMR_READ : 0), fapl)) < 0){ - fprintf(stderr, "H5Fopen failed\n"); + HDfprintf(stderr, "H5Fopen failed\n"); return -1; } if (H5Pclose(fapl) < 0){ - fprintf(stderr, "Failed to property list\n"); + HDfprintf(stderr, "Failed to property list\n"); return -1; } /* Open the dataset of the program name */ if((dsid = H5Dopen2(fid, progname_g, H5P_DEFAULT)) < 0){ - fprintf(stderr, "H5Dopen2 failed\n"); - return -1; + HDfprintf(stderr, "H5Dopen2 failed\n"); + return -1; } /* allocate space for data buffer 1 X dims[1] X dims[2] of UC_CTYPE */ @@ -501,8 +477,8 @@ int read_uc_file(hbool_t towait) memdims[1] = UC_opts.dims[1]; memdims[2] = UC_opts.dims[2]; if ((buffer=(UC_CTYPE*)HDmalloc((size_t)memdims[1]*(size_t)memdims[2]*sizeof(UC_CTYPE)))==NULL) { - fprintf(stderr, "malloc: failed\n"); - return -1; + HDfprintf(stderr, "malloc: failed\n"); + return -1; }; /* @@ -512,31 +488,31 @@ int read_uc_file(hbool_t towait) f_sid = H5Dget_space(dsid); /* Get filespace handle first. */ rank = H5Sget_simple_extent_ndims(f_sid); if (rank != UC_RANK){ - fprintf(stderr, "rank(%d) of dataset does not match\n", rank); - return -1; + HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank); + return -1; } if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0){ - fprintf(stderr, "H5Sget_simple_extent_dims got error\n"); - return -1; + HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n"); + return -1; } - printf("dataset rank %d, dimensions %llu x %llu x %llu\n", - rank, (unsigned long long)(dims[0]), (unsigned long long)(dims[1]), - (unsigned long long)(dims[2])); + HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", + rank, (unsigned long long)(dims[0]), (unsigned long long)(dims[1]), + (unsigned long long)(dims[2])); /* verify that file space dims are as expected and are consistent with memory space dims */ if (dims[1] != memdims[1] || dims[2] != memdims[2]){ - fprintf(stderr, "dataset dimension is not as expected. Got dims=(%llu,%llu,%llu)\n", - (unsigned long long)dims[0], (unsigned long long)dims[1], + HDfprintf(stderr, "dataset dimension is not as expected. Got dims=(%llu,%llu,%llu)\n", + (unsigned long long)dims[0], (unsigned long long)dims[1], (unsigned long long)dims[2]); - fprintf(stderr, "But memdims=(%llu,%llu,%llu)\n", - (unsigned long long)memdims[0], (unsigned long long)memdims[1], + HDfprintf(stderr, "But memdims=(%llu,%llu,%llu)\n", + (unsigned long long)memdims[0], (unsigned long long)memdims[1], (unsigned long long)memdims[2]); - return -1; + return -1; } /* setup mem-space for buffer */ if ((m_sid=H5Screate_simple(rank, memdims, NULL))<0){ - fprintf(stderr, "H5Screate_simple for memory failed\n"); - return -1; + HDfprintf(stderr, "H5Screate_simple for memory failed\n"); + return -1; }; /* Read 1 plane at a time whenever the dataset grows larger @@ -550,22 +526,22 @@ int read_uc_file(hbool_t towait) /* print progress message according to if new planes are availalbe */ if (nplane_old < dims[0]) { if (nonewplane){ - /* end the previous message */ - printf("\n"); - nonewplane=0; + /* end the previous message */ + HDprintf("\n"); + nonewplane=0; } - printf("reading planes %llu to %llu\n", (unsigned long long)nplane_old, + HDprintf("reading planes %llu to %llu\n", (unsigned long long)nplane_old, (unsigned long long)dims[0]); }else{ if (nonewplane){ - printf("."); + HDprintf("."); if (nonewplane>=30){ - fprintf(stderr, "waited too long for new plane, quit.\n"); + HDfprintf(stderr, "waited too long for new plane, quit.\n"); return -1; } }else{ - /* print mesg only the first time; dots still no new plane */ - printf("no new planes to read "); + /* print mesg only the first time; dots still no new plane */ + HDprintf("no new planes to read "); } nonewplane++; /* pause for a second */ @@ -575,41 +551,41 @@ int read_uc_file(hbool_t towait) /* read planes between last old nplanes and current extent */ /* Get the dataset's dataspace */ if((f_sid = H5Dget_space(dsid)) < 0){ - fprintf(stderr, "H5Dget_space failed\n"); - return -1; + HDfprintf(stderr, "H5Dget_space failed\n"); + return -1; } start[0]=nplane; /* Choose the next plane to read */ if(H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0){ - fprintf(stderr, "H5Sselect_hyperslab failed\n"); - return -1; + HDfprintf(stderr, "H5Sselect_hyperslab failed\n"); + return -1; } /* Read the plane from the dataset */ if(H5Dread(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0){ - fprintf(stderr, "H5Dread failed\n"); - return -1; + HDfprintf(stderr, "H5Dread failed\n"); + return -1; } /* compare read data with expected data value which is nplane */ bufptr = buffer; nerrs=0; for (j=0; j<dims[1]; j++){ - for (k=0; k<dims[2]; k++){ - if ((hsize_t)*bufptr++ != nplane){ - if (++nerrs < ErrorReportMax){ - fprintf(stderr, - "found error %llu plane(%llu,%llu), expected %llu, got %d\n", - (unsigned long long)nplane, (unsigned long long)j, - (unsigned long long)k, (unsigned long long)nplane, (int)*(bufptr-1)); - } - } - } + for (k=0; k<dims[2]; k++){ + if ((hsize_t)*bufptr++ != nplane){ + if (++nerrs < ErrorReportMax){ + HDfprintf(stderr, + "found error %llu plane(%llu,%llu), expected %llu, got %d\n", + (unsigned long long)nplane, (unsigned long long)j, + (unsigned long long)k, (unsigned long long)nplane, (int)*(bufptr-1)); + } + } + } } if (nerrs){ - nreadererr++; - fprintf(stderr, "found %d unexpected values in plane %llu\n", nerrs, + nreadererr++; + HDfprintf(stderr, "found %d unexpected values in plane %llu\n", nerrs, (unsigned long long)nplane); } } @@ -620,19 +596,19 @@ int read_uc_file(hbool_t towait) #if 0 /* close dsid and file, then reopen them */ if (H5Dclose(dsid) < 0){ - fprintf(stderr, "H5Dclose failed\n"); + HDfprintf(stderr, "H5Dclose failed\n"); return -1; } if (H5Fclose(fid) < 0){ - fprintf(stderr, "H5Fclose failed\n"); + HDfprintf(stderr, "H5Fclose failed\n"); return -1; } if((fid = H5Fopen(name, H5F_ACC_RDONLY | (UC_opts.use_swmr ? H5F_ACC_SWMR_READ : 0), H5P_DEFAULT)) < 0){ - fprintf(stderr, "H5Fopen failed\n"); + HDfprintf(stderr, "H5Fopen failed\n"); return -1; } if((dsid = H5Dopen2(fid, progname_g, H5P_DEFAULT)) < 0){ - fprintf(stderr, "H5Dopen2 failed\n"); + HDfprintf(stderr, "H5Dopen2 failed\n"); return -1; } #else @@ -640,16 +616,22 @@ int read_uc_file(hbool_t towait) #endif f_sid = H5Dget_space(dsid); /* Get filespace handle first. */ if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0){ - fprintf(stderr, "H5Sget_simple_extent_dims got error\n"); + HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n"); return -1; } } + /* Close the file */ + if(H5Fclose(fid) < 0) { + HDfprintf(stderr, "H5Fclose failed\n"); + return -1; + } + if (nreadererr) - return -1; + return -1; else - return 0; -} + return 0; +} /* read_uc_file() */ #endif /* H5_HAVE_FORK */ diff --git a/test/vds_swmr_gen.c b/test/vds_swmr_gen.c index 24c6131..1cb9744 100644 --- a/test/vds_swmr_gen.c +++ b/test/vds_swmr_gen.c @@ -61,7 +61,7 @@ main(void) map_start = 0; /* All SWMR files need to use the latest file format */ - if((faplid = H5Pcreate(H5P_FILE_ACCESS)) < 0) + if((faplid = h5_fileaccess()) < 0) TEST_ERROR if(H5Pset_libver_bounds(faplid, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR diff --git a/test/vds_swmr_reader.c b/test/vds_swmr_reader.c index 42721d5..d0ec77b 100644 --- a/test/vds_swmr_reader.c +++ b/test/vds_swmr_reader.c @@ -18,6 +18,7 @@ int main(void) { hid_t fid = -1; /* HDF5 file ID */ + hid_t faplid = -1; /* file access property list ID */ hid_t did = -1; /* dataset ID */ hid_t msid = -1; /* memory dataspace ID */ hid_t fsid = -1; /* file dataspace ID */ @@ -34,7 +35,9 @@ main(void) /* Open the VDS file and dataset */ - if((fid = H5Fopen(VDS_FILE_NAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, H5P_DEFAULT)) < 0) + if((faplid = h5_fileaccess()) < 0) + TEST_ERROR + if((fid = H5Fopen(VDS_FILE_NAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, faplid)) < 0) TEST_ERROR if((did = H5Dopen2(fid, VDS_DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR @@ -97,13 +100,14 @@ main(void) TEST_ERROR if(H5Dread(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0) TEST_ERROR - if(H5Sclose(fsid) < 0) TEST_ERROR } while (dims[0] < N_PLANES_TO_WRITE); /* Close file and dataset */ + if(H5Pclose(faplid) < 0) + TEST_ERROR if(H5Sclose(msid) < 0) TEST_ERROR if(H5Dclose(did) < 0) @@ -121,6 +125,8 @@ error: H5E_BEGIN_TRY { if(fid >= 0) (void)H5Fclose(fid); + if(faplid >= 0) + (void)H5Pclose(faplid); if(did >= 0) (void)H5Dclose(did); if(msid >= 0) diff --git a/test/vds_swmr_writer.c b/test/vds_swmr_writer.c index 7824aa0..d62ecaf 100644 --- a/test/vds_swmr_writer.c +++ b/test/vds_swmr_writer.c @@ -56,7 +56,7 @@ main(int argc, char *argv[]) /* Open the source file and dataset */ /* All SWMR files need to use the latest file format */ - if((faplid = H5Pcreate(H5P_FILE_ACCESS)) < 0) + if((faplid = h5_fileaccess()) < 0) TEST_ERROR if(H5Pset_libver_bounds(faplid, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR @@ -149,7 +149,7 @@ test_sec2(void) /* There is no garantee the size of metadata in file is constant. * Just try to check if it's reasonable. - * + * * Currently it should be around 2 KB. */ if(H5Fget_filesize(fid, &file_size) < 0) @@ -258,7 +258,7 @@ test_core(void) | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE | H5FD_FEAT_AGGREGATE_SMALLDATA - | H5FD_FEAT_ALLOW_FILE_IMAGE + | H5FD_FEAT_ALLOW_FILE_IMAGE | H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS)) TEST_ERROR @@ -341,7 +341,7 @@ test_core(void) /* There is no garantee the size of metadata in file is constant. * Just try to check if it's reasonable. - * + * * TODO: Needs justification of why is this is a reasonable size. */ if(H5Fget_filesize(fid, &file_size) < 0) @@ -379,7 +379,7 @@ test_core(void) for(i = 0; i < CORE_DSET_DIM1; i++) for(j = 0; j < CORE_DSET_DIM2; j++) *pw++ = val++; - HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); + HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); /* Create the dataspace */ dims[0] = CORE_DSET_DIM1; @@ -469,7 +469,7 @@ test_core(void) TEST_ERROR; /* Read the data back from the dataset */ - HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); + HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0) TEST_ERROR; @@ -488,7 +488,7 @@ test_core(void) /* Check file size API. * There is no garantee the size of metadata in file is constant. * Just try to check if it's reasonable. - * + * * TODO: Needs justification of why is this is a reasonable size. */ if(H5Fget_filesize(fid, &file_size) < 0) @@ -1118,8 +1118,7 @@ error: * Purpose: Private function for test_multi() to tests wrong ways of * reopening multi file. * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Thursday, May 19, 2005 @@ -1129,7 +1128,7 @@ error: static herr_t test_multi_opens(char *fname) { - hid_t file=-1; + hid_t fid = H5I_INVALID_HID; char super_name[1024]; /*name string "%%s-s.h5"*/ char sf_name[1024]; /*name string "multi_file-s.h5"*/ @@ -1138,11 +1137,11 @@ test_multi_opens(char *fname) HDsnprintf(sf_name, sizeof(sf_name), super_name, fname); H5E_BEGIN_TRY { - file = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); } H5E_END_TRY; - return(file >= 0 ? -1 : 0); -} + return(fid >= 0 ? FAIL : SUCCEED); +} /* end test_multi_opens() */ /*------------------------------------------------------------------------- @@ -1150,8 +1149,7 @@ test_multi_opens(char *fname) * * Purpose: Tests the file handle interface for MUTLI driver * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 @@ -1330,7 +1328,7 @@ test_multi(void) if((atype = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR; - if(H5Tset_size(atype, strlen(meta) + 1) < 0) + if(H5Tset_size(atype, HDstrlen(meta) + 1) < 0) TEST_ERROR; if(H5Tset_strpad(atype, H5T_STR_NULLTERM) < 0) @@ -1365,7 +1363,7 @@ test_multi(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1374,9 +1372,10 @@ error: H5Pclose(fapl); H5Pclose(fapl2); H5Fclose(file); + H5Aclose(attr); } H5E_END_TRY; - return -1; -} + return FAIL; +} /* end test_multi() */ /*------------------------------------------------------------------------- @@ -1385,7 +1384,7 @@ error: * Purpose: Tests the backward compatibility for MULTI driver. * See if we can open files created with v1.6 library. * The source file was created by the test/file_handle.c - * of the v1.6 library. This test verifies the fix for + * of the v1.6 library. This test verifies the fix for * Issue 2598. In v1.6 library, there was EOA for the whole * MULTI file saved in the super block. We took it out in * v1.8 library because it's meaningless for the MULTI file. @@ -1446,7 +1445,7 @@ test_multi_compat(void) h5_fixname(FILENAME[9], fapl, newname, sizeof newname); - /* Make copy for the data file in the build directory, to protect the + /* Make copy for the data file in the build directory, to protect the * original file in the source directory */ sprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's'); sprintf(newname_s, "%s-%c.h5", FILENAME[9], 's'); @@ -1483,7 +1482,7 @@ test_multi_compat(void) if(H5Fclose(file) < 0) TEST_ERROR; - /* Reopen the file for adding another dataset. The new EOA for metadata file + /* Reopen the file for adding another dataset. The new EOA for metadata file * should be written to the file */ if((file=H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; @@ -1510,7 +1509,7 @@ test_multi_compat(void) if(H5Fclose(file) < 0) TEST_ERROR; - /* Reopen the file for read only again. Verify the library can handle + /* Reopen the file for read only again. Verify the library can handle * the EOA correctly */ if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; diff --git a/test/vol.c b/test/vol.c new file mode 100644 index 0000000..b70c0ca --- /dev/null +++ b/test/vol.c @@ -0,0 +1,1029 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Tests the virtual object layer (H5VL) + * + * This is a minimal test to ensure VOL usage (setting a VOL, etc.) + * works as expected. Actual VOL functionality is tested using + * other mechanisms. + */ + +#include "h5test.h" + + +#define NATIVE_VOL_TEST_FILENAME "native_vol_test" +#define NATIVE_VOL_TEST_GROUP_NAME "test_group" +#define NATIVE_VOL_TEST_DATASET_NAME "test_dataset" +#define NATIVE_VOL_TEST_ATTRIBUTE_NAME "test_dataset" +#define NATIVE_VOL_TEST_HARD_LINK_NAME "test_hard_link" +#define NATIVE_VOL_TEST_SOFT_LINK_NAME "test_soft_link" +#define NATIVE_VOL_TEST_MOVE_LINK_NAME "test_move_link" +#define NATIVE_VOL_TEST_COPY_LINK_NAME "test_copy_link" +#define NATIVE_VOL_TEST_DATATYPE_NAME "test_datatype" + +#define N_ELEMENTS 10 + +#define FAKE_VOL_NAME "fake" + +/* A VOL class struct that describes a VOL class with no + * functionality. + */ +static const H5VL_class_t fake_vol_g = { + 0, /* version */ + (H5VL_class_value_t)501, /* value */ + FAKE_VOL_NAME, /* name */ + 0, /* capability flags */ + NULL, /* initialize */ + NULL, /* terminate */ + (size_t)0, /* info size */ + NULL, /* info copy */ + NULL, /* info compare */ + NULL, /* info free */ + NULL, /* info to str */ + NULL, /* str to info */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* wrap_object */ + NULL, /* free_wrap_ctx */ + { /* attribute_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* dataset_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* datatype_cls */ + NULL, /* commit */ + NULL, /* open */ + NULL, /* get_size */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* file_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* group_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* link_cls */ + NULL, /* create */ + NULL, /* copy */ + NULL, /* move */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { /* object_cls */ + NULL, /* open */ + NULL, /* copy */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { /* request_cls */ + NULL, /* wait */ + NULL, /* notify */ + NULL, /* cancel */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* free */ + }, + NULL /* optional */ +}; + + +/*------------------------------------------------------------------------- + * Function: test_vol_registration() + * + * Purpose: Tests if we can load, register, and close a simple + * VOL connector. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_vol_registration(void) +{ + htri_t is_registered; + hid_t vol_id = -1, vol_id2 = -1; + + TESTING("VOL registration"); + + /* The test/fake VOL connector should not be registered at the start of the test */ + if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) + FAIL_STACK_ERROR; + if (is_registered > 0) + FAIL_PUTS_ERROR("native VOL connector is inappropriately registered"); + + /* Load a VOL interface */ + if ((vol_id = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; + + /* The test/fake VOL connector should be registered now */ + if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) + FAIL_STACK_ERROR; + if (0 == is_registered) + FAIL_PUTS_ERROR("native VOL connector is un-registered"); + + /* Re-register a VOL connector */ + if ((vol_id2 = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; + + /* The test/fake VOL connector should still be registered now */ + if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) + FAIL_STACK_ERROR; + if (0 == is_registered) + FAIL_PUTS_ERROR("native VOL connector is un-registered"); + + /* Unregister the second test/fake VOL ID */ + if (H5VLunregister_connector(vol_id2) < 0) + FAIL_STACK_ERROR; + + /* The test/fake VOL connector should still be registered now */ + if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) + FAIL_STACK_ERROR; + if (0 == is_registered) + FAIL_PUTS_ERROR("native VOL connector is un-registered"); + + /* Unregister the original test/fake VOL ID */ + if (H5VLunregister_connector(vol_id) < 0) + FAIL_STACK_ERROR; + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5VLunregister_connector(vol_id); + } H5E_END_TRY; + return FAIL; + +} /* end test_vol_registration() */ + + +/*------------------------------------------------------------------------- + * Function: test_native_vol_init() + * + * Purpose: Tests if the native VOL connector gets initialized. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_native_vol_init(void) +{ + htri_t is_registered; + + TESTING("Native VOL connector initialization"); + + /* The native VOL connector should always be registered */ + if ((is_registered = H5VLis_connector_registered(H5VL_NATIVE_NAME)) < 0) + FAIL_STACK_ERROR; + if (0 == is_registered) + FAIL_PUTS_ERROR("native VOL connector is un-registered"); + + PASSED(); + return SUCCEED; + +error: + return FAIL; + +} /* end test_native_vol_init() */ + + +/*------------------------------------------------------------------------- + * Function: test_basic_file_operation() + * + * Purpose: Uses the native VOL connector to test basic VOL file operations + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_basic_file_operation(void) +{ + hid_t fid = H5I_INVALID_HID; + hid_t fid_reopen = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + hid_t fapl_id2 = H5I_INVALID_HID; + hid_t fcpl_id = H5I_INVALID_HID; + + ssize_t obj_count; + hid_t obj_id_list[1]; + hsize_t file_size; + unsigned intent; + void *os_file_handle = NULL; + H5F_info2_t finfo; + char name[32]; + + TESTING("Basic VOL file operations"); + + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + + /* Set the file close degree to a non-default value, to make the H5Pequal + * work out. This is kinda odd, but the library's current behavior with + * a default value is to return the value chosen (H5F_CLOSE_SEMI) instead + * of the default value (H5F_CLOSE_DEFAULT) from the property and then + * the H5Pequal doesn't detect that the property lists are the same. Since + * this is the documented behavior for file close degree for many years, + * I'm not fighting it, just getting the testing to verify that the VOL + * connector property is returned correctly. -QAK, 2018/11/17 + */ + if(H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI) < 0) + TEST_ERROR; + if(H5Pset_metadata_read_attempts(fapl_id, 9) < 0) + FAIL_STACK_ERROR + + /* H5Fcreate */ + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + TEST_ERROR; + + /* H5Fget_obj_count */ + if ((obj_count = H5Fget_obj_count(fid, H5F_OBJ_FILE)) < 0) + TEST_ERROR; + if ((obj_count = H5Fget_obj_count(fid, H5F_OBJ_ALL)) < 0) + TEST_ERROR; + if ((obj_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_DATASET)) < 0) + TEST_ERROR; + + /* H5Fget_obj_ids */ + if ((obj_count = H5Fget_obj_ids(fid, H5F_OBJ_ALL, 2, obj_id_list)) < 0) + TEST_ERROR; + if ((obj_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_DATASET, 2, obj_id_list)) < 0) + TEST_ERROR; + + /* H5Fget_access_plist */ + if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) + TEST_ERROR; + if (H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if (H5Pclose(fapl_id2) < 0) + TEST_ERROR; + + /* H5Fget_create_plist */ + if ((fcpl_id = H5Fget_create_plist(fid)) < 0) + TEST_ERROR; + if (H5Pclose(fcpl_id) < 0) + TEST_ERROR; + + /* H5Fget_filesize */ + if (H5Fget_filesize(fid, &file_size) < 0) + TEST_ERROR; + + /* H5Fget_vfd_handle */ + if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0) + TEST_ERROR; + + /* H5Fget_intent */ + if (H5Fget_intent(fid, &intent) < 0) + TEST_ERROR; + + /* H5Fget_info2 */ + if (H5Fget_info2(fid, &finfo) < 0) + TEST_ERROR; + + /* H5Fget_name */ + if (H5Fget_name(fid, name, 32) < 0) + TEST_ERROR; + + /* H5Fclear_elink_file_cache */ + if (H5Fclear_elink_file_cache(fid) < 0) + TEST_ERROR; + + /* H5Fflush */ + if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) + TEST_ERROR; + + /* H5Fclose */ + if (H5Fclose(fid) < 0) + TEST_ERROR; + + /* H5Fis_accessible */ + if (H5Fis_accessible(NATIVE_VOL_TEST_FILENAME, fapl_id) < 0) + TEST_ERROR; + + /* H5Fopen */ + if ((fid = H5Fopen(NATIVE_VOL_TEST_FILENAME, H5F_ACC_RDWR, fapl_id)) < 0) + TEST_ERROR; + + /* H5Fget_access_plist */ + if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) + TEST_ERROR; + if (H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if (H5Pclose(fapl_id2) < 0) + TEST_ERROR; + + if ((fid_reopen = H5Freopen(fid)) < 0) + TEST_ERROR; + + /* H5Fget_access_plist */ + if ((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0) + TEST_ERROR; + if (H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if (H5Pclose(fapl_id2) < 0) + TEST_ERROR; + + if (H5Fclose(fid) < 0) + TEST_ERROR; + if (H5Fclose(fid_reopen) < 0) + TEST_ERROR; + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + + HDremove(NATIVE_VOL_TEST_FILENAME); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Fclose(fid_reopen); + H5Pclose(fapl_id); + H5Pclose(fapl_id2); + H5Pclose(fcpl_id); + } H5E_END_TRY; + + return FAIL; + +} /* end test_basic_file_operation() */ + + +/*------------------------------------------------------------------------- + * Function: test_basic_group_operation() + * + * Purpose: Uses the native VOL connector to test basic VOL group operations + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_basic_group_operation(void) +{ + hid_t fid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t gid_a = H5I_INVALID_HID; + hid_t gcpl_id = H5I_INVALID_HID; + H5G_info_t info; + + TESTING("Basic VOL group operations"); + + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Gcreate */ + if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Gget_create_plist */ + if ((gcpl_id = H5Gget_create_plist(gid)) < 0) + TEST_ERROR; + if (H5Pclose(gcpl_id) < 0) + TEST_ERROR; + + /* H5Gget_info */ + if (H5Gget_info(gid, &info) < 0) + TEST_ERROR; + if (H5Gget_info(fid, &info) < 0) + TEST_ERROR; + + /* H5Gget_info_by_name */ + if (H5Gget_info_by_name(fid, NATIVE_VOL_TEST_GROUP_NAME, &info, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Gget_info_by_idx */ + if (H5Gget_info_by_idx(fid, "/", H5_INDEX_NAME, H5_ITER_NATIVE, 0, &info, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Gflush */ + if (H5Gflush(gid) < 0) + TEST_ERROR; + + /* H5Gclose */ + if (H5Gclose(gid) < 0) + TEST_ERROR; + + /* H5Gopen */ + if ((gid = H5Gopen2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Gcreate_anon */ + if ((gid_a = H5Gcreate_anon(fid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Grefresh */ + if (H5Grefresh(gid) < 0) + TEST_ERROR; + + if (H5Gclose(gid) < 0) + TEST_ERROR; + if (H5Gclose(gid_a) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + + HDremove(NATIVE_VOL_TEST_FILENAME); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Gclose(gid); + H5Pclose(gcpl_id); + } H5E_END_TRY; + + return FAIL; + +} /* end test_basic_group_operation() */ + + +/*------------------------------------------------------------------------- + * Function: test_basic_dataset_operation() + * + * Purpose: Uses the native VOL connector to test basic VOL dataset operations + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_basic_dataset_operation(void) +{ + hid_t fid = H5I_INVALID_HID; + hid_t dcpl_id = H5I_INVALID_HID; + hid_t dapl_id = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t did_a = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + + hsize_t curr_dims = 0; + hsize_t max_dims = H5S_UNLIMITED; + + hsize_t storage_size; + haddr_t offset; + H5D_space_status_t status; + + int in_buf[N_ELEMENTS]; + int out_buf[N_ELEMENTS]; + + int i; + + TESTING("Basic VOL dataset operations"); + + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + for (i = 0; i < N_ELEMENTS; i++) { + in_buf[i] = i; + out_buf[i] = 0; + } + + /* H5Dcreate */ + curr_dims = 0; + if ((sid = H5Screate_simple(1, &curr_dims, &max_dims)) < 0) + TEST_ERROR; + curr_dims = N_ELEMENTS; + if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + if (H5Pset_chunk(dcpl_id, 1, &curr_dims) < 0) + TEST_ERROR; + if ((did = H5Dcreate2(fid, NATIVE_VOL_TEST_DATASET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Dcreate_anon */ + if ((did_a = H5Dcreate_anon(fid, H5T_NATIVE_INT, sid, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if (H5Sclose(sid) < 0) + TEST_ERROR; + if (H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /* H5Dset_extent */ + curr_dims = N_ELEMENTS; + if (H5Dset_extent(did, &curr_dims) < 0) + TEST_ERROR; + + /* H5Dflush */ + if (H5Dflush(did) < 0) + TEST_ERROR; + + /* H5Dwrite */ + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, in_buf) < 0) + TEST_ERROR; + + /* H5Drefresh */ + if (H5Drefresh(did) < 0) + TEST_ERROR; + + /* H5Dclose */ + if (H5Dclose(did) < 0) + TEST_ERROR; + if (H5Dclose(did_a) < 0) + TEST_ERROR; + + /* H5Dopen */ + if ((did = H5Dopen2(fid, NATIVE_VOL_TEST_DATASET_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Dget_space */ + if ((sid = H5Dget_space(did)) < 0) + TEST_ERROR; + if (H5Sclose(sid) < 0) + TEST_ERROR; + + /* H5Dget_space_status */ + if (H5Dget_space_status(did, &status) < 0) + TEST_ERROR; + + /* H5Dget_type */ + if ((tid = H5Dget_type(did)) < 0) + TEST_ERROR; + if (H5Tclose(tid) < 0) + TEST_ERROR; + + /* H5Tcopy (when used w/ a dataset, it gets an H5VL struct */ + if ((tid = H5Tcopy(did)) < 0) + TEST_ERROR; + if (H5Tclose(tid) < 0) + TEST_ERROR; + + /* H5Dget_create_plist */ + if ((dcpl_id = H5Dget_create_plist(did)) < 0) + TEST_ERROR; + if (H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /* H5Dget_access_plist */ + if ((dapl_id = H5Dget_access_plist(did)) < 0) + TEST_ERROR; + if (H5Pclose(dapl_id) < 0) + TEST_ERROR; + + /* H5Dget_storage_size */ + /* XXX: This is a terrible API call that can't truly indicate failure */ + if (0 == (storage_size = H5Dget_storage_size(did))) + TEST_ERROR; + + /* H5Dget_offset */ + /* XXX: Another bad API call that can't flag error values. Also, this + * returns HADDR_UNDEF for chunked datasets, which is bizarre. + */ + if (HADDR_UNDEF != (offset = H5Dget_offset(did))) + TEST_ERROR; + + /* H5Dread */ + if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, out_buf) < 0) + TEST_ERROR; + + for (i = 0; i < N_ELEMENTS; i++) + if (in_buf[i] != out_buf[i]) + TEST_ERROR; + + if (H5Dclose(did) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + + HDremove(NATIVE_VOL_TEST_FILENAME); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Dclose(did); + H5Dclose(did_a); + H5Sclose(sid); + H5Tclose(tid); + H5Pclose(dapl_id); + H5Pclose(dcpl_id); + } H5E_END_TRY; + + return FAIL; + +} /* end test_basic_dataset_operation() */ + + +/*------------------------------------------------------------------------- + * Function: test_basic_attribute_operation() + * + * Purpose: Uses the native VOL connector to test basic VOL attribute operations + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_basic_attribute_operation(void) +{ + hid_t fid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t aid = H5I_INVALID_HID; + hid_t aid_name = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + + hsize_t dims = 1; + + int data_in = 42; + int data_out = 0; + + TESTING("Basic VOL attribute operations"); + + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + dims = 1; + if ((sid = H5Screate_simple(1, &dims, &dims)) < 0) + TEST_ERROR; + + /* H5Acreate */ + if ((aid = H5Acreate2(fid, NATIVE_VOL_TEST_ATTRIBUTE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Awrite */ + if (H5Awrite(aid, H5T_NATIVE_INT, &data_in) < 0) + TEST_ERROR; + + /* H5Aread */ + if (H5Aread(aid, H5T_NATIVE_INT, &data_out) < 0) + TEST_ERROR; + if (data_in != data_out) + TEST_ERROR; + + /* H5Aclose */ + if (H5Aclose(aid) < 0) + TEST_ERROR; + + /* H5Aopen */ + if ((aid = H5Aopen(fid, NATIVE_VOL_TEST_ATTRIBUTE_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + if (H5Aclose(aid) < 0) + TEST_ERROR; + + /* H5Adelete */ + if (H5Adelete(fid, NATIVE_VOL_TEST_ATTRIBUTE_NAME) < 0) + TEST_ERROR; + + /* H5Acreate_by_name */ + if ((aid_name = H5Acreate_by_name(fid, NATIVE_VOL_TEST_GROUP_NAME, NATIVE_VOL_TEST_ATTRIBUTE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + /* H5Aclose */ + if (H5Aclose(aid_name) < 0) + TEST_ERROR; + + /* H5Adelete_by_name */ + if (H5Adelete_by_name(fid, NATIVE_VOL_TEST_GROUP_NAME, NATIVE_VOL_TEST_ATTRIBUTE_NAME, H5P_DEFAULT) < 0) + TEST_ERROR; + + if (H5Sclose(sid) < 0) + TEST_ERROR; + if (H5Gclose(gid) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + + HDremove(NATIVE_VOL_TEST_FILENAME); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Gclose(gid); + H5Sclose(sid); + H5Aclose(aid); + H5Aclose(aid_name); + } H5E_END_TRY; + + return FAIL; + +} /* end test_basic_attribute_operation() */ + + +/*------------------------------------------------------------------------- + * Function: test_basic_object_operation() + * + * Purpose: Uses the native VOL connector to test basic VOL object operations + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_basic_object_operation(void) +{ + hid_t fid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t oid = H5I_INVALID_HID; + + H5O_info_t object_info; + + TESTING("Basic VOL object operations"); + + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Oget_info */ + if (H5Oget_info2(fid, &object_info, H5O_INFO_ALL) < 0) + TEST_ERROR; + + /* H5Oget_info_by_name */ + if (H5Oget_info_by_name2(fid, NATIVE_VOL_TEST_GROUP_NAME, &object_info, H5O_INFO_ALL, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Oexists_by_name */ + if (H5Oexists_by_name(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT) != TRUE) + TEST_ERROR; + + /* H5Oopen/close */ + if ((oid = H5Oopen(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + if (H5Oclose(oid) < 0) + TEST_ERROR; + + if (H5Fclose(fid) < 0) + TEST_ERROR; + if (H5Gclose(gid) < 0) + TEST_ERROR; + + HDremove(NATIVE_VOL_TEST_FILENAME); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Gclose(gid); + } H5E_END_TRY; + + return FAIL; + +} /* end test_basic_object_operation() */ + + +/*------------------------------------------------------------------------- + * Function: test_basic_link_operation() + * + * Purpose: Uses the native VOL connector to test basic VOL link operations + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_basic_link_operation(void) +{ + hid_t fid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + + TESTING("Basic VOL link operations"); + + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Lcreate_hard */ + if (H5Lcreate_hard(fid, "/", gid, NATIVE_VOL_TEST_HARD_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Lcreate_soft (to itself) */ + if (H5Lcreate_soft("/", fid, NATIVE_VOL_TEST_SOFT_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Lexists */ + if (H5Lexists(gid, NATIVE_VOL_TEST_HARD_LINK_NAME, H5P_DEFAULT) < 0) + TEST_ERROR; + if (H5Lexists(fid, NATIVE_VOL_TEST_SOFT_LINK_NAME, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Lcopy */ + if (H5Lcopy(gid, NATIVE_VOL_TEST_HARD_LINK_NAME, fid, NATIVE_VOL_TEST_COPY_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Lmove */ + if (H5Lmove(fid, NATIVE_VOL_TEST_COPY_LINK_NAME, gid, NATIVE_VOL_TEST_MOVE_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR; + + if (H5Fclose(fid) < 0) + TEST_ERROR; + if (H5Gclose(gid) < 0) + TEST_ERROR; + + HDremove(NATIVE_VOL_TEST_FILENAME); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Fclose(gid); + } H5E_END_TRY; + + return FAIL; + +} /* end test_basic_link_operation() */ + + +/*------------------------------------------------------------------------- + * Function: test_basic_datatype_operation() + * + * Purpose: Uses the native VOL connector to test basic VOL datatype operations + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_basic_datatype_operation(void) +{ + hid_t fid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t tid_anon = H5I_INVALID_HID; + hid_t tcpl_id = H5I_INVALID_HID; + + TESTING("Basic VOL datatype operations"); + + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) + TEST_ERROR; + + /* H5Tcommit */ + if (H5Tcommit2(fid, NATIVE_VOL_TEST_DATATYPE_NAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Tflush */ + if (H5Tflush(tid) < 0) + TEST_ERROR; + + /* H5Trefresh */ + if (H5Trefresh(tid) < 0) + TEST_ERROR; + + /* H5Tclose */ + if (H5Tclose(tid) < 0) + TEST_ERROR; + + /* H5Topen */ + if ((tid = H5Topen2(fid, NATIVE_VOL_TEST_DATATYPE_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Tget_create_plist */ + if ((tcpl_id = H5Tget_create_plist(tid)) < 0) + TEST_ERROR; + + /* H5Tcommit_anon */ + if ((tid_anon = H5Tcopy(H5T_NATIVE_INT)) < 0) + TEST_ERROR; + if (H5Tcommit_anon(fid, tid_anon, H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR; + + if (H5Pclose(tcpl_id) < 0) + TEST_ERROR; + if (H5Tclose(tid) < 0) + TEST_ERROR; + if (H5Tclose(tid_anon) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + + HDremove(NATIVE_VOL_TEST_FILENAME); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(tcpl_id); + H5Fclose(fid); + H5Tclose(tid); + H5Tclose(tid_anon); + } H5E_END_TRY; + + return FAIL; + +} /* end test_basic_datatype_operation() */ + +#if 0 + +/*------------------------------------------------------------------------- + * Function: test_echo_vol_operation() + * + * Purpose: Uses the echo VOL connector to test basic VOL operations + * via the H5VL public API. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_echo_vol_operation(void) +{ + char name[25]; + + TESTING("Echo VOL operations"); + + PASSED(); + return SUCCEED; + +error: + return FAIL; + +} /* end test_basic_vol_operation() */ +#endif + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Tests the virtual object layer interface (H5VL) + * + * Return: EXIT_SUCCESS/EXIT_FAILURE + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + int nerrors = 0; + + h5_reset(); + + HDputs("Testing basic Virtual Object Layer (VOL) functionality."); + + nerrors += test_vol_registration() < 0 ? 1 : 0; + nerrors += test_native_vol_init() < 0 ? 1 : 0; + nerrors += test_basic_file_operation() < 0 ? 1 : 0; + nerrors += test_basic_group_operation() < 0 ? 1 : 0; + nerrors += test_basic_dataset_operation() < 0 ? 1 : 0; + nerrors += test_basic_attribute_operation() < 0 ? 1 : 0; + nerrors += test_basic_object_operation() < 0 ? 1 : 0; + nerrors += test_basic_link_operation() < 0 ? 1 : 0; + nerrors += test_basic_datatype_operation() < 0 ? 1 : 0; + + if (nerrors) { + HDprintf("***** %d Virtual Object Layer TEST%s FAILED! *****\n", + nerrors, nerrors > 1 ? "S" : ""); + HDexit(EXIT_FAILURE); + } + + HDputs("All Virtual Object Layer (VOL) tests passed."); + + HDexit(EXIT_SUCCESS); + +} /* end main() */ + diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index c08a69e..0b3cbe3 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -17,6 +17,7 @@ set (testphdf5_SOURCES ${HDF5_TEST_PAR_SOURCE_DIR}/t_chunk_alloc.c ${HDF5_TEST_PAR_SOURCE_DIR}/t_filter_read.c ${HDF5_TEST_PAR_SOURCE_DIR}/t_prop.c + ${HDF5_TEST_PAR_SOURCE_DIR}/t_coll_md_read.c ) #-- Adding test for testhdf5 diff --git a/testpar/Makefile.am b/testpar/Makefile.am index 5c7cb26..7262ca6 100644 --- a/testpar/Makefile.am +++ b/testpar/Makefile.am @@ -29,7 +29,7 @@ check_PROGRAMS = $(TEST_PROG_PARA) testphdf5_SOURCES=testphdf5.c t_dset.c t_file.c t_file_image.c t_mdset.c \ t_ph5basic.c t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c \ - t_prop.c + t_prop.c t_coll_md_read.c # The tests all depend on the hdf5 library and the test library LDADD = $(LIBH5TEST) $(LIBHDF5) diff --git a/testpar/t_cache.c b/testpar/t_cache.c index caa578e..da83884 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -1217,20 +1217,20 @@ setup_derived_types(void) struct mssg_t sample; /* used to compute displacements */ /* setup the displacements array */ - if ( ( MPI_SUCCESS != MPI_Address(&sample.req, &displs[0]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.src, &displs[1]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.dest, &displs[2]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.mssg_num, &displs[3]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.base_addr, &displs[4]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.len, &displs[5]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.ver, &displs[6]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.count, &displs[7]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.magic, &displs[8]) ) ) { + if ( ( MPI_SUCCESS != MPI_Get_address(&sample.req, &displs[0]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.src, &displs[1]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.dest, &displs[2]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.mssg_num, &displs[3]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.base_addr, &displs[4]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.len, &displs[5]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.ver, &displs[6]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.count, &displs[7]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.magic, &displs[8]) ) ) { nerrors++; success = FALSE; if ( verbose ) { - HDfprintf(stdout, "%d:%s: MPI_Address() call failed.\n", + HDfprintf(stdout, "%d:%s: MPI_Get_address() call failed.\n", world_mpi_rank, FUNC); } @@ -1245,14 +1245,14 @@ setup_derived_types(void) if ( success ) { - result = MPI_Type_struct(9, block_len, displs, mpi_types, &mpi_mssg_t); + result = MPI_Type_create_struct(9, block_len, displs, mpi_types, &mpi_mssg_t); if ( result != MPI_SUCCESS ) { nerrors++; success = FALSE; if ( verbose ) { - HDfprintf(stdout, "%d:%s: MPI_Type_struct() call failed.\n", + HDfprintf(stdout, "%d:%s: MPI_Type_create_struct() call failed.\n", world_mpi_rank, FUNC); } } @@ -4091,7 +4091,7 @@ setup_cache_for_test(hid_t * fid_ptr, world_mpi_rank, FUNC); } } else { - file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE); + file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE); } if ( file_ptr == NULL ) { @@ -7134,7 +7134,7 @@ trace_file_check(int metadata_write_strategy) if ( HDfgets(buffer, 255, trace_file_ptr) != NULL ) { - actual_line_len = strlen(buffer); + actual_line_len = HDstrlen(buffer); } else { diff --git a/testpar/t_cache_image.c b/testpar/t_cache_image.c index 5b512d6..e158d69 100644 --- a/testpar/t_cache_image.c +++ b/testpar/t_cache_image.c @@ -1187,7 +1187,7 @@ open_hdf5_file(const hbool_t create_file, } else { - file_ptr = (struct H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { diff --git a/testpar/t_coll_md_read.c b/testpar/t_coll_md_read.c new file mode 100644 index 0000000..f945d2b --- /dev/null +++ b/testpar/t_coll_md_read.c @@ -0,0 +1,199 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * A test suite to test HDF5's collective metadata read capabilities, as enabled + * by making a call to H5Pset_all_coll_metadata_ops(). + */ + +#include "testphdf5.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +/* + * Define the non-participating process as the "last" + * rank to avoid any weirdness potentially caused by + * an if (mpi_rank == 0) check. + */ +#define PARTIAL_NO_SELECTION_NO_SEL_PROCESS (mpi_rank == mpi_size - 1) +#define PARTIAL_NO_SELECTION_DATASET_NAME "partial_no_selection_dset" +#define PARTIAL_NO_SELECTION_DATASET_NDIMS 2 +#define PARTIAL_NO_SELECTION_Y_DIM_SCALE 5 +#define PARTIAL_NO_SELECTION_X_DIM_SCALE 5 + +/* + * A test for issue HDFFV-10501. A parallel hang was reported which occurred + * in linked-chunk I/O when collective metadata reads are enabled and some ranks + * do not have any selection in a dataset's dataspace, while others do. The ranks + * which have no selection during the read/write operation called H5D__chunk_addrmap() + * to retrieve the lowest chunk address, since we require that the read/write be done + * in strictly non-decreasing order of chunk address. For version 1 and 2 B-trees, + * this caused the non-participating ranks to issue a collective MPI_Bcast() call + * which the other ranks did not issue, thus causing a hang. + * + * However, since these ranks are not actually reading/writing anything, this call + * can simply be removed and the address used for the read/write can be set to an + * arbitrary number (0 was chosen). + */ +void test_partial_no_selection_coll_md_read(void) +{ + const char *filename; + hsize_t *dataset_dims = NULL; + hsize_t max_dataset_dims[PARTIAL_NO_SELECTION_DATASET_NDIMS]; + hsize_t sel_dims[1]; + hsize_t chunk_dims[PARTIAL_NO_SELECTION_DATASET_NDIMS] = { PARTIAL_NO_SELECTION_Y_DIM_SCALE, PARTIAL_NO_SELECTION_X_DIM_SCALE }; + hsize_t start[PARTIAL_NO_SELECTION_DATASET_NDIMS]; + hsize_t stride[PARTIAL_NO_SELECTION_DATASET_NDIMS]; + hsize_t count[PARTIAL_NO_SELECTION_DATASET_NDIMS]; + hsize_t block[PARTIAL_NO_SELECTION_DATASET_NDIMS]; + hid_t file_id = -1; + hid_t fapl_id = -1; + hid_t dset_id = -1; + hid_t dcpl_id = -1; + hid_t dxpl_id = -1; + hid_t fspace_id = -1; + hid_t mspace_id = -1; + int mpi_rank, mpi_size; + void *data = NULL; + void *read_buf = NULL; + + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + + filename = GetTestParameters(); + + fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); + VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); + + /* + * Even though the testphdf5 framework currently sets collective metadata reads + * on the FAPL, we call it here just to be sure this is futureproof, since + * demonstrating this issue relies upon it. + */ + VRFY((H5Pset_all_coll_metadata_ops(fapl_id, true) >= 0), "Set collective metadata reads succeeded"); + + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + VRFY((file_id >= 0), "H5Fcreate succeeded"); + + dataset_dims = malloc(PARTIAL_NO_SELECTION_DATASET_NDIMS * sizeof(*dataset_dims)); + VRFY((dataset_dims != NULL), "malloc succeeded"); + + dataset_dims[0] = PARTIAL_NO_SELECTION_Y_DIM_SCALE * mpi_size; + dataset_dims[1] = PARTIAL_NO_SELECTION_X_DIM_SCALE * mpi_size; + max_dataset_dims[0] = H5S_UNLIMITED; + max_dataset_dims[1] = H5S_UNLIMITED; + + fspace_id = H5Screate_simple(PARTIAL_NO_SELECTION_DATASET_NDIMS, dataset_dims, max_dataset_dims); + VRFY((fspace_id >= 0), "H5Screate_simple succeeded"); + + /* + * Set up chunking on the dataset in order to reproduce the problem. + */ + dcpl_id = H5Pcreate(H5P_DATASET_CREATE); + VRFY((dcpl_id >= 0), "H5Pcreate succeeded"); + + VRFY((H5Pset_chunk(dcpl_id, PARTIAL_NO_SELECTION_DATASET_NDIMS, chunk_dims) >= 0), "H5Pset_chunk succeeded"); + + dset_id = H5Dcreate2(file_id, PARTIAL_NO_SELECTION_DATASET_NAME, H5T_NATIVE_INT, fspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); + VRFY((dset_id >= 0), "H5Dcreate2 succeeded"); + + /* + * Setup hyperslab selection to split the dataset among the ranks. + * + * The ranks will write rows across the dataset. + */ + start[0] = PARTIAL_NO_SELECTION_Y_DIM_SCALE * mpi_rank; + start[1] = 0; + stride[0] = PARTIAL_NO_SELECTION_Y_DIM_SCALE; + stride[1] = PARTIAL_NO_SELECTION_X_DIM_SCALE; + count[0] = 1; + count[1] = mpi_size; + block[0] = PARTIAL_NO_SELECTION_Y_DIM_SCALE; + block[1] = PARTIAL_NO_SELECTION_X_DIM_SCALE; + + VRFY((H5Sselect_hyperslab(fspace_id, H5S_SELECT_SET, start, stride, count, block) >= 0), "H5Sselect_hyperslab succeeded"); + + sel_dims[0] = count[1] * (PARTIAL_NO_SELECTION_Y_DIM_SCALE * PARTIAL_NO_SELECTION_X_DIM_SCALE); + + mspace_id = H5Screate_simple(1, sel_dims, NULL); + VRFY((mspace_id >= 0), "H5Screate_simple succeeded"); + + data = calloc(1, count[1] * (PARTIAL_NO_SELECTION_Y_DIM_SCALE * PARTIAL_NO_SELECTION_X_DIM_SCALE) * sizeof(int)); + VRFY((data != NULL), "calloc succeeded"); + + dxpl_id = H5Pcreate(H5P_DATASET_XFER); + VRFY((dxpl_id >= 0), "H5Pcreate succeeded"); + + /* + * Enable collective access for the data transfer. + */ + VRFY((H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) >= 0), "H5Pset_dxpl_mpio succeeded"); + + VRFY((H5Dwrite(dset_id, H5T_NATIVE_INT, mspace_id, fspace_id, dxpl_id, data) >= 0), "H5Dwrite succeeded"); + + VRFY((H5Fflush(file_id, H5F_SCOPE_GLOBAL) >= 0), "H5Fflush succeeded"); + + /* + * Ensure that linked-chunk I/O is performed since this is + * the particular code path where the issue lies and we don't + * want the library doing multi-chunk I/O behind our backs. + */ + VRFY((H5Pset_dxpl_mpio_chunk_opt(dxpl_id, H5FD_MPIO_CHUNK_ONE_IO) >= 0), "H5Pset_dxpl_mpio_chunk_opt succeeded"); + + read_buf = malloc(count[1] * (PARTIAL_NO_SELECTION_Y_DIM_SCALE * PARTIAL_NO_SELECTION_X_DIM_SCALE) * sizeof(int)); + VRFY((read_buf != NULL), "malloc succeeded"); + + /* + * Make sure to call H5Sselect_none() on the non-participating process. + */ + if (PARTIAL_NO_SELECTION_NO_SEL_PROCESS) { + VRFY((H5Sselect_none(fspace_id) >= 0), "H5Sselect_none succeeded"); + VRFY((H5Sselect_none(mspace_id) >= 0), "H5Sselect_none succeeded"); + } + + /* + * Finally have each rank read their section of data back from the dataset. + */ + VRFY((H5Dread(dset_id, H5T_NATIVE_INT, mspace_id, fspace_id, dxpl_id, read_buf) >= 0), "H5Dread succeeded"); + + /* + * Check data integrity just to be sure. + */ + if (!PARTIAL_NO_SELECTION_NO_SEL_PROCESS) { + VRFY((!memcmp(data, read_buf, count[1] * (PARTIAL_NO_SELECTION_Y_DIM_SCALE * PARTIAL_NO_SELECTION_X_DIM_SCALE) * sizeof(int))), "memcmp succeeded"); + } + + if (dataset_dims) { + free(dataset_dims); + dataset_dims = NULL; + } + + if (data) { + free(data); + data = NULL; + } + + if (read_buf) { + free(read_buf); + read_buf = NULL; + } + + VRFY((H5Sclose(fspace_id) >= 0), "H5Sclose succeeded"); + VRFY((H5Sclose(mspace_id) >= 0), "H5Sclose succeeded"); + VRFY((H5Pclose(dcpl_id) >= 0), "H5Pclose succeeded"); + VRFY((H5Pclose(dxpl_id) >= 0), "H5Pclose succeeded"); + VRFY((H5Dclose(dset_id) >= 0), "H5Dclose succeeded"); + VRFY((H5Pclose(fapl_id) >= 0), "H5Pclose succeeded"); + VRFY((H5Fclose(file_id) >= 0), "H5Fclose succeeded"); +} diff --git a/testpar/t_dset.c b/testpar/t_dset.c index b315772..281d027 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -36,83 +36,91 @@ * Setup the dimensions of the hyperslab. * Two modes--by rows or by columns. * Assume dimension rank is 2. - * BYROW divide into slabs of rows - * BYCOL divide into blocks of columns - * ZROW same as BYROW except process 0 gets 0 rows - * ZCOL same as BYCOL except process 0 gets 0 columns + * BYROW divide into slabs of rows + * BYCOL divide into blocks of columns + * ZROW same as BYROW except process 0 gets 0 rows + * ZCOL same as BYCOL except process 0 gets 0 columns */ static void slab_set(int mpi_rank, int mpi_size, hsize_t start[], hsize_t count[], - hsize_t stride[], hsize_t block[], int mode) + hsize_t stride[], hsize_t block[], int mode) { - switch (mode){ + switch (mode) { case BYROW: - /* Each process takes a slabs of rows. */ - block[0] = dim0/mpi_size; - block[1] = dim1; - stride[0] = block[0]; - stride[1] = block[1]; - count[0] = 1; - count[1] = 1; - start[0] = mpi_rank*block[0]; - start[1] = 0; -if(VERBOSE_MED) printf("slab_set BYROW\n"); - break; + /* Each process takes a slabs of rows. */ + block[0] = dim0 / mpi_size; + block[1] = dim1; + stride[0] = block[0]; + stride[1] = block[1]; + count[0] = 1; + count[1] = 1; + start[0] = mpi_rank * block[0]; + start[1] = 0; + if (VERBOSE_MED) + HDprintf("slab_set BYROW\n"); + break; case BYCOL: - /* Each process takes a block of columns. */ - block[0] = dim0; - block[1] = dim1/mpi_size; - stride[0] = block[0]; - stride[1] = block[1]; - count[0] = 1; - count[1] = 1; - start[0] = 0; - start[1] = mpi_rank*block[1]; -if(VERBOSE_MED) printf("slab_set BYCOL\n"); - break; + /* Each process takes a block of columns. */ + block[0] = dim0; + block[1] = dim1 / mpi_size; + stride[0] = block[0]; + stride[1] = block[1]; + count[0] = 1; + count[1] = 1; + start[0] = 0; + start[1] = mpi_rank * block[1]; + if (VERBOSE_MED) + HDprintf("slab_set BYCOL\n"); + break; case ZROW: - /* Similar to BYROW except process 0 gets 0 row */ - block[0] = (mpi_rank ? dim0/mpi_size : 0); - block[1] = dim1; - stride[0] = (mpi_rank ? block[0] : 1); /* avoid setting stride to 0 */ - stride[1] = block[1]; - count[0] = 1; - count[1] = 1; - start[0] = (mpi_rank? mpi_rank*block[0] : 0); - start[1] = 0; -if(VERBOSE_MED) printf("slab_set ZROW\n"); - break; + /* Similar to BYROW except process 0 gets 0 row */ + block[0] = (mpi_rank ? dim0 / mpi_size : 0); + block[1] = dim1; + stride[0] = (mpi_rank ? block[0] : 1); /* avoid setting stride to 0 */ + stride[1] = block[1]; + count[0] = 1; + count[1] = 1; + start[0] = (mpi_rank ? mpi_rank * block[0] : 0); + start[1] = 0; + if (VERBOSE_MED) + HDprintf("slab_set ZROW\n"); + break; case ZCOL: - /* Similar to BYCOL except process 0 gets 0 column */ - block[0] = dim0; - block[1] = (mpi_rank ? dim1/mpi_size : 0); - stride[0] = block[0]; - stride[1] = (mpi_rank ? block[1] : 1); /* avoid setting stride to 0 */ - count[0] = 1; - count[1] = 1; - start[0] = 0; - start[1] = (mpi_rank? mpi_rank*block[1] : 0); -if(VERBOSE_MED) printf("slab_set ZCOL\n"); - break; + /* Similar to BYCOL except process 0 gets 0 column */ + block[0] = dim0; + block[1] = (mpi_rank ? dim1 / mpi_size : 0); + stride[0] = block[0]; + stride[1] = (mpi_rank ? block[1] : 1); /* avoid setting stride to 0 */ + count[0] = 1; + count[1] = 1; + start[0] = 0; + start[1] = (mpi_rank ? mpi_rank * block[1] : 0); + if (VERBOSE_MED) + HDprintf("slab_set ZCOL\n"); + break; default: - /* Unknown mode. Set it to cover the whole dataset. */ - printf("unknown slab_set mode (%d)\n", mode); - block[0] = dim0; - block[1] = dim1; - stride[0] = block[0]; - stride[1] = block[1]; - count[0] = 1; - count[1] = 1; - start[0] = 0; - start[1] = 0; -if(VERBOSE_MED) printf("slab_set wholeset\n"); - break; + /* Unknown mode. Set it to cover the whole dataset. */ + HDprintf("unknown slab_set mode (%d)\n", mode); + block[0] = dim0; + block[1] = dim1; + stride[0] = block[0]; + stride[1] = block[1]; + count[0] = 1; + count[1] = 1; + start[0] = 0; + start[1] = 0; + if (VERBOSE_MED) + HDprintf("slab_set wholeset\n"); + break; } -if(VERBOSE_MED){ - printf("start[]=(%lu,%lu), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total datapoints=%lu\n", - (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], - (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1], - (unsigned long)(block[0]*block[1]*count[0]*count[1])); + if (VERBOSE_MED) { + HDprintf( + "start[]=(%lu,%lu), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total datapoints=%lu\n", + (unsigned long) start[0], (unsigned long) start[1], + (unsigned long) count[0], (unsigned long) count[1], + (unsigned long) stride[0], (unsigned long) stride[1], + (unsigned long) block[0], (unsigned long) block[1], + (unsigned long) (block[0] * block[1] * count[0] * count[1])); } } @@ -123,7 +131,7 @@ void point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], - size_t num_points, + size_t num_points, hsize_t coords[], int order) { @@ -153,13 +161,13 @@ void point_set(hsize_t start[], } if(VERBOSE_MED) { - printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total datapoints=%lu\n", + HDprintf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total datapoints=%lu\n", (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1], (unsigned long)(block[0] * block[1] * count[0] * count[1])); k = 0; for(i = 0; i < num_points ; i++) { - printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); + HDprintf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); k += 2; } } @@ -177,10 +185,10 @@ dataset_fill(hsize_t start[], hsize_t block[], DATATYPE * dataset) /* put some trivial data in the data_array */ for (i=0; i < block[0]; i++){ - for (j=0; j < block[1]; j++){ - *dataptr = (DATATYPE)((i+start[0])*100 + (j+start[1]+1)); - dataptr++; - } + for (j=0; j < block[1]; j++){ + *dataptr = (DATATYPE)((i+start[0])*100 + (j+start[1]+1)); + dataptr++; + } } } @@ -195,19 +203,19 @@ dataset_print(hsize_t start[], hsize_t block[], DATATYPE * dataset) hsize_t i, j; /* print the column heading */ - printf("%-8s", "Cols:"); + HDprintf("%-8s", "Cols:"); for (j=0; j < block[1]; j++){ - printf("%3lu ", (unsigned long)(start[1]+j)); + HDprintf("%3lu ", (unsigned long)(start[1]+j)); } - printf("\n"); + HDprintf("\n"); /* print the slab data */ for (i=0; i < block[0]; i++){ - printf("Row %2lu: ", (unsigned long)(i+start[0])); - for (j=0; j < block[1]; j++){ - printf("%03d ", *dataptr++); - } - printf("\n"); + HDprintf("Row %2lu: ", (unsigned long)(i+start[0])); + for (j=0; j < block[1]; j++){ + HDprintf("%03d ", *dataptr++); + } + HDprintf("\n"); } } @@ -223,35 +231,35 @@ dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[] /* print it if VERBOSE_MED */ if(VERBOSE_MED) { - printf("dataset_vrfy dumping:::\n"); - printf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n", - (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], - (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1]); - printf("original values:\n"); - dataset_print(start, block, original); - printf("compared values:\n"); - dataset_print(start, block, dataset); + HDprintf("dataset_vrfy dumping:::\n"); + HDprintf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], + (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1]); + HDprintf("original values:\n"); + dataset_print(start, block, original); + HDprintf("compared values:\n"); + dataset_print(start, block, dataset); } vrfyerrs = 0; for (i=0; i < block[0]; i++){ - for (j=0; j < block[1]; j++){ - if(*dataset != *original){ - if(vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED){ - printf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %d, got %d\n", - (unsigned long)i, (unsigned long)j, - (unsigned long)(i+start[0]), (unsigned long)(j+start[1]), - *(original), *(dataset)); - } - dataset++; - original++; - } - } + for (j=0; j < block[1]; j++){ + if(*dataset != *original){ + if(vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED){ + HDprintf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %d, got %d\n", + (unsigned long)i, (unsigned long)j, + (unsigned long)(i+start[0]), (unsigned long)(j+start[1]), + *(original), *(dataset)); + } + dataset++; + original++; + } + } } if(vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED) - printf("[more errors ...]\n"); + HDprintf("[more errors ...]\n"); if(vrfyerrs) - printf("%d errors found in dataset_vrfy\n", vrfyerrs); + HDprintf("%d errors found in dataset_vrfy\n", vrfyerrs); return(vrfyerrs); } @@ -272,20 +280,20 @@ void dataset_writeInd(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t sid; /* Dataspace ID */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ - hsize_t dims[RANK]; /* dataset dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ + hid_t acc_tpl; /* File access templates */ + hid_t sid; /* Dataspace ID */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ + hid_t dataset1, dataset2; /* Dataset ID */ + hsize_t dims[RANK]; /* dataset dim sizes */ + DATATYPE *data_array1 = NULL; /* data buffer */ const char *filename; - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -293,7 +301,7 @@ dataset_writeInd(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Independent write test on file %s\n", filename); + HDprintf("Independent write test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -332,12 +340,12 @@ dataset_writeInd(void) /* create a dataset collectively */ dataset1 = H5Dcreate2(fid, DATASETNAME1, H5T_NATIVE_INT, sid, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dataset1 >= 0), "H5Dcreate2 succeeded"); /* create another dataset collectively */ dataset2 = H5Dcreate2(fid, DATASETNAME2, H5T_NATIVE_INT, sid, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dataset2 >= 0), "H5Dcreate2 succeeded"); @@ -366,28 +374,28 @@ dataset_writeInd(void) /* write data independently */ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 succeeded"); /* write data independently */ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dwrite dataset2 succeeded"); /* setup dimensions again to write with zero rows for process 0 */ if(VERBOSE_MED) - printf("writeInd by some with zero row\n"); + HDprintf("writeInd by some with zero row\n"); slab_set(mpi_rank, mpi_size, start, count, stride, block, ZROW); ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* need to make mem_dataspace to match for process 0 */ if(MAINPROCESS){ - ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); + ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); } MESG("writeInd by some with zero row"); if((mpi_rank/2)*2 != mpi_rank){ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 by ZROW succeeded"); } #ifdef BARRIER_CHECKS @@ -418,19 +426,19 @@ void dataset_readInd(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ - DATATYPE *data_array1 = NULL; /* data buffer */ - DATATYPE *data_origin1 = NULL; /* expected data buffer */ + hid_t acc_tpl; /* File access templates */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ + hid_t dataset1, dataset2; /* Dataset ID */ + DATATYPE *data_array1 = NULL; /* data buffer */ + DATATYPE *data_origin1 = NULL; /* expected data buffer */ const char *filename; - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -438,7 +446,7 @@ dataset_readInd(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Independent read test on file %s\n", filename); + HDprintf("Independent read test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -489,7 +497,7 @@ dataset_readInd(void) /* read data independently */ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), ""); /* verify the read data with original expected data */ @@ -498,7 +506,7 @@ dataset_readInd(void) /* read data independently */ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), ""); /* verify the read data with original expected data */ @@ -540,28 +548,28 @@ void dataset_writeAll(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t sid; /* Dataspace ID */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ + hid_t acc_tpl; /* File access templates */ + hid_t xfer_plist; /* Dataset transfer properties list */ + hid_t sid; /* Dataspace ID */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ hid_t dataset1, dataset2, dataset3, dataset4; /* Dataset ID */ hid_t dataset5, dataset6, dataset7; /* Dataset ID */ - hid_t datatype; /* Datatype ID */ - hsize_t dims[RANK]; /* dataset dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ + hid_t datatype; /* Datatype ID */ + hsize_t dims[RANK]; /* dataset dim sizes */ + DATATYPE *data_array1 = NULL; /* data buffer */ const char *filename; - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ size_t num_points; /* for point selection */ hsize_t *coords = NULL; /* for point selection */ hsize_t current_dims; /* for point selection */ int i; - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -569,7 +577,7 @@ dataset_writeAll(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Collective write test on file %s\n", filename); + HDprintf("Collective write test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -669,8 +677,8 @@ dataset_writeAll(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* set up the collective transfer properties list */ @@ -687,23 +695,23 @@ dataset_writeAll(void) /* write data collectively */ MESG("writeAll by Row"); ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 succeeded"); /* setup dimensions again to writeAll with zero rows for process 0 */ if(VERBOSE_MED) - printf("writeAll by some with zero row\n"); + HDprintf("writeAll by some with zero row\n"); slab_set(mpi_rank, mpi_size, start, count, stride, block, ZROW); ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* need to make mem_dataspace to match for process 0 */ if(MAINPROCESS){ - ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); + ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); } MESG("writeAll by some with zero row"); ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 by ZROW succeeded"); /* release all temporary handles. */ @@ -720,8 +728,8 @@ dataset_writeAll(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* create a file dataspace independently */ @@ -738,8 +746,8 @@ dataset_writeAll(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* set up the collective transfer properties list */ @@ -755,23 +763,23 @@ dataset_writeAll(void) /* write data independently */ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset2 succeeded"); /* setup dimensions again to writeAll with zero columns for process 0 */ if(VERBOSE_MED) - printf("writeAll by some with zero col\n"); + HDprintf("writeAll by some with zero col\n"); slab_set(mpi_rank, mpi_size, start, count, stride, block, ZCOL); ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* need to make mem_dataspace to match for process 0 */ if(MAINPROCESS){ - ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); + ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); } MESG("writeAll by some with zero col"); ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 by ZCOL succeeded"); /* release all temporary handles. */ @@ -789,8 +797,8 @@ dataset_writeAll(void) file_dataspace = H5Dget_space (dataset3); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); if(MAINPROCESS) { - ret = H5Sselect_none(file_dataspace); - VRFY((ret >= 0), "H5Sselect_none file_dataspace succeeded"); + ret = H5Sselect_none(file_dataspace); + VRFY((ret >= 0), "H5Sselect_none file_dataspace succeeded"); } /* end if */ else { ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); @@ -801,16 +809,16 @@ dataset_writeAll(void) mem_dataspace = H5Screate_simple (RANK, block, NULL); VRFY((mem_dataspace >= 0), ""); if(MAINPROCESS) { - ret = H5Sselect_none(mem_dataspace); - VRFY((ret >= 0), "H5Sselect_none mem_dataspace succeeded"); + ret = H5Sselect_none(mem_dataspace); + VRFY((ret >= 0), "H5Sselect_none mem_dataspace succeeded"); } /* end if */ /* fill the local slab with some trivial data */ dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* end if */ /* set up the collective transfer properties list */ @@ -827,13 +835,13 @@ dataset_writeAll(void) /* write data collectively */ MESG("writeAll with none"); ret = H5Dwrite(dataset3, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset3 succeeded"); /* write data collectively (with datatype conversion) */ MESG("writeAll with none"); ret = H5Dwrite(dataset3, H5T_NATIVE_UCHAR, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset3 succeeded"); /* release all temporary handles. */ @@ -850,8 +858,8 @@ dataset_writeAll(void) file_dataspace = H5Dget_space (dataset4); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); if(MAINPROCESS) { - ret = H5Sselect_none(file_dataspace); - VRFY((ret >= 0), "H5Sselect_all file_dataspace succeeded"); + ret = H5Sselect_none(file_dataspace); + VRFY((ret >= 0), "H5Sselect_all file_dataspace succeeded"); } /* end if */ else { ret = H5Sselect_all(file_dataspace); @@ -862,8 +870,8 @@ dataset_writeAll(void) mem_dataspace = H5Screate(H5S_SCALAR); VRFY((mem_dataspace >= 0), ""); if(MAINPROCESS) { - ret = H5Sselect_none(mem_dataspace); - VRFY((ret >= 0), "H5Sselect_all mem_dataspace succeeded"); + ret = H5Sselect_none(mem_dataspace); + VRFY((ret >= 0), "H5Sselect_all mem_dataspace succeeded"); } /* end if */ else { ret = H5Sselect_all(mem_dataspace); @@ -874,8 +882,8 @@ dataset_writeAll(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* end if */ /* set up the collective transfer properties list */ @@ -891,13 +899,13 @@ dataset_writeAll(void) /* write data collectively */ MESG("writeAll with scalar dataspace"); ret = H5Dwrite(dataset4, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset4 succeeded"); /* write data collectively (with datatype conversion) */ MESG("writeAll with scalar dataspace"); ret = H5Dwrite(dataset4, H5T_NATIVE_UCHAR, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset4 succeeded"); /* release all temporary handles. */ @@ -907,7 +915,7 @@ dataset_writeAll(void) if(data_array1) free(data_array1); - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); block[0] = 1; @@ -922,15 +930,15 @@ dataset_writeAll(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* Dataset5: point selection in File - Hyperslab selection in Memory*/ /* create a file dataspace independently */ point_set (start, count, stride, block, num_points, coords, OUT_OF_ORDER); file_dataspace = H5Dget_space (dataset5); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); + VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); VRFY((ret >= 0), "H5Sselect_elements succeeded"); @@ -1005,7 +1013,7 @@ dataset_writeAll(void) start[1] = 0; point_set (start, count, stride, block, num_points, coords, IN_ORDER); file_dataspace = H5Dget_space (dataset7); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); + VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); VRFY((ret >= 0), "H5Sselect_elements succeeded"); @@ -1075,25 +1083,25 @@ void dataset_readAll(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ + hid_t acc_tpl; /* File access templates */ + hid_t xfer_plist; /* Dataset transfer properties list */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ hid_t dataset1, dataset2, dataset5, dataset6, dataset7; /* Dataset ID */ - DATATYPE *data_array1 = NULL; /* data buffer */ - DATATYPE *data_origin1 = NULL; /* expected data buffer */ + DATATYPE *data_array1 = NULL; /* data buffer */ + DATATYPE *data_origin1 = NULL; /* expected data buffer */ const char *filename; - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ size_t num_points; /* for point selection */ hsize_t *coords = NULL; /* for point selection */ hsize_t current_dims; /* for point selection */ int i,j,k; - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -1101,7 +1109,7 @@ dataset_readAll(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Collective read test on file %s\n", filename); + HDprintf("Collective read test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -1174,8 +1182,8 @@ dataset_readAll(void) dataset_fill(start, block, data_origin1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_origin1); + MESG("data_array created"); + dataset_print(start, block, data_origin1); } /* set up the collective transfer properties list */ @@ -1191,7 +1199,7 @@ dataset_readAll(void) /* read data collectively */ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread dataset1 succeeded"); /* verify the read data with original expected data */ @@ -1200,18 +1208,18 @@ dataset_readAll(void) /* setup dimensions again to readAll with zero columns for process 0 */ if(VERBOSE_MED) - printf("readAll by some with zero col\n"); + HDprintf("readAll by some with zero col\n"); slab_set(mpi_rank, mpi_size, start, count, stride, block, ZCOL); ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* need to make mem_dataspace to match for process 0 */ if(MAINPROCESS){ - ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); + ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); } MESG("readAll by some with zero col"); ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread dataset1 by ZCOL succeeded"); /* verify the read data with original expected data */ @@ -1242,8 +1250,8 @@ dataset_readAll(void) dataset_fill(start, block, data_origin1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_origin1); + MESG("data_array created"); + dataset_print(start, block, data_origin1); } /* set up the collective transfer properties list */ @@ -1259,7 +1267,7 @@ dataset_readAll(void) /* read data collectively */ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread dataset2 succeeded"); /* verify the read data with original expected data */ @@ -1268,18 +1276,18 @@ dataset_readAll(void) /* setup dimensions again to readAll with zero rows for process 0 */ if(VERBOSE_MED) - printf("readAll by some with zero row\n"); + HDprintf("readAll by some with zero row\n"); slab_set(mpi_rank, mpi_size, start, count, stride, block, ZROW); ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* need to make mem_dataspace to match for process 0 */ if(MAINPROCESS){ - ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); + ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); } MESG("readAll by some with zero row"); ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread dataset1 by ZROW succeeded"); /* verify the read data with original expected data */ @@ -1293,9 +1301,9 @@ dataset_readAll(void) if(data_array1) free(data_array1); if(data_origin1) free(data_origin1); - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_origin1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); + data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); block[0] = 1; @@ -1310,8 +1318,8 @@ dataset_readAll(void) dataset_fill(start, block, data_origin1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_origin1); + MESG("data_array created"); + dataset_print(start, block, data_origin1); } /* Dataset5: point selection in memory - Hyperslab selection in file*/ @@ -1344,7 +1352,7 @@ dataset_readAll(void) xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread dataset5 succeeded"); - + ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1); if(ret) nerrors++; @@ -1355,7 +1363,7 @@ dataset_readAll(void) if(data_array1) free(data_array1); - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* Dataset6: point selection in File - Point selection in Memory*/ @@ -1400,7 +1408,7 @@ dataset_readAll(void) H5Pclose(xfer_plist); if(data_array1) free(data_array1); - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* Dataset7: point selection in memory - All selection in file*/ @@ -1488,25 +1496,25 @@ void extend_writeInd(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t sid; /* Dataspace ID */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ + hid_t acc_tpl; /* File access templates */ + hid_t sid; /* Dataspace ID */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ + hid_t dataset1, dataset2; /* Dataset ID */ const char *filename; - hsize_t dims[RANK]; /* dataset dim sizes */ + hsize_t dims[RANK]; /* dataset dim sizes */ hsize_t max_dims[RANK] = - {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - hsize_t chunk_dims[RANK]; /* chunk sizes */ - hid_t dataset_pl; /* dataset create prop. list */ + {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ + DATATYPE *data_array1 = NULL; /* data buffer */ + hsize_t chunk_dims[RANK]; /* chunk sizes */ + hid_t dataset_pl; /* dataset create prop. list */ - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK]; /* for hyperslab setting */ - hsize_t stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK]; /* for hyperslab setting */ + hsize_t stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -1514,7 +1522,7 @@ extend_writeInd(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Extend independent write test on file %s\n", filename); + HDprintf("Extend independent write test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -1567,7 +1575,7 @@ extend_writeInd(void) /* set up dataset storage chunk sizes and creation property list */ if(VERBOSE_MED) - printf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]); + HDprintf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]); dataset_pl = H5Pcreate(H5P_DATASET_CREATE); VRFY((dataset_pl >= 0), "H5Pcreate succeeded"); ret = H5Pset_chunk(dataset_pl, RANK, chunk_dims); @@ -1603,8 +1611,8 @@ extend_writeInd(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* create a memory dataspace independently */ @@ -1625,7 +1633,7 @@ extend_writeInd(void) /* write data independently */ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dwrite succeeded"); /* release resource */ @@ -1643,8 +1651,8 @@ extend_writeInd(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* create a memory dataspace independently */ @@ -1664,7 +1672,7 @@ extend_writeInd(void) /* write data independently. Should fail. */ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret < 0), "H5Dwrite failed as expected"); /* restore auto error reporting */ @@ -1685,7 +1693,7 @@ extend_writeInd(void) /* write data independently */ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dwrite succeeded"); /* release resource */ @@ -1719,25 +1727,25 @@ extend_writeInd2(void) { const char *filename; hid_t fid; /* HDF5 file ID */ - hid_t fapl; /* File access templates */ - hid_t fs; /* File dataspace ID */ - hid_t ms; /* Memory dataspace ID */ - hid_t dataset; /* Dataset ID */ - hsize_t orig_size=10; /* Original dataset dim size */ - hsize_t new_size=20; /* Extended dataset dim size */ + hid_t fapl; /* File access templates */ + hid_t fs; /* File dataspace ID */ + hid_t ms; /* Memory dataspace ID */ + hid_t dataset; /* Dataset ID */ + hsize_t orig_size=10; /* Original dataset dim size */ + hsize_t new_size=20; /* Extended dataset dim size */ hsize_t one=1; - hsize_t max_size = H5S_UNLIMITED; /* dataset maximum dim size */ - hsize_t chunk_size = 16384; /* chunk size */ - hid_t dcpl; /* dataset create prop. list */ + hsize_t max_size = H5S_UNLIMITED; /* dataset maximum dim size */ + hsize_t chunk_size = 16384; /* chunk size */ + hid_t dcpl; /* dataset create prop. list */ int written[10], /* Data to write */ retrieved[10]; /* Data read in */ int mpi_size, mpi_rank; /* MPI settings */ int i; /* Local index variable */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ filename = GetTestParameters(); if(VERBOSE_MED) - printf("Extend independent write test #2 on file %s\n", filename); + HDprintf("Extend independent write test #2 on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -1794,10 +1802,10 @@ extend_writeInd2(void) written[i] = i; MESG("data array initialized"); if(VERBOSE_MED) { - MESG("writing at offset zero: "); + MESG("writing at offset zero: "); for(i = 0; i < (int)orig_size; i++) - printf("%s%d", i?", ":"", written[i]); - printf("\n"); + HDprintf("%s%d", i?", ":"", written[i]); + HDprintf("\n"); } ret = H5Dwrite(dataset, H5T_NATIVE_INT, ms, fs, H5P_DEFAULT, written); VRFY((ret >= 0), "H5Dwrite succeeded"); @@ -1809,15 +1817,15 @@ extend_writeInd2(void) VRFY((ret >= 0), "H5Dread succeeded"); for (i=0; i<(int)orig_size; i++) if(written[i]!=retrieved[i]) { - printf("Line #%d: written!=retrieved: written[%d]=%d, retrieved[%d]=%d\n",__LINE__, + HDprintf("Line #%d: written!=retrieved: written[%d]=%d, retrieved[%d]=%d\n",__LINE__, i,written[i], i,retrieved[i]); nerrors++; } if(VERBOSE_MED){ - MESG("read at offset zero: "); + MESG("read at offset zero: "); for (i=0; i<(int)orig_size; i++) - printf("%s%d", i?", ":"", retrieved[i]); - printf("\n"); + HDprintf("%s%d", i?", ":"", retrieved[i]); + HDprintf("\n"); } /* ------------------------- @@ -1837,10 +1845,10 @@ extend_writeInd2(void) written[i] = orig_size + i; MESG("data array re-initialized"); if(VERBOSE_MED) { - MESG("writing at offset 10: "); + MESG("writing at offset 10: "); for (i=0; i<(int)orig_size; i++) - printf("%s%d", i?", ":"", written[i]); - printf("\n"); + HDprintf("%s%d", i?", ":"", written[i]); + HDprintf("\n"); } ret = H5Sselect_hyperslab(fs, H5S_SELECT_SET, &orig_size, NULL, &one, &orig_size); VRFY((ret >= 0), "H5Sselect_hyperslab succeeded"); @@ -1854,15 +1862,15 @@ extend_writeInd2(void) VRFY((ret >= 0), "H5Dread succeeded"); for (i=0; i<(int)orig_size; i++) if(written[i]!=retrieved[i]) { - printf("Line #%d: written!=retrieved: written[%d]=%d, retrieved[%d]=%d\n",__LINE__, + HDprintf("Line #%d: written!=retrieved: written[%d]=%d, retrieved[%d]=%d\n",__LINE__, i,written[i], i,retrieved[i]); nerrors++; } if(VERBOSE_MED){ - MESG("read at offset 10: "); + MESG("read at offset 10: "); for (i=0; i<(int)orig_size; i++) - printf("%s%d", i?", ":"", retrieved[i]); - printf("\n"); + HDprintf("%s%d", i?", ":"", retrieved[i]); + HDprintf("\n"); } @@ -1879,22 +1887,22 @@ extend_writeInd2(void) void extend_readInd(void) { - hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ - hsize_t dims[RANK]; /* dataset dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - DATATYPE *data_array2 = NULL; /* data buffer */ - DATATYPE *data_origin1 = NULL; /* expected data buffer */ + hid_t fid; /* HDF5 file ID */ + hid_t acc_tpl; /* File access templates */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ + hid_t dataset1, dataset2; /* Dataset ID */ + hsize_t dims[RANK]; /* dataset dim sizes */ + DATATYPE *data_array1 = NULL; /* data buffer */ + DATATYPE *data_array2 = NULL; /* data buffer */ + DATATYPE *data_origin1 = NULL; /* expected data buffer */ const char *filename; - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -1902,7 +1910,7 @@ extend_readInd(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Extend independent read test on file %s\n", filename); + HDprintf("Extend independent read test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -1974,13 +1982,13 @@ extend_readInd(void) /* fill dataset with test data */ dataset_fill(start, block, data_origin1); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* read data independently */ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dread succeeded"); /* verify the read data with original expected data */ @@ -2009,13 +2017,13 @@ extend_readInd(void) /* fill dataset with test data */ dataset_fill(start, block, data_origin1); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* read data independently */ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dread succeeded"); /* verify the read data with original expected data */ @@ -2058,26 +2066,26 @@ void extend_writeAll(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t sid; /* Dataspace ID */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ + hid_t acc_tpl; /* File access templates */ + hid_t xfer_plist; /* Dataset transfer properties list */ + hid_t sid; /* Dataspace ID */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ + hid_t dataset1, dataset2; /* Dataset ID */ const char *filename; - hsize_t dims[RANK]; /* dataset dim sizes */ + hsize_t dims[RANK]; /* dataset dim sizes */ hsize_t max_dims[RANK] = - {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - hsize_t chunk_dims[RANK]; /* chunk sizes */ - hid_t dataset_pl; /* dataset create prop. list */ + {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ + DATATYPE *data_array1 = NULL; /* data buffer */ + hsize_t chunk_dims[RANK]; /* chunk sizes */ + hid_t dataset_pl; /* dataset create prop. list */ - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK]; /* for hyperslab setting */ - hsize_t stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK]; /* for hyperslab setting */ + hsize_t stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -2085,7 +2093,7 @@ extend_writeAll(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Extend independent write test on file %s\n", filename); + HDprintf("Extend independent write test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -2138,7 +2146,7 @@ extend_writeAll(void) /* set up dataset storage chunk sizes and creation property list */ if(VERBOSE_MED) - printf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]); + HDprintf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]); dataset_pl = H5Pcreate(H5P_DATASET_CREATE); VRFY((dataset_pl >= 0), "H5Pcreate succeeded"); ret = H5Pset_chunk(dataset_pl, RANK, chunk_dims); @@ -2174,8 +2182,8 @@ extend_writeAll(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* create a memory dataspace independently */ @@ -2207,7 +2215,7 @@ extend_writeAll(void) /* write data collectively */ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite succeeded"); /* release resource */ @@ -2226,8 +2234,8 @@ extend_writeAll(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* create a memory dataspace independently */ @@ -2258,7 +2266,7 @@ extend_writeAll(void) /* write data independently. Should fail. */ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret < 0), "H5Dwrite failed as expected"); /* restore auto error reporting */ @@ -2279,7 +2287,7 @@ extend_writeAll(void) /* write data independently */ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite succeeded"); /* release resource */ @@ -2308,23 +2316,23 @@ extend_writeAll(void) void extend_readAll(void) { - hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ + hid_t fid; /* HDF5 file ID */ + hid_t acc_tpl; /* File access templates */ + hid_t xfer_plist; /* Dataset transfer properties list */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ + hid_t dataset1, dataset2; /* Dataset ID */ const char *filename; - hsize_t dims[RANK]; /* dataset dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - DATATYPE *data_array2 = NULL; /* data buffer */ - DATATYPE *data_origin1 = NULL; /* expected data buffer */ + hsize_t dims[RANK]; /* dataset dim sizes */ + DATATYPE *data_array1 = NULL; /* data buffer */ + DATATYPE *data_array2 = NULL; /* data buffer */ + DATATYPE *data_origin1 = NULL; /* expected data buffer */ - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -2332,7 +2340,7 @@ extend_readAll(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Extend independent read test on file %s\n", filename); + HDprintf("Extend independent read test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -2404,8 +2412,8 @@ extend_readAll(void) /* fill dataset with test data */ dataset_fill(start, block, data_origin1); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* set up the collective transfer properties list */ @@ -2421,7 +2429,7 @@ extend_readAll(void) /* read data collectively */ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread succeeded"); /* verify the read data with original expected data */ @@ -2451,8 +2459,8 @@ extend_readAll(void) /* fill dataset with test data */ dataset_fill(start, block, data_origin1); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* set up the collective transfer properties list */ @@ -2468,7 +2476,7 @@ extend_readAll(void) /* read data collectively */ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread succeeded"); /* verify the read data with original expected data */ @@ -2505,27 +2513,27 @@ void compress_readAll(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ + hid_t acc_tpl; /* File access templates */ hid_t dcpl; /* Dataset creation property list */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t dataspace; /* Dataspace ID */ - hid_t dataset; /* Dataset ID */ + hid_t xfer_plist; /* Dataset transfer properties list */ + hid_t dataspace; /* Dataspace ID */ + hid_t dataset; /* Dataset ID */ int rank=1; /* Dataspace rank */ hsize_t dim=dim0; /* Dataspace dimensions */ unsigned u; /* Local index variable */ unsigned chunk_opts; /* Chunk options */ unsigned disable_partial_chunk_filters; /* Whether filters are disabled on partial chunks */ - DATATYPE *data_read = NULL; /* data buffer */ + DATATYPE *data_read = NULL; /* data buffer */ DATATYPE *data_orig = NULL; /* expected data buffer */ const char *filename; MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; int mpi_size, mpi_rank; - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ filename = GetTestParameters(); if(VERBOSE_MED) - printf("Collective chunked dataset read test on file %s\n", filename); + HDprintf("Collective chunked dataset read test on file %s\n", filename); /* Retrieve MPI parameters */ MPI_Comm_size(comm,&mpi_size); @@ -2646,7 +2654,7 @@ compress_readAll(void) /* Verify data read */ for(u=0; u<dim; u++) if(data_orig[u]!=data_read[u]) { - printf("Line #%d: written!=retrieved: data_orig[%u]=%d, data_read[%u]=%d\n",__LINE__, + HDprintf("Line #%d: written!=retrieved: data_orig[%u]=%d, data_read[%u]=%d\n",__LINE__, (unsigned)u,data_orig[u],(unsigned)u,data_read[u]); nerrors++; } @@ -2687,26 +2695,26 @@ void none_selection_chunk(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t sid; /* Dataspace ID */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ + hid_t acc_tpl; /* File access templates */ + hid_t xfer_plist; /* Dataset transfer properties list */ + hid_t sid; /* Dataspace ID */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ + hid_t dataset1, dataset2; /* Dataset ID */ const char *filename; - hsize_t dims[RANK]; /* dataset dim sizes */ - DATATYPE *data_origin = NULL; /* data buffer */ - DATATYPE *data_array = NULL; /* data buffer */ - hsize_t chunk_dims[RANK]; /* chunk sizes */ - hid_t dataset_pl; /* dataset create prop. list */ - - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK]; /* for hyperslab setting */ - hsize_t stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ - hsize_t mstart[RANK]; /* for data buffer in memory */ - - herr_t ret; /* Generic return value */ + hsize_t dims[RANK]; /* dataset dim sizes */ + DATATYPE *data_origin = NULL; /* data buffer */ + DATATYPE *data_array = NULL; /* data buffer */ + hsize_t chunk_dims[RANK]; /* chunk sizes */ + hid_t dataset_pl; /* dataset create prop. list */ + + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK]; /* for hyperslab setting */ + hsize_t stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t mstart[RANK]; /* for data buffer in memory */ + + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -2714,7 +2722,7 @@ none_selection_chunk(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Extend independent write test on file %s\n", filename); + HDprintf("Extend independent write test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -2745,7 +2753,7 @@ none_selection_chunk(void) /* set up dataset storage chunk sizes and creation property list */ if(VERBOSE_MED) - printf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]); + HDprintf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]); dataset_pl = H5Pcreate(H5P_DATASET_CREATE); VRFY((dataset_pl >= 0), "H5Pcreate succeeded"); ret = H5Pset_chunk(dataset_pl, RANK, chunk_dims); @@ -2789,8 +2797,8 @@ none_selection_chunk(void) dataset_fill(mstart, block, data_origin); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(mstart, block, data_origin); + MESG("data_array created"); + dataset_print(mstart, block, data_origin); } } @@ -2824,12 +2832,12 @@ none_selection_chunk(void) /* write data collectively */ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_origin); + xfer_plist, data_origin); VRFY((ret >= 0), "H5Dwrite succeeded"); /* read data independently */ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array); + H5P_DEFAULT, data_array); VRFY((ret >= 0), ""); /* verify the read data with original expected data */ @@ -2846,12 +2854,12 @@ none_selection_chunk(void) /* write data collectively */ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_origin); + xfer_plist, data_origin); VRFY((ret >= 0), "H5Dwrite succeeded"); /* read data independently */ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array); + H5P_DEFAULT, data_array); VRFY((ret >= 0), ""); /* verify the read data with original expected data */ @@ -2883,20 +2891,20 @@ none_selection_chunk(void) if(data_array) HDfree(data_array); } - + /* Function: test_actual_io_mode * - * Purpose: tests one specific case of collective I/O and checks that the + * Purpose: tests one specific case of collective I/O and checks that the * actual_chunk_opt_mode property and the actual_io_mode * properties in the DXPL have the correct values. * * Input: selection_mode: changes the way processes select data from the space, as well * as some dxpl flags to get collective I/O to break in different ways. - * + * * The relevant I/O function and expected response for each mode: * TEST_ACTUAL_IO_MULTI_CHUNK_IND: * H5D_mpi_chunk_collective_io, each process reports independent I/O - * + * * TEST_ACTUAL_IO_MULTI_CHUNK_COL: * H5D_mpi_chunk_collective_io, each process reports collective I/O * @@ -2908,7 +2916,7 @@ none_selection_chunk(void) * collective, the rest report independent I/O * * TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND: - * Same test TEST_ACTUAL_IO_MULTI_CHUNK_IND. + * Same test TEST_ACTUAL_IO_MULTI_CHUNK_IND. * Set directly go to multi-chunk-io without num threshold calc. * TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL: * Same test TEST_ACTUAL_IO_MULTI_CHUNK_COL. @@ -2933,20 +2941,20 @@ none_selection_chunk(void) * * Note: DIRECT_MULTI_CHUNK_MIX and DIRECT_MULTI_CHUNK_MIX_DISAGREE * is not needed as they are covered by DIRECT_CHUNK_MIX and - * MULTI_CHUNK_MIX_DISAGREE cases. _DIRECT_ cases are only for testing + * MULTI_CHUNK_MIX_DISAGREE cases. _DIRECT_ cases are only for testing * path way to multi-chunk-io by H5FD_MPIO_CHUNK_MULTI_IO insted of num-threshold. * * Modification: - * - Refctore to remove multi-chunk-without-opimization test and update for - * testing direct to multi-chunk-io + * - Refctore to remove multi-chunk-without-opimization test and update for + * testing direct to multi-chunk-io * Programmer: Jonathan Kim * Date: 2012-10-10 * - * + * * Programmer: Jacob Gruber * Date: 2011-04-06 */ -static void +static void test_actual_io_mode(int selection_mode) { H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_write = -1; H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_read = -1; @@ -2960,7 +2968,7 @@ test_actual_io_mode(int selection_mode) { hbool_t multi_chunk_io; hbool_t is_chunked; hbool_t is_collective; - int mpi_size = -1; + int mpi_size = -1; int mpi_rank = -1; int length; int * buffer; @@ -2985,12 +2993,12 @@ test_actual_io_mode(int selection_mode) { hsize_t block[RANK]; char message[256]; herr_t ret; - + /* Set up some flags to make some future if statements slightly more readable */ direct_multi_chunk_io = ( selection_mode == TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND || selection_mode == TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL ); - + /* Note: RESET performs the same tests as MULTI_CHUNK_MIX_DISAGREE and then * tests independent I/O */ @@ -3000,11 +3008,11 @@ test_actual_io_mode(int selection_mode) { selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_MIX || selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE || selection_mode == TEST_ACTUAL_IO_RESET ); - + is_chunked = ( selection_mode != TEST_ACTUAL_IO_CONTIGUOUS && selection_mode != TEST_ACTUAL_IO_NO_COLLECTIVE); - + is_collective = selection_mode != TEST_ACTUAL_IO_NO_COLLECTIVE; /* Set up MPI parameters */ @@ -3012,7 +3020,7 @@ test_actual_io_mode(int selection_mode) { MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Barrier(MPI_COMM_WORLD); - + HDassert(mpi_size >= 1); mpi_comm = MPI_COMM_WORLD; @@ -3029,7 +3037,7 @@ test_actual_io_mode(int selection_mode) { fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); VRFY((fid >= 0), "H5Fcreate succeeded"); - /* Create the basic Space */ + /* Create the basic Space */ dims[0] = dim0; dims[1] = dim1; sid = H5Screate_simple (RANK, dims, NULL); @@ -3057,10 +3065,10 @@ test_actual_io_mode(int selection_mode) { file_space = H5Dget_space(dataset); VRFY((file_space >= 0), "H5Dget_space succeeded"); - /* Choose a selection method based on the type of I/O we want to occur, + /* Choose a selection method based on the type of I/O we want to occur, * and also set up some selection-dependeent test info. */ switch(selection_mode) { - + /* Independent I/O with optimization */ case TEST_ACTUAL_IO_MULTI_CHUNK_IND: case TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND: @@ -3069,7 +3077,7 @@ test_actual_io_mode(int selection_mode) { * independent. */ slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - + test_name = "Multi Chunk - Independent"; actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT; @@ -3083,7 +3091,7 @@ test_actual_io_mode(int selection_mode) { * selections to each chunk, the operation is purely collective. */ slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - + test_name = "Multi Chunk - Collective"; actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; if(mpi_size > 1) @@ -3091,7 +3099,7 @@ test_actual_io_mode(int selection_mode) { else actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT; break; - + /* Mixed I/O with optimization */ case TEST_ACTUAL_IO_MULTI_CHUNK_MIX: /* A chunk will be assigned collective I/O only if it is selected by each @@ -3102,7 +3110,7 @@ test_actual_io_mode(int selection_mode) { * assigned independent I/O. Each process will access one chunk collectively * and at least one chunk independently, reporting mixed I/O. */ - + if(mpi_rank == 0) { /* Select the first column */ slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); @@ -3117,7 +3125,7 @@ test_actual_io_mode(int selection_mode) { start[0] = 0; start[1] = mpi_rank*block[1]; } - + test_name = "Multi Chunk - Mixed"; actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; actual_io_mode_expected = H5D_MPIO_CHUNK_MIXED; @@ -3127,7 +3135,7 @@ test_actual_io_mode(int selection_mode) { * performed. To acheive this, we have RESET perform collective I/O (which would change * the values from the defaults) followed by independent I/O (which should report the * default values). RESET doesn't need to have a unique selection, so we reuse - * MULTI_CHUMK_MIX_DISAGREE, which was chosen because it is a complex case that works + * MULTI_CHUMK_MIX_DISAGREE, which was chosen because it is a complex case that works * on all builds. The independent section of RESET can be found at the end of this function. */ case TEST_ACTUAL_IO_RESET: @@ -3136,7 +3144,7 @@ test_actual_io_mode(int selection_mode) { case TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE: /* A chunk will be assigned collective I/O only if it is selected by each * process. To get mixed I/O with disagreement, assign process n to the - * first chunk and the nth chunk. The first chunk, selected by all, is + * first chunk and the nth chunk. The first chunk, selected by all, is * assgigned collective I/O, while each other process gets independent I/O. * Since the root process with only access the first chunk, it will report * collective I/O. The subsequent processes will access the first chunk @@ -3158,13 +3166,13 @@ test_actual_io_mode(int selection_mode) { start[0] = 0; start[1] = mpi_rank*block[1]; } - + /* If the testname was not already set by the RESET case */ if (selection_mode == TEST_ACTUAL_IO_RESET) test_name = "RESET"; else test_name = "Multi Chunk - Mixed (Disagreement)"; - + actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; if(mpi_size > 1) { if(mpi_rank == 0) @@ -3174,14 +3182,14 @@ test_actual_io_mode(int selection_mode) { } else actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT; - - break; + + break; /* Linked Chunk I/O */ - case TEST_ACTUAL_IO_LINK_CHUNK: + case TEST_ACTUAL_IO_LINK_CHUNK: /* Nothing special; link chunk I/O is forced in the dxpl settings. */ slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - + test_name = "Link Chunk"; actual_chunk_opt_mode_expected = H5D_MPIO_LINK_CHUNK; actual_io_mode_expected = H5D_MPIO_CHUNK_COLLECTIVE; @@ -3192,7 +3200,7 @@ test_actual_io_mode(int selection_mode) { /* A non overlapping, regular selection in a contiguous dataset leads to * collective I/O */ slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - + test_name = "Contiguous"; actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; actual_io_mode_expected = H5D_MPIO_CONTIGUOUS_COLLECTIVE; @@ -3200,7 +3208,7 @@ test_actual_io_mode(int selection_mode) { case TEST_ACTUAL_IO_NO_COLLECTIVE: slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - + test_name = "Independent"; actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; actual_io_mode_expected = H5D_MPIO_NO_COLLECTIVE; @@ -3215,13 +3223,13 @@ test_actual_io_mode(int selection_mode) { ret = H5Sselect_hyperslab(file_space, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - + /* Create a memory dataspace mirroring the dataset and select the same hyperslab - * as in the file space. + * as in the file space. */ mem_space = H5Screate_simple (RANK, dims, NULL); VRFY((mem_space >= 0), "mem_space created"); - + ret = H5Sselect_hyperslab(mem_space, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); @@ -3230,22 +3238,22 @@ test_actual_io_mode(int selection_mode) { /* Allocate and initialize the buffer */ buffer = (int *)HDmalloc(sizeof(int) * length); - VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); - for(i = 0; i < length; i++) + VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); + for(i = 0; i < length; i++) buffer[i] = i; /* Set up the dxpl for the write */ dxpl_write = H5Pcreate(H5P_DATASET_XFER); VRFY((dxpl_write >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded"); - + /* Set collective I/O properties in the dxpl. */ if(is_collective) { /* Request collective I/O */ ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_COLLECTIVE); VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - - /* Set the threshold number of processes per chunk to twice mpi_size. - * This will prevent the threshold from ever being met, thus forcing + + /* Set the threshold number of processes per chunk to twice mpi_size. + * This will prevent the threshold from ever being met, thus forcing * multi chunk io instead of link chunk io. * This is via deault. */ @@ -3283,12 +3291,12 @@ test_actual_io_mode(int selection_mode) { ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_write, &actual_chunk_opt_mode_write); VRFY((ret >= 0), "retriving actual chunk opt mode succeeded" ); - + /* Read */ ret = H5Dread(dataset, data_type, mem_space, file_space, dxpl_read, buffer); if(ret < 0) H5Eprint2(H5E_DEFAULT, stdout); VRFY((ret >= 0), "H5Dread() dataset multichunk read succeeded"); - + /* Retreive Actual io values */ ret = H5Pget_mpio_actual_io_mode(dxpl_read, &actual_io_mode_read); VRFY((ret >= 0), "retriving actual io mode succeeded" ); @@ -3304,9 +3312,9 @@ test_actual_io_mode(int selection_mode) { /* Test values */ if(actual_chunk_opt_mode_expected != (H5D_mpio_actual_chunk_opt_mode_t) -1 && actual_io_mode_expected != (H5D_mpio_actual_io_mode_t) -1) { - sprintf(message, "Actual Chunk Opt Mode has the correct value for %s.\n",test_name); + HDsprintf(message, "Actual Chunk Opt Mode has the correct value for %s.\n",test_name); VRFY((actual_chunk_opt_mode_write == actual_chunk_opt_mode_expected), message); - sprintf(message, "Actual IO Mode has the correct value for %s.\n",test_name); + HDsprintf(message, "Actual IO Mode has the correct value for %s.\n",test_name); VRFY((actual_io_mode_write == actual_io_mode_expected), message); } else { HDfprintf(stderr, "%s %d -> (%d,%d)\n", test_name, mpi_rank, @@ -3338,7 +3346,7 @@ test_actual_io_mode(int selection_mode) { "actual_chunk_opt_mode has correct value for reset write (independent)"); VRFY(actual_io_mode_write == H5D_MPIO_NO_COLLECTIVE, "actual_io_mode has correct value for reset write (independent)"); - + /* Read */ ret = H5Dread(dataset, data_type, H5S_ALL, H5S_ALL, dxpl_read, buffer); VRFY((ret >= 0), "H5Dwrite() dataset multichunk write succeeded"); @@ -3348,7 +3356,7 @@ test_actual_io_mode(int selection_mode) { VRFY( (ret >= 0), "retriving actual io mode succeeded" ); ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_read, &actual_chunk_opt_mode_read); VRFY( (ret >= 0), "retriving actual chunk opt mode succeeded" ); - + VRFY(actual_chunk_opt_mode_read == H5D_MPIO_NO_CHUNK_OPTIMIZATION, "actual_chunk_opt_mode has correct value for reset read (independent)"); VRFY(actual_io_mode_read == H5D_MPIO_NO_COLLECTIVE, @@ -3370,10 +3378,10 @@ test_actual_io_mode(int selection_mode) { return; } - + /* Function: actual_io_mode_tests * - * Purpose: Tests all possible cases of the actual_io_mode property. + * Purpose: Tests all possible cases of the actual_io_mode property. * * Programmer: Jacob Gruber * Date: 2011-04-06 @@ -3384,10 +3392,10 @@ actual_io_mode_tests(void) { int mpi_rank = -1; MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_size(MPI_COMM_WORLD, &mpi_rank); - + test_actual_io_mode(TEST_ACTUAL_IO_NO_COLLECTIVE); - - /* + + /* * Test multi-chunk-io via proc_num threshold */ test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_IND); @@ -3398,10 +3406,10 @@ actual_io_mode_tests(void) { test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX); else HDfprintf(stdout, "Multi Chunk Mixed test requires 3 proceses minimum\n"); - + test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE); - /* + /* * Test multi-chunk-io via setting direct property */ test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND); @@ -3409,31 +3417,31 @@ actual_io_mode_tests(void) { test_actual_io_mode(TEST_ACTUAL_IO_LINK_CHUNK); test_actual_io_mode(TEST_ACTUAL_IO_CONTIGUOUS); - + test_actual_io_mode(TEST_ACTUAL_IO_RESET); return; } -/* +/* * Function: test_no_collective_cause_mode * - * Purpose: - * tests cases for broken collective I/O and checks that the + * Purpose: + * tests cases for broken collective I/O and checks that the * H5Pget_mpio_no_collective_cause properties in the DXPL have the correct values. * - * Input: + * Input: * selection_mode: various mode to cause broken collective I/O * Note: Originally, each TEST case is supposed to be used alone. * After some discussion, this is updated to take multiple TEST cases - * with '|'. However there is no error check for any of combined + * with '|'. However there is no error check for any of combined * test cases, so a tester is responsible to understand and feed * proper combination of TESTs if needed. * - * + * * TEST_COLLECTIVE: * Test for regular collective I/O without cause of breaking. * Just to test normal behavior. - * + * * TEST_SET_INDEPENDENT: * Test for Independent I/O as the cause of breaking collective I/O. * @@ -3445,7 +3453,7 @@ actual_io_mode_tests(void) { * * TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES: * Test for NULL dataspace as the cause of breaking collective I/O. - * + * * TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT: * Test for Compact layout as the cause of breaking collective I/O. * @@ -3454,17 +3462,17 @@ actual_io_mode_tests(void) { * * TEST_FILTERS: * Test for using filter (checksum) as the cause of breaking collective I/O. - * Note: TEST_FILTERS mode will not work until H5Dcreate and H5write is supported for mpio and filter feature. Use test_no_collective_cause_mode_filter() function instead. + * Note: TEST_FILTERS mode will not work until H5Dcreate and H5write is supported for mpio and filter feature. Use test_no_collective_cause_mode_filter() function instead. + * * - * * Programmer: Jonathan Kim * Date: Aug, 2012 */ #define DSET_NOCOLCAUSE "nocolcause" #define NELM 2 #define FILE_EXTERNAL "nocolcause_extern.data" -static void -test_no_collective_cause_mode(int selection_mode) +static void +test_no_collective_cause_mode(int selection_mode) { uint32_t no_collective_cause_local_write = 0; uint32_t no_collective_cause_local_read = 0; @@ -3478,7 +3486,7 @@ test_no_collective_cause_mode(int selection_mode) const char * test_name; hbool_t is_chunked=1; hbool_t is_independent=0; - int mpi_size = -1; + int mpi_size = -1; int mpi_rank = -1; int length; int * buffer; @@ -3502,7 +3510,7 @@ test_no_collective_cause_mode(int selection_mode) H5Z_filter_t filter_info; #endif /* LATER */ /* set to global value as default */ - int l_facc_type = facc_type; + int l_facc_type = facc_type; char message[256]; /* Set up MPI parameters */ @@ -3564,7 +3572,7 @@ test_no_collective_cause_mode(int selection_mode) sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); } - + filename = (const char *)GetTestParameters(); HDassert(filename != NULL); @@ -3589,20 +3597,19 @@ test_no_collective_cause_mode(int selection_mode) /* Create the dataset */ - dataset = H5Dcreate2(fid, "nocolcause", data_type, sid, H5P_DEFAULT, - dcpl, H5P_DEFAULT); + dataset = H5Dcreate2(fid, "nocolcause", data_type, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); VRFY((dataset >= 0), "H5Dcreate2() dataset succeeded"); - /* - * Set expected causes and some tweaks based on the type of test + /* + * Set expected causes and some tweaks based on the type of test */ if (selection_mode & TEST_DATATYPE_CONVERSION) { test_name = "Broken Collective I/O - Datatype Conversion"; no_collective_cause_local_expected |= H5D_MPIO_DATATYPE_CONVERSION; no_collective_cause_global_expected |= H5D_MPIO_DATATYPE_CONVERSION; /* set different sign to trigger type conversion */ - data_type = H5T_NATIVE_UINT; + data_type = H5T_NATIVE_UINT; } if (selection_mode & TEST_DATA_TRANSFORMS) { @@ -3667,14 +3674,14 @@ test_no_collective_cause_mode(int selection_mode) /* Allocate and initialize the buffer */ buffer = (int *)HDmalloc(sizeof(int) * length); - VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); - for(i = 0; i < length; i++) + VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); + for(i = 0; i < length; i++) buffer[i] = i; /* Set up the dxpl for the write */ dxpl_write = H5Pcreate(H5P_DATASET_XFER); VRFY((dxpl_write >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded"); - + if(is_independent) { /* Set Independent I/O */ ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_INDEPENDENT); @@ -3684,17 +3691,17 @@ test_no_collective_cause_mode(int selection_mode) /* Set Collective I/O */ ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_COLLECTIVE); VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - + } if (selection_mode & TEST_DATA_TRANSFORMS) { - ret = H5Pset_data_transform (dxpl_write, "x+1"); + ret = H5Pset_data_transform (dxpl_write, "x+1"); VRFY((ret >= 0), "H5Pset_data_transform succeeded"); } /*--------------------- * Test Write access - *---------------------*/ + *---------------------*/ /* Write */ ret = H5Dwrite(dataset, data_type, mem_space, file_space, dxpl_write, buffer); @@ -3709,7 +3716,7 @@ test_no_collective_cause_mode(int selection_mode) /*--------------------- * Test Read access - *---------------------*/ + *---------------------*/ /* Make a copy of the dxpl to test the read operation */ dxpl_read = H5Pcopy(dxpl_write); @@ -3720,7 +3727,7 @@ test_no_collective_cause_mode(int selection_mode) if(ret < 0) H5Eprint2(H5E_DEFAULT, stdout); VRFY((ret >= 0), "H5Dread() dataset multichunk read succeeded"); - + /* Get the cause of broken collective I/O */ ret = H5Pget_mpio_no_collective_cause (dxpl_read, &no_collective_cause_local_read, &no_collective_cause_global_read); VRFY((ret >= 0), "retriving no collective cause succeeded" ); @@ -3730,13 +3737,13 @@ test_no_collective_cause_mode(int selection_mode) "reading and writing are the same for local cause of Broken Collective I/O"); VRFY((no_collective_cause_global_read == no_collective_cause_global_write), "reading and writing are the same for global cause of Broken Collective I/O"); - + /* Test values */ - memset (message, 0, sizeof (message)); - sprintf(message, "Local cause of Broken Collective I/O has the correct value for %s.\n",test_name); + HDmemset (message, 0, sizeof (message)); + HDsprintf(message, "Local cause of Broken Collective I/O has the correct value for %s.\n",test_name); VRFY((no_collective_cause_local_write == no_collective_cause_local_expected), message); - memset (message, 0, sizeof (message)); - sprintf(message, "Global cause of Broken Collective I/O has the correct value for %s.\n",test_name); + HDmemset (message, 0, sizeof (message)); + HDsprintf(message, "Global cause of Broken Collective I/O has the correct value for %s.\n",test_name); VRFY((no_collective_cause_global_write == no_collective_cause_global_expected), message); /* Release some resources */ @@ -3768,28 +3775,28 @@ test_no_collective_cause_mode(int selection_mode) } -/* +/* * Function: test_no_collective_cause_mode_filter * - * Purpose: - * Test specific for using filter as a caus of broken collective I/O and + * Purpose: + * Test specific for using filter as a caus of broken collective I/O and * checks that the H5Pget_mpio_no_collective_cause properties in the DXPL * have the correct values. * - * NOTE: - * This is a temporary function. + * NOTE: + * This is a temporary function. * test_no_collective_cause_mode(TEST_FILTERS) will replace this when * H5Dcreate and H5write support for mpio and filter feature. * - * Input: + * Input: * TEST_FILTERS_READ: * Test for using filter (checksum) as the cause of breaking collective I/O. - * + * * Programmer: Jonathan Kim * Date: Aug, 2012 */ -static void -test_no_collective_cause_mode_filter(int selection_mode) +static void +test_no_collective_cause_mode_filter(int selection_mode) { uint32_t no_collective_cause_local_read = 0; uint32_t no_collective_cause_local_expected = 0; @@ -3799,7 +3806,7 @@ test_no_collective_cause_mode_filter(int selection_mode) const char * filename; const char * test_name; hbool_t is_chunked=1; - int mpi_size = -1; + int mpi_size = -1; int mpi_rank = -1; int length; int * buffer; @@ -3829,7 +3836,7 @@ test_no_collective_cause_mode_filter(int selection_mode) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Barrier(MPI_COMM_WORLD); - + HDassert(mpi_size >= 1); mpi_comm = MPI_COMM_WORLD; @@ -3855,12 +3862,12 @@ test_no_collective_cause_mode_filter(int selection_mode) VRFY(0, "Unexpected mode, only test for TEST_FILTERS_READ."); } - /* Create the basic Space */ + /* Create the basic Space */ dims[0] = dim0; dims[1] = dim1; sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); - + filename = (const char *)GetTestParameters(); HDassert(filename != NULL); @@ -3883,8 +3890,7 @@ test_no_collective_cause_mode_filter(int selection_mode) /* Create the dataset */ - dataset = H5Dcreate2(fid, DSET_NOCOLCAUSE, data_type, sid, H5P_DEFAULT, - dcpl, H5P_DEFAULT); + dataset = H5Dcreate2(fid, DSET_NOCOLCAUSE, data_type, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); VRFY((dataset >= 0), "H5Dcreate2() dataset succeeded"); #ifdef LATER /* fletcher32 */ @@ -3907,16 +3913,16 @@ test_no_collective_cause_mode_filter(int selection_mode) /* Allocate and initialize the buffer */ buffer = (int *)HDmalloc(sizeof(int) * length); - VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); - for(i = 0; i < length; i++) + VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); + for(i = 0; i < length; i++) buffer[i] = i; /* Set up the dxpl for the write */ dxpl = H5Pcreate(H5P_DATASET_XFER); VRFY((dxpl >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded"); - + if (selection_mode == TEST_FILTERS_READ) { - /* To test read in collective I/O mode , write in independent mode + /* To test read in collective I/O mode , write in independent mode * because write fails with mpio + filter */ ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_INDEPENDENT); VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); @@ -3926,7 +3932,7 @@ test_no_collective_cause_mode_filter(int selection_mode) ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE); VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); } - + /* Write */ ret = H5Dwrite(dataset, data_type, mem_space, file_space, dxpl, buffer); @@ -3967,17 +3973,17 @@ test_no_collective_cause_mode_filter(int selection_mode) if(ret < 0) H5Eprint2(H5E_DEFAULT, stdout); VRFY((ret >= 0), "H5Dread() dataset multichunk read succeeded"); - + /* Get the cause of broken collective I/O */ ret = H5Pget_mpio_no_collective_cause (dxpl, &no_collective_cause_local_read, &no_collective_cause_global_read); VRFY((ret >= 0), "retriving no collective cause succeeded" ); /* Test values */ - memset (message, 0, sizeof (message)); - sprintf(message, "Local cause of Broken Collective I/O has the correct value for %s.\n",test_name); + HDmemset (message, 0, sizeof (message)); + HDsprintf(message, "Local cause of Broken Collective I/O has the correct value for %s.\n",test_name); VRFY((no_collective_cause_local_read == (uint32_t)no_collective_cause_local_expected), message); - memset (message, 0, sizeof (message)); - sprintf(message, "Global cause of Broken Collective I/O has the correct value for %s.\n",test_name); + HDmemset (message, 0, sizeof (message)); + HDsprintf(message, "Global cause of Broken Collective I/O has the correct value for %s.\n",test_name); VRFY((no_collective_cause_global_read == (uint32_t)no_collective_cause_global_expected), message); /* Release some resources */ @@ -4003,16 +4009,16 @@ test_no_collective_cause_mode_filter(int selection_mode) /* Function: no_collective_cause_tests * - * Purpose: Tests cases for broken collective IO. + * Purpose: Tests cases for broken collective IO. * * Programmer: Jonathan Kim * Date: Aug, 2012 */ -void -no_collective_cause_tests(void) +void +no_collective_cause_tests(void) { - /* - * Test individual cause + /* + * Test individual cause */ test_no_collective_cause_mode (TEST_COLLECTIVE); test_no_collective_cause_mode (TEST_SET_INDEPENDENT); @@ -4022,15 +4028,15 @@ no_collective_cause_tests(void) test_no_collective_cause_mode (TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT); test_no_collective_cause_mode (TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL); #ifdef LATER /* fletcher32 */ - /* TODO: use this instead of below TEST_FILTERS_READ when H5Dcreate and + /* TODO: use this instead of below TEST_FILTERS_READ when H5Dcreate and * H5Dwrite is ready for mpio + filter feature. */ /* test_no_collective_cause_mode (TEST_FILTERS); */ test_no_collective_cause_mode_filter (TEST_FILTERS_READ); -#endif /* LATER */ +#endif /* LATER */ - /* - * Test combined causes + /* + * Test combined causes */ test_no_collective_cause_mode (TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION); test_no_collective_cause_mode (TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS); @@ -4054,22 +4060,22 @@ void dataset_atomicity(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t sid; /* Dataspace ID */ - hid_t dataset1; /* Dataset IDs */ - hsize_t dims[RANK]; /* dataset dim sizes */ - int *write_buf = NULL; /* data buffer */ - int *read_buf = NULL; /* data buffer */ + hid_t acc_tpl; /* File access templates */ + hid_t sid; /* Dataspace ID */ + hid_t dataset1; /* Dataset IDs */ + hsize_t dims[RANK]; /* dataset dim sizes */ + int *write_buf = NULL; /* data buffer */ + int *read_buf = NULL; /* data buffer */ int buf_size; hid_t dataset2; - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* Memory dataspace ID */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* Memory dataspace ID */ hsize_t start[RANK]; hsize_t stride[RANK]; hsize_t count[RANK]; hsize_t block[RANK]; const char *filename; - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; int i, j, k; hbool_t atomicity = FALSE; @@ -4079,11 +4085,11 @@ dataset_atomicity(void) dim0 = 64; dim1 = 32; filename = GetTestParameters(); if (facc_type != FACC_MPIO) { - printf("Atomicity tests will not work without the MPIO VFD\n"); + HDprintf("Atomicity tests will not work without the MPIO VFD\n"); return; } if(VERBOSE_MED) - printf("atomic writes to file %s\n", filename); + HDprintf("atomic writes to file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -4134,7 +4140,7 @@ dataset_atomicity(void) H5P_DEFAULT, write_buf); VRFY((ret >= 0), "H5Dwrite dataset2 succeeded"); } - + ret = H5Dclose(dataset1); VRFY((ret >= 0), "H5Dclose succeeded"); ret = H5Dclose(dataset2); @@ -4149,8 +4155,8 @@ dataset_atomicity(void) /* make sure setting atomicity fails on a serial file ID */ /* file locking allows only one file open (serial) for writing */ if(MAINPROCESS){ - fid=H5Fopen(filename,H5F_ACC_RDWR,H5P_DEFAULT); - VRFY((fid >= 0), "H5Fopen succeeed"); + fid=H5Fopen(filename,H5F_ACC_RDWR,H5P_DEFAULT); + VRFY((fid >= 0), "H5Fopen succeeed"); } /* should fail */ @@ -4158,8 +4164,8 @@ dataset_atomicity(void) VRFY((ret == FAIL), "H5Fset_mpi_atomicity failed"); if(MAINPROCESS){ - ret = H5Fclose(fid); - VRFY((ret >= 0), "H5Fclose succeeded"); + ret = H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded"); } MPI_Barrier (comm); @@ -4215,23 +4221,23 @@ dataset_atomicity(void) if(VERBOSE_MED) { i=0;j=0;k=0; for (i=0 ; i<dim0 ; i++) { - printf ("\n"); + HDprintf ("\n"); for (j=0 ; j<dim1 ; j++) - printf ("%d ", read_buf[k++]); + HDprintf ("%d ", read_buf[k++]); } } /* The processes that read the dataset must either read all values as 0 (read happened before process 0 wrote to dataset 1), or 5 (read happened after process 0 wrote to dataset 1) */ - if (0 != mpi_rank) { + if (0 != mpi_rank) { int compare = read_buf[0]; - VRFY((compare == 0 || compare == 5), + VRFY((compare == 0 || compare == 5), "Atomicity Test Failed Process %d: Value read should be 0 or 5\n"); for (i=1; i<buf_size; i++) { if (read_buf[i] != compare) { - printf("Atomicity Test Failed Process %d: read_buf[%d] is %d, should be %d\n", mpi_rank, i, read_buf[i], compare); + HDprintf("Atomicity Test Failed Process %d: read_buf[%d] is %d, should be %d\n", mpi_rank, i, read_buf[i], compare); nerrors ++; } } @@ -4313,17 +4319,17 @@ dataset_atomicity(void) if (mpi_rank == 1) { i=0;j=0;k=0; for (i=0 ; i<dim0 ; i++) { - printf ("\n"); + HDprintf ("\n"); for (j=0 ; j<dim1 ; j++) - printf ("%d ", read_buf[k++]); + HDprintf ("%d ", read_buf[k++]); } - printf ("\n"); + HDprintf ("\n"); } } /* The processes that read the dataset must either read all values as 5 (read happened after process 0 wrote to dataset 1) */ - if (0 != mpi_rank) { + if (0 != mpi_rank) { int compare; i=0;j=0;k=0; @@ -4347,7 +4353,7 @@ dataset_atomicity(void) continue; } else if (compare != read_buf[k]) { - printf("Atomicity Test Failed Process %d: read_buf[%d] is %d, should be %d\n", mpi_rank, k, read_buf[k], compare); + HDprintf("Atomicity Test Failed Process %d: read_buf[%d] is %d, should be %d\n", mpi_rank, k, read_buf[k], compare); nerrors++; } k ++; @@ -4378,8 +4384,8 @@ dataset_atomicity(void) * Programmer: Quincey Koziol * Date: April, 2013 */ -void -test_dense_attr(void) +void +test_dense_attr(void) { int mpi_size, mpi_rank; hid_t fpid, fid; @@ -4417,7 +4423,7 @@ test_dense_attr(void) status = H5Pclose(gpid); VRFY((status >= 0), "H5Pclose succeeded"); - atFileSpace = H5Screate_simple(1, atDims, NULL); + atFileSpace = H5Screate_simple(1, atDims, NULL); VRFY((atFileSpace > 0), "H5Screate_simple succeeded"); atid = H5Acreate2(gid, "bar", H5T_STD_U64LE, atFileSpace, H5P_DEFAULT, H5P_DEFAULT); VRFY((atid > 0), "H5Acreate succeeded"); diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c index f436c8f..1f26e0d 100644 --- a/testpar/t_filters_parallel.c +++ b/testpar/t_filters_parallel.c @@ -32,9 +32,28 @@ char filenames[1][256]; int nerrors = 0; size_t cur_filter_idx = 0; +#define GZIP_INDEX 0 +#define FLETCHER32_INDEX 1 #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0]) +/* + * Used to check if a filter is available before running a test. + */ +#define CHECK_CUR_FILTER_AVAIL() \ +{ \ + htri_t filter_is_avail; \ + \ + if (cur_filter_idx == GZIP_INDEX) { \ + if ((filter_is_avail = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) != TRUE) { \ + if (MAINPROCESS) { \ + HDputs(" - SKIPPED - Deflate filter not available"); \ + } \ + return; \ + } \ + } \ +} + static herr_t set_dcpl_filter(hid_t dcpl); #if MPI_VERSION >= 3 @@ -144,9 +163,9 @@ static herr_t set_dcpl_filter(hid_t dcpl) { switch (cur_filter_idx) { - case 0: + case GZIP_INDEX: return H5Pset_deflate(dcpl, DEFAULT_DEFLATE_LEVEL); - case 1: + case FLETCHER32_INDEX: return H5Pset_fletcher32(dcpl); default: return H5Pset_deflate(dcpl, DEFAULT_DEFLATE_LEVEL); @@ -178,7 +197,9 @@ test_write_one_chunk_filtered_dataset(void) hid_t file_id = -1, dset_id = -1, plist_id = -1; hid_t filespace = -1, memspace = -1; - if (MAINPROCESS) puts("Testing write to one-chunk filtered dataset"); + if (MAINPROCESS) HDputs("Testing write to one-chunk filtered dataset"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -238,9 +259,9 @@ test_write_one_chunk_filtered_dataset(void) start[1] = 0; if (VERBOSE_MED) { - printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } /* Select hyperslab in the file */ @@ -292,7 +313,7 @@ test_write_one_chunk_filtered_dataset(void) VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (correct_buf) HDfree(correct_buf); @@ -333,7 +354,9 @@ test_write_filtered_dataset_no_overlap(void) hid_t file_id = -1, dset_id = -1, plist_id = -1; hid_t filespace = -1, memspace = -1; - if (MAINPROCESS) puts("Testing write to unshared filtered chunks"); + if (MAINPROCESS) HDputs("Testing write to unshared filtered chunks"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -394,9 +417,9 @@ test_write_filtered_dataset_no_overlap(void) start[1] = 0; if (VERBOSE_MED) { - printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } /* Select hyperslab in the file */ @@ -450,7 +473,7 @@ test_write_filtered_dataset_no_overlap(void) VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (correct_buf) HDfree(correct_buf); @@ -492,7 +515,9 @@ test_write_filtered_dataset_overlap(void) hid_t file_id = -1, dset_id = -1, plist_id = -1; hid_t filespace = -1, memspace = -1; - if (MAINPROCESS) puts("Testing write to shared filtered chunks"); + if (MAINPROCESS) HDputs("Testing write to shared filtered chunks"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -553,9 +578,9 @@ test_write_filtered_dataset_overlap(void) start[1] = 0; if (VERBOSE_MED) { - printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } /* Select hyperslab in the file */ @@ -609,7 +634,7 @@ test_write_filtered_dataset_overlap(void) VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (correct_buf) HDfree(correct_buf); @@ -654,7 +679,9 @@ test_write_filtered_dataset_single_no_selection(void) hid_t file_id = -1, dset_id = -1, plist_id = -1; hid_t filespace = -1, memspace = -1; - if (MAINPROCESS) puts("Testing write to filtered chunks with a single process having no selection"); + if (MAINPROCESS) HDputs("Testing write to filtered chunks with a single process having no selection"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -718,9 +745,9 @@ test_write_filtered_dataset_single_no_selection(void) start[1] = 0; if (VERBOSE_MED) { - printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } /* Select hyperslab in the file */ @@ -782,7 +809,7 @@ test_write_filtered_dataset_single_no_selection(void) VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (correct_buf) HDfree(correct_buf); @@ -823,7 +850,9 @@ test_write_filtered_dataset_all_no_selection(void) hid_t file_id = -1, dset_id = -1, plist_id = -1; hid_t filespace = -1, memspace = -1; - if (MAINPROCESS) puts("Testing write to filtered chunks with all processes having no selection"); + if (MAINPROCESS) HDputs("Testing write to filtered chunks with all processes having no selection"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -912,7 +941,7 @@ test_write_filtered_dataset_all_no_selection(void) VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (correct_buf) HDfree(correct_buf); @@ -949,7 +978,9 @@ test_write_filtered_dataset_point_selection(void) hid_t file_id = -1, dset_id = -1, plist_id = -1; hid_t filespace = -1, memspace = -1; - if (MAINPROCESS) puts("Testing write to filtered chunks with point selection"); + if (MAINPROCESS) HDputs("Testing write to filtered chunks with point selection"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -1058,7 +1089,7 @@ test_write_filtered_dataset_point_selection(void) VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (coords) HDfree(coords); @@ -1102,7 +1133,9 @@ test_write_filtered_dataset_interleaved_write(void) hid_t file_id = -1, dset_id = -1, plist_id = -1; hid_t filespace = -1, memspace = -1; - if (MAINPROCESS) puts("Testing interleaved write to filtered chunks"); + if (MAINPROCESS) HDputs("Testing interleaved write to filtered chunks"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -1163,9 +1196,9 @@ test_write_filtered_dataset_interleaved_write(void) start[1] = 0; if (VERBOSE_MED) { - printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } /* Select hyperslab in the file */ @@ -1225,7 +1258,7 @@ test_write_filtered_dataset_interleaved_write(void) VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (correct_buf) HDfree(correct_buf); @@ -1265,7 +1298,9 @@ test_write_3d_filtered_dataset_no_overlap_separate_pages(void) hid_t file_id = -1, dset_id = -1, plist_id = -1; hid_t filespace = -1, memspace = -1; - if (MAINPROCESS) puts("Testing write to unshared filtered chunks on separate pages in 3D dataset"); + if (MAINPROCESS) HDputs("Testing write to unshared filtered chunks on separate pages in 3D dataset"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -1333,9 +1368,9 @@ test_write_3d_filtered_dataset_no_overlap_separate_pages(void) start[2] = (hsize_t) mpi_rank; if (VERBOSE_MED) { - printf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], start[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], start[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n", mpi_rank, count[0], count[1], count[2], stride[0], stride[1], stride[2], start[0], start[1], start[2], block[0], block[1], block[2]); - fflush(stdout); + HDfflush(stdout); } /* Select hyperslab in the file */ @@ -1385,7 +1420,7 @@ test_write_3d_filtered_dataset_no_overlap_separate_pages(void) VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (correct_buf) HDfree(correct_buf); @@ -1426,7 +1461,9 @@ test_write_3d_filtered_dataset_no_overlap_same_pages(void) hid_t file_id, dset_id, plist_id; hid_t filespace, memspace; - if (MAINPROCESS) puts("Testing write to unshared filtered chunks on the same pages in 3D dataset"); + if (MAINPROCESS) HDputs("Testing write to unshared filtered chunks on the same pages in 3D dataset"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -1494,9 +1531,9 @@ test_write_3d_filtered_dataset_no_overlap_same_pages(void) start[2] = 0; if (VERBOSE_MED) { - printf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], start[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], start[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n", mpi_rank, count[0], count[1], count[2], stride[0], stride[1], stride[2], start[0], start[1], start[2], block[0], block[1], block[2]); - fflush(stdout); + HDfflush(stdout); } /* Select hyperslab in the file */ @@ -1549,7 +1586,7 @@ test_write_3d_filtered_dataset_no_overlap_same_pages(void) VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (correct_buf) HDfree(correct_buf); @@ -1590,7 +1627,9 @@ test_write_3d_filtered_dataset_overlap(void) hid_t file_id = -1, dset_id = -1, plist_id = -1; hid_t filespace = -1, memspace = -1; - if (MAINPROCESS) puts("Testing write to shared filtered chunks in 3D dataset"); + if (MAINPROCESS) HDputs("Testing write to shared filtered chunks in 3D dataset"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -1658,9 +1697,9 @@ test_write_3d_filtered_dataset_overlap(void) start[2] = 0; if (VERBOSE_MED) { - printf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], start[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], start[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n", mpi_rank, count[0], count[1], count[2], stride[0], stride[1], stride[2], start[0], start[1], start[2], block[0], block[1], block[2]); - fflush(stdout); + HDfflush(stdout); } /* Select hyperslab in the file */ @@ -1722,7 +1761,7 @@ test_write_3d_filtered_dataset_overlap(void) VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (correct_buf) HDfree(correct_buf); @@ -1762,7 +1801,9 @@ test_write_cmpd_filtered_dataset_no_conversion_unshared(void) hid_t file_id = -1, dset_id = -1, plist_id = -1, memtype = -1; hid_t filespace = -1, memspace = -1; - if (MAINPROCESS) puts("Testing write to unshared filtered chunks in Compound Datatype dataset without Datatype conversion"); + if (MAINPROCESS) HDputs("Testing write to unshared filtered chunks in Compound Datatype dataset without Datatype conversion"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -1834,9 +1875,9 @@ test_write_cmpd_filtered_dataset_no_conversion_unshared(void) start[1] = ((hsize_t) mpi_rank * WRITE_COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_UNSHARED_CH_NCOLS); if (VERBOSE_MED) { - printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } /* Select hyperslab in the file */ @@ -1902,7 +1943,7 @@ test_write_cmpd_filtered_dataset_no_conversion_unshared(void) VRFY((H5Dread(dset_id, memtype, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (correct_buf) HDfree(correct_buf); @@ -1943,7 +1984,9 @@ test_write_cmpd_filtered_dataset_no_conversion_shared(void) hid_t file_id, dset_id, plist_id, memtype; hid_t filespace, memspace; - if (MAINPROCESS) puts("Testing write to shared filtered chunks in Compound Datatype dataset without Datatype conversion"); + if (MAINPROCESS) HDputs("Testing write to shared filtered chunks in Compound Datatype dataset without Datatype conversion"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -2015,9 +2058,9 @@ test_write_cmpd_filtered_dataset_no_conversion_shared(void) start[1] = 0; if (VERBOSE_MED) { - printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } /* Select hyperslab in the file */ @@ -2086,7 +2129,7 @@ test_write_cmpd_filtered_dataset_no_conversion_shared(void) VRFY((H5Dread(dset_id, memtype, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (correct_buf) HDfree(correct_buf); @@ -2132,7 +2175,9 @@ test_write_cmpd_filtered_dataset_type_conversion_unshared(void) hid_t file_id = -1, dset_id = -1, plist_id = -1, filetype = -1, memtype = -1; hid_t filespace = -1, memspace = -1; - if (MAINPROCESS) puts("Testing write to unshared filtered chunks in Compound Datatype dataset with Datatype conversion"); + if (MAINPROCESS) HDputs("Testing write to unshared filtered chunks in Compound Datatype dataset with Datatype conversion"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -2215,9 +2260,9 @@ test_write_cmpd_filtered_dataset_type_conversion_unshared(void) start[1] = ((hsize_t) mpi_rank * WRITE_COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_UNSHARED_CH_NCOLS); if (VERBOSE_MED) { - printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } /* Select hyperslab in the file */ @@ -2269,7 +2314,7 @@ test_write_cmpd_filtered_dataset_type_conversion_unshared(void) VRFY((H5Dread(dset_id, memtype, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (correct_buf) HDfree(correct_buf); @@ -2316,7 +2361,9 @@ test_write_cmpd_filtered_dataset_type_conversion_shared(void) hid_t file_id, dset_id, plist_id, filetype, memtype; hid_t filespace, memspace; - if (MAINPROCESS) puts("Testing write to shared filtered chunks in Compound Datatype dataset with Datatype conversion"); + if (MAINPROCESS) HDputs("Testing write to shared filtered chunks in Compound Datatype dataset with Datatype conversion"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -2399,9 +2446,9 @@ test_write_cmpd_filtered_dataset_type_conversion_shared(void) start[1] = 0; if (VERBOSE_MED) { - printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } /* Select hyperslab in the file */ @@ -2453,7 +2500,7 @@ test_write_cmpd_filtered_dataset_type_conversion_shared(void) VRFY((H5Dread(dset_id, memtype, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (correct_buf) HDfree(correct_buf); @@ -2503,6 +2550,10 @@ test_read_one_chunk_filtered_dataset(void) int *recvcounts = NULL; int *displs = NULL; + if (MAINPROCESS) HDputs("Testing read from one-chunk filtered dataset"); + + CHECK_CUR_FILTER_AVAIL(); + dataset_dims[0] = (hsize_t) READ_ONE_CHUNK_FILTERED_DATASET_NROWS; dataset_dims[1] = (hsize_t) READ_ONE_CHUNK_FILTERED_DATASET_NCOLS; @@ -2517,8 +2568,6 @@ test_read_one_chunk_filtered_dataset(void) + ((C_DATATYPE) i / (READ_ONE_CHUNK_FILTERED_DATASET_CH_NROWS / mpi_size * READ_ONE_CHUNK_FILTERED_DATASET_CH_NCOLS)); if (MAINPROCESS) { - puts("Testing read from one-chunk filtered dataset"); - plist_id = H5Pcreate(H5P_FILE_ACCESS); VRFY((plist_id >= 0), "FAPL creation succeeded"); @@ -2606,9 +2655,9 @@ test_read_one_chunk_filtered_dataset(void) start[1] = 0; if (VERBOSE_MED) { - printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0), @@ -2648,7 +2697,7 @@ test_read_one_chunk_filtered_dataset(void) VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) flat_dims[0], C_DATATYPE_MPI, global_buf, recvcounts, displs, C_DATATYPE_MPI, comm)), "MPI_Allgatherv succeeded"); - VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (displs) HDfree(displs); @@ -2698,6 +2747,10 @@ test_read_filtered_dataset_no_overlap(void) int *recvcounts = NULL; int *displs = NULL; + if (MAINPROCESS) HDputs("Testing read from unshared filtered chunks"); + + CHECK_CUR_FILTER_AVAIL(); + dataset_dims[0] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_NROWS; dataset_dims[1] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_NCOLS; @@ -2714,8 +2767,6 @@ test_read_filtered_dataset_no_overlap(void) ); if (MAINPROCESS) { - puts("Testing read from unshared filtered chunks"); - plist_id = H5Pcreate(H5P_FILE_ACCESS); VRFY((plist_id >= 0), "FAPL creation succeeded"); @@ -2803,9 +2854,9 @@ test_read_filtered_dataset_no_overlap(void) start[1] = 0; if (VERBOSE_MED) { - printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0), @@ -2845,7 +2896,7 @@ test_read_filtered_dataset_no_overlap(void) VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) flat_dims[0], C_DATATYPE_MPI, global_buf, recvcounts, displs, C_DATATYPE_MPI, comm)), "MPI_Allgatherv succeeded"); - VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (displs) HDfree(displs); @@ -2896,6 +2947,10 @@ test_read_filtered_dataset_overlap(void) int *recvcounts = NULL; int *displs = NULL; + if (MAINPROCESS) HDputs("Testing read from shared filtered chunks"); + + CHECK_CUR_FILTER_AVAIL(); + dataset_dims[0] = (hsize_t) READ_SHARED_FILTERED_CHUNKS_NROWS; dataset_dims[1] = (hsize_t) READ_SHARED_FILTERED_CHUNKS_NCOLS; @@ -2913,8 +2968,6 @@ test_read_filtered_dataset_overlap(void) ); if (MAINPROCESS) { - puts("Testing read from shared filtered chunks"); - plist_id = H5Pcreate(H5P_FILE_ACCESS); VRFY((plist_id >= 0), "FAPL creation succeeded"); @@ -3002,9 +3055,9 @@ test_read_filtered_dataset_overlap(void) start[1] = 0; if (VERBOSE_MED) { - printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0), @@ -3059,7 +3112,7 @@ test_read_filtered_dataset_overlap(void) } } - VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (displs) HDfree(displs); @@ -3111,6 +3164,10 @@ test_read_filtered_dataset_single_no_selection(void) int *recvcounts = NULL; int *displs = NULL; + if (MAINPROCESS) HDputs("Testing read from filtered chunks with a single process having no selection"); + + CHECK_CUR_FILTER_AVAIL(); + dataset_dims[0] = (hsize_t) READ_SINGLE_NO_SELECTION_FILTERED_CHUNKS_NROWS; dataset_dims[1] = (hsize_t) READ_SINGLE_NO_SELECTION_FILTERED_CHUNKS_NCOLS; @@ -3133,8 +3190,6 @@ test_read_filtered_dataset_single_no_selection(void) 0, segment_length * sizeof(*correct_buf)); if (MAINPROCESS) { - puts("Testing read from filtered chunks with a single process having no selection"); - plist_id = H5Pcreate(H5P_FILE_ACCESS); VRFY((plist_id >= 0), "FAPL creation succeeded"); @@ -3225,9 +3280,9 @@ test_read_filtered_dataset_single_no_selection(void) start[1] = 0; if (VERBOSE_MED) { - printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } if (mpi_rank == READ_SINGLE_NO_SELECTION_FILTERED_CHUNKS_NO_SELECT_PROC) @@ -3275,7 +3330,7 @@ test_read_filtered_dataset_single_no_selection(void) VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) flat_dims[0], C_DATATYPE_MPI, global_buf, recvcounts, displs, C_DATATYPE_MPI, comm)), "MPI_Allgatherv succeeded"); - VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (displs) HDfree(displs); @@ -3319,6 +3374,10 @@ test_read_filtered_dataset_all_no_selection(void) hid_t file_id = -1, dset_id = -1, plist_id = -1; hid_t filespace = -1, memspace = -1; + if (MAINPROCESS) HDputs("Testing read from filtered chunks with all processes having no selection"); + + CHECK_CUR_FILTER_AVAIL(); + dataset_dims[0] = (hsize_t) READ_ALL_NO_SELECTION_FILTERED_CHUNKS_NROWS; dataset_dims[1] = (hsize_t) READ_ALL_NO_SELECTION_FILTERED_CHUNKS_NCOLS; @@ -3329,8 +3388,6 @@ test_read_filtered_dataset_all_no_selection(void) VRFY((NULL != correct_buf), "HDcalloc succeeded"); if (MAINPROCESS) { - puts("Testing read from filtered chunks with all processes having no selection"); - plist_id = H5Pcreate(H5P_FILE_ACCESS); VRFY((plist_id >= 0), "FAPL creation succeeded"); @@ -3460,6 +3517,10 @@ test_read_filtered_dataset_point_selection(void) int *recvcounts = NULL; int *displs = NULL; + if (MAINPROCESS) HDputs("Testing read from filtered chunks with point selection"); + + CHECK_CUR_FILTER_AVAIL(); + dataset_dims[0] = (hsize_t) READ_POINT_SELECTION_FILTERED_CHUNKS_NROWS; dataset_dims[1] = (hsize_t) READ_POINT_SELECTION_FILTERED_CHUNKS_NCOLS; @@ -3477,8 +3538,6 @@ test_read_filtered_dataset_point_selection(void) ); if (MAINPROCESS) { - puts("Testing read from filtered chunks with point selection"); - plist_id = H5Pcreate(H5P_FILE_ACCESS); VRFY((plist_id >= 0), "FAPL creation succeeded"); @@ -3615,7 +3674,7 @@ test_read_filtered_dataset_point_selection(void) } } - VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (displs) HDfree(displs); @@ -3669,6 +3728,10 @@ test_read_filtered_dataset_interleaved_read(void) int *recvcounts = NULL; int *displs = NULL; + if (MAINPROCESS) HDputs("Testing interleaved read from filtered chunks"); + + CHECK_CUR_FILTER_AVAIL(); + dataset_dims[0] = (hsize_t) INTERLEAVED_READ_FILTERED_DATASET_NROWS; dataset_dims[1] = (hsize_t) INTERLEAVED_READ_FILTERED_DATASET_NCOLS; @@ -3692,8 +3755,6 @@ test_read_filtered_dataset_interleaved_read(void) ); if (MAINPROCESS) { - puts("Testing interleaved read from filtered chunks"); - plist_id = H5Pcreate(H5P_FILE_ACCESS); VRFY((plist_id >= 0), "FAPL creation succeeded"); @@ -3781,9 +3842,9 @@ test_read_filtered_dataset_interleaved_read(void) start[1] = 0; if (VERBOSE_MED) { - printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0), @@ -3838,7 +3899,7 @@ test_read_filtered_dataset_interleaved_read(void) } } - VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (displs) HDfree(displs); @@ -3889,6 +3950,10 @@ test_read_3d_filtered_dataset_no_overlap_separate_pages(void) hid_t file_id = -1, dset_id = -1, plist_id = -1; hid_t filespace = -1, memspace = -1; + if (MAINPROCESS) HDputs("Testing read from unshared filtered chunks on separate pages in 3D dataset"); + + CHECK_CUR_FILTER_AVAIL(); + dataset_dims[0] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_3D_SEP_PAGE_NROWS; dataset_dims[1] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_3D_SEP_PAGE_NCOLS; dataset_dims[2] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_3D_SEP_PAGE_DEPTH; @@ -3903,8 +3968,6 @@ test_read_3d_filtered_dataset_no_overlap_separate_pages(void) correct_buf[i] = (C_DATATYPE) ((i % (hsize_t) mpi_size) + (i / (hsize_t) mpi_size)); if (MAINPROCESS) { - puts("Testing read from unshared filtered chunks on separate pages in 3D dataset"); - plist_id = H5Pcreate(H5P_FILE_ACCESS); VRFY((plist_id >= 0), "FAPL creation succeeded"); @@ -3998,9 +4061,9 @@ test_read_3d_filtered_dataset_no_overlap_separate_pages(void) start[2] = (hsize_t) mpi_rank; if (VERBOSE_MED) { - printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0), @@ -4043,7 +4106,7 @@ test_read_3d_filtered_dataset_no_overlap_separate_pages(void) VRFY((MPI_SUCCESS == MPI_Allgather(read_buf, (int) flat_dims[0], C_DATATYPE_MPI, global_buf, 1, resized_vector_type, comm)), "MPI_Allgather succeeded"); - VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); VRFY((MPI_SUCCESS == MPI_Type_free(&vector_type)), "MPI_Type_free succeeded"); @@ -4096,6 +4159,10 @@ test_read_3d_filtered_dataset_no_overlap_same_pages(void) int *recvcounts = NULL; int *displs = NULL; + if (MAINPROCESS) HDputs("Testing read from unshared filtered chunks on the same pages in 3D dataset"); + + CHECK_CUR_FILTER_AVAIL(); + dataset_dims[0] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_3D_SAME_PAGE_NROWS; dataset_dims[1] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_3D_SAME_PAGE_NCOLS; dataset_dims[2] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_3D_SAME_PAGE_DEPTH; @@ -4113,8 +4180,6 @@ test_read_3d_filtered_dataset_no_overlap_same_pages(void) ); if (MAINPROCESS) { - puts("Testing read from unshared filtered chunks on the same pages in 3D dataset"); - plist_id = H5Pcreate(H5P_FILE_ACCESS); VRFY((plist_id >= 0), "FAPL creation succeeded"); @@ -4208,9 +4273,9 @@ test_read_3d_filtered_dataset_no_overlap_same_pages(void) start[2] = 0; if (VERBOSE_MED) { - printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0), @@ -4250,7 +4315,7 @@ test_read_3d_filtered_dataset_no_overlap_same_pages(void) VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) flat_dims[0], C_DATATYPE_MPI, global_buf, recvcounts, displs, C_DATATYPE_MPI, comm)), "MPI_Allgatherv succeeded"); - VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (displs) HDfree(displs); @@ -4302,6 +4367,10 @@ test_read_3d_filtered_dataset_overlap(void) hid_t file_id = -1, dset_id = -1, plist_id = -1; hid_t filespace = -1, memspace = -1; + if (MAINPROCESS) HDputs("Testing read from shared filtered chunks in 3D dataset"); + + CHECK_CUR_FILTER_AVAIL(); + dataset_dims[0] = (hsize_t) READ_SHARED_FILTERED_CHUNKS_3D_NROWS; dataset_dims[1] = (hsize_t) READ_SHARED_FILTERED_CHUNKS_3D_NCOLS; dataset_dims[2] = (hsize_t) READ_SHARED_FILTERED_CHUNKS_3D_DEPTH; @@ -4328,8 +4397,6 @@ test_read_3d_filtered_dataset_overlap(void) ); if (MAINPROCESS) { - puts("Testing read from shared filtered chunks in 3D dataset"); - plist_id = H5Pcreate(H5P_FILE_ACCESS); VRFY((plist_id >= 0), "FAPL creation succeeded"); @@ -4423,9 +4490,9 @@ test_read_3d_filtered_dataset_overlap(void) start[2] = 0; if (VERBOSE_MED) { - printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0), @@ -4473,7 +4540,7 @@ test_read_3d_filtered_dataset_overlap(void) VRFY((MPI_SUCCESS == MPI_Allgather(read_buf, (int) flat_dims[0], C_DATATYPE_MPI, global_buf, 1, resized_vector_type, comm)), "MPI_Allgatherv succeeded"); - VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); VRFY((MPI_SUCCESS == MPI_Type_free(&vector_type)), "MPI_Type_free succeeded"); @@ -4525,6 +4592,10 @@ test_read_cmpd_filtered_dataset_no_conversion_unshared(void) int *recvcounts = NULL; int *displs = NULL; + if (MAINPROCESS) HDputs("Testing read from unshared filtered chunks in Compound Datatype dataset without Datatype conversion"); + + CHECK_CUR_FILTER_AVAIL(); + dataset_dims[0] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_UNSHARED_NROWS; dataset_dims[1] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_UNSHARED_NCOLS; @@ -4563,8 +4634,6 @@ test_read_cmpd_filtered_dataset_no_conversion_unshared(void) "Datatype insertion succeeded"); if (MAINPROCESS) { - puts("Testing read from unshared filtered chunks in Compound Datatype dataset without Datatype conversion"); - plist_id = H5Pcreate(H5P_FILE_ACCESS); VRFY((plist_id >= 0), "FAPL creation succeeded"); @@ -4652,9 +4721,9 @@ test_read_cmpd_filtered_dataset_no_conversion_unshared(void) start[1] = ((hsize_t) mpi_rank * READ_COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_UNSHARED_CH_NCOLS); if (VERBOSE_MED) { - printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0), @@ -4694,7 +4763,7 @@ test_read_cmpd_filtered_dataset_no_conversion_unshared(void) VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) (flat_dims[0] * sizeof(COMPOUND_C_DATATYPE)), MPI_BYTE, global_buf, recvcounts, displs, MPI_BYTE, comm)), "MPI_Allgatherv succeeded"); - VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (displs) HDfree(displs); @@ -4746,6 +4815,10 @@ test_read_cmpd_filtered_dataset_no_conversion_shared(void) int *recvcounts = NULL; int *displs = NULL; + if (MAINPROCESS) HDputs("Testing read from shared filtered chunks in Compound Datatype dataset without Datatype conversion"); + + CHECK_CUR_FILTER_AVAIL(); + dataset_dims[0] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_SHARED_NROWS; dataset_dims[1] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_SHARED_NCOLS; @@ -4787,8 +4860,6 @@ test_read_cmpd_filtered_dataset_no_conversion_shared(void) "Datatype insertion succeeded"); if (MAINPROCESS) { - puts("Testing read from shared filtered chunks in Compound Datatype dataset without Datatype conversion"); - plist_id = H5Pcreate(H5P_FILE_ACCESS); VRFY((plist_id >= 0), "FAPL creation succeeded"); @@ -4876,9 +4947,9 @@ test_read_cmpd_filtered_dataset_no_conversion_shared(void) start[1] = 0; if (VERBOSE_MED) { - printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0), @@ -4918,7 +4989,7 @@ test_read_cmpd_filtered_dataset_no_conversion_shared(void) VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) (flat_dims[0] * sizeof(COMPOUND_C_DATATYPE)), MPI_BYTE, global_buf, recvcounts, displs, MPI_BYTE, comm)), "MPI_Allgatherv succeeded"); - VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (displs) HDfree(displs); @@ -4970,6 +5041,10 @@ test_read_cmpd_filtered_dataset_type_conversion_unshared(void) int *recvcounts = NULL; int *displs = NULL; + if (MAINPROCESS) HDputs("Testing read from unshared filtered chunks in Compound Datatype dataset with Datatype conversion"); + + CHECK_CUR_FILTER_AVAIL(); + dataset_dims[0] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_UNSHARED_NROWS; dataset_dims[1] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_UNSHARED_NCOLS; @@ -5019,8 +5094,6 @@ test_read_cmpd_filtered_dataset_type_conversion_unshared(void) "Datatype insertion succeeded"); if (MAINPROCESS) { - puts("Testing read from unshared filtered chunks in Compound Datatype dataset with Datatype conversion"); - plist_id = H5Pcreate(H5P_FILE_ACCESS); VRFY((plist_id >= 0), "FAPL creation succeeded"); @@ -5108,9 +5181,9 @@ test_read_cmpd_filtered_dataset_type_conversion_unshared(void) start[1] = ((hsize_t) mpi_rank * READ_COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_UNSHARED_CH_NCOLS); if (VERBOSE_MED) { - printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0), @@ -5150,7 +5223,7 @@ test_read_cmpd_filtered_dataset_type_conversion_unshared(void) VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) (flat_dims[0] * sizeof(COMPOUND_C_DATATYPE)), MPI_BYTE, global_buf, recvcounts, displs, MPI_BYTE, comm)), "MPI_Allgatherv succeeded"); - VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (displs) HDfree(displs); @@ -5203,6 +5276,10 @@ test_read_cmpd_filtered_dataset_type_conversion_shared(void) int *recvcounts = NULL; int *displs = NULL; + if (MAINPROCESS) HDputs("Testing read from shared filtered chunks in Compound Datatype dataset with Datatype conversion"); + + CHECK_CUR_FILTER_AVAIL(); + dataset_dims[0] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_SHARED_NROWS; dataset_dims[1] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_SHARED_NCOLS; @@ -5255,8 +5332,6 @@ test_read_cmpd_filtered_dataset_type_conversion_shared(void) "Datatype insertion succeeded"); if (MAINPROCESS) { - puts("Testing read from shared filtered chunks in Compound Datatype dataset with Datatype conversion"); - plist_id = H5Pcreate(H5P_FILE_ACCESS); VRFY((plist_id >= 0), "FAPL creation succeeded"); @@ -5344,9 +5419,9 @@ test_read_cmpd_filtered_dataset_type_conversion_shared(void) start[1] = 0; if (VERBOSE_MED) { - printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0), @@ -5386,7 +5461,7 @@ test_read_cmpd_filtered_dataset_type_conversion_shared(void) VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) (flat_dims[0] * sizeof(COMPOUND_C_DATATYPE)), MPI_BYTE, global_buf, recvcounts, displs, MPI_BYTE, comm)), "MPI_Allgatherv succeeded"); - VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (displs) HDfree(displs); @@ -5427,7 +5502,9 @@ test_write_serial_read_parallel(void) hid_t file_id = -1, dset_id = -1, plist_id = -1; hid_t filespace = -1; - if (MAINPROCESS) puts("Testing write file serially; read file in parallel"); + if (MAINPROCESS) HDputs("Testing write file serially; read file in parallel"); + + CHECK_CUR_FILTER_AVAIL(); dataset_dims[0] = (hsize_t) WRITE_SERIAL_READ_PARALLEL_NROWS; dataset_dims[1] = (hsize_t) WRITE_SERIAL_READ_PARALLEL_NCOLS; @@ -5527,7 +5604,7 @@ test_write_serial_read_parallel(void) VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); if (correct_buf) HDfree(correct_buf); @@ -5568,7 +5645,9 @@ test_write_parallel_read_serial(void) hid_t file_id = -1, dset_id = -1, plist_id = -1; hid_t filespace = -1, memspace = -1; - if (MAINPROCESS) puts("Testing write file in parallel; read serially"); + if (MAINPROCESS) HDputs("Testing write file in parallel; read serially"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -5636,9 +5715,9 @@ test_write_parallel_read_serial(void) offset[2] = 0; if (VERBOSE_MED) { - printf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], offset[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], offset[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n", mpi_rank, count[0], count[1], count[2], stride[0], stride[1], stride[2], offset[0], offset[1], offset[2], block[0], block[1], block[2]); - fflush(stdout); + HDfflush(stdout); } /* Select hyperslab in the file */ @@ -5707,7 +5786,7 @@ test_write_parallel_read_serial(void) VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) >= 0), "Dataset read succeeded"); - VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded"); @@ -5741,7 +5820,9 @@ test_shrinking_growing_chunks(void) hid_t file_id = -1, dset_id = -1, plist_id = -1; hid_t filespace = -1, memspace = -1; - if (MAINPROCESS) puts("Testing continually shrinking/growing chunks"); + if (MAINPROCESS) HDputs("Testing continually shrinking/growing chunks"); + + CHECK_CUR_FILTER_AVAIL(); /* Set up file access property list with parallel I/O access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -5803,9 +5884,9 @@ test_shrinking_growing_chunks(void) start[1] = 0; if (VERBOSE_MED) { - printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); - fflush(stdout); + HDfflush(stdout); } /* Select hyperslab in the file */ @@ -5868,8 +5949,8 @@ main(int argc, char** argv) if (mpi_size <= 0) { if (MAINPROCESS) { - printf("The Parallel Filters tests require at least 1 rank.\n"); - printf("Quitting...\n"); + HDprintf("The Parallel Filters tests require at least 1 rank.\n"); + HDprintf("Quitting...\n"); } MPI_Abort(MPI_COMM_WORLD, 1); @@ -5877,16 +5958,16 @@ main(int argc, char** argv) if (H5dont_atexit() < 0) { if (MAINPROCESS) { - printf("Failed to turn off atexit processing. Continue.\n"); + HDprintf("Failed to turn off atexit processing. Continue.\n"); } } H5open(); if (MAINPROCESS) { - printf("==========================\n"); - printf("Parallel Filters tests\n"); - printf("==========================\n\n"); + HDprintf("==========================\n"); + HDprintf("Parallel Filters tests\n"); + HDprintf("==========================\n\n"); } if (VERBOSE_MED) h5_show_hostname(); @@ -5942,9 +6023,9 @@ main(int argc, char** argv) VRFY((H5Fclose(file_id) >= 0), "File close succeeded"); if (MAINPROCESS) { - printf("\n=================================================================\n"); - printf("Re-running Parallel Filters tests with Fletcher32 checksum filter\n"); - printf("=================================================================\n\n"); + HDprintf("\n=================================================================\n"); + HDprintf("Re-running Parallel Filters tests with Fletcher32 checksum filter\n"); + HDprintf("=================================================================\n\n"); } for (i = 0; i < ARRAY_SIZE(tests); i++) { @@ -5959,12 +6040,12 @@ main(int argc, char** argv) if (nerrors) goto exit; - if (MAINPROCESS) puts("All Parallel Filters tests passed\n"); + if (MAINPROCESS) HDputs("All Parallel Filters tests passed\n"); exit: if (nerrors) if (MAINPROCESS) - printf("*** %d TEST ERROR%s OCCURRED ***\n", nerrors, + HDprintf("*** %d TEST ERROR%s OCCURRED ***\n", nerrors, nerrors > 1 ? "S" : ""); ALARM_OFF; diff --git a/testpar/t_pread.c b/testpar/t_pread.c index 19ccf56..0905d44 100644 --- a/testpar/t_pread.c +++ b/testpar/t_pread.c @@ -699,18 +699,11 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id) * with the opening and validation of the data contained * therein. * - * WARNING: This test uses fork() and execve(), and - * therefore will not run on Windows. - * * Return: Success: 0 - * * Failure: 1 * * Programmer: Richard Warren * 10/1/17 - * - * Modifications: - * *------------------------------------------------------------------------- */ diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 87d9056..69b66ae 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -547,6 +547,9 @@ int main(int argc, char **argv) AddTest("denseattr", test_dense_attr, NULL, "Store Dense Attributes", PARATESTFILE); + AddTest("noselcollmdread", test_partial_no_selection_coll_md_read, NULL, + "Collective Metadata read with some ranks having no selection", PARATESTFILE); + /* Display testing information */ TestInfo(argv[0]); diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 322cb9b..176574e 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -294,6 +294,7 @@ void file_image_daisy_chain_test(void); void compress_readAll(void); #endif /* H5_HAVE_FILTER_DEFLATE */ void test_dense_attr(void); +void test_partial_no_selection_coll_md_read(void); /* commonly used prototypes */ hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type); diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 7d41c8f..400039e 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_TOOLS C) -# -------------------------------------------------------------------- -# If testing was NOT enabled, then we need to build the tools library -# -------------------------------------------------------------------- add_subdirectory (lib) #-- Add the test sources diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index a03b60a..1596ea7 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -76,18 +76,6 @@ endif () ############################################################################## #----------------------------------------------------------------------------- -# Add file(s) to CMake Install -#----------------------------------------------------------------------------- -install ( - FILES - ${H5_TOOLS_LIB_HDRS} - DESTINATION - ${HDF5_INSTALL_INCLUDE_DIR} - COMPONENT - toolsheaders -) - -#----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 28b1f00..594bf51 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -274,12 +274,15 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2 int cmp; trav_table_t *table = NULL; size_t idx; + int ret_value = 0; h5difftrace("build_match_list start\n"); /* init */ trav_table_init(&table); - if (table == NULL) - H5TOOLS_INFO(H5E_tools_min_id_g, "Cannot create tarverse table"); + if (table == NULL) { + H5TOOLS_INFO(H5E_tools_min_id_g, "Cannot create traverse table"); + HGOTO_DONE(-1); + } /* * This is necessary for the case that given objects are group and * have different names (ex: obj1 is /grp1 and obj2 is /grp5). @@ -367,6 +370,7 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2 free_exclude_path_list (opts); +done: *table_out = table; h5difftrace("build_match_list finish\n"); } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 470df63..d93f7b0 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1241,10 +1241,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t H5T_class_t type_class; if((size = H5Tget_size(tid)) == 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed") if((type_class = H5Tget_class(tid)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed") switch (type_class) { case H5T_INTEGER: @@ -1264,7 +1264,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t bytes_wrote = HDfwrite(mem, 1, bytes_in, stream); if(bytes_wrote != bytes_in || (0 == bytes_wrote && HDferror(stream))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed") block_index -= (hsize_t)bytes_wrote; mem = mem + bytes_wrote; @@ -1287,7 +1287,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t if (s != NULL) size = HDstrlen(s); else - H5E_THROW(FAIL, H5E_tools_min_id_g, "NULL string"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "NULL string") } else { s = (char *) mem; @@ -1295,7 +1295,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char)); if (1 != HDfwrite(&tempuchar, sizeof(unsigned char), 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed") } /* i */ } /* for (block_index = 0; block_index < block_nelmts; block_index++) */ } @@ -1306,7 +1306,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t unsigned nmembs; if((snmembs = H5Tget_nmembers(tid)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers of compound failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers of compound failed") nmembs = (unsigned)snmembs; for (block_index = 0; block_index < block_nelmts; block_index++) { @@ -1322,7 +1322,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t if (render_bin_output(stream, container, memb, mem + offset, 1) < 0) { H5Tclose(memb); - H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output of compound member failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output of compound member failed") } H5Tclose(memb); @@ -1350,7 +1350,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t } else { H5Tclose(memb); - H5E_THROW(FAIL, H5E_tools_min_id_g, "calculate the number of array elements failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "calculate the number of array elements failed") } for (block_index = 0; block_index < block_nelmts; block_index++) { @@ -1358,7 +1358,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t /* dump the array element */ if (render_bin_output(stream, container, memb, mem, nelmts) < 0) { H5Tclose(memb); - H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed") } } H5Tclose(memb); @@ -1380,7 +1380,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t /* dump the array element */ if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) { H5Tclose(memb); - H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed") } } H5Tclose(memb); @@ -1426,7 +1426,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char*)_mem) + block_index * size; if (size != HDfwrite(mem, sizeof(char), size, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed") } /* end for */ break; @@ -1434,7 +1434,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t case H5T_NCLASSES: default: /* Badness */ - H5E_THROW(FAIL, H5E_tools_min_id_g, "bad type class"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "bad type class") break; } /* end switch */ @@ -1562,12 +1562,12 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, hid_t type_id = -1; if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) - H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed"); + H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed") nblocks = (hsize_t)snblocks; /* Print block information */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed") ndims = (unsigned)sndims; alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); @@ -1683,12 +1683,12 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, hid_t type_id = -1; if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0) - H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); + H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed") npoints = (hsize_t)snpoints; /* Allocate space for the dimension array */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed") ndims = (unsigned)sndims; if((dtype = H5Dget_type(region_id)) < 0) diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 69cecb0..a8b7e30 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -618,12 +618,12 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, HDassert(buffer); if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed"); + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed") nblocks = (hsize_t)snblocks; /* Print block information */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed") ndims = (unsigned)sndims; /* Render the region { element begin */ @@ -944,12 +944,12 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, HDassert(buffer); if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed") npoints = (hsize_t)snpoints; /* Allocate space for the dimension array */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed") ndims = (unsigned)sndims; /* Render the region { element begin */ @@ -1156,7 +1156,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c unsigned int vl_data = 0; /* contains VL datatypes */ if ((size_t) ctx->ndims > NELMTS(sm_size)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed") if (ctx->ndims > 0) init_acc_pos(ctx, total_size); @@ -1184,10 +1184,10 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c /* calculate the potential number of elements we're going to print */ if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed") if((ssm_nelmts = H5Sget_select_npoints(f_space)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed") sm_nelmts = (hsize_t)ssm_nelmts; if (sm_nelmts > 0) { @@ -1196,7 +1196,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c * a hyperslab whose size is manageable. */ if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed") if (ctx->ndims > 0) for (i = ctx->ndims; i > 0; --i) { @@ -1210,17 +1210,17 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c HDassert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/ if(NULL == (sm_buf = (unsigned char *)HDmalloc((size_t) sm_nelmts * p_type_nbytes))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine") if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed") if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &sm_nelmts, NULL) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed") /* read the data */ if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed") /* print the data */ flags = START_OF_DATA; @@ -1234,7 +1234,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c /* print array indices. get the lower bound of the hyperslab and calulate the element position at the start of hyperslab */ if(H5Sget_select_bounds(f_space, low, high) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed") elmtno = 0; for (i = 0; i < (size_t) ctx->ndims - 1; i++) { @@ -1259,13 +1259,13 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); if(H5Sclose(sm_space) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed") if(sm_buf) HDfree(sm_buf); sm_buf = NULL; } else - H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print"); + H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print") ctx->continuation++; @@ -1462,10 +1462,10 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/ if((f_space = H5Dget_space(dset)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed") if((sndims = H5Sget_simple_extent_ndims(f_space)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed") ctx->ndims = (unsigned)sndims; /* assume entire data space to be printed */ @@ -1474,7 +1474,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co ctx->p_min_idx[i] = 0; if(H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed") ctx->size_last_dim = total_size[ctx->ndims - 1]; /* Set the compound datatype field list for display */ @@ -1484,7 +1484,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co CATCH if(f_space >= 0 && H5Sclose(f_space) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed") return ret_value; } @@ -1540,15 +1540,15 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont f_space = H5Dget_space(dset); if (f_space == FAIL) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed") sndims = H5Sget_simple_extent_ndims(f_space); if(sndims < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed") ctx->ndims = (unsigned)sndims; if ((size_t)ctx->ndims > NELMTS(sm_size)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed") /* Assume entire data space to be printed */ if (ctx->ndims > 0) @@ -1629,7 +1629,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont /* Read the data */ if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) { - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed") } /* Print the data */ @@ -1667,9 +1667,9 @@ CATCH done: if(sm_space >= 0 && H5Sclose(sm_space) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed") if(f_space >= 0 && H5Sclose(f_space) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed") return ret_value; } @@ -1696,11 +1696,11 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte sndims = H5Sget_simple_extent_ndims(space); if(sndims < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed") ctx->ndims = (unsigned)sndims; if ((size_t) ctx->ndims > NELMTS(ctx->p_min_idx)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed") /* Assume entire data space to be printed */ for (i = 0; i < ctx->ndims; i++) @@ -1900,7 +1900,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ const char *order_s = NULL; /* byte order string */ if((type_class = H5Tget_class(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed") if (object_search && H5Tcommitted(type) > 0) { H5O_info_t oinfo; obj_t *obj = NULL; /* Found object */ @@ -2280,7 +2280,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ char *ttag; if(NULL == (ttag = H5Tget_tag(type))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed") ctx->need_prefix = TRUE; @@ -2300,7 +2300,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ case H5T_COMPOUND: if((snmembers = H5Tget_nmembers(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed") nmembers = (unsigned)snmembers; h5tools_str_append(buffer, "H5T_COMPOUND %s", h5tools_dump_header_format->structblockbegin); @@ -2344,7 +2344,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ case H5T_ENUM: if((super = H5Tget_super(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed") h5tools_str_append(buffer, "H5T_ENUM %s", h5tools_dump_header_format->enumblockbegin); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); @@ -2374,14 +2374,14 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ case H5T_VLEN: if((super = H5Tget_super(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed") h5tools_str_append(buffer, "H5T_VLEN %s ", h5tools_dump_header_format->vlenblockbegin); h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); if(H5Tclose(super) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed") h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockend); @@ -2456,10 +2456,10 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space) int i; if((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed") if((space_type = H5Sget_simple_extent_type(space)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed") switch(space_type) { case H5S_SCALAR: @@ -2544,15 +2544,15 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i ncols = info->line_ncols; if((snmembs = H5Tget_nmembers(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed") nmembs = (unsigned)snmembs; HDassert(nmembs > 0); if((super = H5Tget_super(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed") if((type_size = H5Tget_size(type)) <= 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed") /* * Determine what datatype to use for the native values. To simplify @@ -2565,7 +2565,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i dst_size = sizeof(long long); if((sign_type = H5Tget_sign(type))<0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed") if(H5T_SGN_NONE == sign_type) native = H5T_NATIVE_ULLONG; else @@ -2576,20 +2576,20 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i /* Get the names and raw values of all members */ if(NULL == (name = (char **)HDcalloc((size_t)nmembs, sizeof(char *)))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name") if(NULL == (value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(type_size, dst_size)))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value") for (i = 0; i < nmembs; i++) { name[i] = H5Tget_member_name(type, i); if(H5Tget_member_value(type, i, value + i * type_size) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed") } /* Convert values to native datatype */ if (native > 0) if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed") /* * Sort members by increasing value @@ -2646,7 +2646,7 @@ CATCH HDfree(value); if(super >= 0 && H5Tclose(super) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class") if(0 == nmembs) h5tools_str_append(buffer, "\n<empty>"); diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 3d595ca..3e8f1fe 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -1045,43 +1045,47 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } else { - unsigned nmembs; - unsigned j; + int retvalue; - nmembs = (unsigned)H5Tget_nmembers(type); - h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); + retvalue = H5Tget_nmembers(type); + if (retvalue >= 0) { + unsigned j; + unsigned nmembs = (unsigned)retvalue; - ctx->indent_level++; + h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); - for(j = 0; j < nmembs; j++) { - if(j) - h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK)); - else - h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); + ctx->indent_level++; - if(info->arr_linebreak) - h5tools_str_indent(str, info, ctx); + for(j = 0; j < nmembs; j++) { + if(j) + h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK)); + else + h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); - /* The name */ - name = H5Tget_member_name(type, j); - h5tools_str_append(str, OPT(info->cmpd_name, ""), name); - H5free_memory(name); + if(info->arr_linebreak) + h5tools_str_indent(str, info, ctx); - /* The value */ - offset = H5Tget_member_offset(type, j); - memb = H5Tget_member_type(type, j); + /* The name */ + name = H5Tget_member_name(type, j); + h5tools_str_append(str, OPT(info->cmpd_name, ""), name); + H5free_memory(name); - h5tools_str_sprint(str, info, container, memb, cp_vp + offset, ctx); + /* The value */ + offset = H5Tget_member_offset(type, j); + memb = H5Tget_member_type(type, j); - H5Tclose(memb); - } - ctx->indent_level--; + h5tools_str_sprint(str, info, container, memb, cp_vp + offset, ctx); - if(info->arr_linebreak) { - h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); - h5tools_str_indent(str, info, ctx); + H5Tclose(memb); + } + ctx->indent_level--; + + if(info->arr_linebreak) { + h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); + h5tools_str_indent(str, info, ctx); + } + h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); } - h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); } break; diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index a31ba3a..4c2bf1e 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -157,7 +157,7 @@ typedef struct { /* obtain link info from H5tools_get_symlink_info() */ typedef struct { H5O_type_t trg_type; /* OUT: target type */ - char *trg_path; /* OUT: target obj path. This must be freed + char *trg_path; /* OUT: target obj path. This must be freed * when used with H5tools_get_symlink_info() */ haddr_t objno; /* OUT: target object address */ unsigned long fileno; /* OUT: File number that target object is located in */ diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index 8f09c81..0c1521e 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -350,7 +350,7 @@ check_n_input( const char *str ) unsigned i; char c; - for (i = 0; i < strlen(str); i++) { + for (i = 0; i < HDstrlen(str); i++) { c = str[i]; if (i == 0) { if (c < 49 || c > 57) /* ascii values between 1 and 9 */ @@ -387,7 +387,7 @@ check_p_input( const char *str ) the atof return value on a hexadecimal input is different on some systems; we do a character check for this */ - if (strlen(str) > 2 && str[0] == '0' && str[1] == 'x') + if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x') return -1; x = atof(str); @@ -421,7 +421,7 @@ check_d_input( const char *str ) the atof return value on a hexadecimal input is different on some systems; we do a character check for this */ - if (strlen(str) > 2 && str[0] == '0' && str[1] == 'x') + if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x') return -1; x = atof(str); diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index a5f0369..b9e37e8 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -65,7 +65,7 @@ struct handler_t { * parameters. The long-named ones can be partially spelled. When * adding more, make sure that they don't clash with each other. */ -/* The following initialization makes use of C language cancatenating */ +/* The following initialization makes use of C language concatenating */ /* "xxx" "yyy" into "xxxyyy". */ static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RE*CM:O*N:vG:"; static struct long_options l_opts[] = { diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index e399d8f..ec76511 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -3438,8 +3438,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\""); for (i = 0; i < sz; i++) { - h5tools_str_append(&buffer, "%x ", *(unsigned int *) buf); - buf = (char *) buf + sizeof(unsigned int); + h5tools_str_append(&buffer, "%x ", *(unsigned int *) buf + (i * sizeof(unsigned int))); } h5tools_str_append(&buffer, "\""); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt index 62f269b..79a1316 100644 --- a/tools/src/h5format_convert/CMakeLists.txt +++ b/tools/src/h5format_convert/CMakeLists.txt @@ -34,4 +34,4 @@ if (HDF5_EXPORTED_TARGETS) ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) -endif ()
\ No newline at end of file +endif () diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index 0fc0289..b9ed9ce 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -226,81 +226,84 @@ convert(hid_t fid, const char *dname) /* Open the dataset */ if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) { - error_msg("unable to open dataset \"%s\"\n", dname); - h5tools_setstatus(EXIT_FAILURE); - goto error; - - } else if(verbose_g) - HDfprintf(stdout, "Open the dataset\n"); + error_msg("unable to open dataset \"%s\"\n", dname); + h5tools_setstatus(EXIT_FAILURE); + goto error; + } + else if(verbose_g) + HDfprintf(stdout, "Open the dataset\n"); /* Get the dataset's creation property list */ if((dcpl = H5Dget_create_plist(did)) < 0) { - error_msg("unable to get the dataset creation property list\n"); - h5tools_setstatus(EXIT_FAILURE); - goto error; + error_msg("unable to get the dataset creation property list\n"); + h5tools_setstatus(EXIT_FAILURE); + goto error; } /* Get the dataset's layout */ if((layout_type = H5Pget_layout(dcpl)) < 0) { - error_msg("unable to get the dataset layout type\n"); - h5tools_setstatus(EXIT_FAILURE); - goto error; - - } else if(verbose_g) - HDfprintf(stdout, "Retrieve the dataset's layout\n"); + error_msg("unable to get the dataset layout type\n"); + h5tools_setstatus(EXIT_FAILURE); + goto error; + } + else if(verbose_g) + HDfprintf(stdout, "Retrieve the dataset's layout\n"); switch(layout_type) { - case H5D_CHUNKED: - if(verbose_g) - HDfprintf(stdout, "Dataset is a chunked dataset\n"); - - /* Get the dataset's chunk indexing type */ - if(H5Dget_chunk_index_type(did, &idx_type) < 0) { - error_msg("unable to get the chunk indexing type for \"%s\"\n", dname); - h5tools_setstatus(EXIT_FAILURE); - goto error; - } else if(verbose_g) - HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n"); + case H5D_CHUNKED: + if(verbose_g) + HDfprintf(stdout, "Dataset is a chunked dataset\n"); + + /* Get the dataset's chunk indexing type */ + if(H5Dget_chunk_index_type(did, &idx_type) < 0) { + error_msg("unable to get the chunk indexing type for \"%s\"\n", dname); + h5tools_setstatus(EXIT_FAILURE); + goto error; + } + else if(verbose_g) + HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n"); + + if(idx_type == H5D_CHUNK_IDX_BTREE) { + if(verbose_g) + HDfprintf(stdout, "Dataset's chunk indexing type is already version 1 B-tree: no further action\n"); + h5tools_setstatus(EXIT_SUCCESS); + goto done; + } + else if (verbose_g) + HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n"); - if(idx_type == H5D_CHUNK_IDX_BTREE) { - if(verbose_g) - HDfprintf(stdout, "Dataset's chunk indexing type is already version 1 B-tree: no further action\n"); - h5tools_setstatus(EXIT_SUCCESS); - goto done; - } else if (verbose_g) - HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n"); break; - case H5D_CONTIGUOUS: - if(verbose_g) - HDfprintf(stdout, "Dataset is a contiguous dataset: downgrade layout version as needed\n"); - break; + case H5D_CONTIGUOUS: + if(verbose_g) + HDfprintf(stdout, "Dataset is a contiguous dataset: downgrade layout version as needed\n"); + break; - case H5D_COMPACT: - if(verbose_g) - HDfprintf(stdout, "Dataset is a compact dataset: downgrade layout version as needed\n"); - break; + case H5D_COMPACT: + if(verbose_g) + HDfprintf(stdout, "Dataset is a compact dataset: downgrade layout version as needed\n"); + break; - case H5D_VIRTUAL: - if(verbose_g) - HDfprintf(stdout, "No further action for virtual dataset\n"); - goto done; + case H5D_VIRTUAL: + if(verbose_g) + HDfprintf(stdout, "No further action for virtual dataset\n"); + goto done; - case H5D_NLAYOUTS: - case H5D_LAYOUT_ERROR: - default: - error_msg("unknown layout type for \"%s\"\n", dname); - h5tools_setstatus(EXIT_FAILURE); - goto error; + case H5D_NLAYOUTS: + case H5D_LAYOUT_ERROR: + default: + error_msg("unknown layout type for \"%s\"\n", dname); + h5tools_setstatus(EXIT_FAILURE); + goto error; } /* end switch */ /* No further action if it is a noop */ if(noop_g) { - if(verbose_g) - HDfprintf(stdout, "Not converting the dataset\n"); - h5tools_setstatus(EXIT_SUCCESS); - goto done; + if(verbose_g) + HDfprintf(stdout, "Not converting the dataset\n"); + h5tools_setstatus(EXIT_SUCCESS); + goto done; } if(verbose_g) @@ -308,51 +311,54 @@ convert(hid_t fid, const char *dname) /* Downgrade the dataset */ if(H5Dformat_convert(did) < 0) { - error_msg("unable to downgrade dataset \"%s\"\n", dname); - h5tools_setstatus(EXIT_FAILURE); - goto error; - } else if(verbose_g) - HDfprintf(stdout, "Done\n"); + error_msg("unable to downgrade dataset \"%s\"\n", dname); + h5tools_setstatus(EXIT_FAILURE); + goto error; + } + else if(verbose_g) + HDfprintf(stdout, "Done\n"); done: /* Close the dataset */ if(H5Dclose(did) < 0) { error_msg("unable to close dataset \"%s\"\n", dname); h5tools_setstatus(EXIT_FAILURE); - goto error; - } else if(verbose_g) - HDfprintf(stdout, "Close the dataset\n"); + goto error; + } + else if(verbose_g) + HDfprintf(stdout, "Close the dataset\n"); /* Close the dataset creation property list */ if(H5Pclose(dcpl) < 0) { error_msg("unable to close dataset creation property list\n"); h5tools_setstatus(EXIT_FAILURE); - goto error; - } else if(verbose_g) - printf("Close the dataset creation property list\n"); + goto error; + } + else if(verbose_g) + HDprintf("Close the dataset creation property list\n"); - return(0); + return 0; error: if(verbose_g) - HDfprintf(stdout, "Error encountered\n"); + HDfprintf(stdout, "Error encountered\n"); H5E_BEGIN_TRY { H5Pclose(dcpl); H5Dclose(did); } H5E_END_TRY; - return(-1); + return -1; } /* convert() */ /*------------------------------------------------------------------------- - * Function: convert_dsets_cb() + * Function: convert_dsets_cb() * - * Purpose: The callback routine from the traversal to convert the - * chunk indexing type of the dataset object. + * Purpose: The callback routine from the traversal to convert the + * chunk indexing type of the dataset object. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static int @@ -363,11 +369,11 @@ convert_dsets_cb(const char *path, const H5O_info_t *oi, const char *already_vis /* If the object has already been seen then just return */ if(NULL == already_visited) { if(oi->type == H5O_TYPE_DATASET) { - if(verbose_g) - HDfprintf(stdout, "Going to process dataset:%s...\n", path); - if(convert(fid, path) < 0) - goto error; - } /* end if */ + if(verbose_g) + HDfprintf(stdout, "Going to process dataset:%s...\n", path); + if(convert(fid, path) < 0) + goto error; + } /* end if */ } /* end if */ return 0; diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 76e78af..16c0d8c 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -88,6 +88,7 @@ int main(int argc, char *argv[]) const char *err7 = "Invalid type of data - %s.\n"; const char *err8 = "Invalid size of data - %s.\n"; const char *err9 = "Cannot specify more than 30 input files in one call to h5import.\n"; + const char *err10 = "Length of output file name limited to 255 chars.\n"; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); @@ -98,6 +99,9 @@ int main(int argc, char *argv[]) (void) HDsetvbuf(stderr, (char *) NULL, _IOLBF, 0); (void) HDsetvbuf(stdout, (char *) NULL, _IOLBF, 0); + /* Initialize the file structure to 0 */ + HDmemset(&opt, 0, sizeof(struct Options)); + if (argv[1] && (HDstrcmp("-V", argv[1]) == 0)) { print_version(PROGRAMNAME); HDexit(EXIT_SUCCESS); @@ -112,9 +116,6 @@ int main(int argc, char *argv[]) goto err; } - /* Initialize the file structure to 0 */ - HDmemset(&opt, 0, sizeof(struct Options)); - /* * parse the command line */ @@ -155,6 +156,10 @@ int main(int argc, char *argv[]) break; case 5: /* get outfile found */ + if (HDstrlen(argv[i]) > MAX_PATH_NAME_LENGTH) { + (void) HDfprintf(stderr, err10, argv[i]); + goto err; + } (void) HDstrcpy(opt.outfile, argv[i]); outfile_named = TRUE; break; @@ -494,7 +499,7 @@ static int readIntegerData(FILE *strm, struct Input *in) return (-1); } #ifdef H5DEBUGIMPORT - printf("readIntegerData %d (0x%.8X)\n", *in08, *in08); + HDprintf("readIntegerData %d (0x%.8X)\n", *in08, *in08); #endif } break; @@ -531,7 +536,7 @@ static int readIntegerData(FILE *strm, struct Input *in) */ *in16 = temp16; #ifdef H5DEBUGIMPORT - printf("readIntegerData %d (0x%.8X)\n", *in16, temp16); + HDprintf("readIntegerData %d (0x%.8X)\n", *in16, temp16); #endif } break; @@ -567,7 +572,7 @@ static int readIntegerData(FILE *strm, struct Input *in) */ *in32 = temp32; #ifdef H5DEBUGIMPORT - printf("readIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32); + HDprintf("readIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32); #endif } break; @@ -605,7 +610,7 @@ static int readIntegerData(FILE *strm, struct Input *in) */ *in64 = temp64; #ifdef H5DEBUGIMPORT - printf("readIntegerData %d (0x%.8X)\n", *in64, temp64); + HDprintf("readIntegerData %d (0x%.8X)\n", *in64, temp64); #endif } break; @@ -701,7 +706,7 @@ static int readUIntegerData(FILE *strm, struct Input *in) */ *in16 = temp16; #ifdef H5DEBUGIMPORT - printf("readUIntegerData %d (0x%.4X = 0x%.4X)\n", *in16, *in16, temp16); + HDprintf("readUIntegerData %d (0x%.4X = 0x%.4X)\n", *in16, *in16, temp16); #endif } break; @@ -737,7 +742,7 @@ static int readUIntegerData(FILE *strm, struct Input *in) */ *in32 = temp32; #ifdef H5DEBUGIMPORT - printf("readUIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32); + HDprintf("readUIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32); #endif } break; @@ -775,7 +780,7 @@ static int readUIntegerData(FILE *strm, struct Input *in) */ *in64 = temp64; #ifdef H5DEBUGIMPORT - printf("readUIntegerData %ld (0x%.8X = 0x%.8X)\n", *in64, *in64, temp64); + HDprintf("readUIntegerData %ld (0x%.8X = 0x%.8X)\n", *in64, *in64, temp64); #endif } break; @@ -855,7 +860,7 @@ static int readFloatData(FILE *strm, struct Input *in) */ *bfp32 = temp32; #ifdef H5DEBUGIMPORT - printf("readFloatData %ld (0x%.8X = 0x%.8X)\n", *bfp32, *bfp32, temp32); + HDprintf("readFloatData %ld (0x%.8X = 0x%.8X)\n", *bfp32, *bfp32, temp32); #endif } break; @@ -907,7 +912,7 @@ static int readFloatData(FILE *strm, struct Input *in) */ *bfp64 = temp64; #ifdef H5DEBUGIMPORT - printf("readFloatData %ld (0x%.16lX)\n", *bfp64, temp64); + HDprintf("readFloatData %ld (0x%.16lX)\n", *bfp64, temp64); #endif } break; @@ -1099,7 +1104,7 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id) *------------------------------------------------------------------------- */ #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING\n"); + HDprintf("processStrHDFData DATATYPE STRING\n"); #endif if ((type_id = H5Tcopy(H5T_C_S1)) < 0) @@ -1136,7 +1141,7 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id) } H5E_END_TRY; #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING groups created\n"); + HDprintf("processStrHDFData DATATYPE STRING groups created\n"); #endif if ((space_id = H5Screate_simple(in->rank, in->sizeOfDimension, NULL)) < 0) @@ -1149,7 +1154,7 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id) goto out; #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING ready to process strings\n"); + HDprintf("processStrHDFData DATATYPE STRING ready to process strings\n"); #endif line = 0; j = 0; @@ -1159,36 +1164,36 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id) str2 = NULL; str3 = NULL; #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING[%llu]={%s}\n", (unsigned long long)line, str1); + HDprintf("processStrHDFData DATATYPE STRING[%llu]={%s}\n", (unsigned long long)line, str1); #endif /* process string to remove the first and last quote char */ str2 = strchr(str1, '"'); if (str2 != NULL) { #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str2), str2); + HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2); #endif str2++; #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str2), str2); + HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2); #endif str3 = strrchr(str2, '"'); if (str3 != NULL) { #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str3), str3); + HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str3), str3); #endif *str3 = '\0'; #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str2), str2); + HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2); #endif - if(strlen(str2) > 0) { + if(HDstrlen(str2) > 0) { hid_t fspace_id; hsize_t start[1]; hsize_t count[1] = { 1 }; #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING[%llu] store %s\n", (unsigned long long)line, str2); + HDprintf("processStrHDFData DATATYPE STRING[%llu] store %s\n", (unsigned long long)line, str2); #endif if ((fspace_id = H5Dget_space(dset_id)) < 0) goto out; @@ -1210,7 +1215,7 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id) j++; } #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING eof reached\n"); + HDprintf("processStrHDFData DATATYPE STRING eof reached\n"); #endif /* close */ @@ -1223,7 +1228,7 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id) out: #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING error exit\n"); + HDprintf("processStrHDFData DATATYPE STRING error exit\n"); #endif /* disable error reporting */ H5E_BEGIN_TRY @@ -1366,9 +1371,9 @@ static int allocateFloatStorage(struct Input *in) static int processConfigurationFile(char *infile, struct Input *in) { FILE *strm = NULL; - char key[255]; + char key[MAX_PATH_NAME_LENGTH]; int kindex; - char temp[255]; + char temp[MAX_PATH_NAME_LENGTH]; int ival; int scanret; int retval = -1; @@ -1437,7 +1442,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } in->inputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif in->inputArchitecture = 0; /* default to NATIVE */ @@ -1446,64 +1451,64 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } - scanret = fscanf(strm, "%s", key); + scanret = fscanf(strm, "%254s", key); if((scanret == 1) && !HDstrcmp("HDF5", key)) { #ifdef H5DEBUGIMPORT int pndx; - printf("\nh5dump file\n"); + HDprintf("\nh5dump file\n"); #endif in->h5dumpInput = 1; - scanret = fscanf(strm, "%s", temp); /* filename */ - scanret = fscanf(strm, "%s", temp); /* start bracket */ - scanret = fscanf(strm, "%s", key); /* DATASET */ + scanret = fscanf(strm, "%254s", temp); /* filename */ + scanret = fscanf(strm, "%254s", temp); /* start bracket */ + scanret = fscanf(strm, "%254s", key); /* DATASET */ while (scanret == 1) { if(!HDstrcmp("DATASET", key)) { /* PATH */ #ifdef H5DEBUGIMPORT - printf("h5dump DATASET key\n"); + HDprintf("h5dump DATASET key\n"); #endif if (in->configOptionVector[PATH] == 1) { (void) HDfprintf(stderr, err3a, infile); goto error; } - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASET %s found\n", temp); + HDprintf("h5dump DATASET %s found\n", temp); #endif if (parsePathInfo(&in->path, temp) == -1) { (void) HDfprintf(stderr, err3b, infile); goto error; } in->configOptionVector[PATH] = 1; - scanret = fscanf(strm, "%s", temp); /* start bracket */ + scanret = fscanf(strm, "%254s", temp); /* start bracket */ #ifdef H5DEBUGIMPORT - printf("h5dump DATASET %s found\n", temp); + HDprintf("h5dump DATASET %s found\n", temp); #endif } /* if(!HDstrcmp("DATASET", key)) PATH */ else if(!HDstrcmp("DATATYPE", key)) { /* INPUT-CLASS */ #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE key\n"); + HDprintf("h5dump DATATYPE key\n"); #endif if (in->configOptionVector[INPUT_CLASS] == 1) { (void) HDfprintf(stderr, err4a, infile); goto error; } - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE %s found\n", temp); + HDprintf("h5dump DATATYPE %s found\n", temp); #endif if ((kindex = getInputClassType(in, temp)) == -1) { (void) HDfprintf(stderr, err4b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE type %d inputClass\n", in->inputClass); + HDprintf("h5dump DATATYPE type %d inputClass\n", in->inputClass); #endif in->configOptionVector[INPUT_CLASS] = 1; @@ -1519,34 +1524,34 @@ static int processConfigurationFile(char *infile, struct Input *in) in->outputClass = 2; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE type %d outputClass\n", in->outputClass); + HDprintf("h5dump DATATYPE type %d outputClass\n", in->outputClass); #endif if(in->inputClass == 5) { /* STRING */ int get_next_prop = 1; in->outputClass = -1; #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING found\n"); + HDprintf("h5dump DATATYPE STRING found\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING %s found\n", temp); + HDprintf("h5dump DATATYPE STRING %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* string properties */ + if (fscanf(strm, "%254s", temp) != 1) { /* string properties */ (void) HDfprintf(stderr, "%s", err18); goto error; } while (get_next_prop) { if(!HDstrcmp("STRSIZE", temp)) { /* STRSIZE */ - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err19); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING STRSIZE %s found\n", temp); + HDprintf("h5dump DATATYPE STRING STRSIZE %s found\n", temp); #endif if (HDstrcmp("H5T_VARIABLE;", temp)) { char *more = temp; @@ -1556,44 +1561,44 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING %d InputSize\n", in->inputSize); + HDprintf("h5dump DATATYPE STRING %d InputSize\n", in->inputSize); #endif } } else if(!HDstrcmp("STRPAD", temp)) { /* STRPAD */ - if (fscanf(strm, "%s", temp) != 1) { /* STRPAD type */ + if (fscanf(strm, "%254s", temp) != 1) { /* STRPAD type */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING STRPAD %s found\n", temp); + HDprintf("h5dump DATATYPE STRING STRPAD %s found\n", temp); #endif } else if(!HDstrcmp("CSET", key)) { /* CSET */ - if (fscanf(strm, "%s", temp) != 1) { /* CSET type */ + if (fscanf(strm, "%254s", temp) != 1) { /* CSET type */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING CSET %s found\n", temp); + HDprintf("h5dump DATATYPE STRING CSET %s found\n", temp); #endif } else if(!HDstrcmp("CTYPE", temp)) { /* CTYPE */ - if (fscanf(strm, "%s", temp) != 1) { /* CTYPE type */ + if (fscanf(strm, "%254s", temp) != 1) { /* CTYPE type */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING CTYPE %s found\n", temp); + HDprintf("h5dump DATATYPE STRING CTYPE %s found\n", temp); #endif } /* if(!HDstrcmp("CSET", key)) */ - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING %s found\n", temp); + HDprintf("h5dump DATATYPE STRING %s found\n", temp); #endif if(!HDstrcmp("}", temp)) { /* end bracket */ get_next_prop = 0; @@ -1605,9 +1610,9 @@ static int processConfigurationFile(char *infile, struct Input *in) hsize_t temp_dims[MAX_NUM_DIMENSION]; #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE key\n"); + HDprintf("h5dump DATASPACE key\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1621,42 +1626,42 @@ static int processConfigurationFile(char *infile, struct Input *in) else if(!HDstrcmp("SIMPLE", temp)) { /* SIMPLE */ int icount = 0; #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE found\n"); + HDprintf("h5dump DATASPACE SIMPLE found\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif if(!HDstrcmp("(", temp)) { /* start paren */ int get_next_dim = 1; int i = 0; - if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif while (get_next_dim) { char *more = temp; temp_dims[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif if(!HDstrcmp(")", temp)) { /* end paren */ in->rank = ++icount; @@ -1676,17 +1681,17 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %ld rank\n", in->rank); + HDprintf("h5dump DATASPACE SIMPLE %ld rank\n", in->rank); #endif for (i = 0; i < in->rank; i++) { in->sizeOfDimension[i] = temp_dims[i]; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE dims[%ld]:", in->rank); + HDprintf("h5dump DATASPACE SIMPLE dims[%ld]:", in->rank); for (pndx = 0; pndx < in->rank; pndx++) { - printf(" %ld", in->sizeOfDimension[pndx]); + HDprintf(" %ld", in->sizeOfDimension[pndx]); } - printf("\n"); + HDprintf("\n"); #endif in->configOptionVector[DIM] = 1; } /* if(!HDstrcmp("(", key)) start paren */ @@ -1694,41 +1699,41 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err5b, infile); goto error; } - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif if(!HDstrcmp("/", temp)) { /* / max dims */ if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { goto error; } - if (fscanf(strm, "%s", temp) != 1) { /* start paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif if(!HDstrcmp("(", temp)) { /* start paren */ int get_next_dim = 1; int i = 0; #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE process max dim values\n"); + HDprintf("h5dump DATASPACE SIMPLE process max dim values\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* max dim with optional comma */ + if (fscanf(strm, "%254s", temp) != 1) { /* max dim with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif while (get_next_dim) { #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE get max dim value\n"); + HDprintf("h5dump DATASPACE SIMPLE get max dim value\n"); #endif if(!HDstrcmp("H5S_UNLIMITED", temp) || !HDstrcmp("H5S_UNLIMITED,", temp)) { /* unlimited */ in->maxsizeOfDimension[i] = H5S_UNLIMITED; @@ -1738,40 +1743,40 @@ static int processConfigurationFile(char *infile, struct Input *in) char *more = temp; in->maxsizeOfDimension[i] = HDstrtoull(more, &more, 10); } - if (fscanf(strm, "%s", temp) != 1) { /* max dim or end paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* max dim or end paren */ (void) HDfprintf(stderr, err16c, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif if(!HDstrcmp(")", temp)) { /* end paren */ get_next_dim = 0; } else { /* comma */ i++; - if (i > MAX_NUM_DIMENSION) { + if (i >= MAX_NUM_DIMENSION) { (void) HDfprintf(stderr, "Invalid value for rank.\n"); goto error; } } } /* while (get_next_dim) */ #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE maxdims[%ld]:", in->rank); + HDprintf("h5dump DATASPACE SIMPLE maxdims[%ld]:", in->rank); for (pndx = 0; pndx < in->rank; pndx++) { - printf(" %ld", in->maxsizeOfDimension[pndx]); + HDprintf(" %ld", in->maxsizeOfDimension[pndx]); } - printf("\n"); - printf("h5dump DATASPACE SIMPLE get max dim finished\n"); + HDprintf("\n"); + HDprintf("h5dump DATASPACE SIMPLE get max dim finished\n"); #endif } /* if(!HDstrcmp("(", key)) start paren */ else { (void) HDfprintf(stderr, err16c, infile); goto error; } - scanret = fscanf(strm, "%s", temp); /* end bracket */ + scanret = fscanf(strm, "%254s", temp); /* end bracket */ #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif } /* if(!HDstrcmp("/", key)) max dims separator */ } /* else if(!HDstrcmp("SIMPLE", key)) */ @@ -1782,54 +1787,54 @@ static int processConfigurationFile(char *infile, struct Input *in) } /* else if(!HDstrcmp("DATASPACE", key)) RANK and DIMENSIONS */ else if(!HDstrcmp("STORAGE_LAYOUT", key)) { /* CHUNKED-DIMENSION-SIZES */ #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT key\n"); + HDprintf("h5dump STORAGE_LAYOUT key\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT %s found\n", temp); + HDprintf("h5dump STORAGE_LAYOUT %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* CHUNKED */ + if (fscanf(strm, "%254s", temp) != 1) { /* CHUNKED */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT %s found\n", temp); + HDprintf("h5dump STORAGE_LAYOUT %s found\n", temp); #endif if(!HDstrcmp("CHUNKED", temp)) { /* CHUNKED */ if ((in->sizeOfChunk = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { (void) HDfprintf(stderr, "Unable to allocate dynamic memory.\n"); goto error; } - if (fscanf(strm, "%s", temp) != 1) { /* start paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); + HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); #endif if(!HDstrcmp("(", temp)) { /* start paren */ int get_next_dim = 1; int icount = 0; - if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); + HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); #endif while (get_next_dim) { char *more = temp; in->sizeOfChunk[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); + HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); #endif if(!HDstrcmp(")", temp)) { /* end paren */ in->configOptionVector[RANK] = 1; @@ -1844,11 +1849,11 @@ static int processConfigurationFile(char *infile, struct Input *in) } } /* while (get_next_dim) */ #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT CHUNKED dims [%ld]:", in->rank); + HDprintf("h5dump STORAGE_LAYOUT CHUNKED dims [%ld]:", in->rank); for (pndx = 0; pndx < in->rank; pndx++) { - printf(" %ld", in->sizeOfChunk[pndx]); + HDprintf(" %ld", in->sizeOfChunk[pndx]); } - printf("\n"); + HDprintf("\n"); #endif in->configOptionVector[DIM] = 1; } /* if(!HDstrcmp("(", key)) start paren */ @@ -1856,12 +1861,12 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err5b, infile); goto error; } - if (fscanf(strm, "%s", temp) != 1) { /* SIZE */ + if (fscanf(strm, "%254s", temp) != 1) { /* SIZE */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); + HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); #endif if(!HDstrcmp("SIZE", temp)) { /* SIZE */ if (fscanf(strm, "%d", (&ival)) != 1) { @@ -1869,16 +1874,16 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT CHUNKED SIZE %d found\n", ival); + HDprintf("h5dump STORAGE_LAYOUT CHUNKED SIZE %d found\n", ival); #endif } while (HDstrcmp("}", temp)) { - if (fscanf(strm, "%s", temp) != 1) { /* end bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); + HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); #endif } in->configOptionVector[CHUNK] = 1; @@ -1886,135 +1891,135 @@ static int processConfigurationFile(char *infile, struct Input *in) } /* else if(!HDstrcmp("STORAGE_LAYOUT", key)) CHUNKED-DIMENSION-SIZES */ else if(!HDstrcmp("FILTERS", key)) { /* FILTERS */ #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS key\n"); + HDprintf("h5dump FILTERS key\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS %s found\n", temp); + HDprintf("h5dump FILTERS %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS %s found\n", temp); + HDprintf("h5dump FILTERS %s found\n", temp); #endif if(!HDstrcmp("COMPRESSION", temp)) { /* COMPRESSION */ #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS COMPRESSION found\n"); + HDprintf("h5dump FILTERS COMPRESSION found\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* DEFLATE */ + if (fscanf(strm, "%254s", temp) != 1) { /* DEFLATE */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS COMPRESSION %s found\n", temp); + HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* bgin bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* bgin bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS COMPRESSION %s found\n", temp); + HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* LEVEL */ + if (fscanf(strm, "%254s", temp) != 1) { /* LEVEL */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS COMPRESSION %s found\n", temp); + HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif if (fscanf(strm, "%d", (&ival)) != 1) { (void) HDfprintf(stderr, "%s", err19); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS COMPRESSION LEVEL %d found\n", ival); + HDprintf("h5dump FILTERS COMPRESSION LEVEL %d found\n", ival); #endif in->compressionParam = ival; - if (fscanf(strm, "%s", temp) != 1) { /* end bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS COMPRESSION %s found\n", temp); + HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif in->compressionType = 0; /* ONLY GZIP supported */ in->configOptionVector[COMPRESS] = 1; } else if(!HDstrcmp("CONTIGUOUS", temp)) { /* CONTIGUOUS */ #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS CONTIGUOUS found\n"); + HDprintf("h5dump FILTERS CONTIGUOUS found\n"); #endif in->configOptionVector[COMPRESS] = 0; } else if(!HDstrcmp("NONE", temp)) { /* NONE */ #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS NONE found\n"); + HDprintf("h5dump FILTERS NONE found\n"); #endif in->configOptionVector[COMPRESS] = 0; } - if (fscanf(strm, "%s", temp) != 1) { /* end bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS %s found\n", temp); + HDprintf("h5dump FILTERS %s found\n", temp); #endif } else if(!HDstrcmp("SUBSET", key)) { /* reduce dimensions */ hsize_t temp_dims[MAX_NUM_DIMENSION]; int get_next_prop = 1; #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET key\n"); + HDprintf("h5dump SUBSET key\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err20, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET %s found\n", temp); + HDprintf("h5dump SUBSET %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* SUBSET keyword */ + if (fscanf(strm, "%254s", temp) != 1) { /* SUBSET keyword */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET %s found\n", temp); + HDprintf("h5dump SUBSET %s found\n", temp); #endif while (get_next_prop) { if(!HDstrcmp("COUNT", temp)) { /* COUNT */ int icount = 0; - if (fscanf(strm, "%s", temp) != 1) { /* start paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET %s found\n", temp); + HDprintf("h5dump SUBSET %s found\n", temp); #endif if(!HDstrcmp("(", temp)) { /* start paren */ int get_next_dim = 1; int i = 0; - if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET COUNT [%s] found\n", temp); + HDprintf("h5dump SUBSET COUNT [%s] found\n", temp); #endif while (get_next_dim) { char *more = temp; temp_dims[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET COUNT %s found\n", temp); + HDprintf("h5dump SUBSET COUNT %s found\n", temp); #endif if(!HDstrcmp(");", temp)) { /* end paren */ in->rank = ++icount; @@ -2023,7 +2028,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } else { /* Dimension */ icount++; - if (icount > MAX_NUM_DIMENSION) { + if (icount >= MAX_NUM_DIMENSION) { (void) HDfprintf(stderr, "Invalid value for rank.\n"); goto error; } @@ -2033,44 +2038,44 @@ static int processConfigurationFile(char *infile, struct Input *in) in->sizeOfDimension[i] = temp_dims[i]; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET COUNT dims: [%d]", in->rank); + HDprintf("h5dump SUBSET COUNT dims: [%d]", in->rank); for (pndx = 0; pndx < in->rank; pndx++) { - printf(" %ld", in->sizeOfDimension[pndx]); + HDprintf(" %ld", in->sizeOfDimension[pndx]); } - printf("\n"); + HDprintf("\n"); #endif in->configOptionVector[DIM] = 1; } /* if(!HDstrcmp("(", key)) start paren */ } /* if(!HDstrcmp("COUNT", temp)) COUNT */ if(!HDstrcmp("BLOCK", temp)) { /* BLOCK */ int icount = 0; - if (fscanf(strm, "%s", temp) != 1) { /* start paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET %s found\n", temp); + HDprintf("h5dump SUBSET %s found\n", temp); #endif if(!HDstrcmp("(", temp)) { /* start paren */ int get_next_dim = 1; int i = 0; - if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET BLOCK [%s] found\n", temp); + HDprintf("h5dump SUBSET BLOCK [%s] found\n", temp); #endif while (get_next_dim) { char *more = temp; temp_dims[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET BLOCK %s found\n", temp); + HDprintf("h5dump SUBSET BLOCK %s found\n", temp); #endif if(!HDstrcmp(");", temp)) { /* end paren */ in->rank = ++icount; @@ -2089,21 +2094,21 @@ static int processConfigurationFile(char *infile, struct Input *in) in->sizeOfDimension[i] = in->sizeOfDimension[i] * temp_dims[i]; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET BLOCK dims: [%d]", in->rank); + HDprintf("h5dump SUBSET BLOCK dims: [%d]", in->rank); for (pndx = 0; pndx < in->rank; pndx++) { - printf(" %ld", in->sizeOfDimension[pndx]); + HDprintf(" %ld", in->sizeOfDimension[pndx]); } - printf("\n"); + HDprintf("\n"); #endif in->configOptionVector[DIM] = 1; } /* if(!HDstrcmp("(", key)) start paren */ } /* if(!HDstrcmp("BLOCK", temp)) BLOCK */ - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET %s found\n", temp); + HDprintf("h5dump SUBSET %s found\n", temp); #endif if(!HDstrcmp("}", temp)) { /* end bracket */ get_next_prop = 0; @@ -2112,40 +2117,40 @@ static int processConfigurationFile(char *infile, struct Input *in) } /* else if(!HDstrcmp("SUBSET", key)) */ else if(!HDstrcmp("DATA", key)) { /* FINSHED */ #ifdef H5DEBUGIMPORT - printf("h5dump DATA key\n"); + HDprintf("h5dump DATA key\n"); #endif scanret = 0; break; } - scanret = fscanf(strm, "%s", key); + scanret = fscanf(strm, "%254s", key); } #ifdef H5DEBUGIMPORT - printf("h5dump path"); + HDprintf("h5dump path"); for (pndx = 0; pndx < in->path.count; pndx++) { - printf(" : %s", in->path.group[pndx]); - } - printf("\n"); - printf("h5dump inputClass=%d\n", in->inputClass); - printf("h5dump inputSize=%d\n", in->inputSize); - printf("h5dump inputArchitecture=%d\n", in->inputArchitecture); - printf("h5dump inputByteOrder=%d\n", in->inputByteOrder); - printf("h5dump rank=%d\n", in->rank); - printf("h5dump outputClass=%d\n", in->outputClass); - printf("h5dump outputSize=%d\n", in->outputSize); - printf("h5dump outputArchitecture=%d\n", in->outputArchitecture); - printf("h5dump outputByteOrder=%d\n", in->outputByteOrder); - printf("h5dump compressionType=%d\n", in->compressionType); - printf("h5dump compressionParam=%d\n", in->compressionParam); - printf("h5dump externFilename=%s\n", in->externFilename); - printf("h5dump sizeOfDimensions:\n"); + HDprintf(" : %s", in->path.group[pndx]); + } + HDprintf("\n"); + HDprintf("h5dump inputClass=%d\n", in->inputClass); + HDprintf("h5dump inputSize=%d\n", in->inputSize); + HDprintf("h5dump inputArchitecture=%d\n", in->inputArchitecture); + HDprintf("h5dump inputByteOrder=%d\n", in->inputByteOrder); + HDprintf("h5dump rank=%d\n", in->rank); + HDprintf("h5dump outputClass=%d\n", in->outputClass); + HDprintf("h5dump outputSize=%d\n", in->outputSize); + HDprintf("h5dump outputArchitecture=%d\n", in->outputArchitecture); + HDprintf("h5dump outputByteOrder=%d\n", in->outputByteOrder); + HDprintf("h5dump compressionType=%d\n", in->compressionType); + HDprintf("h5dump compressionParam=%d\n", in->compressionParam); + HDprintf("h5dump externFilename=%s\n", in->externFilename); + HDprintf("h5dump sizeOfDimensions:\n"); for (pndx = 0; pndx < in->rank; pndx++) { - printf(" %ld\n", in->sizeOfDimension[pndx]); + HDprintf(" %ld\n", in->sizeOfDimension[pndx]); } #endif } else { #ifdef H5DEBUGIMPORT - printf("original option keyword parsing\n"); + HDprintf("original option keyword parsing\n"); #endif while (scanret == 1) { if ((kindex = mapKeywordToIndex(key)) == -1) { @@ -2158,7 +2163,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err3a, infile); goto error; } - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -2175,7 +2180,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -2203,7 +2208,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err5a, infile); goto error; } - if (fscanf(strm, "%d", (&ival)) != 1) { + if (fscanf(strm, "%254d", (&ival)) != 1) { (void) HDfprintf(stderr, "%s", err19); goto error; } @@ -2400,7 +2405,7 @@ static int processConfigurationFile(char *infile, struct Input *in) default: break; } - scanret = fscanf(strm, "%s", key); + scanret = fscanf(strm, "%254s", key); } /* @@ -2571,7 +2576,7 @@ static int getOutputClass(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output class.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -2655,7 +2660,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2676,7 +2681,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2697,7 +2702,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2718,7 +2723,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2739,7 +2744,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2760,7 +2765,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2781,7 +2786,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2802,7 +2807,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2823,7 +2828,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -2844,7 +2849,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -2865,7 +2870,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -2886,7 +2891,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -2907,7 +2912,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -2928,7 +2933,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -2949,7 +2954,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -2970,7 +2975,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -3111,7 +3116,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 3; @@ -3132,7 +3137,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 3; @@ -3153,7 +3158,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 3; @@ -3174,7 +3179,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 3; @@ -3250,7 +3255,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3269,7 +3274,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3288,7 +3293,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3307,7 +3312,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3326,7 +3331,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3345,7 +3350,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3364,7 +3369,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3383,7 +3388,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3422,9 +3427,9 @@ static int getInputClassType(struct Input *in, char * buffer) if (in->configOptionVector[OUTPUT_SIZE] == 0) in->outputSize = in->inputSize; #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE InClass %d inputSize\n", in->inputSize); - printf("h5dump DATATYPE InClass %d outputSize\n", in->outputSize); - printf("h5dump DATATYPE InClass %d outputArchitecture\n", in->outputArchitecture); + HDprintf("h5dump DATATYPE InClass %d inputSize\n", in->inputSize); + HDprintf("h5dump DATATYPE InClass %d outputSize\n", in->outputSize); + HDprintf("h5dump DATATYPE InClass %d outputArchitecture\n", in->outputArchitecture); #endif in->inputClass = kindex; @@ -3464,7 +3469,7 @@ static int getInputByteOrder(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for input byte-order.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -3595,7 +3600,7 @@ static int getOutputArchitecture(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output architecture.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -3627,7 +3632,7 @@ static int getOutputByteOrder(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output byte-order.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -3658,7 +3663,7 @@ static int getCompressionType(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for compression.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -3722,7 +3727,7 @@ static int getExternalFilename(struct Input *in, FILE *strm) char temp[255]; const char *err1 = "Unable to get 'string' value.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -4631,7 +4636,7 @@ static int process(struct Options *opt) intype = createInputDataType(in); outtype = createOutputDataType(in); #ifdef H5DEBUGIMPORT - printf("process intype %ld outtype %ld\n", intype, outtype); + HDprintf("process intype %ld outtype %ld\n", intype, outtype); #endif /* create property list */ diff --git a/tools/src/h5import/h5import.h b/tools/src/h5import/h5import.h index c55717d..00c41f6 100644 --- a/tools/src/h5import/h5import.h +++ b/tools/src/h5import/h5import.h @@ -102,8 +102,8 @@ struct Input struct infilesformat { - char datafile[255]; - char configfile[255]; + char datafile[MAX_PATH_NAME_LENGTH]; + char configfile[MAX_PATH_NAME_LENGTH]; struct Input in; int config; /* Configfile present? No - 0. Yes - 1 */ }; diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c index 01ba4af..8222e06 100644 --- a/tools/src/h5jam/h5jam.c +++ b/tools/src/h5jam/h5jam.c @@ -221,7 +221,7 @@ main (int argc, const char *argv[]) /* Initialize h5tools lib */ h5tools_init(); - parse_command_line (argc, argv); + parse_command_line(argc, argv); if (ub_file == NULL) { /* no user block */ @@ -230,7 +230,7 @@ main (int argc, const char *argv[]) leave (EXIT_FAILURE); } - testval = H5Fis_hdf5 (ub_file); + testval = H5Fis_accessible(ub_file, H5P_DEFAULT); if (testval > 0) { error_msg("-u <user_file> cannot be HDF5 file, but it appears to be an HDF5 file.\n"); @@ -244,7 +244,7 @@ main (int argc, const char *argv[]) leave (EXIT_FAILURE); } - testval = H5Fis_hdf5 (input_file); + testval = H5Fis_accessible(input_file, H5P_DEFAULT); if (testval <= 0) { error_msg("Input HDF5 file \"%s\" is not HDF5 format.\n", input_file); @@ -252,21 +252,21 @@ main (int argc, const char *argv[]) leave (EXIT_FAILURE); } - ifile = H5Fopen (input_file, H5F_ACC_RDONLY, H5P_DEFAULT); + ifile = H5Fopen(input_file, H5F_ACC_RDONLY, H5P_DEFAULT); if (ifile < 0) { error_msg("Can't open input HDF5 file \"%s\"\n", input_file); leave (EXIT_FAILURE); } - plist = H5Fget_create_plist (ifile); + plist = H5Fget_create_plist(ifile); if (plist < 0) { error_msg("Can't get file creation plist for file \"%s\"\n", input_file); H5Fclose(ifile); leave (EXIT_FAILURE); } - status = H5Pget_userblock (plist, &usize); + status = H5Pget_userblock(plist, &usize); if (status < 0) { error_msg("Can't get user block for file \"%s\"\n", input_file); H5Pclose(plist); @@ -330,7 +330,7 @@ main (int argc, const char *argv[]) } } - newubsize = compute_user_block_size ((hsize_t) fsize); + newubsize = compute_user_block_size((hsize_t) fsize); startub = usize; @@ -345,22 +345,22 @@ main (int argc, const char *argv[]) else { /* add new ub to current ublock, pad to new offset */ newubsize += usize; - newubsize = compute_user_block_size ((hsize_t) newubsize); + newubsize = compute_user_block_size((hsize_t) newubsize); } } /* copy the HDF5 from starting at usize to starting at newubsize: * makes room at 'from' for new ub */ /* if no current ub, usize is 0 */ - copy_some_to_file (h5fid, ofid, usize, newubsize, (ssize_t) (h5fsize - usize)); + copy_some_to_file(h5fid, ofid, usize, newubsize, (ssize_t) (h5fsize - usize)); /* copy the old ub to the beginning of the new file */ if (!do_clobber) { - where = copy_some_to_file (h5fid, ofid, (hsize_t) 0, (hsize_t) 0, (ssize_t) usize); + where = copy_some_to_file(h5fid, ofid, (hsize_t) 0, (hsize_t) 0, (ssize_t) usize); } /* copy the new ub to the end of the ub */ - where = copy_some_to_file (ufid, ofid, (hsize_t) 0, startub, (ssize_t) - 1); + where = copy_some_to_file(ufid, ofid, (hsize_t) 0, startub, (ssize_t) - 1); /* pad the ub */ if(write_pad(ofid, where, &where) < 0) { @@ -372,18 +372,18 @@ main (int argc, const char *argv[]) } /* end if */ if(ub_file) - HDfree (ub_file); + HDfree(ub_file); if(input_file) - HDfree (input_file); + HDfree(input_file); if(output_file) - HDfree (output_file); + HDfree(output_file); if(ufid >= 0) - HDclose (ufid); + HDclose(ufid); if(h5fid >= 0) - HDclose (h5fid); + HDclose(h5fid); if(ofid >= 0) - HDclose (ofid); + HDclose(ofid); return h5tools_getstatus(); } diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c index ffe2aca..aa893f9 100644 --- a/tools/src/h5jam/h5unjam.c +++ b/tools/src/h5jam/h5unjam.c @@ -229,7 +229,7 @@ main(int argc, const char *argv[]) goto done; } - testval = H5Fis_hdf5(input_file); + testval = H5Fis_accessible(input_file, H5P_DEFAULT); if (testval <= 0) { error_msg("Input HDF5 file \"%s\" is not HDF\n", input_file); diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index b279cf9..0567269 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -1422,9 +1422,9 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size) } /* end while */ done: - if (infid > 0) + if (infid >= 0) HDclose(infid); - if (outfid > 0) + if (outfid >= 0) HDclose(outfid); return ret_value; @@ -1497,7 +1497,7 @@ print_user_block(const char *filename, hid_t fid) } done: - if (fh > 0) + if (fh >= 0) HDclose(fh); return; diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 8f0178f..dec25f9 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -707,6 +707,8 @@ int main(int argc, const char **argv) void *edata; void *tools_edata; + HDmemset(&options, 0, sizeof(pack_opt_t)); + h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index ff67cf1..8109b93 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -24,11 +24,11 @@ /* Parameters to control statistics gathered */ /* Default threshold for small groups/datasets/attributes */ -#define DEF_SIZE_SMALL_GROUPS 10 -#define DEF_SIZE_SMALL_DSETS 10 -#define DEF_SIZE_SMALL_ATTRS 10 +#define DEF_SIZE_SMALL_GROUPS 10 +#define DEF_SIZE_SMALL_DSETS 10 +#define DEF_SIZE_SMALL_ATTRS 10 -#define SIZE_SMALL_SECTS 10 +#define SIZE_SMALL_SECTS 10 #define H5_NFILTERS_IMPL 8 /* Number of currently implemented filters + one to accommodate for user-define filters + one @@ -83,7 +83,7 @@ typedef struct iter_t { hsize_t max_dset_dims; /* Maximum dimension size of dataset */ unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */ unsigned long dset_layouts[H5D_NLAYOUTS]; /* Type of storage for each dataset */ - unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */ + unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */ unsigned long dset_ntypes; /* Number of diff. dataset datatypes found */ dtype_info_t *dset_type_info; /* Pointer to dataset datatype information found */ unsigned dset_dim_nbins; /* Number of bins for dataset dimensions */ @@ -103,9 +103,9 @@ typedef struct iter_t { hsize_t super_ext_size; /* superblock extension size */ hsize_t ublk_size; /* user block size (if exists) */ H5F_fspace_strategy_t fs_strategy; /* File space management strategy */ - hbool_t fs_persist; /* Free-space persist or not */ + hbool_t fs_persist; /* Free-space persist or not */ hsize_t fs_threshold; /* Free-space section threshold */ - hsize_t fsp_size; /* File space page size */ + hsize_t fsp_size; /* File space page size */ hsize_t free_space; /* Amount of freespace in the file */ hsize_t free_hdr; /* Size of free space manager metadata in the file */ unsigned long num_small_sects[SIZE_SMALL_SECTS]; /* Size of small free-space sections */ @@ -136,9 +136,9 @@ static int display_dset_metadata = FALSE; /* display file space info f static int display_object = FALSE; /* not implemented yet */ /* Initialize threshold for small groups/datasets/attributes */ -static int sgroups_threshold = DEF_SIZE_SMALL_GROUPS; -static int sdsets_threshold = DEF_SIZE_SMALL_DSETS; -static int sattrs_threshold = DEF_SIZE_SMALL_ATTRS; +static int sgroups_threshold = DEF_SIZE_SMALL_GROUPS; +static int sdsets_threshold = DEF_SIZE_SMALL_DSETS; +static int sattrs_threshold = DEF_SIZE_SMALL_ATTRS; /* a structure for handling the order command-line parameters come in */ struct handler_t { @@ -1733,7 +1733,7 @@ main(int argc, const char *argv[]) /* Disable tools error reporting */ H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); - + HDmemset(&iter, 0, sizeof(iter)); if(parse_command_line(argc, argv, &hand) < 0) @@ -1780,15 +1780,15 @@ main(int argc, const char *argv[]) iter.free_hdr = finfo.free.meta_size; } /* end else */ - iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long)); - iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long)); - iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long)); + iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long)); + iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long)); + iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long)); - if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) { - error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } + if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) { + error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } if((fcpl = H5Fget_create_plist(fid)) < 0) warn_msg("Unable to retrieve file creation property\n"); diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index 5724e1b..ae57031 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -82,7 +82,7 @@ static struct long_options l_opts[] = { }; - + /*------------------------------------------------------------------------- * Function: usage * @@ -119,7 +119,7 @@ static void usage(const char *prog) HDfprintf(stdout, " Set the EOA to the maximum of (EOA, EOF) + 512 for the file <file_name>.\n"); } /* usage() */ - + /*------------------------------------------------------------------------- * Function: parse_command_line * @@ -170,9 +170,12 @@ parse_command_line(int argc, const char **argv) case 'i': increment_eoa_eof = TRUE; - if(opt_arg != NULL && (increment = HDatoi(opt_arg)) < 0) { - usage(h5tools_getprogname()); - goto done; + if(opt_arg != NULL) { + if (HDatoi(opt_arg) < 0) { + usage(h5tools_getprogname()); + goto done; + } + increment = HDatoi(opt_arg); } break; @@ -217,7 +220,7 @@ leave(int ret) } /* leave() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -231,14 +234,14 @@ leave(int ret) * so the file is opened with write access. * The --filesize option just prints the EOA and EOF, so the file * is opened with read access. - * + * * The -s option will activate the private property: - * --H5F_ACS_CLEAR_STATUS_FLAGS_NAME + * --H5F_ACS_CLEAR_STATUS_FLAGS_NAME * The --increment option will active these two private properties: - * --H5F_ACS_NULL_FSM_ADDR_NAME - * --H5F_ACS_SKIP_EOF_CHECK_NAME + * --H5F_ACS_NULL_FSM_ADDR_NAME + * --H5F_ACS_SKIP_EOF_CHECK_NAME * The --filesize will activate the private property: - * --H5F_ACS_SKIP_EOF_CHECK_NAME + * --H5F_ACS_SKIP_EOF_CHECK_NAME * * Return: Success: 0 * Failure: 1 @@ -280,7 +283,7 @@ main (int argc, const char *argv[]) } /* Cannot combine the --filesize option with other options */ - if(print_filesize && + if(print_filesize && (clear_status_flags || remove_cache_image || increment_eoa_eof)) { error_msg("Cannot combine --filesize with other options\n"); h5tools_setstatus(EXIT_FAILURE); @@ -298,7 +301,7 @@ main (int argc, const char *argv[]) } /* -s option */ - if(clear_status_flags) { + if(clear_status_flags) { /* Set to clear the status_flags in the file's superblock */ /* Activate this private property */ if(H5Pset(fapl, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear_status_flags) < 0) { @@ -309,7 +312,7 @@ main (int argc, const char *argv[]) } /* --increment option */ - if(increment_eoa_eof) { + if(increment_eoa_eof) { /* Activate this private property */ if(H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &increment_eoa_eof) < 0) { error_msg("H5Pset\n"); @@ -325,7 +328,7 @@ main (int argc, const char *argv[]) } /* --filesize option; open the file read-only */ - if(print_filesize) { + if(print_filesize) { /* Activate this private property */ if(H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &print_filesize) < 0) { error_msg("H5Pset\n"); @@ -333,7 +336,7 @@ main (int argc, const char *argv[]) goto done; } flags = H5F_ACC_RDONLY; - } + } /* Open the file */ if((fid = h5tools_fopen(fname, flags, fapl, NULL, NULL, (size_t)0)) < 0) { @@ -367,7 +370,7 @@ main (int argc, const char *argv[]) } /* -m option */ - if(remove_cache_image) { + if(remove_cache_image) { if(H5Fget_mdc_image_info(fid, &image_addr, &image_len) < 0) { error_msg("H5Fget_mdc_image_info\n"); h5tools_setstatus(EXIT_FAILURE); @@ -375,7 +378,7 @@ main (int argc, const char *argv[]) } if(image_addr == HADDR_UNDEF && image_len == 0) warn_msg("No cache image in the file\n"); - } + } h5tools_setstatus(EXIT_SUCCESS); diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index b66e7ce..088e6e9 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -346,7 +346,7 @@ main(int argc, char *argv[]) /* * Debug a global heap collection. */ - status = H5HG_debug (f, addr, stdout, 0, VCOL); + status = H5HG_debug(f, addr, stdout, 0, VCOL); } else if(!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c index cdc554f..2f4d93e 100644 --- a/tools/src/misc/h5repart.c +++ b/tools/src/misc/h5repart.c @@ -29,11 +29,12 @@ #define NAMELEN 4096 #define GB *1024*1024*1024 -/*Make these 2 private properties(defined in H5Fprivate.h) available to h5repart. - *The first one updates the member file size in the superblock. The second one - *change file driver from family to sec2. */ +/* Make these 2 private properties(defined in H5Fprivate.h) available to h5repart. + * The first one updates the member file size in the superblock. The second one + * change file driver from family to a single file driver. + */ #define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" -#define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2" +#define H5F_ACS_FAMILY_TO_SINGLE_NAME "family_to_single" /*------------------------------------------------------------------------- @@ -53,13 +54,14 @@ static void usage (const char *progname) { - fprintf(stderr, "usage: %s [-v] [-V] [-[b|m] N[g|m|k]] [-family_to_sec2] SRC DST\n", + fprintf(stderr, "usage: %s [-v] [-V] [-[b|m] N[g|m|k]] [-family_to_sec2|-family_to_single] SRC DST\n", progname); fprintf(stderr, " -v Produce verbose output\n"); fprintf(stderr, " -V Print a version number and exit\n"); fprintf(stderr, " -b N The I/O block size, defaults to 1kB\n"); fprintf(stderr, " -m N The destination member size or 1GB\n"); - fprintf(stderr, " -family_to_sec2 Change file driver from family to sec2\n"); + fprintf(stderr, " -family_to_sec2 Deprecated version of -family_to_single (below)\n"); + fprintf(stderr, " -family_to_single Change file driver from family to the default single-file VFD (windows or sec2)\n"); fprintf(stderr, " SRC The name of the source file\n"); fprintf(stderr, " DST The name of the destination files\n"); fprintf(stderr, "Sizes may be suffixed with `g' for GB, `m' for MB or " @@ -186,7 +188,7 @@ main (int argc, char *argv[]) hid_t fapl; /*file access property list */ hid_t file; hsize_t hdsize; /*destination logical memb size */ - hbool_t family_to_sec2=FALSE; /*change family to sec2 driver? */ + hbool_t family_to_single = FALSE; /*change family to single file driver? */ /* * Get the program name from argv[0]. Use only the last component. @@ -206,7 +208,10 @@ main (int argc, char *argv[]) prog_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); exit(EXIT_SUCCESS); } else if (!strcmp (argv[argno], "-family_to_sec2")) { - family_to_sec2 = TRUE; + family_to_single = TRUE; + argno++; + } else if (!strcmp (argv[argno], "-family_to_single")) { + family_to_single = TRUE; argno++; } else if ('b'==argv[argno][1]) { blk_size = (size_t)get_size (prog_name, &argno, argc, argv); @@ -422,11 +427,12 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } - if(family_to_sec2) { - /* The user wants to change file driver from family to sec2. Open the file - * with sec2 driver. This property signals the library to ignore the family - * driver information saved in the superblock. */ - if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SEC2_NAME, &family_to_sec2) < 0) { + if(family_to_single) { + /* The user wants to change file driver from family to a single-file VFD. + * Open the file with the sec2, windows, etc. driver. This property signals + * the library to ignore the family driver information saved in the superblock. + */ + if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SINGLE_NAME, &family_to_single) < 0) { perror ("H5Pset"); exit (EXIT_FAILURE); } @@ -449,13 +455,14 @@ main (int argc, char *argv[]) /* If the new file is a family file, try to open file for "read and write" to * flush metadata. Flushing metadata will update the superblock to the new - * member size. If the original file is a family file and the new file is a sec2 - * file, the property FAMILY_TO_SEC2 will signal the library to switch to sec2 - * driver when the new file is opened. If the original file is a sec2 file and the - * new file can only be a sec2 file, reopen the new file should fail. There's - * nothing to do in this case. */ + * member size. If the original file is a family file and the new file is a single + * file, the property FAMILY_TO_SINGLE will signal the library to switch to default + * single-file driver when the new file is opened. If the original file is a single + * file and the new file can only be a single file, reopen the new file should fail. + * There's nothing to do in this case. + */ H5E_BEGIN_TRY { - file=H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl); + file = H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl); } H5E_END_TRY; if(file>=0) { diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index 1bdefa6..924ade1 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -128,9 +128,10 @@ macro (ADD_SKIP_H5_TEST testname skipresultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5COPY-${testname}-${skipresultfile}-SKIPPED + NAME H5COPY-${testname}-${skipresultfile} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname}-${skipresultfile} ${ARGN}" ) + set_property(TEST H5COPY-${testname}-${skipresultfile} PROPERTY DISABLED) endif () endmacro () diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index 7321c66..4f92cae 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -11,8 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include <stdio.h> -#include <stdlib.h> #include "hdf5.h" #include "H5private.h" @@ -110,6 +108,10 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); #define SPACE1_DIM1 0 #define SPACE1_DIM2 0 +/* Error macros */ +#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); +#define PROGRAM_ERROR {AT(); goto error;} + /* A UD link traversal function. Shouldn't actually be called. */ static hid_t UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED hid_t cur_group, @@ -178,7 +180,7 @@ static void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int ma static void gen_datareg(hid_t fid, int make_diffs); /* utilities */ static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); -static int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); +static herr_t write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); static int gen_dataset_idx(const char *file, int format); /*------------------------------------------------------------------------- @@ -286,7 +288,7 @@ int main(void) /* string dataset and attribute. HDFFV-10028 */ test_objs_strings(DIFF_STRINGS1, DIFF_STRINGS2); - return 0; + return EXIT_SUCCESS; } /*------------------------------------------------------------------------- @@ -4908,9 +4910,9 @@ out: * types. * h5diff should show non-comparable output from these common objects. *-------------------------------------------------------------------------*/ -static void test_objs_nocomparables(const char *fname1, const char *fname2) +static void +test_objs_nocomparables(const char *fname1, const char *fname2) { - herr_t status = SUCCEED; hid_t fid1 = -1; hid_t fid2 = -1; hid_t topgid1 = -1; @@ -4927,110 +4929,90 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2) * Open file(s) to add objects *------------------------------------------------------------------------*/ /* file1 */ - fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname1); - status = FAIL; - goto out; - } + if((fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* file2 */ - fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid2 < 0) { - fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname2); - status = FAIL; - goto out; - } + if((fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /*----------------------------------------------------------------------- * in file1 : add member objects *------------------------------------------------------------------------*/ /* parent group */ - topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (topgid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); - status = FAIL; - goto out; - } + if((topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* dataset */ - status = write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1); - if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); - goto out; - } + if(write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1) < 0) + PROGRAM_ERROR /* group */ - gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); - status = FAIL; - goto out; - } + if((gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* committed type */ - tid1 = H5Tcopy(H5T_NATIVE_INT); - status = H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname1); - goto out; - } + if((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0) + PROGRAM_ERROR + if(H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + PROGRAM_ERROR /*----------------------------------------------------------------------- * in file2 : add member objects *------------------------------------------------------------------------*/ /* parent group */ - topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (topgid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); - status = FAIL; - goto out; - } + if((topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* group */ - gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); - status = FAIL; - goto out; - } + if((gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* committed type */ - tid2 = H5Tcopy(H5T_NATIVE_INT); - status = H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname2); - goto out; - } + if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) + PROGRAM_ERROR + if(H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + PROGRAM_ERROR /* dataset */ - status = write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2); - if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); - goto out; - } + if(write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2) < 0) + PROGRAM_ERROR -out: /*----------------------------------------------------------------------- * Close IDs *-----------------------------------------------------------------------*/ - if (fid1) + if(H5Fclose(fid1) < 0) + PROGRAM_ERROR + if(H5Fclose(fid2) < 0) + PROGRAM_ERROR + if(H5Gclose(topgid1) < 0) + PROGRAM_ERROR + if(H5Gclose(topgid2) < 0) + PROGRAM_ERROR + if(H5Gclose(gid1) < 0) + PROGRAM_ERROR + if(H5Gclose(gid2) < 0) + PROGRAM_ERROR + if(H5Tclose(tid1) < 0) + PROGRAM_ERROR + if(H5Tclose(tid2) < 0) + PROGRAM_ERROR + + return; + +error: + H5E_BEGIN_TRY { H5Fclose(fid1); - if (fid2) H5Fclose(fid2); - if (topgid1) H5Gclose(topgid1); - if (topgid2) H5Gclose(topgid2); - if (gid1) H5Gclose(gid1); - if (gid2) H5Gclose(gid2); - if (tid1) H5Tclose(tid1); - if (tid2) H5Tclose(tid2); + } H5E_END_TRY; + return; } static hid_t mkstr(int size, H5T_str_t pad) @@ -8085,36 +8067,40 @@ out: * *------------------------------------------------------------------------- */ -static -int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) +static herr_t +write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) { hid_t did = -1; hid_t sid = -1; /* create a space */ - if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) - goto out; + if((sid = H5Screate_simple(rank, dims, NULL)) < 0) + PROGRAM_ERROR /* create the dataset */ - if ((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; + if((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* write */ - if (buf) { - if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto out; - } + if(buf) + if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + PROGRAM_ERROR /* close */ - H5Dclose(did); - H5Sclose(sid); + if(H5Dclose(did) < 0) + PROGRAM_ERROR + if(H5Sclose(sid) < 0) + PROGRAM_ERROR return SUCCEED; -out: +error: + + H5E_BEGIN_TRY { + H5Dclose(did); + H5Sclose(sid); + } H5E_END_TRY; - H5Dclose(did); - H5Sclose(sid); return FAIL; -} +} /* end write_dset() */ diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt index 4c409e8..51938ae 100644 --- a/tools/test/h5dump/CMakeLists.txt +++ b/tools/test/h5dump/CMakeLists.txt @@ -4,29 +4,31 @@ project (HDF5_TOOLS_TEST_H5DUMP C) #----------------------------------------------------------------------------- # If plugin library tests can be tested #----------------------------------------------------------------------------- -set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdump") -set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") -set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) - -add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c) -target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) -target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) -H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") - -# make plugins dir -file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") -#----------------------------------------------------------------------------- -# Copy plugin library to a plugins folder -#----------------------------------------------------------------------------- -add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" - "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" -) +if (BUILD_SHARED_LIBS) + set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdump") + set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + + add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c) + target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + + # make plugins dir + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- + # Copy plugin library to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" + "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" + ) +endif () # -------------------------------------------------------------------- # Add the h5dump test executable diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 24588e9..382e664 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -441,9 +441,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP-${skipresultfile}-SKIPPED + NAME H5DUMP-${skipresultfile} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile} ${ARGN}" ) + set_property(TEST H5DUMP-${skipresultfile} PROPERTY DISABLED) endif () else () ADD_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN}) @@ -749,10 +750,10 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-IMPORT-${resultfile} PROPERTIES DEPENDS "H5DUMP-IMPORT-${resultfile}-clear-objects") - add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND h5import ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5) + add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND $<TARGET_FILE:h5import> ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5) set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-${resultfile}) - add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND h5diff ${testfile} ${resultfile}.h5 /integer /integer) + add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND $<TARGET_FILE:h5diff> ${testfile} ${resultfile}.h5 /integer /integer) set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-h5import-${resultfile}) endif () @@ -1548,4 +1549,6 @@ ############################################################################## ### P L U G I N T E S T S ############################################################################## -ADD_H5_UD_TEST (h5dump_plugin_test 0 tudfilter --enable-error-stack tudfilter.h5) +if (BUILD_SHARED_LIBS) + ADD_H5_UD_TEST (h5dump_plugin_test 0 tudfilter --enable-error-stack tudfilter.h5) +endif () diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake index 9c68e5f..de87d2f 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -164,9 +164,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP_XML-${skipresultfile}-SKIPPED + NAME H5DUMP_XML-${skipresultfile} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile}.xml --xml ${ARGN}" ) + set_property(TEST H5DUMP_XML-${skipresultfile} PROPERTY DISABLED) endif () else () ADD_XML_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN}) diff --git a/tools/test/h5dump/errfiles/filter_fail.err b/tools/test/h5dump/errfiles/filter_fail.err index a785ea7..07b0aa0 100644 --- a/tools/test/h5dump/errfiles/filter_fail.err +++ b/tools/test/h5dump/errfiles/filter_fail.err @@ -2,19 +2,28 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dread(): can't read data major: Dataset minor: Read failed - #001: (file name) line (number) in H5D__read(): can't read data + #001: (file name) line (number) in H5VL_dataset_read(): dataset read failed + major: Virtual Object Layer + minor: Read failed + #002: (file name) line (number) in H5VL__dataset_read(): dataset read failed + major: Virtual Object Layer + minor: Read failed + #003: (file name) line (number) in H5VL__native_dataset_read(): can't read data + major: Dataset + minor: Read failed + #004: (file name) line (number) in H5D__read(): can't read data major: Dataset minor: Read failed - #002: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk + #005: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk major: Low-level I/O minor: Read failed - #003: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed + #006: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed major: Dataset minor: Filter operation failed - #004: (file name) line (number) in H5Z_pipeline(): required filter 'filter_fail_test' is not registered + #007: (file name) line (number) in H5Z_pipeline(): required filter 'filter_fail_test' is not registered major: Data filters minor: Read failed - #005: (file name) line (number) in H5PL_load(): filter plugins disabled + #008: (file name) line (number) in H5PL_load(): filter plugins disabled major: Plugin for dynamically loaded library minor: Unable to load metadata into cache h5dump error: unable to print data diff --git a/tools/test/h5dump/errfiles/tall-1.err b/tools/test/h5dump/errfiles/tall-1.err index 9733453..2d2b289 100644 --- a/tools/test/h5dump/errfiles/tall-1.err +++ b/tools/test/h5dump/errfiles/tall-1.err @@ -2,30 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibilty + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A.err b/tools/test/h5dump/errfiles/tall-2A.err index 9733453..2d2b289 100644 --- a/tools/test/h5dump/errfiles/tall-2A.err +++ b/tools/test/h5dump/errfiles/tall-2A.err @@ -2,30 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibilty + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A0.err b/tools/test/h5dump/errfiles/tall-2A0.err index 9733453..2d2b289 100644 --- a/tools/test/h5dump/errfiles/tall-2A0.err +++ b/tools/test/h5dump/errfiles/tall-2A0.err @@ -2,30 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibilty + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2B.err b/tools/test/h5dump/errfiles/tall-2B.err index 9733453..2d2b289 100644 --- a/tools/test/h5dump/errfiles/tall-2B.err +++ b/tools/test/h5dump/errfiles/tall-2B.err @@ -2,30 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibilty + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tarray1_big.err b/tools/test/h5dump/errfiles/tarray1_big.err index be77711..ff22495 100644 --- a/tools/test/h5dump/errfiles/tarray1_big.err +++ b/tools/test/h5dump/errfiles/tarray1_big.err @@ -2,21 +2,48 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object + major: References + minor: Can't open object + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object + major: References + minor: Can't open object + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object + major: References + minor: Can't open object + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tattr-3.err b/tools/test/h5dump/errfiles/tattr-3.err index 3a34314..8481acf 100644 --- a/tools/test/h5dump/errfiles/tattr-3.err +++ b/tools/test/h5dump/errfiles/tattr-3.err @@ -1,11 +1,20 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Aopen(): unable to load attribute info from object header for attribute: 'attr' + #000: (file name) line (number) in H5Aopen(): unable to open attribute: 'attr' major: Attribute minor: Can't open object - #001: (file name) line (number) in H5A__open(): unable to load attribute info from object header for attribute: 'attr' + #001: (file name) line (number) in H5VL_attr_open(): attribute open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__attr_open(): attribute open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_attr_open(): unable to open attribute: 'attr' + major: Attribute + minor: Can't open object + #004: (file name) line (number) in H5A__open(): unable to load attribute info from object header for attribute: 'attr' major: Attribute minor: Can't open object - #002: (file name) line (number) in H5O__attr_open_by_name(): can't locate attribute: 'attr' + #005: (file name) line (number) in H5O__attr_open_by_name(): can't locate attribute: 'attr' major: Attribute minor: Object not found h5dump error: unable to open attribute "attr" diff --git a/tools/test/h5dump/errfiles/tattrregR.err b/tools/test/h5dump/errfiles/tattrregR.err index d84d5ec..8a1539c 100644 --- a/tools/test/h5dump/errfiles/tattrregR.err +++ b/tools/test/h5dump/errfiles/tattrregR.err @@ -2,14 +2,32 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object + major: References + minor: Can't open object + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object + major: References + minor: Can't open object + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tcomp-3.err b/tools/test/h5dump/errfiles/tcomp-3.err index e41e97a..fc59b0b 100644 --- a/tools/test/h5dump/errfiles/tcomp-3.err +++ b/tools/test/h5dump/errfiles/tcomp-3.err @@ -2,18 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Topen2(): unable to open named datatype major: Datatype minor: Can't open object - #001: (file name) line (number) in H5T__open_name(): not found + #001: (file name) line (number) in H5VL_datatype_open(): datatype open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__datatype_open(): datatype open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_datatype_open(): unable to open named datatype + major: Datatype + minor: Can't open object + #004: (file name) line (number) in H5T__open_name(): not found major: Datatype minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5G__loc_find_cb(): object '#6632' doesn't exist + #008: (file name) line (number) in H5G__loc_find_cb(): object '#6632' doesn't exist major: Symbol table minor: Object not found diff --git a/tools/test/h5dump/errfiles/tdataregR.err b/tools/test/h5dump/errfiles/tdataregR.err index d84d5ec..8a1539c 100644 --- a/tools/test/h5dump/errfiles/tdataregR.err +++ b/tools/test/h5dump/errfiles/tdataregR.err @@ -2,14 +2,32 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object + major: References + minor: Can't open object + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object + major: References + minor: Can't open object + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tdset-2.err b/tools/test/h5dump/errfiles/tdset-2.err index d00a92b..2d70b35 100644 --- a/tools/test/h5dump/errfiles/tdset-2.err +++ b/tools/test/h5dump/errfiles/tdset-2.err @@ -2,38 +2,53 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dopen2(): unable to open dataset major: Dataset minor: Can't open object - #001: (file name) line (number) in H5D__open_name(): not found + #001: (file name) line (number) in H5VL_dataset_open(): dataset open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__dataset_open(): dataset open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_dataset_open(): unable to open dataset + major: Dataset + minor: Can't open object + #004: (file name) line (number) in H5D__open_name(): not found major: Dataset minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5G__loc_find_cb(): object 'dset3' doesn't exist + #008: (file name) line (number) in H5G__loc_find_cb(): object 'dset3' doesn't exist major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info major: Links minor: Can't get value - #001: (file name) line (number) in H5L__get_info(): unable to get link info for: 'dset3' - major: Links + #001: (file name) line (number) in H5VL_link_get(): link get failed + major: Virtual Object Layer + minor: Can't get value + #002: (file name) line (number) in H5VL__link_get(): link get failed + major: Virtual Object Layer minor: Can't get value - #002: (file name) line (number) in H5L_get_info(): name doesn't exist + #003: (file name) line (number) in H5VL__native_link_get(): unable to get link info + major: Links + minor: Object not found + #004: (file name) line (number) in H5L_get_info(): name doesn't exist major: Links minor: Object already exists - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5L__get_info_cb(): name doesn't exist + #007: (file name) line (number) in H5L__get_info_cb(): name doesn't exist major: Links minor: Object not found h5dump error: unable to get link info from "dset3" diff --git a/tools/test/h5dump/errfiles/textlink.err b/tools/test/h5dump/errfiles/textlink.err index 99e8530..aaf3144 100644 --- a/tools/test/h5dump/errfiles/textlink.err +++ b/tools/test/h5dump/errfiles/textlink.err @@ -2,61 +2,73 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' - major: File accessibilty + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' + major: File accessibility minor: Unable to open file HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' - major: File accessibilty + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' + major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/textlinkfar.err b/tools/test/h5dump/errfiles/textlinkfar.err index a888ba9..8245291 100644 --- a/tools/test/h5dump/errfiles/textlinkfar.err +++ b/tools/test/h5dump/errfiles/textlinkfar.err @@ -2,52 +2,58 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open object + #010: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object - #009: (file name) line (number) in H5O_open_name(): object not found + #011: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #010: (file name) line (number) in H5G_loc_find(): can't find object + #012: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #011: (file name) line (number) in H5G_traverse(): internal path traversal failed + #013: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #012: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #014: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #013: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #015: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #014: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #016: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #015: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #017: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #016: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #018: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/textlinksrc.err b/tools/test/h5dump/errfiles/textlinksrc.err index a888ba9..8245291 100644 --- a/tools/test/h5dump/errfiles/textlinksrc.err +++ b/tools/test/h5dump/errfiles/textlinksrc.err @@ -2,52 +2,58 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open object + #010: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object - #009: (file name) line (number) in H5O_open_name(): object not found + #011: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #010: (file name) line (number) in H5G_loc_find(): can't find object + #012: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #011: (file name) line (number) in H5G_traverse(): internal path traversal failed + #013: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #012: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #014: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #013: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #015: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #014: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #016: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #015: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #017: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #016: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #018: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tgroup-2.err b/tools/test/h5dump/errfiles/tgroup-2.err index 715f2d2..27557f3 100644 --- a/tools/test/h5dump/errfiles/tgroup-2.err +++ b/tools/test/h5dump/errfiles/tgroup-2.err @@ -2,19 +2,28 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Gopen2(): unable to open group major: Symbol table minor: Can't open object - #001: (file name) line (number) in H5G__open_name(): group not found + #001: (file name) line (number) in H5VL_group_open(): group open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__group_open(): group open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_group_open(): unable to open group + major: Symbol table + minor: Can't open object + #004: (file name) line (number) in H5G__open_name(): group not found major: Symbol table minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5G__loc_find_cb(): object 'y' doesn't exist + #008: (file name) line (number) in H5G__loc_find_cb(): object 'y' doesn't exist major: Symbol table minor: Object not found h5dump error: unable to open group "/y" diff --git a/tools/test/h5dump/errfiles/torderlinks1.err b/tools/test/h5dump/errfiles/torderlinks1.err index 22b4318..ce31ced 100644 --- a/tools/test/h5dump/errfiles/torderlinks1.err +++ b/tools/test/h5dump/errfiles/torderlinks1.err @@ -2,30 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' - major: File accessibilty + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks2.err b/tools/test/h5dump/errfiles/torderlinks2.err index 22b4318..ce31ced 100644 --- a/tools/test/h5dump/errfiles/torderlinks2.err +++ b/tools/test/h5dump/errfiles/torderlinks2.err @@ -2,30 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' - major: File accessibilty + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tperror.err b/tools/test/h5dump/errfiles/tperror.err index 55aeb4a..b0b908b 100644 --- a/tools/test/h5dump/errfiles/tperror.err +++ b/tools/test/h5dump/errfiles/tperror.err @@ -2,38 +2,53 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dopen2(): unable to open dataset major: Dataset minor: Can't open object - #001: (file name) line (number) in H5D__open_name(): not found + #001: (file name) line (number) in H5VL_dataset_open(): dataset open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__dataset_open(): dataset open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_dataset_open(): unable to open dataset + major: Dataset + minor: Can't open object + #004: (file name) line (number) in H5D__open_name(): not found major: Dataset minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5G__loc_find_cb(): object 'bogus' doesn't exist + #008: (file name) line (number) in H5G__loc_find_cb(): object 'bogus' doesn't exist major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info major: Links minor: Can't get value - #001: (file name) line (number) in H5L__get_info(): unable to get link info for: 'bogus' - major: Links + #001: (file name) line (number) in H5VL_link_get(): link get failed + major: Virtual Object Layer + minor: Can't get value + #002: (file name) line (number) in H5VL__link_get(): link get failed + major: Virtual Object Layer minor: Can't get value - #002: (file name) line (number) in H5L_get_info(): name doesn't exist + #003: (file name) line (number) in H5VL__native_link_get(): unable to get link info + major: Links + minor: Object not found + #004: (file name) line (number) in H5L_get_info(): name doesn't exist major: Links minor: Object already exists - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5L__get_info_cb(): name doesn't exist + #007: (file name) line (number) in H5L__get_info_cb(): name doesn't exist major: Links minor: Object not found h5dump error: unable to get link info from "bogus" diff --git a/tools/test/h5dump/errfiles/tqmarkfile.err b/tools/test/h5dump/errfiles/tqmarkfile.err index 06519fb..2c4f1ff 100644 --- a/tools/test/h5dump/errfiles/tqmarkfile.err +++ b/tools/test/h5dump/errfiles/tqmarkfile.err @@ -8,7 +8,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed #004: (file name) line (number) in H5G_loc_find_cb(): object 'Dataset1' doesn't exist @@ -24,7 +24,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed #004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist diff --git a/tools/test/h5dump/errfiles/tslink-D.err b/tools/test/h5dump/errfiles/tslink-D.err index de0705e..e650a33 100644 --- a/tools/test/h5dump/errfiles/tslink-D.err +++ b/tools/test/h5dump/errfiles/tslink-D.err @@ -2,27 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dopen2(): unable to open dataset major: Dataset minor: Can't open object - #001: (file name) line (number) in H5D__open_name(): not found + #001: (file name) line (number) in H5VL_dataset_open(): dataset open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__dataset_open(): dataset open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_dataset_open(): unable to open dataset + major: Dataset + minor: Can't open object + #004: (file name) line (number) in H5D__open_name(): not found major: Dataset minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #005: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #009: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #010: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #008: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #011: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 4ef63e5..cbbbcfa 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -10574,7 +10574,7 @@ static void gent_null_space_group(void) *------------------------------------------------------------------------- */ static void -gent_err_attr_dspace() +gent_err_attr_dspace(void) { hid_t fid = -1; /* File identifier */ hid_t fcpl = -1; /* File access property list */ diff --git a/tools/test/h5format_convert/h5fc_gentest.c b/tools/test/h5format_convert/h5fc_gentest.c index 8c873be..b482dee 100644 --- a/tools/test/h5format_convert/h5fc_gentest.c +++ b/tools/test/h5format_convert/h5fc_gentest.c @@ -14,7 +14,7 @@ /* * Generate the binary hdf5 files for the h5format_convert tests. * Usage: just execute the program without any arguments will - * generate all the binary hdf5 files + * generate all the binary hdf5 files * * If you regenerate the test files (e.g., changing some code, * trying it on a new platform, ...), you need to verify the correctness @@ -24,71 +24,71 @@ #include "hdf5.h" #include "H5private.h" -#define NON_V3_FILE "h5fc_non_v3.h5" -#define EDGE_V3_FILE "h5fc_edge_v3.h5" -#define ERR_LEVEL_FILE "h5fc_err_level.h5" +#define NON_V3_FILE "h5fc_non_v3.h5" +#define EDGE_V3_FILE "h5fc_edge_v3.h5" +#define ERR_LEVEL_FILE "h5fc_err_level.h5" const char *FILENAME[] = { - "h5fc_ext1_i.h5", /* 0 */ - "h5fc_ext1_s.h5", /* 1 */ - "h5fc_ext1_f.h5", /* 2 */ - "h5fc_ext2_is.h5", /* 3 */ - "h5fc_ext2_if.h5", /* 4 */ - "h5fc_ext2_sf.h5", /* 5 */ - "h5fc_ext3_isf.h5", /* 6 */ - "h5fc_ext_none.h5", /* 7 */ + "h5fc_ext1_i.h5", /* 0 */ + "h5fc_ext1_s.h5", /* 1 */ + "h5fc_ext1_f.h5", /* 2 */ + "h5fc_ext2_is.h5", /* 3 */ + "h5fc_ext2_if.h5", /* 4 */ + "h5fc_ext2_sf.h5", /* 5 */ + "h5fc_ext3_isf.h5", /* 6 */ + "h5fc_ext_none.h5", /* 7 */ NULL }; -#define GROUP "GROUP" +#define GROUP "GROUP" -#define DSET_COMPACT "DSET_COMPACT" -#define DSET_CONTIGUOUS "DSET_CONTIGUOUS" +#define DSET_COMPACT "DSET_COMPACT" +#define DSET_CONTIGUOUS "DSET_CONTIGUOUS" -#define DSET_EA "DSET_EA" -#define DSET_NDATA_EA "DSET_NDATA_EA" -#define DSET_BT2 "DSET_BT2" -#define DSET_NDATA_BT2 "DSET_NDATA_BT2" -#define DSET_FA "DSET_FA" -#define DSET_NDATA_FA "DSET_NDATA_FA" -#define DSET_NONE "DSET_NONE" -#define DSET_NDATA_NONE "DSET_NDATA_NONE" +#define DSET_EA "DSET_EA" +#define DSET_NDATA_EA "DSET_NDATA_EA" +#define DSET_BT2 "DSET_BT2" +#define DSET_NDATA_BT2 "DSET_NDATA_BT2" +#define DSET_FA "DSET_FA" +#define DSET_NDATA_FA "DSET_NDATA_FA" +#define DSET_NONE "DSET_NONE" +#define DSET_NDATA_NONE "DSET_NDATA_NONE" -#define DSET_EDGE "DSET_EDGE" -#define DSET_ERR "DSET_ERR" +#define DSET_EDGE "DSET_EDGE" +#define DSET_ERR "DSET_ERR" #define ISTORE_IK 64 -#define ISTORE_ERR 1 +#define ISTORE_ERR 1 #define NUM 500 /* - * Function: gen_non() + * Function: gen_non() * * Create a file with SWMR write+non-latest-format--this will result in v3 superbock+latest version support: - * 1) 1 chunked dataset with extensible array chunk indexing type (without data) - * 2) 1 chunked dataset with version 2 B-tree chunk indexing type (with data) + * 1) 1 chunked dataset with extensible array chunk indexing type (without data) + * 2) 1 chunked dataset with version 2 B-tree chunk indexing type (with data) * Re-open the file with write+non-latest-format and create: - * 3) 1 chunked dataset with version 2 B-tree chunk indexing type (without data) - * 4) 1 chunked dataset with extensible array indexing type (with data) - * 5) 1 compact and 1 contiguous datasets + * 3) 1 chunked dataset with version 2 B-tree chunk indexing type (without data) + * 4) 1 chunked dataset with extensible array indexing type (with data) + * 5) 1 compact and 1 contiguous datasets */ static void gen_non(const char *fname) { - hid_t fid = -1; /* file id */ - hid_t fcpl = -1; /* file creation property list */ - hid_t gid = -1; /* group id */ - hid_t sid = -1; /* space id */ - hid_t dcpl = -1; /* dataset creation property id */ - hid_t did1 = -1, did2 = -1; /* dataset id */ - hsize_t dims1[1] = {10}; /* dataset dimension */ - hsize_t dims2[2] = {4, 6}; /* dataset dimension */ - hsize_t max_dims[2]; /* maximum dataset dimension */ - hsize_t c_dims[2] = {2, 3}; /* chunk dimension */ - int i; /* local index variable */ - int buf[24]; /* data buffer */ + hid_t fid = -1; /* file id */ + hid_t fcpl = -1; /* file creation property list */ + hid_t gid = -1; /* group id */ + hid_t sid = -1; /* space id */ + hid_t dcpl = -1; /* dataset creation property id */ + hid_t did1 = -1, did2 = -1; /* dataset id */ + hsize_t dims1[1] = {10}; /* dataset dimension */ + hsize_t dims2[2] = {4, 6}; /* dataset dimension */ + hsize_t max_dims[2]; /* maximum dataset dimension */ + hsize_t c_dims[2] = {2, 3}; /* chunk dimension */ + int i; /* local index variable */ + int buf[24]; /* data buffer */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) goto error; @@ -115,7 +115,7 @@ gen_non(const char *fname) if(H5Pset_chunk(dcpl, 2, c_dims) < 0) goto error; - /* + /* * Create a chunked dataset with extensible array chunk indexing type (without data) */ @@ -135,7 +135,7 @@ gen_non(const char *fname) if(H5Dclose(did1) < 0) goto error; - /* + /* * Create a chunked dataset with version 2 B-tree chunk indexing type (with data) */ @@ -226,7 +226,7 @@ gen_non(const char *fname) if(H5Dclose(did2) < 0) goto error; - /* + /* * Create a compact dataset in the group */ @@ -251,7 +251,7 @@ gen_non(const char *fname) if(H5Sclose(sid) < 0) goto error; - /* + /* * Create a contiguous dataset with (2d with data) in the file */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) @@ -278,9 +278,9 @@ gen_non(const char *fname) goto error; if(H5Gclose(gid) < 0) - goto error; + goto error; if(H5Pclose(fcpl) < 0) - goto error; + goto error; if(H5Fclose(fid) < 0) goto error; @@ -298,24 +298,24 @@ error: } /* gen_non() */ /* - * Function: gen_edge() + * Function: gen_edge() * * Create a file with write+latest-format--this will result in v3 superblock+latest version support: - * A dataset: chunked, filtered, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS enabled - * (i.e. the dataset does not filter partial edge chunks) + * A dataset: chunked, filtered, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS enabled + * (i.e. the dataset does not filter partial edge chunks) */ static void gen_edge(const char *fname) { - hid_t fid = -1; /* file id */ - hid_t fapl = -1; /* file access property list */ - hid_t sid = -1; /* dataspace id */ - hid_t dcpl = -1; /* dataset creation property id */ - hid_t did = -1; /* dataset id */ - hsize_t dims2[2] = {12, 6}; /* Dataset dimensions */ - hsize_t c_dims[2] = {5, 5}; /* Chunk dimensions */ - float buf[12][6]; /* Buffer for writing data */ - int i, j; /* local index variable */ + hid_t fid = -1; /* file id */ + hid_t fapl = -1; /* file access property list */ + hid_t sid = -1; /* dataspace id */ + hid_t dcpl = -1; /* dataset creation property id */ + hid_t did = -1; /* dataset id */ + hsize_t dims2[2] = {12, 6}; /* Dataset dimensions */ + hsize_t c_dims[2] = {5, 5}; /* Chunk dimensions */ + float buf[12][6]; /* Buffer for writing data */ + int i, j; /* local index variable */ /* Create a new format file */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -377,37 +377,37 @@ error: /* - * Function: gen_err_level() + * Function: gen_err_level() * * Generate a file to test the situtation described in HDFFV-9434: - * Exceed the limit of v1-btree level + * Exceed the limit of v1-btree level * - * Create a file with H5Pset_istore_k(fcpl, 1). - * Create a chunked dataset with extensible array chunk index and - * appends many chunks to the dataset. + * Create a file with H5Pset_istore_k(fcpl, 1). + * Create a chunked dataset with extensible array chunk index and + * appends many chunks to the dataset. * - * When h5format_convert tries to convert the dataset with - * extensive array index in the file to v1-btree chunk index, - * it will insert the dataset chunks to the v1-btree chunk index. - * The tree will split quickly due to the 'K' value of 1 and the - * tree level will eventually hit the maximum: 2^8(256). + * When h5format_convert tries to convert the dataset with + * extensive array index in the file to v1-btree chunk index, + * it will insert the dataset chunks to the v1-btree chunk index. + * The tree will split quickly due to the 'K' value of 1 and the + * tree level will eventually hit the maximum: 2^8(256). */ static void gen_err_level(const char *fname) { - hid_t fid = -1; /* file ID */ - hid_t fapl = -1; /* file access property list */ - hid_t fcpl = -1; /* file creation property list */ - hid_t sid = -1; /* dataspace id */ - hid_t dcpl = -1; /* dataset creation property list */ - hid_t did = -1; /* dataset ID */ - hid_t fsid = -1; /* file dataspace ID */ - hid_t msid = -1; /* memory dataspace ID */ - unsigned char *buf = NULL; /* buffer for data */ - hsize_t dims[2] = {0, 1}; /* dataset dimension sizes */ - hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* dataset maximum dimension sizes */ - hsize_t chunk_dims[2] = {1, 1}; /* chunk dimension sizes */ - int n = 0; /* local index variable */ + hid_t fid = -1; /* file ID */ + hid_t fapl = -1; /* file access property list */ + hid_t fcpl = -1; /* file creation property list */ + hid_t sid = -1; /* dataspace id */ + hid_t dcpl = -1; /* dataset creation property list */ + hid_t did = -1; /* dataset ID */ + hid_t fsid = -1; /* file dataspace ID */ + hid_t msid = -1; /* memory dataspace ID */ + unsigned char *buf = NULL; /* buffer for data */ + hsize_t dims[2] = {0, 1}; /* dataset dimension sizes */ + hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* dataset maximum dimension sizes */ + hsize_t chunk_dims[2] = {1, 1}; /* chunk dimension sizes */ + int n = 0; /* local index variable */ /* Create a new format file */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -440,6 +440,8 @@ gen_err_level(const char *fname) goto error; /* Closing */ + if(H5Pclose(fcpl) < 0) + goto error; if(H5Pclose(dcpl) < 0) goto error; if(H5Sclose(sid) < 0) @@ -459,50 +461,51 @@ gen_err_level(const char *fname) /* Loop through appending 1 element at a time */ for(n = 0; n < NUM; n++) { - hsize_t start[2] = {0, 0}; - hsize_t count[2] = {1, 1}; - hsize_t extent[2] = {0, 0}; - - start[0] = 0; - start[1] = (hsize_t)n; - extent[0] = 1; - extent[1] = (hsize_t)(n + 1); - - /* Set current dimension sizes for the dataset */ - if(H5Dset_extent(did, extent) < 0) - goto error; - - /* Set up memory dataspace */ - if((msid = H5Screate_simple(2, count, NULL)) < 0) - goto error; - - /* Get file dataspace */ - if((fsid = H5Dget_space(did)) < 0) - goto error; - - if((H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, count, NULL)) < 0) - goto error; - - /* Write to the dataset */ - if(H5Dwrite(did, H5T_NATIVE_UCHAR, msid, fsid, H5P_DEFAULT, buf) < 0) - goto error; - - if(H5Sclose(fsid) < 0) - goto error; - if(H5Sclose(msid) < 0) - goto error; + hsize_t start[2] = {0, 0}; + hsize_t count[2] = {1, 1}; + hsize_t extent[2] = {0, 0}; + + start[0] = 0; + start[1] = (hsize_t)n; + extent[0] = 1; + extent[1] = (hsize_t)(n + 1); + + /* Set current dimension sizes for the dataset */ + if(H5Dset_extent(did, extent) < 0) + goto error; + + /* Set up memory dataspace */ + if((msid = H5Screate_simple(2, count, NULL)) < 0) + goto error; + + /* Get file dataspace */ + if((fsid = H5Dget_space(did)) < 0) + goto error; + + if((H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, count, NULL)) < 0) + goto error; + + /* Write to the dataset */ + if(H5Dwrite(did, H5T_NATIVE_UCHAR, msid, fsid, H5P_DEFAULT, buf) < 0) + goto error; + + if(H5Sclose(fsid) < 0) + goto error; + if(H5Sclose(msid) < 0) + goto error; } /* Closing */ if(H5Dclose(did) < 0) - goto error; + goto error; if(H5Fclose(fid) < 0) - goto error; + goto error; if(H5Pclose(fapl) < 0) - goto error; - if(buf) free(buf); + goto error; error: + if(buf) + free(buf); H5E_BEGIN_TRY { H5Pclose(dcpl); H5Sclose(sid); @@ -517,33 +520,33 @@ error: } /* gen_err_level() */ /* - * Function: gen_ext() + * Function: gen_ext() * * Create a file with/without latest format with: - * 1) 1 contiguous dataset (without data) - * 2) 2 chunked datasets with extensible array chunk indexing type (with/without data) - * 3) 2 chunked datasets with version 2 B-tree chunk indexing type (with/without data) - * 4) 2 chunked datasets with fixed array chunk indexing type (with/without data) - * 5) 2 chunked datasets with implicit array chunk indexing type (with/without data) + * 1) 1 contiguous dataset (without data) + * 2) 2 chunked datasets with extensible array chunk indexing type (with/without data) + * 3) 2 chunked datasets with version 2 B-tree chunk indexing type (with/without data) + * 4) 2 chunked datasets with fixed array chunk indexing type (with/without data) + * 5) 2 chunked datasets with implicit array chunk indexing type (with/without data) * It will create the file with/without messages in the superblock extension depending * on the parameter "what". */ static void gen_ext(const char *fname, unsigned new_format, unsigned what) { - hid_t fid = -1; /* file id */ - hid_t fapl = -1; /* file access property list */ - hid_t fcpl = -1; /* file creation property list */ - hid_t gid = -1; /* group id */ - hid_t sid = -1; /* space id */ - hid_t dcpl = -1; /* dataset creation property id */ - hid_t did1 = -1, did2 = -1; /* dataset id */ - hsize_t dims1[1] = {10}; /* dataset dimension */ - hsize_t dims2[2] = {4, 6}; /* dataset dimension */ - hsize_t max_dims[2]; /* maximum dataset dimension */ - hsize_t c_dims[2] = {2, 3}; /* chunk dimension */ - int i; /* local index variable */ - int buf[24]; /* data buffer */ + hid_t fid = -1; /* file id */ + hid_t fapl = -1; /* file access property list */ + hid_t fcpl = -1; /* file creation property list */ + hid_t gid = -1; /* group id */ + hid_t sid = -1; /* space id */ + hid_t dcpl = -1; /* dataset creation property id */ + hid_t did1 = -1, did2 = -1; /* dataset id */ + hsize_t dims1[1] = {10}; /* dataset dimension */ + hsize_t dims2[2] = {4, 6}; /* dataset dimension */ + hsize_t max_dims[2]; /* maximum dataset dimension */ + hsize_t c_dims[2] = {2, 3}; /* chunk dimension */ + int i; /* local index variable */ + int buf[24]; /* data buffer */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error; @@ -559,34 +562,34 @@ gen_ext(const char *fname, unsigned new_format, unsigned what) /* Generate messages that might be placed in superblock extension */ switch(what) { - case 0: - H5Pset_istore_k(fcpl, ISTORE_IK); - break; - case 1: - H5Pset_shared_mesg_nindexes(fcpl, 4); - break; - case 2: - H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1); - break; - case 3: - H5Pset_istore_k(fcpl, ISTORE_IK); - H5Pset_shared_mesg_nindexes(fcpl, 4); - break; - case 4: - H5Pset_istore_k(fcpl, ISTORE_IK); - H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1); - break; - case 5: - H5Pset_shared_mesg_nindexes(fcpl, 4); - H5Pset_file_space_page_size(fcpl, (hsize_t)512); - break; - case 6: - H5Pset_istore_k(fcpl, ISTORE_IK); - H5Pset_shared_mesg_nindexes(fcpl, 4); - H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1); - break; - default: - break; + case 0: + H5Pset_istore_k(fcpl, ISTORE_IK); + break; + case 1: + H5Pset_shared_mesg_nindexes(fcpl, 4); + break; + case 2: + H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1); + break; + case 3: + H5Pset_istore_k(fcpl, ISTORE_IK); + H5Pset_shared_mesg_nindexes(fcpl, 4); + break; + case 4: + H5Pset_istore_k(fcpl, ISTORE_IK); + H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1); + break; + case 5: + H5Pset_shared_mesg_nindexes(fcpl, 4); + H5Pset_file_space_page_size(fcpl, (hsize_t)512); + break; + case 6: + H5Pset_istore_k(fcpl, ISTORE_IK); + H5Pset_shared_mesg_nindexes(fcpl, 4); + H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1); + break; + default: + break; } /* Create the file */ @@ -604,8 +607,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what) goto error; - /* - * Create a contiguous dataset + /* + * Create a contiguous dataset */ /* Create dataspace */ @@ -622,8 +625,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what) if(H5Dclose(did1) < 0) goto error; - /* - * Create 2 chunked datasets with extensible array chunk indexing type + /* + * Create 2 chunked datasets with extensible array chunk indexing type * (one with data; one without data) */ @@ -657,8 +660,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what) goto error; - /* - * Create 2 chunked datasets with version 2 B-tree chunk indexing type + /* + * Create 2 chunked datasets with version 2 B-tree chunk indexing type * (one with data; one without data) */ @@ -689,7 +692,7 @@ gen_ext(const char *fname, unsigned new_format, unsigned what) goto error; /* - * Create 2 chunked datasets with fixed array chunk indexing type + * Create 2 chunked datasets with fixed array chunk indexing type * (one with data; one without data) */ @@ -719,8 +722,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what) goto error; - /* - * Create 2 chunked datasets with implicit chunk indexing type + /* + * Create 2 chunked datasets with implicit chunk indexing type * (one with data; one without data) */ diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake index 3c65b0b..7d76fba 100644 --- a/tools/test/h5import/CMakeTests.cmake +++ b/tools/test/h5import/CMakeTests.cmake @@ -283,9 +283,10 @@ macro (ADD_H5_SKIP_DUMPTEST testname datasetname testfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5IMPORT-DUMP-${testname}-SKIPPED + NAME H5IMPORT-DUMP-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname} ${datasetname} ${testfile} --- DEFLATE filter not available" ) + set_property(TEST H5IMPORT-DUMP-${testname} PROPERTY DISABLED) endif () endmacro () diff --git a/tools/test/h5import/h5importtest.c b/tools/test/h5import/h5importtest.c index 489bc01..bbb67b6 100644 --- a/tools/test/h5import/h5importtest.c +++ b/tools/test/h5import/h5importtest.c @@ -71,9 +71,9 @@ main(void) volatile uint32_t ibyte=0x01234567; /* 0 for big endian, 1 for little endian. */ if ((*((uint8_t*)(&ibyte))) == 0x67) - strncpy(machine_order, "LE", 2); + HDstrncpy(machine_order, "LE", 2); else - strncpy(machine_order, "BE", 2); + HDstrncpy(machine_order, "BE", 2); /* diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c index 7cfde36..26a427d 100644 --- a/tools/test/h5jam/getub.c +++ b/tools/test/h5jam/getub.c @@ -148,7 +148,7 @@ main(int argc, const char *argv[]) error: if(buf) HDfree(buf); - if(fd > -1) + if(fd >= 0) HDclose(fd); return EXIT_FAILURE; } /* end main() */ diff --git a/tools/test/h5jam/tellub.c b/tools/test/h5jam/tellub.c index 8e4b3ac..26c725d 100644 --- a/tools/test/h5jam/tellub.c +++ b/tools/test/h5jam/tellub.c @@ -26,9 +26,9 @@ */ static const char *s_opts = "h"; static struct long_options l_opts[] = { - {"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {NULL, 0, '\0'} + {"help", no_arg, 'h'}, + {"hel", no_arg, 'h'}, + {NULL, 0, '\0'} }; /*------------------------------------------------------------------------- @@ -37,152 +37,126 @@ static struct long_options l_opts[] = { * Purpose: Print the usage message * * Return: void - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ static void usage (const char *prog) { - fflush (stdout); - fprintf (stdout, "usage: %s h5_file\n", prog); - fprintf (stdout, - " Check that h5_fil is HDF5 file and print size of user block \n"); - fprintf (stdout, " %s -h\n", prog); - fprintf (stdout, " Print a usage message and exit\n"); -} + HDfflush(stdout); + HDfprintf(stdout, "usage: %s h5_file\n", prog); + HDfprintf(stdout, + " Check that h5_fil is HDF5 file and print size of user block \n"); + HDfprintf(stdout, " %s -h\n", prog); + HDfprintf(stdout, " Print a usage message and exit\n"); +} /* end usage() */ /*------------------------------------------------------------------------- * Function: parse_command_line * * Purpose: Parse the command line for the h5dumper. * - * Return: Success: - * + * Return: Success: void * Failure: Exits program with EXIT_FAILURE value. - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ static void parse_command_line (int argc, const char *argv[]) { - int opt; - - /* parse command line options */ - while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) - { - switch ((char) opt) - { - case 'h': - usage (h5tools_getprogname()); - exit (EXIT_SUCCESS); - case '?': - default: - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); - } + int opt; + + /* parse command line options */ + while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) { + switch ((char) opt) { + case 'h': + usage (h5tools_getprogname()); + HDexit(EXIT_SUCCESS); + case '?': + default: + usage (h5tools_getprogname()); + HDexit(EXIT_FAILURE); + } } - /* check for file name to be processed */ - if (argc <= opt_ind) - { - error_msg("missing file name\n"); - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); + /* check for file name to be processed */ + if (argc <= opt_ind) { + error_msg("missing file name\n"); + usage (h5tools_getprogname()); + HDexit(EXIT_FAILURE); } -} +} /* end parse_command_line() */ /*------------------------------------------------------------------------- * Function: main * * Purpose: HDF5 user block unjammer * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: - * - * Modifications: - * + * Return: EXIT_SUCCESS/EXIT_FAILURE *------------------------------------------------------------------------- */ int main (int argc, const char *argv[]) { - char *ifname; - void *edata; - H5E_auto2_t func; - hid_t ifile; - hsize_t usize; - htri_t testval; - herr_t status; - hid_t plist; - - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); - - /* Initialize h5tools lib */ - h5tools_init(); - - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - parse_command_line (argc, argv); - - if (argc <= (opt_ind)) - { - error_msg("missing file name\n"); - usage (h5tools_getprogname()); - return (EXIT_FAILURE); + char *ifname; + void *edata; + H5E_auto2_t func; + hid_t ifile; + hsize_t usize; + htri_t testval; + herr_t status; + hid_t plist = -1; + + h5tools_setprogname(PROGRAMNAME); + h5tools_setstatus(EXIT_SUCCESS); + + /* Initialize h5tools lib */ + h5tools_init(); + + /* Disable error reporting */ + H5Eget_auto2(H5E_DEFAULT, &func, &edata); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + + parse_command_line(argc, argv); + + if(argc <= (opt_ind)) { + error_msg("missing file name\n"); + usage (h5tools_getprogname()); + return EXIT_FAILURE; } - ifname = HDstrdup (argv[opt_ind]); + ifname = HDstrdup(argv[opt_ind]); - testval = H5Fis_hdf5 (ifname); + testval = H5Fis_accessible(ifname, H5P_DEFAULT); - if (testval <= 0) - { - error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname); - return (EXIT_FAILURE); + if(testval <= 0) { + error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname); + return EXIT_FAILURE; } - ifile = H5Fopen (ifname, H5F_ACC_RDONLY, H5P_DEFAULT); + ifile = H5Fopen(ifname, H5F_ACC_RDONLY, H5P_DEFAULT); - if (ifile < 0) - { - error_msg("Can't open input HDF5 file \"%s\"\n", ifname); - return (EXIT_FAILURE); + if(ifile < 0) { + error_msg("Can't open input HDF5 file \"%s\"\n", ifname); + return EXIT_FAILURE; } - plist = H5Fget_create_plist (ifile); - if (plist < 0) - { - error_msg("Can't get file creation plist for file \"%s\"\n", - ifname); - return (EXIT_FAILURE); + plist = H5Fget_create_plist(ifile); + if(plist < 0) { + error_msg("Can't get file creation plist for file \"%s\"\n", ifname); + return EXIT_FAILURE; } - status = H5Pget_userblock (plist, &usize); - if (status < 0) - { - error_msg("Can't get user block for file \"%s\"\n", ifname); - return (EXIT_FAILURE); + status = H5Pget_userblock(plist, &usize); + if(status < 0) { + error_msg("Can't get user block for file \"%s\"\n", ifname); + return EXIT_FAILURE; } - printf ("%ld\n", (long) usize); + HDprintf("%ld\n", (long) usize); - H5Pclose (plist); - H5Fclose (ifile); + H5Pclose (plist); + H5Fclose (ifile); - return (EXIT_SUCCESS); -} + return EXIT_SUCCESS; +} /* end main() */ diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt index 5b8cbe0..dc5804c 100644 --- a/tools/test/h5ls/CMakeLists.txt +++ b/tools/test/h5ls/CMakeLists.txt @@ -4,29 +4,31 @@ project (HDF5_TOOLS_TEST_H5LS C) #----------------------------------------------------------------------------- # If plugin library tests can be tested #----------------------------------------------------------------------------- -set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibls") -set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") -set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) +if (BUILD_SHARED_LIBS) + set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibls") + set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) -add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c) -target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) -target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) -H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c) + target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") -# make plugins dir -file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") -#----------------------------------------------------------------------------- -# Copy plugin library to a plugins folder -#----------------------------------------------------------------------------- -add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" - "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" -) + # make plugins dir + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- + # Copy plugin library to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" + "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" + ) +endif () include (CMakeTests.cmake) diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index d03a344..488b271 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -470,4 +470,6 @@ ############################################################################## ### P L U G I N T E S T S ############################################################################## -ADD_H5_UD_TEST (h5ls_plugin_test 0 tudfilter -w80 -d tudfilter.h5) +if (BUILD_SHARED_LIBS) + ADD_H5_UD_TEST (h5ls_plugin_test 0 tudfilter -w80 -d tudfilter.h5) +endif () diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt index 2a168e9..890d5d2 100644 --- a/tools/test/h5repack/CMakeLists.txt +++ b/tools/test/h5repack/CMakeLists.txt @@ -32,45 +32,47 @@ set_target_properties (h5repacktest PROPERTIES FOLDER tools) #----------------------------------------------------------------------------- # If plugin library tests can be tested #----------------------------------------------------------------------------- -set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") -set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") -set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) -set (HDF5_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers") -set (HDF5_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_VCORENAME}") -set (HDF5_TOOL_PLUGIN_LIB_VTARGET ${HDF5_TOOL_PLUGIN_LIB_VCORENAME}) +if (BUILD_SHARED_LIBS) + set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") + set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + set (HDF5_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers") + set (HDF5_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_VCORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_VTARGET ${HDF5_TOOL_PLUGIN_LIB_VCORENAME}) -add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) -target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) -target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) -H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) + target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") -add_library (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) -target_include_directories(${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED) -target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) -H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") + add_library (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) + target_include_directories(${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED) + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") -# make plugins dir -file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") -#----------------------------------------------------------------------------- -# Copy plugin library to a plugins folder -#----------------------------------------------------------------------------- -add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" - "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" -) -add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_VTARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>" - "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>" -) + # make plugins dir + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- + # Copy plugin library to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" + "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" + ) + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_VTARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>" + "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>" + ) +endif () include (CMakeTests.cmake) diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index f40c0b1..3ee5e27 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -229,9 +229,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_OLD-${testname}-SKIPPED + NAME H5REPACK_OLD-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" ) + set_property(TEST H5REPACK_OLD-${testname} PROPERTY DISABLED) endif () else () add_test ( @@ -260,9 +261,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK-${testname}-SKIPPED + NAME H5REPACK-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" ) + set_property(TEST H5REPACK-${testname} PROPERTY DISABLED) endif () else () add_test ( @@ -291,9 +293,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_CMP-${testname}-SKIPPED + NAME H5REPACK_CMP-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) + set_property(TEST H5REPACK_CMP-${testname} PROPERTY DISABLED) endif () else () # If using memchecker add tests without using scripts @@ -338,9 +341,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_MASK-${testname}-SKIPPED + NAME H5REPACK_MASK-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) + set_property(TEST H5REPACK_MASK-${testname} PROPERTY DISABLED) endif () else () # If using memchecker add tests without using scripts @@ -385,9 +389,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_DMP-${testname}-SKIPPED + NAME H5REPACK_DMP-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) + set_property(TEST H5REPACK_DMP-${testname} PROPERTY DISABLED) endif () else () add_test ( @@ -427,9 +432,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_STAT-${testname}-SKIPPED + NAME H5REPACK_STAT-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile}" ) + set_property(TEST H5REPACK_STAT-${testname} PROPERTY DISABLED) endif () else () add_test ( @@ -469,9 +475,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_VERIFY_LAYOUT-${testname}-SKIPPED + NAME H5REPACK_VERIFY_LAYOUT-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) + set_property(TEST H5REPACK_VERIFY_LAYOUT-${testname} PROPERTY DISABLED) endif () else () if (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -542,9 +549,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}-SKIPPED + NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) + set_property(TEST H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTY DISABLED) endif () else () if (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -1442,11 +1450,13 @@ ADD_H5_VERIFY_INVALIDBOUNDS (latest_latest_invalid bounds_latest_latest.h5 0 1) ############################################################################## ### P L U G I N T E S T S ############################################################################## +if (BUILD_SHARED_LIBS) ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,0,4,9,${H5_VERS_MAJOR},${H5_VERS_MINOR},${H5_VERS_RELEASE}) ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,0,1,9) ADD_H5_UD_TEST (plugin_none 0 h5repack_layout.UD.h5 -v -f NONE) # check for no parameters ADD_H5_UD_TEST (plugin_zero 0 h5repack_layout.h5 -v -f UD=250,0,0) +endif () if (HDF5_TEST_VFD) # Run test with different Virtual File Driver diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index b0a2f99..a36eb08 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -997,6 +997,7 @@ fi ############################################################################## ### T H E T E S T S ############################################################################## + # prepare for test COPY_TESTFILES_TO_TESTDIR diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index f6166da..0ae570b 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -3728,7 +3728,7 @@ out: H5Pclose(fcpl); H5Fclose(fid); } H5E_END_TRY; - if(fd > 0) + if(fd >= 0) HDclose(fd); return -1; @@ -3797,7 +3797,7 @@ out: H5Pclose(fcpl); H5Fclose(fid); } H5E_END_TRY; - if(fd > 0) + if(fd >= 0) HDclose(fd); return -1; @@ -3838,7 +3838,7 @@ make_userblock_file(void) out: - if(fd > 0) + if(fd >= 0) HDclose(fd); return -1; @@ -4134,13 +4134,19 @@ int write_dset_in(hid_t loc_id, } /* create a type larger than TEST_BUFSIZE */ - if ((tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims)) < 0) + if ((tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims)) < 0) { + HDfree(dbuf); goto out; + } size = H5Tget_size(tid); - if ((sid = H5Screate_simple(1, sdims, NULL)) < 0) + if ((sid = H5Screate_simple(1, sdims, NULL)) < 0) { + HDfree(dbuf); goto out; - if ((did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + } + if ((did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + HDfree(dbuf); goto out; + } #if defined(WRITE_ARRAY) H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf); #endif @@ -4149,7 +4155,7 @@ int write_dset_in(hid_t loc_id, H5Dclose(did); H5Tclose(tid); H5Sclose(sid); - HDfree( dbuf ); + HDfree(dbuf); } /*------------------------------------------------------------------------- diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst index 069fb3b..4e69148 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst @@ -2,34 +2,43 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dcreate2(): unable to create dataset major: Dataset minor: Unable to initialize object - #001: (file name) line (number) in H5D__create_named(): unable to create and link to dataset + #001: (file name) line (number) in H5VL_dataset_create(): dataset create failed + major: Virtual Object Layer + minor: Unable to create file + #002: (file name) line (number) in H5VL__dataset_create(): dataset create failed + major: Virtual Object Layer + minor: Unable to create file + #003: (file name) line (number) in H5VL__native_dataset_create(): unable to create dataset major: Dataset minor: Unable to initialize object - #002: (file name) line (number) in H5L_link_object(): unable to create new link to object + #004: (file name) line (number) in H5D__create_named(): unable to create and link to dataset + major: Dataset + minor: Unable to initialize object + #005: (file name) line (number) in H5L_link_object(): unable to create new link to object major: Links minor: Unable to initialize object - #003: (file name) line (number) in H5L__create_real(): can't insert link + #006: (file name) line (number) in H5L__create_real(): can't insert link major: Links minor: Unable to insert object - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #007: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #008: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #006: (file name) line (number) in H5L__link_cb(): unable to create object + #009: (file name) line (number) in H5L__link_cb(): unable to create object major: Links minor: Unable to initialize object - #007: (file name) line (number) in H5O_obj_create(): unable to open object + #010: (file name) line (number) in H5O_obj_create(): unable to open object major: Object header minor: Can't open object - #008: (file name) line (number) in H5O__dset_create(): unable to create dataset + #011: (file name) line (number) in H5O__dset_create(): unable to create dataset major: Dataset minor: Unable to initialize object - #009: (file name) line (number) in H5D__create(): unable to construct layout information + #012: (file name) line (number) in H5D__create(): unable to construct layout information major: Dataset minor: Unable to initialize object - #010: (file name) line (number) in H5D__chunk_construct(): dimensionality of chunks doesn't match the dataspace + #013: (file name) line (number) in H5D__chunk_construct(): dimensionality of chunks doesn't match the dataspace major: Dataset minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl index a1fc0cb..1d2914b 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl @@ -11,7 +11,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -33,7 +33,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -55,7 +55,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -77,7 +77,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -99,7 +99,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -121,7 +121,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -143,7 +143,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 4 } } } FILLVALUE { diff --git a/tools/test/h5stat/h5stat_gentest.c b/tools/test/h5stat/h5stat_gentest.c index 2daf24b..ae11032 100644 --- a/tools/test/h5stat/h5stat_gentest.c +++ b/tools/test/h5stat/h5stat_gentest.c @@ -14,7 +14,7 @@ /* * Generate the binary hdf5 files for the h5stat tests. * Usage: just execute the program without any arguments will - * generate all the binary hdf5 files + * generate all the binary hdf5 files * * If you regenerate the test files (e.g., changing some code, * trying it on a new platform, ...), you need to verify the correctness @@ -24,25 +24,25 @@ #include "H5private.h" /* For gen_newgrat_file() */ -#define NEWGRAT_FILE "h5stat_newgrat.h5" -#define DATASET_NAME "DATASET_NAME" -#define GROUP_NAME "GROUP" -#define ATTR_NAME "ATTR" -#define NUM_GRPS 35000 -#define NUM_ATTRS 100 +#define NEWGRAT_FILE "h5stat_newgrat.h5" +#define DATASET_NAME "DATASET_NAME" +#define GROUP_NAME "GROUP" +#define ATTR_NAME "ATTR" +#define NUM_GRPS 35000 +#define NUM_ATTRS 100 /* Declarations for gen_idx_file() */ -#define IDX_FILE "h5stat_idx.h5" -#define DSET "dset" -#define DSET_FILTER "dset_filter" +#define IDX_FILE "h5stat_idx.h5" +#define DSET "dset" +#define DSET_FILTER "dset_filter" /* For gen_threshold_file() */ -#define THRESHOLD_FILE "h5stat_threshold.h5" -#define THRES_ATTR_NAME "attr" -#define THRES_ATTR_GRP_NAME "grp_attr" -#define THRES_DSET_NAME "dset" -#define THRES_NUM 10 -#define THRES_NUM_25 25 +#define THRESHOLD_FILE "h5stat_threshold.h5" +#define THRES_ATTR_NAME "attr" +#define THRES_ATTR_GRP_NAME "grp_attr" +#define THRES_DSET_NAME "dset" +#define THRES_NUM 10 +#define THRES_NUM_25 25 /* For gen_err_refcount() */ #define ERR_REFCOUNT_FILE "h5stat_err_refcount.h5" @@ -51,7 +51,7 @@ * Generate HDF5 file with latest format with * NUM_GRPS groups and NUM_ATTRS attributes for the dataset */ -static void +static void gen_newgrat_file(const char *fname) { hid_t fcpl = -1; /* File creation property */ @@ -62,79 +62,66 @@ gen_newgrat_file(const char *fname) hid_t sid = -1; /* Dataspace id */ hid_t attr_id = -1; /* Attribute id */ hid_t did = -1; /* Dataset id */ - char name[30]; /* Group name */ - char attrname[30]; /* Attribute name */ - int i; /* Local index variable */ + char name[30]; /* Group name */ + char attrname[30]; /* Attribute name */ + int i; /* Local index variable */ /* Get a copy file access property list */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - goto error; + goto error; /* Set to use latest library format */ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - goto error; + goto error; /* Get a copy of file creation property list */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - goto error; + goto error; /* Set file space handling strategy */ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, 1, (hsize_t)1) < 0) - goto error; + goto error; /* Create file */ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - goto error; + goto error; /* Create NUM_GRPS groups in the root group */ for(i = 1; i <= NUM_GRPS; i++) { sprintf(name, "%s%d", GROUP_NAME,i); if((gid = H5Gcreate2(fid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Gclose(gid) < 0) - goto error; + goto error; } /* end for */ /* Create a datatype to commit and use */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) - goto error; + goto error; /* Create dataspace for dataset */ if((sid = H5Screate(H5S_SCALAR)) < 0) - goto error; + goto error; /* Create dataset */ if((did = H5Dcreate2(fid, DATASET_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Create NUM_ATTRS for the dataset */ for(i = 1; i <= NUM_ATTRS; i++) { sprintf(attrname, "%s%d", ATTR_NAME,i); if((attr_id = H5Acreate2(did, attrname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Aclose(attr_id) < 0) - goto error; + goto error; } /* end for */ /* Close dataset, dataspace, datatype, file */ - if(H5Pclose(fapl) < 0) - goto error; - if(H5Pclose(fcpl) < 0) - goto error; - if(H5Dclose(did) < 0) - goto error; - if(H5Sclose(sid) < 0) - goto error; - if(H5Tclose(tid) < 0) - goto error; - if(H5Fclose(fid) < 0) - goto error; - error: H5E_BEGIN_TRY { - H5Pclose(fapl); - H5Pclose(fcpl); - H5Aclose(attr_id); + H5Pclose(fapl); + H5Pclose(fcpl); + H5Aclose(attr_id); H5Dclose(did); H5Tclose(tid); H5Sclose(sid); @@ -145,192 +132,175 @@ error: /* * Generate an HDF5 file with groups, datasets, attributes for testing the options: - * -l N (--links=N): Set the threshold for # of links when printing information for small groups. - * -m N (--dims=N): Set the threshold for the # of dimension sizes when printing information for small datasets. - * -a N (--numattrs=N): Set the threshold for the # of attributes when printing information for small # of attributes. + * -l N (--links=N): Set the threshold for # of links when printing information for small groups. + * -m N (--dims=N): Set the threshold for the # of dimension sizes when printing information for small datasets. + * -a N (--numattrs=N): Set the threshold for the # of attributes when printing information for small # of attributes. */ static void gen_threshold_file(const char *fname) { - hid_t fid; /* File ID */ - hid_t sid0, sid1, sid2, sid3, sid4; /* Dataspace IDs */ - hid_t did; /* Dataset ID */ - hid_t attr_id; /* Attribute ID */ - hid_t gid; /* Group ID */ - hsize_t two_dims[] = {2, 5}; /* Dimension array */ - hsize_t one_dims[] = {6}; /* Dimension array */ - hsize_t zero_dims[] = {0}; /* Dimension array */ - char name[30]; /* Name */ - unsigned i; /* Local index variable */ + hid_t fid = -1; /* File ID */ + hid_t sid0 = -1; /* Dataspace IDs */ + hid_t sid1 = -1; /* Dataspace IDs */ + hid_t sid2 = -1; /* Dataspace IDs */ + hid_t sid3 = -1; /* Dataspace IDs */ + hid_t sid4 = -1; /* Dataspace IDs */ + hid_t did = -1; /* Dataset ID */ + hid_t attr_id = -1; /* Attribute ID */ + hid_t gid = -1; /* Group ID */ + hsize_t two_dims[] = {2, 5}; /* Dimension array */ + hsize_t one_dims[] = {6}; /* Dimension array */ + hsize_t zero_dims[] = {0}; /* Dimension array */ + char name[30]; /* Name */ + unsigned i; /* Local index variable */ /* Create file */ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Create 1-D dataspace with zero dimension size */ if((sid0 = H5Screate_simple(1, zero_dims, NULL)) < 0) - goto error; + goto error; /* Create 1-D dataspace with non-zero dimension size*/ if((sid1 = H5Screate_simple(1, one_dims, NULL)) < 0) - goto error; + goto error; /* Create 2-D dataspace */ if((sid2 = H5Screate_simple(2, two_dims, NULL)) < 0) - goto error; + goto error; /* Create scalar dataspace */ if((sid3 = H5Screate(H5S_SCALAR)) < 0) - goto error; + goto error; /* Create null dataspace */ if((sid4 = H5Screate(H5S_NULL)) < 0) - goto error; + goto error; /* Create an attribute for the root group */ if((attr_id = H5Acreate2(fid, "attr", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Aclose(attr_id) < 0) - goto error; + goto error; /* Create 1-D dataset with zero dimension size for the root group */ if((did = H5Dcreate2(fid, "zero_dset", H5T_NATIVE_UCHAR, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Create 11 attributes for the dataset */ for(i = 1; i <= (THRES_NUM+1); i++) { sprintf(name, "%s%d", THRES_ATTR_NAME,i); if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Aclose(attr_id) < 0) - goto error; + goto error; } if(H5Dclose(did) < 0) - goto error; + goto error; /* Create dataset with scalar dataspace for the root group */ if((did = H5Dcreate2(fid, "scalar_dset", H5T_NATIVE_UCHAR, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Dclose(did) < 0) - goto error; + goto error; /* Create dataset with null dataspace for the root group */ if((did = H5Dcreate2(fid, "null_dset", H5T_NATIVE_UCHAR, sid4, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Dclose(did) < 0) - goto error; + goto error; /* Create 2-D dataset for the root group */ if((did = H5Dcreate2(fid, "dset", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Create 10 attributes for the 2-D dataset */ for(i = 1; i <= THRES_NUM; i++) { sprintf(name, "%s%d", THRES_ATTR_NAME,i); if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Aclose(attr_id) < 0) - goto error; + goto error; } if(H5Dclose(did) < 0) - goto error; + goto error; /* Create first group */ if((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Create an attribute for the group */ if((attr_id = H5Acreate2(gid, "ATTR", H5T_NATIVE_INT, sid3, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Close attribute */ if(H5Aclose(attr_id) < 0) - goto error; + goto error; /* Create 10 1-D datasets with non-zero dimension size for the group */ for(i = 1; i <= THRES_NUM; i++) { - /* set up dataset name */ + /* set up dataset name */ sprintf(name, "%s%d", THRES_DSET_NAME,i); - /* Create the dataset */ - if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + /* Create the dataset */ + if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; - /* Close the dataset */ + /* Close the dataset */ if(H5Dclose(did) < 0) - goto error; + goto error; } /* Close the group */ if(H5Gclose(gid) < 0) - goto error; + goto error; /* Create second group */ if((gid = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Create 25 attributes for the group */ for(i = 1; i <= THRES_NUM_25; i++) { - /* Set up attribute name */ + /* Set up attribute name */ sprintf(name, "%s%d", THRES_ATTR_GRP_NAME,i); - /* Create the attribute */ + /* Create the attribute */ if((attr_id = H5Acreate2(gid, name, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; - /* Close the attribute */ + /* Close the attribute */ if(H5Aclose(attr_id) < 0) - goto error; + goto error; } /* Close the group */ if(H5Gclose(gid) < 0) - goto error; + goto error; /* Create third group */ if((gid = H5Gcreate2(fid, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Create 9 1-D datasets with non-zero dimension size for the group */ for(i = 1; i < THRES_NUM; i++) { - /* set up dataset name */ + /* set up dataset name */ sprintf(name, "%s%d", THRES_DSET_NAME,i); - /* Create the dataset */ - if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + /* Create the dataset */ + if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; - /* Close the dataset */ + /* Close the dataset */ if(H5Dclose(did) < 0) - goto error; + goto error; } - /* Close the group */ - if(H5Gclose(gid) < 0) - goto error; - - - /* Close dataspaces */ - if(H5Sclose(sid0) < 0) - goto error; - if(H5Sclose(sid1) < 0) - goto error; - if(H5Sclose(sid2) < 0) - goto error; - if(H5Sclose(sid3) < 0) - goto error; - if(H5Sclose(sid4) < 0) - goto error; - - /* Close file */ - if(H5Fclose(fid) < 0) - goto error; - error: H5E_BEGIN_TRY { H5Gclose(gid); - H5Aclose(attr_id); + H5Aclose(attr_id); H5Dclose(did); H5Sclose(sid0); H5Sclose(sid1); @@ -346,84 +316,73 @@ error: * Function: gen_idx_file * * Purpose: Create a file with datasets that use Fixed Array indexing: - * one dataset: fixed dimension, chunked layout, w/o filters - * one dataset: fixed dimension, chunked layout, w/ filters + * one dataset: fixed dimension, chunked layout, w/o filters + * one dataset: fixed dimension, chunked layout, w/ filters * */ -static void +static void gen_idx_file(const char *fname) { - hid_t fapl = -1; /* file access property id */ - hid_t fid = -1; /* file id */ - hid_t sid = -1; /* space id */ - hid_t dcpl = -1; /* dataset creation property id */ - hid_t did = -1, did2 = -1; /* dataset id */ - hsize_t dims[1] = {10}; /* dataset dimension */ - hsize_t c_dims[1] = {2}; /* chunk dimension */ - int i; /* local index variable */ - int buf[10]; /* data buffer */ + hid_t fapl = -1; /* file access property id */ + hid_t fid = -1; /* file id */ + hid_t sid = -1; /* space id */ + hid_t dcpl = -1; /* dataset creation property id */ + hid_t did = -1, did2 = -1; /* dataset id */ + hsize_t dims[1] = {10}; /* dataset dimension */ + hsize_t c_dims[1] = {2}; /* chunk dimension */ + int i; /* local index variable */ + int buf[10]; /* data buffer */ /* Get a copy of the file access property */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - goto error; + goto error; /* Set the "use the latest format" bounds for creating objects in the file */ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - goto error; + goto error; /* Create file */ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; /* Create data */ for(i = 0; i < 10; i++) - buf[i] = i; + buf[i] = i; /* Set chunk */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; + goto error; if(H5Pset_chunk(dcpl, 1, c_dims) < 0) - goto error; + goto error; /* Create a 1D dataset */ if((sid = H5Screate_simple(1, dims, NULL)) < 0) - goto error; + goto error; if((did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - + goto error; + /* Write to the dataset */ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto error; + goto error; #if defined (H5_HAVE_FILTER_DEFLATE) /* set deflate data */ if(H5Pset_deflate(dcpl, 9) < 0) - goto error; + goto error; /* Create and write the dataset */ if((did2 = H5Dcreate2(fid, DSET_FILTER, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto error; + goto error; /* Close the dataset */ if(H5Dclose(did2) < 0) - goto error; + goto error; #endif /* closing: dataspace, dataset, file */ - if(H5Pclose(fapl) < 0) - goto error; - if(H5Pclose(dcpl) < 0) - goto error; - if(H5Sclose(sid) < 0) - goto error; - if(H5Dclose(did) < 0) - goto error; - if(H5Fclose(fid) < 0) - goto error; - error: H5E_BEGIN_TRY { H5Pclose(fapl); @@ -451,7 +410,7 @@ error: * H5O_refcount_decode in the jira issue. * */ -static void +static void gen_err_refcount(const char *fname) { hid_t fid = -1; /* File identifier */ @@ -525,16 +484,13 @@ gen_err_refcount(const char *fname) /* Offset of the message ID to modify is as follows: */ /* 4520: the offset of the object header containing the attribute message with the committed datatype */ - /* 24: the offset in the object header containing the version of the + /* 24: the offset in the object header containing the version of the attribute message */ - if((fd = HDopen(fname, O_RDWR, 0633)) < 0) - goto error; - if(HDlseek(fd, 4520+24, SEEK_SET) < 0) - goto error; - if(HDwrite(fd, &val, 2) < 0) - goto error; - if(HDclose(fd) < 0) - goto error; + if((fd = HDopen(fname, O_RDWR, 0633)) >= 0) { + HDlseek(fd, 4520+24, SEEK_SET); + HDwrite(fd, &val, 2); + HDclose(fd); + } error: H5E_BEGIN_TRY { @@ -548,8 +504,8 @@ error: } H5E_END_TRY; } /* gen_err_refcount() */ -/* - * The following two test files are generated with older versions +/* + * The following two test files are generated with older versions * of the library for HDFFV-10333. They are used for testing in * testh5stat.sh.in. * @@ -559,7 +515,7 @@ error: * Then a "0" is written to the "dimension" field in the layout * message to trigger the error. * This is to verify HDFFV-10333 that h5stat will exit gracefully - * when encountered error similar to H5O__layout_decode in the + * when encountered error similar to H5O__layout_decode in the * jira issue. * * (2) h5stat_err_old_fill.h5 @@ -568,7 +524,7 @@ error: * Then an illegal size is written to the "size" fild in the * fill value message to trigger the error. * This is to verify HDFFV-10333 that h5stat will exit gracefully - * when encountered error similar to H5O_fill_old_decode in the + * when encountered error similar to H5O_fill_old_decode in the * jira issue. */ diff --git a/tools/test/h5stat/testh5stat.sh.in b/tools/test/h5stat/testh5stat.sh.in index 5082daf..0a5127f 100644 --- a/tools/test/h5stat/testh5stat.sh.in +++ b/tools/test/h5stat/testh5stat.sh.in @@ -249,7 +249,6 @@ TOOLTEST h5stat_help2.ddl --help TOOLTEST h5stat_notexist.ddl notexist.h5 TOOLTEST h5stat_nofile.ddl '' - # Test file with groups, compressed datasets, user-applied fileters, etc. # h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4 TOOLTEST h5stat_filters.ddl h5stat_filters.h5 diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake index 37da903..830de11 100644 --- a/tools/test/misc/CMakeTestsRepart.cmake +++ b/tools/test/misc/CMakeTestsRepart.cmake @@ -68,6 +68,7 @@ scd_family00001.h5 scd_family00002.h5 scd_family00003.h5 + family_to_single.h5 family_to_sec2.h5 ) if (NOT "${last_test}" STREQUAL "") @@ -84,6 +85,10 @@ set_tests_properties (H5REPART-h5repart_5K PROPERTIES DEPENDS H5REPART-clearall-objects) # convert family file to sec2 file of 20,000 bytes + add_test (NAME H5REPART-h5repart_single COMMAND $<TARGET_FILE:h5repart> -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5) + set_tests_properties (H5REPART-h5repart_single PROPERTIES DEPENDS H5REPART-clearall-objects) + + # convert family file to sec2 file of 20,000 bytes (old argument) add_test (NAME H5REPART-h5repart_sec2 COMMAND $<TARGET_FILE:h5repart> -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES DEPENDS H5REPART-clearall-objects) diff --git a/tools/test/misc/repart_test.c b/tools/test/misc/repart_test.c index 4016ee8..b8e0292 100644 --- a/tools/test/misc/repart_test.c +++ b/tools/test/misc/repart_test.c @@ -26,12 +26,13 @@ const char *FILENAME[] = { "fst_family%05d.h5", "scd_family%05d.h5", + "family_to_single.h5", "family_to_sec2.h5", NULL }; herr_t test_family_h5repart_opens(void); -herr_t test_sec2_h5repart_opens(void); +herr_t test_single_h5repart_opens(void); /*------------------------------------------------------------------------- @@ -90,23 +91,28 @@ error: /*------------------------------------------------------------------------- - * Function: test_sec2_h5repart_opens + * Function: test_single_h5repart_opens * - * Purpose: Tries to reopen a sec2 file. + * Purpose: Tries to reopen a single file. * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -test_sec2_h5repart_opens(void) +test_single_h5repart_opens(void) { hid_t fid = -1; - /* open the sec2 file */ + /* open the single file */ if ((fid = H5Fopen(FILENAME[2], H5F_ACC_RDWR, H5P_DEFAULT)) < 0) goto error; + if (H5Fclose(fid) < 0) + goto error; + /* open the single file (created using the old argument) */ + if ((fid = H5Fopen(FILENAME[3], H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + goto error; if (H5Fclose(fid) < 0) goto error; @@ -119,7 +125,7 @@ error: return FAIL; -} /* end test_sec2_h5repart_opens() */ +} /* end test_single_h5repart_opens() */ /*------------------------------------------------------------------------- @@ -137,7 +143,7 @@ main(void) int nerrors = 0; nerrors += test_family_h5repart_opens() < 0 ? 1 : 0; - nerrors += test_sec2_h5repart_opens() < 0 ? 1 : 0; + nerrors += test_single_h5repart_opens() < 0 ? 1 : 0; if (nerrors) goto error; @@ -150,3 +156,4 @@ error: nerrors, 1 == nerrors ? "" : "S"); HDexit(EXIT_FAILURE); } /* end main() */ + diff --git a/tools/test/misc/testh5repart.sh.in b/tools/test/misc/testh5repart.sh.in index 594d37e..143f607 100644 --- a/tools/test/misc/testh5repart.sh.in +++ b/tools/test/misc/testh5repart.sh.in @@ -171,7 +171,9 @@ COPY_TESTFILES_TO_TESTDIR TOOLTEST -m 20000 family_file%05d.h5 fst_family%05d.h5 # repartition family member size to 5 KB. TOOLTEST -m 5k family_file%05d.h5 scd_family%05d.h5 -# convert family file to sec2 file of 20,000 bytes +# convert family file to single file of 20,000 bytes +TOOLTEST -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5 +# convert family file to single file of 20,000 bytes (old argument) TOOLTEST -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5 # test the output files repartitioned above. @@ -183,7 +185,7 @@ CLEAN_TESTFILES_AND_TESTDIR if test -z "$HDF5_NOCLEANUP"; then cd $actual_dir - rm -f fst_family*.h5 scd_family*.h5 family_to_sec2.h5 + rm -f fst_family*.h5 scd_family*.h5 family_to_single.h5 family_to_sec2.h5 fi if test $nerrors -eq 0 ; then diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index fa41608..14abdec 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -51,6 +51,16 @@ TARGET_C_PROPERTIES (iopipe STATIC) target_link_libraries (iopipe PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (iopipe PROPERTIES FOLDER perform) +#-- Adding test for chunk_cache +set (chunk_cache_SOURCES + ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk_cache.c +) +add_executable (chunk_cache ${chunk_cache_SOURCES}) +target_include_directories(chunk_cache PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +TARGET_C_PROPERTIES (chunk_cache STATIC) +target_link_libraries (chunk_cache PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +set_target_properties (chunk_cache PROPERTIES FOLDER perform) + #-- Adding test for overhead set (overhead_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/overhead.c diff --git a/tools/test/perform/Makefile.am b/tools/test/perform/Makefile.am index 5a89a66..39800d7 100644 --- a/tools/test/perform/Makefile.am +++ b/tools/test/perform/Makefile.am @@ -50,12 +50,12 @@ if BUILD_PARALLEL_CONDITIONAL TEST_PROG_PARA=h5perf perf endif # Serial test programs. -TEST_PROG = iopipe chunk overhead zip_perf perf_meta h5perf_serial $(BUILD_ALL_PROGS) +TEST_PROG = iopipe chunk chunk_cache overhead zip_perf perf_meta h5perf_serial $(BUILD_ALL_PROGS) # check_PROGRAMS will be built but not installed. Do not any executable # that is in bin_PROGRAMS already. Otherwise, it will be removed twice in # "make clean" and some systems, e.g., AIX, do not like it. -check_PROGRAMS= iopipe chunk overhead zip_perf perf_meta $(BUILD_ALL_PROGS) perf +check_PROGRAMS= iopipe chunk chunk_cache overhead zip_perf perf_meta $(BUILD_ALL_PROGS) perf h5perf_SOURCES=pio_perf.c pio_engine.c h5perf_serial_SOURCES=sio_perf.c sio_engine.c diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c new file mode 100644 index 0000000..429f70a --- /dev/null +++ b/tools/test/perform/chunk_cache.c @@ -0,0 +1,405 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: check the performance of chunk cache in these two cases (HDFFV-10601): + * 1. partial chunks exist along any dimension. + * 2. number of slots in chunk cache is smaller than the number of chunks + * in the fastest-growing dimension. + */ +#include "hdf5.h" +#include "H5private.h" + +#define FILENAME "chunk_cache_perf.h5" + +#define RANK 2 + +#define DSET1_NAME "partial_chunks" +#define DSET1_DIM1 9 * 1000 +#define DSET1_DIM2 9 +#define CHUNK1_DIM1 2 * 1000 +#define CHUNK1_DIM2 2 + +#define DSET2_NAME "hash_value" +#define DSET2_DIM1 300 +#define DSET2_DIM2 600 +#define CHUNK2_DIM1 100 +#define CHUNK2_DIM2 100 + +#define RDCC_NSLOTS 5 +#define RDCC_NBYTES 1024 * 1024 * 10 +#define RDCC_W0 0.75F + +#define FILTER_COUNTER 306 +static size_t nbytes_global; + +typedef struct test_time_t { + long tv_sec; + long tv_usec; +} test_time_t; + +/* Local function prototypes for the dummy filter */ +static size_t +counter (unsigned flags, size_t cd_nelmts, + const unsigned *cd_values, size_t nbytes, + size_t *buf_size, void **buf); + +/* This message derives from H5Z */ +const H5Z_class2_t H5Z_COUNTER[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + FILTER_COUNTER, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "counter", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + counter, /* The actual filter function */ +}}; + +/*------------------------------------------------------------------------- + * Count number of bytes but don't do anything else. Keep + * track of the data of chunks being read from file into memory. + */ +static size_t +counter (unsigned flags, size_t cd_nelmts, + const unsigned *cd_values, size_t nbytes, + size_t *buf_size, void **buf) +{ + nbytes_global += nbytes; + return nbytes; +} + +/*---------------------------------------------------------------------------*/ +double retrieve_time(void) +{ +#ifdef H5_HAVE_GETTIMEOFDAY + struct timeval t; + HDgettimeofday(&t, NULL); + return ((double)t.tv_sec + (double)t.tv_usec / 1000000); +#else + return 0.0; +#endif +} + +/*---------------------------------------------------------------------------*/ +static void +cleanup (void) +{ + if (!getenv ("HDF5_NOCLEANUP")) { + remove (FILENAME); + } +} + +/*------------------------------------------------------------------------------- + * Create a chunked dataset with partial chunks along either dimensions: + * dataset dimension: 9000 x 9 + * chunk dimension: 2000 x 2 + */ +static int create_dset1(hid_t file) +{ + hid_t dataspace, dataset; + hid_t dcpl; + hsize_t dims[RANK] = {DSET1_DIM1, DSET1_DIM2}; + hsize_t chunk_dims[RANK] = {CHUNK1_DIM1, CHUNK1_DIM2}; + int data[DSET1_DIM1][DSET1_DIM2]; /* data for writing */ + int i, j; + + /* Create the data space. */ + if((dataspace = H5Screate_simple (RANK, dims, NULL)) < 0) + goto error; + + /* Modify dataset creation properties, i.e. enable chunking */ + if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) + goto error; + if(H5Pset_chunk (dcpl, RANK, chunk_dims) < 0) + goto error; + + /* Set the dummy filter simply for counting the number of bytes being read into the memory */ + if(H5Zregister(H5Z_COUNTER) < 0) + goto error; + + if(H5Pset_filter(dcpl, FILTER_COUNTER, 0, 0, NULL) < 0) + goto error; + + /* Create a new dataset within the file using chunk creation properties. */ + if((dataset = H5Dcreate2 (file, DSET1_NAME, H5T_NATIVE_INT, dataspace, + H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + goto error; + + for (i = 0; i < DSET1_DIM1; i++) + for (j = 0; j < DSET1_DIM2; j++) + data[i][j] = i+j; + + /* Write data to dataset */ + if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, data) < 0) + goto error; + + /* Close resources */ + H5Dclose (dataset); + H5Pclose (dcpl); + H5Sclose (dataspace); + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose (dataset); + H5Pclose (dcpl); + H5Sclose (dataspace); + } H5E_END_TRY; + + return 1; +} + +/*--------------------------------------------------------------------------- + * Create a chunked dataset for testing hash values: + * dataset dimensions: 300 x 600 + * chunk dimensions: 100 x 100 + */ +static int create_dset2(hid_t file) +{ + hid_t dataspace, dataset; + hid_t dcpl; + hsize_t dims[RANK] = {DSET2_DIM1, DSET2_DIM2}; + hsize_t chunk_dims[RANK] = {CHUNK2_DIM1, CHUNK2_DIM2}; + int data[DSET2_DIM1][DSET2_DIM2]; /* data for writing */ + int i, j; + + /* Create the data space. */ + if((dataspace = H5Screate_simple (RANK, dims, NULL)) < 0) + goto error; + + /* Modify dataset creation properties, i.e. enable chunking */ + if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) + goto error; + if(H5Pset_chunk (dcpl, RANK, chunk_dims) < 0) + goto error; + + /* Set the dummy filter simply for counting the number of bytes being read into the memory */ + if(H5Zregister(H5Z_COUNTER) < 0) + goto error; + if(H5Pset_filter(dcpl, FILTER_COUNTER, 0, 0, NULL) < 0) + goto error; + + /* Create a new dataset within the file using chunk creation properties. */ + if((dataset = H5Dcreate2 (file, DSET2_NAME, H5T_NATIVE_INT, dataspace, + H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + goto error; + + for (i = 0; i < DSET2_DIM1; i++) + for (j = 0; j < DSET2_DIM2; j++) + data[i][j] = i+j; + + /* Write data to dataset */ + if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, data) < 0) + goto error; + + /* Close resources */ + H5Dclose (dataset); + H5Pclose (dcpl); + H5Sclose (dataspace); + + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose (dataset); + H5Pclose (dcpl); + H5Sclose (dataspace); + } H5E_END_TRY; + + return 1; +} +/*--------------------------------------------------------------------------- + * Check the performance of the chunk cache when partial chunks exist + * along the dataset dimensions. + */ +static int check_partial_chunks_perf(hid_t file) +{ + hid_t dataset; + hid_t filespace; + hid_t memspace; + hid_t dapl; + + int rdata[DSET1_DIM2]; /* data for reading */ + int i; + + hsize_t row_rank = 1; + hsize_t row_dim[1] = {DSET1_DIM2}; + hsize_t start[RANK] = {0, 0}; + hsize_t count[RANK] = {1, DSET1_DIM2}; + double start_t, end_t; + + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + goto error; + if(H5Pset_chunk_cache (dapl, RDCC_NSLOTS, RDCC_NBYTES, RDCC_W0) < 0) + goto error; + + dataset = H5Dopen2 (file, DSET1_NAME, dapl); + + memspace = H5Screate_simple(row_rank, row_dim, NULL); + filespace = H5Dget_space(dataset); + + nbytes_global = 0; + + start_t = retrieve_time(); + + /* Read the data row by row */ + for(i = 0; i < DSET1_DIM1; i++) { + start[0] = i; + if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, + start, NULL, count, NULL) < 0) + goto error; + + if(H5Dread (dataset, H5T_NATIVE_INT, memspace, filespace, + H5P_DEFAULT, rdata) < 0) + goto error; + } + + end_t = retrieve_time(); + +#ifdef H5_HAVE_GETTIMEOFDAY + printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global); +#else + printf("1. Partial chunks: no total read time because gettimeofday() is not available; number of bytes being read from file is %lu\n", nbytes_global); +#endif + + H5Dclose (dataset); + H5Sclose (filespace); + H5Sclose (memspace); + H5Pclose (dapl); + + return 0; +error: + H5E_BEGIN_TRY { + H5Dclose (dataset); + H5Sclose (filespace); + H5Sclose (memspace); + H5Pclose (dapl); + } H5E_END_TRY; + return 1; +} + +/*--------------------------------------------------------------------------- + * Check the performance of chunk cache when the number of cache slots + * is smaller than the number of chunks along the fastest-growing + * dimension of the dataset. + */ +static int check_hash_value_perf(hid_t file) +{ + hid_t dataset; + hid_t filespace; + hid_t memspace; + hid_t dapl; + + int rdata[DSET2_DIM1]; /* data for reading */ + int i; + + hsize_t column_rank = 1; + hsize_t column_dim[1] = {DSET2_DIM1}; + hsize_t start[RANK] = {0, 0}; + hsize_t count[RANK] = {DSET2_DIM1, 1}; + double start_t, end_t; + + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + goto error; + if(H5Pset_chunk_cache (dapl, RDCC_NSLOTS, RDCC_NBYTES, RDCC_W0) < 0) + goto error; + + if((dataset = H5Dopen2 (file, DSET2_NAME, dapl)) < 0) + goto error; + if((memspace = H5Screate_simple(column_rank, column_dim, NULL)) < 0) + goto error; + if((filespace = H5Dget_space(dataset)) < 0) + goto error; + + nbytes_global = 0; + + start_t = retrieve_time(); + + /* Read the data column by column */ + for(i = 0; i < DSET2_DIM2; i++) { + start[1] = i; + if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, + start, NULL, count, NULL) < 0) + goto error; + + if(H5Dread (dataset, H5T_NATIVE_INT, memspace, filespace, + H5P_DEFAULT, rdata) < 0) + goto error; + } + + end_t = retrieve_time(); + +#ifdef H5_HAVE_GETTIMEOFDAY + printf("2. Hash value: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global); +#else + printf("2. Hash value: no total read time because gettimeofday() is not available; number of bytes being read from file is %lu\n", nbytes_global); +#endif + + H5Dclose (dataset); + H5Sclose (filespace); + H5Sclose (memspace); + H5Pclose (dapl); + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose (dataset); + H5Sclose (filespace); + H5Sclose (memspace); + H5Pclose (dapl); + } H5E_END_TRY; + return 1; +} + +/*------------------------------------------------------------------------------------- + * Purpose: check the performance of chunk cache in these two cases (HDFFV-10601): + * 1. partial chunks exist along any dimension. + * 2. number of slots in chunk cache is smaller than the number of chunks + * in the fastest-growing dimension. + *-------------------------------------------------------------------------------------*/ +int +main (void) +{ + hid_t file; /* handles */ + int nerrors = 0; + + /* Create a new file. If file exists its contents will be overwritten. */ + if((file = H5Fcreate (FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + nerrors += create_dset1(file); + nerrors += create_dset2(file); + + if(H5Fclose (file) < 0) + goto error; + + /* Re-open the file for testing performance. */ + if((file = H5Fopen (FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + goto error; + + nerrors += check_partial_chunks_perf(file); + nerrors += check_hash_value_perf(file); + + if(H5Fclose (file) < 0) + goto error; + + if (nerrors>0) goto error; + cleanup(); + return 0; + +error: + fprintf(stderr, "*** ERRORS DETECTED ***\n"); + return 1; +} diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c index b421328..c6e62d5 100644 --- a/tools/test/perform/perf.c +++ b/tools/test/perform/perf.c @@ -63,13 +63,13 @@ #define H5FATAL 1 #define VRFY(val, mesg, fatal) do { \ if (!val) { \ - printf("Proc %d: ", mynod); \ + printf("Proc %d: ", mynod); \ printf("*** Assertion failed (%s) at line %4d in %s\n", \ mesg, (int)__LINE__, __FILE__); \ - if (fatal){ \ + if (fatal){ \ fflush(stdout); \ goto die_jar_jar_die; \ - } \ + } \ } \ } while(0) #define RANK 1 @@ -180,38 +180,38 @@ int main(int argc, char **argv) /* setup file access template with parallel IO access. */ if (opt_split_vfd){ - hid_t mpio_pl; - - mpio_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "", H5FATAL); - ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL); - VRFY((ret >= 0), "", H5FATAL); - - /* set optional allocation alignment */ - if (opt_alignment*opt_threshold != 1){ - ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); - VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); - } - - /* setup file access template */ - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "", H5FATAL); - ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL); - ret = H5Pclose(mpio_pl); - VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL); + hid_t mpio_pl; + + mpio_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((acc_tpl >= 0), "", H5FATAL); + ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL); + VRFY((ret >= 0), "", H5FATAL); + + /* set optional allocation alignment */ + if (opt_alignment*opt_threshold != 1){ + ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); + VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); + } + + /* setup file access template */ + acc_tpl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((acc_tpl >= 0), "", H5FATAL); + ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl); + VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL); + ret = H5Pclose(mpio_pl); + VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL); }else{ - /* setup file access template */ - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "", H5FATAL); - ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL); - VRFY((ret >= 0), "", H5FATAL); - - /* set optional allocation alignment */ - if (opt_alignment*opt_threshold != 1){ - ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); - VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); - } + /* setup file access template */ + acc_tpl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((acc_tpl >= 0), "", H5FATAL); + ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL); + VRFY((ret >= 0), "", H5FATAL); + + /* set optional allocation alignment */ + if (opt_alignment*opt_threshold != 1){ + ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); + VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); + } } h5_fixname_no_suffix(FILENAME[0], acc_tpl, filename, sizeof filename); @@ -225,7 +225,7 @@ int main(int argc, char **argv) sid = H5Screate_simple(RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded", H5FATAL); dataset = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_CHAR, sid, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dataset >= 0), "H5Dcreate2 succeeded", H5FATAL); /* create the memory dataspace and the file dataspace */ diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c index 0636d3b..e301bb3 100644 --- a/tools/test/perform/zip_perf.c +++ b/tools/test/perform/zip_perf.c @@ -419,7 +419,9 @@ fill_with_random_data(Bytef *src, uLongf src_len) buf += rc; len -= (size_t)rc; } - } else { + HDclose(fd); + } + else { HDfprintf(stdout, "Using random() for random data\n"); for (u = 0; u < src_len; ++u) @@ -557,7 +559,7 @@ main(int argc, char **argv) int opt; prog = argv[0]; - + /* Initialize h5tools lib */ h5tools_init(); diff --git a/tools/testfiles/tstarfile.ddl b/tools/testfiles/tstarfile.ddl index 77b80e0..87c3f87 100644 --- a/tools/testfiles/tstarfile.ddl +++ b/tools/testfiles/tstarfile.ddl @@ -64,7 +64,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed #004: (file name) line (number) in H5G_loc_find_cb(): object 'Dataset1' doesn't exist @@ -80,7 +80,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed #004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist |