summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM. Scot Breitenfeld <brtnfld@hdfgroup.org>2019-04-24 17:57:30 (GMT)
committerM. Scot Breitenfeld <brtnfld@hdfgroup.org>2019-04-24 17:57:30 (GMT)
commit7dd53873f73ee67046607b50067b543f2a44cab3 (patch)
tree4d08558545b8403ed43ff27ebb5bd02b8503a52e
parent6682f51a1157dc9e88bd34528fff999aee50ca2a (diff)
parent4fbe80acc27bc0e84eec9880c3c4257802e5bae5 (diff)
downloadhdf5-7dd53873f73ee67046607b50067b543f2a44cab3.zip
hdf5-7dd53873f73ee67046607b50067b543f2a44cab3.tar.gz
hdf5-7dd53873f73ee67046607b50067b543f2a44cab3.tar.bz2
Merge branch 'develop' into H10621
-rw-r--r--CMakeInstallation.cmake4
-rw-r--r--CMakeLists.txt12
-rw-r--r--MANIFEST12
-rw-r--r--Makefile.am9
-rw-r--r--README.txt2
-rwxr-xr-xbin/snapshot25
-rw-r--r--c++/Makefile.am6
-rw-r--r--c++/src/C2Cppfunction_map.htm36
-rw-r--r--c++/src/H5File.cpp21
-rw-r--r--c++/src/H5File.h3
-rw-r--r--c++/src/cpp_doc_config2
-rw-r--r--c++/test/tfile.cpp59
-rw-r--r--c++/test/tobject.cpp4
-rw-r--r--config/cmake/CTestCustom.cmake1
-rw-r--r--config/cmake/HDF5_Examples.cmake.in2
-rw-r--r--config/cmake/HDF5_Examples_options.cmake103
-rw-r--r--config/cmake/README.txt.cmake.in2
-rw-r--r--config/cmake/cacheinit.cmake2
-rw-r--r--config/cmake/hdf5-config.cmake.in4
-rw-r--r--config/cmake/mccacheinit.cmake2
-rw-r--r--config/cmake/scripts/HDF5config.cmake2
-rw-r--r--config/cmake_ext_mod/HDFLibMacros.cmake122
-rw-r--r--config/cmake_ext_mod/grepTest.cmake137
-rw-r--r--config/commence.am4
-rw-r--r--config/conclude.am6
-rw-r--r--configure.ac6
-rw-r--r--fortran/Makefile.am6
-rw-r--r--fortran/src/H5Ff.c34
-rw-r--r--fortran/src/H5Fff.F9038
-rw-r--r--fortran/src/H5Sf.c6
-rw-r--r--fortran/src/H5Sff.F9013
-rw-r--r--fortran/src/H5f90proto.h3
-rw-r--r--fortran/src/hdf5_fortrandll.def.in1
-rw-r--r--fortran/test/tH5F.F9029
-rw-r--r--fortran/test/tH5MISC_1_8.F9033
-rw-r--r--hl/Makefile.am6
-rw-r--r--hl/fortran/src/H5DSff.F9034
-rw-r--r--hl/fortran/src/H5HL_buildiface.F9016
-rw-r--r--hl/fortran/src/H5IMff.F904
-rw-r--r--hl/fortran/src/H5TBff.F908
-rw-r--r--java/Makefile.am5
-rw-r--r--java/src/hdf/hdf5lib/H5.java17
-rw-r--r--java/src/hdf/hdf5lib/HDF5Constants.java3
-rw-r--r--java/src/jni/h5Constants.c2
-rw-r--r--java/src/jni/h5fImp.c24
-rw-r--r--java/src/jni/h5fImp.h9
-rw-r--r--java/src/jni/h5sImp.c4
-rw-r--r--java/test/TestH5.java4
-rw-r--r--java/test/TestH5F.java110
-rw-r--r--java/test/TestH5P.java2
-rw-r--r--java/test/testfiles/JUnit-TestH5F.txt4
-rw-r--r--m4/ax_check_class.m475
-rw-r--r--m4/ax_check_classpath.m46
-rw-r--r--m4/ax_check_java_home.m46
-rw-r--r--m4/ax_check_junit.m44
-rw-r--r--m4/ax_check_rqrd_class.m46
-rw-r--r--m4/ax_java_check_class.m48
-rw-r--r--m4/ax_java_options.m44
-rw-r--r--m4/ax_jni_include_dir.m461
-rw-r--r--m4/ax_prog_jar.m44
-rw-r--r--m4/ax_prog_java.m46
-rw-r--r--m4/ax_prog_java_cc.m46
-rw-r--r--m4/ax_prog_java_works.m451
-rw-r--r--m4/ax_prog_javac.m46
-rw-r--r--m4/ax_prog_javac_works.m46
-rw-r--r--m4/ax_prog_javadoc.m44
-rw-r--r--m4/ax_prog_javah.m416
-rw-r--r--m4/ax_try_compile_java.m48
-rw-r--r--m4/ax_try_run_java.m44
-rw-r--r--release_docs/INSTALL_CMake.txt2
-rw-r--r--release_docs/RELEASE.txt68
-rw-r--r--release_docs/USING_CMake_Examples.txt2
-rw-r--r--src/CMakeLists.txt7
-rw-r--r--src/H5.c6
-rw-r--r--src/H5Abtree2.c9
-rw-r--r--src/H5Adense.c30
-rw-r--r--src/H5Aint.c21
-rw-r--r--src/H5B.c53
-rw-r--r--src/H5B2.c8
-rw-r--r--src/H5B2cache.c6
-rw-r--r--src/H5B2int.c75
-rw-r--r--src/H5B2leaf.c14
-rw-r--r--src/H5Bcache.c3
-rw-r--r--src/H5C.c14
-rw-r--r--src/H5CX.c556
-rw-r--r--src/H5CXprivate.h26
-rw-r--r--src/H5Cimage.c12
-rw-r--r--src/H5D.c6
-rw-r--r--src/H5Dbtree.c5
-rw-r--r--src/H5Dbtree2.c3
-rw-r--r--src/H5Dchunk.c82
-rw-r--r--src/H5Dcompact.c11
-rw-r--r--src/H5Dcontig.c68
-rw-r--r--src/H5Ddeprec.c3
-rw-r--r--src/H5Dearray.c7
-rw-r--r--src/H5Defl.c5
-rw-r--r--src/H5Dfill.c7
-rw-r--r--src/H5Dint.c85
-rw-r--r--src/H5Dio.c4
-rw-r--r--src/H5Dlayout.c1
-rw-r--r--src/H5Dmpio.c23
-rw-r--r--src/H5Dpkg.h9
-rw-r--r--src/H5Dscatgath.c9
-rw-r--r--src/H5Dselect.c2
-rw-r--r--src/H5Dvirtual.c62
-rw-r--r--src/H5EA.c5
-rw-r--r--src/H5EAcache.c13
-rw-r--r--src/H5EAhdr.c3
-rw-r--r--src/H5EAstat.c3
-rw-r--r--src/H5F.c36
-rw-r--r--src/H5FA.c9
-rw-r--r--src/H5FAcache.c9
-rw-r--r--src/H5FAhdr.c3
-rw-r--r--src/H5FAstat.c3
-rw-r--r--src/H5FD.c4
-rw-r--r--src/H5FDcore.c6
-rw-r--r--src/H5FDdirect.c10
-rw-r--r--src/H5FDfamily.c2
-rw-r--r--src/H5FDlog.c2
-rw-r--r--src/H5FDmpio.c2
-rw-r--r--src/H5FL.c4
-rw-r--r--src/H5FS.c3
-rw-r--r--src/H5FScache.c5
-rw-r--r--src/H5Faccum.c21
-rw-r--r--src/H5Fint.c17
-rw-r--r--src/H5Fprivate.h10
-rw-r--r--src/H5Fpublic.h6
-rw-r--r--src/H5Fsuper.c3
-rw-r--r--src/H5Fsuper_cache.c4
-rw-r--r--src/H5Gbtree2.c13
-rw-r--r--src/H5Gcache.c3
-rw-r--r--src/H5Gent.c3
-rw-r--r--src/H5Gname.c2
-rw-r--r--src/H5Gnode.c4
-rw-r--r--src/H5Gtraverse.c4
-rw-r--r--src/H5HF.c6
-rw-r--r--src/H5HFcache.c20
-rw-r--r--src/H5HFhdr.c3
-rw-r--r--src/H5HFhuge.c4
-rw-r--r--src/H5HFman.c2
-rw-r--r--src/H5HFsection.c8
-rw-r--r--src/H5HFtest.c4
-rw-r--r--src/H5HFtiny.c3
-rw-r--r--src/H5HG.c6
-rw-r--r--src/H5HGcache.c4
-rw-r--r--src/H5HL.c2
-rw-r--r--src/H5HLcache.c11
-rw-r--r--src/H5I.c7
-rw-r--r--src/H5L.c4
-rw-r--r--src/H5Lexternal.c2
-rw-r--r--src/H5MM.c48
-rw-r--r--src/H5MMprivate.h1
-rw-r--r--src/H5Oalloc.c11
-rw-r--r--src/H5Oattr.c8
-rw-r--r--src/H5Oattribute.c2
-rw-r--r--src/H5Ocache.c7
-rw-r--r--src/H5Ocopy.c4
-rw-r--r--src/H5Odrvinfo.c10
-rw-r--r--src/H5Odtype.c8
-rw-r--r--src/H5Oefl.c4
-rw-r--r--src/H5Ofill.c17
-rw-r--r--src/H5Oint.c7
-rw-r--r--src/H5Olayout.c18
-rw-r--r--src/H5Olink.c14
-rw-r--r--src/H5Opline.c5
-rw-r--r--src/H5Oshared.c5
-rw-r--r--src/H5P.c19
-rw-r--r--src/H5PB.c21
-rw-r--r--src/H5Pdapl.c6
-rw-r--r--src/H5Pdcpl.c26
-rw-r--r--src/H5Pdeprec.c48
-rw-r--r--src/H5Pdxpl.c2
-rw-r--r--src/H5Pfapl.c57
-rw-r--r--src/H5Pint.c144
-rw-r--r--src/H5Plapl.c2
-rw-r--r--src/H5Pocpl.c2
-rw-r--r--src/H5Pocpypl.c2
-rw-r--r--src/H5Ppkg.h4
-rw-r--r--src/H5Pprivate.h3
-rw-r--r--src/H5Ppublic.h3
-rw-r--r--src/H5Rint.c3
-rw-r--r--src/H5S.c26
-rw-r--r--src/H5SL.c4
-rw-r--r--src/H5SM.c4
-rw-r--r--src/H5SMbtree2.c3
-rw-r--r--src/H5SMcache.c4
-rw-r--r--src/H5SMmessage.c5
-rw-r--r--src/H5Sall.c46
-rw-r--r--src/H5Sdeprec.c121
-rw-r--r--src/H5Shyper.c960
-rw-r--r--src/H5Snone.c47
-rw-r--r--src/H5Spkg.h34
-rw-r--r--src/H5Spoint.c412
-rw-r--r--src/H5Spublic.h12
-rw-r--r--src/H5Sselect.c85
-rw-r--r--src/H5T.c5
-rw-r--r--src/H5Tcommit.c4
-rw-r--r--src/H5Tconv.c22
-rw-r--r--src/H5Tenum.c6
-rw-r--r--src/H5Tfields.c12
-rw-r--r--src/H5Tnative.c2
-rw-r--r--src/H5Tvlen.c34
-rw-r--r--src/H5VL.c359
-rw-r--r--src/H5VLcallback.c212
-rw-r--r--src/H5VLint.c1027
-rw-r--r--src/H5VLnative.c1
-rw-r--r--src/H5VLnative_file.c13
-rw-r--r--src/H5VLpassthru.c103
-rw-r--r--src/H5VLpkg.h15
-rw-r--r--src/H5VLprivate.h28
-rw-r--r--src/H5VLpublic.h7
-rw-r--r--src/H5VM.c23
-rw-r--r--src/H5VMprivate.h3
-rw-r--r--src/H5Z.c4
-rw-r--r--src/H5Zfletcher32.c6
-rw-r--r--src/H5Zscaleoffset.c24
-rw-r--r--src/H5Zshuffle.c4
-rw-r--r--src/H5Ztrans.c4
-rw-r--r--src/H5private.h6
-rw-r--r--src/H5public.h4
-rw-r--r--src/H5system.c132
-rw-r--r--src/H5trace.c6
-rw-r--r--src/H5vers.txt2
-rw-r--r--src/H5win32defs.h14
-rw-r--r--src/Makefile.am2
-rw-r--r--test/CMakeLists.txt11
-rw-r--r--test/CMakePassthroughVOLTests.cmake (renamed from test/CMakeVOLTests.cmake)2
-rw-r--r--test/CMakeTests.cmake176
-rw-r--r--test/CMakeVFDTests.cmake4
-rw-r--r--test/Makefile.am20
-rw-r--r--test/cache_tagging.c52
-rw-r--r--test/direct_chunk.c121
-rw-r--r--test/dsets.c14
-rw-r--r--test/dtypes.c24
-rw-r--r--test/enc_dec_plist.c878
-rw-r--r--test/external.c262
-rw-r--r--test/external_common.c127
-rw-r--r--test/external_common.h50
-rw-r--r--test/external_env.c213
-rw-r--r--test/gen_plist.c4
-rw-r--r--test/h5test.c143
-rw-r--r--test/h5test.h5
-rw-r--r--test/null_vol_connector.c25
-rw-r--r--test/objcopy.c6
-rw-r--r--test/ohdr.c55
-rw-r--r--test/set_extent.c4
-rw-r--r--test/tattr.c109
-rw-r--r--test/testerror.sh.in4
-rw-r--r--test/testexternal_env.sh.in42
-rw-r--r--test/testvds_env.sh.in44
-rw-r--r--test/tfile.c106
-rw-r--r--test/th5o.c4
-rw-r--r--test/th5s.c971
-rw-r--r--test/tid.c28
-rw-r--r--test/titerate.c4
-rw-r--r--test/trefer.c238
-rw-r--r--test/ttsafe_error.c65
-rw-r--r--test/vds.c280
-rw-r--r--test/vds_env.c364
-rw-r--r--test/vol.c1
-rw-r--r--testpar/Makefile.am5
-rw-r--r--testpar/t_cache.c1
-rw-r--r--testpar/t_prop.c4
-rw-r--r--tools/Makefile.am5
-rw-r--r--tools/test/h5dump/CMakeTests.cmake54
-rw-r--r--tools/test/h5dump/testh5dump.sh.in6
-rw-r--r--tools/test/h5format_convert/CMakeTests.cmake9
-rw-r--r--tools/test/h5repack/CMakeTests.cmake10
-rw-r--r--tools/test/h5repack/h5repack.sh.in8
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl14
-rw-r--r--tools/test/perform/pio_engine.c6
-rw-r--r--tools/test/perform/sio_engine.c6
272 files changed, 8504 insertions, 3324 deletions
diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake
index 7cf3450..b933c29 100644
--- a/CMakeInstallation.cmake
+++ b/CMakeInstallation.cmake
@@ -33,7 +33,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED)
EXPORT ${HDF5_EXPORTED_TARGETS}
DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/hdf5
FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake
- NAMESPACE ${HDF5_PACKAGE}::
+ NAMESPACE ${HDF_PACKAGE_NAMESPACE}
COMPONENT configinstall
)
endif ()
@@ -45,7 +45,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED)
export (
TARGETS ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES} ${HDF5_UTILS_TO_EXPORT}
FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake
- NAMESPACE ${HDF5_PACKAGE}::
+ NAMESPACE ${HDF_PACKAGE_NAMESPACE}
)
endif ()
endif ()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2eb94d..6ab7958 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -756,7 +756,7 @@ endif ()
option (BUILD_TESTING "Build HDF5 Unit Testing" ON)
if (BUILD_TESTING)
set (DART_TESTING_TIMEOUT 1200
- CACHE INTEGER
+ CACHE STRING
"Timeout in seconds for each test (default 1200=20minutes)"
)
@@ -772,11 +772,11 @@ if (BUILD_TESTING)
mark_as_advanced (HDF5_TEST_FHEAP_VFD)
endif ()
- option (HDF5_TEST_VOL "Execute tests with different VOL connectors" OFF)
- mark_as_advanced (HDF5_TEST_VOL)
- if (HDF5_TEST_VOL)
- option (HDF5_TEST_FHEAP_VOL "Execute fheap test with different VOL connectors" ON)
- mark_as_advanced (HDF5_TEST_FHEAP_VOL)
+ option (HDF5_TEST_PASSTHROUGH_VOL "Execute tests with different passthrough VOL connectors" OFF)
+ mark_as_advanced (HDF5_TEST_PASSTHROUGH_VOL)
+ if (HDF5_TEST_PASSTHROUGH_VOL)
+ option (HDF5_TEST_FHEAP_PASSTHROUGH_VOL "Execute fheap test with different passthrough VOL connectors" ON)
+ mark_as_advanced (HDF5_TEST_FHEAP_PASSTHROUGH VOL)
endif ()
option (HDF_TEST_EXPRESS "Control testing framework (0-3)" "0")
diff --git a/MANIFEST b/MANIFEST
index 48bc1e7..9750c49 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -462,8 +462,9 @@
./release_docs/INSTALL_parallel
./release_docs/INSTALL_Warnings.txt
./release_docs/INSTALL_Windows.txt
-./release_docs/RELEASE.txt
+./release_docs/README_HDF5_CMake
./release_docs/README_HPC
+./release_docs/RELEASE.txt
./release_docs/USING_HDF5_CMake.txt
./release_docs/USING_HDF5_VS.txt
@@ -847,6 +848,7 @@
./src/H5S.c
./src/H5Sall.c
./src/H5Sdbg.c
+./src/H5Sdeprec.c
./src/H5Shyper.c
./src/H5Smodule.h
./src/H5Smpio.c
@@ -991,6 +993,9 @@
./test/evict_on_close.c
./test/extend.c
./test/external.c
+./test/external_common.c
+./test/external_common.h
+./test/external_env.c
./test/error_test.c
./test/err_compat.c
./test/filter_error.h5
@@ -1115,6 +1120,7 @@
./test/tcoords.c
./test/testabort_fail.sh.in
./test/testcheck_version.sh.in
+./test/testexternal_env.sh.in
./test/testerror.sh.in
./test/testlinks_env.sh.in
./test/test_filter_plugin.sh.in
@@ -1130,6 +1136,7 @@
./test/testmeta.c
./test/testswmr.sh.in
./test/testvdsswmr.sh.in
+./test/testvds_env.sh.in
./test/tfile.c
./test/tgenprop.c
./test/th5o.c
@@ -1169,6 +1176,7 @@
./test/use_disable_mdc_flushes.c
./test/use.h
./test/vds.c
+./test/vds_env.c
./test/vds_swmr.h
./test/vds_swmr_gen.c
./test/vds_swmr_reader.c
@@ -3337,9 +3345,9 @@
./hl/tools/h5watch/CMakeTests.cmake
./src/CMakeLists.txt
./test/CMakeLists.txt
+./test/CMakePassthroughVOLTests.cmake
./test/CMakeTests.cmake
./test/CMakeVFDTests.cmake
-./test/CMakeVOLTests.cmake
./test/flushrefreshTest.cmake
./test/ShellTests.cmake
./testpar/CMakeLists.txt
diff --git a/Makefile.am b/Makefile.am
index d58b1b4..7f872b0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -186,10 +186,11 @@ 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 \
+# Run tests with different passthrough Virtual Object Layer Connectors.
+# NOTE: Will only succeed with passthrough VOL connectors that use
+# the native VOL connector as the terminal connector.
+check-passthrough-vol:
+ for d in $(SUBDIRS); do \
if test $$d != .; then \
(cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
fi; \
diff --git a/README.txt b/README.txt
index 03e8dd7..d3d85cf 100644
--- a/README.txt
+++ b/README.txt
@@ -1,4 +1,4 @@
-HDF5 version 1.11.4 currently under development
+HDF5 version 1.11.5 currently under development
------------------------------------------------------------------------------
Please refer to the release_docs/INSTALL file for installation instructions.
diff --git a/bin/snapshot b/bin/snapshot
index 5900728..1218caa 100755
--- a/bin/snapshot
+++ b/bin/snapshot
@@ -130,10 +130,10 @@ DISPLAYUSAGE()
set -
cat <<EOF
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>]
+ [clean] [distclean] [echo] [deploy <dir>] [deploydir <dir>]
+ [zlib <zlib_path>] [releasedir <dir>] [srcdirname <dir>] [check-vfd]
+ [check-passthrough-vol]
+ [exec <command>] [module-load <module-list>] [op-configure <option>]
[--<option>]
all: Run all commands (checkout, test & release)
[Default is all]
@@ -150,8 +150,8 @@ Usage: $PROGNAME [all] [checkout] [ftp <URL> [diff] [test] [srcdir] [release] [h
setenv <name> <value>:
Set environment variable <name> to <value>.
setenvN <N> <name> <value> ...:
- Set environment variable with <N> values.
- E.g., setenvN 3 x a b c is same as setenv x="a b c".
+ Set environment variable with <N> values.
+ E.g., setenvN 3 x a b c is same as setenv x="a b c".
srcdir: Use srcdir option (does not imply other commands)
"snapshot srcdir" is equivalent to "snapshot srcdir all"
"snapshot srcdir checkout" is equivalent to "snapshot checkout"
@@ -169,9 +169,12 @@ Usage: $PROGNAME [all] [checkout] [ftp <URL> [diff] [test] [srcdir] [release] [h
Use <dir> as the release directory
[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.
+ Run make check-vfd instead of just make check.
+ check-passthrough-vol:
+ Run make check-passthrough-vol instead of just make check.
+ NOTE: Will only succeed with passthrough VOL connectors
+ that use the native VOL connector as the terminal
+ connector.
exttest <testscript>;
Run testscript;
exec <command>:
@@ -425,8 +428,8 @@ while [ $# -gt 0 ] ; do
check-vfd)
CHECKVAL=check-vfd
;;
- check-vol)
- CHECKVAL=check-vol
+ check-passthrough-vol)
+ CHECKVAL=check-passthrough-vol
;;
module-load)
shift
diff --git a/c++/Makefile.am b/c++/Makefile.am
index 94fbefc..3713901 100644
--- a/c++/Makefile.am
+++ b/c++/Makefile.am
@@ -21,6 +21,12 @@ include $(top_srcdir)/config/commence.am
## Only recurse into subdirectories if C++ interface is enabled.
if BUILD_CXX_CONDITIONAL
SUBDIRS=src test
+
+# 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={}}"
+
endif
DIST_SUBDIRS = src test examples
diff --git a/c++/src/C2Cppfunction_map.htm b/c++/src/C2Cppfunction_map.htm
index b53ea15..2d779a3 100644
--- a/c++/src/C2Cppfunction_map.htm
+++ b/c++/src/C2Cppfunction_map.htm
@@ -7666,6 +7666,42 @@ normal'><span style='font-size:14.0pt;mso-bidi-font-size:11.0pt;line-height:
normal'><o:p>&nbsp;</o:p></p>
</td>
</tr>
+ <tr style='mso-yfti-irow:180'>
+ <td width=263 style='width:197.2pt;border:solid windowtext 1.0pt;border-top:
+ none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
+ padding:0in 5.4pt 0in 5.4pt'>
+ <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
+ normal'>H5Fget_fileno</p>
+ </td>
+ <td width=474 valign=top style='width:355.2pt;border-top:none;border-left:
+ none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+ mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
+ mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
+ <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
+ normal'>unsigned long H5File::getFileNum()</p>
+ </td>
+ <td width=35 valign=top style='width:26.05pt;border-top:none;border-left:
+ none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+ mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
+ mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
+ <p class=MsoNormal align=center style='margin-bottom:0in;margin-bottom:.0001pt;
+ text-align:center;line-height:normal'><o:p>&nbsp;</o:p></p>
+ </td>
+ <td width=42 valign=top style='width:31.45pt;border-top:none;border-left:
+ none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+ mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
+ mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
+ <p class=MsoNormal align=center style='margin-bottom:0in;margin-bottom:.0001pt;
+ text-align:center;line-height:normal'><o:p>&nbsp;</o:p></p>
+ </td>
+ <td width=169 valign=top style='width:126.65pt;border-top:none;border-left:
+ none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+ mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
+ mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
+ <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
+ normal'><o:p>&nbsp;</o:p></p>
+ </td>
+ </tr>
<tr style='mso-yfti-irow:181'>
<td width=263 style='width:197.2pt;border:solid windowtext 1.0pt;border-top:
none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 719c1ba..b9ecded 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -580,6 +580,27 @@ hsize_t H5File::getFileSize() const
}
//--------------------------------------------------------------------------
+// Function: H5File::getFileNum
+///\brief Returns the file number of the HDF5 file.
+///\return File number
+///\exception H5::FileIException
+///\par Description
+/// This function is called after an existing file is opened in
+/// order to retrieve the unique 'file number' for the file.
+// Programmer Quincey Koziol - April 13, 2019
+//--------------------------------------------------------------------------
+unsigned long H5File::getFileNum() const
+{
+ unsigned long fileno = 0;
+ herr_t ret_value = H5Fget_fileno(id, &fileno);
+ if (ret_value < 0)
+ {
+ throw FileIException("H5File::getFileNum", "H5Fget_fileno failed");
+ }
+ return (fileno);
+}
+
+//--------------------------------------------------------------------------
// Function: H5File::getId
///\brief Get the id of this file
///\return File identifier
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index 332685e..1b1227f 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -69,6 +69,9 @@ class H5_DLLCPP H5File : public Group {
// Returns the file size of the HDF5 file.
hsize_t getFileSize() const;
+ // Returns the 'file number' of the HDF5 file.
+ unsigned long getFileNum() const;
+
// Determines if a file, specified by its name, is in HDF5 format
static bool isHdf5(const char* name);
static bool isHdf5(const H5std_string& name);
diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config
index 697fb77..c1961ec 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.4"
+PROJECT_NUMBER = "1.11.5"
# 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/tfile.cpp b/c++/test/tfile.cpp
index a2bf1c2..055cf23 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -412,6 +412,64 @@ static void test_file_size()
/*-------------------------------------------------------------------------
+ * Function: test_file_num
+ *
+ * Purpose Test file number.
+ *
+ * Return None
+ *
+ * Programmer Quincey Koziol
+ * April, 2019
+ *-------------------------------------------------------------------------
+ */
+static void test_file_num()
+{
+ // Output message about test being performed
+ SUBTEST("File Number");
+
+ hid_t fapl_id;
+ fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
+
+ try {
+ // Use the file access template id to create a file access prop.
+ // list object to pass in H5File::H5File
+ FileAccPropList fapl(fapl_id);
+
+ // Create two files
+ H5File file1(FILE1, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ H5File file2(FILE2, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+
+ // Open the first file again
+ H5File file3(FILE1, H5F_ACC_RDWR);
+
+ // Get file numbers
+ unsigned long file_num1 = file1.getFileNum();
+ unsigned long file_num2 = file2.getFileNum();
+ unsigned long file_num3 = file3.getFileNum();
+
+ // Check file numbers
+ if (file_num1 == file_num2)
+ issue_fail_msg("test_file_num()", __LINE__, __FILE__, "getFileNum() returned wrong value");
+ if (file_num1 != file_num3)
+ issue_fail_msg("test_file_num()", __LINE__, __FILE__, "getFileNum() returned wrong value");
+
+ PASSED();
+ } // end of try block
+
+ catch (Exception& E)
+ {
+ issue_fail_msg("test_file_num()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+
+ // use C test utility routine to close property list.
+ herr_t ret = H5Pclose(fapl_id);
+ if (ret < 0)
+ issue_fail_msg("test_file_num()", __LINE__, __FILE__, "H5Pclose failed");
+
+} // test_file_num()
+
+
+/*-------------------------------------------------------------------------
* Function: test_file_name
*
* Purpose Test getting file's name.
@@ -966,6 +1024,7 @@ void test_file()
test_file_create(); // Test file creation (also creation templates)
test_file_open(); // Test file opening
test_file_size(); // Test file size
+ test_file_num(); // Test file number
test_file_name(); // Test getting file's name
test_file_attribute(); // Test file attribute feature
test_libver_bounds(); // Test format version
diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp
index 537716f..23c1453 100644
--- a/c++/test/tobject.cpp
+++ b/c++/test/tobject.cpp
@@ -609,10 +609,10 @@ static void test_getobjectinfo_same_file()
catch (Exception& E)
{
cerr << " in Exception " << E.getCFuncName() << "detail: " << E.getCDetailMsg() << endl;
- issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_getobjectinfo_same_file()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_h5o_getinfo_same_file
+} // test_getobjectinfo_same_file
/*-------------------------------------------------------------------------
* Function: test_object
diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake
index 2333f67..75d73cd 100644
--- a/config/cmake/CTestCustom.cmake
+++ b/config/cmake/CTestCustom.cmake
@@ -39,7 +39,6 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE
H5TEST-flush2 #designed to need flush1
H5TEST-error_test #uses runTest.cmake
H5TEST-err_compat #uses runTest.cmake
- H5TEST-links_env #uses runTest.cmake
H5TEST-testlibinfo #uses grepTest.cmake
#########
H5TEST-clear-objects
diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in
index c4d9cd8..bac174a 100644
--- a/config/cmake/HDF5_Examples.cmake.in
+++ b/config/cmake/HDF5_Examples.cmake.in
@@ -103,6 +103,8 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PAC
if(WIN32)
include(${CTEST_SCRIPT_DIRECTORY}\\HDF5_Examples_options.cmake)
+ include(${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake)
else()
include(${CTEST_SCRIPT_DIRECTORY}/HDF5_Examples_options.cmake)
+ include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake)
endif()
diff --git a/config/cmake/HDF5_Examples_options.cmake b/config/cmake/HDF5_Examples_options.cmake
index 6e4b510..386e99c 100644
--- a/config/cmake/HDF5_Examples_options.cmake
+++ b/config/cmake/HDF5_Examples_options.cmake
@@ -57,106 +57,3 @@
#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCOMPARE_TESTING:BOOL=ON")
#############################################################################################
-# Do not edit below this line
-#############################################################################################
-#-----------------------------------------------------------------------------
-# MAC machines need special option
-#-----------------------------------------------------------------------------
-if (APPLE)
- # Compiler choice
- execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE)
- execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE)
- set (ENV{CC} "${XCODE_CC}")
- set (ENV{CXX} "${XCODE_CXX}")
- if (NOT NO_MAC_FORTRAN)
- # Shared fortran is not supported, build static
- set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC")
- else ()
- set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF")
- endif ()
- set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF")
-else ()
- set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS}")
-endif ()
-
-#-----------------------------------------------------------------------------
-set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"")
-## --------------------------
-if (CTEST_USE_TAR_SOURCE)
- ## Uncompress source if tar or zip file provided
- ## --------------------------
- if (WIN32)
- message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip]")
- execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv)
- else ()
- message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]")
- execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv)
- endif ()
-
- if (NOT rv EQUAL 0)
- message (STATUS "extracting... [error-(${rv}) clean up]")
- file (REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}")
- message (FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed")
- endif ()
-endif()
-
-#-----------------------------------------------------------------------------
-## Clear the build directory
-## --------------------------
-set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE)
-if (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
- ctest_empty_binary_directory (${CTEST_BINARY_DIRECTORY})
-else ()
- file (MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
-endif ()
-
-# Use multiple CPU cores to build
-include (ProcessorCount)
-ProcessorCount (N)
-if (NOT N EQUAL 0)
- if (NOT WIN32)
- set (CTEST_BUILD_FLAGS -j${N})
- endif ()
- set (ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
-endif ()
-set (CTEST_CONFIGURE_COMMAND
- "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
-)
-
-#-----------------------------------------------------------------------------
-## -- set output to english
-set ($ENV{LC_MESSAGES} "en_EN")
-
-#-----------------------------------------------------------------------------
-configure_file (${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake)
-ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}")
-## NORMAL process
-## --------------------------
-ctest_start (Experimental)
-ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
-if (${res} LESS 0 OR ${res} GREATER 0)
- file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Configure: ${res}\n")
-endif ()
-if (LOCAL_SUBMIT)
- ctest_submit (PARTS Configure Notes)
-endif ()
-ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND APPEND RETURN_VALUE res NUMBER_ERRORS errval)
-if (${res} LESS 0 OR ${res} GREATER 0 OR ${errval} GREATER 0)
- file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed ${errval} Build: ${res}\n")
-endif ()
-if (LOCAL_SUBMIT)
- ctest_submit (PARTS Build)
-endif ()
-ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res)
-if (${res} LESS 0 OR ${res} GREATER 0)
- file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n")
-endif ()
-if (LOCAL_SUBMIT)
- ctest_submit (PARTS Test)
-endif ()
-if (${res} LESS 0 OR ${res} GREATER 0)
- message (FATAL_ERROR "tests FAILED")
-endif ()
-#-----------------------------------------------------------------------------
-##############################################################################################################
-message (STATUS "DONE")
diff --git a/config/cmake/README.txt.cmake.in b/config/cmake/README.txt.cmake.in
index be6ddc1..b29d50b 100644
--- a/config/cmake/README.txt.cmake.in
+++ b/config/cmake/README.txt.cmake.in
@@ -34,9 +34,9 @@ utility should be installed.
To test the installation with the examples;
Create a directory to run the examples.
Copy HDF5Examples folder to this directory.
+ Copy CTestScript.cmake to this directory.
Copy HDF5_Examples.cmake to this directory.
Copy HDF5_Examples_options.cmake to this directory.
- Copy CTestScript.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@".
diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake
index d5c5e52..5254115 100644
--- a/config/cmake/cacheinit.cmake
+++ b/config/cmake/cacheinit.cmake
@@ -19,6 +19,8 @@ set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Framework
set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE)
+set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace (can be empty)" FORCE)
+
set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE)
set (HDF5_BUILD_GENERATORS ON CACHE BOOL "Build Test Generators" FORCE)
diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in
index b1ef0ac..d0f1d00 100644
--- a/config/cmake/hdf5-config.cmake.in
+++ b/config/cmake/hdf5-config.cmake.in
@@ -108,10 +108,10 @@ set (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@)
# project which has already built hdf5 as a subproject
#-----------------------------------------------------------------------------
if (NOT TARGET "@HDF5_PACKAGE@")
- if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "zlib")
+ if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS)
include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE_NAME@/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake)
endif ()
- if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "szip")
+ if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS)
include (@PACKAGE_SHARE_INSTALL_DIR@/@SZIP_PACKAGE_NAME@/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake)
endif ()
include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake)
diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake
index 577144b..c35f51f 100644
--- a/config/cmake/mccacheinit.cmake
+++ b/config/cmake/mccacheinit.cmake
@@ -23,6 +23,8 @@ set (BUILD_TESTING ON CACHE BOOL "Build HDF5 Unit Testing" FORCE)
set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE)
+set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace" FORCE)
+
set (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build HDF5 C++ Library" FORCE)
set (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE)
diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake
index 83909b2..805aee1 100644
--- a/config/cmake/scripts/HDF5config.cmake
+++ b/config/cmake/scripts/HDF5config.cmake
@@ -34,7 +34,7 @@ cmake_minimum_required (VERSION 3.10)
# CTEST_SOURCE_NAME - source folder
##############################################################################
-set (CTEST_SOURCE_VERSION "1.11.4")
+set (CTEST_SOURCE_VERSION "1.11.5")
set (CTEST_SOURCE_VERSEXT "")
##############################################################################
diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake
index 2eda66c..9df2b4b 100644
--- a/config/cmake_ext_mod/HDFLibMacros.cmake
+++ b/config/cmake_ext_mod/HDFLibMacros.cmake
@@ -14,25 +14,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic)
# May need to build JPEG with PIC on x64 machines with gcc
# Need to use CMAKE_ANSI_CFLAGS define so that compiler test works
- if (${compress_type} MATCHES "SVN")
- EXTERNALPROJECT_ADD (JPEG
- SVN_REPOSITORY ${JPEG_URL}
- # [SVN_REVISION rev]
- INSTALL_COMMAND ""
- CMAKE_ARGS
- -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
- -DJPEG_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
- -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF
- -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
- -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
- -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
- -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
- -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")
+ if (${compress_type} MATCHES "GIT")
EXTERNALPROJECT_ADD (JPEG
GIT_REPOSITORY ${JPEG_URL}
GIT_TAG ${JPEG_BRANCH}
@@ -49,6 +31,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic)
-DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
+ -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE}
)
elseif (${compress_type} MATCHES "TGZ")
EXTERNALPROJECT_ADD (JPEG
@@ -67,23 +50,24 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic)
-DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
+ -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE}
)
endif ()
externalproject_get_property (JPEG BINARY_DIR SOURCE_DIR)
##include (${BINARY_DIR}/${JPEG_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake)
# Create imported target jpeg-static
- add_library(jpeg-static STATIC IMPORTED)
- HDF_IMPORT_SET_LIB_OPTIONS (jpeg-static "jpeg" STATIC "")
- add_dependencies (jpeg-static JPEG)
- set (JPEG_STATIC_LIBRARY "jpeg-static")
+ add_library(${HDF_PACKAGE_NAMESPACE}jpeg-static STATIC IMPORTED)
+ HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}jpeg-static "jpeg" STATIC "")
+ add_dependencies (${HDF_PACKAGE_NAMESPACE}jpeg-static JPEG)
+ set (JPEG_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}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-shared JPEG)
- set (JPEG_SHARED_LIBRARY "jpeg-shared")
+ add_library(${HDF_PACKAGE_NAMESPACE}jpeg-shared SHARED IMPORTED)
+ HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}jpeg-shared "jpeg" SHARED "")
+ add_dependencies (${HDF_PACKAGE_NAMESPACE}jpeg-shared JPEG)
+ set (JPEG_SHARED_LIBRARY "${HDF_PACKAGE_NAMESPACE}jpeg-shared")
set (JPEG_LIBRARIES ${JPEG_LIBRARIES} ${JPEG_SHARED_LIBRARY})
endif ()
@@ -100,33 +84,14 @@ macro (PACKAGE_JPEG_LIBRARY compress_type)
COMMENT "Copying ${JPEG_INCLUDE_DIR_GEN}/jconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
)
set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/jconfig.h)
- if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
+ if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ")
add_dependencies (JPEG-GenHeader-Copy JPEG)
endif ()
endmacro ()
#-------------------------------------------------------------------------------
macro (EXTERNAL_SZIP_LIBRARY compress_type encoding)
- if (${compress_type} MATCHES "SVN")
- EXTERNALPROJECT_ADD (SZIP
- SVN_REPOSITORY ${SZIP_URL}
- # [SVN_REVISION rev]
- INSTALL_COMMAND ""
- CMAKE_ARGS
- -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
- -DSZIP_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
- -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF
- -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
- -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
- -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
- -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
- -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}
- -DSZIP_ENABLE_ENCODING:BOOL=${encoding}
- -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
- )
- elseif (${compress_type} MATCHES "GIT")
+ if (${compress_type} MATCHES "GIT")
EXTERNALPROJECT_ADD (SZIP
GIT_REPOSITORY ${SZIP_URL}
GIT_TAG ${SZIP_BRANCH}
@@ -144,6 +109,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding)
-DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
-DSZIP_ENABLE_ENCODING:BOOL=${encoding}
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
+ -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE}
)
elseif (${compress_type} MATCHES "TGZ")
EXTERNALPROJECT_ADD (SZIP
@@ -163,23 +129,24 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding)
-DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
-DSZIP_ENABLE_ENCODING:BOOL=${encoding}
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
+ -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE}
)
endif ()
externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR)
##include (${BINARY_DIR}/${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake)
# Create imported target szip-static
- add_library(szip-static STATIC IMPORTED)
- HDF_IMPORT_SET_LIB_OPTIONS (szip-static "szip" STATIC "")
- add_dependencies (szip-static SZIP)
- set (SZIP_STATIC_LIBRARY "szip-static")
+ add_library(${HDF_PACKAGE_NAMESPACE}szip-static STATIC IMPORTED)
+ HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}szip-static "szip" STATIC "")
+ add_dependencies (${HDF_PACKAGE_NAMESPACE}szip-static SZIP)
+ set (SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}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-shared SZIP)
- set (SZIP_SHARED_LIBRARY "szip-shared")
+ add_library(${HDF_PACKAGE_NAMESPACE}szip-shared SHARED IMPORTED)
+ HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}szip-shared "szip" SHARED "")
+ add_dependencies (${HDF_PACKAGE_NAMESPACE}szip-shared SZIP)
+ set (SZIP_SHARED_LIBRARY "${HDF_PACKAGE_NAMESPACE}szip-shared")
set (SZIP_LIBRARIES ${SZIP_LIBRARIES} ${SZIP_SHARED_LIBRARY})
endif ()
@@ -196,32 +163,14 @@ macro (PACKAGE_SZIP_LIBRARY compress_type)
COMMENT "Copying ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
)
set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SZconfig.h)
- if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
+ if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ")
add_dependencies (SZIP-GenHeader-Copy SZIP)
endif ()
endmacro ()
#-------------------------------------------------------------------------------
macro (EXTERNAL_ZLIB_LIBRARY compress_type)
- if (${compress_type} MATCHES "SVN")
- EXTERNALPROJECT_ADD (ZLIB
- SVN_REPOSITORY ${ZLIB_URL}
- # [SVN_REVISION rev]
- INSTALL_COMMAND ""
- CMAKE_ARGS
- -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
- -DZLIB_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
- -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF
- -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
- -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
- -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
- -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
- -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")
+ if (${compress_type} MATCHES "GIT")
EXTERNALPROJECT_ADD (ZLIB
GIT_REPOSITORY ${ZLIB_URL}
GIT_TAG ${ZLIB_BRANCH}
@@ -238,6 +187,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type)
-DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
+ -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE}
)
elseif (${compress_type} MATCHES "TGZ")
EXTERNALPROJECT_ADD (ZLIB
@@ -256,6 +206,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type)
-DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
+ -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE}
)
endif ()
externalproject_get_property (ZLIB BINARY_DIR SOURCE_DIR)
@@ -267,17 +218,18 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type)
endif ()
##include (${BINARY_DIR}/${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake)
# 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-static ZLIB)
- set (ZLIB_STATIC_LIBRARY "zlib-static")
+ add_library(${HDF_PACKAGE_NAMESPACE}zlib-static STATIC IMPORTED)
+# add_library(${HDF_PACKAGE_NAMESPACE}zlib-static ALIAS zlib-static)
+ HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}zlib-static ${ZLIB_LIB_NAME} STATIC "")
+ add_dependencies (${HDF_PACKAGE_NAMESPACE}zlib-static ZLIB)
+ set (ZLIB_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}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-shared ZLIB)
- set (ZLIB_SHARED_LIBRARY "zlib-shared")
+ add_library(${HDF_PACKAGE_NAMESPACE}zlib-shared SHARED IMPORTED)
+ HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}zlib-shared ${ZLIB_LIB_NAME} SHARED "")
+ add_dependencies (${HDF_PACKAGE_NAMESPACE}zlib-shared ZLIB)
+ set (ZLIB_SHARED_LIBRARY "${HDF_PACKAGE_NAMESPACE}zlib-shared")
set (ZLIB_LIBRARIES ${ZLIB_LIBRARIES} ${ZLIB_SHARED_LIBRARY})
endif ()
@@ -294,7 +246,7 @@ macro (PACKAGE_ZLIB_LIBRARY compress_type)
COMMENT "Copying ${ZLIB_INCLUDE_DIR_GEN}/zconf.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
)
set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/zconf.h)
- if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
+ if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ")
add_dependencies (ZLIB-GenHeader-Copy ZLIB)
endif ()
endmacro ()
diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake
index 1417204..fcde003 100644
--- a/config/cmake_ext_mod/grepTest.cmake
+++ b/config/cmake_ext_mod/grepTest.cmake
@@ -29,14 +29,35 @@ endif ()
# message (STATUS "Require TEST_EXPECT to be defined")
#endif ()
if (NOT TEST_FILTER)
- message (STATUS "Require TEST_FILTER to be defined")
+ message (STATUS "Optional TEST_FILTER to be defined")
endif ()
if (NOT TEST_REFERENCE)
message (FATAL_ERROR "Require TEST_REFERENCE to be defined")
endif ()
+if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT})
+ file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT})
+endif ()
+
+if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
+ file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err)
+endif ()
+
message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}")
+if (TEST_LIBRARY_DIRECTORY)
+ if (WIN32 AND NOT MINGW)
+ set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}")
+ else ()
+ set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}")
+ endif ()
+endif ()
+
+if (TEST_ENV_VAR)
+ set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}")
+ #message (STATUS "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}")
+endif ()
+
# run the test program, capture the stdout/stderr and the result var
execute_process (
COMMAND ${TEST_PROGRAM} ${TEST_ARGS}
@@ -49,24 +70,114 @@ execute_process (
)
message (STATUS "COMMAND Result: ${TEST_RESULT}")
+
message (STATUS "COMMAND Error: ${TEST_ERROR}")
-# now grep the output with the reference
+# remove special output
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
+string (FIND TEST_STREAM "_pmi_alps" "${TEST_FIND_RESULT}")
+if (TEST_FIND_RESULT GREATER 0)
+ string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
+ file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM})
+endif ()
-# TEST_REFERENCE should always be matched
-string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM})
-string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT)
-if (NOT TEST_RESULT)
- message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}")
+# if the TEST_ERRREF exists grep the error output with the error reference
+if (TEST_ERRREF)
+ # if the .err file exists grep the error output with the error reference before comparing stdout
+ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
+ file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_ERR_STREAM)
+
+ # TEST_ERRREF should always be matched
+ string (REGEX MATCH "${TEST_ERRREF}" TEST_MATCH ${TEST_ERR_STREAM})
+ string (COMPARE EQUAL "${TEST_ERRREF}" "${TEST_MATCH}" TEST_RESULT)
+ if (NOT TEST_RESULT)
+ message (FATAL_ERROR "Failed: The error output of ${TEST_PROGRAM} did not contain ${TEST_ERRREF}")
+ endif ()
+ endif ()
+
+ #always compare output file to reference unless this must be skipped
+ if (NOT TEST_SKIP_COMPARE)
+ if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE})
+ if (WIN32 AND NOT MINGW)
+ file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
+ file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
+ endif ()
+ if (NOT TEST_SORT_COMPARE)
+ # now compare the output with the reference
+ execute_process (
+ COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
+ RESULT_VARIABLE TEST_RESULT
+ )
+ else ()
+ file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1)
+ file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2)
+ list (SORT v1)
+ list (SORT v2)
+ if (NOT v1 STREQUAL v2)
+ set(TEST_RESULT 1)
+ endif ()
+ endif ()
+
+ if (TEST_RESULT)
+ set (TEST_RESULT 0)
+ file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
+ list (LENGTH test_act len_act)
+ file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
+ list (LENGTH test_ref len_ref)
+ if (len_act GREATER 0 AND len_ref GREATER 0)
+ math (EXPR _FP_LEN "${len_ref} - 1")
+ foreach (line RANGE 0 ${_FP_LEN})
+ list (GET test_act ${line} str_act)
+ list (GET test_ref ${line} str_ref)
+ if (NOT str_act STREQUAL str_ref)
+ if (str_act)
+ set (TEST_RESULT 1)
+ message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
+ endif ()
+ endif ()
+ endforeach ()
+ else ()
+ if (len_act EQUAL 0)
+ message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty")
+ endif ()
+ if (len_ref EQUAL 0)
+ message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty")
+ endif ()
+ endif ()
+ if (NOT len_act EQUAL len_ref)
+ set (TEST_RESULT 1)
+ endif ()
+ endif ()
+
+ message (STATUS "COMPARE Result: ${TEST_RESULT}")
+
+ # again, if return value is !=0 scream and shout
+ if (TEST_RESULT)
+ message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}")
+ endif ()
+ endif ()
+ endif ()
+else ()
+ # else grep the output with the reference
+ file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
+
+ # TEST_REFERENCE should always be matched
+ string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM})
+ string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT)
+ if (NOT TEST_RESULT)
+ message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}")
+ endif ()
endif ()
-string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM})
-if (TEST_EXPECT)
- # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match
- string (LENGTH "${TEST_MATCH}" TEST_RESULT)
- if (TEST_RESULT)
- message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}")
+
+if (TEST_FILTER)
+ string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM})
+ if (TEST_EXPECT)
+ # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match
+ string (LENGTH "${TEST_MATCH}" TEST_RESULT)
+ if (TEST_RESULT)
+ message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}")
+ endif ()
endif ()
endif ()
diff --git a/config/commence.am b/config/commence.am
index 5d88a88..a16eee5 100644
--- a/config/commence.am
+++ b/config/commence.am
@@ -97,8 +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 \
- check-vol install-doc lib progs tests uninstall-doc _exec_check-s \
- _test help
+ check-passthrough-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 9da1da5..2eec03a 100644
--- a/config/conclude.am
+++ b/config/conclude.am
@@ -282,8 +282,10 @@ check-vfd: $(LIB) $(PROGS) $(chk_TESTS)
fi; \
done
-# Run test with different Virtual Object Layer Connector
-check-vol: $(LIB) $(PROGS) $(chk_TESTS)
+# Run test with different passthrough Virtual Object Layer Connector
+# NOTE: Will only succeed with passthrough VOL connectors that use
+# the native VOL connector as the terminal connector.
+check-passthrough-vol: $(LIB) $(PROGS) $(chk_TESTS)
@for vol in $(VOL_LIST) dummy; do \
if test "$$vol" != dummy; then \
echo "============================"; \
diff --git a/configure.ac b/configure.ac
index e40e3c6..8c080ed 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.4], [help@hdfgroup.org])
+AC_INIT([HDF5], [1.11.5], [help@hdfgroup.org])
AC_CONFIG_SRCDIR([src/H5.c])
AC_CONFIG_HEADERS([src/H5config.h])
@@ -48,7 +48,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # use silent rules where a
##
## By default, it is enabled. Users can configure with
## --disable-maintainer-mode to prevent running the autotools.
-AM_MAINTAINER_MODE([enable])
+AM_MAINTAINER_MODE([disable])
## ----------------------------------------------------------------------
## Set prefix default (install directory) to a directory in the build area.
@@ -3477,10 +3477,12 @@ AC_CONFIG_FILES([src/libhdf5.settings
test/testabort_fail.sh
test/testcheck_version.sh
test/testerror.sh
+ test/testexternal_env.sh
test/testflushrefresh.sh
test/testlibinfo.sh
test/testlinks_env.sh
test/testswmr.sh
+ test/testvds_env.sh
test/testvdsswmr.sh
test/test_filter_plugin.sh
test/test_usecases.sh
diff --git a/fortran/Makefile.am b/fortran/Makefile.am
index 38084b9..ca0733f 100644
--- a/fortran/Makefile.am
+++ b/fortran/Makefile.am
@@ -30,6 +30,12 @@ endif
## Only recurse into subdirectories if HDF5 is configured to use Fortran.
if BUILD_FORTRAN_CONDITIONAL
SUBDIRS=src test $(TESTPARALLEL_DIR)
+
+# 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={}}"
+
endif
# All directories that have Makefiles
diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c
index a4e786e..12fb7ed 100644
--- a/fortran/src/H5Ff.c
+++ b/fortran/src/H5Ff.c
@@ -632,6 +632,40 @@ done:
return ret_value;
}
+/****if* H5Ff/h5fget_fileno_c
+ * NAME
+ * h5fget_fileno_c
+ * PURPOSE
+ * Call H5Fget_fileno to get file number
+ * INPUTS
+ * file_id - file identifier
+ * OUTPUTS
+ * fileno - file number for open file
+ * RETURNS
+ * 0 on success, -1 on failure
+ * AUTHOR
+ * Quincey Koziol
+ * Saturday, April 13, 2019
+ * SOURCE
+*/
+int_f
+h5fget_fileno_c(hid_t_f *file_id, int_f *fileno)
+/******/
+{
+ unsigned long fileno_c;
+ herr_t ret_value=0; /* Return value */
+
+ /*
+ * Call H5Fget_filesize function
+ */
+ if ((ret_value = H5Fget_fileno((hid_t)*file_id, &fileno_c)) < 0)
+ HGOTO_DONE(FAIL);
+ *fileno = (hsize_t_f)fileno_c;
+
+done:
+ return ret_value;
+}
+
/****if* H5Ff/h5fget_file_image_c
* NAME
* h5fget_file_image_c
diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90
index cc51f37..ac3a1c0 100644
--- a/fortran/src/H5Fff.F90
+++ b/fortran/src/H5Fff.F90
@@ -886,6 +886,44 @@ CONTAINS
hdferr = h5fget_filesize_c(file_id, size)
END SUBROUTINE h5fget_filesize_f
+!****s* H5F/h5fget_fileno_f
+!
+! NAME
+! h5fget_fileno_f
+!
+! PURPOSE
+! Retrieves the file number of the HDF5 file.
+!
+! INPUTS
+! file_id - file identifier
+! OUTPUTS
+! fileno - file number
+! hdferr - Returns 0 if successful and -1 if fails
+!
+! AUTHOR
+! Quincey Koziol
+! April 13, 2019
+!
+! SOURCE
+ SUBROUTINE h5fget_fileno_f(file_id, fileno, hdferr)
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN) :: file_id ! file identifier
+ INTEGER, INTENT(OUT) :: fileno ! File number
+ INTEGER, INTENT(OUT) :: hdferr ! Error code: 0 on success,
+ ! -1 if fail
+!*****
+ INTERFACE
+ INTEGER FUNCTION h5fget_fileno_c(file_id, fileno) &
+ BIND(C,NAME='h5fget_fileno_c')
+ IMPORT :: HID_T, HSIZE_T
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN) :: file_id
+ INTEGER, INTENT(OUT) :: fileno
+ END FUNCTION h5fget_fileno_c
+ END INTERFACE
+ hdferr = h5fget_fileno_c(file_id, fileno)
+ END SUBROUTINE h5fget_fileno_f
+
!****s* H5F (F03)/h5fget_file_image_f_F03
!
! NAME
diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c
index 96540f7..8abea25 100644
--- a/fortran/src/H5Sf.c
+++ b/fortran/src/H5Sf.c
@@ -1149,7 +1149,7 @@ h5sdecode_c ( _fcd buf, hid_t_f *obj_id )
*/
int_f
-h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc )
+h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc, hid_t_f *fapl_id )
/******/
{
int ret_value = -1;
@@ -1162,7 +1162,7 @@ h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc )
if (*nalloc == 0) {
- if(H5Sencode((hid_t)*obj_id, c_buf, &c_size) < 0)
+ if(H5Sencode2((hid_t)*obj_id, c_buf, &c_size, (hid_t)*fapl_id) < 0)
return ret_value;
*nalloc = (size_t_f)c_size;
@@ -1180,7 +1180,7 @@ h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc )
/*
* Call H5Sencode function.
*/
- if(H5Sencode((hid_t)*obj_id, c_buf, &c_size) < 0){
+ if(H5Sencode2((hid_t)*obj_id, c_buf, &c_size, (hid_t)*fapl_id) < 0){
return ret_value;
}
diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90
index 3af7755..bd3dcf4 100644
--- a/fortran/src/H5Sff.F90
+++ b/fortran/src/H5Sff.F90
@@ -1379,25 +1379,32 @@ CONTAINS
! M. Scot Breitenfeld
! March 26, 2008
! SOURCE
- SUBROUTINE h5sencode_f(obj_id, buf, nalloc, hdferr)
+ SUBROUTINE h5sencode_f(obj_id, buf, nalloc, hdferr, fapl_id)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: obj_id
CHARACTER(LEN=*), INTENT(OUT) :: buf
INTEGER(SIZE_T), INTENT(INOUT) :: nalloc
INTEGER, INTENT(OUT) :: hdferr
+ INTEGER(HID_T), OPTIONAL, INTENT(IN) :: fapl_id ! File access property list
!*****
+ INTEGER(HID_T) :: fapl_id_default
INTERFACE
- INTEGER FUNCTION h5sencode_c(buf, obj_id, nalloc) BIND(C,NAME='h5sencode_c')
+ INTEGER FUNCTION h5sencode_c(buf, obj_id, nalloc, fapl_id_default) BIND(C,NAME='h5sencode_c')
IMPORT :: C_CHAR
IMPORT :: HID_T, SIZE_T
INTEGER(HID_T), INTENT(IN) :: obj_id
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: buf
INTEGER(SIZE_T), INTENT(INOUT) :: nalloc
+ INTEGER(HID_T) :: fapl_id_default
END FUNCTION h5sencode_c
END INTERFACE
- hdferr = h5sencode_c(buf, obj_id, nalloc)
+ fapl_id_default = H5P_DEFAULT_F
+
+ IF(PRESENT(fapl_id)) fapl_id_default = fapl_id
+
+ hdferr = h5sencode_c(buf, obj_id, nalloc, fapl_id_default)
END SUBROUTINE h5sencode_f
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index 4f0e5ef..7945857 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -91,6 +91,7 @@ H5_FCDLL int_f h5fget_file_image_c(hid_t_f *file_id, void *buf_ptr, size_t_f *bu
H5_FCDLL int_f h5fflush_c(hid_t_f *obj_id, int_f *scope);
H5_FCDLL int_f h5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen);
H5_FCDLL int_f h5fget_filesize_c(hid_t_f *file_id, hsize_t_f *size);
+H5_FCDLL int_f h5fget_fileno_c(hid_t_f *file_id, int_f *fileno);
/*
* Functions from H5Sf.c
@@ -121,7 +122,7 @@ H5_FCDLL int_f h5sselect_hyperslab_c( hid_t_f *space_id , int_f *op, hsize_t_f *
H5_FCDLL int_f h5sget_select_type_c( hid_t_f *space_id , int_f *op);
H5_FCDLL int_f h5sselect_elements_c( hid_t_f *space_id , int_f *op, size_t_f *nelements, hsize_t_f *coord);
H5_FCDLL int_f h5sdecode_c( _fcd buf, hid_t_f *obj_id );
-H5_FCDLL int_f h5sencode_c(_fcd buf, hid_t_f *obj_id, size_t_f *nalloc );
+H5_FCDLL int_f h5sencode_c(_fcd buf, hid_t_f *obj_id, size_t_f *nalloc, hid_t_f *fapl_id );
H5_FCDLL int_f h5sextent_equal_c( hid_t_f * space1_id, hid_t_f *space2_id, hid_t_f *c_equal);
/*
diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in
index 7a4647f..390c2b7 100644
--- a/fortran/src/hdf5_fortrandll.def.in
+++ b/fortran/src/hdf5_fortrandll.def.in
@@ -98,6 +98,7 @@ H5F_mp_H5FGET_ACCESS_PLIST_F
H5F_mp_H5FIS_ACCESSIBLE_F
H5F_mp_H5FIS_HDF5_F
H5F_mp_H5FGET_NAME_F
+H5F_mp_H5FGET_FILENO_F
H5F_mp_H5FGET_FILESIZE_F
H5F_mp_H5FGET_FILE_IMAGE_F
H5F_mp_H5FGET_DSET_NO_ATTRS_HINT_F
diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90
index 2501996..b898c21 100644
--- a/fortran/test/tH5F.F90
+++ b/fortran/test/tH5F.F90
@@ -105,6 +105,10 @@ CONTAINS
INTEGER(SIZE_T) :: obj_count
INTEGER(HID_T) :: t1, t2, t3, t4
+ ! File numbers
+ INTEGER :: file_num1
+ INTEGER :: file_num2
+
!
!data buffers
!
@@ -287,6 +291,18 @@ CONTAINS
IF(obj_count.NE.2)THEN
total_error = total_error + 1
ENDIF
+
+ !
+ !Check file numbers
+ !
+ CALL h5fget_fileno_f(file1_id, file_num1, error)
+ CALL check("h5fget_fileno_f",error,total_error)
+ CALL h5fget_fileno_f(file2_id, file_num2, error)
+ CALL check("h5fget_fileno_f",error,total_error)
+ IF(file_num1 .EQ. file_num2) THEN
+ write(*,*) "file numbers aren't supposed to match"
+ END IF
+
!
!mount the second file under the first file's "/G" group.
!
@@ -431,6 +447,8 @@ CONTAINS
INTEGER, DIMENSION(4,6) :: dset_data, data_out
INTEGER(HSIZE_T), DIMENSION(2) :: data_dims
INTEGER(HSIZE_T) :: file_size
+ INTEGER :: file_num1
+ INTEGER :: file_num2
CHARACTER(LEN=80) :: file_name
INTEGER(SIZE_T) :: name_size
@@ -499,6 +517,17 @@ CONTAINS
CALL check("h5fget_filesize_f",error,total_error)
!
+ !Check file numbers
+ !
+ CALL h5fget_fileno_f(file_id, file_num1, error)
+ CALL check("h5fget_fileno_f",error,total_error)
+ CALL h5fget_fileno_f(reopen_id, file_num2, error)
+ CALL check("h5fget_fileno_f",error,total_error)
+ IF(file_num1 .NE. file_num2) THEN
+ write(*,*) "file numbers don't match"
+ END IF
+
+ !
!Open the dataset based on the reopen_id.
!
CALL h5dopen_f(reopen_id, dsetname, dset_id, error)
diff --git a/fortran/test/tH5MISC_1_8.F90 b/fortran/test/tH5MISC_1_8.F90
index 79fbf3e..b8c777c 100644
--- a/fortran/test/tH5MISC_1_8.F90
+++ b/fortran/test/tH5MISC_1_8.F90
@@ -189,8 +189,9 @@ SUBROUTINE test_h5s_encode(total_error)
INTEGER(hid_t) :: sid1, sid3! Dataspace ID
INTEGER(hid_t) :: decoded_sid1, decoded_sid3
+ INTEGER(hid_t) :: fapl ! File access property
INTEGER :: rank ! LOGICAL rank of dataspace
- INTEGER(size_t) :: sbuf_size=0, scalar_size=0
+ INTEGER(size_t) :: new_size = 0, old_size = 0, orig_size=0, scalar_size=0
! Make sure the size is large
CHARACTER(LEN=288) :: sbuf
@@ -228,18 +229,36 @@ SUBROUTINE test_h5s_encode(total_error)
! Encode simple data space in a buffer
- ! First find the buffer size
- CALL H5Sencode_f(sid1, sbuf, sbuf_size, error)
- CALL check("H5Sencode", error, total_error)
+ ! Find the buffer size without fapl
+ CALL H5Sencode_f(sid1, sbuf, orig_size, error)
+ CALL check("H5Sencode_f", error, total_error)
+ CALL verify("H5Sencode_f", INT(orig_size), 279, total_error)
+
+ ! Create file access property list
+ CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error)
+ CALL check("h5pcreate_f", error, total_error)
+
+ ! Find the buffer size with fapl (default old format)
+ CALL H5Sencode_f(sid1, sbuf, old_size, error, fapl)
+ CALL check("H5Sencode_f", error, total_error)
+ CALL verify("H5Sencode_f", INT(old_size), 279, total_error)
+ ! Set fapl to latest file format
+ CALL H5Pset_libver_bounds_f(fapl, H5F_LIBVER_LATEST_F, H5F_LIBVER_LATEST_F, error)
+ CALL check("H5Pset_libver_bounds_f",error, total_error)
- ! Try decoding bogus buffer
+ ! Find the buffer size with fapl set to latest format
+ CALL H5Sencode_f(sid1, sbuf, new_size, error, fapl)
+ CALL check("H5Sencode_f", error, total_error)
+ CALL verify("H5Sencode_f", INT(new_size), 101, total_error)
+ ! Try decoding bogus buffer
CALL H5Sdecode_f(sbuf, decoded_sid1, error)
CALL verify("H5Sdecode", error, -1, total_error)
- CALL H5Sencode_f(sid1, sbuf, sbuf_size, error)
- CALL check("H5Sencode", error, total_error)
+ ! Encode according to the latest file format
+ CALL H5Sencode_f(sid1, sbuf, new_size, error, fapl)
+ CALL check("H5Sencode_f", error, total_error)
! Decode from the dataspace buffer and return an object handle
CALL H5Sdecode_f(sbuf, decoded_sid1, error)
diff --git a/hl/Makefile.am b/hl/Makefile.am
index aee1f86..172d0e8 100644
--- a/hl/Makefile.am
+++ b/hl/Makefile.am
@@ -36,6 +36,12 @@ endif
## use the HL library
if BUILD_HDF5_HL_CONDITIONAL
SUBDIRS=src test tools $(CXX_DIR) $(FORTRAN_DIR)
+
+# 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={}}"
+
endif
DIST_SUBDIRS=src test tools c++ fortran examples
diff --git a/hl/fortran/src/H5DSff.F90 b/hl/fortran/src/H5DSff.F90
index 2dca479..5488bb2 100644
--- a/hl/fortran/src/H5DSff.F90
+++ b/hl/fortran/src/H5DSff.F90
@@ -304,7 +304,7 @@ CONTAINS
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: did ! The dataset
INTEGER , INTENT(in) :: idx ! The dimension
- CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: label ! The label
+ CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: label ! The label
INTEGER(SIZE_T), INTENT(in) :: label_len ! Length of label
END FUNCTION H5DSset_label_c
END INTERFACE
@@ -337,11 +337,11 @@ CONTAINS
IMPLICIT NONE
- INTEGER(hid_t), INTENT(in) :: did ! The dataget
- INTEGER , INTENT(in) :: idx ! The dimension
- CHARACTER(LEN=*), INTENT(in) :: label ! The label
- INTEGER(size_t) , INTENT(inout) :: size ! The length of the label buffer
- INTEGER :: errcode ! Error code
+ INTEGER(hid_t), INTENT(in) :: did ! The dataget
+ INTEGER , INTENT(in) :: idx ! The dimension
+ CHARACTER(LEN=*), INTENT(INOUT) :: label ! The label
+ INTEGER(size_t) , INTENT(INOUT) :: size ! The length of the label buffer
+ INTEGER :: errcode ! Error code
INTEGER :: c_idx
INTERFACE
@@ -352,7 +352,7 @@ CONTAINS
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: did ! The dataget
INTEGER , INTENT(in) :: idx ! The dimension
- CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: label ! The label
+ CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(INOUT) :: label ! The label
INTEGER(SIZE_T), INTENT(inout) :: size ! Length of label
END FUNCTION H5DSget_label_c
END INTERFACE
@@ -386,8 +386,8 @@ CONTAINS
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: did ! The dataget
- CHARACTER(LEN=*), INTENT(out) :: name ! The name
- INTEGER(size_t) , INTENT(inout) :: size ! The length of the name buffer
+ CHARACTER(LEN=*), INTENT(INOUT) :: name ! The name
+ INTEGER(size_t) , INTENT(INOUT) :: size ! The length of the name buffer
INTEGER :: errcode ! Error code
INTERFACE
@@ -397,7 +397,7 @@ CONTAINS
IMPORT :: HID_T, SIZE_T
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: did ! The dataget
- CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(out) :: name ! The name
+ CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(INOUT) :: name ! The name
INTEGER(SIZE_T), INTENT(inout) :: size ! Length of name
END FUNCTION H5DSget_scale_name_c
END INTERFACE
@@ -426,10 +426,10 @@ CONTAINS
SUBROUTINE H5DSget_num_scales_f( did, idx, num_scales, errcode)
IMPLICIT NONE
- INTEGER(hid_t), INTENT(in) :: did ! the dataset
- INTEGER , INTENT(in) :: idx ! the dimension of did to query
- INTEGER , INTENT(out) :: num_scales ! the number of Dimension Scales associated with did
- INTEGER :: errcode ! error code
+ INTEGER(hid_t), INTENT(in) :: did ! the dataset
+ INTEGER , INTENT(in) :: idx ! the dimension of did to query
+ INTEGER , INTENT(INOUT) :: num_scales ! the number of Dimension Scales associated with did
+ INTEGER :: errcode ! error code
INTEGER :: c_idx
INTERFACE
@@ -437,9 +437,9 @@ CONTAINS
BIND(C,NAME='h5dsget_num_scales_c')
IMPORT :: HID_T
IMPLICIT NONE
- INTEGER(hid_t), INTENT(in) :: did ! the dataset
- INTEGER , INTENT(in) :: idx ! the dimension of did to query
- INTEGER , INTENT(out) :: num_scales ! the number of Dimension Scales associated with did
+ INTEGER(hid_t), INTENT(in) :: did ! the dataset
+ INTEGER , INTENT(in) :: idx ! the dimension of did to query
+ INTEGER , INTENT(INOUT) :: num_scales ! the number of Dimension Scales associated with did
END FUNCTION H5DSget_num_scales_c
END INTERFACE
diff --git a/hl/fortran/src/H5HL_buildiface.F90 b/hl/fortran/src/H5HL_buildiface.F90
index dda8d56..1c5d9c8 100644
--- a/hl/fortran/src/H5HL_buildiface.F90
+++ b/hl/fortran/src/H5HL_buildiface.F90
@@ -293,7 +293,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name'
WRITE(11,'(A)') ' INTEGER(hid_t), INTENT(in) :: type_id'
WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
@@ -354,7 +354,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id'
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name'
WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
@@ -414,7 +414,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id'
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name'
WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
@@ -510,7 +510,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name'
WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
WRITE(11,'(A)') ' INTEGER(hid_t), INTENT(in) :: type_id'
- WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
+ WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
@@ -540,7 +540,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id'
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name'
WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
- WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
+ WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
@@ -712,7 +712,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: start'
WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: nrecords'
WRITE(11,'(A)') ' INTEGER(size_t), INTENT(in) :: type_size'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN), DIMENSION(*), TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT), DIMENSION(*), TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen1'
@@ -778,7 +778,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: start'
WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: nrecords'
WRITE(11,'(A)') ' INTEGER(size_t), INTENT(in) :: type_size'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN), DIMENSION(*), TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT), DIMENSION(*), TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
@@ -809,7 +809,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(in) :: field_name'
WRITE(11,'(A)') ' INTEGER(hid_t), INTENT(in) :: field_type'
WRITE(11,'(A)') ' INTEGER, INTENT(in) :: field_index'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'), INTENT(in), DIMENSION(*), TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'), INTENT(IN), DIMENSION(*), TARGET :: buf'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen1'
WRITE(11,'(A)') ' INTEGER :: errcode'
diff --git a/hl/fortran/src/H5IMff.F90 b/hl/fortran/src/H5IMff.F90
index 6646828..ac4b794 100644
--- a/hl/fortran/src/H5IMff.F90
+++ b/hl/fortran/src/H5IMff.F90
@@ -539,7 +539,7 @@ CONTAINS
INTEGER, INTENT(in) :: pal_number ! palette number
INTEGER(hsize_t), DIMENSION(*), INTENT(inout) :: dims ! dimensions
INTEGER :: errcode ! error code
- INTEGER(size_t) :: namelen ! name length
+ INTEGER(size_t) :: namelen ! name length
INTERFACE
INTEGER FUNCTION h5imget_palette_info_c(loc_id,namelen,dset_name,pal_number,dims) &
@@ -551,7 +551,7 @@ CONTAINS
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: dset_name ! name of the dataset
INTEGER, INTENT(in) :: pal_number ! palette number
INTEGER(hsize_t), DIMENSION(*), INTENT(inout) :: dims ! dimensions
- INTEGER(size_t) :: namelen ! name length
+ INTEGER(size_t) :: namelen ! name length
END FUNCTION h5imget_palette_info_c
END INTERFACE
diff --git a/hl/fortran/src/H5TBff.F90 b/hl/fortran/src/H5TBff.F90
index 2575b24..d18d023 100644
--- a/hl/fortran/src/H5TBff.F90
+++ b/hl/fortran/src/H5TBff.F90
@@ -532,7 +532,7 @@ CONTAINS
INTEGER(hsize_t), INTENT(in) :: start ! start record
INTEGER(hsize_t), INTENT(in) :: nrecords ! records
INTEGER(size_t), INTENT(in) :: type_size ! type size
- INTEGER, INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer
+ INTEGER, INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: namelen1
@@ -564,7 +564,7 @@ CONTAINS
INTEGER(hsize_t), INTENT(in) :: start ! start record
INTEGER(hsize_t), INTENT(in) :: nrecords ! records
INTEGER(size_t), INTENT(in) :: type_size ! type size
- CHARACTER(LEN=*), INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer
+ CHARACTER(LEN=*), INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: namelen1 ! name length
@@ -687,7 +687,7 @@ CONTAINS
INTEGER(hsize_t), INTENT(in) :: start ! start record
INTEGER(hsize_t), INTENT(in) :: nrecords ! records
INTEGER(size_t), INTENT(in) :: type_size ! type size
- INTEGER, INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer
+ INTEGER, INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
TYPE(C_PTR) :: f_ptr
@@ -716,7 +716,7 @@ CONTAINS
INTEGER(hsize_t), INTENT(in) :: start ! start record
INTEGER(hsize_t), INTENT(in) :: nrecords ! records
INTEGER(size_t), INTENT(in) :: type_size ! type size
- CHARACTER(LEN=*), INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer
+ CHARACTER(LEN=*), INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
TYPE(C_PTR) :: f_ptr
diff --git a/java/Makefile.am b/java/Makefile.am
index 7d0e2f0..ed2414d 100644
--- a/java/Makefile.am
+++ b/java/Makefile.am
@@ -31,6 +31,11 @@ JAVA_API=yes
SUBDIRS=src test examples
+# 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={}}"
+
endif
include $(top_srcdir)/config/conclude.am
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index 57157c2..e874732 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -212,7 +212,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* exception handlers to print out the HDF-5 error stack.
* <hr>
*
- * @version HDF5 1.11.4 <BR>
+ * @version HDF5 1.11.5 <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>
@@ -235,7 +235,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, 4 };
+ public final static int LIB_VERSION[] = { 1, 11, 5 };
public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib";
@@ -2968,6 +2968,19 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Fget_intent(long file_id) throws HDF5LibraryException;
/**
+ * H5Fget_fileno retrieves the "file number" for an open file.
+ *
+ * @param file_id
+ * IN: File identifier for a currently-open HDF5 file
+ *
+ * @return the unique file number for the file.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native long H5Fget_fileno(long file_id) throws HDF5LibraryException;
+
+ /**
* H5Fget_mdc_hit_rate queries the metadata cache of the target file to obtain its hit rate (cache hits / (cache
* hits + cache misses)) since the last time hit rate statistics were reset.
*
diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java
index a0c2ed6..9294bad 100644
--- a/java/src/hdf/hdf5lib/HDF5Constants.java
+++ b/java/src/hdf/hdf5lib/HDF5Constants.java
@@ -216,6 +216,7 @@ public class HDF5Constants {
public static final int H5F_LIBVER_EARLIEST = H5F_LIBVER_EARLIEST();
public static final int H5F_LIBVER_V18 = H5F_LIBVER_V18();
public static final int H5F_LIBVER_V110 = H5F_LIBVER_V110();
+ public static final int H5F_LIBVER_V112 = H5F_LIBVER_V112();
public static final int H5F_LIBVER_NBOUNDS = H5F_LIBVER_NBOUNDS();
public static final int H5F_LIBVER_LATEST = H5F_LIBVER_LATEST();
public static final int H5F_OBJ_ALL = H5F_OBJ_ALL();
@@ -1049,6 +1050,8 @@ public class HDF5Constants {
private static native final int H5F_LIBVER_V110();
+ private static native final int H5F_LIBVER_V112();
+
private static native final int H5F_LIBVER_NBOUNDS();
private static native final int H5F_LIBVER_LATEST();
diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c
index 2ac0892..74eb436 100644
--- a/java/src/jni/h5Constants.c
+++ b/java/src/jni/h5Constants.c
@@ -401,6 +401,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V18(JNIEnv *env, jclass cls){return
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V110(JNIEnv *env, jclass cls){return H5F_LIBVER_V110;}
JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V112(JNIEnv *env, jclass cls){return H5F_LIBVER_V112;}
+JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1NBOUNDS(JNIEnv *env, jclass cls){return H5F_LIBVER_NBOUNDS;}
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1LATEST(JNIEnv *env, jclass cls){return H5F_LIBVER_LATEST;}
diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c
index d145c6a..80567d9 100644
--- a/java/src/jni/h5fImp.c
+++ b/java/src/jni/h5fImp.c
@@ -260,11 +260,11 @@ done:
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1intent
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
unsigned intent = 0;
- UNUSED(cls);
+ UNUSED(clss);
if (H5Fget_intent((hid_t)file_id, &intent) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -275,6 +275,26 @@ done:
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Fget_fileno
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Fget_1fileno
+ (JNIEnv *env, jclass clss, jlong file_id)
+{
+ unsigned long fileno = 0;
+
+ UNUSED(clss);
+
+ if (H5Fget_fileno((hid_t)file_id, &fileno) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)fileno;
+} /* end Java_hdf_hdf5lib_H5_H5Fget_1fileno */
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Fclose
* Signature: (J)I
*/
diff --git a/java/src/jni/h5fImp.h b/java/src/jni/h5fImp.h
index 410a249..fc02c76 100644
--- a/java/src/jni/h5fImp.h
+++ b/java/src/jni/h5fImp.h
@@ -104,6 +104,15 @@ Java_hdf_hdf5lib_H5_H5Fget_1intent
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Fget_fileno
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Fget_1fileno
+ (JNIEnv*, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Fclose
* Signature: (J)I
*/
diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c
index a91dab2..d8110a1 100644
--- a/java/src/jni/h5sImp.c
+++ b/java/src/jni/h5sImp.c
@@ -1141,7 +1141,7 @@ Java_hdf_hdf5lib_H5_H5Sencode
if (obj_id < 0)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sencode: invalid object ID");
- if ((status = H5Sencode(obj_id, NULL, &buf_size)) < 0)
+ if ((status = H5Sencode2(obj_id, NULL, &buf_size, H5P_DEFAULT)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (buf_size == 0)
@@ -1150,7 +1150,7 @@ Java_hdf_hdf5lib_H5_H5Sencode
if (NULL == (bufPtr = (unsigned char *) HDcalloc((size_t) 1, buf_size)))
H5_JNI_FATAL_ERROR(ENVONLY, "H5Sencode: failed to allocate encoding buffer");
- if ((status = H5Sencode((hid_t) obj_id, bufPtr, &buf_size)) < 0)
+ if ((status = H5Sencode2((hid_t) obj_id, bufPtr, &buf_size, H5P_DEFAULT)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (NULL == (returnedArray = ENVPTR->NewByteArray(ENVONLY, (jsize) buf_size)))
diff --git a/java/test/TestH5.java b/java/test/TestH5.java
index c59101b..1d24724 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, 4 };
+ int libversion[] = { 1, 11, 5 };
try {
H5.H5get_libversion(libversion);
@@ -201,7 +201,7 @@ public class TestH5 {
*/
@Test
public void testH5check_version() {
- int majnum = 1, minnum = 11, relnum = 4;
+ int majnum = 1, minnum = 11, relnum = 5;
try {
H5.H5check_version(majnum, minnum, relnum);
diff --git a/java/test/TestH5F.java b/java/test/TestH5F.java
index e4f9a30..869b45c 100644
--- a/java/test/TestH5F.java
+++ b/java/test/TestH5F.java
@@ -14,6 +14,7 @@
package test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -32,6 +33,7 @@ import org.junit.rules.TestName;
public class TestH5F {
@Rule public TestName testname = new TestName();
private static final String H5_FILE = "testF.h5";
+ private static final String H5_FILE2 = "testF2.h5";
private static final int COUNT_OBJ_FILE = 1;
private static final int COUNT_OBJ_DATASET = 0;
@@ -94,28 +96,12 @@ public class TestH5F {
@Test(expected = HDF5LibraryException.class)
public void testH5Fget_create_plist_closed() throws Throwable {
- long fid = -1;
-
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
- }
-
- try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
- HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- fail("H5.H5Fopen: " + err);
- }
- try {
- H5.H5Fclose(fid);
- }
- catch (Exception ex) {
}
// it should fail because the file was closed.
- H5.H5Fget_create_plist(fid);
+ H5.H5Fget_create_plist(H5fid);
}
@Test
@@ -134,34 +120,17 @@ public class TestH5F {
@Test(expected = HDF5LibraryException.class)
public void testH5Fget_access_plist_closed() throws Throwable {
- long fid = -1;
-
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
- }
-
- try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
- HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- fail("H5.H5Fopen: " + err);
- }
- try {
- H5.H5Fclose(fid);
- }
- catch (Exception ex) {
}
// it should fail because the file was closed.
- H5.H5Fget_access_plist(fid);
+ H5.H5Fget_access_plist(H5fid);
}
@Test
public void testH5Fget_intent_rdwr() {
int intent = 0;
- long fid = -1;
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
@@ -169,31 +138,24 @@ public class TestH5F {
}
try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
+ H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
}
try {
- intent = H5.H5Fget_intent(fid);
+ intent = H5.H5Fget_intent(H5fid);
}
catch (Throwable err) {
fail("H5.H5Fget_intent: " + err);
}
assertEquals(HDF5Constants.H5F_ACC_RDWR, intent);
-
- try {
- H5.H5Fclose(fid);
- }
- catch (Exception ex) {
- }
}
@Test
public void testH5Fget_intent_rdonly() {
int intent = 0;
- long fid = -1;
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
@@ -201,24 +163,76 @@ public class TestH5F {
}
try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY,
+ H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY,
HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
}
try {
- intent = H5.H5Fget_intent(fid);
+ intent = H5.H5Fget_intent(H5fid);
}
catch (Throwable err) {
fail("H5.H5Fget_intent: " + err);
}
assertEquals(HDF5Constants.H5F_ACC_RDONLY, intent);
+ }
+
+ @Test
+ public void testH5Fget_fileno_same() {
+ long fileno1 = 0;
+ long fileno2 = 0;
+ long fid1 = -1;
+ long fid2 = -1;
try {
- H5.H5Fclose(fid);
+ fid1 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5.H5Fflush(fid1, HDF5Constants.H5F_SCOPE_LOCAL);
+ assertTrue("H5Fcreate failed", fid1 > 0);
+ fid2 = H5.H5Fopen(H5_FILE2, HDF5Constants.H5F_ACC_RDWR,
+ HDF5Constants.H5P_DEFAULT);
+ assertTrue("H5Fopen failed", fid2 > 0);
+ fileno1 = H5.H5Fget_fileno(fid1);
+ assertTrue("H5Fget_fileno1="+fileno1, fileno1 > 0);
+ fileno2 = H5.H5Fget_fileno(fid2);
+ assertTrue("H5Fget_fileno2="+fileno2, fileno2 > 0);
+
+ assertEquals("fileno1["+fileno1+"]!=fileno2["+fileno2+"]", fileno1, fileno2);
+ }
+ catch (Throwable err) {
+ fail("testH5Fget_fileno_same: " + err);
+ }
+ finally {
+ H5.H5Fclose(fid1);
+ H5.H5Fclose(fid2);
+ }
+ }
+
+ @Test
+ public void testH5Fget_fileno_diff() {
+ long fileno1 = 0;
+ long fileno2 = 0;
+ long fid2 = -1;
+
+ try {
+ fid2 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5.H5Fflush(fid2, HDF5Constants.H5F_SCOPE_LOCAL);
+ assertTrue("H5Fcreate failed", fid2 > 0);
+
+ fileno1 = H5.H5Fget_fileno(H5fid);
+ assertTrue("H5Fget_fileno1="+fileno1, fileno1 > 0);
+ fileno2 = H5.H5Fget_fileno(fid2);
+ assertTrue("H5Fget_fileno2="+fileno2, fileno2 > 0);
+
+ assertNotEquals("fileno1["+fileno1+"]==fileno2["+fileno2+"]", fileno1, fileno2);
+ }
+ catch (Throwable err) {
+ fail("testH5Fget_fileno_diff: " + err);
}
- catch (Exception ex) {
+ finally {
+ H5.H5Fclose(fid2);
}
}
diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java
index 981f34e..e46ed48 100644
--- a/java/test/TestH5P.java
+++ b/java/test/TestH5P.java
@@ -214,7 +214,7 @@ public class TestH5P {
@Test(expected = HDF5FunctionArgumentException.class)
public void testH5Pset_libver_bounds_invalidhigh() throws Throwable {
- H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_V110, HDF5Constants.H5F_LIBVER_V110+1);
+ H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_V112, HDF5Constants.H5F_LIBVER_V112+1);
}
@Test
diff --git a/java/test/testfiles/JUnit-TestH5F.txt b/java/test/testfiles/JUnit-TestH5F.txt
index 16a423e..f79ac40 100644
--- a/java/test/testfiles/JUnit-TestH5F.txt
+++ b/java/test/testfiles/JUnit-TestH5F.txt
@@ -1,5 +1,7 @@
JUnit version 4.11
.testH5Fget_access_plist
+.testH5Fget_fileno_diff
+.testH5Fget_fileno_same
.testH5Fget_obj_ids
.testH5Fget_intent_rdwr
.testH5Fget_access_plist_closed
@@ -10,5 +12,5 @@ JUnit version 4.11
Time: XXXX
-OK (8 tests)
+OK (10 tests)
diff --git a/m4/ax_check_class.m4 b/m4/ax_check_class.m4
index 098aa77..e673c2d 100644
--- a/m4/ax_check_class.m4
+++ b/m4/ax_check_class.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_check_class.html
+# https://www.gnu.org/software/autoconf-archive/ax_check_class.html
# ===========================================================================
#
# SYNOPSIS
@@ -36,7 +36,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -51,83 +51,18 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 7
+#serial 12
AU_ALIAS([AC_CHECK_CLASS], [AX_CHECK_CLASS])
AC_DEFUN([AX_CHECK_CLASS],[
AC_REQUIRE([AX_PROG_JAVA])
ac_var_name=`echo $1 | sed 's/\./_/g'`
-dnl Normaly I'd use a AC_CACHE_CHECK here but since the variable name is
+dnl Normally I'd use a AC_CACHE_CHECK here but since the variable name is
dnl dynamic I need an extra level of extraction
AC_MSG_CHECKING([for $1 class])
AC_CACHE_VAL(ax_cv_class_$ac_var_name, [
-if test x$ac_cv_prog_uudecode_base64 = xyes; then
-dnl /**
-dnl * Test.java: used to test dynamicaly if a class exists.
-dnl */
-dnl public class Test
-dnl {
-dnl
-dnl public static void
-dnl main( String[] argv )
-dnl {
-dnl Class lib;
-dnl if (argv.length < 1)
-dnl {
-dnl System.err.println ("Missing argument");
-dnl System.exit (77);
-dnl }
-dnl try
-dnl {
-dnl lib = Class.forName (argv[0]);
-dnl }
-dnl catch (ClassNotFoundException e)
-dnl {
-dnl System.exit (1);
-dnl }
-dnl lib = null;
-dnl System.exit (0);
-dnl }
-dnl
-dnl }
-cat << \EOF > Test.uue
-begin-base64 644 Test.class
-yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE
-bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51
-bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ
-AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt
-ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV
-ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp
-VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM
-amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi
-AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B
-AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA
-AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN
-uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK
-AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA
-JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA
-JwAAAAIAKA==
-====
-EOF
- if $UUDECODE Test.uue; then
- :
- else
- echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD
- echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD
- cat Test.uue >&AS_MESSAGE_LOG_FD
- ac_cv_prog_uudecode_base64=no
- fi
- rm -f Test.uue
- if AC_TRY_COMMAND($JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then
- eval "ac_cv_class_$ac_var_name=yes"
- else
- eval "ac_cv_class_$ac_var_name=no"
- fi
- rm -f Test.class
-else
AX_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"],
[eval "ac_cv_class_$ac_var_name=no"])
-fi
eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`"
HAVE_LAST_CLASS=$ac_var_val
@@ -137,7 +72,7 @@ else
ifelse([$3], , :, [$3])
fi
])
-dnl for some reason the above statment didn't fall though here?
+dnl for some reason the above statement didn't fall though here?
dnl do scripts have variable scoping?
eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
AC_MSG_RESULT($ac_var_val)
diff --git a/m4/ax_check_classpath.m4 b/m4/ax_check_classpath.m4
index 3c9081a..e08a253 100644
--- a/m4/ax_check_classpath.m4
+++ b/m4/ax_check_classpath.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_check_classpath.html
+# https://www.gnu.org/software/autoconf-archive/ax_check_classpath.html
# ===========================================================================
#
# SYNOPSIS
@@ -33,7 +33,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -48,7 +48,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 5
+#serial 6
AU_ALIAS([AC_CHECK_CLASSPATH], [AX_CHECK_CLASSPATH])
AC_DEFUN([AX_CHECK_CLASSPATH],[
diff --git a/m4/ax_check_java_home.m4 b/m4/ax_check_java_home.m4
index cfe8f58..1d60387 100644
--- a/m4/ax_check_java_home.m4
+++ b/m4/ax_check_java_home.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_check_java_home.html
+# https://www.gnu.org/software/autoconf-archive/ax_check_java_home.html
# ===========================================================================
#
# SYNOPSIS
@@ -28,7 +28,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -43,7 +43,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 6
+#serial 7
AU_ALIAS([AC_CHECK_JAVA_HOME], [AX_CHECK_JAVA_HOME])
diff --git a/m4/ax_check_junit.m4 b/m4/ax_check_junit.m4
index 39b52d1..44dd70d 100644
--- a/m4/ax_check_junit.m4
+++ b/m4/ax_check_junit.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_check_junit.html
+# https://www.gnu.org/software/autoconf-archive/ax_check_junit.html
# ===========================================================================
#
# SYNOPSIS
@@ -45,7 +45,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 5
+#serial 6
AU_ALIAS([AC_CHECK_JUNIT], [AX_CHECK_JUNIT])
AC_DEFUN([AX_CHECK_JUNIT],[
diff --git a/m4/ax_check_rqrd_class.m4 b/m4/ax_check_rqrd_class.m4
index 8f14241..baa041a 100644
--- a/m4/ax_check_rqrd_class.m4
+++ b/m4/ax_check_rqrd_class.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_check_rqrd_class.html
+# https://www.gnu.org/software/autoconf-archive/ax_check_rqrd_class.html
# ===========================================================================
#
# SYNOPSIS
@@ -35,7 +35,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -50,7 +50,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 5
+#serial 6
AU_ALIAS([AC_CHECK_RQRD_CLASS], [AX_CHECK_RQRD_CLASS])
AC_DEFUN([AX_CHECK_RQRD_CLASS],[
diff --git a/m4/ax_java_check_class.m4 b/m4/ax_java_check_class.m4
index 917638a..c9d60f7 100644
--- a/m4/ax_java_check_class.m4
+++ b/m4/ax_java_check_class.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_java_check_class.html
+# https://www.gnu.org/software/autoconf-archive/ax_java_check_class.html
# ===========================================================================
#
# SYNOPSIS
@@ -15,7 +15,7 @@
#
# The macro tries to compile a minimal program importing <class>. Some
# newer compilers moan about the failure to use this but fail or produce a
-# class file anyway. All moaing is sunk to /dev/null since I only wanted
+# class file anyway. All moaning is sunk to /dev/null since I only wanted
# to know if the class could be imported. This is a recommended followup
# to AX_CHECK_JAVA_PLUGIN with classpath appropriately adjusted.
#
@@ -34,7 +34,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -49,7 +49,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 9
+#serial 12
AU_ALIAS([DPS_JAVA_CHECK_CLASS], [AX_JAVA_CHECK_CLASS])
AC_DEFUN([AX_JAVA_CHECK_CLASS],[
diff --git a/m4/ax_java_options.m4 b/m4/ax_java_options.m4
index 36c10d9..722d788 100644
--- a/m4/ax_java_options.m4
+++ b/m4/ax_java_options.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_java_options.html
+# https://www.gnu.org/software/autoconf-archive/ax_java_options.html
# ===========================================================================
#
# SYNOPSIS
@@ -27,7 +27,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 6
+#serial 7
AU_ALIAS([AC_JAVA_OPTIONS], [AX_JAVA_OPTIONS])
AC_DEFUN([AX_JAVA_OPTIONS],[
diff --git a/m4/ax_jni_include_dir.m4 b/m4/ax_jni_include_dir.m4
index becb33a..ae7a5f0 100644
--- a/m4/ax_jni_include_dir.m4
+++ b/m4/ax_jni_include_dir.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html
+# https://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html
# ===========================================================================
#
# SYNOPSIS
@@ -32,6 +32,10 @@
#
# - at the configure level, setenv JAVAC
#
+# This macro depends on AC_CANONICAL_HOST which requires that config.guess
+# and config.sub be distributed along with the source code. See autoconf
+# manual for details.
+#
# Note: This macro can work with the autoconf M4 macros for Java programs.
# This particular macro is not part of the original set of macros.
#
@@ -44,11 +48,13 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 11
+#serial 15
AU_ALIAS([AC_JNI_INCLUDE_DIR], [AX_JNI_INCLUDE_DIR])
AC_DEFUN([AX_JNI_INCLUDE_DIR],[
+AC_REQUIRE([AC_CANONICAL_HOST])
+
JNI_INCLUDE_DIRS=""
if test "x$JAVA_HOME" != x; then
@@ -66,14 +72,17 @@ else
fi
case "$host_os" in
- darwin*) # Apple JDK is at /System location and has headers symlinked elsewhere
- case "$_JTOPDIR" in
- /System/Library/Frameworks/JavaVM.framework/*)
- _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
- _JINC="$_JTOPDIR/Headers";;
- *) _JINC="$_JTOPDIR/include";;
- esac;;
- *) _JINC="$_JTOPDIR/include";;
+ darwin*) # Apple Java headers are inside the Xcode bundle.
+ macos_version=$(sw_vers -productVersion | sed -n -e 's/^@<:@0-9@:>@*.\(@<:@0-9@:>@*\).@<:@0-9@:>@*/\1/p')
+ if @<:@ "$macos_version" -gt "7" @:>@; then
+ _JTOPDIR="$(xcrun --show-sdk-path)/System/Library/Frameworks/JavaVM.framework"
+ _JINC="$_JTOPDIR/Headers"
+ else
+ _JTOPDIR="/System/Library/Frameworks/JavaVM.framework"
+ _JINC="$_JTOPDIR/Headers"
+ fi
+ ;;
+ *) _JINC="$_JTOPDIR/include";;
esac
_AS_ECHO_LOG([_JTOPDIR=$_JTOPDIR])
_AS_ECHO_LOG([_JINC=$_JINC])
@@ -81,13 +90,21 @@ _AS_ECHO_LOG([_JINC=$_JINC])
# On Mac OS X 10.6.4, jni.h is a symlink:
# /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h
# -> ../../CurrentJDK/Headers/jni.h.
-AC_CHECK_FILE([$_JINC/jni.h],
- [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"],
- [_JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
- AC_CHECK_FILE([$_JTOPDIR/include/jni.h],
- [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"],
- AC_MSG_ERROR([cannot find JDK header files]))
- ])
+AC_CACHE_CHECK(jni headers, ac_cv_jni_header_path,
+[
+ if test -f "$_JINC/jni.h"; then
+ ac_cv_jni_header_path="$_JINC"
+ JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path"
+ else
+ _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
+ if test -f "$_JTOPDIR/include/jni.h"; then
+ ac_cv_jni_header_path="$_JTOPDIR/include"
+ JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path"
+ else
+ ac_cv_jni_header_path=none
+ fi
+ fi
+])
# get the likely subdirectories for system specific java includes
case "$host_os" in
@@ -102,13 +119,15 @@ cygwin*) _JNI_INC_SUBDIRS="win32";;
*) _JNI_INC_SUBDIRS="genunix";;
esac
-# add any subdirectories that are present
-for JINCSUBDIR in $_JNI_INC_SUBDIRS
-do
+if test "x$ac_cv_jni_header_path" != "xnone"; then
+ # add any subdirectories that are present
+ for JINCSUBDIR in $_JNI_INC_SUBDIRS
+ do
if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then
JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR"
fi
-done
+ done
+fi
])
# _ACJNI_FOLLOW_SYMLINKS <path>
diff --git a/m4/ax_prog_jar.m4 b/m4/ax_prog_jar.m4
index 3c60fca..d474912 100644
--- a/m4/ax_prog_jar.m4
+++ b/m4/ax_prog_jar.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_jar.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_jar.html
# ===========================================================================
#
# SYNOPSIS
@@ -37,7 +37,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 7
+#serial 8
AU_ALIAS([AC_PROG_JAR], [AX_PROG_JAR])
AC_DEFUN([AX_PROG_JAR],[
diff --git a/m4/ax_prog_java.m4 b/m4/ax_prog_java.m4
index 03961db..c2e6964 100644
--- a/m4/ax_prog_java.m4
+++ b/m4/ax_prog_java.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_java.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_java.html
# ===========================================================================
#
# SYNOPSIS
@@ -85,7 +85,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -100,7 +100,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 9
+#serial 10
AU_ALIAS([AC_PROG_JAVA], [AX_PROG_JAVA])
AC_DEFUN([AX_PROG_JAVA],[
diff --git a/m4/ax_prog_java_cc.m4 b/m4/ax_prog_java_cc.m4
index 3df064f..ce9612d 100644
--- a/m4/ax_prog_java_cc.m4
+++ b/m4/ax_prog_java_cc.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_java_cc.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_java_cc.html
# ===========================================================================
#
# SYNOPSIS
@@ -56,7 +56,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -71,7 +71,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 4
+#serial 5
# AX_PROG_JAVA_CC([COMPILER ...])
# --------------------------
diff --git a/m4/ax_prog_java_works.m4 b/m4/ax_prog_java_works.m4
index 54e132a..bc70526 100644
--- a/m4/ax_prog_java_works.m4
+++ b/m4/ax_prog_java_works.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html
# ===========================================================================
#
# SYNOPSIS
@@ -32,7 +32,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -47,57 +47,16 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 9
+#serial 11
AU_ALIAS([AC_PROG_JAVA_WORKS], [AX_PROG_JAVA_WORKS])
AC_DEFUN([AX_PROG_JAVA_WORKS], [
-AC_PATH_PROG(UUDECODE, uudecode, [no])
-if test x$UUDECODE != xno; then
-AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [
-dnl /**
-dnl * Test.java: used to test if java compiler works.
-dnl */
-dnl public class Test
-dnl {
-dnl
-dnl public static void
-dnl main( String[] argv )
-dnl {
-dnl System.exit (0);
-dnl }
-dnl
-dnl }
-cat << \EOF > Test.uue
-begin-base64 644 Test.class
-yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE
-bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51
-bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s
-YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG
-aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB
-AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB
-AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ=
-====
-EOF
-if $UUDECODE Test.uue; then
- ac_cv_prog_uudecode_base64=yes
-else
- echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD
- echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD
- cat Test.uue >&AS_MESSAGE_LOG_FD
- ac_cv_prog_uudecode_base64=no
-fi
-rm -f Test.uue])
-fi
-if test x$ac_cv_prog_uudecode_base64 != xyes; then
- rm -f Test.class
- AC_MSG_WARN([I have to compile Test.class from scratch])
if test x$ac_cv_prog_javac_works = xno; then
AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly])
fi
if test x$ac_cv_prog_javac_works = x; then
AX_PROG_JAVAC
fi
-fi
AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [
JAVA_TEST=Test.java
CLASS_TEST=Test.class
@@ -111,7 +70,6 @@ public static void main (String args[]) {
} }
EOF
changequote([, ])dnl
-if test x$ac_cv_prog_uudecode_base64 != xyes; then
if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then
:
else
@@ -119,7 +77,6 @@ if test x$ac_cv_prog_uudecode_base64 != xyes; then
cat $JAVA_TEST >&AS_MESSAGE_LOG_FD
AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?))
fi
-fi
if AC_TRY_COMMAND($JAVA -classpath . $JAVAFLAGS $TEST) >/dev/null 2>&1; then
ac_cv_prog_java_works=yes
else
@@ -127,7 +84,7 @@ else
cat $JAVA_TEST >&AS_MESSAGE_LOG_FD
AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?))
fi
-rm -fr $JAVA_TEST $CLASS_TEST Test.uue
+rm -f $JAVA_TEST $CLASS_TEST
])
AC_PROVIDE([$0])dnl
]
diff --git a/m4/ax_prog_javac.m4 b/m4/ax_prog_javac.m4
index d061243..8abb733 100644
--- a/m4/ax_prog_javac.m4
+++ b/m4/ax_prog_javac.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_javac.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_javac.html
# ===========================================================================
#
# SYNOPSIS
@@ -49,7 +49,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -64,7 +64,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 7
+#serial 8
AU_ALIAS([AC_PROG_JAVAC], [AX_PROG_JAVAC])
AC_DEFUN([AX_PROG_JAVAC],[
diff --git a/m4/ax_prog_javac_works.m4 b/m4/ax_prog_javac_works.m4
index 7dfa1e3..9b48149 100644
--- a/m4/ax_prog_javac_works.m4
+++ b/m4/ax_prog_javac_works.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html
# ===========================================================================
#
# SYNOPSIS
@@ -32,7 +32,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -47,7 +47,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 6
+#serial 7
AU_ALIAS([AC_PROG_JAVAC_WORKS], [AX_PROG_JAVAC_WORKS])
AC_DEFUN([AX_PROG_JAVAC_WORKS],[
diff --git a/m4/ax_prog_javadoc.m4 b/m4/ax_prog_javadoc.m4
index bcb6045..b9fcea4 100644
--- a/m4/ax_prog_javadoc.m4
+++ b/m4/ax_prog_javadoc.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_javadoc.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_javadoc.html
# ===========================================================================
#
# SYNOPSIS
@@ -38,7 +38,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 8
+#serial 9
AU_ALIAS([AC_PROG_JAVADOC], [AX_PROG_JAVADOC])
AC_DEFUN([AX_PROG_JAVADOC],[
diff --git a/m4/ax_prog_javah.m4 b/m4/ax_prog_javah.m4
index cefc616..935ec89 100644
--- a/m4/ax_prog_javah.m4
+++ b/m4/ax_prog_javah.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_javah.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_javah.html
# ===========================================================================
#
# SYNOPSIS
@@ -21,7 +21,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 8
+#serial 11
AU_ALIAS([AC_PROG_JAVAH], [AX_PROG_JAVAH])
AC_DEFUN([AX_PROG_JAVAH],[
@@ -30,19 +30,19 @@ AC_REQUIRE([AC_PROG_CPP])dnl
AC_PATH_PROG(JAVAH,javah)
AS_IF([test -n "$ac_cv_path_JAVAH"],
[
- AC_TRY_CPP([#include <jni.h>],,[
+ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <jni.h>]])],[],[
ac_save_CPPFLAGS="$CPPFLAGS"
- _ACJAVAH_FOLLOW_SYMLINKS("$ac_cv_path_JAVAH")
+ _ACJAVAH_FOLLOW_SYMLINKS("$ac_cv_path_JAVAH")
ax_prog_javah_bin_dir=`AS_DIRNAME([$_ACJAVAH_FOLLOWED])`
ac_dir="`AS_DIRNAME([$ax_prog_javah_bin_dir])`/include"
AS_CASE([$build_os],
- [cygwin*],
+ [cygwin*|mingw*],
[ac_machdep=win32],
[ac_machdep=`AS_ECHO($build_os) | sed 's,[[-0-9]].*,,'`])
CPPFLAGS="$ac_save_CPPFLAGS -I$ac_dir -I$ac_dir/$ac_machdep"
- AC_TRY_CPP([#include <jni.h>],
- ac_save_CPPFLAGS="$CPPFLAGS",
- AC_MSG_WARN([unable to include <jni.h>]))
+ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <jni.h>]])],
+ [ac_save_CPPFLAGS="$CPPFLAGS"],
+ [AC_MSG_WARN([unable to include <jni.h>])])
CPPFLAGS="$ac_save_CPPFLAGS"])
])
])
diff --git a/m4/ax_try_compile_java.m4 b/m4/ax_try_compile_java.m4
index a8ed6b2..245c36c 100644
--- a/m4/ax_try_compile_java.m4
+++ b/m4/ax_try_compile_java.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_try_compile_java.html
+# https://www.gnu.org/software/autoconf-archive/ax_try_compile_java.html
# ===========================================================================
#
# SYNOPSIS
@@ -29,7 +29,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 8
+#serial 10
AU_ALIAS([AC_TRY_COMPILE_JAVA], [AX_TRY_COMPILE_JAVA])
AC_DEFUN([AX_TRY_COMPILE_JAVA],[
@@ -48,8 +48,8 @@ dnl Don't remove the temporary files here, so they can be examined.
else
echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
cat Test.java >&AS_MESSAGE_LOG_FD
-ifelse([$4], , , [ rm -fr Test.java Test.class
+ifelse([$4], , , [ rm -f Test.java Test.class
$4
])dnl
fi
-rm -fr Test.java Test.class])
+rm -f Test.java Test.class])
diff --git a/m4/ax_try_run_java.m4 b/m4/ax_try_run_java.m4
index c680f03..2ebb86d 100644
--- a/m4/ax_try_run_java.m4
+++ b/m4/ax_try_run_java.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_try_run_java.html
+# https://www.gnu.org/software/autoconf-archive/ax_try_run_java.html
# ===========================================================================
#
# SYNOPSIS
@@ -29,7 +29,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 2
+#serial 3
AU_ALIAS([AC_TRY_RUN_JAVA], [AX_TRY_RUN_JAVA])
AC_DEFUN([AX_TRY_RUN_JAVA],[
diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt
index 233c2cc..4bba5e8 100644
--- a/release_docs/INSTALL_CMake.txt
+++ b/release_docs/INSTALL_CMake.txt
@@ -651,7 +651,7 @@ HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries"
HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF
HDF_TEST_EXPRESS "Control testing framework (0-3)" "0"
HDF5_TEST_VFD "Execute tests with different VFDs" OFF
-HDF5_TEST_VOL "Execute tests with different VOL connectors" OFF
+HDF5_TEST_PASSTHROUGH_VOL "Execute tests with different passthrough VOL connectors" 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
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 879c3f3..93453a0 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -1,4 +1,4 @@
- version 1.11.4 currently under development
+HDF5 version 1.11.5 currently under development
================================================================================
@@ -48,6 +48,14 @@ New Features
Configuration:
-------------
+ - Change tools test that test the error stack
+
+ There are some use cases which can cause the error stack of tools to be
+ different then the expected. These tests now use grepTest.cmake, this was
+ changed to allow the error file to be searched for an expected string.
+
+ (ADB - 2019/04/15, HDFFV-10741)
+
- Keep stderr and stdout separate in tests
Changed test handling of output capture. Tests now keep the stderr
@@ -135,14 +143,22 @@ New Features
(DER - 2018/12/08, HDFFV-10252)
+ - Added the ability to open files with UTF-8 file names on Windows.
+
+ The POSIX open(2) API call on Windows is limited to ASCII
+ file names. The library has been updated to convert incoming file
+ names to UTF-16 (via MultiByteToWideChar(CP_UTF8, ...) and use
+ _wopen() instead.
+
+ (DER - 2019/03/15, HDFFV-2714, HDFFV-3914, HDFFV-3895, HDFFV-8237, HDFFV-10413, HDFFV-10691)
Parallel Library:
-----------------
- Changed the default behavior in parallel when reading the same dataset in its entirely
(i.e. H5S_ALL dataset selection) which is being read by all the processes collectively.
The dataset mush be contiguous, less than 2GB, and of an atomic datatype.
- The new behavior is the HDF5 library will use an MPI_Bcast to pass the data read from
- the disk by the root process to the remain processes in the MPI communicator associated
+ The new behavior is the HDF5 library will use an MPI_Bcast to pass the data read from
+ the disk by the root process to the remain processes in the MPI communicator associated
with the HDF5 file.
(MSB - 2019/01/02, HDFFV-10652)
@@ -157,10 +173,10 @@ New Features
- Added new Fortran API, H5gmtime, which converts (C) 'time_t' structure
to Fortran DATE AND TIME storage format.
-
+
(MSB, 2019/01/08, HDFFV-10443)
- - Added new Fortran 'fields' optional parameter to: h5ovisit_f, h5oget_info_by_name_f,
+ - Added new Fortran 'fields' optional parameter to: h5ovisit_f, h5oget_info_by_name_f,
h5oget_info, h5oget_info_by_idx and h5ovisit_by_name_f.
(MSB, 2019/01/08, HDFFV-10443)
@@ -224,6 +240,28 @@ Bug Fixes since HDF5-1.10.3 release
Library
-------
+ - Fixed a bug that would cause an error or cause fill values to be
+ incorrectly read from a chunked dataset using the "single chunk" index if
+ the data was held in cache and there was no data on disk.
+
+ (NAF - 2019/03/06)
+
+ - Fixed a bug that could cause an error or cause fill values to be
+ incorrectly read from a dataset that was written to using H5Dwrite_chunk
+ if the dataset was not closed after writing.
+
+ (NAF - 2019/03/06, HDFFV-10716)
+
+ - Fixed memory leak in scale offset filter
+
+ In a special case where the MinBits is the same as the number of bits in
+ the datatype's precision, the filter's data buffer was not freed, causing
+ the memory usage to grow. In general the buffer was freed correctly. The
+ Minbits are the minimal number of bits to store the data values. Please
+ see the reference manual for H5Pset_scaleoffset for the detail.
+
+ (RL - 2019/3/4, HDFFV-10705)
+
- Fix hangs with collective metadata reads during chunked dataset I/O
In the parallel library, it was discovered that when a particular
@@ -263,8 +301,8 @@ Bug Fixes since HDF5-1.10.3 release
When deleting the attribute nodes from the name index v2 B-tree,
if an attribute is found in the intermediate B-tree nodes,
- which may be merged/redistributed in the process, we need to
- free the dynamically allocated spaces for the intermediate
+ which may be merged/redistributed in the process, we need to
+ free the dynamically allocated spaces for the intermediate
decoded attribute.
(VC - 2018/12/26, HDFFV-10659)
@@ -341,10 +379,10 @@ Bug Fixes since HDF5-1.10.3 release
Fortran
--------
- Added symbolic links libhdf5_hl_fortran.so to libhdf5hl_fortran.so and
- libhdf5_hl_fortran.a to libhdf5hl_fortran.a in hdf5/lib directory for
- autotools installs. These were added to match the name of the files
- installed by cmake and the general pattern of hl lib files. We will
- change the names of the installed lib files to the matching name in
+ libhdf5_hl_fortran.a to libhdf5hl_fortran.a in hdf5/lib directory for
+ autotools installs. These were added to match the name of the files
+ installed by cmake and the general pattern of hl lib files. We will
+ change the names of the installed lib files to the matching name in
the next major release.
(LRK - 2019/01/04, HDFFV-10596)
@@ -355,7 +393,7 @@ Bug Fixes since HDF5-1.10.3 release
(MSB, 2018/12/04, HDFFV-10511)
- - Fixed issue with Fortran not returning h5o_info_t field values
+ - Fixed issue with Fortran not returning h5o_info_t field values
meta_size%attr%index_size and meta_size%attr%heap_size.
(MSB, 2018/1/8, HDFFV-10443)
@@ -638,10 +676,10 @@ Bug Fixes since HDF5-1.10.2 release
conversions from or to long double types, especially when special values
such as infinity or NAN were involved. In some cases the results differed
by extremely small amounts from those on other machines, while some other
- tests resulted in segmentation faults. These conversion tests with long
- double types have been disabled for ppc64 machines until the problems are
+ tests resulted in segmentation faults. These conversion tests with long
+ double types have been disabled for ppc64 machines until the problems are
better understood and can be properly addressed.
-
+
(SRL - 2019/01/07, TRILAB-98)
Supported Platforms
diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt
index ea1ac05..ea352fe 100644
--- a/release_docs/USING_CMake_Examples.txt
+++ b/release_docs/USING_CMake_Examples.txt
@@ -38,12 +38,14 @@ II. Building HDF5 Examples with CMake
Files in the HDF5 install directory:
HDF5Examples folder
+ CTestScript.cmake
HDF5_Examples.cmake
HDF5_Examples_options.cmake
Default installation process:
Create a directory to run the examples, i.e. \test_hdf5.
Copy HDF5Examples folder to this directory.
+ Copy CTestScript.cmake to this directory.
Copy HDF5_Examples.cmake to this directory.
Copy HDF5_Examples_options.cmake to this directory.
The default source folder is defined as "HDF5Examples". It can be changed
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 83240bd..9730436 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -533,6 +533,7 @@ set (H5S_SOURCES
${HDF5_SRC_DIR}/H5S.c
${HDF5_SRC_DIR}/H5Sall.c
${HDF5_SRC_DIR}/H5Sdbg.c
+ ${HDF5_SRC_DIR}/H5Sdeprec.c
${HDF5_SRC_DIR}/H5Shyper.c
${HDF5_SRC_DIR}/H5Smpio.c
${HDF5_SRC_DIR}/H5Snone.c
@@ -1120,7 +1121,7 @@ target_link_libraries (${HDF5_LIB_TARGET}
)
if (NOT WIN32)
target_link_libraries (${HDF5_LIB_TARGET}
- PUBLIC $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ PRIVATE $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
)
endif ()
set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET})
@@ -1152,8 +1153,8 @@ if (BUILD_SHARED_LIBS)
)
TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED)
target_link_libraries (${HDF5_LIBSH_TARGET}
- PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
- PUBLIC $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}> $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ PUBLIC $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_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")
diff --git a/src/H5.c b/src/H5.c
index bf4643c..104c9fd 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -214,7 +214,7 @@ H5_init_library(void)
*/
if(H5E_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize error interface")
- if(H5VL_init() < 0)
+ if(H5VL_init_phase1() < 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")
@@ -229,6 +229,10 @@ H5_init_library(void)
if(H5FS_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize FS interface")
+ /* Finish initializing interfaces that depend on the interfaces above */
+ if(H5VL_init_phase2() < 0)
+ HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize vol interface")
+
/* Debugging? */
H5_debug_mask("-all");
H5_debug_mask(HDgetenv("HDF5_DEBUG"));
diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c
index 07da8e2..3377aa2 100644
--- a/src/H5Abtree2.c
+++ b/src/H5Abtree2.c
@@ -35,6 +35,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Apkg.h" /* Attributes */
#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
#include "H5SMprivate.h" /* Shared object header messages */
@@ -318,7 +319,7 @@ H5A__dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_U
FUNC_ENTER_STATIC_NOERR
/* Encode the record's fields */
- HDmemcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN);
+ H5MM_memcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN);
raw += H5O_FHEAP_ID_LEN;
*raw++ = nrecord->flags;
UINT32ENCODE(raw, nrecord->corder)
@@ -349,7 +350,7 @@ H5A__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_U
FUNC_ENTER_STATIC_NOERR
/* Decode the record's fields */
- HDmemcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
+ H5MM_memcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
raw += H5O_FHEAP_ID_LEN;
nrecord->flags = *raw++;
UINT32DECODE(raw, nrecord->corder)
@@ -477,7 +478,7 @@ H5A__dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR
FUNC_ENTER_STATIC_NOERR
/* Encode the record's fields */
- HDmemcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN);
+ H5MM_memcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN);
raw += H5O_FHEAP_ID_LEN;
*raw++ = nrecord->flags;
UINT32ENCODE(raw, nrecord->corder)
@@ -507,7 +508,7 @@ H5A__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR
FUNC_ENTER_STATIC_NOERR
/* Decode the record's fields */
- HDmemcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
+ H5MM_memcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
raw += H5O_FHEAP_ID_LEN;
nrecord->flags = *raw++;
UINT32DECODE(raw, nrecord->corder)
diff --git a/src/H5Adense.c b/src/H5Adense.c
index 021fa76..81e0dc5 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -899,6 +899,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name,
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
+ H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order ndex */
H5A_t *attr_copy = NULL; /* Copy of attribute to rename */
htri_t attr_sharable; /* Flag indicating attributes are sharable */
htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */
@@ -976,6 +977,33 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name,
if(H5A__set_version(f, attr_copy) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "unable to update attribute version")
+ /* Need to remove the attribute from the creation order index v2 B-tree */
+ if(ainfo->index_corder) {
+ htri_t corder_attr_exists; /* Attribute exists in v2 B-tree */
+
+ /* Open the creation order index v2 B-tree */
+ HDassert(H5F_addr_defined(ainfo->corder_bt2_addr));
+ if(NULL == (bt2_corder = H5B2_open(f, ainfo->corder_bt2_addr, NULL)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation index")
+
+ /* Set up the creation order to search for */
+ udata.corder = attr_copy->shared->crt_idx;
+
+ if((corder_attr_exists = H5B2_find(bt2_corder, &udata, NULL, NULL)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index")
+
+ if(corder_attr_exists) {
+ H5A_bt2_ud_rm_t rm_udata;
+
+ /* Set up the creation order in user data for the v2 B-tree 'record remove' callback */
+ rm_udata.common.corder = attr_copy->shared->crt_idx;
+
+ /* Remove the record from the creation order index v2 B-tree */
+ if(H5B2_remove(bt2_corder, &rm_udata, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from creation order index v2 B-tree")
+ }
+ }
+
/* Insert renamed attribute back into dense storage */
/* (Possibly making it shared) */
if(H5A__dense_insert(f, ainfo, attr_copy) < 0)
@@ -1023,6 +1051,8 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
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(bt2_corder && H5B2_close(bt2_corder) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index")
if(attr_copy)
H5O_msg_free(H5O_ATTR_ID, attr_copy);
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 6502fa4..d8ba92a 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -108,6 +108,7 @@ static herr_t H5A__iterate_common(hid_t loc_id, H5_index_t idx_type,
const unsigned H5O_attr_ver_bounds[] = {
H5O_ATTR_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_ATTR_VERSION_3, /* H5F_LIBVER_V18 */
+ H5O_ATTR_VERSION_3, /* H5F_LIBVER_V110 */
H5O_ATTR_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -646,21 +647,21 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf)
HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Copy the attribute data into the buffer for conversion */
- HDmemcpy(tconv_buf, attr->shared->data, (src_type_size * nelmts));
+ H5MM_memcpy(tconv_buf, attr->shared->data, (src_type_size * nelmts));
/* Perform datatype conversion. */
if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed")
/* Copy the converted data into the user's buffer */
- HDmemcpy(buf, tconv_buf, (dst_type_size * nelmts));
+ H5MM_memcpy(buf, tconv_buf, (dst_type_size * nelmts));
} /* end if */
/* No type conversion necessary */
else {
HDassert(dst_type_size == src_type_size);
/* Copy the attribute data into the user's buffer */
- HDmemcpy(buf, attr->shared->data, (dst_type_size * nelmts));
+ H5MM_memcpy(buf, attr->shared->data, (dst_type_size * nelmts));
} /* end else */
} /* end else */
} /* end if */
@@ -747,7 +748,7 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf)
HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed")
/* Copy the user's data into the buffer for conversion */
- HDmemcpy(tconv_buf, buf, (src_type_size * nelmts));
+ H5MM_memcpy(tconv_buf, buf, (src_type_size * nelmts));
/* Perform datatype conversion */
if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf) < 0)
@@ -771,7 +772,7 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Copy the attribute data into the user's buffer */
- HDmemcpy(attr->shared->data, buf, (dst_type_size * nelmts));
+ H5MM_memcpy(attr->shared->data, buf, (dst_type_size * nelmts));
} /* end else */
/* Modify the attribute in the object header */
@@ -827,7 +828,7 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf)
/* Copy all/some of the name */
if(buf && copy_len > 0) {
- HDmemcpy(buf, attr->shared->name, copy_len);
+ H5MM_memcpy(buf, attr->shared->name, copy_len);
/* Terminate the string */
buf[copy_len]='\0';
@@ -2240,7 +2241,7 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
if(NULL == (buf = H5FL_BLK_MALLOC(attr_buf, buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation NULLed for raw data chunk")
- HDmemcpy(buf, attr_src->shared->data, attr_src->shared->data_size);
+ H5MM_memcpy(buf, attr_src->shared->data, attr_src->shared->data_size);
/* Allocate background memory */
if(H5T_path_bkg(tpath_src_mem) || H5T_path_bkg(tpath_mem_dst))
@@ -2251,7 +2252,7 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg_buf) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "datatype conversion NULLed")
- HDmemcpy(reclaim_buf, buf, buf_size);
+ H5MM_memcpy(reclaim_buf, buf, buf_size);
/* Set background buffer to all zeros */
if(bkg_buf)
@@ -2261,14 +2262,14 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg_buf) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "datatype conversion NULLed")
- HDmemcpy(attr_dst->shared->data, buf, attr_dst->shared->data_size);
+ H5MM_memcpy(attr_dst->shared->data, buf, attr_dst->shared->data_size);
if(H5D_vlen_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, NULL, "unable to reclaim variable-length data")
} /* end if */
else {
HDassert(attr_dst->shared->data_size == attr_src->shared->data_size);
- HDmemcpy(attr_dst->shared->data, attr_src->shared->data, attr_src->shared->data_size);
+ H5MM_memcpy(attr_dst->shared->data, attr_src->shared->data, attr_src->shared->data_size);
} /* end else */
} /* end if(attr_src->shared->data) */
diff --git a/src/H5B.c b/src/H5B.c
index 2772bb9..2a34fae 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -107,6 +107,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
@@ -484,10 +485,10 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
*/
split_bt_ud->cache_flags = H5AC__DIRTIED_FLAG;
- HDmemcpy(split_bt_ud->bt->native,
+ H5MM_memcpy(split_bt_ud->bt->native,
bt_ud->bt->native + nleft * shared->type->sizeof_nkey,
(nright + 1) * shared->type->sizeof_nkey);
- HDmemcpy(split_bt_ud->bt->child,
+ H5MM_memcpy(split_bt_ud->bt->child,
&bt_ud->bt->child[nleft],
nright * sizeof(haddr_t));
@@ -612,9 +613,9 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
/* update left and right keys */
if(!lt_key_changed)
- HDmemcpy(lt_key, H5B_NKEY(bt_ud.bt,shared,0), type->sizeof_nkey);
+ H5MM_memcpy(lt_key, H5B_NKEY(bt_ud.bt,shared,0), type->sizeof_nkey);
if(!rt_key_changed)
- HDmemcpy(rt_key, H5B_NKEY(split_bt_ud.bt,shared,split_bt_ud.bt->nchildren), type->sizeof_nkey);
+ H5MM_memcpy(rt_key, H5B_NKEY(split_bt_ud.bt,shared,split_bt_ud.bt->nchildren), type->sizeof_nkey);
/*
* Copy the old root node to some other file location and make the new root
@@ -657,11 +658,11 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
new_root_bt->nchildren = 2;
new_root_bt->child[0] = bt_ud.addr;
- HDmemcpy(H5B_NKEY(new_root_bt, shared, 0), lt_key, shared->type->sizeof_nkey);
+ H5MM_memcpy(H5B_NKEY(new_root_bt, shared, 0), lt_key, shared->type->sizeof_nkey);
new_root_bt->child[1] = split_bt_ud.addr;
- HDmemcpy(H5B_NKEY(new_root_bt, shared, 1), md_key, shared->type->sizeof_nkey);
- HDmemcpy(H5B_NKEY(new_root_bt, shared, 2), rt_key, shared->type->sizeof_nkey);
+ H5MM_memcpy(H5B_NKEY(new_root_bt, shared, 1), md_key, shared->type->sizeof_nkey);
+ H5MM_memcpy(H5B_NKEY(new_root_bt, shared, 2), rt_key, shared->type->sizeof_nkey);
/* Insert the modified copy of the old root into the file again */
if(H5AC_insert_entry(f, H5AC_BT, addr, new_root_bt, H5AC__NO_FLAGS_SET) < 0)
@@ -726,9 +727,9 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx,
base = H5B_NKEY(bt, shared, (idx + 1));
if((idx + 1) == bt->nchildren) {
/* Make room for the new key */
- HDmemcpy(base + shared->type->sizeof_nkey, base,
+ H5MM_memcpy(base + shared->type->sizeof_nkey, base,
shared->type->sizeof_nkey); /* No overlap possible - memcpy() OK */
- HDmemcpy(base, md_key, shared->type->sizeof_nkey);
+ H5MM_memcpy(base, md_key, shared->type->sizeof_nkey);
/* The MD_KEY is the left key of the new node */
if(H5B_INS_RIGHT == anchor)
@@ -741,7 +742,7 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx,
/* Make room for the new key */
HDmemmove(base + shared->type->sizeof_nkey, base,
(bt->nchildren - idx) * shared->type->sizeof_nkey);
- HDmemcpy(base, md_key, shared->type->sizeof_nkey);
+ H5MM_memcpy(base, md_key, shared->type->sizeof_nkey);
/* The MD_KEY is the left key of the new node */
if(H5B_INS_RIGHT == anchor)
@@ -915,7 +916,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
* node. This node is not empty (handled above).
*/
my_ins = H5B_INS_LEFT;
- HDmemcpy(md_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey);
+ H5MM_memcpy(md_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey);
if((type->new_node)(f, H5B_INS_LEFT, H5B_NKEY(bt, shared, idx), udata,
md_key, &new_child_bt_ud.addr/*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node")
@@ -963,7 +964,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
*/
idx = bt->nchildren - 1;
my_ins = H5B_INS_RIGHT;
- HDmemcpy(md_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
+ H5MM_memcpy(md_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
if((type->new_node)(f, H5B_INS_RIGHT, md_key, udata,
H5B_NKEY(bt, shared, idx + 1), &new_child_bt_ud.addr/*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node")
@@ -1021,7 +1022,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
*lt_key_changed = FALSE;
} /* end if */
else
- HDmemcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
+ H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
} /* end if */
if(*rt_key_changed) {
bt_ud->cache_flags |= H5AC__DIRTIED_FLAG;
@@ -1031,7 +1032,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
*rt_key_changed = FALSE;
} /* end if */
else
- HDmemcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
+ H5MM_memcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
} /* end if */
/*
@@ -1080,7 +1081,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
* by the left and right node).
*/
if(split_bt_ud->bt) {
- HDmemcpy(md_key, H5B_NKEY(split_bt_ud->bt, shared, 0), type->sizeof_nkey);
+ H5MM_memcpy(md_key, H5B_NKEY(split_bt_ud->bt, shared, 0), type->sizeof_nkey);
ret_value = H5B_INS_RIGHT;
#ifdef H5B_DEBUG
/*
@@ -1339,7 +1340,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
/* Don't propagate change out of this B-tree node */
*lt_key_changed = FALSE;
else
- HDmemcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
+ H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
} /* end if */
if(*rt_key_changed) {
HDassert(type->critical_key == H5B_RIGHT);
@@ -1348,7 +1349,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
/* Don't propagate change out of this B-tree node */
*rt_key_changed = FALSE;
else
- HDmemcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
+ H5MM_memcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
} /* end if */
/*
@@ -1383,7 +1384,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
* in its left neighbor, but only if it is not the critical
* key for the right-most child of the left neighbor */
if(type->critical_key == H5B_LEFT)
- HDmemcpy(H5B_NKEY(sibling, shared, sibling->nchildren),
+ H5MM_memcpy(H5B_NKEY(sibling, shared, sibling->nchildren),
H5B_NKEY(bt, shared, 1), type->sizeof_nkey);
sibling->right = bt->right;
@@ -1400,7 +1401,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
* its right neighbor, but only if it is not the critical
* key for the left-most child of the right neighbor */
if(type->critical_key == H5B_RIGHT)
- HDmemcpy(H5B_NKEY(sibling, shared, 0),
+ H5MM_memcpy(H5B_NKEY(sibling, shared, 0),
H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
sibling->left = bt->left;
@@ -1442,7 +1443,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
/* Slide all keys down 1, update lt_key */
HDmemmove(H5B_NKEY(bt, shared, 0), H5B_NKEY(bt, shared, 1),
bt->nchildren * type->sizeof_nkey);
- HDmemcpy(lt_key, H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
+ H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
*lt_key_changed = TRUE;
} else
/* Slide all but the leftmost 2 keys down, leaving the leftmost
@@ -1471,7 +1472,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey);
else {
/* Just update rt_key */
- HDmemcpy(rt_key, H5B_NKEY(bt, shared, bt->nchildren - 1),
+ H5MM_memcpy(rt_key, H5B_NKEY(bt, shared, bt->nchildren - 1),
type->sizeof_nkey);
*rt_key_changed = TRUE;
} /* end else */
@@ -1516,7 +1517,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
if(NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->left, &cache_udata, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to protect node")
- HDmemcpy(H5B_NKEY(sibling, shared, sibling->nchildren),
+ H5MM_memcpy(H5B_NKEY(sibling, shared, sibling->nchildren),
H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
if(H5AC_unprotect(f, H5AC_BT, bt->left, sibling, H5AC__DIRTIED_FLAG) < 0)
@@ -1531,7 +1532,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
if(NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->right, &cache_udata, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to protect node")
- HDmemcpy(H5B_NKEY(sibling, shared, 0),
+ H5MM_memcpy(H5B_NKEY(sibling, shared, 0),
H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey);
if(H5AC_unprotect(f, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0)
@@ -1811,7 +1812,7 @@ H5B__copy(const H5B_t *old_bt)
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node")
/* Copy the main structure */
- HDmemcpy(new_node, old_bt, sizeof(H5B_t));
+ H5MM_memcpy(new_node, old_bt, sizeof(H5B_t));
/* Reset cache info */
HDmemset(&new_node->cache_info, 0, sizeof(H5AC_info_t));
@@ -1821,8 +1822,8 @@ H5B__copy(const H5B_t *old_bt)
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node")
/* Copy the other structures */
- HDmemcpy(new_node->native, old_bt->native, shared->sizeof_keys);
- HDmemcpy(new_node->child, old_bt->child, (sizeof(haddr_t) * shared->two_k));
+ H5MM_memcpy(new_node->native, old_bt->native, shared->sizeof_keys);
+ H5MM_memcpy(new_node->child, old_bt->child, (sizeof(haddr_t) * shared->two_k));
/* Increment the ref-count on the raw page */
H5UC_INC(new_node->rc_shared);
diff --git a/src/H5B2.c b/src/H5B2.c
index cf8e4a9..6b0d7a3 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -662,7 +662,7 @@ H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data)
if(hdr->min_native_rec == NULL)
if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
- HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
if(idx == (unsigned)(leaf->nrec - 1)) {
@@ -670,7 +670,7 @@ H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data)
if(hdr->max_native_rec == NULL)
if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
- HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
} /* end if */
@@ -1343,7 +1343,7 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data)
if(hdr->min_native_rec == NULL)
if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
- HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
if(idx == (unsigned)(leaf->nrec - 1)) {
@@ -1351,7 +1351,7 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data)
if(hdr->max_native_rec == NULL)
if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
- HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
} /* end if */
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index 2e1d37b..2a77bd5 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -391,7 +391,7 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
HDassert(hdr);
/* Magic number */
- HDmemcpy(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -811,7 +811,7 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
HDassert(internal->hdr);
/* Magic number */
- HDmemcpy(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -1212,7 +1212,7 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H
HDassert(leaf->hdr);
/* magic number */
- HDmemcpy(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* version # */
diff --git a/src/H5B2int.c b/src/H5B2int.c
index b3f855f..9940cd7 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -35,6 +35,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5B2pkg.h" /* v2 B-trees */
#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
@@ -241,17 +242,17 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
mid_record = old_node_nrec / 2;
/* Copy "upper half" of records to new child */
- HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0),
+ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0),
H5B2_NAT_NREC(left_native, hdr, mid_record + (unsigned)1),
hdr->cls->nrec_size * (old_node_nrec - (mid_record + (unsigned)1)));
/* Copy "upper half" of node pointers, if the node is an internal node */
if(depth > 1)
- HDmemcpy(&(right_node_ptrs[0]), &(left_node_ptrs[mid_record + (unsigned)1]),
+ H5MM_memcpy(&(right_node_ptrs[0]), &(left_node_ptrs[mid_record + (unsigned)1]),
sizeof(H5B2_node_ptr_t) * (size_t)(old_node_nrec - mid_record));
/* Copy "middle" record to internal node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, mid_record), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, mid_record), hdr->cls->nrec_size);
/* Mark nodes as dirty */
left_child_flags |= H5AC__DIRTIED_FLAG;
@@ -510,14 +511,14 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
uint16_t move_nrec = (uint16_t)(*right_nrec - new_right_nrec); /* Number of records to move from right node to left */
/* Copy record from parent node down into left child */
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* See if we need to move records from right node */
if(move_nrec > 1)
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, (*left_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (size_t)(move_nrec - 1));
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, (*left_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (size_t)(move_nrec - 1));
/* Move record from right node into parent node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), hdr->cls->nrec_size);
/* Slide records in right node down */
HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, move_nrec), hdr->cls->nrec_size * new_right_nrec);
@@ -534,7 +535,7 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
right_moved_nrec -= (hssize_t)moved_nrec;
/* Copy node pointers from right node to left */
- HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * move_nrec);
+ H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * move_nrec);
/* Slide node pointers in right node down */
HDmemmove(&(right_node_ptrs[0]), &(right_node_ptrs[move_nrec]), sizeof(H5B2_node_ptr_t) * (new_right_nrec + (unsigned)1));
@@ -569,14 +570,14 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
hdr->cls->nrec_size * (*right_nrec));
/* Copy record from parent node down into right child */
- HDmemcpy(H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* See if we need to move records from left node */
if(move_nrec > 1)
- HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, ((*left_nrec - move_nrec) + 1)), hdr->cls->nrec_size * (size_t)(move_nrec - 1));
+ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, ((*left_nrec - move_nrec) + 1)), hdr->cls->nrec_size * (size_t)(move_nrec - 1));
/* Move record from left node into parent node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, (*left_nrec - move_nrec)), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, (*left_nrec - move_nrec)), hdr->cls->nrec_size);
/* Handle node pointers, if we have an internal node */
if(depth > 1) {
@@ -587,7 +588,7 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
HDmemmove(&(right_node_ptrs[move_nrec]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
/* Copy node pointers from left node to right */
- HDmemcpy(&(right_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * move_nrec);
+ H5MM_memcpy(&(right_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * move_nrec);
/* Count the number of records being moved */
for(u = 0; u < move_nrec; u++)
@@ -775,16 +776,16 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
uint16_t moved_middle_nrec = 0; /* Number of records moved into left node */
/* Move left parent record down to left node */
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
/* Move records from middle node into left node */
if((new_left_nrec - 1) > *left_nrec) {
moved_middle_nrec = (uint16_t)(new_left_nrec - (*left_nrec + 1));
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * moved_middle_nrec);
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * moved_middle_nrec);
} /* end if */
/* Move record from middle node up to parent node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), hdr->cls->nrec_size);
moved_middle_nrec++;
/* Slide records in middle node down */
@@ -798,7 +799,7 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
/* Move middle node pointers into left node */
move_nptrs = (unsigned)(new_left_nrec - *left_nrec);
- HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t)*move_nptrs);
+ H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t)*move_nptrs);
/* Count the number of records being moved into the left node */
for(u = 0, moved_nrec = 0; u < move_nptrs; u++)
@@ -832,14 +833,14 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
HDmemmove(H5B2_NAT_NREC(right_native, hdr, right_nrec_move), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
/* Move right parent record down to right node */
- HDmemcpy(H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* Move records from middle node into right node */
if(right_nrec_move > 1)
- HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, ((curr_middle_nrec - right_nrec_move) + 1)), hdr->cls->nrec_size * (right_nrec_move - 1));
+ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, ((curr_middle_nrec - right_nrec_move) + 1)), hdr->cls->nrec_size * (right_nrec_move - 1));
/* Move record from middle node up to parent node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec - right_nrec_move)), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec - right_nrec_move)), hdr->cls->nrec_size);
/* Move node pointers also if this is an internal node */
if(depth > 1) {
@@ -850,7 +851,7 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
HDmemmove(&(right_node_ptrs[right_nrec_move]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
/* Move middle node pointers into right node */
- HDmemcpy(&(right_node_ptrs[0]), &(middle_node_ptrs[(curr_middle_nrec - right_nrec_move) + 1]), sizeof(H5B2_node_ptr_t) * right_nrec_move);
+ H5MM_memcpy(&(right_node_ptrs[0]), &(middle_node_ptrs[(curr_middle_nrec - right_nrec_move) + 1]), sizeof(H5B2_node_ptr_t) * right_nrec_move);
/* Count the number of records being moved into the right node */
for(u = 0, moved_nrec = 0; u < right_nrec_move; u++)
@@ -881,14 +882,14 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
HDmemmove(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * curr_middle_nrec);
/* Move left parent record down to middle node */
- HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
/* Move left records to middle node */
if(left_nrec_move > 1)
HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, new_left_nrec + 1), hdr->cls->nrec_size * (left_nrec_move - 1));
/* Move left parent record up from left node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(left_native, hdr, new_left_nrec), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(left_native, hdr, new_left_nrec), hdr->cls->nrec_size);
/* Move node pointers also if this is an internal node */
if(depth > 1) {
@@ -899,7 +900,7 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
HDmemmove(&(middle_node_ptrs[left_nrec_move]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(curr_middle_nrec + 1));
/* Move left node pointers into middle node */
- HDmemcpy(&(middle_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * left_nrec_move);
+ H5MM_memcpy(&(middle_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * left_nrec_move);
/* Count the number of records being moved into the left node */
for(u = 0, moved_nrec = 0; u < left_nrec_move; u++)
@@ -927,13 +928,13 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
unsigned right_nrec_move = (unsigned)(*right_nrec - new_right_nrec); /* Number of records to move out of right node */
/* Move right parent record down to middle node */
- HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, curr_middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, curr_middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* Move right records to middle node */
HDmemmove(H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (right_nrec_move - 1));
/* Move right parent record up from right node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), hdr->cls->nrec_size);
/* Slide right records down */
HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, right_nrec_move), hdr->cls->nrec_size * new_right_nrec);
@@ -944,7 +945,7 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
unsigned u; /* Local index variable */
/* Move right node pointers into middle node */
- HDmemcpy(&(middle_node_ptrs[curr_middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * right_nrec_move);
+ H5MM_memcpy(&(middle_node_ptrs[curr_middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * right_nrec_move);
/* Count the number of records being moved into the right node */
for(u = 0, moved_nrec = 0; u < right_nrec_move; u++)
@@ -1113,14 +1114,14 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
/* Redistribute records into left node */
{
/* Copy record from parent node to proper location */
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* Copy records from right node to left node */
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
/* Copy node pointers from right node into left node */
if(depth > 1)
- HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
+ H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
/* Update flush dependencies for grandchildren, if using SWMR */
if(hdr->swmr_write && depth > 1)
@@ -1304,13 +1305,13 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
middle_moved_nrec = middle_nrec_move;
/* Copy record from parent node to proper location in left node */
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
/* Copy records from middle node to left node */
- HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * (middle_nrec_move - 1));
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * (middle_nrec_move - 1));
/* Copy record from middle node to proper location in parent node */
- HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, (middle_nrec_move - 1)), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, (middle_nrec_move - 1)), hdr->cls->nrec_size);
/* Slide records in middle node down */
HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, middle_nrec_move), hdr->cls->nrec_size * (*middle_nrec - middle_nrec_move));
@@ -1320,7 +1321,7 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
unsigned u; /* Local index variable */
/* Copy node pointers from middle node into left node */
- HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * middle_nrec_move);
+ H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * middle_nrec_move);
/* Count the number of records being moved into the left node */
for(u = 0; u < middle_nrec_move; u++)
@@ -1348,15 +1349,15 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
/* Redistribute records into middle node */
{
/* Copy record from parent node to proper location in middle node */
- HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* Copy records from right node to middle node */
- HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
+ H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
/* Move node pointers also if this is an internal node */
if(depth > 1)
/* Copy node pointers from right node into middle node */
- HDmemcpy(&(middle_node_ptrs[*middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
+ H5MM_memcpy(&(middle_node_ptrs[*middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
/* Update flush dependencies for grandchildren, if using SWMR */
if(hdr->swmr_write && depth > 1)
@@ -1539,7 +1540,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers")
/* Copy the node pointers */
- HDmemcpy(node_ptrs, internal->node_ptrs, (sizeof(H5B2_node_ptr_t) * (size_t)(curr_node->node_nrec + 1)));
+ H5MM_memcpy(node_ptrs, internal->node_ptrs, (sizeof(H5B2_node_ptr_t) * (size_t)(curr_node->node_nrec + 1)));
} /* end if */
else {
H5B2_leaf_t *leaf; /* Pointer to leaf node */
@@ -1559,7 +1560,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys")
/* Copy the native keys */
- HDmemcpy(native, node_native, (hdr->cls->nrec_size * curr_node->node_nrec));
+ H5MM_memcpy(native, node_native, (hdr->cls->nrec_size * curr_node->node_nrec));
/* Unlock the node */
if(H5AC_unprotect(hdr->f, curr_node_class, curr_node->addr, node, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0)
diff --git a/src/H5B2leaf.c b/src/H5B2leaf.c
index 54d40ea..beca40c 100644
--- a/src/H5B2leaf.c
+++ b/src/H5B2leaf.c
@@ -412,7 +412,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
if(hdr->min_native_rec == NULL)
if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
- HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
if(idx == (unsigned)(leaf->nrec - 1)) {
@@ -420,7 +420,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
if(hdr->max_native_rec == NULL)
if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
- HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
} /* end if */
@@ -561,7 +561,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
if(hdr->min_native_rec == NULL)
if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
- HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
if(idx == (unsigned)(leaf->nrec - 1)) {
@@ -569,7 +569,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
if(hdr->max_native_rec == NULL)
if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
- HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
} /* end if */
} /* end if */
@@ -664,9 +664,9 @@ H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
} /* end else */
/* Swap records (use disk page as temporary buffer) */
- HDmemcpy(hdr->page, H5B2_NAT_NREC(child_native, hdr, 0), hdr->cls->nrec_size);
- HDmemcpy(H5B2_NAT_NREC(child_native, hdr, 0), swap_loc, hdr->cls->nrec_size);
- HDmemcpy(swap_loc, hdr->page, hdr->cls->nrec_size);
+ H5MM_memcpy(hdr->page, H5B2_NAT_NREC(child_native, hdr, 0), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(child_native, hdr, 0), swap_loc, hdr->cls->nrec_size);
+ H5MM_memcpy(swap_loc, hdr->page, hdr->cls->nrec_size);
/* Mark parent as dirty */
*internal_flags_ptr |= H5AC__DIRTIED_FLAG;
diff --git a/src/H5Bcache.c b/src/H5Bcache.c
index a0a75c8..c2c7a80 100644
--- a/src/H5Bcache.c
+++ b/src/H5Bcache.c
@@ -35,6 +35,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Bpkg.h" /* B-link trees */
#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -304,7 +305,7 @@ H5B__cache_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
HDassert(shared->type->encode);
/* magic number */
- HDmemcpy(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += 4;
/* node type and level */
diff --git a/src/H5C.c b/src/H5C.c
index 09c5fe8..ad2f762 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -2285,7 +2285,7 @@ H5C_protect(H5F_t * f,
if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
if(0 == mpi_rank)
if(H5C__generate_image(f, cache_ptr, entry_ptr) < 0)
@@ -6042,7 +6042,7 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags)
if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
} /* end if */
@@ -6542,7 +6542,7 @@ H5C_load_entry(H5F_t * f,
if(NULL == (image = (uint8_t *)H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
#ifdef H5_HAVE_PARALLEL
@@ -6580,7 +6580,7 @@ H5C_load_entry(H5F_t * f,
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()")
image = (uint8_t *)new_image;
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
} /* end if */
@@ -6624,7 +6624,7 @@ H5C_load_entry(H5F_t * f,
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()")
image = (uint8_t *)new_image;
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(image + actual_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(image + actual_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
if(actual_len > len) {
@@ -8456,7 +8456,7 @@ H5C__serialize_single_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry
if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)) )
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
} /* end if */
@@ -8573,7 +8573,7 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr)
if(NULL == (entry_ptr->image_ptr = H5MM_realloc(entry_ptr->image_ptr, new_len + H5C_IMAGE_EXTRA_SPACE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + new_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + new_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
/* Update statistics for resizing the entry */
diff --git a/src/H5CX.c b/src/H5CX.c
index c97bdcd..5474b63 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -64,17 +64,22 @@
#define H5CX_get_my_context() (&H5CX_head_g)
#endif /* H5_HAVE_THREADSAFE */
+/* Common macro for the retrieving the pointer to a property list */
+#define H5CX_RETRIEVE_PLIST(PL, FAILVAL) \
+ /* Check if the property list is already available */ \
+ if(NULL == (*head)->ctx.PL) \
+ /* Get the property list pointer */ \
+ if(NULL == ((*head)->ctx.PL = (H5P_genplist_t *)H5I_object((*head)->ctx.H5_GLUE(PL,_id)))) \
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, (FAILVAL), "can't get property list")
+
/* Common macro for the duplicated code to retrieve properties from a property list */
#define H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
/* Check for default property list */ \
if((*head)->ctx.H5_GLUE(PL,_id) == (DEF_PL)) \
- HDmemcpy(&(*head)->ctx.PROP_FIELD, &H5_GLUE3(H5CX_def_,PL,_cache).PROP_FIELD, sizeof(H5_GLUE3(H5CX_def_,PL,_cache).PROP_FIELD)); \
+ H5MM_memcpy(&(*head)->ctx.PROP_FIELD, &H5_GLUE3(H5CX_def_,PL,_cache).PROP_FIELD, sizeof(H5_GLUE3(H5CX_def_,PL,_cache).PROP_FIELD)); \
else { \
- /* Check if the property list is already available */ \
- if(NULL == (*head)->ctx.PL) \
- /* Get the dataset transfer property list pointer */ \
- if(NULL == ((*head)->ctx.PL = (H5P_genplist_t *)H5I_object((*head)->ctx.H5_GLUE(PL,_id)))) \
- HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset transfer property list") \
+ /* Retrieve the property list */ \
+ H5CX_RETRIEVE_PLIST(PL, FAIL) \
\
/* Get the property */ \
if(H5P_get((*head)->ctx.PL, (PROP_NAME), &(*head)->ctx.PROP_FIELD) < 0) \
@@ -108,11 +113,8 @@
\
/* Check if property exists in DXPL */ \
if(!(*head)->ctx.H5_GLUE(PROP_FIELD,_set)) { \
- /* Check if the property list is already available */ \
- if(NULL == (*head)->ctx.dxpl) \
- /* Get the dataset transfer property list pointer */ \
- if(NULL == ((*head)->ctx.dxpl = (H5P_genplist_t *)H5I_object((*head)->ctx.dxpl_id))) \
- HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset transfer property list") \
+ /* Retrieve the dataset transfer property list */ \
+ H5CX_RETRIEVE_PLIST(dxpl, FAIL) \
\
if((check_prop = H5P_exist_plist((*head)->ctx.dxpl, PROP_NAME)) < 0) \
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "error checking for property") \
@@ -129,15 +131,12 @@
/* Macro for the duplicated code to test and set properties for a property list */
#define H5CX_SET_PROP(PROP_NAME, PROP_FIELD) \
if((*head)->ctx.H5_GLUE(PROP_FIELD,_set)) { \
- /* Check if the property list is already available */ \
- if(NULL == (*head)->ctx.dxpl) \
- /* Get the dataset transfer property list pointer */ \
- if(NULL == ((*head)->ctx.dxpl = (H5P_genplist_t *)H5I_object((*head)->ctx.dxpl_id))) \
- HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, NULL, "can't get default dataset transfer property list") \
+ /* Retrieve the dataset transfer property list */ \
+ H5CX_RETRIEVE_PLIST(dxpl, NULL) \
\
- /* Set the chunk filter mask property */ \
+ /* Set the property */ \
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") \
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, NULL, "error setting data xfer property") \
} /* end if */
#endif /* H5_HAVE_PARALLEL */
@@ -175,7 +174,7 @@
* corresponding property in the property list to be set when the API
* context is popped, when returning from the API routine. Note that the
* naming of these fields, <foo> and <foo>_set, is important for the
-* H5CX_TEST_SET_PROP and H5CX_SET_PROP macros to work properly.
+ * H5CX_TEST_SET_PROP and H5CX_SET_PROP macros to work properly.
*/
typedef struct H5CX_t {
/* DXPL */
@@ -190,6 +189,14 @@ typedef struct H5CX_t {
hid_t dcpl_id; /* DCPL ID for API operation */
H5P_genplist_t *dcpl; /* Dataset Creation Property List */
+ /* DAPL */
+ hid_t dapl_id; /* DAPL ID for API operation */
+ H5P_genplist_t *dapl; /* Dataset Access Property List */
+
+ /* FAPL */
+ hid_t fapl_id; /* FAPL ID for API operation */
+ H5P_genplist_t *fapl; /* File Access Property List */
+
/* Internal: Object tagging info */
haddr_t tag; /* Current object's tag (ohdr chunk #0 address) */
@@ -276,8 +283,20 @@ typedef struct H5CX_t {
hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */
/* Cached DCPL properties */
- hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
- hbool_t do_min_dset_ohdr_valid; /* Whether minimize dataset object header flag is valid */
+ hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
+ hbool_t do_min_dset_ohdr_valid; /* Whether minimize dataset object header flag is valid */
+
+ /* Cached DAPL properties */
+ char *extfile_prefix; /* Prefix for external file */
+ hbool_t extfile_prefix_valid; /* Whether the prefix for external file is valid */
+ char *vds_prefix; /* Prefix for VDS */
+ hbool_t vds_prefix_valid; /* Whether the prefix for VDS is valid */
+
+ /* Cached FAPL properties */
+ H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds() */
+ hbool_t low_bound_valid; /* Whether low_bound property is valid */
+ H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds */
+ hbool_t high_bound_valid; /* Whether high_bound property is valid */
/* Cached VOL settings */
H5VL_connector_prop_t vol_connector_prop; /* Property for VOL connector ID & info */
@@ -339,6 +358,19 @@ typedef struct H5CX_dcpl_cache_t {
hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
} H5CX_dcpl_cache_t;
+/* Typedef for cached default dataset access property list information */
+/* (Same as the cached DXPL struct, above, except for the default DXPL) */
+typedef struct H5CX_dapl_cache_t {
+ char *extfile_prefix; /* Prefix for external file */
+ char *vds_prefix; /* Prefix for VDS */
+} H5CX_dapl_cache_t;
+
+/* Typedef for cached default file access property list information */
+/* (Same as the cached DXPL struct, above, except for the default DCPL) */
+typedef struct H5CX_fapl_cache_t {
+ H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds() */
+ H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds */
+} H5CX_fapl_cache_t;
/********************/
/* Local Prototypes */
@@ -375,9 +407,18 @@ static H5CX_lapl_cache_t H5CX_def_lapl_cache;
/* Define a "default" dataset creation property list cache structure to use for default DCPLs */
static H5CX_dcpl_cache_t H5CX_def_dcpl_cache;
+/* Define a "default" dataset access property list cache structure to use for default DAPLs */
+static H5CX_dapl_cache_t H5CX_def_dapl_cache;
+
+/* Define a "default" file access property list cache structure to use for default FAPLs */
+static H5CX_fapl_cache_t H5CX_def_fapl_cache;
+
/* Declare a static free list to manage H5CX_node_t structs */
H5FL_DEFINE_STATIC(H5CX_node_t);
+/* Declare a static free list to manage H5CX_state_t structs */
+H5FL_DEFINE_STATIC(H5CX_state_t);
+
/*--------------------------------------------------------------------------
@@ -396,6 +437,8 @@ H5CX__init_package(void)
H5P_genplist_t *dx_plist; /* Data transfer property list */
H5P_genplist_t *la_plist; /* Link access property list */
H5P_genplist_t *dc_plist; /* Dataset creation property list */
+ H5P_genplist_t *da_plist; /* Dataset access property list */
+ H5P_genplist_t *fa_plist; /* File access property list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -509,6 +552,39 @@ H5CX__init_package(void)
if(H5P_get(dc_plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &H5CX_def_dcpl_cache.do_min_dset_ohdr) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag")
+ /* Reset the "default DAPL cache" information */
+ HDmemset(&H5CX_def_dapl_cache, 0, sizeof(H5CX_dapl_cache_t));
+
+ /* Get the default DAPL cache information */
+
+ /* Get the default dataset access property list */
+ if(NULL == (da_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_ACCESS_DEFAULT)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list")
+
+ /* Get the prefix for the external file */
+ if(H5P_peek(da_plist, H5D_ACS_EFILE_PREFIX_NAME, &H5CX_def_dapl_cache.extfile_prefix) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for external file")
+
+ /* Get the prefix for the VDS file */
+ if(H5P_peek(da_plist, H5D_ACS_VDS_PREFIX_NAME, &H5CX_def_dapl_cache.vds_prefix) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for VDS")
+
+ /* Reset the "default FAPL cache" information */
+ HDmemset(&H5CX_def_fapl_cache, 0, sizeof(H5CX_fapl_cache_t));
+
+ /* Get the default FAPL cache information */
+
+ /* Get the default file access property list */
+ if(NULL == (fa_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list")
+
+ /* Get low_bound */
+ if(H5P_get(fa_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &H5CX_def_fapl_cache.low_bound) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag")
+
+ if(H5P_get(fa_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &H5CX_def_fapl_cache.high_bound) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX__init_package() */
@@ -632,7 +708,10 @@ H5CX__push_common(H5CX_node_t *cnode)
/* Set non-zero context info */
cnode->ctx.dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ cnode->ctx.dcpl_id = H5P_DATASET_CREATE_DEFAULT;
+ cnode->ctx.dapl_id = H5P_DATASET_ACCESS_DEFAULT;
cnode->ctx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ cnode->ctx.fapl_id = H5P_FILE_ACCESS_DEFAULT;
cnode->ctx.tag = H5AC__INVALID_TAG;
cnode->ctx.ring = H5AC_RING_USER;
@@ -709,6 +788,226 @@ H5CX_push_special(void)
/*-------------------------------------------------------------------------
+ * Function: H5CX_retrieve_state
+ *
+ * Purpose: Retrieve the state of an API context, for later resumption.
+ *
+ * Note: This routine _only_ tracks the state of API context information
+ * set before the VOL callback is invoked, not values that are
+ * set internal to the library. It's main purpose is to provide
+ * API context state to VOL connectors.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * January 8, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_retrieve_state(H5CX_state_t **api_state)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(head && *head);
+ HDassert(api_state);
+
+ /* Allocate & clear API context state */
+ if(NULL == (*api_state = H5FL_CALLOC(H5CX_state_t)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "unable to allocate new API context state")
+
+ /* Check for non-default DXPL */
+ if(H5P_DATASET_XFER_DEFAULT != (*head)->ctx.dxpl_id) {
+ /* Retrieve the DXPL property list */
+ H5CX_RETRIEVE_PLIST(dxpl, FAIL)
+
+ /* Copy the DXPL ID */
+ if(((*api_state)->dxpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.dxpl, FALSE)) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list")
+ } /* end if */
+ else
+ (*api_state)->dxpl_id = H5P_DATASET_XFER_DEFAULT;
+
+ /* Check for non-default LAPL */
+ if(H5P_LINK_ACCESS_DEFAULT != (*head)->ctx.lapl_id) {
+ /* Retrieve the LAPL property list */
+ H5CX_RETRIEVE_PLIST(lapl, FAIL)
+
+ /* Copy the LAPL ID */
+ if(((*api_state)->lapl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.lapl, FALSE)) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list")
+ } /* end if */
+ else
+ (*api_state)->lapl_id = H5P_LINK_ACCESS_DEFAULT;
+
+ /* Keep a reference to the current VOL wrapping context */
+ (*api_state)->vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx;
+ if(NULL != (*api_state)->vol_wrap_ctx)
+ if(H5VL_inc_vol_wrapper((*api_state)->vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTINC, FAIL, "can't increment refcount on VOL wrapping context")
+
+ /* Keep a copy of the VOL connector property, if there is one */
+ if((*head)->ctx.vol_connector_prop_valid && (*head)->ctx.vol_connector_prop.connector_id > 0) {
+ /* Get the connector property */
+ H5MM_memcpy(&(*api_state)->vol_connector_prop, &(*head)->ctx.vol_connector_prop, sizeof(H5VL_connector_prop_t));
+
+ /* Check for actual VOL connector property */
+ if((*api_state)->vol_connector_prop.connector_id) {
+ /* Copy connector info, if it exists */
+ if((*api_state)->vol_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((*api_state)->vol_connector_prop.connector_id)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Allocate and copy connector info */
+ if(H5VL_copy_connector_info(connector, &new_connector_info, (*api_state)->vol_connector_prop.connector_info) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "connector info copy failed")
+ (*api_state)->vol_connector_prop.connector_info = new_connector_info;
+ } /* end if */
+
+ /* Increment the refcount on the connector ID */
+ if(H5I_inc_ref((*api_state)->vol_connector_prop.connector_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed")
+ } /* end if */
+ } /* end if */
+
+#ifdef H5_HAVE_PARALLEL
+ /* Save parallel I/O settings */
+ (*api_state)->coll_metadata_read = (*head)->ctx.coll_metadata_read;
+#endif /* H5_HAVE_PARALLEL */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_retrieve_state() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_restore_state
+ *
+ * Purpose: Restore an API context, from a previously retrieved state.
+ *
+ * Note: This routine _only_ resets the state of API context information
+ * set before the VOL callback is invoked, not values that are
+ * set internal to the library. It's main purpose is to restore
+ * API context state from VOL connectors.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * January 9, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_restore_state(const H5CX_state_t *api_state)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity check */
+ HDassert(head && *head);
+ HDassert(api_state);
+
+ /* Restore the DXPL info */
+ (*head)->ctx.dxpl_id = api_state->dxpl_id;
+ (*head)->ctx.dxpl = NULL;
+
+ /* Restore the LAPL info */
+ (*head)->ctx.lapl_id = api_state->lapl_id;
+ (*head)->ctx.lapl = NULL;
+
+ /* Restore the VOL wrapper context */
+ (*head)->ctx.vol_wrap_ctx = api_state->vol_wrap_ctx;
+
+ /* Restore the VOL connector info */
+ if(api_state->vol_connector_prop.connector_id) {
+ H5MM_memcpy(&(*head)->ctx.vol_connector_prop, &api_state->vol_connector_prop, sizeof(H5VL_connector_prop_t));
+ (*head)->ctx.vol_connector_prop_valid = TRUE;
+ } /* end if */
+
+#ifdef H5_HAVE_PARALLEL
+ /* Restore parallel I/O settings */
+ (*head)->ctx.coll_metadata_read = api_state->coll_metadata_read;
+#endif /* H5_HAVE_PARALLEL */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5CX_restore_state() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_free_state
+ *
+ * Purpose: Free a previously retrievedAPI context state
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * January 9, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_free_state(H5CX_state_t *api_state)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(api_state);
+
+ /* Release the DXPL */
+ if(api_state->dxpl_id != H5P_DATASET_XFER_DEFAULT)
+ if(H5I_dec_ref(api_state->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DXPL")
+
+ /* Release the LAPL */
+ if(api_state->lapl_id != H5P_LINK_ACCESS_DEFAULT)
+ if(H5I_dec_ref(api_state->lapl_id) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LAPL")
+
+ /* Release the VOL wrapper context */
+ if(api_state->vol_wrap_ctx)
+ if(H5VL_dec_vol_wrapper(api_state->vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on VOL wrapping context")
+
+ /* Release the VOL connector property, if it was set */
+ if(api_state->vol_connector_prop.connector_id) {
+ /* Clean up any VOL connector info */
+ if(api_state->vol_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(api_state->vol_connector_prop.connector_id)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Free the connector info */
+ if(H5VL_free_connector_info(connector, api_state->vol_connector_prop.connector_info) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
+ } /* end if */
+
+ /* Decrement connector ID */
+ if(H5I_dec_ref(api_state->vol_connector_prop.connector_id) < 0)
+ HDONE_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't close VOL connector ID")
+ } /* end if */
+
+ /* Free the state */
+ api_state = H5FL_FREE(H5CX_state_t, api_state);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_free_state() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_is_def_dxpl
*
* Purpose: Checks if the API context is using the library's default DXPL
@@ -791,6 +1090,42 @@ H5CX_set_dcpl(hid_t dcpl_id)
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_dcpl() */
+/*-------------------------------------------------------------------------
+ * Function: H5CX_set_libver_bounds
+ *
+ * Purpose: Sets the low/high bounds according to "f" for the current API call context.
+ * When "f" is NULL, the low/high bounds are set to latest format.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * March 27, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_set_libver_bounds(H5F_t *f)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(head && *head);
+
+ /* Set the API context value */
+ (*head)->ctx.low_bound = (f == NULL) ? H5F_LIBVER_LATEST : H5F_LOW_BOUND(f);
+ (*head)->ctx.high_bound = (f == NULL) ? H5F_LIBVER_LATEST : H5F_HIGH_BOUND(f);
+
+ /* Mark the values as valid */
+ (*head)->ctx.low_bound_valid = TRUE;
+ (*head)->ctx.high_bound_valid = TRUE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_set_libver_bounds() */
+
/*-------------------------------------------------------------------------
* Function: H5CX_set_lapl
@@ -861,6 +1196,8 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
*acspl_id = *libclass->def_plist_id;
else {
htri_t is_lapl; /* Whether the access property list is (or is derived from) a link access property list */
+ htri_t is_dapl; /* Whether the access property list is (or is derived from) a dataset access property list */
+ htri_t is_fapl; /* Whether the access property list is (or is derived from) a file access property list */
#ifdef H5CX_DEBUG
/* Sanity check the access property list class */
@@ -874,6 +1211,18 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
else if(is_lapl)
(*head)->ctx.lapl_id = *acspl_id;
+ /* Check for dataset access property and set API context if so */
+ if((is_dapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_DACC->pclass)) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for dataset access class")
+ else if(is_dapl)
+ (*head)->ctx.dapl_id = *acspl_id;
+
+ /* Check for file access property and set API context if so */
+ if((is_fapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_FACC->pclass)) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for file access class")
+ else if(is_fapl)
+ (*head)->ctx.fapl_id = *acspl_id;
+
#ifdef H5_HAVE_PARALLEL
/* If this routine is not guaranteed to be collective (i.e. it doesn't
* modify the structural metadata in a file), check if the application
@@ -951,6 +1300,7 @@ H5CX_set_loc(hid_t
#endif /* H5_HAVE_PARALLEL */
loc_id)
{
+#ifdef H5_HAVE_PARALLEL
H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
herr_t ret_value = SUCCEED; /* Return value */
@@ -959,7 +1309,6 @@ H5CX_set_loc(hid_t
/* Sanity check */
HDassert(head && *head);
-#ifdef H5_HAVE_PARALLEL
/* Set collective metadata read flag */
(*head)->ctx.coll_metadata_read = TRUE;
@@ -980,10 +1329,14 @@ H5CX_set_loc(hid_t
if(mpi_comm != MPI_COMM_NULL)
MPI_Barrier(mpi_comm);
} /* end if */
-#endif /* H5_HAVE_PARALLEL */
done:
FUNC_LEAVE_NOAPI(ret_value)
+#else /* H5_HAVE_PARALLEL */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+#endif /* H5_HAVE_PARALLEL */
} /* end H5CX_set_loc() */
@@ -1045,7 +1398,7 @@ H5CX_set_vol_connector_prop(const H5VL_connector_prop_t *vol_connector_prop)
HDassert(head && *head);
/* Set the API context value */
- HDmemcpy(&(*head)->ctx.vol_connector_prop, vol_connector_prop, sizeof(H5VL_connector_prop_t));
+ H5MM_memcpy(&(*head)->ctx.vol_connector_prop, vol_connector_prop, sizeof(H5VL_connector_prop_t));
/* Mark the value as valid */
(*head)->ctx.vol_connector_prop_valid = TRUE;
@@ -1170,7 +1523,7 @@ H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop)
/* Check for value that was set */
if((*head)->ctx.vol_connector_prop_valid)
/* Get the value */
- HDmemcpy(vol_connector_prop, &(*head)->ctx.vol_connector_prop, sizeof(H5VL_connector_prop_t));
+ H5MM_memcpy(vol_connector_prop, &(*head)->ctx.vol_connector_prop, sizeof(H5VL_connector_prop_t));
else
HDmemset(vol_connector_prop, 0, sizeof(H5VL_connector_prop_t));
@@ -1375,7 +1728,7 @@ H5CX_get_btree_split_ratios(double split_ratio[3])
H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_BTREE_SPLIT_RATIO_NAME, btree_split_ratio)
/* Get the B-tree split ratio values */
- HDmemcpy(split_ratio, &(*head)->ctx.btree_split_ratio, sizeof((*head)->ctx.btree_split_ratio));
+ H5MM_memcpy(split_ratio, &(*head)->ctx.btree_split_ratio, sizeof((*head)->ctx.btree_split_ratio));
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2060,6 +2413,43 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_nlinks() */
+/*-------------------------------------------------------------------------
+ * Function: H5CX_get_libver_bounds
+ *
+ * Purpose: Retrieves the low/high bounds for the current API call context.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * March 27, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(low_bound);
+ HDassert(high_bound);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.fapl_id);
+
+ H5CX_RETRIEVE_PROP_VALID(fapl, H5P_FILE_ACCESS_DEFAULT, H5F_ACS_LIBVER_LOW_BOUND_NAME, low_bound)
+ H5CX_RETRIEVE_PROP_VALID(fapl, H5P_FILE_ACCESS_DEFAULT, H5F_ACS_LIBVER_HIGH_BOUND_NAME, high_bound)
+
+ /* Get the values */
+ *low_bound = (*head)->ctx.low_bound;
+ *high_bound = (*head)->ctx.high_bound;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_libver_bounds() */
+
/*-------------------------------------------------------------------------
* Function: H5CX_get_dset_min_ohdr_flag
@@ -2098,6 +2488,120 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_get_ext_file_prefix
+ *
+ * Purpose: Retrieves the prefix for external file
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * March 6, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_ext_file_prefix(char **extfile_prefix)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(extfile_prefix);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id);
+
+ /* Check if the value has been retrieved already */
+ if(!(*head)->ctx.extfile_prefix_valid) {
+ /* Check for default DAPL */
+ if((*head)->ctx.dapl_id == H5P_DATASET_ACCESS_DEFAULT)
+ (*head)->ctx.extfile_prefix = H5CX_def_dapl_cache.extfile_prefix;
+ else {
+ /* Check if the property list is already available */
+ if(NULL == (*head)->ctx.dapl)
+ /* Get the dataset access property list pointer */
+ if(NULL == ((*head)->ctx.dapl = (H5P_genplist_t *)H5I_object((*head)->ctx.dapl_id)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset access property list")
+
+ /* Get the prefix for the external file */
+ /* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need
+ * to copy it and free this in the H5CX pop routine. -QAK)
+ */
+ if(H5P_peek((*head)->ctx.dapl, H5D_ACS_EFILE_PREFIX_NAME, &(*head)->ctx.extfile_prefix) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve external file prefix")
+ } /* end else */
+
+ /* Mark the value as valid */
+ (*head)->ctx.extfile_prefix_valid = TRUE;
+ } /* end if */
+
+ /* Get the value */
+ *extfile_prefix = (*head)->ctx.extfile_prefix;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_ext_file_prefix() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_get_vds_prefix
+ *
+ * Purpose: Retrieves the prefix for VDS
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * March 6, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_vds_prefix(char **vds_prefix)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vds_prefix);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id);
+
+ /* Check if the value has been retrieved already */
+ if(!(*head)->ctx.vds_prefix_valid) {
+ /* Check for default DAPL */
+ if((*head)->ctx.dapl_id == H5P_DATASET_ACCESS_DEFAULT)
+ (*head)->ctx.vds_prefix = H5CX_def_dapl_cache.vds_prefix;
+ else {
+ /* Check if the property list is already available */
+ if(NULL == (*head)->ctx.dapl)
+ /* Get the dataset access property list pointer */
+ if(NULL == ((*head)->ctx.dapl = (H5P_genplist_t *)H5I_object((*head)->ctx.dapl_id)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset access property list")
+
+ /* Get the prefix for the VDS */
+ /* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need
+ * to copy it and free this in the H5CX pop routine. -QAK)
+ */
+ if(H5P_peek((*head)->ctx.dapl, H5D_ACS_VDS_PREFIX_NAME, &(*head)->ctx.vds_prefix) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VDS prefix")
+ } /* end else */
+
+ /* Mark the value as valid */
+ (*head)->ctx.vds_prefix_valid = TRUE;
+ } /* end if */
+
+ /* Get the value */
+ *vds_prefix = (*head)->ctx.vds_prefix;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_vds_prefix() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_set_tag
*
* Purpose: Sets the object tag for the current API call context.
diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h
index 51ee96b..638c32a 100644
--- a/src/H5CXprivate.h
+++ b/src/H5CXprivate.h
@@ -39,6 +39,19 @@
/* Library Private Typedefs */
/****************************/
+/* API context state */
+typedef struct H5CX_state_t {
+ hid_t dxpl_id; /* DXPL for operation */
+ hid_t lapl_id; /* LAPL for operation */
+ void *vol_wrap_ctx; /* VOL connector's "wrap context" for creating IDs */
+ H5VL_connector_prop_t vol_connector_prop; /* VOL connector property */
+
+#ifdef H5_HAVE_PARALLEL
+ /* Internal: Parallel I/O settings */
+ hbool_t coll_metadata_read; /* Whether to use collective I/O for metadata read */
+#endif /* H5_HAVE_PARALLEL */
+} H5CX_state_t;
+
/*****************************/
/* Library-private Variables */
@@ -57,10 +70,16 @@ H5_DLL herr_t H5CX_pop(void);
H5_DLL void H5CX_push_special(void);
H5_DLL hbool_t H5CX_is_def_dxpl(void);
+/* API context state routines */
+H5_DLL herr_t H5CX_retrieve_state(H5CX_state_t **api_state);
+H5_DLL herr_t H5CX_restore_state(const H5CX_state_t *api_state);
+H5_DLL herr_t H5CX_free_state(H5CX_state_t *api_state);
+
/* "Setter" routines for API context info */
H5_DLL void H5CX_set_dxpl(hid_t dxpl_id);
H5_DLL void H5CX_set_lapl(hid_t lapl_id);
H5_DLL void H5CX_set_dcpl(hid_t dcpl_id);
+H5_DLL herr_t H5CX_set_libver_bounds(H5F_t *f);
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);
@@ -109,6 +128,13 @@ H5_DLL herr_t H5CX_get_nlinks(size_t *nlinks);
/* "Getter" routines for DCPL properties cached in API context */
H5_DLL herr_t H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag);
+/* "Getter" routines for DAPL properties cached in API context */
+H5_DLL herr_t H5CX_get_ext_file_prefix(char **prefix_extfile);
+H5_DLL herr_t H5CX_get_vds_prefix(char **prefix_vds);
+
+/* "Getter" routines for FAPL properties cached in API context */
+H5_DLL herr_t H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound);
+
/* "Setter" routines for API context info */
H5_DLL void H5CX_set_tag(haddr_t tag);
H5_DLL void H5CX_set_ring(H5AC_ring_t ring);
diff --git a/src/H5Cimage.c b/src/H5Cimage.c
index 4684630..db44c7a 100644
--- a/src/H5Cimage.c
+++ b/src/H5Cimage.c
@@ -2020,11 +2020,11 @@ H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr,
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(((uint8_t *)image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(((uint8_t *)image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
/* Copy the entry image from the cache image block */
- HDmemcpy(image_ptr, p, size);
+ H5MM_memcpy(image_ptr, p, size);
p += size;
/* Copy data into target */
@@ -2219,7 +2219,7 @@ H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr,
p = *buf;
/* write signature */
- HDmemcpy(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN);
+ H5MM_memcpy(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN);
p += H5C__MDCI_BLOCK_SIGNATURE_LEN;
/* write version */
@@ -2355,7 +2355,7 @@ H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf,
H5F_addr_encode(f, &p, ie_ptr->fd_parent_addrs[u]);
/* Copy entry image */
- HDmemcpy(p, ie_ptr->image_ptr, ie_ptr->size);
+ H5MM_memcpy(p, ie_ptr->image_ptr, ie_ptr->size);
p += ie_ptr->size;
/* Update buffer pointer */
@@ -3422,11 +3422,11 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr,
if(NULL == (pf_entry_ptr->image_ptr = H5MM_malloc(pf_entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(((uint8_t *)pf_entry_ptr->image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(((uint8_t *)pf_entry_ptr->image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
/* Copy the entry image from the cache image block */
- HDmemcpy(pf_entry_ptr->image_ptr, p, pf_entry_ptr->size);
+ H5MM_memcpy(pf_entry_ptr->image_ptr, p, pf_entry_ptr->size);
p += pf_entry_ptr->size;
/* Initialize the rest of the fields in the prefetched entry */
diff --git a/src/H5D.c b/src/H5D.c
index fc350f2..413be37 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -135,6 +135,9 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "dcpl_id is not a dataset create property list ID")
+ /* Set the DCPL for the API context */
+ H5CX_set_dcpl(dcpl_id);
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
@@ -228,6 +231,9 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID")
+ /* Set the DCPL for the API context */
+ H5CX_set_dcpl(dcpl_id);
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c
index b61aed4..c13c36a 100644
--- a/src/H5Dbtree.c
+++ b/src/H5Dbtree.c
@@ -39,6 +39,7 @@
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MFprivate.h" /* File space management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h" /* Object headers */
#include "H5Sprivate.h" /* Dataspaces */
#include "H5VMprivate.h" /* Vector and array functions */
@@ -847,7 +848,7 @@ H5D__btree_shared_create(const H5F_t *f, H5O_storage_chunk_t *store,
/* Set up the "local" information for this dataset's chunks */
if(NULL == (my_layout = H5FL_MALLOC(H5O_layout_chunk_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk layout")
- HDmemcpy(my_layout, layout, sizeof(H5O_layout_chunk_t));
+ H5MM_memcpy(my_layout, layout, sizeof(H5O_layout_chunk_t));
shared->udata = my_layout;
/* Make shared B-tree info reference counted */
@@ -1087,7 +1088,7 @@ H5D__btree_idx_iterate_cb(H5F_t H5_ATTR_UNUSED *f, const void *_lt_key,
HDcompile_assert(sizeof(chunk_rec.filter_mask) == sizeof(lt_key->filter_mask));
/* Compose generic chunk record for callback */
- HDmemcpy(&chunk_rec, lt_key, sizeof(*lt_key));
+ H5MM_memcpy(&chunk_rec, lt_key, sizeof(*lt_key));
chunk_rec.chunk_addr = addr;
/* Make "generic chunk" callback */
diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c
index b32f395..d25e0f0 100644
--- a/src/H5Dbtree2.c
+++ b/src/H5Dbtree2.c
@@ -32,6 +32,7 @@
#include "H5Dpkg.h" /* Datasets */
#include "H5FLprivate.h" /* Free Lists */
#include "H5MFprivate.h" /* File space management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vector and array functions */
@@ -248,7 +249,7 @@ H5D__bt2_crt_context(void *_udata)
/* Set up the "local" information for this dataset's chunk dimension sizes */
if(NULL == (my_dim = (uint32_t *)H5FL_BLK_MALLOC(chunk_dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate chunk dims")
- HDmemcpy(my_dim, udata->dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t));
+ H5MM_memcpy(my_dim, udata->dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t));
ctx->dim = my_dim;
/*
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index dcd3a8d..93b4427 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -313,6 +313,7 @@ const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {{
H5D__chunk_construct,
H5D__chunk_init,
H5D__chunk_is_space_alloc,
+ H5D__chunk_is_data_cached,
H5D__chunk_io_init,
H5D__chunk_read,
H5D__chunk_write,
@@ -340,6 +341,7 @@ const H5D_layout_ops_t H5D_LOPS_NONEXISTENT[1] = {{
NULL,
NULL,
NULL,
+ NULL,
#ifdef H5_HAVE_PARALLEL
NULL,
NULL,
@@ -394,10 +396,13 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset,
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
+ /* Sanity checks */
+ HDassert(layout->type == H5D_CHUNKED);
+
io_info.dset = dset;
/* Allocate dataspace and initialize it if it hasn't been. */
- if(!(*layout->ops->is_space_alloc)(&layout->storage))
+ if(!H5D__chunk_is_space_alloc(&layout->storage))
/* Allocate storage */
if(H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
@@ -435,13 +440,17 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset,
if(0 == idx_info.pline->nused && H5F_addr_defined(old_chunk.offset))
/* If there are no filters and we are overwriting the chunk we can just set values */
need_insert = FALSE;
- else
+ else {
/* Otherwise, create the chunk it if it doesn't exist, or reallocate the chunk
* if its size has changed.
*/
if(H5D__chunk_file_alloc(&idx_info, &old_chunk, &udata.chunk_block, &need_insert, scaled) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk")
+ /* Cache the new chunk information */
+ H5D__chunk_cinfo_cache_update(&dset->shared->cache.chunk.last, &udata);
+ } /* end else */
+
/* Make sure the address of the chunk is returned. */
if(!H5F_addr_defined(udata.chunk_block.offset))
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk address isn't defined")
@@ -506,7 +515,8 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters,
*filters = 0;
/* Allocate dataspace and initialize it if it hasn't been. */
- if(!(*layout->ops->is_space_alloc)(&layout->storage))
+ if(!H5D__chunk_is_space_alloc(&layout->storage)
+ && !H5D__chunk_is_data_cached(dset->shared))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "storage is not initialized")
/* Calculate the index of this chunk */
@@ -1019,6 +1029,30 @@ H5D__chunk_is_space_alloc(const H5O_storage_t *storage)
/*-------------------------------------------------------------------------
+ * Function: H5D__chunk_is_data_cached
+ *
+ * Purpose: Query if raw data is cached for dataset
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * Wednessday, March 6, 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(shared_dset);
+
+ FUNC_LEAVE_NOAPI(shared_dset->cache.chunk.nused > 0)
+} /* end H5D__chunk_is_data_cached() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__chunk_io_init
*
* Purpose: Performs initialization before any sort of I/O on the raw data
@@ -1654,7 +1688,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
new_chunk_info->mspace_shared = FALSE;
/* Copy the chunk's scaled coordinates */
- HDmemcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
+ H5MM_memcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
new_chunk_info->scaled[fm->f_ndims] = 0;
/* Insert the new chunk into the skip list */
@@ -1914,9 +1948,9 @@ H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type,
chunk_info->chunk_points = 0;
/* Set the chunk's scaled coordinates */
- HDmemcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
+ H5MM_memcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
chunk_info->scaled[fm->f_ndims] = 0;
- HDmemcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
+ H5MM_memcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
/* Insert the new chunk into the skip list */
if(H5SL_insert(fm->sel_chunks,chunk_info,&chunk_info->index) < 0) {
@@ -2157,11 +2191,11 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
HDassert(fm);
/* Set up "nonexistent" I/O info object */
- HDmemcpy(&nonexistent_io_info, io_info, sizeof(nonexistent_io_info));
+ H5MM_memcpy(&nonexistent_io_info, io_info, sizeof(nonexistent_io_info));
nonexistent_io_info.layout_ops = *H5D_LOPS_NONEXISTENT;
/* Set up contiguous I/O info object */
- HDmemcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
+ H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
ctg_io_info.store = &ctg_store;
ctg_io_info.layout_ops = *H5D_LOPS_CONTIG;
@@ -2169,7 +2203,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size, uint32_t);
/* Set up compact I/O info object */
- HDmemcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
+ H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
cpt_io_info.store = &cpt_store;
cpt_io_info.layout_ops = *H5D_LOPS_COMPACT;
@@ -2307,7 +2341,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
HDassert(fm);
/* Set up contiguous I/O info object */
- HDmemcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
+ H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
ctg_io_info.store = &ctg_store;
ctg_io_info.layout_ops = *H5D_LOPS_CONTIG;
@@ -2315,7 +2349,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size, uint32_t);
/* Set up compact I/O info object */
- HDmemcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
+ H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
cpt_io_info.store = &cpt_store;
cpt_io_info.layout_ops = *H5D_LOPS_COMPACT;
@@ -2670,7 +2704,7 @@ H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *ud
HDassert(udata->common.scaled);
/* Stored the information to cache */
- HDmemcpy(last->scaled, udata->common.scaled, sizeof(hsize_t) * udata->common.layout->ndims);
+ H5MM_memcpy(last->scaled, udata->common.scaled, sizeof(hsize_t) * udata->common.layout->ndims);
last->addr = udata->chunk_block.offset;
H5_CHECKED_ASSIGN(last->nbytes, uint32_t, udata->chunk_block.length, hsize_t);
last->chunk_idx = udata->chunk_idx;
@@ -3039,7 +3073,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
*/
if(NULL == (buf = H5MM_malloc(alloc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline")
- HDmemcpy(buf, ent->chunk, alloc);
+ H5MM_memcpy(buf, ent->chunk, alloc);
} /* end if */
else {
/*
@@ -3452,7 +3486,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
*/
if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
- HDmemcpy(chunk, ent->chunk, chunk_size);
+ H5MM_memcpy(chunk, ent->chunk, chunk_size);
ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, old_pline);
ent->chunk = (uint8_t *)chunk;
chunk = NULL;
@@ -3478,7 +3512,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
*/
if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
- HDmemcpy(chunk, ent->chunk, chunk_size);
+ H5MM_memcpy(chunk, ent->chunk, chunk_size);
ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, old_pline);
ent->chunk = (uint8_t *)chunk;
@@ -3607,7 +3641,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
(void)H5D__chunk_mem_xfree(tmp_chunk, old_pline);
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
} /* end if */
- HDmemcpy(chunk, tmp_chunk, chunk_size);
+ H5MM_memcpy(chunk, tmp_chunk, chunk_size);
(void)H5D__chunk_mem_xfree(tmp_chunk, old_pline);
} /* end if */
} /* end if */
@@ -3688,7 +3722,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
ent->chunk_block.offset = chunk_addr;
ent->chunk_block.length = chunk_alloc;
ent->chunk_idx = udata->chunk_idx;
- HDmemcpy(ent->scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims);
+ H5MM_memcpy(ent->scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims);
H5_CHECKED_ASSIGN(ent->rd_count, uint32_t, chunk_size, size_t);
H5_CHECKED_ASSIGN(ent->wr_count, uint32_t, chunk_size, size_t);
ent->chunk = (uint8_t *)chunk;
@@ -3816,7 +3850,7 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata,
fake_ent.edge_chunk_state = H5D_RDCC_DISABLE_FILTERS;
if(udata->new_unfilt_chunk)
fake_ent.edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS;
- HDmemcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims);
+ H5MM_memcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims);
HDassert(layout->u.chunk.size > 0);
fake_ent.chunk_idx = udata->chunk_idx;
fake_ent.chunk_block.offset = udata->chunk_block.offset;
@@ -4103,7 +4137,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
if(has_unfilt_edge_chunks) {
if(NULL == (unfilt_fill_buf = H5D__chunk_mem_alloc(orig_chunk_size, &def_pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk")
- HDmemcpy(unfilt_fill_buf, fb_info.fill_buf, orig_chunk_size);
+ H5MM_memcpy(unfilt_fill_buf, fb_info.fill_buf, orig_chunk_size);
} /* end if */
/* Retrieve filter settings from API context */
@@ -5637,7 +5671,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
if(udata->chunk_in_cache && udata->chunk) {
HDassert(!H5F_addr_defined(chunk_rec->chunk_addr));
- HDmemcpy(buf, udata->chunk, nbytes);
+ H5MM_memcpy(buf, udata->chunk, nbytes);
udata->chunk = NULL;
}
else {
@@ -5671,7 +5705,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HDassert(H5F_addr_defined(ent->chunk_block.offset));
H5_CHECKED_ASSIGN(nbytes, size_t, shared_fo->layout.u.chunk.size, uint32_t);
- HDmemcpy(buf, ent->chunk, nbytes);
+ H5MM_memcpy(buf, ent->chunk, nbytes);
}
else {
/* read chunk data from the source file */
@@ -5705,7 +5739,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "datatype conversion failed")
/* Copy into another buffer, to reclaim memory later */
- HDmemcpy(reclaim_buf, buf, reclaim_buf_size);
+ H5MM_memcpy(reclaim_buf, buf, reclaim_buf_size);
/* Set background buffer to all zeros */
HDmemset(bkg, 0, buf_size);
@@ -5736,7 +5770,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
} /* end if */
/* After fix ref, copy the new reference elements to the buffer to write out */
- HDmemcpy(buf, bkg, buf_size);
+ H5MM_memcpy(buf, bkg, buf_size);
} /* end if */
/* Set up destination chunk callback information for insertion */
@@ -6036,7 +6070,7 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
for(ent = shared_fo->cache.chunk.head; ent; ent = next) {
if(!H5F_addr_defined(ent->chunk_block.offset)) {
- HDmemcpy(chunk_rec.scaled, ent->scaled, sizeof(chunk_rec.scaled));
+ H5MM_memcpy(chunk_rec.scaled, ent->scaled, sizeof(chunk_rec.scaled));
udata.chunk = ent->chunk;
udata.chunk_in_cache = TRUE;
if(H5D__chunk_copy_cb(&chunk_rec, &udata) < 0)
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index c0c2a80..df61856 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -80,6 +80,7 @@ const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {{
H5D__compact_construct,
NULL,
H5D__compact_is_space_alloc,
+ NULL,
H5D__compact_io_init,
H5D__contig_read,
H5D__contig_write,
@@ -528,7 +529,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
if(NULL == (buf = H5FL_BLK_MALLOC(type_conv, buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- HDmemcpy(buf, storage_src->buf, storage_src->size);
+ H5MM_memcpy(buf, storage_src->buf, storage_src->size);
/* allocate temporary bkg buff for data conversion */
if(NULL == (bkg = H5FL_BLK_MALLOC(type_conv, buf_size)))
@@ -539,7 +540,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
/* Copy into another buffer, to reclaim memory later */
- HDmemcpy(reclaim_buf, buf, buf_size);
+ H5MM_memcpy(reclaim_buf, buf, buf_size);
/* Set background buffer to all zeros */
HDmemset(bkg, 0, buf_size);
@@ -548,7 +549,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
- HDmemcpy(storage_dst->buf, buf, storage_dst->size);
+ H5MM_memcpy(storage_dst->buf, buf, storage_dst->size);
if(H5D_vlen_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data")
@@ -573,11 +574,11 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
} /* end if */
else
/* Type conversion not necessary */
- HDmemcpy(storage_dst->buf, storage_src->buf, storage_src->size);
+ H5MM_memcpy(storage_dst->buf, storage_src->buf, storage_src->size);
} /* end if */
else
/* Type conversion not necessary */
- HDmemcpy(storage_dst->buf, storage_src->buf, storage_src->size);
+ H5MM_memcpy(storage_dst->buf, storage_src->buf, storage_src->size);
/* Mark destination buffer as dirty */
storage_dst->dirty = TRUE;
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index ad12ba0..8733633 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -40,6 +40,7 @@
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5FOprivate.h" /* File objects */
#include "H5Oprivate.h" /* Object headers */
#include "H5Pprivate.h" /* Property lists */
@@ -118,6 +119,7 @@ const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {{
H5D__contig_construct,
H5D__contig_init,
H5D__contig_is_space_alloc,
+ H5D__contig_is_data_cached,
H5D__contig_io_init,
H5D__contig_read,
H5D__contig_write,
@@ -538,6 +540,30 @@ H5D__contig_is_space_alloc(const H5O_storage_t *storage)
/*-------------------------------------------------------------------------
+ * Function: H5D__contig_is_data_cached
+ *
+ * Purpose: Query if raw data is cached for dataset
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * Wednessday, March 6, 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5D__contig_is_data_cached(const H5D_shared_t *shared_dset)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(shared_dset);
+
+ FUNC_LEAVE_NOAPI(shared_dset->cache.contig.sieve_size > 0)
+} /* end H5D__contig_is_data_cached() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__contig_io_init
*
* Purpose: Performs initialization before any sort of I/O on the raw data
@@ -751,15 +777,10 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
/* Grab the data out of the buffer (must be first piece of data in buffer ) */
- HDmemcpy(buf, dset_contig->sieve_buf, len);
+ H5MM_memcpy(buf, dset_contig->sieve_buf, len);
/* Reset sieve buffer dirty flag */
dset_contig->sieve_dirty = FALSE;
-
- /* Stash local copies of these value */
- sieve_start = dset_contig->sieve_loc;
- sieve_size = dset_contig->sieve_size;
- sieve_end = sieve_start+sieve_size;
} /* end else */
} /* end if */
else {
@@ -771,7 +792,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
unsigned char *base_sieve_buf = dset_contig->sieve_buf + (addr - sieve_start);
/* Grab the data out of the buffer */
- HDmemcpy(buf, base_sieve_buf, len);
+ H5MM_memcpy(buf, base_sieve_buf, len);
} /* end if */
/* Entire request is not within this data sieve buffer */
else {
@@ -825,17 +846,12 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
min = MIN3(rel_eoa - dset_contig->sieve_loc, max_data, dset_contig->sieve_buf_size);
H5_CHECKED_ASSIGN(dset_contig->sieve_size, size_t, min, hsize_t);
- /* Update local copies of sieve information */
- sieve_start = dset_contig->sieve_loc;
- sieve_size = dset_contig->sieve_size;
- sieve_end = sieve_start + sieve_size;
-
/* Read the new sieve buffer */
if(H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
/* Grab the data out of the buffer (must be first piece of data in buffer ) */
- HDmemcpy(buf, dset_contig->sieve_buf, len);
+ H5MM_memcpy(buf, dset_contig->sieve_buf, len);
/* Reset sieve buffer dirty flag */
dset_contig->sieve_dirty = FALSE;
@@ -1033,7 +1049,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
} /* end if */
/* Grab the data out of the buffer (must be first piece of data in buffer ) */
- HDmemcpy(dset_contig->sieve_buf, buf, len);
+ H5MM_memcpy(dset_contig->sieve_buf, buf, len);
/* Set sieve buffer dirty flag */
dset_contig->sieve_dirty = TRUE;
@@ -1053,7 +1069,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
unsigned char *base_sieve_buf = dset_contig->sieve_buf + (addr - sieve_start);
/* Put the data into the sieve buffer */
- HDmemcpy(base_sieve_buf, buf, len);
+ H5MM_memcpy(base_sieve_buf, buf, len);
/* Set sieve buffer dirty flag */
dset_contig->sieve_dirty = TRUE;
@@ -1096,7 +1112,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
HDmemmove(dset_contig->sieve_buf + len, dset_contig->sieve_buf, dset_contig->sieve_size);
/* Copy in new information (must be first in sieve buffer) */
- HDmemcpy(dset_contig->sieve_buf, buf, len);
+ H5MM_memcpy(dset_contig->sieve_buf, buf, len);
/* Adjust sieve location */
dset_contig->sieve_loc = addr;
@@ -1105,16 +1121,11 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
/* Append to existing sieve buffer */
else {
/* Copy in new information */
- HDmemcpy(dset_contig->sieve_buf + sieve_size, buf, len);
+ H5MM_memcpy(dset_contig->sieve_buf + sieve_size, buf, len);
} /* end else */
/* Adjust sieve size */
dset_contig->sieve_size += len;
-
- /* Update local copies of sieve information */
- sieve_start = dset_contig->sieve_loc;
- sieve_size = dset_contig->sieve_size;
- sieve_end = sieve_start + sieve_size;
} /* end if */
/* Can't add the new data onto the existing sieve buffer */
else {
@@ -1146,11 +1157,6 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
min = MIN3(rel_eoa - dset_contig->sieve_loc, max_data, dset_contig->sieve_buf_size);
H5_CHECKED_ASSIGN(dset_contig->sieve_size, size_t, min, hsize_t);
- /* Update local copies of sieve information */
- sieve_start = dset_contig->sieve_loc;
- sieve_size = dset_contig->sieve_size;
- sieve_end = sieve_start + sieve_size;
-
/* Check if there is any point in reading the data from the file */
if(dset_contig->sieve_size > len) {
/* Read the new sieve buffer */
@@ -1159,7 +1165,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
} /* end if */
/* Grab the data out of the buffer (must be first piece of data in buffer ) */
- HDmemcpy(dset_contig->sieve_buf, buf, len);
+ H5MM_memcpy(dset_contig->sieve_buf, buf, len);
/* Set sieve buffer dirty flag */
dset_contig->sieve_dirty = TRUE;
@@ -1514,7 +1520,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
if(try_sieve && (addr_src >= sieve_start) && ((addr_src + src_nbytes -1) < sieve_end)) {
unsigned char *base_sieve_buf = shared_fo->cache.contig.sieve_buf + (addr_src - sieve_start);
- HDmemcpy(buf, base_sieve_buf, src_nbytes);
+ H5MM_memcpy(buf, base_sieve_buf, src_nbytes);
} else
/* Read raw data from source file */
if(H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, src_nbytes, buf) < 0)
@@ -1527,7 +1533,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
/* Copy into another buffer, to reclaim memory later */
- HDmemcpy(reclaim_buf, buf, mem_nbytes);
+ H5MM_memcpy(reclaim_buf, buf, mem_nbytes);
/* Set background buffer to all zeros */
HDmemset(bkg, 0, buf_size);
@@ -1553,7 +1559,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
/* After fix ref, copy the new reference elements to the buffer to write out */
- HDmemcpy(buf, bkg, buf_size);
+ H5MM_memcpy(buf, bkg, buf_size);
} /* end if */
else
/* Reset value to zero */
diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c
index 76827b4..85371ae 100644
--- a/src/H5Ddeprec.c
+++ b/src/H5Ddeprec.c
@@ -136,6 +136,9 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID")
+ /* Set the DCPL for the API context */
+ H5CX_set_dcpl(dcpl_id);
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
diff --git a/src/H5Dearray.c b/src/H5Dearray.c
index a8fffbc..b23ac46 100644
--- a/src/H5Dearray.c
+++ b/src/H5Dearray.c
@@ -37,6 +37,7 @@
#include "H5EAprivate.h" /* Extensible arrays */
#include "H5FLprivate.h" /* Free Lists */
#include "H5MFprivate.h" /* File space management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vector functions */
@@ -1197,11 +1198,11 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
hsize_t swizzled_max_chunks[H5O_LAYOUT_NDIMS]; /* Swizzled form of max # of chunks in each dimension */
/* Get the swizzled chunk dimensions */
- HDmemcpy(layout->u.earray.swizzled_dim, layout->dim, (layout->ndims - 1) * sizeof(layout->dim[0]));
+ H5MM_memcpy(layout->u.earray.swizzled_dim, layout->dim, (layout->ndims - 1) * sizeof(layout->dim[0]));
H5VM_swizzle_coords(uint32_t, layout->u.earray.swizzled_dim, layout->u.earray.unlim_dim);
/* Get the swizzled number of chunks in each dimension */
- HDmemcpy(swizzled_chunks, layout->chunks, (layout->ndims - 1) * sizeof(swizzled_chunks[0]));
+ H5MM_memcpy(swizzled_chunks, layout->chunks, (layout->ndims - 1) * sizeof(swizzled_chunks[0]));
H5VM_swizzle_coords(hsize_t, swizzled_chunks, layout->u.earray.unlim_dim);
/* Get the swizzled "down" sizes for each dimension */
@@ -1209,7 +1210,7 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value")
/* Get the swizzled max number of chunks in each dimension */
- HDmemcpy(swizzled_max_chunks, layout->max_chunks, (layout->ndims - 1) * sizeof(swizzled_max_chunks[0]));
+ H5MM_memcpy(swizzled_max_chunks, layout->max_chunks, (layout->ndims - 1) * sizeof(swizzled_max_chunks[0]));
H5VM_swizzle_coords(hsize_t, swizzled_max_chunks, layout->u.earray.unlim_dim);
/* Get the swizzled max "down" sizes for each dimension */
diff --git a/src/H5Defl.c b/src/H5Defl.c
index b2f9b29..91caa61 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -91,6 +91,7 @@ const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{
H5D__efl_construct,
NULL,
H5D__efl_is_space_alloc,
+ NULL,
H5D__efl_io_init,
H5D__contig_read,
H5D__contig_write,
@@ -226,7 +227,7 @@ H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNU
{
FUNC_ENTER_STATIC_NOERR
- HDmemcpy(&io_info->store->efl, &(io_info->dset->shared->dcpl_cache.efl), sizeof(H5O_efl_t));
+ H5MM_memcpy(&io_info->store->efl, &(io_info->dset->shared->dcpl_cache.efl), sizeof(H5O_efl_t));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__efl_io_init() */
@@ -476,7 +477,6 @@ H5D__efl_readvv(const H5D_io_info_t *io_info,
HDassert(io_info->u.rbuf);
HDassert(io_info->dset);
HDassert(io_info->dset->shared);
- HDassert(io_info->dset->shared->extfile_prefix);
HDassert(dset_curr_seq);
HDassert(dset_len_arr);
HDassert(dset_off_arr);
@@ -560,7 +560,6 @@ H5D__efl_writevv(const H5D_io_info_t *io_info,
HDassert(io_info->u.wbuf);
HDassert(io_info->dset);
HDassert(io_info->dset->shared);
- HDassert(io_info->dset->shared->extfile_prefix);
HDassert(dset_curr_seq);
HDassert(dset_len_arr);
HDassert(dset_off_arr);
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index 619f699..69f4ff8 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -38,6 +38,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vector and array functions */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -300,7 +301,7 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Copy the user's data into the buffer for conversion */
- HDmemcpy(elem_ptr, fill, src_type_size);
+ H5MM_memcpy(elem_ptr, fill, src_type_size);
/* If there's no VL type of data, do conversion first then fill the data into
* the memory buffer. */
@@ -577,7 +578,7 @@ H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts)
HDassert(fb_info->fill_buf);
/* Make a copy of the (disk-based) fill value into the buffer */
- HDmemcpy(fb_info->fill_buf, fb_info->fill->buf, fb_info->file_elmt_size);
+ H5MM_memcpy(fb_info->fill_buf, fb_info->fill->buf, fb_info->file_elmt_size);
/* Reset first element of background buffer, if necessary */
if(H5T_path_bkg(fb_info->fill_to_mem_tpath))
@@ -603,7 +604,7 @@ H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts)
if(!buf)
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary fill buffer")
- HDmemcpy(buf, fb_info->fill_buf, fb_info->fill_buf_size);
+ H5MM_memcpy(buf, fb_info->fill_buf, fb_info->fill_buf_size);
/* Type convert the dataset buffer, to copy any VL components */
if(H5T_convert(fb_info->mem_to_dset_tpath, fb_info->mem_tid, fb_info->file_tid, nelmts, (size_t)0, (size_t)0, fb_info->fill_buf, fb_info->bkg_buf) < 0)
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 384c66b..220f026 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -54,7 +54,7 @@ static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, cons
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, H5F_prefix_open_t 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[]);
@@ -112,6 +112,10 @@ static const H5I_class_t H5I_DATASET_CLS[1] = {{
/* Flag indicating "top" of interface has been initialized */
static hbool_t H5D_top_package_initialize_s = FALSE;
+/* Prefixes of VDS and external file from the environment variables
+ * HDF5_EXTFILE_PREFIX and HDF5_VDS_PREFIX */
+const static char *H5D_prefix_ext_env = NULL;
+const static char *H5D_prefix_vds_env = NULL;
/*-------------------------------------------------------------------------
@@ -188,6 +192,10 @@ H5D__init_package(void)
/* Mark "top" of interface as initialized, too */
H5D_top_package_initialize_s = TRUE;
+ /* Retrieve the prefixes of VDS and external file from the environment variable */
+ H5D_prefix_vds_env = HDgetenv("HDF5_VDS_PREFIX");
+ H5D_prefix_ext_env = HDgetenv("HDF5_EXTFILE_PREFIX");
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__init_package() */
@@ -470,7 +478,7 @@ H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the default dataset information */
- HDmemcpy(new_dset, &H5D_def_dset, sizeof(H5D_shared_t));
+ H5MM_memcpy(new_dset, &H5D_def_dset, sizeof(H5D_shared_t));
/* If we are using the default dataset creation property list, during creation
* don't bother to copy it, just increment the reference count
@@ -488,9 +496,6 @@ H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type)
new_dset->dcpl_id = H5P_copy_plist(plist, FALSE);
} /* end else */
- /* Set the DCPL for the API context */
- H5CX_set_dcpl(new_dset->dcpl_id);
-
/* Set return value */
ret_value = new_dset;
@@ -774,7 +779,7 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr)
/* Shallow copy the fill value property */
/* guards against shared component modification */
- HDmemcpy(&old_fill_prop, fill_prop, sizeof(old_fill_prop));
+ H5MM_memcpy(&old_fill_prop, fill_prop, sizeof(old_fill_prop));
if (H5O_msg_reset_share(H5O_FILL_ID, &old_fill_prop) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't reset the copied fill property")
@@ -1000,7 +1005,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
/* Shallow copy the fill value property */
/* (we only want to make certain that the shared component isn't modified) */
- HDmemcpy(&old_fill_prop, fill_prop, sizeof(old_fill_prop));
+ H5MM_memcpy(&old_fill_prop, fill_prop, sizeof(old_fill_prop));
/* Reset shared component info */
H5O_msg_reset_share(H5O_FILL_ID, &old_fill_prop);
@@ -1083,8 +1088,7 @@ done:
*--------------------------------------------------------------------------
*/
static herr_t
-H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type,
- char **file_prefix /*out*/)
+H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char **file_prefix /*out*/)
{
char *prefix = NULL; /* prefix used to look for the file */
char *filepath = NULL; /* absolute path of directory the HDF5 file is in */
@@ -1105,20 +1109,22 @@ H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type
/* XXX: Future thread-safety note - getenv is not required
* to be reentrant.
*/
- 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)
- prefix = HDgetenv("HDF5_EXTFILE_PREFIX");
- else
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "prefix name is not sensible")
-
- if(prefix == NULL || *prefix == '\0') {
- /* Set prefix to value of prefix_type property */
- if(NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
- if(H5P_peek(plist, prefix_type, &prefix) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file prefix")
- } /* end if */
+ if(H5F_PREFIX_VDS == prefix_type) {
+ prefix = (char *)H5D_prefix_vds_env;
+
+ if(prefix == NULL || *prefix == '\0') {
+ if(H5CX_get_vds_prefix(&prefix) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for vds file")
+ }
+ } else if(H5F_PREFIX_EFILE == prefix_type) {
+ prefix = (char *)H5D_prefix_ext_env;
+
+ if(prefix == NULL || *prefix == '\0') {
+ if(H5CX_get_ext_file_prefix(&prefix) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for the external file")
+ }
+ } else
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "prefix name is not sensible")
/* Prefix has to be checked for NULL / empty string again because the
* code above might have updated it.
@@ -1127,8 +1133,7 @@ H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type
/* filename is interpreted as relative to the current directory,
* does not need to be expanded
*/
- if(NULL == (*file_prefix = (char *)H5MM_strdup("")))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ *file_prefix = NULL;
} /* end if */
else {
if(HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) {
@@ -1326,11 +1331,11 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property")
/* Set the external file prefix */
- if(H5D__build_file_prefix(new_dset, dapl_id, H5D_ACS_EFILE_PREFIX_NAME, &new_dset->shared->extfile_prefix) < 0)
+ if(H5D__build_file_prefix(new_dset, H5F_PREFIX_EFILE, &new_dset->shared->extfile_prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix")
/* Set the VDS file prefix */
- if(H5D__build_file_prefix(new_dset, dapl_id, H5D_ACS_VDS_PREFIX_NAME, &new_dset->shared->vds_prefix) < 0)
+ if(H5D__build_file_prefix(new_dset, H5F_PREFIX_VDS, &new_dset->shared->vds_prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize VDS prefix")
/* Add the dataset to the list of opened objects in the file */
@@ -1485,11 +1490,11 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path")
/* Get the external file prefix */
- if(H5D__build_file_prefix(dataset, dapl_id, H5D_ACS_EFILE_PREFIX_NAME, &extfile_prefix) < 0)
+ if(H5D__build_file_prefix(dataset, H5F_PREFIX_EFILE, &extfile_prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix")
/* Get the VDS prefix */
- if(H5D__build_file_prefix(dataset, dapl_id, H5D_ACS_VDS_PREFIX_NAME, &vds_prefix) < 0)
+ if(H5D__build_file_prefix(dataset, H5F_PREFIX_VDS, &vds_prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize VDS prefix")
/* Check if dataset was already open */
@@ -1533,8 +1538,13 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id)
/* Check whether the external file prefix of the already open dataset
* matches the new external file prefix
*/
- if(HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset")
+ if(extfile_prefix && dataset->shared->extfile_prefix) {
+ if(HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset")
+ } else {
+ if(extfile_prefix || dataset->shared->extfile_prefix)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset")
+ }
/* Check if the object has been opened through the top file yet */
if(H5FO_top_count(dataset->oloc.file, dataset->oloc.addr) == 0) {
@@ -1642,7 +1652,7 @@ H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id)
dset->shared->append_flush.ndims = info.ndims;
dset->shared->append_flush.func = info.func;
dset->shared->append_flush.udata = info.udata;
- HDmemcpy(dset->shared->append_flush.boundary, info.boundary, sizeof(info.boundary));
+ H5MM_memcpy(dset->shared->append_flush.boundary, info.boundary, sizeof(info.boundary));
} /* end if */
} /* end if */
} /* end if */
@@ -2778,7 +2788,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
/* Keep the current dataspace dimensions for later */
HDcompile_assert(sizeof(curr_dims) == sizeof(dset->shared->curr_dims));
- HDmemcpy(curr_dims, dset->shared->curr_dims, H5S_MAX_RANK * sizeof(curr_dims[0]));
+ H5MM_memcpy(curr_dims, dset->shared->curr_dims, H5S_MAX_RANK * sizeof(curr_dims[0]));
/* Modify the size of the dataspace */
if((changed = H5S_set_extent(dset->shared->space, size)) < 0)
@@ -2872,7 +2882,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
dset->shared->layout.storage.u.virt.list[u].virtual_space_status = H5O_VIRTUAL_STATUS_CORRECT;
/* Patch sub-source datasets */
- for(v = 0; v < dset->shared->layout.storage.u.virt.list[u].sub_dset_nalloc; v++)
+ for(v = 0; v < dset->shared->layout.storage.u.virt.list[u].sub_dset_nused; v++)
if(H5S_set_extent(dset->shared->layout.storage.u.virt.list[u].sub_dset[v].virtual_select, size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace")
} /* end for */
@@ -2898,7 +2908,8 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
*-------------------------------------------------------------------------
*/
if(H5D_CHUNKED == dset->shared->layout.type) {
- if(shrink && (*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage))
+ if(shrink && ((*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)
+ || (dset->shared->layout.ops->is_data_cached && (*dset->shared->layout.ops->is_data_cached)(dset->shared))))
/* Remove excess chunks */
if(H5D__chunk_prune_by_extent(dset, curr_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to remove chunks")
@@ -3062,7 +3073,7 @@ H5D__format_convert(H5D_t *dataset)
idx_info.storage = &dataset->shared->layout.storage.u.chunk;
/* Copy the current layout info to the new layout */
- HDmemcpy(newlayout, &dataset->shared->layout, sizeof(H5O_layout_t));
+ H5MM_memcpy(newlayout, &dataset->shared->layout, sizeof(H5O_layout_t));
/* Set up info for version 1 B-tree in the new layout */
newlayout->version = H5O_LAYOUT_VERSION_3;
@@ -3113,7 +3124,7 @@ H5D__format_convert(H5D_t *dataset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info")
/* Copy the new layout to the dataset's layout */
- HDmemcpy(&dataset->shared->layout, newlayout, sizeof(H5O_layout_t));
+ H5MM_memcpy(&dataset->shared->layout, newlayout, sizeof(H5O_layout_t));
break;
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 2f87e38..9343b80 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -518,7 +518,8 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
* has been overwritten. So just proceed in reading.
*/
if(nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 &&
- !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)) {
+ !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) &&
+ !(dataset->shared->layout.ops->is_data_cached && (*dataset->shared->layout.ops->is_data_cached)(dataset->shared))) {
H5D_fill_value_t fill_status; /* Whether/How the fill value is defined */
/* Retrieve dataset's fill-value properties */
@@ -550,6 +551,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Sanity check that space is allocated, if there are elements */
if(nelmts > 0)
HDassert((*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)
+ || (dataset->shared->layout.ops->is_data_cached && (*dataset->shared->layout.ops->is_data_cached)(dataset->shared))
|| dataset->shared->dcpl_cache.efl.nused > 0
|| dataset->shared->layout.type == H5D_COMPACT);
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index 494d2c8..fb28489 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -50,6 +50,7 @@
const unsigned H5O_layout_ver_bounds[] = {
H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_LAYOUT_VERSION_3, /* H5F_LIBVER_V18 */ /* H5O_LAYOUT_VERSION_DEFAULT */
+ H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V110 */
H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index 2a6c05f..7019362 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -1427,7 +1427,7 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in
for (i = 0, offset = 0; i < (size_t) mpi_rank; i++)
offset += num_chunks_selected_array[i];
- HDmemcpy(chunk_list, &collective_chunk_list[offset], num_chunks_selected_array[mpi_rank] * sizeof(H5D_filtered_collective_io_info_t));
+ H5MM_memcpy(chunk_list, &collective_chunk_list[offset], num_chunks_selected_array[mpi_rank] * sizeof(H5D_filtered_collective_io_info_t));
/* Create single MPI type encompassing each selection in the dataspace */
if (H5D__mpio_filtered_collective_write_type(chunk_list, chunk_list_num_entries,
@@ -1553,7 +1553,7 @@ if(H5DEBUG(D))
HGOTO_ERROR(H5E_DATASET, H5E_CANTRECV, FAIL, "unable to obtain MPIO mode")
/* Set up contiguous I/O info object */
- HDmemcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
+ H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
ctg_io_info.store = &ctg_store;
ctg_io_info.layout_ops = *H5D_LOPS_CONTIG;
@@ -1561,7 +1561,7 @@ if(H5DEBUG(D))
ctg_store.contig.dset_size = (hsize_t)io_info->dset->shared->layout.u.chunk.size;
/* Set up compact I/O info object */
- HDmemcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
+ H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
cpt_io_info.store = &cpt_store;
cpt_io_info.layout_ops = *H5D_LOPS_COMPACT;
@@ -1788,7 +1788,7 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't construct filtered I/O info list")
/* Set up contiguous I/O info object */
- HDmemcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
+ H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
ctg_io_info.store = &ctg_store;
ctg_io_info.layout_ops = *H5D_LOPS_CONTIG;
@@ -1893,7 +1893,7 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i
/* Collect the new chunk info back to the local copy, since only the record in the
* collective array gets updated by the chunk re-allocation */
- HDmemcpy(&chunk_list[i].chunk_states.new_chunk, &collective_chunk_list[offset].chunk_states.new_chunk, sizeof(chunk_list[i].chunk_states.new_chunk));
+ H5MM_memcpy(&chunk_list[i].chunk_states.new_chunk, &collective_chunk_list[offset].chunk_states.new_chunk, sizeof(chunk_list[i].chunk_states.new_chunk));
H5_CHECKED_ASSIGN(mpi_type_count, int, chunk_list[i].chunk_states.new_chunk.length, hsize_t);
@@ -2517,8 +2517,8 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
/* merge buffer io_mode info and chunk addr into one */
- HDmemcpy(mergebuf, assign_io_mode, total_chunks);
- HDmemcpy(tempbuf, chunk_addr, sizeof(haddr_t) * total_chunks);
+ H5MM_memcpy(mergebuf, assign_io_mode, total_chunks);
+ H5MM_memcpy(tempbuf, chunk_addr, sizeof(haddr_t) * total_chunks);
H5MM_free(nproc_per_chunk);
} /* end if */
@@ -2527,8 +2527,8 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
if(MPI_SUCCESS != (mpi_code = MPI_Bcast(mergebuf, ((sizeof(haddr_t) + 1) * total_chunks), MPI_BYTE, root, comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_BCast failed", mpi_code)
- HDmemcpy(assign_io_mode, mergebuf, total_chunks);
- HDmemcpy(chunk_addr, tempbuf, sizeof(haddr_t) * total_chunks);
+ H5MM_memcpy(assign_io_mode, mergebuf, total_chunks);
+ H5MM_memcpy(chunk_addr, tempbuf, sizeof(haddr_t) * total_chunks);
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
{
@@ -2630,7 +2630,7 @@ H5D__construct_filtered_io_info_list(const H5D_io_info_t *io_info, const H5D_typ
local_info_array[i].async_info.receive_buffer_array = NULL;
local_info_array[i].async_info.receive_requests_array = NULL;
- HDmemcpy(local_info_array[i].scaled, chunk_info->scaled, sizeof(chunk_info->scaled));
+ H5MM_memcpy(local_info_array[i].scaled, chunk_info->scaled, sizeof(chunk_info->scaled));
if ((select_npoints = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
@@ -2742,6 +2742,9 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
if ((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size")
+ /* Set to latest format for encoding dataspace */
+ H5CX_set_libver_bounds(NULL);
+
if (*local_chunk_array_num_entries)
if (NULL == (send_requests = (MPI_Request *) H5MM_malloc(*local_chunk_array_num_entries * sizeof(MPI_Request))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate send requests buffer")
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 2767aa1..e7c623b 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -113,12 +113,14 @@ typedef struct H5D_type_info_t {
/* Forward declaration of structs used below */
struct H5D_io_info_t;
struct H5D_chunk_map_t;
+typedef struct H5D_shared_t H5D_shared_t;
/* Function pointers for I/O on particular types of dataset layouts */
typedef herr_t (*H5D_layout_construct_func_t)(H5F_t *f, H5D_t *dset);
typedef herr_t (*H5D_layout_init_func_t)(H5F_t *f, const H5D_t *dset,
hid_t dapl_id);
typedef hbool_t (*H5D_layout_is_space_alloc_func_t)(const H5O_storage_t *storage);
+typedef hbool_t (*H5D_layout_is_data_cached_func_t)(const H5D_shared_t *shared_dset);
typedef herr_t (*H5D_layout_io_init_func_t)(const struct H5D_io_info_t *io_info,
const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
@@ -144,6 +146,7 @@ typedef struct H5D_layout_ops_t {
H5D_layout_construct_func_t construct; /* Layout constructor for new datasets */
H5D_layout_init_func_t init; /* Layout initializer for dataset */
H5D_layout_is_space_alloc_func_t is_space_alloc; /* Query routine to determine if storage is allocated */
+ H5D_layout_is_data_cached_func_t is_data_cached; /* Query routine to determine if any raw data is cached. If routine is not present then the layout type never caches raw data. */
H5D_layout_io_init_func_t io_init; /* I/O initialization routine */
H5D_layout_read_func_t ser_read; /* High-level I/O routine for reading data in serial */
H5D_layout_write_func_t ser_write; /* High-level I/O routine for writing data in serial */
@@ -429,7 +432,7 @@ typedef struct H5D_rdcdc_t {
* created once for a given dataset. Thus, if a dataset is opened twice,
* there will be two IDs and two H5D_t structs, both sharing one H5D_shared_t.
*/
-typedef struct H5D_shared_t {
+struct H5D_shared_t {
size_t fo_count; /* Reference count */
hbool_t closing; /* Flag to indicate dataset is closing */
hid_t type_id; /* ID for dataset's datatype */
@@ -459,7 +462,7 @@ typedef struct H5D_shared_t {
H5D_append_flush_t append_flush; /* Append flush property information */
char *extfile_prefix; /* expanded external file prefix */
char *vds_prefix; /* expanded vds prefix */
-} H5D_shared_t;
+};
struct H5D_t {
H5O_loc_t oloc; /* Object header location */
@@ -618,6 +621,7 @@ H5_DLL herr_t H5D__layout_oh_write(const H5D_t *dataset, H5O_t *oh, unsigned upd
/* Functions that operate on contiguous storage */
H5_DLL herr_t H5D__contig_alloc(H5F_t *f, H5O_storage_contig_t *storage);
H5_DLL hbool_t H5D__contig_is_space_alloc(const H5O_storage_t *storage);
+H5_DLL hbool_t H5D__contig_is_data_cached(const H5D_shared_t *shared_dset);
H5_DLL herr_t H5D__contig_fill(const H5D_io_info_t *io_info);
H5_DLL herr_t H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
@@ -636,6 +640,7 @@ H5_DLL htri_t H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr,
H5_DLL herr_t H5D__chunk_create(const H5D_t *dset /*in,out*/);
H5_DLL herr_t H5D__chunk_set_info(const H5D_t *dset);
H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage);
+H5_DLL hbool_t H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset);
H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled,
H5D_chunk_ud_t *udata);
H5_DLL herr_t H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes);
diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c
index 266f5f5..0e0edf7 100644
--- a/src/H5Dscatgath.c
+++ b/src/H5Dscatgath.c
@@ -27,6 +27,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -117,7 +118,7 @@ H5D__scatter_file(const H5D_io_info_t *_io_info,
HDassert(_buf);
/* Set up temporary I/O info object */
- HDmemcpy(&tmp_io_info, _io_info, sizeof(*_io_info));
+ H5MM_memcpy(&tmp_io_info, _io_info, sizeof(*_io_info));
tmp_io_info.op_type = H5D_IO_OP_WRITE;
tmp_io_info.u.wbuf = _buf;
@@ -220,7 +221,7 @@ H5D__gather_file(const H5D_io_info_t *_io_info,
HDassert(_buf);
/* Set up temporary I/O info object */
- HDmemcpy(&tmp_io_info, _io_info, sizeof(*_io_info));
+ H5MM_memcpy(&tmp_io_info, _io_info, sizeof(*_io_info));
tmp_io_info.op_type = H5D_IO_OP_READ;
tmp_io_info.u.rbuf = _buf;
@@ -337,7 +338,7 @@ H5D__scatter_mem (const void *_tscat_buf, const H5S_t *space,
/* Get the number of bytes in sequence */
curr_len = len[curr_seq];
- HDmemcpy(buf + off[curr_seq], tscat_buf, curr_len);
+ H5MM_memcpy(buf + off[curr_seq], tscat_buf, curr_len);
/* Advance offset in destination buffer */
tscat_buf += curr_len;
@@ -425,7 +426,7 @@ H5D__gather_mem(const void *_buf, const H5S_t *space,
/* Get the number of bytes in sequence */
curr_len = len[curr_seq];
- HDmemcpy(tgath_buf, buf + off[curr_seq], curr_len);
+ H5MM_memcpy(tgath_buf, buf + off[curr_seq], curr_len);
/* Advance offset in gather buffer */
tgath_buf += curr_len;
diff --git a/src/H5Dselect.c b/src/H5Dselect.c
index 0ec3423..4ffce62 100644
--- a/src/H5Dselect.c
+++ b/src/H5Dselect.c
@@ -227,6 +227,8 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
/* Decrement number of elements left to process */
HDassert(((size_t)tmp_file_len % elmt_size) == 0);
+ if(elmt_size == 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "Resulted in division by zero")
nelmts -= ((size_t)tmp_file_len / elmt_size);
} /* end while */
} /* end else */
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index c0d49d8..e3e0aa5 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -78,6 +78,7 @@
/********************/
/* Layout operation callbacks */
+static hbool_t H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset);
static herr_t H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t
*type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
H5D_chunk_map_t *fm);
@@ -121,6 +122,7 @@ const H5D_layout_ops_t H5D_LOPS_VIRTUAL[1] = {{
NULL,
H5D__virtual_init,
H5D__virtual_is_space_alloc,
+ H5D__virtual_is_data_cached,
NULL,
H5D__virtual_read,
H5D__virtual_write,
@@ -428,6 +430,10 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
/* Create block if # of used entries > 0 */
if(layout->storage.u.virt.list_nused > 0) {
+
+ /* Set the low/high bounds according to 'f' for the API context */
+ H5CX_set_libver_bounds(f);
+
/* Allocate array for caching results of strlen */
if(NULL == (str_size = (size_t *)H5MM_malloc(2 * layout->storage.u.virt.list_nused * sizeof(size_t))))
HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, FAIL, "unable to allocate string length array")
@@ -491,11 +497,11 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
/* Encode each entry */
for(i = 0; i < layout->storage.u.virt.list_nused; i++) {
/* Source file name */
- HDmemcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_file_name, str_size[2 * i]);
+ H5MM_memcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_file_name, str_size[2 * i]);
heap_block_p += str_size[2 * i];
/* Source dataset name */
- HDmemcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_dset_name, str_size[(2 * i) + 1]);
+ H5MM_memcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_dset_name, str_size[(2 * i) + 1]);
heap_block_p += str_size[(2 * i) + 1];
/* Source selection */
@@ -1107,7 +1113,7 @@ H5D__virtual_str_append(const char *src, size_t src_len, char **p, char **buf,
/* Copy string to *p. Note that since src in not NULL terminated, we must
* use memcpy */
- (void)HDmemcpy(*p, src, src_len);
+ (void)H5MM_memcpy(*p, src, src_len);
/* Advance *p */
*p += src_len;
@@ -2207,6 +2213,54 @@ H5D__virtual_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage)
/*-------------------------------------------------------------------------
+ * Function: H5D__virtual_is_data_cached
+ *
+ * Purpose: Query if raw data is cached for dataset
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * Wednessday, March 6, 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset)
+{
+ const H5O_storage_virtual_t *storage; /* Convenience pointer */
+ size_t i, j; /* Local index variables */
+ hbool_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(shared_dset);
+ storage = &shared_dset->layout.storage.u.virt;
+
+ /* Iterate over mappings */
+ for(i = 0; i < storage->list_nused; i++)
+ /* Check for "printf" source dataset resolution */
+ if(storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
+ /* Iterate over sub-source dsets */
+ for(j = storage->list[i].sub_dset_io_start; j < storage->list[i].sub_dset_io_end; j++)
+ /* Check for cahced data in source dset */
+ if(storage->list[i].sub_dset[j].dset
+ && storage->list[i].sub_dset[j].dset->shared->layout.ops->is_data_cached
+ && storage->list[i].sub_dset[j].dset->shared->layout.ops->is_data_cached(storage->list[i].sub_dset[j].dset->shared))
+ HGOTO_DONE(TRUE);
+ } /* end if */
+ else
+ if(storage->list[i].source_dset.dset
+ && storage->list[i].source_dset.dset->shared->layout.ops->is_data_cached
+ && storage->list[i].source_dset.dset->shared->layout.ops->is_data_cached(storage->list[i].source_dset.dset->shared))
+ HGOTO_DONE(TRUE);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__virtual_is_data_cached() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__virtual_pre_io
*
* Purpose: Project all virtual mappings onto mem_space, with the
@@ -2981,7 +3035,7 @@ H5D__virtual_refresh_source_dset(H5D_t **dset)
/* Discard the identifier & replace the dataset */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_remove(temp_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID")
- if(NULL == (*dset = (H5D_t *)H5VL_object_data(vol_obj)))
+ if(NULL == (*dset = (H5D_t *)H5VL_object_unwrap(vol_obj)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve library object from VOL object")
vol_obj->data = NULL;
diff --git a/src/H5EA.c b/src/H5EA.c
index 9ceb144..d0bf474 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -46,6 +46,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5EApkg.h" /* Extensible Arrays */
#include "H5FLprivate.h" /* Free Lists */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vector functions */
@@ -693,7 +694,7 @@ H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt))
HDassert(thing_unprot_func);
/* Set element in thing's element buffer */
- HDmemcpy(thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size);
+ H5MM_memcpy(thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size);
thing_cache_flags |= H5AC__DIRTIED_FLAG;
/* Update max. element set in array, if appropriate */
@@ -765,7 +766,7 @@ H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt))
} /* end if */
else
/* Get element from thing's element buffer */
- HDmemcpy(elmt, thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), hdr->cparam.cls->nat_elmt_size);
+ H5MM_memcpy(elmt, thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), hdr->cparam.cls->nat_elmt_size);
} /* end else */
CATCH
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index 8138991..da67e6b 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -41,6 +41,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5EApkg.h" /* Extensible Arrays */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -479,7 +480,7 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
HDassert(hdr);
/* Magic number */
- HDmemcpy(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -867,7 +868,7 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
/* Get temporary pointer to serialized info */
/* Magic number */
- HDmemcpy(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -1179,7 +1180,7 @@ H5EA__cache_sblock_deserialize(const void *_image, size_t len,
size_t tot_page_init_size = sblock->ndblks * sblock->dblk_page_init_size; /* Compute total size of 'page init' buffer */
/* Retrieve the 'page init' bitmasks */
- HDmemcpy(sblock->page_init, image, tot_page_init_size);
+ H5MM_memcpy(sblock->page_init, image, tot_page_init_size);
image += tot_page_init_size;
} /* end if */
@@ -1276,7 +1277,7 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
HDassert(sblock->hdr);
/* Magic number */
- HDmemcpy(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -1298,7 +1299,7 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
size_t tot_page_init_size = sblock->ndblks * sblock->dblk_page_init_size; /* Compute total size of 'page init' buffer */
/* Store the 'page init' bitmasks */
- HDmemcpy(image, sblock->page_init, tot_page_init_size);
+ H5MM_memcpy(image, sblock->page_init, tot_page_init_size);
image += tot_page_init_size;
} /* end if */
@@ -1690,7 +1691,7 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
HDassert(dblock->hdr);
/* Magic number */
- HDmemcpy(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c
index 62a23b8..18d642f 100644
--- a/src/H5EAhdr.c
+++ b/src/H5EAhdr.c
@@ -41,6 +41,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5EApkg.h" /* Extensible Arrays */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
@@ -407,7 +408,7 @@ H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata))
hdr->idx_blk_addr = HADDR_UNDEF;
/* Set the creation parameters for the array */
- HDmemcpy(&hdr->cparam, cparam, sizeof(hdr->cparam));
+ H5MM_memcpy(&hdr->cparam, cparam, sizeof(hdr->cparam));
/* Finish initializing extensible array header */
if(H5EA__hdr_init(hdr, ctx_udata) < 0)
diff --git a/src/H5EAstat.c b/src/H5EAstat.c
index 72c4d14..509d3f8 100644
--- a/src/H5EAstat.c
+++ b/src/H5EAstat.c
@@ -40,6 +40,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5EApkg.h" /* Extensible Arrays */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -108,7 +109,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
HDassert(stats);
/* Copy extensible array statistics */
- HDmemcpy(stats, &ea->hdr->stats, sizeof(ea->hdr->stats));
+ H5MM_memcpy(stats, &ea->hdr->stats, sizeof(ea->hdr->stats));
END_FUNC(PRIV) /* end H5EA_get_stats() */
diff --git a/src/H5F.c b/src/H5F.c
index 9df8140..779c940 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -921,6 +921,42 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Fget_fileno
+ *
+ * Purpose: Public API to retrieve the file's 'file number' that uniquely
+ * identifies each open file.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fget_fileno(hid_t file_id, unsigned long *fileno)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*Ul", file_id, fileno);
+
+ /* If no fileno pointer was passed in, exit quietly */
+ if(fileno) {
+ H5VL_object_t *vol_obj; /* File info */
+
+ /* Get the internal file structure */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+
+ /* Get the flags */
+ if((ret_value = H5VL_file_get(vol_obj, H5VL_FILE_GET_FILENO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fileno)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's 'file number'")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fget_fileno() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Fget_freespace
*
* Purpose: Retrieves the amount of free space in the file.
diff --git a/src/H5FA.c b/src/H5FA.c
index 61aaa53..8c86193 100644
--- a/src/H5FA.c
+++ b/src/H5FA.c
@@ -41,6 +41,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FApkg.h" /* Fixed Arrays */
#include "H5FLprivate.h" /* Free Lists */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vector functions */
@@ -371,7 +372,7 @@ H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt))
/* Check for paging data block */
if(!dblock->npages) {
/* Set element in data block */
- HDmemcpy(((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), elmt, hdr->cparam.cls->nat_elmt_size);
+ H5MM_memcpy(((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), elmt, hdr->cparam.cls->nat_elmt_size);
dblock_cache_flags |= H5AC__DIRTIED_FLAG;
} /* end if */
else { /* paging */
@@ -410,7 +411,7 @@ H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt))
H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", (unsigned long long)dblk_page_addr)
/* Set the element in the data block page */
- HDmemcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size);
+ H5MM_memcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size);
dblk_page_cache_flags |= H5AC__DIRTIED_FLAG;
} /* end else */
@@ -474,7 +475,7 @@ H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt))
/* Check for paged data block */
if(!dblock->npages)
/* Retrieve element from data block */
- HDmemcpy(elmt, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), hdr->cparam.cls->nat_elmt_size);
+ H5MM_memcpy(elmt, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), hdr->cparam.cls->nat_elmt_size);
else { /* paging */
size_t page_idx; /* Index of page within data block */
@@ -512,7 +513,7 @@ H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt))
H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", (unsigned long long)dblk_page_addr)
/* Retrieve element from data block */
- HDmemcpy(elmt, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), hdr->cparam.cls->nat_elmt_size);
+ H5MM_memcpy(elmt, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), hdr->cparam.cls->nat_elmt_size);
} /* end else */
} /* end else */
} /* end else */
diff --git a/src/H5FAcache.c b/src/H5FAcache.c
index 1f199e9..f440efe 100644
--- a/src/H5FAcache.c
+++ b/src/H5FAcache.c
@@ -41,6 +41,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FApkg.h" /* Fixed Arrays */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -409,7 +410,7 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
HDassert(hdr);
/* Magic number */
- HDmemcpy(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -693,7 +694,7 @@ H5FA__cache_dblock_deserialize(const void *_image, size_t len,
/* Page initialization flags */
if(dblock->npages > 0) {
- HDmemcpy(dblock->dblk_page_init, image, dblock->dblk_page_init_size);
+ H5MM_memcpy(dblock->dblk_page_init, image, dblock->dblk_page_init_size);
image += dblock->dblk_page_init_size;
} /* end if */
@@ -797,7 +798,7 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
HDassert(dblock->hdr);
/* Magic number */
- HDmemcpy(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -812,7 +813,7 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
/* Page init flags */
if(dblock->npages > 0) {
/* Store the 'page init' bitmasks */
- HDmemcpy(image, dblock->dblk_page_init, dblock->dblk_page_init_size);
+ H5MM_memcpy(image, dblock->dblk_page_init, dblock->dblk_page_init_size);
image += dblock->dblk_page_init_size;
} /* end if */
diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c
index 2e3db0b..8f29b83 100644
--- a/src/H5FAhdr.c
+++ b/src/H5FAhdr.c
@@ -39,6 +39,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FApkg.h" /* Fixed Arrays */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -207,7 +208,7 @@ H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata))
hdr->dblk_addr = HADDR_UNDEF;
/* Set the creation parameters for the array */
- HDmemcpy(&hdr->cparam, cparam, sizeof(hdr->cparam));
+ H5MM_memcpy(&hdr->cparam, cparam, sizeof(hdr->cparam));
/* Finish initializing fixed array header */
if(H5FA__hdr_init(hdr, ctx_udata) < 0)
diff --git a/src/H5FAstat.c b/src/H5FAstat.c
index 3c06855..49a56a9 100644
--- a/src/H5FAstat.c
+++ b/src/H5FAstat.c
@@ -38,6 +38,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FApkg.h" /* Fixed Arrays */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -105,7 +106,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
HDassert(stats);
/* Copy fixed array statistics */
- HDmemcpy(stats, &fa->hdr->stats, sizeof(fa->hdr->stats));
+ H5MM_memcpy(stats, &fa->hdr->stats, sizeof(fa->hdr->stats));
END_FUNC(PRIV) /* end H5FA_get_stats() */
diff --git a/src/H5FD.c b/src/H5FD.c
index 5585f37..61969b6 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -293,7 +293,7 @@ H5FD_register(const void *_cls, size_t size, hbool_t app_ref)
/* 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, H5I_INVALID_HID, "memory allocation failed for file driver class struct")
- HDmemcpy(saved, cls, size);
+ H5MM_memcpy(saved, cls, size);
/* Create the new class ID */
if((ret_value = H5I_register(H5I_VFL, saved, app_ref)) < 0)
@@ -1367,7 +1367,7 @@ H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map)
} /* end if */
else
/* Copy class's default free space type mapping */
- HDmemcpy(type_map, file->cls->fl_map, sizeof(file->cls->fl_map));
+ H5MM_memcpy(type_map, file->cls->fl_map, sizeof(file->cls->fl_map));
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index d1a17cd..6db8af6 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -848,7 +848,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, NULL, "image_memcpy callback failed")
} /* end if */
else
- HDmemcpy(file->mem, file_image_info.buffer, size);
+ H5MM_memcpy(file->mem, file_image_info.buffer, size);
} /* end if */
/* Read in existing data from the file if there is no image */
else {
@@ -1300,7 +1300,7 @@ H5FD__core_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
nbytes = MIN(size,(size_t)(file->eof-addr));
#endif /* NDEBUG */
- HDmemcpy(buf, file->mem + addr, nbytes);
+ H5MM_memcpy(buf, file->mem + addr, nbytes);
size -= nbytes;
addr += nbytes;
buf = (char *)buf + nbytes;
@@ -1386,7 +1386,7 @@ H5FD__core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN
}
/* Write from BUF to memory */
- HDmemcpy(file->mem + addr, buf, size);
+ H5MM_memcpy(file->mem + addr, buf, size);
/* Mark memory buffer as modified */
file->dirty = TRUE;
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 10c368a..33a0ef4 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -422,7 +422,7 @@ H5FD_direct_fapl_copy(const void *_old_fa)
HDassert(new_fa);
/* Copy the general information */
- HDmemcpy(new_fa, old_fa, sizeof(H5FD_direct_fapl_t));
+ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_direct_fapl_t));
FUNC_LEAVE_NOAPI(new_fa)
} /* end H5FD_direct_fapl_copy() */
@@ -976,12 +976,12 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN
* next section of data. */
p2 = (unsigned char*)copy_buf + copy_offset;
if((copy_size + copy_offset) <= alloc_size) {
- HDmemcpy(buf, p2, copy_size);
+ H5MM_memcpy(buf, p2, copy_size);
buf = (unsigned char *)buf + copy_size;
copy_size = 0;
} /* end if */
else {
- HDmemcpy(buf, p2, alloc_size - copy_offset);
+ H5MM_memcpy(buf, p2, alloc_size - copy_offset);
buf = (unsigned char*)buf + alloc_size - copy_offset;
copy_size -= alloc_size - copy_offset;
copy_offset = 0;
@@ -1189,11 +1189,11 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U
*/
p1 = (unsigned char *)copy_buf + copy_offset;
if((copy_size + copy_offset) <= alloc_size) {
- HDmemcpy(p1, p3, copy_size);
+ H5MM_memcpy(p1, p3, copy_size);
copy_size = 0;
} /* end if */
else {
- HDmemcpy(p1, p3, alloc_size - copy_offset);
+ H5MM_memcpy(p1, p3, alloc_size - copy_offset);
p3 = (const unsigned char *)p3 + (alloc_size - copy_offset);
copy_size -= alloc_size - copy_offset;
copy_offset = 0;
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 4d40cf3..047fb25 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -411,7 +411,7 @@ H5FD_family_fapl_copy(const void *_old_fa)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the fields of the structure */
- HDmemcpy(new_fa, old_fa, sizeof(H5FD_family_fapl_t));
+ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_family_fapl_t));
/* Deep copy the property list objects in the structure */
if(old_fa->memb_fapl_id==H5P_FILE_ACCESS_DEFAULT) {
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 655d7d3..06a0e61 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -405,7 +405,7 @@ H5FD_log_fapl_copy(const void *_old_fa)
HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL")
/* Copy the general information */
- HDmemcpy(new_fa, old_fa, sizeof(H5FD_log_fapl_t));
+ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_log_fapl_t));
/* Deep copy the log file name */
if(old_fa->logfile != NULL)
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 3ab90aa..d5aa170 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -745,7 +745,7 @@ if(H5FD_mpio_Debug[(int)'t'])
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the general information */
- HDmemcpy(new_fa, old_fa, sizeof(H5FD_mpio_fapl_t));
+ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_mpio_fapl_t));
/* Duplicate communicator and Info object. */
if(H5FD_mpi_comm_info_dup(old_fa->comm, old_fa->info, &new_fa->comm, &new_fa->info) < 0)
diff --git a/src/H5FL.c b/src/H5FL.c
index 21bbf02..a662713 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -1142,7 +1142,7 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_
if((ret_value=H5FL_blk_malloc(head,new_size H5FL_TRACK_INFO_INT))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for block")
blk_size=MIN(new_size,temp->size);
- HDmemcpy(ret_value,block,blk_size);
+ H5MM_memcpy(ret_value,block,blk_size);
H5FL_blk_free(head,block);
} /* end if */
else {
@@ -1630,7 +1630,7 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void * obj, size_t new_elem)
/* Copy the appropriate amount of elements */
blk_size = head->list_arr[MIN(temp->nelem, new_elem)].size;
- HDmemcpy(ret_value, obj, blk_size);
+ H5MM_memcpy(ret_value, obj, blk_size);
/* Free the old block */
H5FL_arr_free(head, obj);
diff --git a/src/H5FS.c b/src/H5FS.c
index 8fee634..dbcb6b5 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -36,6 +36,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FSpkg.h" /* File free space */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -615,7 +616,7 @@ H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes
HDassert(u == classes[u]->type);
/* Copy the class information into the free space manager */
- HDmemcpy(&fspace->sect_cls[u], classes[u], sizeof(H5FS_section_class_t));
+ H5MM_memcpy(&fspace->sect_cls[u], classes[u], sizeof(H5FS_section_class_t));
/* Call the class initialization routine, if there is one */
if(fspace->sect_cls[u].init_cls)
diff --git a/src/H5FScache.c b/src/H5FScache.c
index ac0874e..7525a9a 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -38,6 +38,7 @@
#include "H5Fprivate.h" /* File */
#include "H5FSpkg.h" /* File free space */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -707,7 +708,7 @@ H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len,
(fspace->alloc_sect_size == (size_t)fspace->sect_size)));
/* Magic number */
- HDmemcpy(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -1265,7 +1266,7 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len,
HDassert(fspace->sect_cls);
/* Magic number */
- HDmemcpy(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
diff --git a/src/H5Faccum.c b/src/H5Faccum.c
index 0b33f8e..8d7852b 100644
--- a/src/H5Faccum.c
+++ b/src/H5Faccum.c
@@ -38,6 +38,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FDprivate.h" /* File drivers */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
@@ -198,7 +199,7 @@ H5F__accum_read(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
} /* end if */
/* Copy the data out of the buffer */
- HDmemcpy(buf, accum->buf + (addr - new_addr), size);
+ H5MM_memcpy(buf, accum->buf + (addr - new_addr), size);
/* Adjust the accumulator address & size */
accum->loc = new_addr;
@@ -250,7 +251,7 @@ H5F__accum_read(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
} /* end else */
/* Copy the dirty region to buffer */
- HDmemcpy((unsigned char *)buf + buf_off, (unsigned char *)accum->buf + accum->dirty_off + dirty_off, overlap_size);
+ H5MM_memcpy((unsigned char *)buf + buf_off, (unsigned char *)accum->buf + accum->dirty_off + dirty_off, overlap_size);
} /* end if */
} /* end else */
} /* end if */
@@ -457,7 +458,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
HDmemmove(accum->buf + size, accum->buf, accum->size);
/* Copy the new metadata at the front */
- HDmemcpy(accum->buf, buf, size);
+ H5MM_memcpy(accum->buf, buf, size);
/* Set the new size & location of the metadata accumulator */
accum->loc = addr;
@@ -479,7 +480,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator")
/* Copy the new metadata to the end */
- HDmemcpy(accum->buf + accum->size, buf, size);
+ H5MM_memcpy(accum->buf + accum->size, buf, size);
/* Adjust the dirty region and mark accumulator dirty */
if(accum->dirty)
@@ -502,7 +503,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
size_t dirty_off = (size_t)(addr - accum->loc);
/* Copy the new metadata to the proper location within the accumulator */
- HDmemcpy(accum->buf + dirty_off, buf, size);
+ H5MM_memcpy(accum->buf + dirty_off, buf, size);
/* Adjust the dirty region and mark accumulator dirty */
if(accum->dirty) {
@@ -545,7 +546,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
HDmemmove(accum->buf + size, accum->buf + old_offset, (accum->size - old_offset));
/* Copy the new metadata at the front */
- HDmemcpy(accum->buf, buf, size);
+ H5MM_memcpy(accum->buf, buf, size);
/* Set the new size & location of the metadata accumulator */
accum->loc = addr;
@@ -582,7 +583,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
dirty_off = (size_t)(addr - accum->loc);
/* Copy the new metadata to the end */
- HDmemcpy(accum->buf + dirty_off, buf, size);
+ H5MM_memcpy(accum->buf + dirty_off, buf, size);
/* Set the new size of the metadata accumulator */
accum->size += add_size;
@@ -625,7 +626,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
} /* end if */
/* Copy the new metadata to the buffer */
- HDmemcpy(accum->buf, buf, size);
+ H5MM_memcpy(accum->buf, buf, size);
/* Set the new size & location of the metadata accumulator */
accum->loc = addr;
@@ -688,7 +689,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
accum->size = size;
/* Store the piece of metadata in the accumulator */
- HDmemcpy(accum->buf, buf, size);
+ H5MM_memcpy(accum->buf, buf, size);
/* Adjust the dirty region and mark accumulator dirty */
accum->dirty_off = 0;
@@ -721,7 +722,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
accum->size = size;
/* Store the piece of metadata in the accumulator */
- HDmemcpy(accum->buf, buf, size);
+ H5MM_memcpy(accum->buf, buf, size);
/* Adjust the dirty region and mark accumulator dirty */
accum->dirty_off = 0;
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 8a7019d..5d03b3b 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -1362,19 +1362,10 @@ H5F__dest(H5F_t *f, hbool_t flush)
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)
+ if(f->shared->vol_info)
+ if(H5VL_free_connector_info(f->shared->vol_id, 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*/
@@ -3254,7 +3245,7 @@ H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Copy the information */
- HDmemcpy(info->retries[j], file->shared->retries[i], tot_size);
+ H5MM_memcpy(info->retries[j], file->shared->retries[i], tot_size);
}
/* Increment location in info->retries[] array */
@@ -3336,7 +3327,7 @@ H5F__start_swmr_write(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file superblock version - should be at least 3")
/* Check for correct file format version */
- if((f->shared->low_bound != H5F_LIBVER_V110) || (f->shared->high_bound != H5F_LIBVER_V110))
+ if((f->shared->low_bound < H5F_LIBVER_V110) || (f->shared->high_bound < H5F_LIBVER_V110))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file format version does not support SWMR - needs to be 1.10 or greater")
/* Should not be marked for SWMR writing mode already */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 5f7a1b2..0fa2214 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -28,6 +28,7 @@ typedef struct H5F_t H5F_t;
#include "H5FDpublic.h" /* File drivers */
/* Private headers needed by this file */
+#include "H5MMprivate.h" /* Memory management */
#ifdef H5_HAVE_PARALLEL
#include "H5Pprivate.h" /* Property lists */
#endif /* H5_HAVE_PARALLEL */
@@ -134,7 +135,7 @@ typedef struct H5F_t H5F_t;
\
HDcompile_assert(sizeof(double) == 8); \
HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \
- HDmemcpy(&_n, &n, sizeof(double)); \
+ H5MM_memcpy(&_n, &n, sizeof(double)); \
for(_u = 0; _u < sizeof(uint64_t); _u++, _n >>= 8) \
*_p++ = (uint8_t)(_n & 0xff); \
(p) = (uint8_t *)(p) + 8; \
@@ -240,7 +241,7 @@ typedef struct H5F_t H5F_t;
(p) += 8; \
for(_u = 0; _u < sizeof(uint64_t); _u++) \
_n = (_n << 8) | *(--p); \
- HDmemcpy(&(n), &_n, sizeof(double)); \
+ H5MM_memcpy(&(n), &_n, sizeof(double)); \
(p) += 8; \
}
@@ -701,8 +702,9 @@ typedef enum H5F_mem_page_t {
/* Type of prefix for opening prefixed files */
typedef enum H5F_prefix_open_t {
- H5F_PREFIX_VDS, /* Virtual dataset prefix */
- H5F_PREFIX_ELINK /* External link prefix */
+ H5F_PREFIX_VDS = 0, /* Virtual dataset prefix */
+ H5F_PREFIX_ELINK = 1, /* External link prefix */
+ H5F_PREFIX_EFILE = 2 /* External file prefix */
} H5F_prefix_open_t;
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 9f1ed01..52f1ee2 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -178,11 +178,12 @@ typedef enum H5F_libver_t {
H5F_LIBVER_ERROR = -1,
H5F_LIBVER_EARLIEST = 0, /* Use the earliest possible format for storing objects */
H5F_LIBVER_V18 = 1, /* Use the latest v18 format for storing objects */
- H5F_LIBVER_V110 = 2, /* Use the latest v10 format for storing objects */
+ H5F_LIBVER_V110 = 2, /* Use the latest v110 format for storing objects */
+ H5F_LIBVER_V112 = 3, /* Use the latest v112 format for storing objects */
H5F_LIBVER_NBOUNDS
} H5F_libver_t;
-#define H5F_LIBVER_LATEST H5F_LIBVER_V110
+#define H5F_LIBVER_LATEST H5F_LIBVER_V112
/* File space handling strategy */
typedef enum H5F_fspace_strategy_t {
@@ -235,6 +236,7 @@ H5_DLL herr_t H5Fclose(hid_t file_id);
H5_DLL hid_t H5Fget_create_plist(hid_t file_id);
H5_DLL hid_t H5Fget_access_plist(hid_t file_id);
H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned *intent);
+H5_DLL herr_t H5Fget_fileno(hid_t file_id, unsigned long *fileno);
H5_DLL ssize_t H5Fget_obj_count(hid_t file_id, unsigned types);
H5_DLL ssize_t H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *obj_id_list);
H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle);
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 489cc21..aa5a85d 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -76,6 +76,7 @@ H5FL_DEFINE(H5F_super_t);
static const unsigned HDF5_superblock_ver_bounds[] = {
HDF5_SUPERBLOCK_VERSION_DEF, /* H5F_LIBVER_EARLIEST */
HDF5_SUPERBLOCK_VERSION_2, /* H5F_LIBVER_V18 */
+ HDF5_SUPERBLOCK_VERSION_3, /* H5F_LIBVER_V110 */
HDF5_SUPERBLOCK_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -555,7 +556,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
/* Set the B-tree internal node values, etc */
if(H5P_set(c_plist, H5F_CRT_BTREE_RANK_NAME, udata.btree_k) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set rank for btree internal nodes")
- HDmemcpy(sblock->btree_k, udata.btree_k, sizeof(unsigned) * (size_t)H5B_NUM_BTREE_ID);
+ H5MM_memcpy(sblock->btree_k, udata.btree_k, sizeof(unsigned) * (size_t)H5B_NUM_BTREE_ID);
} /* end if */
else {
/* Get the (default) B-tree internal node values, etc */
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index 361f8a1..125d6cf 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -269,7 +269,7 @@ H5F__drvrinfo_prefix_decode(H5O_drvinfo_t *drvrinfo, char *drv_name,
/* Driver name and/or version */
if(drv_name) {
- HDmemcpy(drv_name, (const char *)image, (size_t)8);
+ H5MM_memcpy(drv_name, (const char *)image, (size_t)8);
drv_name[8] = '\0';
image += 8; /* advance past name/version */
} /* end if */
@@ -682,7 +682,7 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU
HDassert(sblock->cache_info.flush_me_last);
/* Encode the common portion of the file superblock for all versions */
- HDmemcpy(image, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN);
+ H5MM_memcpy(image, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN);
image += H5F_SIGNATURE_LEN;
*image++ = (uint8_t)sblock->super_vers;
diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c
index 721d591..71e0b2d 100644
--- a/src/H5Gbtree2.c
+++ b/src/H5Gbtree2.c
@@ -35,6 +35,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Gpkg.h" /* Groups */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -206,7 +207,7 @@ H5G_dense_btree2_name_store(void *_nrecord, const void *_udata)
/* Copy user information info native record */
nrecord->hash = udata->common.name_hash;
- HDmemcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+ H5MM_memcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_name_store() */
@@ -305,7 +306,7 @@ H5G_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UN
/* Encode the record's fields */
UINT32ENCODE(raw, nrecord->hash)
- HDmemcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+ H5MM_memcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_name_encode() */
@@ -333,7 +334,7 @@ H5G_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UN
/* Decode the record's fields */
UINT32DECODE(raw, nrecord->hash)
- HDmemcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+ H5MM_memcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_name_decode() */
@@ -393,7 +394,7 @@ H5G_dense_btree2_corder_store(void *_nrecord, const void *_udata)
/* Copy user information info native record */
nrecord->corder = udata->common.corder;
- HDmemcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+ H5MM_memcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_corder_store() */
@@ -469,7 +470,7 @@ H5G_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_
/* Encode the record's fields */
INT64ENCODE(raw, nrecord->corder)
- HDmemcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+ H5MM_memcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_corder_encode() */
@@ -497,7 +498,7 @@ H5G_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_
/* Decode the record's fields */
INT64DECODE(raw, nrecord->corder)
- HDmemcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+ H5MM_memcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_corder_decode() */
diff --git a/src/H5Gcache.c b/src/H5Gcache.c
index b447cad..0ffdc53 100644
--- a/src/H5Gcache.c
+++ b/src/H5Gcache.c
@@ -36,6 +36,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Gpkg.h" /* Groups */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -287,7 +288,7 @@ H5G__cache_node_serialize(const H5F_t *f, void *_image, size_t len,
HDassert(len == sym->node_size);
/* magic number */
- HDmemcpy(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* version number */
diff --git a/src/H5Gent.c b/src/H5Gent.c
index baee35c..19aef10 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -32,6 +32,7 @@
#include "H5FLprivate.h" /* Free Lists */
#include "H5Gpkg.h" /* Groups */
#include "H5HLprivate.h" /* Local Heaps */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -331,7 +332,7 @@ H5G__ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5_copy_depth_t depth)
HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP);
/* Copy the top level information */
- HDmemcpy(dst, src, sizeof(H5G_entry_t));
+ H5MM_memcpy(dst, src, sizeof(H5G_entry_t));
/* Deep copy the names */
if(depth == H5_COPY_DEEP) {
diff --git a/src/H5Gname.c b/src/H5Gname.c
index 2aece2b..fa0a925 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -522,7 +522,7 @@ H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth)
HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP);
/* Copy the top level information */
- HDmemcpy(dst, src, sizeof(H5G_name_t));
+ H5MM_memcpy(dst, src, sizeof(H5G_name_t));
/* Deep copy the names */
if(depth == H5_COPY_DEEP) {
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 72b3633..b79b7d2 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -672,7 +672,7 @@ H5G__node_insert(H5F_t *f, haddr_t addr, void H5_ATTR_UNUSED *_lt_key,
if(NULL == (snrt = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, *new_node_p, f, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to split symbol table node")
- HDmemcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f),
+ H5MM_memcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f),
H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t));
snrt->nsyms = H5F_SYM_LEAF_K(f);
snrt_flags |= H5AC__DIRTIED_FLAG;
@@ -1262,7 +1262,7 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr,
char *link_name; /* Pointer to value of soft link */
/* Make a temporary copy, so that it will not change the info in the cache */
- HDmemcpy(&tmp_src_ent, src_ent, sizeof(H5G_entry_t));
+ H5MM_memcpy(&tmp_src_ent, src_ent, sizeof(H5G_entry_t));
/* Set up group location for soft link to start in */
H5G_name_reset(&grp_path);
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index d029bea..492b5b9 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -555,7 +555,7 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
* Copy the component name into a null-terminated buffer so
* we can pass it down to the other symbol table functions.
*/
- HDmemcpy(comp, name, nchars);
+ H5MM_memcpy(comp, name, nchars);
comp[nchars] = '\0';
/*
@@ -670,7 +670,7 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* Only keep the creation order information from the parent
* group's link info
*/
- HDmemcpy(&tmp_linfo, &def_linfo, sizeof(H5O_linfo_t));
+ H5MM_memcpy(&tmp_linfo, &def_linfo, sizeof(H5O_linfo_t));
tmp_linfo.track_corder = par_linfo.track_corder;
tmp_linfo.index_corder = par_linfo.index_corder;
linfo = &tmp_linfo;
diff --git a/src/H5HF.c b/src/H5HF.c
index 3df7e7b..5d52ca4 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -42,6 +42,8 @@
#include "H5FOprivate.h" /* File objects */
#include "H5HFpkg.h" /* Fractal heaps */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+
/****************/
/* Local Macros */
@@ -104,7 +106,7 @@ H5HF_op_read(const void *obj, size_t obj_len, void *op_data)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Perform "read", using memcpy() */
- HDmemcpy(op_data, obj, obj_len);
+ H5MM_memcpy(op_data, obj, obj_len);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_op_read() */
@@ -129,7 +131,7 @@ H5HF_op_write(const void *obj, size_t obj_len, void *op_data)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Perform "write", using memcpy() */
- HDmemcpy((void *)obj, op_data, obj_len); /* Casting away const OK -QAK */
+ H5MM_memcpy((void *)obj, op_data, obj_len); /* Casting away const OK -QAK */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_op_write() */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 0c5d3aa..2d1c1f2 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -772,7 +772,7 @@ H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len,
hdr->f = f;
/* Magic number */
- HDmemcpy(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -1362,7 +1362,7 @@ H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t len,
hdr->f = f;
/* Magic number */
- HDmemcpy(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -1677,7 +1677,7 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata)
/* Set up parameters for filter pipeline */
nbytes = len;
filter_mask = udata->filter_mask;
- HDmemcpy(read_buf, image, len);
+ H5MM_memcpy(read_buf, image, len);
/* Push direct block data through I/O filter pipeline */
if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &len, &read_buf) < 0)
@@ -1724,7 +1724,7 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Copy un-filtered data into block's buffer */
- HDmemcpy(udata->dblk, read_buf, len);
+ H5MM_memcpy(udata->dblk, read_buf, len);
} /* end if */
done:
@@ -1829,7 +1829,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata,
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for pipeline buffer")
/* Copy compressed image into buffer */
- HDmemcpy(read_buf, image, len);
+ H5MM_memcpy(read_buf, image, len);
/* Push direct block data through I/O filter pipeline */
nbytes = len;
@@ -1841,7 +1841,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata,
HDassert(nbytes == dblock->size);
/* Copy un-filtered data into block's buffer */
- HDmemcpy(dblock->blk, read_buf, dblock->size);
+ H5MM_memcpy(dblock->blk, read_buf, dblock->size);
} /* end if */
} /* end if */
else {
@@ -1856,7 +1856,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata,
/* Copy image to dblock->blk */
HDassert(dblock->size == len);
- HDmemcpy(dblock->blk, image, dblock->size);
+ H5MM_memcpy(dblock->blk, image, dblock->size);
} /* end else */
/* Start decoding direct block */
@@ -2146,7 +2146,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing,
image = dblock->blk;
/* Magic number */
- HDmemcpy(image, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
@@ -2201,7 +2201,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing,
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer")
/* Copy the direct block's image into the buffer to compress */
- HDmemcpy(write_buf, dblock->blk, write_size);
+ H5MM_memcpy(write_buf, dblock->blk, write_size);
/* Push direct block data through I/O filter pipeline */
nbytes = write_size;
@@ -2460,7 +2460,7 @@ H5HF__cache_dblock_serialize(const H5F_t *f, void *image, size_t len,
HDassert(dblock->write_size == len);
/* Copy the image from *(dblock->write_buf) to *image */
- HDmemcpy(image, dblock->write_buf, dblock->write_size);
+ H5MM_memcpy(image, dblock->write_buf, dblock->write_size);
/* Free *(dblock->write_buf) if it was allocated by the
* pre-serialize function
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index b014017..5750a03 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -36,6 +36,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5HFpkg.h" /* Fractal heaps */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
@@ -387,7 +388,7 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam)
/* Set the creation parameters for the heap */
hdr->max_man_size = cparam->max_man_size;
hdr->checksum_dblocks = cparam->checksum_dblocks;
- HDmemcpy(&(hdr->man_dtable.cparam), &(cparam->managed), sizeof(H5HF_dtable_cparam_t));
+ H5MM_memcpy(&(hdr->man_dtable.cparam), &(cparam->managed), sizeof(H5HF_dtable_cparam_t));
/* Set root table address to indicate that the heap is empty currently */
hdr->man_dtable.table_addr = HADDR_UNDEF;
diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c
index 6e475ad..d496d62 100644
--- a/src/H5HFhuge.c
+++ b/src/H5HFhuge.c
@@ -355,7 +355,7 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size);
write_size = obj_size;
if(NULL == (write_buf = H5MM_malloc(write_size)))
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer")
- HDmemcpy(write_buf, obj, write_size);
+ H5MM_memcpy(write_buf, obj, write_size);
/* Push direct block data through I/O filter pipeline */
nbytes = write_size;
@@ -794,7 +794,7 @@ H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read,
/* Copy object to user's buffer if there's filters on heap data */
/* (if there's no filters, the object was read directly into the user's buffer) */
if(hdr->filter_len > 0)
- HDmemcpy(op_data, read_buf, (size_t)obj_size);
+ H5MM_memcpy(op_data, read_buf, (size_t)obj_size);
} /* end if */
else {
/* Call the user's 'op' callback */
diff --git a/src/H5HFman.c b/src/H5HFman.c
index 7f90f49..e5b5cb8 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -183,7 +183,7 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id)
p = dblock->blk + blk_off;
/* Copy the object's data into the heap */
- HDmemcpy(p, obj, obj_size);
+ H5MM_memcpy(p, obj, obj_size);
p += obj_size;
/* Sanity check */
diff --git a/src/H5HFsection.c b/src/H5HFsection.c
index 36e966e..f5ac8e5 100644
--- a/src/H5HFsection.c
+++ b/src/H5HFsection.c
@@ -3082,7 +3082,7 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect,
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "allocation failed for row section pointer array")
/* Transfer row sections between current & peer sections */
- HDmemcpy(&peer_sect->u.indirect.dir_rows[0],
+ H5MM_memcpy(&peer_sect->u.indirect.dir_rows[0],
&sect->u.indirect.dir_rows[0],
(sizeof(H5HF_free_section_t *) * peer_dir_nrows));
HDmemmove(&sect->u.indirect.dir_rows[0],
@@ -3321,7 +3321,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect,
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "allocation failed for indirect section pointer array")
/* Transfer child indirect sections between current & peer sections */
- HDmemcpy(&peer_sect->u.indirect.indir_ents[0],
+ H5MM_memcpy(&peer_sect->u.indirect.indir_ents[0],
&sect->u.indirect.indir_ents[sect->u.indirect.indir_nents - peer_nentries],
(sizeof(H5HF_free_section_t *) * peer_nentries));
sect->u.indirect.indir_nents -= (peer_nentries + 1); /* Transferred blocks, plus child entry */
@@ -3636,7 +3636,7 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1,
sect1->u.indirect.dir_rows = new_dir_rows;
/* Transfer the second section's rows to first section */
- HDmemcpy(&sect1->u.indirect.dir_rows[sect1->u.indirect.dir_nrows],
+ H5MM_memcpy(&sect1->u.indirect.dir_rows[sect1->u.indirect.dir_nrows],
&sect2->u.indirect.dir_rows[src_row2],
(sizeof(H5HF_free_section_t *) * nrows_moved2));
@@ -3682,7 +3682,7 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1,
sect1->u.indirect.indir_ents = new_indir_ents;
/* Transfer the second section's entries to first section */
- HDmemcpy(&sect1->u.indirect.indir_ents[sect1->u.indirect.indir_nents],
+ H5MM_memcpy(&sect1->u.indirect.indir_ents[sect1->u.indirect.indir_nents],
&sect2->u.indirect.indir_ents[0],
(sizeof(H5HF_free_section_t *) * sect2->u.indirect.indir_nents));
} /* end else */
diff --git a/src/H5HFtest.c b/src/H5HFtest.c
index 1b1f688..6f174bb 100644
--- a/src/H5HFtest.c
+++ b/src/H5HFtest.c
@@ -32,6 +32,8 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5HFpkg.h" /* Fractal heaps */
+#include "H5MMprivate.h" /* Memory management */
+
/****************/
/* Local Macros */
@@ -100,7 +102,7 @@ H5HF_get_cparam_test(const H5HF_t *fh, H5HF_create_t *cparam)
else
H5_CHECKED_ASSIGN(cparam->id_len, uint16_t, fh->hdr->id_len, unsigned);
cparam->max_man_size = fh->hdr->max_man_size;
- HDmemcpy(&(cparam->managed), &(fh->hdr->man_dtable.cparam), sizeof(H5HF_dtable_cparam_t));
+ H5MM_memcpy(&(cparam->managed), &(fh->hdr->man_dtable.cparam), sizeof(H5HF_dtable_cparam_t));
H5O_msg_copy(H5O_PLINE_ID, &(fh->hdr->pline), &(cparam->pline));
FUNC_LEAVE_NOAPI(SUCCEED)
diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c
index 5cf1c08..0c27180 100644
--- a/src/H5HFtiny.c
+++ b/src/H5HFtiny.c
@@ -35,6 +35,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5HFpkg.h" /* Fractal heaps */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -176,7 +177,7 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size);
*id++ = enc_obj_size & H5HF_TINY_MASK_EXT_2;
} /* end else */
- HDmemcpy(id, obj, obj_size);
+ H5MM_memcpy(id, obj, obj_size);
HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size)));
/* Update statistics about heap */
diff --git a/src/H5HG.c b/src/H5HG.c
index df1c82d..231294b 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -168,7 +168,7 @@ H5HG__create(H5F_t *f, size_t size)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
/* Initialize the header */
- HDmemcpy(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC);
p = heap->chunk + H5_SIZEOF_MAGIC;
*p++ = H5HG_VERSION;
*p++ = 0; /*reserved*/
@@ -553,7 +553,7 @@ H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/)
/* Copy data into the heap */
if(size > 0) {
- HDmemcpy(heap->obj[idx].begin + H5HG_SIZEOF_OBJHDR(f), obj, size);
+ H5MM_memcpy(heap->obj[idx].begin + H5HG_SIZEOF_OBJHDR(f), obj, size);
#ifdef OLD_WAY
/* Don't bother zeroing out the rest of the info in the heap -QAK */
HDmemset(heap->obj[idx].begin + H5HG_SIZEOF_OBJHDR(f) + size, 0,
@@ -618,7 +618,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")
- HDmemcpy(object, p, size);
+ H5MM_memcpy(object, p, size);
/*
* Advance the heap in the CWFS list. We might have done this already
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index beaea7b..29e88df 100644
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -271,7 +271,7 @@ H5HG__cache_heap_deserialize(const void *_image, size_t len, void *_udata,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the image buffer into the newly allocate chunk */
- HDmemcpy(heap->chunk, _image, len);
+ H5MM_memcpy(heap->chunk, _image, len);
/* Deserialize the heap's header */
if(H5HG__hdr_deserialize(heap, (const uint8_t *)heap->chunk, f) < 0)
@@ -448,7 +448,7 @@ H5HG__cache_heap_serialize(const H5F_t *f, void *image, size_t len,
HDassert(heap->chunk);
/* copy the image into the buffer */
- HDmemcpy(image, heap->chunk, len);
+ H5MM_memcpy(image, heap->chunk, len);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HG__cache_heap_serialize() */
diff --git a/src/H5HL.c b/src/H5HL.c
index 735077c..f290294 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -725,7 +725,7 @@ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf))
} /* end if */
/* Copy the data into the heap */
- HDmemcpy(heap->dblk_image + offset, buf, buf_size);
+ H5MM_memcpy(heap->dblk_image + offset, buf, buf_size);
/* Set return value */
ret_value = offset;
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index 926f787..8b04b47 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -36,6 +36,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5HLpkg.h" /* Local Heaps */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -464,7 +465,7 @@ H5HL__cache_prefix_deserialize(const void *_image, size_t len, void *_udata,
image = ((const uint8_t *)_image) + heap->prfx_size;
/* Copy the heap data from the speculative read buffer */
- HDmemcpy(heap->dblk_image, image, heap->dblk_size);
+ H5MM_memcpy(heap->dblk_image, image, heap->dblk_size);
/* Build free list */
if(H5HL__fl_deserialize(heap) < 0)
@@ -587,7 +588,7 @@ H5HL__cache_prefix_serialize(const H5F_t *f, void *_image, size_t len,
heap->free_block = heap->freelist ? heap->freelist->offset : H5HL_FREE_NULL;
/* Serialize the heap prefix */
- HDmemcpy(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
*image++ = H5HL_VERSION;
*image++ = 0; /*reserved*/
@@ -615,7 +616,7 @@ H5HL__cache_prefix_serialize(const H5F_t *f, void *_image, size_t len,
H5HL__fl_serialize(heap);
/* Copy the heap data block into the cache image */
- HDmemcpy(image, heap->dblk_image, heap->dblk_size);
+ H5MM_memcpy(image, heap->dblk_image, heap->dblk_size);
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) + heap->dblk_size == len);
@@ -756,7 +757,7 @@ H5HL__cache_datablock_deserialize(const void *image, size_t len, void *_udata,
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate data block image buffer");
/* copy the datablock from the read buffer */
- HDmemcpy(heap->dblk_image, image, len);
+ H5MM_memcpy(heap->dblk_image, image, len);
/* Build free list */
if(FAIL == H5HL__fl_deserialize(heap))
@@ -851,7 +852,7 @@ H5HL__cache_datablock_serialize(const H5F_t *f, void *image, size_t len,
H5HL__fl_serialize(heap);
/* Copy the heap's data block into the cache's image */
- HDmemcpy(image, heap->dblk_image, heap->dblk_size);
+ H5MM_memcpy(image, heap->dblk_image, heap->dblk_size);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HL__cache_datablock_serialize() */
diff --git a/src/H5I.c b/src/H5I.c
index ca9ff61..93c9e98 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -355,6 +355,9 @@ H5Itype_exists(H5I_type_t type)
FUNC_ENTER_API(FAIL)
H5TRACE1("t", "It", type);
+ if(H5I_IS_LIB_TYPE(type))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type")
+
if (type <= H5I_BADID || type >= H5I_next_type)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
@@ -1131,7 +1134,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-void *
+static void *
H5I__remove_verify(hid_t id, H5I_type_t id_type)
{
void * ret_value = NULL; /*return value */
@@ -1940,6 +1943,8 @@ H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata)
ret_value = H5_ITER_STOP; /* terminate iteration early */
else if(cb_ret_val < 0)
ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */
+ else
+ ret_value = H5_ITER_CONT; /* continue iteration */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5I__iterate_pub_cb() */
diff --git a/src/H5L.c b/src/H5L.c
index 1f45740..da0bc7d 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -1676,7 +1676,7 @@ H5L_register(const H5L_class_t *cls)
} /* end if */
/* Copy link class info into table */
- HDmemcpy(H5L_table_g + i, cls, sizeof(H5L_class_t));
+ H5MM_memcpy(H5L_table_g + i, cls, sizeof(H5L_class_t));
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2217,7 +2217,7 @@ H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name,
/* Fill in UD link-specific information in the link struct*/
if(ud_data_size > 0) {
lnk.u.ud.udata = H5MM_malloc((size_t)ud_data_size);
- HDmemcpy(lnk.u.ud.udata, ud_data, (size_t) ud_data_size);
+ H5MM_memcpy(lnk.u.ud.udata, ud_data, (size_t) ud_data_size);
} /* end if */
else
lnk.u.ud.udata = NULL;
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index 0f3296f..d838d77 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -306,7 +306,7 @@ H5L__extern_query(const char H5_ATTR_UNUSED * link_name, const void *_udata, siz
buf_size = udata_size;
/* Copy the udata verbatim up to buf_size */
- HDmemcpy(buf, udata, buf_size);
+ H5MM_memcpy(buf, udata, buf_size);
} /* end if */
/* Set return value */
diff --git a/src/H5MM.c b/src/H5MM.c
index 866dfbe..1a5a149 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -274,7 +274,7 @@ H5MM_malloc(size_t size)
#if defined H5_MEMORY_ALLOC_SANITY_CHECK
/* Initialize block list head singleton */
if(!H5MM_init_s) {
- HDmemcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE);
+ H5MM_memcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE);
H5MM_block_head_s.next = &H5MM_block_head_s;
H5MM_block_head_s.prev = &H5MM_block_head_s;
H5MM_block_head_s.u.info.size = SIZET_MAX;
@@ -291,15 +291,15 @@ H5MM_malloc(size_t size)
if(NULL != (block = (H5MM_block_t *)HDmalloc(alloc_size))) {
/* Set up block */
- HDmemcpy(block->sig, H5MM_block_signature_s, H5MM_SIG_SIZE);
+ H5MM_memcpy(block->sig, H5MM_block_signature_s, H5MM_SIG_SIZE);
block->next = H5MM_block_head_s.next;
H5MM_block_head_s.next = block;
block->next->prev = block;
block->prev = &H5MM_block_head_s;
block->u.info.size = size;
block->u.info.in_use = TRUE;
- HDmemcpy(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE);
- HDmemcpy(block->b + H5MM_HEAD_GUARD_SIZE + size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE);
+ H5MM_memcpy(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE);
+ H5MM_memcpy(block->b + H5MM_HEAD_GUARD_SIZE + size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE);
/* Update statistics */
H5MM_total_alloc_bytes_s += size;
@@ -417,7 +417,7 @@ H5MM_realloc(void *mem, size_t size)
H5MM__sanity_check(mem);
ret_value = H5MM_malloc(size);
- HDmemcpy(ret_value, mem, MIN(size, old_size));
+ H5MM_memcpy(ret_value, mem, MIN(size, old_size));
H5MM_xfree(mem);
} /* end if */
else
@@ -564,3 +564,41 @@ H5MM_xfree(void *mem)
FUNC_LEAVE_NOAPI(NULL)
} /* end H5MM_xfree() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5MM_memcpy
+ *
+ * Purpose: Like memcpy(3) but with sanity checks on the parameters,
+ * particularly buffer overlap.
+ *
+ * Return: Success: pointer to dest
+ * Failure: NULL
+ *
+ * Programmer: Dana Robinson
+ * Spring 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5MM_memcpy(void *dest, const void *src, size_t n)
+{
+ void *ret = NULL;
+
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(dest);
+ HDassert(src);
+#if 0
+ /* Commented out while we investigate overlapping buffers in the
+ * parallel filter code (HDFFV-10735).
+ */
+ HDassert((char *)dest >= (const char *)src + n || (const char *)src >= (char *)dest + n);
+#endif
+
+ ret = HDmemcpy(dest, src, n);
+
+ FUNC_LEAVE_NOAPI(ret)
+
+} /* end H5MM_memcpy() */
+
diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h
index 0524601..2053215 100644
--- a/src/H5MMprivate.h
+++ b/src/H5MMprivate.h
@@ -45,6 +45,7 @@ H5_DLL void *H5MM_realloc(void *mem, size_t size);
H5_DLL char *H5MM_xstrdup(const char *s);
H5_DLL char *H5MM_strdup(const char *s);
H5_DLL void *H5MM_xfree(void *mem);
+H5_DLL void *H5MM_memcpy(void *dest, const void *src, size_t n);
#if defined H5_MEMORY_ALLOC_SANITY_CHECK
H5_DLL void H5MM_sanity_check_all(void);
H5_DLL void H5MM_final_sanity_check(void);
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index 23dd928..c1f90cb 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -36,6 +36,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free lists */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
/****************/
@@ -949,7 +950,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null,
* # at the beginning of the chunk image.
*/
if(oh->version > H5O_VERSION_1) {
- HDmemcpy(p, H5O_CHK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(p, H5O_CHK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
p += H5_SIZEOF_MAGIC;
} /* end if */
@@ -988,7 +989,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null,
HDassert(curr_msg->type->id != H5O_CONT_ID);
/* Copy the raw data */
- HDmemcpy(p, curr_msg->raw - (size_t)H5O_SIZEOF_MSGHDR_OH(oh),
+ H5MM_memcpy(p, curr_msg->raw - (size_t)H5O_SIZEOF_MSGHDR_OH(oh),
curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Update the message info */
@@ -1044,7 +1045,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null,
null_msg->chunkno = oh->mesg[found_msg->msgno].chunkno;
/* Copy the message to move (& its prefix) to its new location */
- HDmemcpy(p, oh->mesg[found_msg->msgno].raw - H5O_SIZEOF_MSGHDR_OH(oh),
+ H5MM_memcpy(p, oh->mesg[found_msg->msgno].raw - H5O_SIZEOF_MSGHDR_OH(oh),
oh->mesg[found_msg->msgno].raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Switch moved message to point to new location */
@@ -1519,7 +1520,7 @@ H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
move_size = curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
/* Move message out of deleted chunk */
- HDmemcpy(move_start, curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), move_size);
+ H5MM_memcpy(move_start, curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), move_size);
curr_msg->raw = move_start + H5O_SIZEOF_MSGHDR_OH(oh);
curr_msg->chunkno = cont_chunkno;
chk_dirtied = TRUE;
@@ -1791,7 +1792,7 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh)
} /* end if */
/* Copy raw data for non-null message to new chunk */
- HDmemcpy(null_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
+ H5MM_memcpy(null_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Point non-null message at null message's space */
curr_msg->chunkno = null_msg->chunkno;
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index c420046..0a7c4bf 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -208,7 +208,7 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace")
/* Copy the extent information to the dataspace */
- HDmemcpy(&(attr->shared->ds->extent), extent, sizeof(H5S_extent_t));
+ H5MM_memcpy(&(attr->shared->ds->extent), extent, sizeof(H5S_extent_t));
/* Release temporary extent information */
extent = H5FL_FREE(H5S_extent_t, extent);
@@ -240,7 +240,7 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
if(attr->shared->data_size) {
if(NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, attr->shared->data_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(attr->shared->data, p, attr->shared->data_size);
+ H5MM_memcpy(attr->shared->data, p, attr->shared->data_size);
} /* end if */
/* Increment the reference count for this object header message in cache(compact
@@ -336,7 +336,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
*p++ = attr->shared->encoding;
/* Write the name including null terminator */
- HDmemcpy(p, attr->shared->name, name_len);
+ H5MM_memcpy(p, attr->shared->name, name_len);
if(attr->shared->version < H5O_ATTR_VERSION_2) {
/* Pad to the correct number of bytes */
HDmemset(p + name_len, 0, H5O_ALIGN_OLD(name_len) - name_len);
@@ -369,7 +369,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
/* Store attribute data. If there's no data, store 0 as fill value. */
if(attr->shared->data)
- HDmemcpy(p, attr->shared->data, attr->shared->data_size);
+ H5MM_memcpy(p, attr->shared->data, attr->shared->data_size);
else
HDmemset(p, 0, attr->shared->data_size);
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 6e135c5..57ec9b8 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -862,7 +862,7 @@ H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
/* (Needs to occur before updating the shared message, or the hash
* value on the old & new messages will be the same) */
- HDmemcpy(((H5A_t *)mesg->native)->shared->data, udata->attr->shared->data, udata->attr->shared->data_size);
+ H5MM_memcpy(((H5A_t *)mesg->native)->shared->data, udata->attr->shared->data, udata->attr->shared->data_size);
} /* end if */
/* Mark the message as modified */
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 578cff0..683d155 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -36,6 +36,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free lists */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -542,7 +543,7 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing)
* Can we rework things so that the object header and the cache
* share a buffer?
*/
- HDmemcpy(image, oh->chunk[0].image, len);
+ H5MM_memcpy(image, oh->chunk[0].image, len);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -900,7 +901,7 @@ H5O__cache_chk_serialize(const H5F_t *f, void *image, size_t len, void *_thing)
/* copy the chunk into the image -- this is potentially expensive.
* Can we rework things so that the chunk and the cache share a buffer?
*/
- HDmemcpy(image, chk_proxy->oh->chunk[chk_proxy->chunkno].image, len);
+ H5MM_memcpy(image, chk_proxy->oh->chunk[chk_proxy->chunkno].image, len);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1352,7 +1353,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
oh->chunk[chunkno].chunk_proxy = NULL;
/* Copy disk image into chunk's image */
- HDmemcpy(oh->chunk[chunkno].image, image, oh->chunk[chunkno].size);
+ H5MM_memcpy(oh->chunk[chunkno].image, image, oh->chunk[chunkno].size);
/* Point into chunk image to decode */
chunk_image = oh->chunk[chunkno].image;
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index a3d4884..9578f95 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -732,7 +732,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
* header. This will be written when the header is flushed to disk.
*/
if(oh_dst->version > H5O_VERSION_1)
- HDmemcpy(current_pos, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(current_pos, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
current_pos += H5O_SIZEOF_HDR(oh_dst) - H5O_SIZEOF_CHKSUM_OH(oh_dst);
/* Loop through destination messages, updating their "raw" info */
@@ -755,7 +755,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
/* Copy each message that wasn't dirtied above */
if(!mesg_dst->dirty)
/* Copy the message header plus the message's raw data. */
- HDmemcpy(current_pos, mesg_src->raw - msghdr_size, msghdr_size + mesg_src->raw_size);
+ H5MM_memcpy(current_pos, mesg_src->raw - msghdr_size, msghdr_size + mesg_src->raw_size);
/* Set message's raw pointer to destination chunk's new "image" */
mesg_dst->raw = current_pos + msghdr_size;
diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c
index 159c950..eb678e4 100644
--- a/src/H5Odrvinfo.c
+++ b/src/H5Odrvinfo.c
@@ -101,7 +101,7 @@ H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for driver info message")
/* Retrieve driver name */
- HDmemcpy(mesg->name, p, 8);
+ H5MM_memcpy(mesg->name, p, 8);
mesg->name[8] = '\0';
p += 8;
@@ -116,7 +116,7 @@ H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh,
} /* end if */
/* Copy encoded driver info into buffer */
- HDmemcpy(mesg->buf, p, mesg->len);
+ H5MM_memcpy(mesg->buf, p, mesg->len);
/* Set return value */
ret_value = (void *)mesg;
@@ -152,11 +152,11 @@ H5O_drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_share
/* Store version, driver name, buffer length, & encoded buffer */
*p++ = H5O_DRVINFO_VERSION;
- HDmemcpy(p, mesg->name, 8);
+ H5MM_memcpy(p, mesg->name, 8);
p += 8;
HDassert(mesg->len <= 65535);
UINT16ENCODE(p, mesg->len);
- HDmemcpy(p, mesg->buf, mesg->len);
+ H5MM_memcpy(p, mesg->buf, mesg->len);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_drvinfo_encode() */
@@ -200,7 +200,7 @@ H5O_drvinfo_copy(const void *_mesg, void *_dest)
dest = (H5O_drvinfo_t *)H5MM_xfree(dest);
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
} /* end if */
- HDmemcpy(dest->buf, mesg->buf, mesg->len);
+ H5MM_memcpy(dest->buf, mesg->buf, mesg->len);
/* Set return value */
ret_value = dest;
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 28970d1..39d8bac 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -250,7 +250,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
HDassert(0 == (z & 0x7)); /*must be aligned*/
if(NULL == (dt->shared->u.opaque.tag = (char *)H5MM_malloc(z + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- HDmemcpy(dt->shared->u.opaque.tag, *pp, z);
+ H5MM_memcpy(dt->shared->u.opaque.tag, *pp, z);
dt->shared->u.opaque.tag[z] = '\0';
*pp += z;
break;
@@ -483,7 +483,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
} /* end for */
/* Values */
- HDmemcpy(dt->shared->u.enumer.value, *pp,
+ H5MM_memcpy(dt->shared->u.enumer.value, *pp,
dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size);
*pp += dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size;
break;
@@ -882,7 +882,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
z = HDstrlen(dt->shared->u.opaque.tag);
aligned = (z + 7) & (H5T_OPAQUE_TAG_MAX - 8);
flags = (unsigned)(flags | aligned);
- HDmemcpy(*pp, dt->shared->u.opaque.tag, MIN(z,aligned));
+ H5MM_memcpy(*pp, dt->shared->u.opaque.tag, MIN(z,aligned));
for(n = MIN(z, aligned); n < aligned; n++)
(*pp)[n] = 0;
*pp += aligned;
@@ -997,7 +997,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
} /* end for */
/* Values */
- HDmemcpy(*pp, dt->shared->u.enumer.value, dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size);
+ H5MM_memcpy(*pp, dt->shared->u.enumer.value, dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size);
*pp += dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size;
break;
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index 6a81a46..b18d819 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -461,7 +461,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the "top level" information */
- HDmemcpy(efl_dst, efl_src, sizeof(H5O_efl_t));
+ H5MM_memcpy(efl_dst, efl_src, sizeof(H5O_efl_t));
/* Determine size needed for destination heap */
heap_size = H5HL_ALIGN(1); /* "empty" name */
@@ -488,7 +488,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* copy content from the source. Need to update later */
- HDmemcpy(efl_dst->slot, efl_src->slot, size);
+ H5MM_memcpy(efl_dst->slot, efl_src->slot, size);
} /* end if */
/* copy the name from the source */
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index fd50cb9..d87dc84 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -157,6 +157,7 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{
const unsigned H5O_fill_ver_bounds[] = {
H5O_FILL_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_FILL_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_FILL_VERSION_3, /* H5F_LIBVER_V110 */
H5O_FILL_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -232,7 +233,7 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "destination buffer too small")
if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(fill->buf, p, (size_t)fill->size);
+ H5MM_memcpy(fill->buf, p, (size_t)fill->size);
} /* end if */
} /* end if */
else
@@ -270,7 +271,7 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh,
H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t);
if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(fill->buf, p, (size_t)fill->size);
+ H5MM_memcpy(fill->buf, p, (size_t)fill->size);
/* Set the "defined" flag */
fill->fill_defined = TRUE;
@@ -353,7 +354,7 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh,
if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(fill->buf, p, (size_t)fill->size);
+ H5MM_memcpy(fill->buf, p, (size_t)fill->size);
fill->fill_defined = TRUE;
} /* end if */
else
@@ -420,7 +421,7 @@ H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill)
if(fill->size > 0)
if(fill->buf) {
H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t);
- HDmemcpy(p, fill->buf, (size_t)fill->size);
+ H5MM_memcpy(p, fill->buf, (size_t)fill->size);
} /* end if */
} /* end if */
} /* end if */
@@ -459,7 +460,7 @@ H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill)
/* Encode the fill value */
HDassert(fill->buf);
H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t);
- HDmemcpy(p, fill->buf, (size_t)fill->size);
+ H5MM_memcpy(p, fill->buf, (size_t)fill->size);
} /* end if */
else {
/* Flags */
@@ -499,7 +500,7 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill)
UINT32ENCODE(p, fill->size);
if(fill->buf)
- HDmemcpy(p, fill->buf, (size_t)fill->size);
+ H5MM_memcpy(p, fill->buf, (size_t)fill->size);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_fill_old_encode() */
@@ -551,7 +552,7 @@ H5O_fill_copy(const void *_src, void *_dst)
H5_CHECK_OVERFLOW(src->size, ssize_t, size_t);
if(NULL == (dst->buf = H5MM_malloc((size_t)src->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(dst->buf, src->buf, (size_t)src->size);
+ H5MM_memcpy(dst->buf, src->buf, (size_t)src->size);
/* Check for needing to convert/copy fill value */
if(src->type) {
@@ -1025,7 +1026,7 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed)
else {
if(NULL == (buf = H5MM_malloc(H5T_get_size(dset_type))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
- HDmemcpy(buf, fill->buf, H5T_get_size(fill->type));
+ H5MM_memcpy(buf, fill->buf, H5T_get_size(fill->type));
} /* end else */
/* Use CALLOC here to clear the buffer in case later the library thinks there's
diff --git a/src/H5Oint.c b/src/H5Oint.c
index d3a409c..60aae45 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -38,9 +38,7 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MFprivate.h" /* File memory management */
-#ifdef H5O_ENABLE_BOGUS
#include "H5MMprivate.h" /* Memory management */
-#endif /* H5O_ENABLE_BOGUS */
#include "H5Opkg.h" /* Object headers */
#include "H5VLprivate.h" /* Virtual Object Layer */
@@ -132,6 +130,7 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
const unsigned H5O_obj_ver_bounds[] = {
H5O_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_VERSION_2, /* H5F_LIBVER_V110 */
H5O_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -496,7 +495,7 @@ H5O__apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t ini
/* Put magic # for object header in first chunk */
if(H5O_VERSION_1 < oh->version)
- HDmemcpy(oh->chunk[0].image, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(oh->chunk[0].image, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
/* Create the message list */
oh->nmesgs = 1;
@@ -1921,7 +1920,7 @@ H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth)
HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP);
/* Copy the top level information */
- HDmemcpy(dst, src, sizeof(H5O_loc_t));
+ H5MM_memcpy(dst, src, sizeof(H5O_loc_t));
/* Deep copy the names */
if(depth == H5_COPY_DEEP) {
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 2b65e0c..138f219 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -189,7 +189,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
if(mesg->storage.u.compact.size > 0) {
if(NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer")
- HDmemcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size);
+ H5MM_memcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size);
p += mesg->storage.u.compact.size;
} /* end if */
} /* end if */
@@ -210,7 +210,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed for compact data buffer")
/* Compact data */
- HDmemcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size);
+ H5MM_memcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size);
p += mesg->storage.u.compact.size;
} /* end if */
@@ -425,14 +425,14 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
tmp_size = HDstrlen((const char *)heap_block_p) + 1;
if(NULL == (mesg->storage.u.virt.list[i].source_file_name = (char *)H5MM_malloc(tmp_size)))
HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, NULL, "unable to allocate memory for source file name")
- (void)HDmemcpy(mesg->storage.u.virt.list[i].source_file_name, heap_block_p, tmp_size);
+ (void)H5MM_memcpy(mesg->storage.u.virt.list[i].source_file_name, heap_block_p, tmp_size);
heap_block_p += tmp_size;
/* Source dataset name */
tmp_size = HDstrlen((const char *)heap_block_p) + 1;
if(NULL == (mesg->storage.u.virt.list[i].source_dset_name = (char *)H5MM_malloc(tmp_size)))
HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, NULL, "unable to allocate memory for source dataset name")
- (void)HDmemcpy(mesg->storage.u.virt.list[i].source_dset_name, heap_block_p, tmp_size);
+ (void)H5MM_memcpy(mesg->storage.u.virt.list[i].source_dset_name, heap_block_p, tmp_size);
heap_block_p += tmp_size;
/* Source selection */
@@ -581,7 +581,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p,
/* Raw data */
if(mesg->storage.u.compact.size > 0) {
if(mesg->storage.u.compact.buf)
- HDmemcpy(p, mesg->storage.u.compact.buf, mesg->storage.u.compact.size);
+ H5MM_memcpy(p, mesg->storage.u.compact.buf, mesg->storage.u.compact.size);
else
HDmemset(p, 0, mesg->storage.u.compact.size);
p += mesg->storage.u.compact.size;
@@ -742,7 +742,7 @@ H5O__layout_copy(const void *_mesg, void *_dest)
HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset")
/* Copy over the raw data */
- HDmemcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size);
+ H5MM_memcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size);
} /* end if */
else
HDassert(dest->storage.u.compact.buf == NULL);
@@ -1039,7 +1039,8 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
layout_dst->storage.u.contig.size = H5S_extent_nelem(udata->src_space_extent) *
H5T_get_size(udata->src_dtype);
- if(H5D__contig_is_space_alloc(&layout_src->storage)) {
+ if(H5D__contig_is_space_alloc(&layout_src->storage)
+ || (cpy_info->shared_fo && H5D__contig_is_data_cached((const H5D_shared_t *)cpy_info->shared_fo))) {
/* copy contiguous raw data */
if(H5D__contig_copy(file_src, &layout_src->storage.u.contig, file_dst, &layout_dst->storage.u.contig, udata->src_dtype, cpy_info) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy contiguous storage")
@@ -1048,7 +1049,8 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
break;
case H5D_CHUNKED:
- if(H5D__chunk_is_space_alloc(&layout_src->storage)) {
+ if(H5D__chunk_is_space_alloc(&layout_src->storage)
+ || (cpy_info->shared_fo && H5D__chunk_is_data_cached((const H5D_shared_t *)cpy_info->shared_fo))) {
/* Create chunked layout */
if(H5D__chunk_copy(file_src, &layout_src->storage.u.chunk, &layout_src->u.chunk, file_dst, &layout_dst->storage.u.chunk, udata->src_space_extent, udata->src_dtype, udata->common.src_pline, cpy_info) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage")
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 55e1aee..4bd952b 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -202,7 +202,7 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
/* Get the link's name */
if(NULL == (lnk->name = (char *)H5MM_malloc(len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(lnk->name, p, len);
+ H5MM_memcpy(lnk->name, p, len);
lnk->name[len] = '\0';
p += len;
@@ -220,7 +220,7 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid link length")
if(NULL == (lnk->u.soft.name = (char *)H5MM_malloc((size_t)len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(lnk->u.soft.name, p, len);
+ H5MM_memcpy(lnk->u.soft.name, p, len);
lnk->u.soft.name[len] = '\0';
p += len;
break;
@@ -240,7 +240,7 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
{
if(NULL == (lnk->u.ud.udata = H5MM_malloc((size_t)len)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(lnk->u.ud.udata, p, len);
+ H5MM_memcpy(lnk->u.ud.udata, p, len);
p += len;
}
else
@@ -349,7 +349,7 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
} /* end switch */
/* Store the link's name */
- HDmemcpy(p, lnk->name, (size_t)len);
+ H5MM_memcpy(p, lnk->name, (size_t)len);
p += len;
/* Store the appropriate information for each type of link */
@@ -364,7 +364,7 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
len = (uint16_t)HDstrlen(lnk->u.soft.name);
HDassert(len > 0);
UINT16ENCODE(p, len)
- HDmemcpy(p, lnk->u.soft.name, (size_t)len);
+ H5MM_memcpy(p, lnk->u.soft.name, (size_t)len);
p += len;
break;
@@ -380,7 +380,7 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
UINT16ENCODE(p, len)
if(len > 0)
{
- HDmemcpy(p, lnk->u.ud.udata, (size_t)len);
+ H5MM_memcpy(p, lnk->u.ud.udata, (size_t)len);
p+=len;
}
break;
@@ -437,7 +437,7 @@ H5O_link_copy(const void *_mesg, void *_dest)
if(lnk->u.ud.size > 0) {
if(NULL == (dest->u.ud.udata = H5MM_malloc(lnk->u.ud.size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(dest->u.ud.udata, lnk->u.ud.udata, lnk->u.ud.size);
+ H5MM_memcpy(dest->u.ud.udata, lnk->u.ud.udata, lnk->u.ud.size);
} /* end if */
} /* end if */
diff --git a/src/H5Opline.c b/src/H5Opline.c
index 1fae1b8..609f2eb 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -93,6 +93,7 @@ const H5O_msg_class_t H5O_MSG_PLINE[1] = {{
const unsigned H5O_pline_ver_bounds[] = {
H5O_PLINE_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_PLINE_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_PLINE_VERSION_2, /* H5F_LIBVER_V110 */
H5O_PLINE_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -318,7 +319,7 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg)
/* Encode name, if there is one to encode */
if(name_length > 0) {
/* Store name, with null terminator */
- HDmemcpy(p, name, name_length);
+ H5MM_memcpy(p, name, name_length);
p += name_length;
/* Pad out name to alignment, in older versions */
@@ -409,7 +410,7 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/)
if(NULL == (dst->filter[i].cd_values = (unsigned *)H5MM_malloc(src->filter[i].cd_nelmts* sizeof(unsigned))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(dst->filter[i].cd_values, src->filter[i].cd_values,
+ H5MM_memcpy(dst->filter[i].cd_values, src->filter[i].cd_values,
src->filter[i].cd_nelmts * sizeof(unsigned));
} /* end if */
else
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index 4fc0488..67ca76f 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -39,6 +39,7 @@
#include "H5Fprivate.h" /* File access */
#include "H5Gprivate.h" /* Groups */
#include "H5HFprivate.h" /* Fractal heap */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
#include "H5SMprivate.h" /* Shared object header messages */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -358,7 +359,7 @@ H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *b
*/
if(sh_mesg.type == H5O_SHARE_TYPE_SOHM) {
HDassert(version >= H5O_SHARED_VERSION_3);
- HDmemcpy(&sh_mesg.u.heap_id, buf, sizeof(sh_mesg.u.heap_id));
+ H5MM_memcpy(&sh_mesg.u.heap_id, buf, sizeof(sh_mesg.u.heap_id));
} /* end if */
else {
/* The H5O_COMMITTED_FLAG should be set if this message
@@ -426,7 +427,7 @@ H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_m
* object header that holds it.
*/
if(sh_mesg->type == H5O_SHARE_TYPE_SOHM)
- HDmemcpy(buf, &(sh_mesg->u.heap_id), sizeof(sh_mesg->u.heap_id));
+ H5MM_memcpy(buf, &(sh_mesg->u.heap_id), sizeof(sh_mesg->u.heap_id));
else
H5F_addr_encode(f, &buf, sh_mesg->u.loc.oh_addr);
diff --git a/src/H5P.c b/src/H5P.c
index 72d7ae8..09ff7f0 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -817,14 +817,17 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5Pencode
+ H5Pencode2
PURPOSE
- Routine to convert the property values in a property list into a binary buffer
+ Routine to convert the property values in a property list into a binary buffer.
+ The encoding of property values will be done according to the file format
+ setting in fapl_id.
USAGE
- herr_t H5Pencode(plist_id, buf, nalloc)
+ herr_t H5Pencode(plist_id, buf, nalloc, fapl_id)
hid_t plist_id; IN: Identifier to property list to encode
void *buf: OUT: buffer to gold the encoded plist
size_t *nalloc; IN/OUT: size of buffer needed to encode plist
+ hid_t fapl_id; IN: File access property list ID
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
@@ -837,25 +840,29 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Pencode(hid_t plist_id, void *buf, size_t *nalloc)
+H5Pencode2(hid_t plist_id, void *buf, size_t *nalloc, hid_t fapl_id)
{
H5P_genplist_t *plist; /* Property list to query */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*x*z", plist_id, buf, nalloc);
+ H5TRACE4("e", "i*x*zi", plist_id, buf, nalloc, fapl_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");
+ /* 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")
+
/* Call the internal encode routine */
if((ret_value = H5P__encode(plist, TRUE, buf, nalloc)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to encode property list");
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Pencode() */
+} /* H5Pencode2() */
/*--------------------------------------------------------------------------
diff --git a/src/H5PB.c b/src/H5PB.c
index 88a6151..25c5f43 100644
--- a/src/H5PB.c
+++ b/src/H5PB.c
@@ -36,6 +36,7 @@
#include "H5Fpkg.h" /* Files */
#include "H5FDprivate.h" /* File drivers */
#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
#include "H5PBpkg.h" /* File access */
#include "H5SLprivate.h" /* Skip List */
@@ -609,7 +610,7 @@ H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf)
HDassert(addr + size <= page_addr + page_buf->page_size);
offset = addr - page_addr;
- HDmemcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf, size);
+ H5MM_memcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf, size);
/* move to top of LRU list */
H5PB__MOVE_TO_TOP_LRU(page_buf, page_entry)
@@ -818,7 +819,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/
offset = addr - first_page_addr;
HDassert(page_buf->page_size > offset);
- HDmemcpy(buf, (uint8_t *)page_entry->page_buf_ptr + offset,
+ H5MM_memcpy(buf, (uint8_t *)page_entry->page_buf_ptr + offset,
page_buf->page_size - (size_t)offset);
/* move to top of LRU list */
@@ -829,7 +830,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/
offset = (num_touched_pages-2)*page_buf->page_size +
(page_buf->page_size - (addr - first_page_addr));
- HDmemcpy((uint8_t *)buf + offset, page_entry->page_buf_ptr,
+ H5MM_memcpy((uint8_t *)buf + offset, page_entry->page_buf_ptr,
(size_t)((addr + size) - last_page_addr));
/* move to top of LRU list */
@@ -839,7 +840,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/
else {
offset = i*page_buf->page_size;
- HDmemcpy((uint8_t *)buf+(i*page_buf->page_size) , page_entry->page_buf_ptr,
+ H5MM_memcpy((uint8_t *)buf+(i*page_buf->page_size) , page_entry->page_buf_ptr,
page_buf->page_size);
} /* end else */
} /* end if */
@@ -872,7 +873,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/
buf_offset = (0 == i ? 0 : size - access_size);
/* copy the requested data from the page into the input buffer */
- HDmemcpy((uint8_t *)buf + buf_offset, (uint8_t *)page_entry->page_buf_ptr + offset, access_size);
+ H5MM_memcpy((uint8_t *)buf + buf_offset, (uint8_t *)page_entry->page_buf_ptr + offset, access_size);
/* Update LRU */
H5PB__MOVE_TO_TOP_LRU(page_buf, page_entry)
@@ -937,7 +938,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/
/* Copy the requested data from the page into the input buffer */
offset = (0 == i ? addr - search_addr : 0);
buf_offset = (0 == i ? 0 : size - access_size);
- HDmemcpy((uint8_t *)buf + buf_offset, (uint8_t *)new_page_buf + offset, access_size);
+ H5MM_memcpy((uint8_t *)buf + buf_offset, (uint8_t *)new_page_buf + offset, access_size);
/* Create the new PB entry */
if(NULL == (page_entry = H5FL_CALLOC(H5PB_entry_t)))
@@ -1102,7 +1103,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
HDassert(page_buf->page_size > offset);
/* Update page's data */
- HDmemcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf, page_buf->page_size - (size_t)offset);
+ H5MM_memcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf, page_buf->page_size - (size_t)offset);
/* Mark page dirty and push to top of LRU */
page_entry->is_dirty = TRUE;
@@ -1121,7 +1122,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
(page_buf->page_size - (addr - first_page_addr));
/* Update page's data */
- HDmemcpy(page_entry->page_buf_ptr, (const uint8_t *)buf + offset,
+ H5MM_memcpy(page_entry->page_buf_ptr, (const uint8_t *)buf + offset,
(size_t)((addr + size) - last_page_addr));
/* Mark page dirty and push to top of LRU */
@@ -1173,7 +1174,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
buf_offset = (0 == i ? 0 : size - access_size);
/* Copy the requested data from the input buffer into the page */
- HDmemcpy((uint8_t *)page_entry->page_buf_ptr + offset, (const uint8_t *)buf + buf_offset, access_size);
+ H5MM_memcpy((uint8_t *)page_entry->page_buf_ptr + offset, (const uint8_t *)buf + buf_offset, access_size);
/* Mark page dirty and push to top of LRU */
page_entry->is_dirty = TRUE;
@@ -1289,7 +1290,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
} /* end else */
/* Copy the requested data from the page into the input buffer */
- HDmemcpy((uint8_t *)new_page_buf + offset, (const uint8_t *)buf+buf_offset, access_size);
+ H5MM_memcpy((uint8_t *)new_page_buf + offset, (const uint8_t *)buf+buf_offset, access_size);
/* Page is dirty now */
page_entry->is_dirty = TRUE;
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index 00e598f..5ce12b4 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -37,8 +37,8 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Ppkg.h" /* Property lists */
-#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -341,7 +341,7 @@ H5P__dapl_vds_file_pref_enc(const void *value, void **_pp, size_t *size)
/* encode the prefix */
if(NULL != vds_file_pref) {
- HDmemcpy(*(char **)pp, vds_file_pref, len);
+ H5MM_memcpy(*(char **)pp, vds_file_pref, len);
*pp += len;
} /* end if */
} /* end if */
@@ -589,7 +589,7 @@ H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size)
/* encode the prefix */
if(NULL != efile_pref) {
- HDmemcpy(*(char **)pp, efile_pref, len);
+ H5MM_memcpy(*(char **)pp, efile_pref, len);
*pp += len;
} /* end if */
} /* end if */
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index b85f105..41d7c78 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -439,13 +439,13 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size)
for(u = 0; u < layout->storage.u.virt.list_nused; u++) {
/* Source file name */
tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_file_name) + (size_t)1;
- (void)HDmemcpy(*pp, layout->storage.u.virt.list[u].source_file_name, tmp_size);
+ (void)H5MM_memcpy(*pp, layout->storage.u.virt.list[u].source_file_name, tmp_size);
*pp += tmp_size;
*size += tmp_size;
/* Source dataset name */
tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_dset_name) + (size_t)1;
- (void)HDmemcpy(*pp, layout->storage.u.virt.list[u].source_dset_name, tmp_size);
+ (void)H5MM_memcpy(*pp, layout->storage.u.virt.list[u].source_dset_name, tmp_size);
*pp += tmp_size;
*size += tmp_size;
@@ -615,14 +615,14 @@ H5P__dcrt_layout_dec(const void **_pp, void *value)
tmp_size = HDstrlen((const char *)*pp) + 1;
if(NULL == (tmp_layout.storage.u.virt.list[u].source_file_name = (char *)H5MM_malloc(tmp_size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory for source file name")
- (void)HDmemcpy(tmp_layout.storage.u.virt.list[u].source_file_name, *pp, tmp_size);
+ (void)H5MM_memcpy(tmp_layout.storage.u.virt.list[u].source_file_name, *pp, tmp_size);
*pp += tmp_size;
/* Source dataset name */
tmp_size = HDstrlen((const char *)*pp) + 1;
if(NULL == (tmp_layout.storage.u.virt.list[u].source_dset_name = (char *)H5MM_malloc(tmp_size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory for source dataset name")
- (void)HDmemcpy(tmp_layout.storage.u.virt.list[u].source_dset_name, *pp, tmp_size);
+ (void)H5MM_memcpy(tmp_layout.storage.u.virt.list[u].source_dset_name, *pp, tmp_size);
*pp += tmp_size;
/* Source selection */
@@ -687,7 +687,7 @@ H5P__dcrt_layout_dec(const void **_pp, void *value)
} /* end switch */
/* Set the value */
- HDmemcpy(value, layout, sizeof(H5O_layout_t));
+ H5MM_memcpy(value, layout, sizeof(H5O_layout_t));
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1036,7 +1036,7 @@ H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size)
/* Encode the fill value & datatype */
if(fill->size > 0) {
/* Encode the fill value itself */
- HDmemcpy(*pp, (uint8_t *)fill->buf, (size_t)fill->size);
+ H5MM_memcpy(*pp, (uint8_t *)fill->buf, (size_t)fill->size);
*pp += fill->size;
/* Encode fill value datatype */
@@ -1133,7 +1133,7 @@ H5P__dcrt_fill_value_dec(const void **_pp, void *_value)
/* Allocate fill buffer and copy the contents in it */
if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for fill value buffer")
- HDmemcpy((uint8_t *)fill->buf, *pp, (size_t)fill->size);
+ H5MM_memcpy((uint8_t *)fill->buf, *pp, (size_t)fill->size);
*pp += fill->size;
enc_size = *(*pp)++;
@@ -1448,7 +1448,7 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size)
UINT64ENCODE_VAR(*pp, enc_value, enc_size);
/* Encode name */
- HDmemcpy(*pp, (uint8_t *)(efl->slot[u].name), len);
+ H5MM_memcpy(*pp, (uint8_t *)(efl->slot[u].name), len);
*pp += len;
/* Encode offset */
@@ -2035,7 +2035,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
/* Verify & initialize property's chunk dims */
- HDmemcpy(&chunk_layout, &H5D_def_layout_chunk_g, sizeof(H5D_def_layout_chunk_g));
+ H5MM_memcpy(&chunk_layout, &H5D_def_layout_chunk_g, sizeof(H5D_def_layout_chunk_g));
HDmemset(&chunk_layout.u.chunk.dim, 0, sizeof(chunk_layout.u.chunk.dim));
chunk_nelmts = 1;
for(u = 0; u < (unsigned)ndims; u++) {
@@ -2204,7 +2204,7 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name,
HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release layout message")
/* Copy the default virtual layout */
- HDmemcpy(&virtual_layout, &H5D_def_layout_virtual_g, sizeof(H5D_def_layout_virtual_g));
+ H5MM_memcpy(&virtual_layout, &H5D_def_layout_virtual_g, sizeof(H5D_def_layout_virtual_g));
/* Sanity check */
HDassert(virtual_layout.storage.u.virt.list_nalloc == 0);
@@ -3243,7 +3243,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
fill.size = (ssize_t)H5T_get_size(type);
if(NULL == (fill.buf = H5MM_malloc((size_t)fill.size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for fill value")
- HDmemcpy(fill.buf, value, (size_t)fill.size);
+ H5MM_memcpy(fill.buf, value, (size_t)fill.size);
/* Set up type conversion function */
if(NULL == (tpath = H5T_path_find(type, type)))
@@ -3351,7 +3351,7 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/)
if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_malloc(H5T_get_size(fill.type))))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion")
} /* end else */
- HDmemcpy(buf, fill.buf, H5T_get_size(fill.type));
+ H5MM_memcpy(buf, fill.buf, H5T_get_size(fill.type));
/* Do the conversion */
if((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(type, H5T_COPY_TRANSIENT), FALSE)) < 0)
@@ -3359,7 +3359,7 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/)
if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, buf, bkg) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "datatype conversion failed")
if(buf != value)
- HDmemcpy(value, buf, H5T_get_size(type));
+ H5MM_memcpy(value, buf, H5T_get_size(type));
done:
if(buf != value)
diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c
index 4a63b36..f6c2a3c 100644
--- a/src/H5Pdeprec.c
+++ b/src/H5Pdeprec.c
@@ -486,6 +486,54 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_version() */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Pencode1
+ PURPOSE
+ Routine to convert the property values in a property list into a binary buffer
+ USAGE
+ herr_t H5Pencode1(plist_id, buf, nalloc)
+ hid_t plist_id; IN: Identifier to property list to encode
+ void *buf: OUT: buffer to gold the encoded plist
+ size_t *nalloc; IN/OUT: size of buffer needed to encode plist
+ RETURNS
+ Returns non-negative on success, negative on failure.
+ DESCRIPTION
+ Encodes a property list into a binary buffer. If the buffer is NULL, then
+ the call will set the size needed to encode the plist in nalloc. Otherwise
+ the routine will encode the plist in buf.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5Pencode1(hid_t plist_id, void *buf, size_t *nalloc)
+{
+ H5P_genplist_t *plist; /* Property list to query */
+ hid_t temp_fapl_id = H5P_DEFAULT;
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "i*x*z", plist_id, buf, nalloc);
+
+ /* 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");
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&temp_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")
+
+ /* Call the internal encode routine */
+ if((ret_value = H5P__encode(plist, TRUE, buf, nalloc)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to encode property list");
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Pencode1() */
+
/*-------------------------------------------------------------------------
* Function: H5Pset_file_space
*
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index 8338d84..df9cf4e 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -695,7 +695,7 @@ H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size)
HDassert(pexp);
/* Copy the expression into the buffer */
- HDmemcpy(*pp, (const uint8_t *)pexp, len);
+ H5MM_memcpy(*pp, (const uint8_t *)pexp, len);
*pp += len;
*pp[0] = '\0';
} /* end if */
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index bfb52ff..585e913 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -1064,7 +1064,7 @@ H5P__file_driver_copy(void *value)
else if(driver->fapl_size > 0) {
if(NULL == (new_pl = H5MM_malloc(driver->fapl_size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "driver info allocation failed")
- HDmemcpy(new_pl, info->driver_info, driver->fapl_size);
+ H5MM_memcpy(new_pl, info->driver_info, driver->fapl_size);
} /* end else-if */
else
HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "no way to copy driver info")
@@ -2597,7 +2597,7 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed")
} /* end if */
else
- HDmemcpy(image_info.buffer, buf_ptr, buf_len);
+ H5MM_memcpy(image_info.buffer, buf_ptr, buf_len);
} /* end if */
else
image_info.buffer = NULL;
@@ -2691,7 +2691,7 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed")
} /* end if */
else
- HDmemcpy(copy_ptr, image_info.buffer, image_info.size);
+ H5MM_memcpy(copy_ptr, image_info.buffer, image_info.size);
} /* end if */
*buf_ptr_ptr = copy_ptr;
@@ -2894,7 +2894,7 @@ H5P__file_image_info_copy(void *value)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "image_memcpy callback failed")
} /* end if */
else
- HDmemcpy(info->buffer, old_buffer, info->size);
+ H5MM_memcpy(info->buffer, old_buffer, info->size);
} /* end if */
/* Copy udata if it exists */
@@ -3089,7 +3089,7 @@ H5P__facc_cache_image_config_dec(const void **_pp, void *_value)
HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
/* Set property to default value */
- HDmemcpy(config, &H5F_def_mdc_initCacheImageCfg_g, sizeof(H5AC_cache_image_config_t));
+ H5MM_memcpy(config, &H5F_def_mdc_initCacheImageCfg_g, sizeof(H5AC_cache_image_config_t));
/* Decode type sizes */
enc_size = *(*pp)++;
@@ -3480,7 +3480,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size)
H5_ENCODE_UNSIGNED(*pp, config->close_trace_file);
- HDmemcpy(*pp, (const uint8_t *)(config->trace_file_name), (size_t)(H5AC__MAX_TRACE_FILE_NAME_LEN + 1));
+ H5MM_memcpy(*pp, (const uint8_t *)(config->trace_file_name), (size_t)(H5AC__MAX_TRACE_FILE_NAME_LEN + 1));
*pp += H5AC__MAX_TRACE_FILE_NAME_LEN + 1;
H5_ENCODE_UNSIGNED(*pp, config->evictions_enabled);
@@ -3615,7 +3615,7 @@ H5P__facc_cache_config_dec(const void **_pp, void *_value)
HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
/* Set property to default value */
- HDmemcpy(config, &H5F_def_mdc_initCacheCfg_g, sizeof(H5AC_cache_config_t));
+ H5MM_memcpy(config, &H5F_def_mdc_initCacheCfg_g, sizeof(H5AC_cache_config_t));
/* Decode type sizes */
enc_size = *(*pp)++;
@@ -4195,7 +4195,7 @@ H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled, char *location,
/* Copy log location to output buffer */
if(location_ptr && location)
- HDmemcpy(location, location_ptr, *location_size);
+ H5MM_memcpy(location, location_ptr, *location_size);
/* Get location size, including terminating NULL */
if(location_size) {
@@ -4250,7 +4250,7 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size)
/* encode the prefix */
if(NULL != log_location) {
- HDmemcpy(*(char **)pp, log_location, len);
+ H5MM_memcpy(*(char **)pp, log_location, len);
*pp += len;
} /* end if */
} /* end if */
@@ -4536,7 +4536,7 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size)
if(NULL != *pp) {
/* Encode the value */
- HDmemcpy(*pp, coll_md_read_flag, sizeof(H5P_coll_md_read_flag_t));
+ H5MM_memcpy(*pp, coll_md_read_flag, sizeof(H5P_coll_md_read_flag_t));
*pp += sizeof(H5P_coll_md_read_flag_t);
} /* end if */
@@ -4907,6 +4907,43 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5P_reset_vol_class
+ *
+ * Purpose: Change the VOL connector for a file access property class.
+ *
+ * Note: The VOL property will be copied into the property list and
+ * the reference count on the previous VOL will _NOT_ be decremented.
+ * The reference count on the new VOL will _NOT_ be incremented.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * March 8, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P_reset_vol_class(const H5P_genclass_t *pclass, const H5VL_connector_prop_t *vol_prop)
+{
+ H5VL_connector_prop_t old_vol_prop; /* Previous VOL connector property */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Get the connector ID & info property */
+ if(H5P__class_get(pclass, H5F_ACS_VOL_CONN_NAME, &old_vol_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector ID & info")
+
+ /* Set the new connector ID & info property */
+ if(H5P__class_set(pclass, H5F_ACS_VOL_CONN_NAME, vol_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL connector ID & info")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_set_vol_class() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Pset_vol
*
* Purpose: Set the file VOL connector (VOL_ID) for a file access
diff --git a/src/H5Pint.c b/src/H5Pint.c
index e2ae792..b07f42d 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -631,7 +631,7 @@ H5P__do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb)
/* Allocate space for a temporary copy of the property value */
if(NULL == (tmp_value = H5MM_malloc(prop->size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary property value")
- HDmemcpy(tmp_value, prop->value, prop->size);
+ H5MM_memcpy(tmp_value, prop->value, prop->size);
/* Call "type 1" callback ('create', 'copy' or 'close') */
if(cb(prop->name, prop->size, tmp_value) < 0)
@@ -642,7 +642,7 @@ H5P__do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb)
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);
+ H5MM_memcpy(pcopy->value, tmp_value, prop->size);
/* Insert the changed property into the property list */
if(H5P__add_prop(slist, pcopy) < 0)
@@ -990,7 +990,7 @@ H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy basic property information */
- HDmemcpy(prop, oprop, sizeof(H5P_genprop_t));
+ H5MM_memcpy(prop, oprop, sizeof(H5P_genprop_t));
/* Check if we should duplicate the name or share it */
@@ -1030,7 +1030,7 @@ H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type)
HDassert(prop->size > 0);
if(NULL == (prop->value = H5MM_malloc(prop->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(prop->value, oprop->value, prop->size);
+ H5MM_memcpy(prop->value, oprop->value, prop->size);
} /* end if */
/* Set return value */
@@ -1117,7 +1117,7 @@ H5P__create_prop(const char *name, size_t size, H5P_prop_within_t type,
if(value != NULL) {
if(NULL == (prop->value = H5MM_malloc (prop->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(prop->value, value, prop->size);
+ H5MM_memcpy(prop->value, value, prop->size);
} /* end if */
else
prop->value = NULL;
@@ -2727,7 +2727,7 @@ H5P__poke_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size")
/* Overwrite value in property */
- HDmemcpy(prop->value, udata->value, prop->size);
+ H5MM_memcpy(prop->value, udata->value, prop->size);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2779,7 +2779,7 @@ H5P__poke_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop
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);
+ H5MM_memcpy(pcopy->value, udata->value, pcopy->size);
/* Insert the changed property into the property list */
if(H5P__add_prop(plist->props, pcopy) < 0)
@@ -2888,7 +2888,7 @@ H5P__set_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
/* Make a copy of the current value, in case the callback fails */
if(NULL == (tmp_value = H5MM_malloc(prop->size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value")
- HDmemcpy(tmp_value, udata->value, prop->size);
+ H5MM_memcpy(tmp_value, udata->value, prop->size);
/* Call user's callback */
if((*(prop->set))(plist->plist_id, name, prop->size, tmp_value) < 0)
@@ -2909,7 +2909,7 @@ H5P__set_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
} /* end if */
/* Copy new [possibly unchanged] value into property value */
- HDmemcpy(prop->value, prp_value, prop->size);
+ H5MM_memcpy(prop->value, prp_value, prop->size);
done:
/* Free the temporary value buffer */
@@ -2968,7 +2968,7 @@ H5P__set_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
/* Make a copy of the current value, in case the callback fails */
if(NULL == (tmp_value = H5MM_malloc(prop->size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value")
- HDmemcpy(tmp_value, udata->value, prop->size);
+ H5MM_memcpy(tmp_value, udata->value, prop->size);
/* Call user's callback */
if((*(prop->set))(plist->plist_id, name, prop->size, tmp_value) < 0)
@@ -2985,7 +2985,7 @@ H5P__set_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
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);
+ H5MM_memcpy(pcopy->value, prp_value, pcopy->size);
/* Insert the changed property into the property list */
if(H5P__add_prop(plist->props, pcopy) < 0)
@@ -3061,6 +3061,116 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5P__class_get
+ PURPOSE
+ Internal routine to get a property's value from a property class.
+ USAGE
+ herr_t H5P__class_get(pclass, name, value)
+ const H5P_genclass_t *pclass; IN: Property class to find property in
+ const char *name; IN: Name of property to get
+ void *value; IN: Pointer to the value for the property
+ RETURNS
+ Returns non-negative on success, negative on failure.
+ DESCRIPTION
+ Gets the current value for a property in a property class. The property
+ name must exist or this routine will fail.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ The 'get' callback routine registered for this property will _NOT_ be
+ called, this routine is designed for internal library use only!
+
+ This routine may not be called for zero-sized properties and will
+ return an error in that case.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5P__class_get(const H5P_genclass_t *pclass, const char *name, void *value)
+{
+ H5P_genprop_t *prop; /* Temporary property pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(pclass);
+ HDassert(name);
+ HDassert(value);
+
+ /* Find property in list */
+ if(NULL == (prop = (H5P_genprop_t *)H5SL_search(pclass->props, name)))
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist")
+
+ /* Check for property size >0 */
+ if(0 == prop->size)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size")
+
+ /* Copy the property value */
+ HDmemcpy(value, prop->value, prop->size);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5P__class_get() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5P__class_set
+ PURPOSE
+ Internal routine to set a property's value in a property class.
+ USAGE
+ herr_t H5P__class_set(pclass, name, value)
+ const H5P_genclass_t *pclass; IN: Property class to find property in
+ const char *name; IN: Name of property to set
+ const void *value; IN: Pointer to the value for the property
+ RETURNS
+ Returns non-negative on success, negative on failure.
+ DESCRIPTION
+ Sets a new value for a property in a property class. The property name
+ must exist or this routine will fail.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ The 'set' callback routine registered for this property will _NOT_ be
+ called, this routine is designed for internal library use only!
+
+ This routine may not be called for zero-sized properties and will
+ return an error in that case.
+
+ The previous value is overwritten, not released in any way.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5P__class_set(const H5P_genclass_t *pclass, const char *name, const void *value)
+{
+ H5P_genprop_t *prop; /* Temporary property pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(pclass);
+ HDassert(name);
+ HDassert(value);
+
+ /* Find property in list */
+ if(NULL == (prop = (H5P_genprop_t *)H5SL_search(pclass->props, name)))
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist")
+
+ /* Check for property size >0 */
+ if(0 == prop->size)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size")
+
+ /* Copy the property value */
+ HDmemcpy(prop->value, value, prop->size);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5P__class_set() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5P_exist_plist
PURPOSE
Internal routine to query the existance of a property in a property list.
@@ -4234,7 +4344,7 @@ H5P__peek_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 (shallow) copy of the value */
- HDmemcpy(udata->value, prop->value, prop->size);
+ H5MM_memcpy(udata->value, prop->value, prop->size);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -4334,18 +4444,18 @@ H5P__get_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
/* Make a copy of the current value, in case the callback fails */
if(NULL == (tmp_value = H5MM_malloc(prop->size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value")
- HDmemcpy(tmp_value, prop->value, prop->size);
+ H5MM_memcpy(tmp_value, prop->value, prop->size);
/* Call user's callback */
if((*(prop->get))(plist->plist_id, name, prop->size, tmp_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value")
/* Copy new [possibly unchanged] value into return value */
- HDmemcpy(udata->value, tmp_value, prop->size);
+ H5MM_memcpy(udata->value, tmp_value, prop->size);
} /* end if */
/* No 'get' callback, just copy value */
else
- HDmemcpy(udata->value, prop->value, prop->size);
+ H5MM_memcpy(udata->value, prop->value, prop->size);
done:
/* Free the temporary value buffer */
@@ -4518,7 +4628,7 @@ H5P__del_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
/* Allocate space for a temporary copy of the property value */
if(NULL == (tmp_value = H5MM_malloc(prop->size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary property value")
- HDmemcpy(tmp_value, prop->value, prop->size);
+ H5MM_memcpy(tmp_value, prop->value, prop->size);
/* Call user's callback */
if((*(prop->del))(plist->plist_id, name, prop->size, tmp_value) < 0)
@@ -4967,7 +5077,7 @@ H5P_close(void *_plist)
/* Allocate space for a temporary copy of the property value */
if(NULL==(tmp_value=H5MM_malloc(tmp->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for temporary property value")
- HDmemcpy(tmp_value,tmp->value,tmp->size);
+ H5MM_memcpy(tmp_value,tmp->value,tmp->size);
/* Call the 'close' callback */
(tmp->close)(tmp->name,tmp->size,tmp_value);
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index bedeed9..7a7cc23 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -715,7 +715,7 @@ H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size)
/* encode the prefix */
if(NULL != elink_pref) {
- HDmemcpy(*(char **)pp, elink_pref, len);
+ H5MM_memcpy(*(char **)pp, elink_pref, len);
*pp += len;
} /* end if */
} /* end if */
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index c2bf6cb..a60c593 100644
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -1501,7 +1501,7 @@ H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size)
*(*pp)++ = (uint8_t)TRUE;
/* encode filter name */
- HDmemcpy(*pp, (uint8_t *)(pline->filter[u].name), H5Z_COMMON_NAME_LEN);
+ H5MM_memcpy(*pp, (uint8_t *)(pline->filter[u].name), H5Z_COMMON_NAME_LEN);
*pp += H5Z_COMMON_NAME_LEN;
} /* end if */
else
diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c
index 666a945..2dc92f9 100644
--- a/src/H5Pocpypl.c
+++ b/src/H5Pocpypl.c
@@ -384,7 +384,7 @@ H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size)
/* Encode merge committed dtype list */
if(*pp) {
- HDmemcpy(*(char **)pp, dt_list->path, len);
+ H5MM_memcpy(*(char **)pp, dt_list->path, len);
*pp += len;
} /* end if */
diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h
index 13f3b13..c8e5e98 100644
--- a/src/H5Ppkg.h
+++ b/src/H5Ppkg.h
@@ -151,6 +151,10 @@ H5_DLL herr_t H5P__register(H5P_genclass_t **pclass, const char *name, size_t si
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 herr_t H5P__class_get(const H5P_genclass_t *pclass, const char *name,
+ void *value);
+H5_DLL herr_t H5P__class_set(const H5P_genclass_t *pclass, const char *name,
+ const void *value);
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);
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 866f088..49f7a12 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -148,6 +148,7 @@ H5_DLLVAR const struct H5P_libclass_t H5P_CLS_OCPY[1]; /* Object copy */
/* Forward declaration of structs used below */
struct H5O_fill_t;
struct H5T_t;
+struct H5VL_connector_prop_t;
/* Package initialization routine */
H5_DLL herr_t H5P_init(void);
@@ -178,6 +179,8 @@ 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_reset_vol_class(const H5P_genclass_t *pclass,
+ const struct H5VL_connector_prop_t *vol_prop);
H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist,
H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func,
void *free_info);
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 078fe74..90e6618 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -236,7 +236,7 @@ H5_DLL herr_t H5Pinsert2(hid_t plist_id, const char *name, size_t size,
H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close);
H5_DLL herr_t H5Pset(hid_t plist_id, const char *name, const void *value);
H5_DLL htri_t H5Pexist(hid_t plist_id, const char *name);
-H5_DLL herr_t H5Pencode(hid_t plist_id, void *buf, size_t *nalloc);
+H5_DLL herr_t H5Pencode2(hid_t plist_id, void *buf, size_t *nalloc, hid_t fapl_id);
H5_DLL hid_t H5Pdecode(const void *buf);
H5_DLL herr_t H5Pget_size(hid_t id, const char *name, size_t *size);
H5_DLL herr_t H5Pget_nprops(hid_t id, size_t *nprops);
@@ -536,6 +536,7 @@ H5_DLL herr_t H5Pinsert1(hid_t plist_id, const char *name, size_t size,
void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy,
H5P_prp_close_func_t prp_close);
+H5_DLL herr_t H5Pencode1(hid_t plist_id, void *buf, size_t *nalloc);
H5_DLL H5Z_filter_t H5Pget_filter1(hid_t plist_id, unsigned filter,
unsigned int *flags/*out*/, size_t *cd_nelmts/*out*/,
unsigned cd_values[]/*out*/, size_t namelen, char name[]);
diff --git a/src/H5Rint.c b/src/H5Rint.c
index a4f76ce..9098a03 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -215,6 +215,9 @@ H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H
obj_loc.path = &path;
H5G_loc_reset(&obj_loc);
+ /* Set the FAPL for the API context */
+ H5CX_set_libver_bounds(loc->oloc->file);
+
/* Find the object */
if(H5G_loc_find(loc, name, &obj_loc) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "object not found")
diff --git a/src/H5S.c b/src/H5S.c
index 3a917bc..3926b5f 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -23,9 +23,11 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Fprivate.h" /* Files */
#include "H5FLprivate.h" /* Free lists */
#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h" /* Object headers */
#include "H5Spkg.h" /* Dataspaces */
@@ -65,6 +67,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
const unsigned H5O_sdspace_ver_bounds[] = {
H5O_SDSPACE_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V110 */
H5O_SDSPACE_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -1359,7 +1362,7 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
* same as the dimension */
space->extent.max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)rank);
if(max != NULL)
- HDmemcpy(space->extent.max, max, sizeof(hsize_t) * rank);
+ H5MM_memcpy(space->extent.max, max, sizeof(hsize_t) * rank);
else
for(u = 0; u < space->extent.rank; u++)
space->extent.max[u] = dims[u];
@@ -1485,13 +1488,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Sencode
+ * Function: H5Sencode2
*
* Purpose: Given a dataspace ID, converts the object description
* (including selection) into binary in a buffer.
+ * The selection will be encoded according to the file
+ * format setting in fapl.
*
* Return: Success: non-negative
- * Failure: negative
+ * Failure: negative
*
* Programmer: Raymond Lu
* slu@ncsa.uiuc.edu
@@ -1500,24 +1505,29 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Sencode(hid_t obj_id, void *buf, size_t *nalloc)
+H5Sencode2(hid_t obj_id, void *buf, size_t *nalloc, hid_t fapl_id)
{
H5S_t *dspace;
herr_t ret_value=SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*x*z", obj_id, buf, nalloc);
+ H5TRACE4("e", "i*x*zi", obj_id, buf, nalloc, fapl_id);
/* Check argument and retrieve object */
if(NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ /* 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")
+
if(H5S_encode(dspace, (unsigned char **)&buf, nalloc) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Sencode() */
+} /* H5Sencode2() */
/*-------------------------------------------------------------------------
diff --git a/src/H5SL.c b/src/H5SL.c
index c0934ca..5f00fb8 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -240,7 +240,7 @@
/* Allocate space for new forward pointers */ \
if(NULL == (_tmp = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[X->log_nalloc]))) \
HGOTO_ERROR(H5E_SLIST, H5E_CANTALLOC, ERR, "memory allocation failed") \
- HDmemcpy((void *)_tmp, (const void *)X->forward, (LVL + 1) * sizeof(H5SL_node_t *)); \
+ H5MM_memcpy((void *)_tmp, (const void *)X->forward, (LVL + 1) * sizeof(H5SL_node_t *)); \
X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc-1], (void *)X->forward); \
X->forward = _tmp; \
} /* end if */ \
@@ -262,7 +262,7 @@
/* Allocate space for new forward pointers */ \
if(NULL == (_tmp = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[X->log_nalloc]))) \
HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed") \
- HDmemcpy((void *)_tmp, (const void *)X->forward, (LVL) * sizeof(H5SL_node_t *)); \
+ H5MM_memcpy((void *)_tmp, (const void *)X->forward, (LVL) * sizeof(H5SL_node_t *)); \
X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc+1], (void *)X->forward); \
X->forward = _tmp; \
} /* end if */ \
diff --git a/src/H5SM.c b/src/H5SM.c
index 0fa3489..3946f51 100644
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -2318,7 +2318,7 @@ H5SM__read_iter_op(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed")
/* Copy the encoded message into the buffer to return */
- HDmemcpy(udata->encoding_buf, mesg->raw, udata->buf_size);
+ H5MM_memcpy(udata->encoding_buf, mesg->raw, udata->buf_size);
/* Found the message we were looking for */
ret_value = H5_ITER_STOP;
@@ -2356,7 +2356,7 @@ H5SM__read_mesg_fh_cb(const void *obj, size_t obj_len, void *_udata)
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Copy the message from the heap */
- HDmemcpy(udata->encoding_buf, obj, obj_len);
+ H5MM_memcpy(udata->encoding_buf, obj, obj_len);
udata->buf_size = obj_len;
done:
diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c
index f0c4963..7f6c804 100644
--- a/src/H5SMbtree2.c
+++ b/src/H5SMbtree2.c
@@ -24,6 +24,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object Headers */
#include "H5SMpkg.h" /* Shared object header messages */
@@ -248,7 +249,7 @@ H5SM_bt2_convert_to_list_op(const void * record, void *op_data)
/* Insert this message at the end of the list */
HDassert(list->messages[mesg_idx].location == H5SM_NO_LOC);
HDassert(message->location != H5SM_NO_LOC);
- HDmemcpy(&(list->messages[mesg_idx]), message, sizeof(H5SM_sohm_t));
+ H5MM_memcpy(&(list->messages[mesg_idx]), message, sizeof(H5SM_sohm_t));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5SM_bt2_convert_to_list_op() */
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index f0b469a..49ce2b4 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -388,7 +388,7 @@ H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t len,
HDassert(H5F_SOHM_VERS(f) == HDF5_SHAREDHEADER_VERSION);
/* Encode magic number */
- HDmemcpy(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Encode each index header */
@@ -710,7 +710,7 @@ H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t len,
HDassert(list->header->list_size == len);
/* Encode magic number */
- HDmemcpy(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* serialize messages from the messages array */
diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c
index ad84b24..0cca6bb 100644
--- a/src/H5SMmessage.c
+++ b/src/H5SMmessage.c
@@ -24,6 +24,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object Headers */
#include "H5SMpkg.h" /* Shared object header messages */
@@ -302,7 +303,7 @@ H5SM__message_encode(uint8_t *raw, const void *_nrecord, void *_ctx)
if(message->location == H5SM_IN_HEAP) {
UINT32ENCODE(raw, message->u.heap_loc.ref_count);
- HDmemcpy(raw, message->u.heap_loc.fheap_id.id, (size_t)H5O_FHEAP_ID_LEN);
+ H5MM_memcpy(raw, message->u.heap_loc.fheap_id.id, (size_t)H5O_FHEAP_ID_LEN);
} /* end if */
else {
HDassert(message->location == H5SM_IN_OH);
@@ -343,7 +344,7 @@ H5SM__message_decode(const uint8_t *raw, void *_nrecord, void *_ctx)
if(message->location == H5SM_IN_HEAP) {
UINT32DECODE(raw, message->u.heap_loc.ref_count);
- HDmemcpy(message->u.heap_loc.fheap_id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
+ H5MM_memcpy(message->u.heap_loc.fheap_id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
} /* end if */
else {
HDassert(message->location == H5SM_IN_OH);
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 0aa2f05..7aa9644 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -58,8 +58,7 @@ static herr_t H5S__all_release(H5S_t *space);
static htri_t H5S__all_is_valid(const H5S_t *space);
static hssize_t H5S__all_serial_size(const H5S_t *space);
static herr_t H5S__all_serialize(const H5S_t *space, uint8_t **p);
-static herr_t H5S__all_deserialize(H5S_t *space, uint32_t version, uint8_t flags,
- const uint8_t **p);
+static herr_t H5S__all_deserialize(H5S_t **space, const uint8_t **p);
static herr_t H5S__all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static herr_t H5S__all_offset(const H5S_t *space, hsize_t *off);
static int H5S__all_unlim_dim(const H5S_t *space);
@@ -630,7 +629,7 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p)
/* Store the preamble information */
UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
- UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */
+ UINT32ENCODE(pp, (uint32_t)H5S_ALL_VERSION_1); /* Store the version number */
UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */
@@ -648,10 +647,8 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p)
Deserialize the current selection from a user-provided buffer.
USAGE
herr_t H5S_all_deserialize(space, p)
- H5S_t *space; IN/OUT: Dataspace pointer to place
+ H5S_t **space; IN/OUT: Dataspace pointer to place
selection into
- uint32_t version IN: Selection version
- uint8_t flags IN: Selection flags
uint8 **p; OUT: Pointer to buffer holding serialized
selection. Will be advanced to end of
serialized selection.
@@ -666,22 +663,51 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__all_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags,
- const uint8_t H5_ATTR_UNUSED **p)
+H5S__all_deserialize(H5S_t **space, const uint8_t **p)
{
+ uint32_t version; /* Version number */
+ H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use,
+ either *space or a newly allocated one */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_STATIC
- HDassert(space);
HDassert(p);
HDassert(*p);
+ /* As part of the efforts to push all selection-type specific coding
+ to the callbacks, the coding for the allocation of a null dataspace
+ is moved from H5S_select_deserialize() in H5Sselect.c.
+ This is needed for decoding virtual layout in H5O__layout_decode() */
+
+ /* Allocate space if not provided */
+ if(!*space) {
+ if(NULL == (tmp_space = H5S_create(H5S_SIMPLE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace")
+ } /* end if */
+ else
+ tmp_space = *space;
+
+ /* Decode version */
+ UINT32DECODE(*p, version);
+
+ /* Skip over the remainder of the header */
+ *p += 8;
+
/* Change to "all" selection */
- if(H5S_select_all(space, TRUE) < 0)
+ if(H5S_select_all(tmp_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
+ /* Return space to the caller if allocated */
+ if(!*space)
+ *space = tmp_space;
+
done:
+ /* Free temporary space if not passed to caller (only happens on error) */
+ if(!*space && tmp_space)
+ if(H5S_close(tmp_space) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__all_deserialize() */
diff --git a/src/H5Sdeprec.c b/src/H5Sdeprec.c
new file mode 100644
index 0000000..e4ec1b0
--- /dev/null
+++ b/src/H5Sdeprec.c
@@ -0,0 +1,121 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: H5Sdeprec.c
+ *
+ * Purpose: Deprecated functions from the H5S interface. These
+ * functions are here for compatibility purposes and may be
+ * removed in the future. Applications should switch to the
+ * newer APIs.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Smodule.h" /* This source code file is part of the H5S module */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Spkg.h" /* Dataspaces */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/*-------------------------------------------------------------------------
+ * Function: H5Sencode1
+ *
+ * Purpose: Given a dataspace ID, converts the object description
+ * (including selection) into binary in a buffer.
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Raymond Lu
+ * slu@ncsa.uiuc.edu
+ * July 14, 2004
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Sencode1(hid_t obj_id, void *buf, size_t *nalloc)
+{
+ H5S_t *dspace;
+ hid_t temp_fapl_id = H5P_DEFAULT;
+ herr_t ret_value=SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "i*x*z", obj_id, buf, nalloc);
+
+ /* Check argument and retrieve object */
+ if (NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&temp_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")
+
+ /* Use (earliest, latest) i.e. not latest format */
+ if(H5S_encode(dspace, (unsigned char **)&buf, nalloc)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Sencode1() */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index c9fab38..a6494d9 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -28,12 +28,14 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* ID Functions */
-#include "H5Spkg.h" /* Dataspace functions */
-#include "H5VMprivate.h" /* Vector functions */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Spkg.h" /* Dataspace functions */
+#include "H5VMprivate.h" /* Vector functions */
/****************/
@@ -94,8 +96,7 @@ static herr_t H5S__hyper_release(H5S_t *space);
static htri_t H5S__hyper_is_valid(const H5S_t *space);
static hssize_t H5S__hyper_serial_size(const H5S_t *space);
static herr_t H5S__hyper_serialize(const H5S_t *space, uint8_t **p);
-static herr_t H5S__hyper_deserialize(H5S_t *space, uint32_t version, uint8_t flags,
- const uint8_t **p);
+static herr_t H5S__hyper_deserialize(H5S_t **space, const uint8_t **p);
static herr_t H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static herr_t H5S__hyper_offset(const H5S_t *space, hsize_t *offset);
static int H5S__hyper_unlim_dim(const H5S_t *space);
@@ -157,6 +158,13 @@ const H5S_select_class_t H5S_sel_hyper[1] = {{
H5S__hyper_iter_init,
}};
+/* Format version bounds for dataspace hyperslab selection */
+const unsigned H5O_sds_hyper_ver_bounds[] = {
+ H5S_HYPER_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5S_HYPER_VERSION_1, /* H5F_LIBVER_V18 */
+ H5S_HYPER_VERSION_2, /* H5F_LIBVER_V110 */
+ H5S_HYPER_VERSION_3 /* H5F_LIBVER_LATEST */
+};
/*******************/
/* Local Variables */
@@ -554,10 +562,10 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
HDassert(v < 0);
} /* end if */
else
- HDmemcpy(coords, iter->u.hyp.off, sizeof(hsize_t) * iter->rank);
+ H5MM_memcpy(coords, iter->u.hyp.off, sizeof(hsize_t) * iter->rank);
} /* end if */
else
- HDmemcpy(coords, iter->u.hyp.off, sizeof(hsize_t) * iter->rank);
+ H5MM_memcpy(coords, iter->u.hyp.off, sizeof(hsize_t) * iter->rank);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S__hyper_iter_coords() */
@@ -3204,8 +3212,9 @@ H5S__hyper_span_nblocks(const H5S_hyper_span_info_t *spans)
PURPOSE
Get the number of hyperslab blocks in current hyperslab selection
USAGE
- hsize_t H5S__get_select_hyper_nblocks(space)
+ hsize_t H5S__get_select_hyper_nblocks(space, app_ref)
H5S_t *space; IN: Dataspace ptr of selection to query
+ hbool_t app_ref; IN: Whether this is an appl. ref. call
RETURNS
The number of hyperslab blocks in selection on success, negative on failure
DESCRIPTION
@@ -3216,7 +3225,7 @@ H5S__hyper_span_nblocks(const H5S_hyper_span_info_t *spans)
REVISION LOG
--------------------------------------------------------------------------*/
static hsize_t
-H5S__get_select_hyper_nblocks(const H5S_t *space)
+H5S__get_select_hyper_nblocks(const H5S_t *space, hbool_t app_ref)
{
hsize_t ret_value = 0; /* Return value */
@@ -3231,7 +3240,8 @@ H5S__get_select_hyper_nblocks(const H5S_t *space)
/* Check each dimension */
for(ret_value = 1, u = 0; u < space->extent.rank; u++)
- ret_value *= space->select.sel_info.hslab->app_diminfo[u].count;
+ ret_value *= (app_ref ? space->select.sel_info.hslab->app_diminfo[u].count :
+ space->select.sel_info.hslab->opt_diminfo[u].count);
} /* end if */
else
ret_value = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst);
@@ -3274,7 +3284,7 @@ H5Sget_select_hyper_nblocks(hid_t spaceid)
if(space->select.sel_info.hslab->unlim_dim >= 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "cannot get number of blocks for unlimited selection")
- ret_value = (hssize_t)H5S__get_select_hyper_nblocks(space);
+ ret_value = (hssize_t)H5S__get_select_hyper_nblocks(space, TRUE);
done:
FUNC_LEAVE_API(ret_value)
@@ -3283,6 +3293,210 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5S__hyper_get_enc_size_real
+ PURPOSE
+ Determine the size to encode the hyperslab selection info
+ USAGE
+ hssize_t H5S__hyper_get_enc_size_real(max_size, enc_size)
+ hsize_t max_size: IN: The maximum size of the hyperslab selection info
+ unint8_t *enc_size: OUT:The encoding size
+ RETURNS
+ The size to encode hyperslab selection info
+ DESCRIPTION
+ Determine the size by comparing "max_size" with (2^32 - 1) and (2^16 - 1).
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static uint8_t
+H5S__hyper_get_enc_size_real(hsize_t max_size)
+{
+ uint8_t ret_value = H5S_SELECT_INFO_ENC_SIZE_2;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ if(max_size > H5S_UINT32_MAX)
+ ret_value = H5S_SELECT_INFO_ENC_SIZE_8;
+ else if(max_size > H5S_UINT16_MAX)
+ ret_value = H5S_SELECT_INFO_ENC_SIZE_4;
+ else
+ ret_value = H5S_SELECT_INFO_ENC_SIZE_2;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S__hyper_get_enc_size_real() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__hyper_get_version_enc_size
+ PURPOSE
+ Determine the version and encoded size to use for encoding hyperslab selection info
+ USAGE
+ hssize_t H5S__hyper_get_version_enc_size(space, block_count, version, enc_size)
+ const H5S_t *space: IN: The dataspace
+ hsize_t block_count: IN: The number of blocks in the selection
+ uint32_t *version: OUT: The version to use for encoding
+ uint8_t *enc_size: OUT: The encoded size to use
+
+ RETURNS
+ The version and the size to encode hyperslab selection info
+ DESCRIPTION
+ Determine the version to use for encoding hyperslab selection info based
+ on the following:
+ (1) the file format setting in fapl
+ (2) whether the number of blocks or selection high bounds exceeds H5S_UINT32_MAX or not
+
+ Determine the encoded size based on version:
+ For version 3, the encoded size is determined according to:
+ (a) regular hyperslab
+ (1) The maximum needed to store start/stride/count/block
+ (2) Special handling for count/block: need to provide room for H5S_UNLIMITED
+ (b) irregular hyperslab
+ The maximum size needed to store:
+ (1) the number of blocks
+ (2) the selection high bounds
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__hyper_get_version_enc_size(const H5S_t *space, hsize_t block_count, uint32_t *version, uint8_t *enc_size)
+{
+ hsize_t bounds_start[H5S_MAX_RANK]; /* Starting coordinate of bounding box */
+ hsize_t bounds_end[H5S_MAX_RANK]; /* Opposite coordinate of bounding box */
+ hbool_t count_up_version = FALSE; /* Whether number of blocks exceed H5S_UINT32_MAX */
+ hbool_t bound_up_version = FALSE; /* Whether high bounds exceed H5S_UINT32_MAX */
+ H5F_libver_t low_bound; /* The 'low' bound of library format versions */
+ H5F_libver_t high_bound; /* The 'high' bound of library format versions */
+ htri_t is_regular; /* A regular hyperslab or not */
+ uint32_t tmp_version; /* Local temporay version */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Get bounding box for the selection */
+ HDmemset(bounds_end, 0, sizeof(bounds_end));
+
+ if(space->select.sel_info.hslab->unlim_dim < 0) { /* ! H5S_UNLIMITED */
+ /* Get bounding box for the selection */
+ if(H5S__hyper_bounds(space, bounds_start, bounds_end) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds")
+ }
+
+ /* Determine whether the number of blocks or the high bounds in the selection exceed (2^32 - 1) */
+ if(block_count > H5S_UINT32_MAX)
+ count_up_version = TRUE;
+ else {
+ for(u = 0; u < space->extent.rank; u++)
+ if(bounds_end[u] > H5S_UINT32_MAX) {
+ bound_up_version = TRUE;
+ break;
+ }
+ }
+
+ /* Get the file's low_bound and high_bound */
+ if(H5CX_get_libver_bounds(&low_bound, &high_bound) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get low/high bounds from API context")
+
+ /* Determine regular hyperslab */
+ is_regular = H5S__hyper_is_regular(space);
+
+ if(low_bound >= H5F_LIBVER_V112 || space->select.sel_info.hslab->unlim_dim >= 0)
+ tmp_version = MAX(H5S_HYPER_VERSION_2, H5O_sds_hyper_ver_bounds[low_bound]);
+
+ else {
+ if(count_up_version || bound_up_version)
+ tmp_version = is_regular ? H5S_HYPER_VERSION_2 : H5S_HYPER_VERSION_3;
+ else
+ tmp_version = (is_regular && block_count >= 4) ? H5O_sds_hyper_ver_bounds[low_bound] : H5S_HYPER_VERSION_1;
+
+ }
+
+ /* Version bounds check */
+ if(tmp_version > H5O_sds_hyper_ver_bounds[high_bound]) {
+ /* Fail for irregular hyperslab if exceeds 32 bits */
+ if(count_up_version)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The number of blocks in hyperslab selection exceeds 2^32")
+ else if(bound_up_version)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The end of bounding box in hyperslab selection exceeds 2^32")
+ else
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "Dataspace hyperslab selection version out of bounds")
+ }
+
+ /* Set the message version */
+ *version = tmp_version;
+
+ /* Determine the encoded size based on version */
+ switch(tmp_version) {
+ case H5S_HYPER_VERSION_1:
+ *enc_size = H5S_SELECT_INFO_ENC_SIZE_4;
+ break;
+
+ case H5S_HYPER_VERSION_2:
+ *enc_size = H5S_SELECT_INFO_ENC_SIZE_8;
+ break;
+
+ case H5S_HYPER_VERSION_3:
+ if(is_regular) {
+ uint8_t enc1, enc2;
+ hsize_t max1 = 0;
+ hsize_t max2 = 0;
+
+ /* Find max for count[] and block[] */
+ for(u = 0; u < space->extent.rank; u++) {
+ if(space->select.sel_info.hslab->opt_diminfo[u].count != H5S_UNLIMITED &&
+ space->select.sel_info.hslab->opt_diminfo[u].count > max1)
+ max1 = space->select.sel_info.hslab->opt_diminfo[u].count;
+ if(space->select.sel_info.hslab->opt_diminfo[u].block != H5S_UNLIMITED &&
+ space->select.sel_info.hslab->opt_diminfo[u].block > max1)
+ max1 = space->select.sel_info.hslab->opt_diminfo[u].block;
+ }
+
+ /* +1 to provide room for H5S_UNLIMITED */
+ enc1 = H5S__hyper_get_enc_size_real(++max1);
+
+ /* Find max for start[] and stride[] */
+ for(u = 0; u < space->extent.rank; u++) {
+ if(space->select.sel_info.hslab->opt_diminfo[u].start > max2)
+ max2 = space->select.sel_info.hslab->opt_diminfo[u].start;
+ if(space->select.sel_info.hslab->opt_diminfo[u].stride > max2)
+ max2 = space->select.sel_info.hslab->opt_diminfo[u].stride;
+ }
+
+ /* Determine the encoding size */
+ enc2 = H5S__hyper_get_enc_size_real(max2);
+
+ *enc_size = MAX(enc1, enc2);
+ } else {
+ hsize_t max_size = block_count;
+ HDassert(space->select.sel_info.hslab->unlim_dim < 0);
+
+ /* Find max for block_count and bounds_end[] */
+ for(u = 0; u < space->extent.rank; u++)
+ if(bounds_end[u] > max_size)
+ max_size = bounds_end[u];
+
+ /* Determine the encoding size */
+ *enc_size = H5S__hyper_get_enc_size_real(max_size);
+ }
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown hyperslab selection version")
+ break;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S__hyper_get_version_enc_size() */
+
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5S__hyper_serial_size
PURPOSE
Determine the number of bytes needed to store the serialized hyperslab
@@ -3303,49 +3517,73 @@ done:
static hssize_t
H5S__hyper_serial_size(const H5S_t *space)
{
- hsize_t block_count; /* block counter for regular hyperslabs */
- unsigned u; /* Counter */
- hssize_t ret_value = -1; /* return value */
+ hsize_t block_count = 0; /* block counter for regular hyperslabs */
+ uint32_t version; /* Version number */
+ uint8_t enc_size; /* Encoded size of hyerslab selection info */
+ hssize_t ret_value = -1; /* return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
HDassert(space);
- /* Check for version (right now, an unlimited dimension is the only thing
- * that would bump the version) */
- if(space->select.sel_info.hslab->unlim_dim >= 0)
+ if(space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */
+ block_count = H5S__get_select_hyper_nblocks(space, FALSE);
+
+ /* Determine the version and the encoded size */
+ if(H5S__hyper_get_version_enc_size(space, block_count, &version, &enc_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version & enc_size")
+
+ if(version == H5S_HYPER_VERSION_3) {
+ /* Version 3: regular */
+ /* Size required is always:
+ * <type (4 bytes)> + <version (4 bytes)> + <flags (1 byte)> +
+ * <size of offset info (1 byte)> + <rank (4 bytes)> +
+ * (4 (start/stride/count/block) * <enc_size> * <rank>) =
+ * 14 + (4 * enc_size * rank) bytes
+ */
+ if(H5S__hyper_is_regular(space))
+ ret_value = (hssize_t)14 +
+ ((hssize_t)4 * (hssize_t)enc_size * (hssize_t)space->extent.rank);
+ else {
+ /* Version 3: irregular */
+ /* Size required is always:
+ * <type (4 bytes)> + <version (4 bytes)> + <flags (1 byte)> +
+ * <size of offset info (1 byte)> + <rank (4 bytes)> +
+ * < # of blocks (depend on enc_size) > +
+ * (2 (starting/ending offset) * <rank> * <enc_size> * <# of blocks) =
+ * = 14 bytes + enc_size (block_count) + (2 * enc_size * rank * block_count) bytes
+ */
+ ret_value = 14 + enc_size;
+ H5_CHECK_OVERFLOW(((unsigned)2 * enc_size * space->extent.rank * block_count), hsize_t, hssize_t);
+ ret_value += (hssize_t)((unsigned)2 * enc_size * space->extent.rank * block_count);
+ }
+ } else if(version == H5S_HYPER_VERSION_2) {
/* Version 2 */
/* Size required is always:
* <type (4 bytes)> + <version (4 bytes)> + <flags (1 byte)> +
* <length (4 bytes)> + <rank (4 bytes)> +
- * (4 (start/stride/count/block) * <rank> * <value (8 bytes)>) =
- * 17 + (4 * rank * 8) bytes
+ * (4 (start/stride/count/block) * <enc_size (8 bytes)> * <rank>) =
+ * 17 + (4 * 8 * rank) bytes
*/
- ret_value = (hssize_t)17 + ((hssize_t)4 * (hssize_t)space->extent.rank
- * (hssize_t)8);
- else {
+ HDassert(enc_size == 8);
+ ret_value = (hssize_t)17 + ((hssize_t)4 * (hssize_t)8 * (hssize_t)space->extent.rank);
+ } else {
+ HDassert(version == H5S_HYPER_VERSION_1);
+ HDassert(enc_size == 4);
/* Version 1 */
/* Basic number of bytes required to serialize hyperslab selection:
* <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> +
- * <length (4 bytes)> + <rank (4 bytes)> + <# of blocks (4 bytes)>
- * = 24 bytes
+ * <length (4 bytes)> + <rank (4 bytes)> + <# of blocks (4 bytes)> +
+ * (2 (starting/ending offset) * <enc_size (4 bytes)> * <rank> * <# of blocks) =
+ * = 24 bytes + (2 * 4 * rank * block_count)
*/
ret_value = 24;
-
- /* Check for a "regular" hyperslab selection */
- if(space->select.sel_info.hslab->diminfo_valid) {
- /* Check each dimension */
- for(block_count = 1, u = 0; u < space->extent.rank; u++)
- block_count *= space->select.sel_info.hslab->opt_diminfo[u].count;
- } /* end if */
- else
- /* Spin through hyperslab spans, adding 8 * rank bytes for each block */
- block_count = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst);
-
H5_CHECK_OVERFLOW((8 * space->extent.rank * block_count), hsize_t, hssize_t);
- ret_value += (hssize_t)(8 * block_count * space->extent.rank);
+ ret_value += (hssize_t)(8 * space->extent.rank * block_count);
} /* end else */
+done:
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_serial_size() */
@@ -3356,12 +3594,13 @@ H5S__hyper_serial_size(const H5S_t *space)
PURPOSE
Serialize the current selection into a user-provided buffer.
USAGE
- void H5S__hyper_serialize_helper(spans, start, end, rank, buf)
+ void H5S__hyper_serialize_helper(spans, start, end, rank, enc_size, buf)
H5S_hyper_span_info_t *spans; IN: Hyperslab span tree to serialize
hssize_t start[]; IN/OUT: Accumulated start points
hssize_t end[]; IN/OUT: Accumulated end points
hsize_t rank; IN: Current rank looking at
- uint8 *buf; OUT: Buffer to put serialized selection into
+ uint8_t enc_size IN: Encoded size of hyperslab selection info
+ uint8_t *buf; OUT: Buffer to put serialized selection into
RETURNS
None
DESCRIPTION
@@ -3374,7 +3613,7 @@ H5S__hyper_serial_size(const H5S_t *space)
--------------------------------------------------------------------------*/
static void
H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans,
- hsize_t *start, hsize_t *end, hsize_t rank, uint8_t **p)
+ hsize_t *start, hsize_t *end, hsize_t rank, uint8_t enc_size, uint8_t **p)
{
H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */
uint8_t *pp = (*p); /* Local pointer for decoding */
@@ -3398,26 +3637,65 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans,
end[rank] = curr->high;
/* Recurse down to the next dimension */
- H5S__hyper_serialize_helper(curr->down, start, end, rank + 1, &pp);
+ H5S__hyper_serialize_helper(curr->down, start, end, rank + 1, enc_size, &pp);
} /* end if */
else {
hsize_t u; /* Index variable */
/* Encode all the previous dimensions starting & ending points */
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ /* Encode previous starting points */
+ for(u=0; u<rank; u++)
+ UINT16ENCODE(pp, (uint16_t)start[u]);
+
+ /* Encode starting point for this span */
+ UINT16ENCODE(pp, (uint16_t)curr->low);
- /* Encode previous starting points */
- for(u = 0; u < rank; u++)
- UINT32ENCODE(pp, (uint32_t)start[u]);
+ /* Encode previous ending points */
+ for(u=0; u<rank; u++)
+ UINT16ENCODE(pp, (uint16_t)end[u]);
+
+ /* Encode starting point for this span */
+ UINT16ENCODE(pp, (uint16_t)curr->high);
+ break;
- /* Encode starting point for this span */
- UINT32ENCODE(pp, (uint32_t)curr->low);
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ /* Encode previous starting points */
+ for(u=0; u<rank; u++)
+ UINT32ENCODE(pp, (uint32_t)start[u]);
+
+ /* Encode starting point for this span */
+ UINT32ENCODE(pp, (uint32_t)curr->low);
+
+ /* Encode previous ending points */
+ for(u=0; u<rank; u++)
+ UINT32ENCODE(pp, (uint32_t)end[u]);
+
+ /* Encode starting point for this span */
+ UINT32ENCODE(pp, (uint32_t)curr->high);
+ break;
- /* Encode previous ending points */
- for(u = 0; u < rank; u++)
- UINT32ENCODE(pp, (uint32_t)end[u]);
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ /* Encode previous starting points */
+ for(u=0; u<rank; u++)
+ UINT64ENCODE(pp, (uint64_t)start[u]);
- /* Encode starting point for this span */
- UINT32ENCODE(pp, (uint32_t)curr->high);
+ /* Encode starting point for this span */
+ UINT64ENCODE(pp, (uint64_t)curr->low);
+
+ /* Encode previous ending points */
+ for(u=0; u<rank; u++)
+ UINT64ENCODE(pp, (uint64_t)end[u]);
+
+ /* Encode starting point for this span */
+ UINT64ENCODE(pp, (uint64_t)curr->high);
+ break;
+
+ default:
+ HDassert(0 && "Unknown enc size?!?");
+
+ } /* end switch */
} /* end else */
/* Advance to next node */
@@ -3455,14 +3733,26 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans,
static herr_t
H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
{
- uint8_t *pp; /* Local pointer for decoding */
- uint8_t *lenp; /* Pointer to length location for later storage */
- uint32_t len = 0; /* Number of bytes used */
+ const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
+ hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary hyperslab counts */
+ hsize_t offset[H5S_MAX_RANK]; /* Offset of element in dataspace */
+ hsize_t start[H5S_MAX_RANK]; /* Location of start of hyperslab */
+ hsize_t end[H5S_MAX_RANK]; /* Location of end of hyperslab */
+ uint8_t *pp; /* Local pointer for decoding */
+ uint8_t *lenp = NULL; /* pointer to length location for later storage */
+ uint32_t len = 0; /* number of bytes used */
uint32_t version; /* Version number */
uint8_t flags = 0; /* Flags for message */
- hsize_t block_count; /* Block counter for regular hyperslabs */
+ hsize_t block_count = 0; /* block counter for regular hyperslabs */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ unsigned ndims; /* Rank of the dataspace */
+ unsigned i, u; /* Local counting variable */
+ hbool_t complete = FALSE; /* Whether we are done with the iteration */
+ hbool_t is_regular; /* Whether selection is regular */
+ uint8_t enc_size;
+ herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(space);
@@ -3470,162 +3760,243 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
pp = (*p);
HDassert(pp);
- /* Calculate version */
- if(space->select.sel_info.hslab->unlim_dim >= 0) {
- version = 2;
- flags |= H5S_SELECT_FLAG_UNLIM;
- } /* end if */
- else
- version = 1;
+ /* Set some convienence values */
+ ndims = space->extent.rank;
+ diminfo = space->select.sel_info.hslab->opt_diminfo;
+
+ if(space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */
+ block_count = H5S__get_select_hyper_nblocks(space, FALSE);
+
+ /* Determine the version and the encoded size */
+ if(H5S__hyper_get_version_enc_size(space, block_count, &version, &enc_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version & enc_size")
+
+ is_regular = H5S__hyper_is_regular(space);
+ if(is_regular &&
+ (version == H5S_HYPER_VERSION_2 || version == H5S_HYPER_VERSION_3))
+ flags |= H5S_HYPER_REGULAR;
/* Store the preamble information */
UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
UINT32ENCODE(pp, version); /* Store the version number */
- if(version >= 2)
- *(pp)++ = flags; /* Store the flags */
- else
- UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
- lenp = pp; /* keep the pointer to the length location for later */
- pp += 4; /* skip over space for length */
+
+ if(version >= 3) {
+ *(pp)++ = flags; /* Store the flags */
+ *(pp)++ = enc_size; /* Store size of offset info */
+
+ } else {
+ if(version == 2)
+ *(pp)++ = flags; /* Store the flags */
+ else
+ UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
+ lenp = pp; /* keep the pointer to the length location for later */
+ pp += 4; /* skip over space for length */
+
+ len += 4; /* ndims */
+ }
/* Encode number of dimensions */
- UINT32ENCODE(pp, (uint32_t)space->extent.rank);
- len += 4;
+ UINT32ENCODE(pp, (uint32_t)ndims);
- /* If there is an unlimited dimension, only encode opt_unlim_diminfo */
- if(flags & H5S_SELECT_FLAG_UNLIM) {
- unsigned i;
+ if(is_regular) {
- HDassert(H5S_UNLIMITED == HSIZE_UNDEF);
+ if(version >= H5S_HYPER_VERSION_2) {
+
+ HDassert(H5S_UNLIMITED == HSIZE_UNDEF);
- /* Iterate over dimensions */
- for(i = 0; i < space->extent.rank; i++) {
+ /* Iterate over dimensions */
/* Encode start/stride/block/count */
- UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].start);
- UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].stride);
- UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].count);
- UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].block);
- } /* end for */
- } /* end if */
- /* Check for a "regular" hyperslab selection */
- else if(space->select.sel_info.hslab->diminfo_valid) {
- const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
- hsize_t offset[H5S_MAX_RANK]; /* Offset of element in dataspace */
- hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary hyperslab counts */
- unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
- unsigned ndims; /* Rank of the dataspace */
- unsigned u; /* Local counting variable */
- hbool_t done; /* Whether we are done with the iteration */
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ HDassert(version == H5S_HYPER_VERSION_3);
+ for(i = 0; i < space->extent.rank; i++) {
+ UINT16ENCODE(pp, diminfo[i].start);
+ UINT16ENCODE(pp, diminfo[i].stride);
+ if(diminfo[i].count == H5S_UNLIMITED) {
+ UINT16ENCODE(pp, H5S_UINT16_MAX);
+ } else {
+ UINT16ENCODE(pp, diminfo[i].count);
+ }
+
+ if(diminfo[i].block == H5S_UNLIMITED) {
+ UINT16ENCODE(pp, H5S_UINT16_MAX);
+ } else {
+ UINT16ENCODE(pp, diminfo[i].block);
+ }
+ } /* end for */
+ break;
- /* Set some convenience values */
- ndims = space->extent.rank;
- fast_dim = ndims - 1;
- diminfo = space->select.sel_info.hslab->opt_diminfo;
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ HDassert(version == H5S_HYPER_VERSION_3);
+ for(i = 0; i < space->extent.rank; i++) {
+ UINT32ENCODE(pp, diminfo[i].start);
+ UINT32ENCODE(pp, diminfo[i].stride);
+ if(diminfo[i].count == H5S_UNLIMITED) {
+ UINT32ENCODE(pp, H5S_UINT32_MAX);
+ } else {
+ UINT32ENCODE(pp, diminfo[i].count);
+ }
+ if(diminfo[i].block == H5S_UNLIMITED) {
+ UINT32ENCODE(pp, H5S_UINT32_MAX);
+ } else {
+ UINT32ENCODE(pp, diminfo[i].block);
+ }
+ } /* end for */
+ break;
- /* Check each dimension */
- for(block_count = 1, u = 0; u < ndims; u++)
- block_count *= diminfo[u].count;
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ HDassert(version == H5S_HYPER_VERSION_2 || version == H5S_HYPER_VERSION_3);
+ for(i = 0; i < space->extent.rank; i++) {
+ UINT64ENCODE(pp, diminfo[i].start);
+ UINT64ENCODE(pp, diminfo[i].stride);
+ if(diminfo[i].count == H5S_UNLIMITED) {
+ UINT64ENCODE(pp, H5S_UINT64_MAX);
+ } else {
+ UINT64ENCODE(pp, diminfo[i].count);
+ }
+ if(diminfo[i].block == H5S_UNLIMITED) {
+ UINT64ENCODE(pp, H5S_UINT64_MAX);
+ } else {
+ UINT64ENCODE(pp, diminfo[i].block);
+ }
+ } /* end for */
+ if(version == H5S_HYPER_VERSION_2)
+ len += (4 * space->extent.rank * 8);
+ break;
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab")
+ break;
+ } /* end switch */
- /* Encode number of hyperslabs */
- H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t);
- UINT32ENCODE(pp, (uint32_t)block_count);
- len += 4;
+ } else {
- /* Now serialize the information for the regular hyperslab */
+ HDassert(version == H5S_HYPER_VERSION_1);
+
+ /* Set some convienence values */
+ fast_dim = ndims - 1;
- /* Build the tables of count sizes as well as the initial offset */
- for(u = 0; u < ndims; u++) {
- tmp_count[u] = diminfo[u].count;
- offset[u] = diminfo[u].start;
- } /* end for */
+ /* Encode number of hyperslabs */
+ H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t);
+ UINT32ENCODE(pp, (uint32_t)block_count);
+ len += 4;
- /* We're not done with the iteration */
- done = FALSE;
+ /* Now serialize the information for the regular hyperslab */
- /* Go iterate over the hyperslabs */
- while(done == FALSE) {
- /* Iterate over the blocks in the fastest dimension */
- while(tmp_count[fast_dim] > 0) {
- /* Add 8 bytes times the rank for each hyperslab selected */
- len += 8 * ndims;
+ /* Build the tables of count sizes as well as the initial offset */
+ for(u = 0; u < ndims; u++) {
+ tmp_count[u] = diminfo[u].count;
+ offset[u] = diminfo[u].start;
+ } /* end for */
- /* Encode hyperslab starting location */
- for(u = 0; u < ndims; u++)
- UINT32ENCODE(pp, (uint32_t)offset[u]);
+ /* Go iterate over the hyperslabs */
+ while(complete == FALSE) {
+ /* Iterate over the blocks in the fastest dimension */
+ while(tmp_count[fast_dim] > 0) {
+ /* Add 8 bytes times the rank for each hyperslab selected */
+ len += 8 * ndims;
- /* Encode hyperslab ending location */
- for(u = 0; u < ndims; u++)
- UINT32ENCODE(pp, (uint32_t)(offset[u] + (diminfo[u].block - 1)));
+ /* Encode hyperslab starting location */
+ for(u = 0; u < ndims; u++)
+ UINT32ENCODE(pp, (uint32_t)offset[u]);
- /* Move the offset to the next sequence to start */
- offset[fast_dim]+=diminfo[fast_dim].stride;
+ /* Encode hyperslab ending location */
+ for(u = 0; u < ndims; u++)
+ UINT32ENCODE(pp, (uint32_t)(offset[u] + (diminfo[u].block - 1)));
- /* Decrement the block count */
- tmp_count[fast_dim]--;
- } /* end while */
+ /* Move the offset to the next sequence to start */
+ offset[fast_dim]+=diminfo[fast_dim].stride;
+
+ /* Decrement the block count */
+ tmp_count[fast_dim]--;
+ } /* end while */
- /* Work on other dimensions if necessary */
- if(fast_dim > 0) {
- int temp_dim; /* Temporary rank holder */
+ /* Work on other dimensions if necessary */
+ if(fast_dim > 0) {
+ int temp_dim; /* Temporary rank holder */
- /* Reset the block counts */
- tmp_count[fast_dim] = diminfo[fast_dim].count;
+ /* Reset the block counts */
+ tmp_count[fast_dim] = diminfo[fast_dim].count;
- /* Bubble up the decrement to the slower changing dimensions */
- temp_dim = (int)fast_dim - 1;
- while(temp_dim >= 0 && done == FALSE) {
- /* Decrement the block count */
- tmp_count[temp_dim]--;
+ /* Bubble up the decrement to the slower changing dimensions */
+ temp_dim = (int)fast_dim - 1;
+ while(temp_dim >= 0 && complete == FALSE) {
+ /* Decrement the block count */
+ tmp_count[temp_dim]--;
- /* Check if we have more blocks left */
- if(tmp_count[temp_dim] > 0)
- break;
+ /* Check if we have more blocks left */
+ if(tmp_count[temp_dim] > 0)
+ break;
- /* Check for getting out of iterator */
- if(temp_dim == 0)
- done = TRUE;
+ /* Check for getting out of iterator */
+ if(temp_dim == 0)
+ complete = TRUE;
- /* Reset the block count in this dimension */
- tmp_count[temp_dim] = diminfo[temp_dim].count;
+ /* Reset the block count in this dimension */
+ tmp_count[temp_dim] = diminfo[temp_dim].count;
- /* Wrapped a dimension, go up to next dimension */
- temp_dim--;
- } /* end while */
- } /* end if */
- else
- break; /* Break out now, for 1-D selections */
+ /* Wrapped a dimension, go up to next dimension */
+ temp_dim--;
+ } /* end while */
+ } /* end if */
+ else
+ break; /* Break out now, for 1-D selections */
- /* Re-compute offset array */
- for(u = 0; u < ndims; u++)
- offset[u] = diminfo[u].start + diminfo[u].stride * (diminfo[u].count - tmp_count[u]);
- } /* end while */
- } /* end if */
- else {
- hsize_t start[H5S_MAX_RANK]; /* Location of start of hyperslab */
- hsize_t end[H5S_MAX_RANK]; /* Location of end of hyperslab */
+ /* Re-compute offset array */
+ for(u = 0; u < ndims; u++)
+ offset[u] = diminfo[u].start + diminfo[u].stride * (diminfo[u].count - tmp_count[u]);
+ } /* end while */
+
+ } /* end else */
+
+ } else { /* irregular */
/* Encode number of hyperslabs */
- block_count = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst);
- H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t);
- UINT32ENCODE(pp, (uint32_t)block_count);
- len += 4;
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ HDassert(version == H5S_HYPER_VERSION_3);
+ H5_CHECK_OVERFLOW(block_count, hsize_t, uint16_t);
+ UINT16ENCODE(pp, (uint16_t)block_count);
+ break;
- /* Add 8 bytes times the rank for each hyperslab selected */
- H5_CHECK_OVERFLOW((8 * space->extent.rank * block_count), hsize_t, size_t);
- len += (uint32_t)(8 * space->extent.rank * block_count);
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ HDassert(version == H5S_HYPER_VERSION_1 || version == H5S_HYPER_VERSION_3);
+ H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t);
+ UINT32ENCODE(pp, (uint32_t)block_count);
+ break;
- /* Encode each hyperslab in selection */
- H5S__hyper_serialize_helper(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, &pp);
- } /* end else */
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ HDassert(version == H5S_HYPER_VERSION_3);
+ UINT64ENCODE(pp, block_count);
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab")
+ break;
+ } /* end switch */
+
+ if(version == H5S_HYPER_VERSION_1) {
+ len+=4; /* block_count */
+
+ /* Add 8 bytes times the rank for each hyperslab selected */
+ H5_CHECK_OVERFLOW((8 * ndims * block_count), hsize_t, size_t);
+ len += (uint32_t)(8 * ndims * block_count);
+ }
+
+ H5S__hyper_serialize_helper(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, enc_size, &pp);
+
+ }
/* Encode length */
- UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */
+ if(version <= H5S_HYPER_VERSION_2)
+ UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */
/* Update encoding pointer */
*p = pp;
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__hyper_serialize() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S__hyper_serialize() */
+
/*--------------------------------------------------------------------------
@@ -3635,10 +4006,8 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
Deserialize the current selection from a user-provided buffer.
USAGE
herr_t H5S__hyper_deserialize(space, p)
- H5S_t *space; IN/OUT: Dataspace pointer to place
+ H5S_t **space; IN/OUT: Dataspace pointer to place
selection into
- uint32_t version IN: Selection version
- uint8_t flags IN: Selection flags
uint8 **p; OUT: Pointer to buffer holding serialized
selection. Will be advanced to end of
serialized selection.
@@ -3653,82 +4022,216 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t flags,
- const uint8_t **p)
+H5S__hyper_deserialize(H5S_t **space, const uint8_t **p)
{
- unsigned rank; /* Rank of points */
- const uint8_t *pp; /* Local pointer for decoding */
- hsize_t start[H5S_MAX_RANK]; /* Hyperslab start information */
- hsize_t block[H5S_MAX_RANK]; /* Hyperslab block information */
- unsigned u; /* Local counting variable */
- herr_t ret_value = FAIL; /* Return value */
+ H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use,
+ either *space or a newly allocated one */
+ hsize_t dims[H5S_MAX_RANK]; /* Dimenion sizes */
+ hsize_t start[H5S_MAX_RANK]; /* hyperslab start information */
+ hsize_t block[H5S_MAX_RANK]; /* hyperslab block information */
+ uint32_t version; /* Version number */
+ uint8_t flags = 0; /* Flags */
+ uint8_t enc_size = 0; /* Encoded size of selection info */
+ unsigned rank; /* rank of points */
+ const uint8_t *pp; /* Local pointer for decoding */
+ unsigned u; /* Local counting variable */
+ herr_t ret_value=FAIL; /* return value */
FUNC_ENTER_STATIC
/* Check args */
- HDassert(space);
HDassert(p);
pp = (*p);
HDassert(pp);
- /* Deserialize slabs to select */
- /* (The header and rank have already beed decoded) */
- rank = space->extent.rank; /* Retrieve rank from space */
+ /* As part of the efforts to push all selection-type specific coding
+ to the callbacks, the coding for the allocation of a null dataspace
+ is moved from H5S_select_deserialize() in H5Sselect.c to here.
+ This is needed for decoding virtual layout in H5O__layout_decode() */
+ /* Allocate space if not provided */
+ if(!*space) {
+ if(NULL == (tmp_space = H5S_create(H5S_SIMPLE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace")
+ } /* end if */
+ else
+ tmp_space = *space;
+
+ /* Decode version */
+ UINT32DECODE(pp, version);
+
+ if(version >= (uint32_t)H5S_HYPER_VERSION_2) {
+ /* Decode flags */
+ flags = *(pp)++;
+
+ if(version >= (uint32_t)H5S_HYPER_VERSION_3)
+ /* decode size of offset info */
+ enc_size = *(pp)++;
+ else {
+ /* Skip over the remainder of the header */
+ pp += 4;
+ enc_size = H5S_SELECT_INFO_ENC_SIZE_8;
+ }
+
+ /* Check for unknown flags */
+ if(flags & ~H5S_SELECT_FLAG_BITS)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown flag for selection")
+ } else {
+ /* Skip over the remainder of the header */
+ pp += 8;
+ enc_size = H5S_SELECT_INFO_ENC_SIZE_4;
+ }
+
+ /* Check encoded */
+ if(enc_size & ~H5S_SELECT_INFO_ENC_SIZE_BITS)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown size of point/offset info for selection")
+
+ /* Decode the rank of the point selection */
+ UINT32DECODE(pp,rank);
+
+ if(!*space) {
+ /* Patch the rank of the allocated dataspace */
+ (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0]));
+ if(H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions")
+ } /* end if */
+ else
+ /* Verify the rank of the provided dataspace */
+ if(rank != tmp_space->extent.rank)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of serialized selection does not match dataspace")
- /* If there is an unlimited dimension, only encode opt_unlim_diminfo */
- if(flags & H5S_SELECT_FLAG_UNLIM) {
+ if(flags & H5S_HYPER_REGULAR) {
hsize_t stride[H5S_MAX_RANK]; /* Hyperslab stride information */
- hsize_t count[H5S_MAX_RANK]; /* Hyperslab count information */
+ hsize_t count[H5S_MAX_RANK]; /* Hyperslab count information */
/* Sanity checks */
HDassert(H5S_UNLIMITED == HSIZE_UNDEF);
HDassert(version >= 2);
- /* Iterate over dimensions */
- for(u = 0; u < rank; u++) {
- /* Decode start/stride/block/count */
- UINT64DECODE(pp, start[u]);
- UINT64DECODE(pp, stride[u]);
- UINT64DECODE(pp, count[u]);
- UINT64DECODE(pp, block[u]);
- } /* end for */
+ /* Decode start/stride/block/count */
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ for(u = 0; u < tmp_space->extent.rank; u++) {
+ UINT16DECODE(pp, start[u]);
+ UINT16DECODE(pp, stride[u]);
+
+ UINT16DECODE(pp, count[u]);
+ if((uint16_t)count[u] == H5S_UINT16_MAX)
+ count[u] = H5S_UNLIMITED;
+
+ UINT16DECODE(pp, block[u]);
+ if((uint16_t)block[u] == H5S_UINT16_MAX)
+ block[u] = H5S_UNLIMITED;
+ } /* end for */
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ for(u = 0; u < tmp_space->extent.rank; u++) {
+ UINT32DECODE(pp, start[u]);
+ UINT32DECODE(pp, stride[u]);
+
+ UINT32DECODE(pp, count[u]);
+ if((uint32_t)count[u] == H5S_UINT32_MAX)
+ count[u] = H5S_UNLIMITED;
+
+ UINT32DECODE(pp, block[u]);
+ if((uint32_t)block[u] == H5S_UINT32_MAX)
+ block[u] = H5S_UNLIMITED;
+ } /* end for */
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ for(u = 0; u < tmp_space->extent.rank; u++) {
+ UINT64DECODE(pp, start[u]);
+ UINT64DECODE(pp, stride[u]);
+ UINT64DECODE(pp, count[u]);
+ if((uint64_t)count[u] == H5S_UINT64_MAX)
+ count[u] = H5S_UNLIMITED;
+
+ UINT64DECODE(pp, block[u]);
+ if((uint64_t)block[u] == H5S_UINT64_MAX)
+ block[u] = H5S_UNLIMITED;
+ } /* end for */
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab")
+ break;
+ } /* end switch */
+
/* Select the hyperslab to the current selection */
- if((ret_value = H5S_select_hyperslab(space, H5S_SELECT_SET, start, stride, count, block)) < 0)
+ if((ret_value = H5S_select_hyperslab(tmp_space, H5S_SELECT_SET, start, stride, count, block)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't change selection")
} /* end if */
else {
const hsize_t *stride; /* Hyperslab stride information */
const hsize_t *count; /* Hyperslab count information */
- hsize_t end[H5S_MAX_RANK]; /* Hyperslab end information */
- hsize_t *tstart; /* Temporary hyperslab pointers */
- hsize_t *tend; /* Temporary hyperslab pointers */
- hsize_t *tblock; /* Temporary hyperslab pointers */
- size_t block_count; /* Number of blocks in selection */
- unsigned v; /* Local counting variable */
+ hsize_t end[H5S_MAX_RANK]; /* Hyperslab end information */
+ hsize_t *tstart; /* Temporary hyperslab pointers */
+ hsize_t *tend; /* Temporary hyperslab pointers */
+ hsize_t *tblock; /* Temporary hyperslab pointers */
+ size_t num_elem; /* Number of elements in selection */
+ unsigned v; /* Local counting variable */
+
+ /* decode the number of blocks */
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ UINT16DECODE(pp, num_elem);
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ UINT32DECODE(pp, num_elem);
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ UINT64DECODE(pp, num_elem);
+ break;
- /* Decode the number of blocks */
- UINT32DECODE(pp, block_count);
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab")
+ break;
+ }
/* Set the count & stride for all blocks */
stride = count = H5S_hyper_ones_g;
/* Retrieve the coordinates from the buffer */
- for(u = 0; u < block_count; u++) {
- /* Decode the starting points */
- for(tstart = start, v = 0; v < rank; v++, tstart++)
- UINT32DECODE(pp, *tstart);
+ for(u = 0; u < num_elem; u++) {
+
+ /* Decode the starting and ending points */
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ for(tstart = start, v = 0; v < rank; v++, tstart++)
+ UINT16DECODE(pp, *tstart);
+ for(tend = end, v = 0; v < rank; v++, tend++)
+ UINT16DECODE(pp, *tend);
+ break;
- /* Decode the ending points */
- for(tend = end, v = 0; v < rank; v++, tend++)
- UINT32DECODE(pp, *tend);
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ for(tstart = start,v = 0; v < rank; v++, tstart++)
+ UINT32DECODE(pp, *tstart);
+ for(tend = end, v = 0; v < rank; v++, tend++)
+ UINT32DECODE(pp, *tend);
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ for(tstart = start, v = 0; v < rank; v++, tstart++)
+ UINT64DECODE(pp, *tstart);
+ for(tend = end, v = 0; v < rank; v++, tend++)
+ UINT64DECODE(pp, *tend);
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab")
+ break;
+ }
/* Change the ending points into blocks */
for(tblock = block, tstart = start, tend = end, v = 0; v < rank; v++, tstart++, tend++, tblock++)
*tblock = (*tend - *tstart) + 1;
/* Select or add the hyperslab to the current selection */
- if((ret_value = H5S_select_hyperslab(space, (u == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, stride, count, block)) < 0)
+ if((ret_value = H5S_select_hyperslab(tmp_space, (u == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, stride, count, block)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't change selection")
} /* end for */
} /* end else */
@@ -3736,7 +4239,16 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl
/* Update decoding pointer */
*p = pp;
+ /* Return space to the caller if allocated */
+ if(!*space)
+ *space = tmp_space;
+
done:
+ /* Free temporary space if not passed to caller (only happens on error) */
+ if(!*space && tmp_space)
+ if(H5S_close(tmp_space) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_deserialize() */
@@ -3819,18 +4331,18 @@ H5S__hyper_span_blocklist(const H5S_hyper_span_info_t *spans, hsize_t start[],
/* Copy previous starting points */
for(u = 0; u < rank; u++, (*buf)++)
- HDmemcpy(*buf, &start[u], sizeof(hsize_t));
+ H5MM_memcpy(*buf, &start[u], sizeof(hsize_t));
/* Copy starting point for this span */
- HDmemcpy(*buf, &curr->low, sizeof(hsize_t));
+ H5MM_memcpy(*buf, &curr->low, sizeof(hsize_t));
(*buf)++;
/* Copy previous ending points */
for(u = 0; u < rank; u++, (*buf)++)
- HDmemcpy(*buf, &end[u], sizeof(hsize_t));
+ H5MM_memcpy(*buf, &end[u], sizeof(hsize_t));
/* Copy starting point for this span */
- HDmemcpy(*buf, &curr->high, sizeof(hsize_t));
+ H5MM_memcpy(*buf, &curr->high, sizeof(hsize_t));
(*buf)++;
/* Decrement the number of blocks processed */
@@ -3943,11 +4455,11 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblo
/* Check if we should copy this block information */
if(startblock == 0) {
/* Copy the starting location */
- HDmemcpy(buf, offset, sizeof(hsize_t) * ndims);
+ H5MM_memcpy(buf, offset, sizeof(hsize_t) * ndims);
buf += ndims;
/* Compute the ending location */
- HDmemcpy(buf, offset, sizeof(hsize_t) * ndims);
+ H5MM_memcpy(buf, offset, sizeof(hsize_t) * ndims);
for(u = 0; u < ndims; u++)
buf[u] += (diminfo[u].block - 1);
buf += ndims;
@@ -6029,7 +6541,7 @@ H5S_hyper_denormalize_offset(H5S_t *space, const hssize_t *old_offset)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection")
/* Copy the selection offset over */
- HDmemcpy(space->select.offset, old_offset, sizeof(hssize_t) * space->extent.rank);
+ H5MM_memcpy(space->select.offset, old_offset, sizeof(hssize_t) * space->extent.rank);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -7255,7 +7767,7 @@ H5S__hyper_rebuild_helper(const H5S_hyper_span_t *span, H5S_hyper_dim_t span_sla
if(!H5S__hyper_rebuild_helper(span->down->head, span_slab_info, rank - 1))
HGOTO_DONE(FALSE)
- HDmemcpy(canon_down_span_slab_info, span_slab_info, sizeof(H5S_hyper_dim_t) * rank);
+ H5MM_memcpy(canon_down_span_slab_info, span_slab_info, sizeof(H5S_hyper_dim_t) * rank);
} /* end if */
/* Assign the initial starting point & block size */
diff --git a/src/H5Snone.c b/src/H5Snone.c
index 86994dd..6219bb1 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -58,8 +58,7 @@ static herr_t H5S__none_release(H5S_t *space);
static htri_t H5S__none_is_valid(const H5S_t *space);
static hssize_t H5S__none_serial_size(const H5S_t *space);
static herr_t H5S__none_serialize(const H5S_t *space, uint8_t **p);
-static herr_t H5S__none_deserialize(H5S_t *space, uint32_t version, uint8_t flags,
- const uint8_t **p);
+static herr_t H5S__none_deserialize(H5S_t **space, const uint8_t **p);
static herr_t H5S__none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static herr_t H5S__none_offset(const H5S_t *space, hsize_t *off);
static int H5S__none_unlim_dim(const H5S_t *space);
@@ -584,7 +583,7 @@ H5S__none_serialize(const H5S_t *space, uint8_t **p)
/* Store the preamble information */
UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
- UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */
+ UINT32ENCODE(pp, (uint32_t)H5S_NONE_VERSION_1); /* Store the version number */
UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */
@@ -602,10 +601,8 @@ H5S__none_serialize(const H5S_t *space, uint8_t **p)
Deserialize the current selection from a user-provided buffer.
USAGE
herr_t H5S__none_deserialize(space, version, flags, p)
- H5S_t *space; IN/OUT: Dataspace pointer to place
+ H5S_t **space; IN/OUT: Dataspace pointer to place
selection into
- uint32_t version IN: Selection version
- uint8_t flags IN: Selection flags
uint8 **p; OUT: Pointer to buffer holding serialized
selection. Will be advanced to end of
serialized selection.
@@ -620,22 +617,50 @@ H5S__none_serialize(const H5S_t *space, uint8_t **p)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__none_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version,
- uint8_t H5_ATTR_UNUSED flags, const uint8_t H5_ATTR_UNUSED **p)
+H5S__none_deserialize(H5S_t **space, const uint8_t **p)
{
- herr_t ret_value = SUCCEED; /* return value */
+ H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use,
+ either *space or a newly allocated one */
+ uint32_t version; /* Version number */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_STATIC
- HDassert(space);
HDassert(p);
HDassert(*p);
+ /* As part of the efforts to push all selection-type specific coding
+ to the callbacks, the coding for the allocation of a null dataspace
+ is moved from H5S_select_deserialize() in H5Sselect.c to here.
+ This is needed for decoding virtual layout in H5O__layout_decode() */
+ /* Allocate space if not provided */
+ if(!*space) {
+ if(NULL == (tmp_space = H5S_create(H5S_SIMPLE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace")
+ } /* end if */
+ else
+ tmp_space = *space;
+
+ /* Decode version */
+ UINT32DECODE(*p, version);
+
+ /* Skip over the remainder of the header */
+ *p += 8;
+
/* Change to "none" selection */
- if(H5S_select_none(space) < 0)
+ if(H5S_select_none(tmp_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
+ /* Return space to the caller if allocated */
+ if(!*space)
+ *space = tmp_space;
+
done:
+ /* Free temporary space if not passed to caller (only happens on error) */
+ if(!*space && tmp_space)
+ if(H5S_close(tmp_space) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__none_deserialize() */
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index 0575f03..56b1f30 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -37,8 +37,35 @@
#define H5S_VALID_PERM 0x02
/* Flags for serialization of selections */
-#define H5S_SELECT_FLAG_UNLIM 0x01
-#define H5S_SELECT_FLAG_BITS (H5S_SELECT_FLAG_UNLIM)
+#define H5S_HYPER_REGULAR 0x01
+#define H5S_SELECT_FLAG_BITS (H5S_HYPER_REGULAR)
+
+/* Versions for H5S_SEL_HYPER selection info */
+#define H5S_HYPER_VERSION_1 1
+#define H5S_HYPER_VERSION_2 2
+#define H5S_HYPER_VERSION_3 3
+
+/* Versions for H5S_SEL_POINTS selection info */
+#define H5S_POINT_VERSION_1 1
+#define H5S_POINT_VERSION_2 2
+
+/* Versions for H5S_SEL_NONE selection info */
+#define H5S_NONE_VERSION_1 1
+
+/* Versions for H5S_SEL_ALL selection info */
+#define H5S_ALL_VERSION_1 1
+
+/* Encoded size of selection info for H5S_SEL_POINTS/H5S_SEL_HYPER */
+#define H5S_SELECT_INFO_ENC_SIZE_2 0x02 /* 2 bytes: 16 bits */
+#define H5S_SELECT_INFO_ENC_SIZE_4 0x04 /* 4 bytes: 32 bits */
+#define H5S_SELECT_INFO_ENC_SIZE_8 0x08 /* 8 bytes: 64 bits */
+#define H5S_SELECT_INFO_ENC_SIZE_BITS ( H5S_SELECT_INFO_ENC_SIZE_2 | \
+ H5S_SELECT_INFO_ENC_SIZE_4 | \
+ H5S_SELECT_INFO_ENC_SIZE_8 )
+
+#define H5S_UINT16_MAX 0x0000FFFF /* 2^16 - 1 = 65,535 */
+#define H5S_UINT32_MAX 0xFFFFFFFF /* 2^32 - 1 = 4,294,967,295 */
+#define H5S_UINT64_MAX ((hsize_t)(-1L)) /* 2^64 - 1 = 18,446,744,073,709,551,615 */
/* Length of stack-allocated sequences for "project intersect" routines */
#define H5S_PROJECT_INTERSECT_NSEQS 256
@@ -148,8 +175,7 @@ typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space);
/* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */
typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t **p);
/* Method to create selection from "serialized" form (a byte sequence suitable for storing on disk) */
-typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t *space, uint32_t version, uint8_t flags,
- const uint8_t **p);
+typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t **space, const uint8_t **p);
/* Method to determine smallest n-D bounding box containing the current selection */
typedef herr_t (*H5S_sel_bounds_func_t)(const H5S_t *space, hsize_t *start, hsize_t *end);
/* Method to determine linear offset of initial element in selection within dataspace */
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 6411b94..0bdabb4 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -28,13 +28,14 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* ID Functions */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Spkg.h" /* Dataspace functions */
-#include "H5VMprivate.h" /* Vector functions */
+#include "H5Iprivate.h" /* ID Functions */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Spkg.h" /* Dataspace functions */
+#include "H5VMprivate.h" /* Vector functions */
/****************/
@@ -60,8 +61,7 @@ static herr_t H5S__point_release(H5S_t *space);
static htri_t H5S__point_is_valid(const H5S_t *space);
static hssize_t H5S__point_serial_size(const H5S_t *space);
static herr_t H5S__point_serialize(const H5S_t *space, uint8_t **p);
-static herr_t H5S__point_deserialize(H5S_t *space, uint32_t version, uint8_t flags,
- const uint8_t **p);
+static herr_t H5S__point_deserialize(H5S_t **space, const uint8_t **p);
static herr_t H5S__point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static herr_t H5S__point_offset(const H5S_t *space, hsize_t *off);
static int H5S__point_unlim_dim(const H5S_t *space);
@@ -73,6 +73,8 @@ 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);
+static herr_t
+ H5S__point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t *enc_size);
/* Selection iteration callbacks */
static herr_t H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
@@ -119,6 +121,13 @@ const H5S_select_class_t H5S_sel_point[1] = {{
H5S__point_iter_init,
}};
+/* Format version bounds for dataspace hyperslab selection */
+const unsigned H5O_sds_point_ver_bounds[] = {
+ H5S_POINT_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5S_POINT_VERSION_1, /* H5F_LIBVER_V18 */
+ H5S_POINT_VERSION_1, /* H5F_LIBVER_V110 */
+ H5S_POINT_VERSION_2 /* H5F_LIBVER_LATEST */
+};
/*******************/
/* Local Variables */
@@ -203,7 +212,7 @@ H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
HDassert(coords);
/* Copy the offset of the current point */
- HDmemcpy(coords, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank);
+ H5MM_memcpy(coords, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S__point_iter_coords() */
@@ -233,8 +242,8 @@ H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
HDassert(end);
/* Copy the current point as a block */
- HDmemcpy(start, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank);
- HDmemcpy(end, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank);
+ H5MM_memcpy(start, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank);
+ H5MM_memcpy(end, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S__point_iter_block() */
@@ -581,7 +590,7 @@ H5S__point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *c
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate coordinate information")
/* Copy over the coordinates */
- HDmemcpy(new_node->pnt, coord + (u * space->extent.rank), (space->extent.rank * sizeof(hsize_t)));
+ H5MM_memcpy(new_node->pnt, coord + (u * space->extent.rank), (space->extent.rank * sizeof(hsize_t)));
/* Link into list */
if(top == NULL)
@@ -799,7 +808,7 @@ H5S__point_copy(H5S_t *dst, const H5S_t *src, hbool_t H5_ATTR_UNUSED share_selec
} /* end if */
/* Copy over the point's coordinates */
- HDmemcpy(new_node->pnt, curr->pnt, (src->extent.rank * sizeof(hsize_t)));
+ H5MM_memcpy(new_node->pnt, curr->pnt, (src->extent.rank * sizeof(hsize_t)));
/* Keep the order the same when copying */
if(NULL == new_tail)
@@ -920,6 +929,124 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Sget_select_elem_npoints() */
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__point_get_version_enc_size
+ PURPOSE
+ Determine the version and the size (2, 4 or 8 bytes) to encode point selection info
+ USAGE
+ hssize_t H5S__point_set_enc_size(space, version, enc_size)
+ const H5S_t *space: IN: Dataspace ID of selection to query
+ uint32_t *version: OUT: The version to use for encoding
+ uint8_t *enc_size: OUT: The size to use for encoding
+ RETURNS
+ The version and the size to encode point selection info
+ DESCRIPTION
+ Determine the version to use for encoding points selection info based
+ on the following:
+ (1) the low/high bounds setting in fapl
+ (2) whether the number of points or selection high bounds exceeds H5S_UINT32_MAX or not
+
+ Determine the encoded size based on version:
+ --For version 2, the encoded size of point selection info is determined
+ by the maximum size for:
+ (a) storing the number of points
+ (b) storing the selection high bounds
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t *enc_size)
+{
+ hbool_t count_up_version = FALSE; /* Whether number of points exceed H5S_UINT32_MAX */
+ hbool_t bound_up_version = FALSE; /* Whether high bounds exceed H5S_UINT32_MAX */
+ H5F_libver_t low_bound; /* The 'low' bound of library format versions */
+ H5F_libver_t high_bound; /* The 'high' bound of library format versions */
+ uint32_t tmp_version; /* Local temporary version */
+ hsize_t bounds_start[H5S_MAX_RANK]; /* Starting coordinate of bounding box */
+ hsize_t bounds_end[H5S_MAX_RANK]; /* Opposite coordinate of bounding box */
+ hsize_t max_size = 0; /* Maximum selection size */
+ unsigned u; /* Local index veriable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Get bounding box for the selection */
+ HDmemset(bounds_end, 0, sizeof(bounds_end));
+ if(H5S__point_bounds(space, bounds_start, bounds_end) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds")
+
+ /* Determine whether number of points or high bounds exceeds (2^32 - 1) */
+ if(space->select.num_elem > H5S_UINT32_MAX)
+ count_up_version = TRUE;
+ else {
+ for(u = 0; u < space->extent.rank; u++)
+ if(bounds_end[u] > H5S_UINT32_MAX) {
+ bound_up_version = TRUE;
+ break;
+ }
+ }
+
+ /* If exceed (2^32 -1) */
+ if(count_up_version || bound_up_version)
+ tmp_version = H5S_POINT_VERSION_2;
+ else
+ tmp_version = H5S_POINT_VERSION_1;
+
+ /* Get the file's low/high bounds */
+ if(H5CX_get_libver_bounds(&low_bound, &high_bound) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get low/high bounds from API context")
+
+ /* Upgrade to the version indicated by the file's low bound if higher */
+ tmp_version = MAX(tmp_version, H5O_sds_point_ver_bounds[low_bound]);
+
+ /* Version bounds check */
+ if(tmp_version > H5O_sds_point_ver_bounds[high_bound]) {
+ if(count_up_version)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The number of points in point selection exceeds 2^32")
+ else if(bound_up_version)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The end of bounding box in point selection exceeds 2^32")
+ else
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "Dataspace point selection version out of bounds")
+ }
+
+ /* Set the version to return */
+ *version = tmp_version;
+
+ /* Get the encoded size use based on version */
+ switch(tmp_version) {
+ case H5S_POINT_VERSION_1:
+ *enc_size = H5S_SELECT_INFO_ENC_SIZE_4;
+ break;
+
+ case H5S_POINT_VERSION_2:
+ /* Find max for num_elem and bounds_end[] */
+ max_size = space->select.num_elem;
+ for(u = 0; u < space->extent.rank; u++)
+ if(bounds_end[u] > max_size)
+ max_size = bounds_end[u];
+
+ /* Determine the encoding size */
+ if(max_size > H5S_UINT32_MAX)
+ *enc_size = H5S_SELECT_INFO_ENC_SIZE_8;
+ else if(max_size > H5S_UINT16_MAX)
+ *enc_size = H5S_SELECT_INFO_ENC_SIZE_4;
+ else
+ *enc_size = H5S_SELECT_INFO_ENC_SIZE_2;
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size")
+ break;
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S__point_get_version_enc_size() */
+
/*--------------------------------------------------------------------------
NAME
@@ -943,22 +1070,39 @@ done:
static hssize_t
H5S__point_serial_size(const H5S_t *space)
{
+ uint32_t version; /* Version number */
+ uint8_t enc_size; /* Encoded size of point selection info */
hssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
HDassert(space);
- /* Basic number of bytes required to serialize point selection:
- * <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> +
- * <length (4 bytes)> + <rank (4 bytes)> + <# of points (4 bytes)> = 24 bytes
- */
- ret_value = 24;
+ /* Determine the version and encoded size for point selection */
+ if(H5S__point_get_version_enc_size(space, &version, &enc_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version")
+
+ /* Basic number of bytes required to serialize point selection: */
+ if(version >= H5S_POINT_VERSION_2)
+ /*
+ * <type (4 bytes)> + <version (4 bytes)> +
+ * <size of point info (1 byte)> + rank (4 bytes)>
+ */
+ ret_value=13;
+ else
+ /*
+ * <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> +
+ * <length (4 bytes)> + <rank (4 bytes)>
+ */
+ ret_value = 20;
+
+ /* <num points (depend on enc_size)> */
+ ret_value += enc_size;
/* Count points in selection */
- /* (Add 4 bytes times the rank for each element selected) */
- ret_value += (4 * space->extent.rank) * (hssize_t)H5S_GET_SELECT_NPOINTS(space);
+ ret_value += (hssize_t) (enc_size * space->extent.rank * space->select.num_elem);
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__point_serial_size() */
@@ -988,54 +1132,112 @@ static herr_t
H5S__point_serialize(const H5S_t *space, uint8_t **p)
{
H5S_pnt_node_t *curr; /* Point information nodes */
- uint8_t *pp = (*p); /* Local pointer for decoding */
- uint8_t *lenp; /* Pointer to length location for later storage */
- uint32_t len = 0; /* Number of bytes used */
- unsigned u; /* Local counting variable */
+ uint8_t *pp; /* Local pointer for decoding */
+ uint8_t *lenp = NULL; /* pointer to length location for later storage */
+ uint32_t len=0; /* number of bytes used */
+ unsigned u; /* local counting variable */
+ uint32_t version; /* Version number */
+ uint8_t enc_size; /* Encoded size of point selection info */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
HDassert(p);
+ pp = (*p);
HDassert(pp);
+ /* Determine the version and encoded size for point selection info */
+ if(H5S__point_get_version_enc_size(space, &version, &enc_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version")
+
/* Store the preamble information */
UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
- UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */
- UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
- lenp = pp; /* Keep the pointer to the length location for later */
- pp += 4; /* Skip over space for length */
+
+ UINT32ENCODE(pp, version); /* Store the version number */
+ if(version >= 2) {
+ *(pp)++ = enc_size; /* Store size of point info */
+ } else {
+ HDassert(version == H5S_POINT_VERSION_1);
+ UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
+ lenp = pp; /* Keep the pointer to the length location for later */
+ pp += 4; /* Skip over space for length */
+ len += 8; /* Add in advance # of bytes for num of dimensions and num elements */
+ }
/* Encode number of dimensions */
UINT32ENCODE(pp, (uint32_t)space->extent.rank);
- len += 4;
- /* Encode number of elements */
- UINT32ENCODE(pp, (uint32_t)space->select.num_elem);
- len += 4;
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ HDassert(version == H5S_POINT_VERSION_2);
+
+ /* Encode number of elements */
+ UINT16ENCODE(pp, (uint16_t)space->select.num_elem);
+
+ /* Encode each point in selection */
+ curr=space->select.sel_info.pnt_lst->head;
+ while(curr!=NULL) {
+ /* Encode each point */
+ for(u=0; u<space->extent.rank; u++)
+ UINT16ENCODE(pp, (uint16_t)curr->pnt[u]);
+ curr=curr->next;
+ } /* end while */
+ break;
- /* Encode each point in selection */
- curr = space->select.sel_info.pnt_lst->head;
- while(curr != NULL) {
- /* Add 4 bytes times the rank for each element selected */
- len += 4 * space->extent.rank;
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ HDassert(version == H5S_POINT_VERSION_1 || version == H5S_POINT_VERSION_2);
- /* Encode each point */
- for(u = 0; u < space->extent.rank; u++)
- UINT32ENCODE(pp, (uint32_t)curr->pnt[u]);
+ /* Encode number of elements */
+ UINT32ENCODE(pp, (uint32_t)space->select.num_elem);
- curr = curr->next;
- } /* end while */
+ /* Encode each point in selection */
+ curr=space->select.sel_info.pnt_lst->head;
+ while(curr!=NULL) {
+ /* Encode each point */
+ for(u=0; u<space->extent.rank; u++)
+ UINT32ENCODE(pp, (uint32_t)curr->pnt[u]);
+ curr=curr->next;
+ } /* end while */
+
+ /* Add 4 bytes times the rank for each element selected */
+ if(version == H5S_POINT_VERSION_1)
+ len += (uint32_t)space->select.num_elem * 4 * space->extent.rank;
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ HDassert(version == H5S_POINT_VERSION_2);
+
+ /* Encode number of elements */
+ UINT64ENCODE(pp, space->select.num_elem);
+
+ /* Encode each point in selection */
+ curr=space->select.sel_info.pnt_lst->head;
+ while(curr!=NULL) {
+ /* Encode each point */
+ for(u=0; u<space->extent.rank; u++)
+ UINT64ENCODE(pp, curr->pnt[u]);
+ curr=curr->next;
+ } /* end while */
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size")
+ break;
- /* Encode length */
- UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */
+ } /* end switch */
+
+ if(version == H5S_POINT_VERSION_1)
+ UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */
/* Update encoding pointer */
*p = pp;
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__point_serialize() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S__point_serialize() */
+
/*--------------------------------------------------------------------------
@@ -1045,10 +1247,8 @@ H5S__point_serialize(const H5S_t *space, uint8_t **p)
Deserialize the current selection from a user-provided buffer.
USAGE
herr_t H5S__point_deserialize(space, p)
- H5S_t *space; IN/OUT: Dataspace pointer to place
+ H5S_t **space; IN/OUT: Dataspace pointer to place
selection into
- uint32_t version IN: Selection version
- uint8_t flags IN: Selection flags
uint8 **p; OUT: Pointer to buffer holding serialized
selection. Will be advanced to end of
serialized selection.
@@ -1063,12 +1263,16 @@ H5S__point_serialize(const H5S_t *space, uint8_t **p)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags,
- const uint8_t **p)
+H5S__point_deserialize(H5S_t **space, const uint8_t **p)
{
+ H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use,
+ either *space or a newly allocated one */
+ hsize_t dims[H5S_MAX_RANK]; /* Dimension sizes */
+ uint32_t version; /* Version number */
+ uint8_t enc_size = 0; /* Encoded size of selection info */
hsize_t *coord = NULL, *tcoord; /* Pointer to array of elements */
- const uint8_t *pp = (*p); /* Local pointer for decoding */
- size_t num_elem = 0; /* Number of elements in selection */
+ const uint8_t *pp; /* Local pointer for decoding */
+ uint64_t num_elem = 0; /* Number of elements in selection */
unsigned rank; /* Rank of points */
unsigned i, j; /* local counting variables */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1076,14 +1280,68 @@ H5S__point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5
FUNC_ENTER_STATIC
/* Check args */
- HDassert(space);
HDassert(p);
+ pp = (*p);
HDassert(pp);
- /* Deserialize points to select */
- /* (The header and rank have already beed decoded) */
- rank = space->extent.rank; /* Retrieve rank from space */
- UINT32DECODE(pp, num_elem); /* decode the number of points */
+ /* As part of the efforts to push all selection-type specific coding
+ to the callbacks, the coding for the allocation of a null dataspace
+ is moved from H5S_select_deserialize() in H5Sselect.c to here.
+ This is needed for decoding virtual layout in H5O__layout_decode() */
+ /* Allocate space if not provided */
+ if(!*space) {
+ if(NULL == (tmp_space = H5S_create(H5S_SIMPLE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace")
+ } /* end if */
+ else
+ tmp_space = *space;
+
+ /* Decode version */
+ UINT32DECODE(pp, version);
+
+ if(version >= (uint32_t)H5S_POINT_VERSION_2)
+ /* Decode size of point info */
+ enc_size = *(pp)++;
+ else {
+ /* Skip over the remainder of the header */
+ pp += 8;
+ enc_size = H5S_SELECT_INFO_ENC_SIZE_4;
+ }
+
+ /* Check encoded size */
+ if(enc_size & ~H5S_SELECT_INFO_ENC_SIZE_BITS)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown size of point/offset info for selection")
+
+ /* Decode the rank of the point selection */
+ UINT32DECODE(pp,rank);
+
+ if(!*space) {
+ /* Patch the rank of the allocated dataspace */
+ (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0]));
+ if(H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions")
+ } /* end if */
+ else
+ /* Verify the rank of the provided dataspace */
+ if(rank != tmp_space->extent.rank)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of serialized selection does not match dataspace")
+
+ /* decode the number of points */
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ UINT16DECODE(pp, num_elem);
+ break;
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ UINT32DECODE(pp, num_elem);
+ break;
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ UINT64DECODE(pp, num_elem);
+ break;
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size")
+ break;
+ } /* end switch */
+
/* Allocate space for the coordinates */
if(NULL == (coord = (hsize_t *)H5MM_malloc(num_elem * rank * sizeof(hsize_t))))
@@ -1092,16 +1350,40 @@ H5S__point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5
/* Retrieve the coordinates from the buffer */
for(tcoord = coord, i = 0; i < num_elem; i++)
for(j = 0; j < (unsigned)rank; j++, tcoord++)
- UINT32DECODE(pp, *tcoord);
+ switch(enc_size) {
+ case H5S_SELECT_INFO_ENC_SIZE_2:
+ UINT16DECODE(pp, *tcoord);
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_4:
+ UINT32DECODE(pp, *tcoord);
+ break;
+
+ case H5S_SELECT_INFO_ENC_SIZE_8:
+ UINT64DECODE(pp, *tcoord);
+ break;
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size")
+ break;
+ } /* end switch */
/* Select points */
- if(H5S_select_elements(space, H5S_SELECT_SET, num_elem, (const hsize_t *)coord) < 0)
+ if(H5S_select_elements(tmp_space, H5S_SELECT_SET, num_elem, (const hsize_t *)coord) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
/* Update decoding pointer */
*p = pp;
+ /* Return space to the caller if allocated */
+ if(!*space)
+ *space = tmp_space;
+
done:
+ /* Free temporary space if not passed to caller (only happens on error) */
+ if(!*space && tmp_space)
+ if(H5S_close(tmp_space) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
+
/* Free the coordinate array if necessary */
if(coord != NULL)
H5MM_xfree(coord);
@@ -1165,7 +1447,7 @@ H5S__get_select_elem_pointlist(const H5S_t *space, hsize_t startpoint,
/* Iterate through the node, copying each point's information */
while(node != NULL && numpoints > 0) {
- HDmemcpy(buf, node->pnt, sizeof(hsize_t) * rank);
+ H5MM_memcpy(buf, node->pnt, sizeof(hsize_t) * rank);
buf += rank;
numpoints--;
node = node->next;
@@ -1649,7 +1931,7 @@ H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of
/* Calculate offset of selection in projected buffer */
HDmemset(block, 0, sizeof(block));
- HDmemcpy(block, base_space->select.sel_info.pnt_lst->head->pnt, sizeof(hsize_t) * rank_diff);
+ H5MM_memcpy(block, base_space->select.sel_info.pnt_lst->head->pnt, sizeof(hsize_t) * rank_diff);
*offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block);
/* Iterate through base space's point nodes, copying the point information */
@@ -1666,7 +1948,7 @@ H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of
} /* end if */
/* Copy over the point's coordinates */
- HDmemcpy(new_node->pnt, &base_node->pnt[rank_diff], (new_space->extent.rank * sizeof(hsize_t)));
+ H5MM_memcpy(new_node->pnt, &base_node->pnt[rank_diff], (new_space->extent.rank * sizeof(hsize_t)));
/* Keep the order the same when copying */
if(NULL == prev_node)
@@ -1704,7 +1986,7 @@ H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of
/* Copy over the point's coordinates */
HDmemset(new_node->pnt, 0, sizeof(hsize_t) * rank_diff);
- HDmemcpy(&new_node->pnt[rank_diff], base_node->pnt, (new_space->extent.rank * sizeof(hsize_t)));
+ H5MM_memcpy(&new_node->pnt[rank_diff], base_node->pnt, (new_space->extent.rank * sizeof(hsize_t)));
/* Keep the order the same when copying */
if(NULL == prev_node)
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 561875a..c01beca 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -97,7 +97,7 @@ H5_DLL herr_t H5Sset_extent_simple(hid_t space_id, int rank,
const hsize_t dims[], const hsize_t max[]);
H5_DLL hid_t H5Scopy(hid_t space_id);
H5_DLL herr_t H5Sclose(hid_t space_id);
-H5_DLL herr_t H5Sencode(hid_t obj_id, void *buf, size_t *nalloc);
+H5_DLL herr_t H5Sencode2(hid_t obj_id, void *buf, size_t *nalloc, hid_t fapl);
H5_DLL hid_t H5Sdecode(const void *buf);
H5_DLL hssize_t H5Sget_simple_extent_npoints(hid_t space_id);
H5_DLL int H5Sget_simple_extent_ndims(hid_t space_id);
@@ -134,6 +134,16 @@ H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
hsize_t numblocks, hsize_t buf[/*numblocks*/]);
+/* Symbols defined for compatibility with previous versions of the HDF5 API.
+ *
+ * Use of these symbols is deprecated.
+ */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+/* Function prototypes */
+H5_DLL herr_t H5Sencode1(hid_t obj_id, void *buf, size_t *nalloc);
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
#ifdef __cplusplus
}
#endif
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 24586de..aaea203 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -114,7 +114,7 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset)
HDassert(offset);
/* Copy the offset over */
- HDmemcpy(space->select.offset, offset, sizeof(hssize_t) * space->extent.rank);
+ H5MM_memcpy(space->select.offset, offset, sizeof(hssize_t) * space->extent.rank);
/* Indicate that the offset was changed */
space->select.offset_changed = TRUE;
@@ -544,101 +544,44 @@ H5S_select_valid(const H5S_t *space)
herr_t
H5S_select_deserialize(H5S_t **space, const uint8_t **p)
{
- H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, either
- *space or a newly allocated one */
uint32_t sel_type; /* Pointer to the selection type */
- uint32_t version; /* Version number */
- uint8_t flags = 0; /* Flags */
herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
HDassert(space);
- /* Allocate space if not provided */
- if(!*space) {
- if(NULL == (tmp_space = H5S_create(H5S_SIMPLE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace")
- } /* end if */
- else
- tmp_space = *space;
+ /* Selection-type specific coding is moved to the callbacks. */
/* Decode selection type */
UINT32DECODE(*p, sel_type);
- /* Decode version */
- UINT32DECODE(*p, version);
-
- if(version >= (uint32_t)2) {
- /* Decode flags */
- flags = *(*p)++;
-
- /* Check for unknown flags */
- if(flags & ~H5S_SELECT_FLAG_BITS)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown flag for selection")
-
- /* Skip over the remainder of the header */
- *p += 4;
- } /* end if */
- else
- /* Skip over the remainder of the header */
- *p += 8;
-
- /* Decode and check or patch rank for point and hyperslab selections */
- if((sel_type == H5S_SEL_POINTS) || (sel_type == H5S_SEL_HYPERSLABS)) {
- uint32_t rank; /* Rank of dataspace */
-
- /* Decode the rank of the point selection */
- UINT32DECODE(*p,rank);
-
- if(!*space) {
- hsize_t dims[H5S_MAX_RANK];
-
- /* Patch the rank of the allocated dataspace */
- (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0]));
- if(H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions")
- } /* end if */
- else
- /* Verify the rank of the provided dataspace */
- if(rank != tmp_space->extent.rank)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of serialized selection does not match dataspace")
- } /* end if */
-
/* Make routine for selection type */
switch(sel_type) {
case H5S_SEL_POINTS: /* Sequence of points selected */
- ret_value = (*H5S_sel_point->deserialize)(tmp_space, version, flags, p);
+ ret_value = (*H5S_sel_point->deserialize)(space, p);
break;
case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */
- ret_value = (*H5S_sel_hyper->deserialize)(tmp_space, version, flags, p);
+ ret_value = (*H5S_sel_hyper->deserialize)(space, p);
break;
case H5S_SEL_ALL: /* Entire extent selected */
- ret_value = (*H5S_sel_all->deserialize)(tmp_space, version, flags, p);
+ ret_value = (*H5S_sel_all->deserialize)(space, p);
break;
case H5S_SEL_NONE: /* Nothing selected */
- ret_value = (*H5S_sel_none->deserialize)(tmp_space, version, flags, p);
+ ret_value = (*H5S_sel_none->deserialize)(space, p);
break;
default:
break;
} /* end switch */
+
if(ret_value < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "can't deserialize selection")
- /* Return space to the caller if allocated */
- if(!*space)
- *space = tmp_space;
-
done:
- /* Free temporary space if not passed to caller (only happens on error) */
- if(!*space && tmp_space)
- if(H5S_close(tmp_space) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_deserialize() */
@@ -1538,7 +1481,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
if(ndims > 0) {
/* Copy the size of the space */
HDassert(space->extent.size);
- HDmemcpy(space_size, space->extent.size, ndims * sizeof(hsize_t));
+ H5MM_memcpy(space_size, space->extent.size, ndims * sizeof(hsize_t));
} /* end if */
space_size[ndims] = elmt_size;
@@ -2192,16 +2135,16 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
rank_diff = new_space_rank - base_space_rank;
H5VM_array_fill(new_space_dims, &tmp_dim_size, sizeof(tmp_dim_size), rank_diff);
H5VM_array_fill(new_space_maxdims, &tmp_dim_size, sizeof(tmp_dim_size), rank_diff);
- HDmemcpy(&new_space_dims[rank_diff], base_space_dims, sizeof(new_space_dims[0]) * base_space_rank);
- HDmemcpy(&new_space_maxdims[rank_diff], base_space_maxdims, sizeof(new_space_maxdims[0]) * base_space_rank);
+ H5MM_memcpy(&new_space_dims[rank_diff], base_space_dims, sizeof(new_space_dims[0]) * base_space_rank);
+ H5MM_memcpy(&new_space_maxdims[rank_diff], base_space_maxdims, sizeof(new_space_maxdims[0]) * base_space_rank);
} /* end if */
else { /* new_space_rank < base_space_rank */
/* we must copy the fastest changing dimension of the
* base space into the dimensions of the new space.
*/
rank_diff = base_space_rank - new_space_rank;
- HDmemcpy(new_space_dims, &base_space_dims[rank_diff], sizeof(new_space_dims[0]) * new_space_rank);
- HDmemcpy(new_space_maxdims, &base_space_maxdims[rank_diff], sizeof(new_space_maxdims[0]) * new_space_rank);
+ H5MM_memcpy(new_space_dims, &base_space_dims[rank_diff], sizeof(new_space_dims[0]) * new_space_rank);
+ H5MM_memcpy(new_space_maxdims, &base_space_maxdims[rank_diff], sizeof(new_space_maxdims[0]) * new_space_rank);
} /* end else */
/* now have the new space rank and dimensions set up --
@@ -2232,10 +2175,10 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
if(H5S_GET_EXTENT_TYPE(base_space) == H5S_SIMPLE && base_space->select.offset_changed) {
if(new_space_rank > base_space_rank) {
HDmemset(new_space->select.offset, 0, sizeof(new_space->select.offset[0]) * rank_diff);
- HDmemcpy(&new_space->select.offset[rank_diff], base_space->select.offset, sizeof(new_space->select.offset[0]) * base_space_rank);
+ H5MM_memcpy(&new_space->select.offset[rank_diff], base_space->select.offset, sizeof(new_space->select.offset[0]) * base_space_rank);
} /* end if */
else
- HDmemcpy(new_space->select.offset, &base_space->select.offset[rank_diff], sizeof(new_space->select.offset[0]) * new_space_rank);
+ H5MM_memcpy(new_space->select.offset, &base_space->select.offset[rank_diff], sizeof(new_space->select.offset[0]) * new_space_rank);
/* Propagate the offset changed flag into the new dataspace. */
new_space->select.offset_changed = TRUE;
diff --git a/src/H5T.c b/src/H5T.c
index ad36492..8c8a9b7 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -513,6 +513,7 @@ H5FL_DEFINE(H5T_shared_t);
const unsigned H5O_dtype_ver_bounds[] = {
H5O_DTYPE_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V18 */
+ H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V110 */
H5O_DTYPE_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -3338,7 +3339,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
if (NULL == new_dt->shared->u.compnd.memb)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb,
+ H5MM_memcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb,
new_dt->shared->u.compnd.nmembs * sizeof(H5T_cmemb_t));
} /* end if */
@@ -3404,7 +3405,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
(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")
- HDmemcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value,
+ H5MM_memcpy(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++) {
s = old_dt->shared->u.enumer.name[i];
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 712b264..c6b85a5 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -1211,7 +1211,7 @@ H5T_save_refresh_state(hid_t tid, H5O_shared_t *cached_H5O_shared)
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));
+ H5MM_memcpy(cached_H5O_shared, &(vol_dt->sh_loc), sizeof(H5O_shared_t));
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1245,7 +1245,7 @@ H5T_restore_refresh_state(hid_t tid, H5O_shared_t *cached_H5O_shared)
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));
+ H5MM_memcpy(&(vol_dt->sh_loc), cached_H5O_shared, sizeof(H5O_shared_t));
/* Decrement the ref. count for this object in the top file */
if(H5FO_top_decr(vol_dt->sh_loc.file, vol_dt->sh_loc.u.loc.oh_addr) < 0)
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 9a1105b..7d47483 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -828,7 +828,7 @@ done: \
/* Macro defining action on source data which needs to be aligned (before main action) */
#define H5T_CONV_LOOP_PRE_SALIGN(ST) { \
- HDmemcpy(&src_aligned, src, sizeof(ST)); \
+ H5MM_memcpy(&src_aligned, src, sizeof(ST)); \
}
/* Macro defining action on source data which doesn't need to be aligned (before main action) */
@@ -854,7 +854,7 @@ done: \
/* Macro defining action on destination data which needs to be aligned (after main action) */
#define H5T_CONV_LOOP_POST_DALIGN(DT) { \
- HDmemcpy(dst, &dst_aligned, sizeof(DT)); \
+ H5MM_memcpy(dst, &dst_aligned, sizeof(DT)); \
}
/* Macro defining action on destination data which doesn't need to be aligned (after main action) */
@@ -1797,7 +1797,7 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* should copy the value to the true destination buffer.
*/
if(d == dbuf)
- HDmemcpy(dp, d, dst->shared->size);
+ H5MM_memcpy(dp, d, dst->shared->size);
if(buf_stride) {
sp += direction * (ssize_t)buf_stride; /* Note that cast is checked with H5_CHECK_OVERFLOW, above */
dp += direction * (ssize_t)buf_stride; /* Note that cast is checked with H5_CHECK_OVERFLOW, above */
@@ -2852,7 +2852,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
else if(except_ret == H5T_CONV_ABORT)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception")
} else
- HDmemcpy(d,
+ H5MM_memcpy(d,
dst->shared->u.enumer.value + (unsigned)priv->src2dst[n] * dst->shared->size,
dst->shared->size);
} /* end if */
@@ -2888,7 +2888,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
} /* end if */
else {
HDassert(priv->src2dst[md] >= 0);
- HDmemcpy(d,
+ H5MM_memcpy(d,
dst->shared->u.enumer.value + (unsigned)priv->src2dst[md] * dst->shared->size,
dst->shared->size);
} /* end else */
@@ -3846,7 +3846,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* should copy the value to the true destination buffer.
*/
if(d==dbuf)
- HDmemcpy(dp, d, dst->shared->size);
+ H5MM_memcpy(dp, d, dst->shared->size);
/* Advance source & destination pointers by delta amounts */
sp += src_delta;
@@ -4432,7 +4432,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
*/
next:
if(d == dbuf)
- HDmemcpy(dp, d, dst_p->shared->size);
+ H5MM_memcpy(dp, d, dst_p->shared->size);
/* Advance source & destination pointers by delta amounts */
sp += src_delta;
@@ -4604,7 +4604,7 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
--nchars;
nchars = MIN(dst->shared->size, nchars);
if(d != s)
- HDmemcpy(d, s, nchars);
+ H5MM_memcpy(d, s, nchars);
break;
case H5T_STR_RESERVED_3:
@@ -4666,7 +4666,7 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* should copy the value to the true destination buffer.
*/
if(d == dbuf)
- HDmemcpy(dp, d, dst->shared->size);
+ H5MM_memcpy(dp, d, dst->shared->size);
/* Advance source & destination pointers by delta amounts */
sp += src_delta;
@@ -8825,7 +8825,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* should copy the value to the true destination buffer.
*/
if (d==dbuf)
- HDmemcpy (dp, d, dst_p->shared->size);
+ H5MM_memcpy (dp, d, dst_p->shared->size);
if (buf_stride) {
sp += direction * (ssize_t) buf_stride;
dp += direction * (ssize_t) buf_stride;
@@ -9235,7 +9235,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* should copy the value to the true destination buffer.
*/
if (d==dbuf)
- HDmemcpy (dp, d, dst_p->shared->size);
+ H5MM_memcpy (dp, d, dst_p->shared->size);
if (buf_stride) {
sp += direction * (ssize_t) buf_stride;
dp += direction * (ssize_t) buf_stride;
diff --git a/src/H5Tenum.c b/src/H5Tenum.c
index 0ed1775..ff88fab 100644
--- a/src/H5Tenum.c
+++ b/src/H5Tenum.c
@@ -223,7 +223,7 @@ H5T__enum_insert(const H5T_t *dt, const char *name, const void *value)
dt->shared->u.enumer.sorted = H5T_SORT_NONE;
i = dt->shared->u.enumer.nmembs++;
dt->shared->u.enumer.name[i] = H5MM_xstrdup(name);
- HDmemcpy(dt->shared->u.enumer.value+i*dt->shared->size, value, dt->shared->size);
+ H5MM_memcpy(dt->shared->u.enumer.value+i*dt->shared->size, value, dt->shared->size);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -298,7 +298,7 @@ H5T__get_member_value(const H5T_t *dt, unsigned membno, void *value/*out*/)
HDassert(dt);
HDassert(value);
- HDmemcpy(value, dt->shared->u.enumer.value + membno*dt->shared->size, dt->shared->size);
+ H5MM_memcpy(value, dt->shared->u.enumer.value + membno*dt->shared->size, dt->shared->size);
FUNC_LEAVE_NOAPI(SUCCEED)
}
@@ -569,7 +569,7 @@ H5T_enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/)
if (cmp!=0)
HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "string doesn't exist in the enumeration type")
- HDmemcpy(value, copied_dt->shared->u.enumer.value+md*copied_dt->shared->size, copied_dt->shared->size);
+ H5MM_memcpy(value, copied_dt->shared->u.enumer.value+md*copied_dt->shared->size, copied_dt->shared->size);
done:
if(copied_dt)
diff --git a/src/H5Tfields.c b/src/H5Tfields.c
index be62d85..8202c2c 100644
--- a/src/H5Tfields.c
+++ b/src/H5Tfields.c
@@ -351,10 +351,10 @@ H5T__sort_value(const H5T_t *dt, int *map)
dt->shared->u.enumer.name[j + 1] = tmp;
/* Swap values */
- HDmemcpy(tbuf, dt->shared->u.enumer.value + (j * size), size);
- HDmemcpy(dt->shared->u.enumer.value + (j * size),
+ H5MM_memcpy(tbuf, dt->shared->u.enumer.value + (j * size), size);
+ H5MM_memcpy(dt->shared->u.enumer.value + (j * size),
dt->shared->u.enumer.value + ((j + 1) * size), size);
- HDmemcpy(dt->shared->u.enumer.value + ((j + 1) * size), tbuf, size);
+ H5MM_memcpy(dt->shared->u.enumer.value + ((j + 1) * size), tbuf, size);
/* Swap map */
if(map) {
@@ -457,10 +457,10 @@ H5T__sort_name(const H5T_t *dt, int *map)
dt->shared->u.enumer.name[j+1] = tmp;
/* Swap values */
- HDmemcpy(tbuf, dt->shared->u.enumer.value+j*size, size);
- HDmemcpy(dt->shared->u.enumer.value+j*size,
+ H5MM_memcpy(tbuf, dt->shared->u.enumer.value+j*size, size);
+ H5MM_memcpy(dt->shared->u.enumer.value+j*size,
dt->shared->u.enumer.value+(j+1)*size, size);
- HDmemcpy(dt->shared->u.enumer.value+(j+1)*size, tbuf, size);
+ H5MM_memcpy(dt->shared->u.enumer.value+(j+1)*size, tbuf, size);
/* Swap map */
if (map) {
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index c9ad01a..3554f75 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -369,7 +369,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member name")
if(H5T__get_member_value(dtype, u, tmp_memb_value) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value")
- HDmemcpy(memb_value, tmp_memb_value, H5T_get_size(super_type));
+ H5MM_memcpy(memb_value, tmp_memb_value, H5T_get_size(super_type));
if(H5T_convert(tpath, super_type_id, nat_super_type_id, (size_t)1, (size_t)0, (size_t)0, memb_value, NULL) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value")
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 841637d..bafb47f 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -302,7 +302,7 @@ H5T_vlen_seq_mem_getlen(const void *_vl)
FUNC_LEAVE_NOAPI((ssize_t)vl->len)
#else
HDassert(_vl);
- HDmemcpy(&vl, _vl, sizeof(hvl_t));
+ H5MM_memcpy(&vl, _vl, sizeof(hvl_t));
FUNC_LEAVE_NOAPI((ssize_t)vl.len)
#endif
@@ -339,7 +339,7 @@ H5T_vlen_seq_mem_getptr(void *_vl)
FUNC_LEAVE_NOAPI(vl->p)
#else
HDassert(_vl);
- HDmemcpy(&vl, _vl, sizeof(hvl_t));
+ H5MM_memcpy(&vl, _vl, sizeof(hvl_t));
FUNC_LEAVE_NOAPI(vl.p)
#endif
@@ -376,7 +376,7 @@ H5T_vlen_seq_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl)
FUNC_LEAVE_NOAPI((vl->len==0 || vl->p==NULL) ? TRUE : FALSE)
#else
HDassert(_vl);
- HDmemcpy(&vl, _vl, sizeof(hvl_t));
+ H5MM_memcpy(&vl, _vl, sizeof(hvl_t));
FUNC_LEAVE_NOAPI((vl.len==0 || vl.p==NULL) ? TRUE : FALSE)
#endif
@@ -411,13 +411,13 @@ H5T_vlen_seq_mem_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len)
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
HDassert(vl && vl->p);
- HDmemcpy(buf,vl->p,len);
+ H5MM_memcpy(buf,vl->p,len);
#else
HDassert(_vl);
- HDmemcpy(&vl, _vl, sizeof(hvl_t));
+ H5MM_memcpy(&vl, _vl, sizeof(hvl_t));
HDassert(vl.p);
- HDmemcpy(buf,vl.p,len);
+ H5MM_memcpy(buf,vl.p,len);
#endif
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -463,7 +463,7 @@ H5T_vlen_seq_mem_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_
} /* end else */
/* Copy the data into the newly allocated buffer */
- HDmemcpy(vl.p,buf,len);
+ H5MM_memcpy(vl.p,buf,len);
} /* end if */
else
@@ -473,7 +473,7 @@ H5T_vlen_seq_mem_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_
vl.len=seq_len;
/* Set pointer in user's buffer with memcpy, to avoid alignment issues */
- HDmemcpy(_vl,&vl,sizeof(hvl_t));
+ H5MM_memcpy(_vl,&vl,sizeof(hvl_t));
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -507,7 +507,7 @@ H5T_vlen_seq_mem_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSED
vl.p=NULL;
/* Set pointer in user's buffer with memcpy, to avoid alignment issues */
- HDmemcpy(_vl,&vl,sizeof(hvl_t));
+ H5MM_memcpy(_vl,&vl,sizeof(hvl_t));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5T_vlen_seq_mem_setnull() */
@@ -541,7 +541,7 @@ H5T_vlen_str_mem_getlen(const void *_vl)
HDassert(s);
#else
HDassert(_vl);
- HDmemcpy(&s, _vl, sizeof(char *));
+ H5MM_memcpy(&s, _vl, sizeof(char *));
#endif
FUNC_LEAVE_NOAPI((ssize_t)HDstrlen(s))
@@ -576,7 +576,7 @@ H5T_vlen_str_mem_getptr(void *_vl)
HDassert(s);
#else
HDassert(_vl);
- HDmemcpy(&s, _vl, sizeof(char *));
+ H5MM_memcpy(&s, _vl, sizeof(char *));
#endif
FUNC_LEAVE_NOAPI(s)
@@ -607,7 +607,7 @@ H5T_vlen_str_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl)
FUNC_ENTER_NOAPI_NOINIT_NOERR
#ifndef H5_NO_ALIGNMENT_RESTRICTIONS
- HDmemcpy(&s, _vl, sizeof(char *));
+ H5MM_memcpy(&s, _vl, sizeof(char *));
#endif
FUNC_LEAVE_NOAPI(s==NULL ? TRUE : FALSE)
@@ -644,10 +644,10 @@ H5T_vlen_str_mem_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len)
HDassert(s);
#else
HDassert(_vl);
- HDmemcpy(&s, _vl, sizeof(char *));
+ H5MM_memcpy(&s, _vl, sizeof(char *));
#endif
- HDmemcpy(buf,s,len);
+ H5MM_memcpy(buf,s,len);
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -690,11 +690,11 @@ H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_
} /* end else */
len=(seq_len*base_size);
- HDmemcpy(t,buf,len);
+ H5MM_memcpy(t,buf,len);
t[len]='\0';
/* Set pointer in user's buffer with memcpy, to avoid alignment issues */
- HDmemcpy(_vl,&t,sizeof(char *));
+ H5MM_memcpy(_vl,&t,sizeof(char *));
done:
FUNC_LEAVE_NOAPI(ret_value) /*lint !e429 The pointer in 't' has been copied */
@@ -721,7 +721,7 @@ H5T_vlen_str_mem_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSED
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Set pointer in user's buffer with memcpy, to avoid alignment issues */
- HDmemcpy(_vl,&t,sizeof(char *));
+ H5MM_memcpy(_vl,&t,sizeof(char *));
FUNC_LEAVE_NOAPI(SUCCEED) /*lint !e429 The pointer in 't' has been copied */
} /* end H5T_vlen_str_mem_setnull() */
diff --git a/src/H5VL.c b/src/H5VL.c
index aa276ec..fd45bf8 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -29,11 +29,8 @@
/***********/
#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 */
@@ -46,29 +43,10 @@
/* 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);
/*********************/
@@ -88,45 +66,6 @@ static int H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data);
/*-------------------------------------------------------------------------
- * 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
@@ -143,8 +82,7 @@ H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data)
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;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "*xi", cls, vipl_id);
@@ -161,25 +99,9 @@ H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id)
if (cls->wrap_cls.get_wrap_ctx && !cls->wrap_cls.free_wrap_ctx)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for object wrapping contexts when a get callback is provided")
- 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 */
+ /* Register connector */
+ 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")
done:
FUNC_LEAVE_API(ret_value)
@@ -203,8 +125,7 @@ done:
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;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "*si", name, vipl_id);
@@ -215,34 +136,9 @@ H5VLregister_connector_by_name(const char *name, hid_t vipl_id)
if (0 == HDstrlen(name))
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL connector name is disallowed")
- op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
- op_data.u.name = name;
- op_data.found_id = H5I_INVALID_HID;
-
- /* 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 */
+ /* Register connector */
+ if((ret_value = H5VL__register_connector_by_name(name, TRUE, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector")
done:
FUNC_LEAVE_API(ret_value)
@@ -266,8 +162,7 @@ done:
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;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "VCi", value, vipl_id);
@@ -276,34 +171,9 @@ H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id)
if(value < 0)
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "negative VOL connector value is disallowed")
- 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_VALUE;
- 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 */
+ /* Register connector */
+ if((ret_value = H5VL__register_connector_by_value(value, TRUE, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector")
done:
FUNC_LEAVE_API(ret_value)
@@ -315,33 +185,26 @@ done:
*
* 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
+ * Return: >0 if the VOL class has been registered
+ * 0 if it is unregistered
+ * <0 on error (if the class is not a valid class ID)
*
- * Negative on error (if the class is not a valid class ID)
+ * Programmer: Dana Robinson
+ * June 17, 2017
*
*-------------------------------------------------------------------------
*/
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;
+ /* Check if connector with this name is registered */
+ if((ret_value = H5VL__is_connector_registered(name)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't check for VOL")
done:
FUNC_LEAVE_API(ret_value)
@@ -356,30 +219,22 @@ done:
* Return: Positive if the VOL class has been registered
* Negative on error (if the class is not a valid class or not registered)
*
+ * Programmer: Dana Robinson
+ * June 17, 2017
+ *
*-------------------------------------------------------------------------
*/
hid_t
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 */
+ /* Get connector ID with this name */
+ if((ret_value = H5VL__get_connector_id(name, TRUE)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id")
done:
FUNC_LEAVE_API(ret_value)
@@ -406,7 +261,8 @@ H5VLget_connector_name(hid_t obj_id, char *name/*out*/, size_t size)
FUNC_ENTER_API(FAIL)
H5TRACE3("Zs", "ixz", obj_id, name, size);
- if ((ret_value = H5VL_get_connector_name(obj_id, name, size)) < 0)
+ /* Call internal routine */
+ 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:
@@ -488,6 +344,9 @@ done:
*
* Purpose: Compares two connector classes (based on their value field)
*
+ * Note: This routine is _only_ for HDF5 VOL connector authors! It is
+ * _not_ part of the public API for HDF5 application developers.
+ *
* Return: Success: Non-negative, *cmp set to a value like strcmp
*
* Failure: Negative, *cmp unset
@@ -587,3 +446,159 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5VLobject() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLretrieve_lib_state
+ *
+ * Purpose: Retrieves a copy of the internal state of the HDF5 library,
+ * so that it can be restored later.
+ *
+ * Note: This routine is _only_ for HDF5 VOL connector authors! It is
+ * _not_ part of the public API for HDF5 application developers.
+ *
+ * Return: Success: Non-negative, *state set
+ * Failure: Negative, *state unset
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 10, 2019
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLretrieve_lib_state(void **state)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ /* Must use this, to avoid modifying the API context stack in FUNC_ENTER */
+ FUNC_ENTER_API_NOINIT
+ H5TRACE1("e", "**x", state);
+
+ /* Check args */
+ if(NULL == state)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid state pointer")
+
+ /* Retrieve the library state */
+ if(H5VL_retrieve_lib_state(state) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve library state")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLretrieve_lib_state() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLrestore_lib_state
+ *
+ * Purpose: Restores the internal state of the HDF5 library.
+ *
+ * Note: This routine is _only_ for HDF5 VOL connector authors! It is
+ * _not_ part of the public API for HDF5 application developers.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 10, 2019
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLrestore_lib_state(const void *state)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ /* Must use this, to avoid modifying the API context stack in FUNC_ENTER */
+ FUNC_ENTER_API_NOINIT
+ H5TRACE1("e", "*x", state);
+
+ /* Check args */
+ if(NULL == state)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid state pointer")
+
+ /* Restore the library state */
+ if(H5VL_restore_lib_state(state) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't restore library state")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLrestore_lib_state() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLreset_lib_state
+ *
+ * Purpose: Resets the internal state of the HDF5 library, undoing the
+ * affects of H5VLrestore_lib_state.
+ *
+ * Note: This routine is _only_ for HDF5 VOL connector authors! It is
+ * _not_ part of the public API for HDF5 application developers.
+ *
+ * Note: This routine must be called as a "pair" with
+ * H5VLrestore_lib_state. It can be called before / after /
+ * independently of H5VLfree_lib_state.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, February 23, 2019
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLreset_lib_state(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ /* Must use this, to avoid modifying the API context stack in FUNC_ENTER */
+ FUNC_ENTER_API_NOINIT
+ H5TRACE0("e","");
+
+ /* Reset the library state */
+ if(H5VL_reset_lib_state() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset library state")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLreset_lib_state() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLfree_lib_state
+ *
+ * Purpose: Free a retrieved library state.
+ *
+ * Note: This routine is _only_ for HDF5 VOL connector authors! It is
+ * _not_ part of the public API for HDF5 application developers.
+ *
+ * Note: This routine must be called as a "pair" with
+ * H5VLretrieve_lib_state.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 10, 2019
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLfree_lib_state(void *state)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "*x", state);
+
+ /* Check args */
+ if(NULL == state)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid state pointer")
+
+ /* Free the library state */
+ if(H5VL_free_lib_state(state) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "can't free library state")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5VLfree_lib_state() */
+
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index 5a5d9ee..b785747 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -355,7 +355,7 @@ H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info,
else if(connector->info_cls.size > 0) {
if(NULL == (new_connector_info = H5MM_malloc(connector->info_cls.size)))
HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "connector info allocation failed")
- HDmemcpy(new_connector_info, src_info, connector->info_cls.size);
+ H5MM_memcpy(new_connector_info, src_info, connector->info_cls.size);
} /* end else-if */
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "no way to copy connector info")
@@ -506,20 +506,25 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_free_connector_info(const H5VL_class_t *connector, void *info)
+H5VL_free_connector_info(hid_t connector_id, void *info)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- /* Sanity checks */
- HDassert(connector);
+ /* Sanity check */
+ HDassert(connector_id > 0);
+
+ /* Check args and get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Only free info object, if it's non-NULL */
if(info) {
/* Allow the connector to free info or do it ourselves */
- if(connector->info_cls.free) {
- if((connector->info_cls.free)(info) < 0)
+ if(cls->info_cls.free) {
+ if((cls->info_cls.free)(info) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed")
} /* end if */
else
@@ -544,18 +549,13 @@ done:
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)
+ if(H5VL_free_connector_info(connector_id, info) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
done:
@@ -623,24 +623,9 @@ H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info)
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->info_cls.from_str) {
- if((cls->info_cls.from_str)(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;
+ /* Call internal routine */
+ if(H5VL__connector_str_to_info(str, connector_id, info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "can't deserialize connector info")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
@@ -755,84 +740,89 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL_free_wrap_ctx
+ * Function: H5VL_wrap_object
*
- * Purpose: Free object wrapping context for a connector
+ * Purpose: Wrap an object with connector
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-NULL
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx)
+void *
+H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj,
+ H5I_type_t obj_type)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(NULL)
/* Sanity checks */
HDassert(connector);
+ HDassert(obj);
- /* Only free wrap context, if it's non-NULL */
+ /* Only wrap object if there's a wrap context */
if(wrap_ctx) {
- /* Free the connector's object wrapping context */
- if((connector->wrap_cls.free_wrap_ctx)(wrap_ctx) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector wrap context free request failed")
+ /* Ask the connector to wrap the object */
+ if(NULL == (ret_value = (connector->wrap_cls.wrap_object)(obj, obj_type, 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_free_wrap_ctx() */
+} /* end H5VL_wrap_object() */
/*---------------------------------------------------------------------------
- * Function: H5VLfree_wrap_ctx
+ * Function: H5VLwrap_object
*
- * Purpose: Release a VOL connector's object wrapping context
+ * Purpose: Asks a connector to wrap an underlying object.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-NULL
+ * Failure: NULL
*
*---------------------------------------------------------------------------
*/
-herr_t
-H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id)
+void *
+H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_ctx)
{
- H5VL_class_t *cls; /* VOL connector's class struct */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE2("e", "*xi", wrap_ctx, connector_id);
+ H5TRACE4("*x", "*xIti*x", obj, obj_type, 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, FAIL, "not a VOL connector ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "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")
+ /* Wrap the object */
+ if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj, obj_type)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
-} /* H5VLfree_wrap_ctx() */
+} /* H5VLwrap_object */
/*-------------------------------------------------------------------------
- * Function: H5VL_wrap_object
+ * Function: H5VL_unwrap_object
*
- * Purpose: Wrap an object with connector
+ * Purpose: Unwrap an object from connector
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-NULL
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
void *
-H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj,
- H5I_type_t obj_type)
+H5VL_unwrap_object(const H5VL_class_t *connector, void *obj)
{
- void *ret_value = SUCCEED; /* Return value */
+ void *ret_value; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -840,24 +830,24 @@ H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj,
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_cls.wrap_object)(obj, obj_type, wrap_ctx)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object")
+ /* Only unwrap object if there's an unwrap callback */
+ if(connector->wrap_cls.wrap_object) {
+ /* Ask the connector to unwrap the object */
+ if(NULL == (ret_value = (connector->wrap_cls.unwrap_object)(obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't unwrap object")
} /* end if */
else
ret_value = obj;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_wrap_object() */
+} /* end H5VL_unwrap_object() */
/*---------------------------------------------------------------------------
- * Function: H5VLwrap_object
+ * Function: H5VLunwrap_object
*
- * Purpose: Asks a connector to wrap an underlying object.
+ * Purpose: Unwrap an object from connector
*
* Return: Success: Non-NULL
* Failure: NULL
@@ -865,13 +855,13 @@ done:
*---------------------------------------------------------------------------
*/
void *
-H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_ctx)
+H5VLunwrap_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
- H5TRACE4("*x", "*xIti*x", obj, obj_type, connector_id, wrap_ctx);
+ H5TRACE2("*x", "*xi", obj, connector_id);
/* Check args and get class pointer */
if(NULL == obj)
@@ -879,13 +869,77 @@ H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_c
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, obj_type)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object")
+ /* Unwrap the object */
+ if(NULL == (ret_value = H5VL_unwrap_object(cls, obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to unwrap object")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
-} /* H5VLwrap_object */
+} /* H5VLunwrap_object */
+
+
+/*-------------------------------------------------------------------------
+ * 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->wrap_cls.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() */
/*-------------------------------------------------------------------------
diff --git a/src/H5VLint.c b/src/H5VLint.c
index 5aa25d2..1b735f5 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -29,14 +29,19 @@
/* 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 */
+#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 "H5PLprivate.h" /* Plugins */
+#include "H5Tprivate.h" /* Datatypes */
+#include "H5VLpkg.h" /* Virtual Object Layer */
+
+/* VOL connectors */
+#include "H5VLnative.h" /* Native VOL connector */
+#include "H5VLpassthru.h" /* Pass-through VOL connector */
/****************/
@@ -51,10 +56,28 @@
/* 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 */
+ H5VL_t *connector; /* VOL connector for "outermost" class to start wrap */
void *obj_wrap_ctx; /* "wrap context" for outermost connector */
} H5VL_wrap_ctx_t;
+/* 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;
+
/********************/
/* Package Typedefs */
@@ -65,10 +88,15 @@ typedef struct H5VL_wrap_ctx_t {
/* Local Prototypes */
/********************/
static herr_t H5VL__free_cls(H5VL_class_t *cls);
+static int H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data);
+static herr_t H5VL__set_def_conn(void);
static void *H5VL__wrap_obj(void *obj, H5I_type_t obj_type);
static H5VL_object_t *H5VL__new_vol_obj(H5I_type_t type, void *object,
H5VL_t *vol_connector, hbool_t wrap_obj);
+static int64_t H5VL__conn_inc_rc(H5VL_t *connector);
+static int64_t H5VL__conn_dec_rc(H5VL_t *connector);
static void *H5VL__object(hid_t id, H5I_type_t obj_type);
+static herr_t H5VL__free_vol_wrapper(H5VL_wrap_ctx_t *vol_wrap_ctx);
/*********************/
@@ -83,6 +111,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Library Private Variables */
/*****************************/
+
/*******************/
/* Local Variables */
/*******************/
@@ -107,21 +136,27 @@ H5FL_DEFINE(H5VL_object_t);
/* Declare a free list to manage the H5VL_wrap_ctx_t struct */
H5FL_DEFINE_STATIC(H5VL_wrap_ctx_t);
+/* Default VOL connector */
+static H5VL_connector_prop_t H5VL_def_conn_s = {-1, NULL};
+
/*-------------------------------------------------------------------------
- * Function: H5VL_init
+ * Function: H5VL_init_phase1
*
- * Purpose: Initialize the interface from some other package
+ * Purpose: Initialize the interface from some other package. This should
+ * be followed with a call to H5VL_init_phase2 after the H5P
+ * interface is completely set up, finish setting up the H5VL
+ * information.
*
- * Return: Success: Non-negative
*
+ * Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_init(void)
+H5VL_init_phase1(void)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -131,7 +166,36 @@ H5VL_init(void)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_init() */
+} /* end H5VL_init_phase1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_init_phase2
+ *
+ * Purpose: Finish initializing the interface from some other package.
+ *
+ * Note: This is broken out as a separate routine to avoid a circular
+ * reference with the H5P package.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_init_phase2(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set up the default VOL connector in the default FAPL */
+ if(H5VL__set_def_conn() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to set default VOL connector")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_init_phase2() */
/*-------------------------------------------------------------------------
@@ -148,12 +212,12 @@ done:
herr_t
H5VL__init_package(void)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ 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)
+ if(H5I_register_type(H5I_VOL_CLS) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize H5VL interface")
done:
@@ -180,17 +244,27 @@ H5VL_term_package(void)
FUNC_ENTER_NOAPI_NOINIT_NOERR
if(H5_PKG_INIT_VAR) {
- if (H5I_nmembers(H5I_VOL) > 0) {
- (void)H5I_clear_type(H5I_VOL, FALSE, FALSE);
+ if(H5VL_def_conn_s.connector_id > 0) {
+ /* Release the default VOL connector */
+ (void)H5VL_conn_free(&H5VL_def_conn_s);
+ H5VL_def_conn_s.connector_id = -1;
+ H5VL_def_conn_s.connector_info = NULL;
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;
+ if(H5I_nmembers(H5I_VOL) > 0) {
+ /* Unregister all VOL connectors */
+ (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 else */
} /* end if */
@@ -234,6 +308,182 @@ done:
/*-------------------------------------------------------------------------
+ * 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
+ *
+ * Programmer: Dana Robinson
+ * June 22, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+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: H5VL__set_def_conn
+ *
+ * Purpose: Parses a string that contains the default VOL connector for
+ * the library.
+ *
+ * Note: Usually from the environment variable "HDF5_VOL_CONNECTOR",
+ * but could be from elsewhere.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Jordan Henderson
+ * November 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__set_def_conn(void)
+{
+ H5P_genplist_t *def_fapl; /* Default file access property list */
+ H5P_genclass_t *def_fapclass; /* Default file access property class */
+ const char *env_var; /* Environment variable for default VOL connector */
+ char *buf = NULL; /* Buffer for tokenizing string */
+ hid_t connector_id = -1; /* VOL conntector ID */
+ void *vol_info = NULL; /* VOL connector info */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(H5VL_def_conn_s.connector_id == (-1));
+ HDassert(H5VL_def_conn_s.connector_info == NULL);
+
+ /* Check for environment variable set */
+ env_var = HDgetenv("HDF5_VOL_CONNECTOR");
+
+ /* Only parse the string if it's set */
+ if(env_var && *env_var) {
+ char *lasts = NULL; /* Context pointer for strtok_r() call */
+ const char *tok = NULL; /* Token from strtok_r call */
+ htri_t connector_is_registered; /* Whether connector is already registered */
+
+ /* Duplicate the string to parse, as it is modified as we go */
+ if(NULL == (buf = H5MM_strdup(env_var)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate memory for environment variable string")
+
+ /* Get the first 'word' of the environment variable.
+ * If it's nothing (environment variable was whitespace) return error.
+ */
+ if(NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "VOL connector environment variable set empty?")
+
+ /* First, check to see if the connector is already registered */
+ if((connector_is_registered = H5VL__is_connector_registered(tok)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't check if VOL connector already registered")
+ else if(connector_is_registered) {
+ /* Retrieve the ID of the already-registered VOL connector */
+ if((connector_id = H5VL__get_connector_id(tok, FALSE)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector ID")
+ } /* end else-if */
+ else {
+ /* Check for VOL connectors that ship with the library */
+ if(!HDstrcmp(tok, "native")) {
+ connector_id = H5VL_NATIVE;
+ if(H5I_inc_ref(connector_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, FAIL, "can't increment VOL connector refcount")
+ } /* end if */
+ else if(!HDstrcmp(tok, "pass_through")) {
+ connector_id = H5VL_PASSTHRU;
+ if(H5I_inc_ref(connector_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, FAIL, "can't increment VOL connector refcount")
+ } /* end else-if */
+ else {
+ /* Register the VOL connector */
+ /* (NOTE: No provisions for vipl_id currently) */
+ if((connector_id = H5VL__register_connector_by_name(tok, FALSE, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register connector")
+ } /* end else */
+ } /* end else */
+
+ /* Was there any connector info specified in the environment variable? */
+ if(NULL != (tok = HDstrtok_r(NULL, " \t\n\r", &lasts)))
+ if(H5VL__connector_str_to_info(tok, connector_id, &vol_info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "can't deserialize connector info")
+
+ /* Set the default VOL connector */
+ H5VL_def_conn_s.connector_id = connector_id;
+ H5VL_def_conn_s.connector_info = vol_info;
+ } /* end if */
+ else {
+ /* Set the default VOL connector */
+ H5VL_def_conn_s.connector_id = H5_DEFAULT_VOL;
+ H5VL_def_conn_s.connector_info = NULL;
+
+ /* Increment the ref count on the default connector */
+ if(H5I_inc_ref(H5VL_def_conn_s.connector_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, FAIL, "can't increment VOL connector refcount")
+ } /* end else */
+
+ /* Get default file access pclass */
+ if(NULL == (def_fapclass = (H5P_genclass_t *)H5I_object(H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADATOM, FAIL, "can't find object for default file access property class ID")
+
+ /* Change the default VOL for the default file access pclass */
+ if(H5P_reset_vol_class(def_fapclass, &H5VL_def_conn_s) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set default VOL connector for default file access property class")
+
+ /* Get default file access plist */
+ if(NULL == (def_fapl = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADATOM, FAIL, "can't find object for default fapl ID")
+
+ /* Change the default VOL for the default FAPL */
+ if(H5P_set_vol(def_fapl, H5VL_def_conn_s.connector_id, H5VL_def_conn_s.connector_info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set default VOL connector for default FAPL")
+
+done:
+ /* Clean up on error */
+ if(ret_value < 0) {
+ if(vol_info)
+ if(H5VL_free_connector_info(connector_id, vol_info) < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "can't free VOL connector info")
+ if(connector_id >= 0)
+ /* The H5VL_class_t struct will be freed by this function */
+ if(H5I_dec_ref(connector_id) < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL connector")
+ } /* end if */
+
+ /* Clean up */
+ H5MM_xfree(buf);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__set_def_conn() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL__wrap_obj
*
* Purpose: Wraps a library object with possible VOL connector wrappers, to
@@ -317,7 +567,7 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t
new_vol_obj->data = object;
/* Bump the reference count on the VOL connector */
- vol_connector->nrefs++;
+ H5VL__conn_inc_rc(vol_connector);
/* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */
if(H5I_DATATYPE == type) {
@@ -393,29 +643,22 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_conn_free(const H5VL_connector_prop_t *info)
+H5VL_conn_free(const H5VL_connector_prop_t *connector_prop)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if(info) {
+ if(connector_prop) {
/* 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")
-
+ if(connector_prop->connector_id > 0) {
+ if(connector_prop->connector_info)
/* Free the connector info */
- if(H5VL_free_connector_info(connector, (void *)info->connector_info) < 0) /* Casting away const OK - QAK */
+ if(H5VL_free_connector_info(connector_prop->connector_id, (void *)connector_prop->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)
+ if(H5I_dec_ref(connector_prop->connector_id) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID")
} /* end if */
} /* end if */
@@ -550,6 +793,76 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL__conn_inc_rc
+ *
+ * Purpose: Wrapper to increment the ref. count on a connector.
+ *
+ * Return: Current ref. count (can't fail)
+ *
+ * Programmer: Quincey Koziol
+ * February 23, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static int64_t
+H5VL__conn_inc_rc(H5VL_t *connector)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check arguments */
+ HDassert(connector);
+
+ /* Increment refcount for connector */
+ connector->nrefs++;
+
+ FUNC_LEAVE_NOAPI(connector->nrefs)
+} /* end H5VL__conn_inc_rc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__conn_dec_rc
+ *
+ * Purpose: Wrapper to decrement the ref. count on a connector.
+ *
+ * Return: Current ref. count (>=0) on success, <0 on failure
+ *
+ * Programmer: Quincey Koziol
+ * February 23, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static int64_t
+H5VL__conn_dec_rc(H5VL_t *connector)
+{
+ int64_t ret_value = -1; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check arguments */
+ HDassert(connector);
+
+ /* Decrement refcount for connector */
+ connector->nrefs--;
+
+ /* Check for last reference */
+ if(0 == connector->nrefs) {
+ if(H5I_dec_ref(connector->id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector")
+ H5FL_FREE(H5VL_t, connector);
+
+ /* Set return value */
+ ret_value = 0;
+ } /* end if */
+ else
+ /* Set return value */
+ ret_value = connector->nrefs;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__conn_dec_rc() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_free_object
*
* Purpose: Wrapper to unregister an object ID with a VOL aux struct
@@ -562,20 +875,16 @@ done:
herr_t
H5VL_free_object(H5VL_object_t *vol_obj)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(SUCCEED)
+ FUNC_ENTER_NOAPI(FAIL)
/* 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 */
+ /* Decrement refcount on connector */
+ if(H5VL__conn_dec_rc(vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector")
vol_obj = H5FL_FREE(H5VL_object_t, vol_obj);
@@ -595,6 +904,9 @@ done:
*
* Failure: H5I_INVALID_HID
*
+ * Programmer: Dana Robinson
+ * June 22, 2017
+ *
*-------------------------------------------------------------------------
*/
hid_t
@@ -610,9 +922,9 @@ H5VL_register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id)
HDassert(cls);
/* Copy the class structure so the caller can reuse or free it */
- if (NULL == (saved = H5FL_CALLOC(H5VL_class_t)))
+ if(NULL == (saved = H5FL_MALLOC(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));
+ H5MM_memcpy(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")
@@ -621,23 +933,319 @@ H5VL_register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id)
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)
+ 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 && saved) {
- if (saved->name)
+ if(ret_value < 0 && saved) {
+ if(saved->name)
H5MM_xfree((void *)(saved->name)); /* Casting away const OK -QAK */
H5FL_FREE(H5VL_class_t, saved);
- }
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_register_connector() */
/*-------------------------------------------------------------------------
- * Function: H5VL_get_connector_name
+ * 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
+ *
+ * Programmer: Dana Robinson
+ * June 22, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL__register_connector(const H5VL_class_t *cls, hbool_t app_ref, hid_t vipl_id)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Set up op data for iteration */
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = cls->name;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* 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, app_ref) < 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, app_ref, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__register_connector() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__register_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
+ *
+ * Programmer: Dana Robinson
+ * June 22, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL__register_connector_by_name(const char *name, hbool_t app_ref, hid_t vipl_id)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Set up op data for iteration */
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = name;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* 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, app_ref) < 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, app_ref, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__register_connector_by_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__register_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
+ *
+ * Programmer: Dana Robinson
+ * June 22, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL__register_connector_by_value(H5VL_class_value_t value, hbool_t app_ref, hid_t vipl_id)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Set up op data for iteration */
+ op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE;
+ op_data.u.value = value;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* 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, app_ref) < 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_VALUE;
+ 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, app_ref, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__register_connector_by_value() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__is_connector_registered
+ *
+ * Purpose: Checks if a connector with a particular name is registered.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Dana Robinson
+ * June 17, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5VL__is_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_PACKAGE
+
+ /* Set up op data for iteration */
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = name;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Find connector with name */
+ 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 connectors")
+
+ /* Found a connector with that name */
+ if(op_data.found_id != H5I_INVALID_HID)
+ ret_value = TRUE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__is_connector_registered() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__get_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)
+ *
+ * Programmer: Dana Robinson
+ * June 17, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL__get_connector_id(const char *name, hbool_t is_api)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Set up op data for iteration */
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = name;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Find connector with name */
+ 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 connectors")
+
+ /* Found a connector with that name */
+ if(op_data.found_id != H5I_INVALID_HID) {
+ if(H5I_inc_ref(op_data.found_id, is_api) < 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_NOAPI(ret_value)
+} /* end H5VL__get_connector_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__connector_str_to_info
+ *
+ * Purpose: Deserializes a string into a connector's info object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * March 2, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__connector_str_to_info(const char *str, hid_t connector_id, void **info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* 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_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Allow the connector to deserialize info */
+ if(cls->info_cls.from_str) {
+ if((cls->info_cls.from_str)(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_NOAPI(ret_value)
+} /* end H5VL__connector_str_to_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__get_connector_name
*
* Purpose: Private version of H5VLget_connector_name
*
@@ -647,14 +1255,14 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5VL_get_connector_name(hid_t id, char *name /*out*/, size_t size)
+H5VL__get_connector_name(hid_t id, char *name /*out*/, size_t size)
{
H5VL_object_t *vol_obj;
const H5VL_class_t *cls;
size_t len;
ssize_t ret_value = -1;
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* get the object pointer */
if (NULL == (vol_obj = H5VL_vol_object(id)))
@@ -674,7 +1282,7 @@ H5VL_get_connector_name(hid_t id, char *name /*out*/, size_t size)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_get_connector_name() */
+} /* end H5VL__get_connector_name() */
/*-------------------------------------------------------------------------
@@ -750,6 +1358,32 @@ H5VL_object_data(const H5VL_object_t *vol_obj)
/*-------------------------------------------------------------------------
+ * Function: H5VL_object_unwrap
+ *
+ * Purpose: Correctly unwrap the 'data' field for a VOL object (H5VL_object),
+ * even for nested / stacked VOL connectors.
+ *
+ * Return: Success: Object pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_object_unwrap(const H5VL_object_t *vol_obj)
+{
+ void *ret_value = NULL;
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ if(NULL == (ret_value = H5VL_unwrap_object(vol_obj->connector->cls, vol_obj->data)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't unwrap object")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_object_unwrap() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL__object
*
* Purpose: Internal function to return the VOL object pointer associated
@@ -836,7 +1470,7 @@ H5VL_object(hid_t id)
/* 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")
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't retrieve object for ID")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -952,6 +1586,189 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL_retrieve_lib_state
+ *
+ * Purpose: Retrieve the state of the library.
+ *
+ * Note: Currently just retrieves the API context state, but could be
+ * expanded in the future.
+ *
+ * Return: Success: Non-negative, *state set
+ * Failure: Negative, *state unset
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_retrieve_lib_state(void **state)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(state);
+
+ /* Retrieve the API context state */
+ if(H5CX_retrieve_state((H5CX_state_t **)state) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get API context state")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_retrieve_lib_state() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_restore_lib_state
+ *
+ * Purpose: Restore the state of the library.
+ *
+ * Note: Currently just restores the API context state, but could be
+ * expanded in the future.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 10, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_restore_lib_state(const void *state)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(state);
+
+ /* Push a new API context on the stack */
+ if(H5CX_push() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't push API context")
+
+ /* Restore the API context state */
+ if(H5CX_restore_state((const H5CX_state_t *)state) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set API context state")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_restore_lib_state() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_reset_lib_state
+ *
+ * Purpose: Reset the state of the library, undoing affects of
+ * H5VL_restore_lib_state.
+ *
+ * Note: Currently just resets the API context state, but could be
+ * expanded in the future.
+ *
+ * Note: This routine must be called as a "pair" with
+ * H5VL_restore_lib_state. It can be called before / after /
+ * independently of H5VL_free_lib_state.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, February 23, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_reset_lib_state(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Pop the API context off the stack */
+ if(H5CX_pop() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't pop API context")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_reset_lib_state() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_free_lib_state
+ *
+ * Purpose: Free a library state.
+ *
+ * Note: This routine must be called as a "pair" with
+ * H5VL_retrieve_lib_state.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 10, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_free_lib_state(void *state)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(state);
+
+ /* Free the API context state */
+ if(H5CX_free_state((H5CX_state_t *)state) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "can't free API context state")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_free_lib_state() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__free_vol_wrapper
+ *
+ * Purpose: Free object wrapping context for VOL connector
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, January 9, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__free_vol_wrapper(H5VL_wrap_ctx_t *vol_wrap_ctx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(vol_wrap_ctx);
+ HDassert(0 == vol_wrap_ctx->rc);
+ HDassert(vol_wrap_ctx->connector);
+ HDassert(vol_wrap_ctx->connector->cls);
+
+ /* 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->wrap_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")
+
+ /* Decrement refcount on connector */
+ if(H5VL__conn_dec_rc(vol_wrap_ctx->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector")
+
+ /* Release object wrapping context */
+ H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__free_vol_wrapper() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_set_vol_wrapper
*
* Purpose: Set up object wrapping context for current VOL connector
@@ -961,7 +1778,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_set_vol_wrapper(void *obj, const H5VL_t *connector)
+H5VL_set_vol_wrapper(void *obj, H5VL_t *connector)
{
H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */
void *obj_wrap_ctx = NULL; /* VOL connector's wrapping context */
@@ -993,8 +1810,11 @@ H5VL_set_vol_wrapper(void *obj, const H5VL_t *connector)
if(NULL == (vol_wrap_ctx = H5FL_MALLOC(H5VL_wrap_ctx_t)))
HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate VOL wrap context")
+ /* Increment the outstanding objects that are using the connector */
+ H5VL__conn_inc_rc(connector);
+
/* Set up VOL object wrapper context */
- vol_wrap_ctx->rc = 1;;
+ vol_wrap_ctx->rc = 1;
vol_wrap_ctx->connector = connector;
vol_wrap_ctx->obj_wrap_ctx = obj_wrap_ctx;
} /* end if */
@@ -1016,6 +1836,80 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL_inc_vol_wrapper
+ *
+ * Purpose: Increment refcount on object wrapping context
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, January 9, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_inc_vol_wrapper(void *_vol_wrap_ctx)
+{
+ H5VL_wrap_ctx_t *vol_wrap_ctx = (H5VL_wrap_ctx_t *)_vol_wrap_ctx; /* VOL object wrapping context */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check for valid, active VOL object wrap context */
+ if(NULL == vol_wrap_ctx)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "no VOL object wrap context?")
+ if(0 == vol_wrap_ctx->rc)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "bad VOL object wrap context refcount?")
+
+ /* Increment ref count on wrapping context */
+ vol_wrap_ctx->rc++;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_inc_vol_wrapper() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dec_vol_wrapper
+ *
+ * Purpose: Decrement refcount on object wrapping context, releasing it
+ * if the refcount drops to zero.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, January 9, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_dec_vol_wrapper(void *_vol_wrap_ctx)
+{
+ H5VL_wrap_ctx_t *vol_wrap_ctx = (H5VL_wrap_ctx_t *)_vol_wrap_ctx; /* VOL object wrapping context */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check for valid, active VOL object wrap context */
+ if(NULL == vol_wrap_ctx)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "no VOL object wrap context?")
+ if(0 == vol_wrap_ctx->rc)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "bad VOL object wrap context refcount?")
+
+ /* 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(H5VL__free_vol_wrapper(vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL object wrapping context")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_dec_vol_wrapper() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_reset_vol_wrapper
*
* Purpose: Reset object wrapping context for current VOL connector
@@ -1045,25 +1939,18 @@ H5VL_reset_vol_wrapper(void)
/* Release context if the ref count drops to zero */
if(0 == vol_wrap_ctx->rc) {
- /* If there is a VOL 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->wrap_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);
+ if(H5VL__free_vol_wrapper(vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL object wrapping context")
/* 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 {
+ 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)
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index f4f3b5f..7848c5d 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -50,6 +50,7 @@ static H5VL_class_t H5VL_native_cls_g = {
NULL, /* get_object */
NULL, /* get_wrap_ctx */
NULL, /* wrap_object */
+ NULL, /* unwrap_object */
NULL /* free_wrap_ctx */
},
{ /* attribute_cls */
diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c
index 624cd30..8903911 100644
--- a/src/H5VLnative_file.c
+++ b/src/H5VLnative_file.c
@@ -228,6 +228,19 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type,
break;
}
+ /* H5Fget_fileno */
+ case H5VL_FILE_GET_FILENO:
+ {
+ unsigned long *fileno = HDva_arg(arguments, unsigned long *);
+ unsigned long my_fileno = 0;
+
+ f = (H5F_t *)obj;
+ H5F_GET_FILENO(f, my_fileno);
+ *fileno = my_fileno; /* sigh */
+
+ break;
+ }
+
/* H5Fget_name */
case H5VL_FILE_GET_NAME:
{
diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c
index fe72000..85a9346 100644
--- a/src/H5VLpassthru.c
+++ b/src/H5VLpassthru.c
@@ -20,6 +20,11 @@
* include _any_ private HDF5 header files. This connector should
* therefore only make public HDF5 API calls and use standard C /
* POSIX calls.
+ *
+ * Note that the HDF5 error stack must be preserved on code paths
+ * that could be invoked when the underlying VOL connector's
+ * callback can fail.
+ *
*/
@@ -93,9 +98,10 @@ static herr_t H5VL_pass_through_str_to_info(const char *str, void **info);
/* VOL object wrap / retrieval callbacks */
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, H5I_type_t obj_type,
void *wrap_ctx);
+static void *H5VL_pass_through_unwrap_object(void *obj);
+static herr_t H5VL_pass_through_free_wrap_ctx(void *obj);
/* 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);
@@ -189,6 +195,7 @@ static const H5VL_class_t H5VL_pass_through_g = {
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_unwrap_object, /* unwrap_object */
H5VL_pass_through_free_wrap_ctx, /* free_wrap_ctx */
},
{ /* attribute_cls */
@@ -297,6 +304,9 @@ H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id)
*
* Purpose: Release a pass through object
*
+ * Note: Take care to preserve the current HDF5 error stack
+ * when calling HDF5 API calls.
+ *
* Return: Success: 0
* Failure: -1
*
@@ -308,7 +318,14 @@ 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)
{
+ hid_t err_id;
+
+ err_id = H5Eget_current_stack();
+
H5Idec_ref(obj->under_vol_id);
+
+ H5Eset_current_stack(err_id);
+
free(obj);
return 0;
@@ -332,11 +349,8 @@ H5VL_pass_through_free_obj(H5VL_pass_through_t *obj)
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))
+ if(H5VL_PASSTHRU_g < 0)
H5VL_PASSTHRU_g = H5VLregister_connector(&H5VL_pass_through_g, H5P_DEFAULT);
return H5VL_PASSTHRU_g;
@@ -476,6 +490,9 @@ H5VL_pass_through_info_cmp(int *cmp_value, const void *_info1, const void *_info
*
* Purpose: Release an info object for the connector.
*
+ * Note: Take care to preserve the current HDF5 error stack
+ * when calling HDF5 API calls.
+ *
* Return: Success: 0
* Failure: -1
*
@@ -485,16 +502,21 @@ static herr_t
H5VL_pass_through_info_free(void *_info)
{
H5VL_pass_through_info_t *info = (H5VL_pass_through_info_t *)_info;
+ hid_t err_id;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL INFO Free\n");
#endif
+ err_id = H5Eget_current_stack();
+
/* 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);
+ H5Eset_current_stack(err_id);
+
/* Free pass through info object itself */
free(info);
@@ -663,8 +685,8 @@ H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx)
*
* Purpose: Use a "wrapper context" to wrap a data object
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: Pointer to wrapped object
+ * Failure: NULL
*
*---------------------------------------------------------------------------
*/
@@ -691,10 +713,44 @@ H5VL_pass_through_wrap_object(void *obj, H5I_type_t obj_type, void *_wrap_ctx)
/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_unwrap_object
+ *
+ * Purpose: Unwrap a wrapped object, discarding the wrapper, but returning
+ * underlying object.
+ *
+ * Return: Success: Pointer to unwrapped object
+ * Failure: NULL
+ *
+ *---------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_unwrap_object(void *obj)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL UNWRAP Object\n");
+#endif
+
+ /* Unrap the object with the underlying VOL */
+ under = H5VLunwrap_object(o->under_object, o->under_vol_id);
+
+ if(under)
+ H5VL_pass_through_free_obj(o);
+
+ return under;
+} /* end H5VL_pass_through_unwrap_object() */
+
+
+/*---------------------------------------------------------------------------
* Function: H5VL_pass_through_free_wrap_ctx
*
* Purpose: Release a "wrapper context" for an object
*
+ * Note: Take care to preserve the current HDF5 error stack
+ * when calling HDF5 API calls.
+ *
* Return: Success: 0
* Failure: -1
*
@@ -704,16 +760,21 @@ 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;
+ hid_t err_id;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL WRAP CTX Free\n");
#endif
+ err_id = H5Eget_current_stack();
+
/* 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);
+ H5Eset_current_stack(err_id);
+
/* Free pass through wrap context object itself */
free(wrap_ctx);
@@ -1166,17 +1227,22 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t
hid_t dxpl_id, void **req, va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ hid_t under_vol_id;
herr_t ret_value;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL H5Dspecific\n");
#endif
+ // Save copy of underlying VOL connector ID and prov helper, in case of
+ // refresh destroying the current object
+ under_vol_id = o->under_vol_id;
+
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);
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
return ret_value;
} /* end H5VL_pass_through_dataset_specific() */
@@ -1368,17 +1434,22 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific
hid_t dxpl_id, void **req, va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ hid_t under_vol_id;
herr_t ret_value;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATATYPE Specific\n");
#endif
+ // Save copy of underlying VOL connector ID and prov helper, in case of
+ // refresh destroying the current object
+ under_vol_id = o->under_vol_id;
+
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);
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
return ret_value;
} /* end H5VL_pass_through_datatype_specific() */
@@ -1908,17 +1979,22 @@ 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;
+ hid_t under_vol_id;
herr_t ret_value;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL GROUP Specific\n");
#endif
+ // Save copy of underlying VOL connector ID and prov helper, in case of
+ // refresh destroying the current object
+ under_vol_id = o->under_vol_id;
+
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);
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
return ret_value;
} /* end H5VL_pass_through_group_specific() */
@@ -2344,17 +2420,22 @@ H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params
va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ hid_t under_vol_id;
herr_t ret_value;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL OBJECT Specific\n");
#endif
+ // Save copy of underlying VOL connector ID and prov helper, in case of
+ // refresh destroying the current object
+ under_vol_id = o->under_vol_id;
+
ret_value = H5VLobject_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
- *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
return ret_value;
} /* end H5VL_pass_through_object_specific() */
diff --git a/src/H5VLpkg.h b/src/H5VLpkg.h
index bbdb0cc..69e51c2 100644
--- a/src/H5VLpkg.h
+++ b/src/H5VLpkg.h
@@ -28,21 +28,36 @@
/* Other private headers needed by this file */
+
/**************************/
/* Package Private Macros */
/**************************/
+
/****************************/
/* Package Private Typedefs */
/****************************/
+
/*****************************/
/* Package Private Variables */
/*****************************/
+
/******************************/
/* Package Private Prototypes */
/******************************/
+H5_DLL hid_t H5VL__register_connector(const H5VL_class_t *cls, hbool_t app_ref,
+ hid_t vipl_id);
+H5_DLL hid_t H5VL__register_connector_by_name(const char *name, hbool_t app_ref,
+ hid_t vipl_id);
+H5_DLL hid_t H5VL__register_connector_by_value(H5VL_class_value_t value,
+ hbool_t app_ref, hid_t vipl_id);
+H5_DLL htri_t H5VL__is_connector_registered(const char *name);
+H5_DLL hid_t H5VL__get_connector_id(const char *name, hbool_t is_api);
+H5_DLL herr_t H5VL__connector_str_to_info(const char *str, hid_t connector_id,
+ void **info);
+H5_DLL ssize_t H5VL__get_connector_name(hid_t id, char *name/*out*/, size_t size);
#endif /* _H5VLpkg_H */
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index 283c77a..04cc982 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -18,10 +18,12 @@
/* Private headers needed by this file */
+
/**************************/
/* Library Private Macros */
/**************************/
+
/****************************/
/* Library Private Typedefs */
/****************************/
@@ -41,8 +43,8 @@ typedef 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 */
+ hid_t connector_id; /* VOL connector's ID */
+ void *connector_info; /* VOL connector info, for open callbacks */
} H5VL_connector_prop_t;
/* Which kind of VOL connector field to use for searching */
@@ -62,14 +64,14 @@ typedef enum H5VL_get_connector_kind_t {
/******************************/
/* Utility functions */
-H5_DLL herr_t H5VL_init(void);
+H5_DLL herr_t H5VL_init_phase1(void);
+H5_DLL herr_t H5VL_init_phase2(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
@@ -84,6 +86,7 @@ H5_DLL ssize_t H5VL_get_connector_name(hid_t id, char *name/*out*/, size_t size)
/* Functions that manipulate VOL objects */
H5_DLL void *H5VL_object(hid_t id);
H5_DLL void *H5VL_object_data(const H5VL_object_t *vol_obj);
+H5_DLL void *H5VL_object_unwrap(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);
@@ -91,11 +94,20 @@ 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, H5I_type_t obj_type);
+H5_DLL void * H5VL_unwrap_object(const H5VL_class_t *connector, void *obj);
+H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx);
+H5_DLL herr_t H5VL_set_vol_wrapper(void *obj, H5VL_t *vol_connector);
+H5_DLL herr_t H5VL_inc_vol_wrapper(void *vol_wrap_ctx);
+H5_DLL herr_t H5VL_dec_vol_wrapper(void *vol_wrap_ctx);
+H5_DLL herr_t H5VL_reset_vol_wrapper(void);
+
+/* Library state functions */
+H5_DLL herr_t H5VL_retrieve_lib_state(void **state);
+H5_DLL herr_t H5VL_restore_lib_state(const void *state);
+H5_DLL herr_t H5VL_reset_lib_state(void);
+H5_DLL herr_t H5VL_free_lib_state(void *state);
/* ID registration functions */
H5_DLL hid_t H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref);
@@ -112,7 +124,7 @@ H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_in
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);
+H5_DLL herr_t H5VL_free_connector_info(hid_t connector_id, 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);
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index f8f5423..ca34f6b 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -114,6 +114,7 @@ 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_FILENO, /* file number */
H5VL_FILE_GET_NAME, /* file name */
H5VL_FILE_GET_OBJ_COUNT, /* object count in file */
H5VL_FILE_GET_OBJ_IDS /* object ids in file */
@@ -252,6 +253,7 @@ typedef struct H5VL_wrap_class_t {
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, H5I_type_t obj_type, void *wrap_ctx); /* Callback to wrap a library object */
+ void * (*unwrap_object)(void *obj); /* Callback to unwrap a library object */
herr_t (*free_wrap_ctx)(void *wrap_ctx); /* Callback to release the object wrapping context for the connector */
} H5VL_wrap_class_t;
@@ -450,6 +452,10 @@ H5_DLL herr_t H5VLunregister_connector(hid_t connector_id);
H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2);
H5_DLL hid_t H5VLwrap_register(void *obj, H5I_type_t type);
H5_DLL void *H5VLobject(hid_t obj_id);
+H5_DLL herr_t H5VLretrieve_lib_state(void **state);
+H5_DLL herr_t H5VLrestore_lib_state(const void *state);
+H5_DLL herr_t H5VLreset_lib_state(void);
+H5_DLL herr_t H5VLfree_lib_state(void *state);
/* Public wrappers for generic callbacks */
@@ -467,6 +473,7 @@ 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, H5I_type_t obj_type, hid_t connector_id,
void *wrap_ctx);
+H5_DLL void *H5VLunwrap_object(void *obj, hid_t connector_id);
H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id);
/* Public wrappers for attribute callbacks */
diff --git a/src/H5VM.c b/src/H5VM.c
index 452d378..f78da96 100644
--- a/src/H5VM.c
+++ b/src/H5VM.c
@@ -19,6 +19,7 @@
#include "H5private.h"
#include "H5Eprivate.h"
+#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h"
#include "H5VMprivate.h"
@@ -732,7 +733,7 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size,
/* Copy an element */
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ H5MM_memcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
/* Decrement indices and advance pointers */
for (j=(int)(n-1), carry=TRUE; j>=0 && carry; --j) {
@@ -749,7 +750,7 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size,
}
} else {
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ H5MM_memcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
}
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -801,7 +802,7 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size,
/* Copy an element */
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ H5MM_memcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
/* Decrement indices and advance pointers */
for (j=(int)(n-1), carry=TRUE; j>=0 && carry; --j) {
@@ -818,7 +819,7 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size,
}
} else {
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ H5MM_memcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
}
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -877,7 +878,7 @@ H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
/* Copy an element */
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ H5MM_memcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
/* Decrement indices and advance pointers */
for (j=(int)(dst_n-1), carry=TRUE; j>=0 && carry; --j) {
@@ -936,7 +937,7 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count)
HDassert(size < SIZET_MAX && size > 0);
HDassert(count < SIZET_MAX && count > 0);
- HDmemcpy(dst, src, size); /* copy first item */
+ H5MM_memcpy(dst, src, size); /* copy first item */
/* Initialize counters, etc. while compensating for first element copied */
copy_size = size;
@@ -947,7 +948,7 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count)
/* copy until we've copied at least half of the items */
while (items_left >= copy_items)
{
- HDmemcpy(dst, _dst, copy_size); /* copy the current chunk */
+ H5MM_memcpy(dst, _dst, copy_size); /* copy the current chunk */
dst += copy_size; /* move the offset for the next chunk */
items_left -= copy_items; /* decrement the number of items left */
@@ -955,7 +956,7 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count)
copy_items *= 2; /* increase the count of items we are copying */
} /* end while */
if (items_left > 0) /* if there are any items left to copy */
- HDmemcpy(dst, _dst, items_left * size);
+ H5MM_memcpy(dst, _dst, items_left * size);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5VM_array_fill() */
@@ -1623,7 +1624,7 @@ src_smaller:
acc_len = 0;
do {
/* Copy data */
- HDmemcpy(dst, src, tmp_src_len);
+ H5MM_memcpy(dst, src, tmp_src_len);
/* Accumulate number of bytes copied */
acc_len += tmp_src_len;
@@ -1666,7 +1667,7 @@ dst_smaller:
acc_len = 0;
do {
/* Copy data */
- HDmemcpy(dst, src, tmp_dst_len);
+ H5MM_memcpy(dst, src, tmp_dst_len);
/* Accumulate number of bytes copied */
acc_len += tmp_dst_len;
@@ -1709,7 +1710,7 @@ equal:
acc_len = 0;
do {
/* Copy data */
- HDmemcpy(dst, src, tmp_dst_len);
+ H5MM_memcpy(dst, src, tmp_dst_len);
/* Accumulate number of bytes copied */
acc_len += tmp_dst_len;
diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h
index decac7e..26f59e2 100644
--- a/src/H5VMprivate.h
+++ b/src/H5VMprivate.h
@@ -21,6 +21,7 @@
/* Private headers needed by this file */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
/* Vector-Vector sequence operation callback */
typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off,
@@ -41,7 +42,7 @@ typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off,
/* Other functions */
#define H5VM_vector_cpy(N,DST,SRC) { \
HDassert(sizeof(*(DST))==sizeof(*(SRC))); \
- if (SRC) HDmemcpy (DST, SRC, (N)*sizeof(*(DST))); \
+ if (SRC) H5MM_memcpy (DST, SRC, (N)*sizeof(*(DST))); \
else HDmemset (DST, 0, (N)*sizeof(*(DST))); \
}
diff --git a/src/H5Z.c b/src/H5Z.c
index 0e2a7ba..b703958 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -322,7 +322,7 @@ H5Z_register (const H5Z_class2_t *cls)
/* Initialize */
i = H5Z_table_used_g++;
- HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
+ H5MM_memcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
#ifdef H5Z_DEBUG
HDmemset(H5Z_stat_table_g+i, 0, sizeof(H5Z_stats_t));
#endif /* H5Z_DEBUG */
@@ -330,7 +330,7 @@ H5Z_register (const H5Z_class2_t *cls)
/* Filter already registered */
else {
/* Replace old contents */
- HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
+ H5MM_memcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
} /* end else */
done:
diff --git a/src/H5Zfletcher32.c b/src/H5Zfletcher32.c
index 4cd77ef..4d75d14 100644
--- a/src/H5Zfletcher32.c
+++ b/src/H5Zfletcher32.c
@@ -108,7 +108,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, const un
* system. We'll check both the correct checksum and the wrong
* checksum to be consistent with Release 1.6.2 and before.
*/
- HDmemcpy(c, &fletcher, (size_t)4);
+ H5MM_memcpy(c, &fletcher, (size_t)4);
tmp = c[1];
c[1] = c[0];
@@ -118,7 +118,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, const un
c[3] = c[2];
c[2] = tmp;
- HDmemcpy(&reversed_fletcher, c, (size_t)4);
+ H5MM_memcpy(&reversed_fletcher, c, (size_t)4);
/* Verify computed checksum matches stored checksum */
if(stored_fletcher != fletcher && stored_fletcher != reversed_fletcher)
@@ -140,7 +140,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, const un
dst = (unsigned char *) outbuf;
/* Copy raw data */
- HDmemcpy((void*)dst, (void*)(*buf), nbytes);
+ H5MM_memcpy((void*)dst, (void*)(*buf), nbytes);
/* Append checksum to raw data for storage */
dst += nbytes;
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index 0026749..d3e8fc0 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -141,7 +141,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
} /* end if */ \
\
/* Copy the value */ \
- HDmemcpy(&_cd_value, _fv_p, _copy_size); \
+ H5MM_memcpy(&_cd_value, _fv_p, _copy_size); \
(cd_values)[_i] = (unsigned)_cd_value; \
\
/* Next field */ \
@@ -158,7 +158,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
_fv_p = ((char *)&(fill_val)) + sizeof(type) - MIN(4, _size_rem); \
while(_size_rem >= 4) { \
/* Copy the value */ \
- HDmemcpy(&_cd_value, _fv_p, _copy_size); \
+ H5MM_memcpy(&_cd_value, _fv_p, _copy_size); \
(cd_values)[_i] = (unsigned)_cd_value; \
\
/* Next field */ \
@@ -176,7 +176,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
* _cd_value as it will not be fully overwritten and copy to the end \
* of _cd value as it is BE. */ \
_cd_value = (uint32_t)0; \
- HDmemcpy((char *)&_cd_value + 4 - _size_rem, _fv_p, _size_rem); \
+ H5MM_memcpy((char *)&_cd_value + 4 - _size_rem, _fv_p, _size_rem); \
(cd_values)[_i] = (unsigned)_cd_value; \
} /* end if */ \
} /* end else */ \
@@ -269,7 +269,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
\
/* Copy the value */ \
_cd_value = (uint32_t)(cd_values)[_i]; \
- HDmemcpy(_fv_p, &_cd_value, _copy_size); \
+ H5MM_memcpy(_fv_p, &_cd_value, _copy_size); \
\
/* Next field */ \
_i++; \
@@ -286,7 +286,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
while(_size_rem >= 4) { \
/* Copy the value */ \
_cd_value = (uint32_t)(cd_values)[_i]; \
- HDmemcpy(_fv_p, &_cd_value, _copy_size); \
+ H5MM_memcpy(_fv_p, &_cd_value, _copy_size); \
\
/* Next field */ \
_i++; \
@@ -303,7 +303,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
* _cd_value as it will not be fully overwritten and copy to the end \
* of _cd value as it is BE. */ \
_cd_value = (uint32_t)(cd_values)[_i]; \
- HDmemcpy(_fv_p, (char *)&_cd_value + 4 - _size_rem, _size_rem); \
+ H5MM_memcpy(_fv_p, (char *)&_cd_value + 4 - _size_rem, _size_rem); \
} /* end if */ \
} /* end else */ \
}
@@ -529,10 +529,10 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
* account for offset in BE if sizes differ \
*/ \
if(H5T_native_order_g == H5T_ORDER_LE) \
- HDmemcpy(minval, &min, sizeof(type)); \
+ H5MM_memcpy(minval, &min, sizeof(type)); \
else { \
HDassert(H5T_native_order_g == H5T_ORDER_BE); \
- HDmemcpy(((char *)minval) + (sizeof(long long) - sizeof(type)), \
+ H5MM_memcpy(((char *)minval) + (sizeof(long long) - sizeof(type)), \
&min, sizeof(type)); \
} /* end else */ \
else \
@@ -604,10 +604,10 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
* account for offset in BE if sizes differ \
*/ \
if(H5T_native_order_g == H5T_ORDER_LE) \
- HDmemcpy(&min, &minval, sizeof(type)); \
+ H5MM_memcpy(&min, &minval, sizeof(type)); \
else { \
HDassert(H5T_native_order_g == H5T_ORDER_BE); \
- HDmemcpy(&min, ((char *)&minval) + (sizeof(long long) \
+ H5MM_memcpy(&min, ((char *)&minval) + (sizeof(long long) \
- sizeof(type)), sizeof(type)); \
} /* end else */ \
else \
@@ -1173,7 +1173,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value
/* special case: minbits equal to full precision */
if(minbits == p.size * 8) {
- HDmemcpy(outbuf, (unsigned char*)(*buf)+buf_offset, size_out);
+ H5MM_memcpy(outbuf, (unsigned char*)(*buf)+buf_offset, size_out);
/* free the original buffer */
H5MM_xfree(*buf);
@@ -1273,7 +1273,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value
/* special case: minbits equal to full precision */
if(minbits == p.size * 8) {
- HDmemcpy(outbuf + buf_offset, *buf, nbytes);
+ H5MM_memcpy(outbuf + buf_offset, *buf, nbytes);
/* free the original buffer */
H5MM_xfree(*buf);
diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c
index 1fef1c1..e70ef33 100644
--- a/src/H5Zshuffle.c
+++ b/src/H5Zshuffle.c
@@ -210,7 +210,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
if(leftover>0) {
/* Adjust back to end of shuffled bytes */
_dest -= (bytesoftype - 1); /*lint !e794 _dest is initialized */
- HDmemcpy((void*)_dest, (void*)_src, leftover);
+ H5MM_memcpy((void*)_dest, (void*)_src, leftover);
}
} /* end if */
else {
@@ -268,7 +268,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
if(leftover>0) {
/* Adjust back to end of shuffled bytes */
_src -= (bytesoftype - 1); /*lint !e794 _src is initialized */
- HDmemcpy((void*)_dest, (void*)_src, leftover);
+ H5MM_memcpy((void*)_dest, (void*)_src, leftover);
}
} /* end else */
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index f8fc325..6d07513 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -1078,7 +1078,7 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size
if(NULL == (data_xform_prop->dat_val_pointers->ptr_dat_val[i] = (void*)H5MM_malloc(array_size * H5T_get_size((H5T_t *)H5I_object(array_type)))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "Ran out of memory trying to allocate space for data in data transform")
- HDmemcpy(data_xform_prop->dat_val_pointers->ptr_dat_val[i], array, array_size * H5T_get_size((H5T_t *)H5I_object(array_type)));
+ H5MM_memcpy(data_xform_prop->dat_val_pointers->ptr_dat_val[i], array, array_size * H5T_get_size((H5T_t *)H5I_object(array_type)));
} /* end for */
} /* end else */
@@ -1086,7 +1086,7 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform")
if(data_xform_prop->dat_val_pointers->num_ptrs > 1)
- HDmemcpy(array, res.value.dat_val, array_size * H5T_get_size((H5T_t *)H5I_object(array_type)));
+ H5MM_memcpy(array, res.value.dat_val, array_size * H5T_get_size((H5T_t *)H5I_object(array_type)));
/* Free the temporary arrays we used */
if(data_xform_prop->dat_val_pointers->num_ptrs > 1)
diff --git a/src/H5private.h b/src/H5private.h
index ef52ac6..dad2d94 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -1104,12 +1104,8 @@ typedef off_t h5_stat_size_t;
#ifndef HDmemcmp
#define HDmemcmp(X,Y,Z) memcmp(X,Y,Z)
#endif /* HDmemcmp */
-/*
- * The (char*) casts are required for the DEC when optimizations are turned
- * on and the source and/or destination are not aligned.
- */
#ifndef HDmemcpy
- #define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z)
+ #define HDmemcpy(X,Y,Z) memcpy(X,Y,Z)
#endif /* HDmemcpy */
#ifndef HDmemmove
#define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z)
diff --git a/src/H5public.h b/src/H5public.h
index 353ff16..3b53e00 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 4 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 5 /* 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.4" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.11.5" /* 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 f47d057..35123db 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -985,6 +985,132 @@ Wroundf(float arg)
return (float)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F));
}
+/*-------------------------------------------------------------------------
+* Function: H5_get_utf16_str
+*
+* Purpose: Gets a UTF-16 string from an UTF-8 (or ASCII) string.
+*
+* Return: Success: A pointer to a UTF-16 string
+* This must be freed by the caller using H5MM_xfree()
+* Failure: NULL
+*
+* Programmer: Dana Robinson
+* Spring 2019
+*
+*-------------------------------------------------------------------------
+*/
+const wchar_t *
+H5_get_utf16_str(const char *s)
+{
+ int nwchars = -1; /* Length of the UTF-16 buffer */
+ wchar_t *ret_s = NULL; /* UTF-16 version of the string */
+
+ /* Get the number of UTF-16 characters needed */
+ if(0 == (nwchars = MultiByteToWideChar(CP_UTF8, 0, s, -1, NULL, 0)))
+ goto error;
+
+ /* Allocate a buffer for the UTF-16 string */
+ if(NULL == (ret_s = (wchar_t *)H5MM_calloc(sizeof(wchar_t) * (size_t)nwchars)))
+ goto error;
+
+ /* Convert the input UTF-8 string to UTF-16 */
+ if(0 == MultiByteToWideChar(CP_UTF8, 0, s, -1, ret_s, nwchars))
+ goto error;
+
+ return ret_s;
+
+error:
+ if(ret_s)
+ H5MM_xfree((void *)ret_s);
+ return NULL;
+} /* end H5_get_utf16_str() */
+
+/*-------------------------------------------------------------------------
+ * Function: Wopen_utf8
+ *
+ * Purpose: UTF-8 equivalent of open(2) for use on Windows.
+ * Converts a UTF-8 input path to UTF-16 and then opens the
+ * file via _wopen() under the hood
+ *
+ * Return: Success: A POSIX file descriptor
+ * Failure: -1
+ *
+ * Programmer: Dana Robinson
+ * Spring 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+Wopen_utf8(const char *path, int oflag, ...)
+{
+ int fd = -1; /* POSIX file descriptor to be returned */
+ wchar_t *wpath = NULL; /* UTF-16 version of the path */
+ int pmode = 0; /* mode (optionally set via variable args) */
+
+ /* Convert the input UTF-8 path to UTF-16 */
+ if(NULL == (wpath = H5_get_utf16_str(path)))
+ goto done;
+
+ /* _O_BINARY must be set in Windows to avoid CR-LF <-> LF EOL
+ * transformations when performing I/O. Note that this will
+ * produce Unix-style text files, though.
+ */
+ oflag |= _O_BINARY;
+
+ /* Get the mode, if O_CREAT was specified */
+ if(oflag & O_CREAT) {
+ va_list vl;
+
+ HDva_start(vl, oflag);
+ pmode = HDva_arg(vl, int);
+ HDva_end(vl);
+ }
+
+ /* Open the file */
+ fd = _wopen(wpath, oflag, pmode);
+
+done:
+ if(wpath)
+ H5MM_xfree((void *)wpath);
+
+ return fd;
+} /* end Wopen_utf8() */
+
+/*-------------------------------------------------------------------------
+ * Function: Wremove_utf8
+ *
+ * Purpose: UTF-8 equivalent of remove(3) for use on Windows.
+ * Converts a UTF-8 input path to UTF-16 and then opens the
+ * file via _wremove() under the hood
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Dana Robinson
+ * Spring 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+Wremove_utf8(const char *path)
+{
+ wchar_t *wpath = NULL; /* UTF-16 version of the path */
+ int ret;
+
+ /* Convert the input UTF-8 path to UTF-16 */
+ if(NULL == (wpath = H5_get_utf16_str(path)))
+ goto done;
+
+ /* Open the file */
+ ret = _wremove(wpath);
+
+done:
+ if(wpath)
+ H5MM_xfree((void *)wpath);
+
+ return ret;
+} /* end Wremove_utf8() */
+
#endif /* H5_HAVE_WIN32_API */
@@ -1130,13 +1256,13 @@ H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/)
FUNC_ENTER_NOAPI_NOINIT
- HDassert(path1);
HDassert(path2);
- path1_len = HDstrlen(path1);
+ if(path1)
+ path1_len = HDstrlen(path1);
path2_len = HDstrlen(path2);
- if(*path1 == '\0' || H5_CHECK_ABSOLUTE(path2)) {
+ if(path1 == NULL || *path1 == '\0' || H5_CHECK_ABSOLUTE(path2)) {
/* If path1 is empty or path2 is absolute, simply use path2 */
if(NULL == (*full_name = (char *)H5MM_strdup(path2)))
diff --git a/src/H5trace.c b/src/H5trace.c
index 9a13193..23f2f1d 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -1054,7 +1054,11 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
break;
case H5F_LIBVER_V110:
- HDcompile_assert(H5F_LIBVER_LATEST == H5F_LIBVER_V110);
+ HDfprintf(out, "H5F_LIBVER_V110");
+ break;
+
+ case H5F_LIBVER_V112:
+ HDcompile_assert(H5F_LIBVER_LATEST == H5F_LIBVER_V112);
HDfprintf(out, "H5F_LIBVER_LATEST");
break;
diff --git a/src/H5vers.txt b/src/H5vers.txt
index 914c30e..22117c3 100644
--- a/src/H5vers.txt
+++ b/src/H5vers.txt
@@ -61,12 +61,14 @@ FUNCTION: H5Oget_info_by_name; ; v18, v112
FUNCTION: H5Oget_info_by_idx; ; v18, v112
FUNCTION: H5Ovisit; ; v18, v112
FUNCTION: H5Ovisit_by_name; ; v18, v112
+FUNCTION: H5Pencode; ; v110, v112
FUNCTION: H5Pget_filter; ; v10, v18
FUNCTION: H5Pget_filter_by_id; ; v16, v18
FUNCTION: H5Pinsert; ; v14, v18
FUNCTION: H5Pregister; ; v14, v18
FUNCTION: H5Rdereference; ; v10, v110
FUNCTION: H5Rget_obj_type; ; v16, v18
+FUNCTION: H5Sencode; ; v18, v112
FUNCTION: H5Tarray_create; ; v14, v18
FUNCTION: H5Tcommit; ; v10, v18
FUNCTION: H5Tget_array_dims; ; v14, v18
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index 140afc3..2ae2575 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -34,6 +34,7 @@ typedef __int64 h5_stat_size_t;
#define HDaccess(F,M) _access(F,M)
#define HDchdir(S) _chdir(S)
#define HDclose(F) _close(F)
+#define HDcreat(S,M) Wopen_utf8(S,O_CREAT|O_TRUNC|O_RDWR,M)
#define HDdup(F) _dup(F)
#define HDfdopen(N,S) _fdopen(N,S)
#define HDfileno(F) _fileno(F)
@@ -47,15 +48,13 @@ typedef __int64 h5_stat_size_t;
#define HDmkdir(S,M) _mkdir(S)
#define HDnanosleep(N, O) Wnanosleep(N, O)
#define HDoff_t __int64
-/* _O_BINARY must be set in Windows to avoid CR-LF <-> LF EOL
- * transformations when performing I/O. Note that this will
- * produce Unix-style text files, though.
- *
- * Also note that the variadic macro is using a VC++ extension
+
+/* Note that the variadic HDopen macro is using a VC++ extension
* where the comma is dropped if nothing is passed to the ellipsis.
*/
-#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__)
+#define HDopen(S,F,...) Wopen_utf8(S,F,__VA_ARGS__)
#define HDread(F,M,Z) _read(F,M,Z)
+#define HDremove(S) Wremove_utf8(S)
#define HDrmdir(S) _rmdir(S)
#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2))
#define HDsleep(S) Sleep(S*1000)
@@ -128,6 +127,9 @@ extern "C" {
H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap);
H5_DLL int Wnanosleep(const struct timespec *req, struct timespec *rem);
H5_DLL herr_t H5_expand_windows_env_vars(char **env_var);
+ H5_DLL const wchar_t *H5_get_utf16_str(const char *s);
+ H5_DLL int Wopen_utf8(const char *path, int oflag, ...);
+ H5_DLL int Wremove_utf8(const char *path);
/* Round functions only needed for VS2012 and earlier.
* They are always built to ensure they don't go stale and
diff --git a/src/Makefile.am b/src/Makefile.am
index 5532655..378e390 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -102,7 +102,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5R.c H5Rint.c H5Rdeprec.c \
H5UC.c \
H5RS.c \
- H5S.c H5Sall.c H5Sdbg.c H5Shyper.c H5Snone.c H5Spoint.c \
+ H5S.c H5Sall.c H5Sdbg.c H5Sdeprec.c H5Shyper.c H5Snone.c H5Spoint.c \
H5Sselect.c H5Stest.c \
H5SL.c \
H5SM.c H5SMbtree2.c H5SMcache.c H5SMmessage.c H5SMtest.c \
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 276cf09..0b9911f 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -14,12 +14,14 @@ set (TEST_LIB_SOURCES
${HDF5_TEST_SOURCE_DIR}/h5test.c
${HDF5_TEST_SOURCE_DIR}/testframe.c
${HDF5_TEST_SOURCE_DIR}/cache_common.c
+ ${HDF5_TEST_SOURCE_DIR}/external_common.c
${HDF5_TEST_SOURCE_DIR}/swmr_common.c
)
set (TEST_LIB_HEADERS
${HDF5_TEST_SOURCE_DIR}/h5test.h
${HDF5_TEST_SOURCE_DIR}/cache_common.h
+ ${HDF5_TEST_SOURCE_DIR}/external_common.h
${HDF5_TEST_SOURCE_DIR}/swmr_common.h
)
@@ -236,6 +238,7 @@ set (H5_TESTS
extend
direct_chunk # compression lib link
external
+ external_env
efc
objcopy
links
@@ -263,6 +266,7 @@ set (H5_TESTS
freespace
mf
vds
+ vds_env
file_image
unregister
cache_logging
@@ -352,12 +356,17 @@ add_executable (ttsafe ${ttsafe_SOURCES})
target_include_directories(ttsafe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (ttsafe STATIC)
target_link_libraries (ttsafe PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+if (NOT WIN32)
+ target_link_libraries (ttsafe
+ PRIVATE $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ )
+endif ()
set_target_properties (ttsafe PROPERTIES FOLDER test)
if (BUILD_SHARED_LIBS)
add_executable (ttsafe-shared ${ttsafe_SOURCES})
target_include_directories(ttsafe-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (ttsafe-shared SHARED)
- target_link_libraries (ttsafe-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ target_link_libraries (ttsafe-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>)
set_target_properties (ttsafe-shared PROPERTIES FOLDER test)
endif ()
diff --git a/test/CMakeVOLTests.cmake b/test/CMakePassthroughVOLTests.cmake
index cf47291..8c7d797 100644
--- a/test/CMakeVOLTests.cmake
+++ b/test/CMakePassthroughVOLTests.cmake
@@ -340,7 +340,7 @@ endif ()
set_tests_properties (VOL-${volname}-cache-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
endif ()
endif ()
- if (HDF5_TEST_FHEAP_VOL)
+ if (HDF5_TEST_FHEAP_PASSTHROUGH_VOL)
add_test (
NAME VOL-${volname}-fheap-clear-objects
COMMAND ${CMAKE_COMMAND}
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index c606eb1..8c4e1ce 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -542,8 +542,10 @@ set (H5TEST_SEPARATE_TESTS
testhdf5
cache
cache_image
+ external_env
flush1
flush2
+ vds_env
)
foreach (h5_test ${H5_TESTS})
if (NOT h5_test IN_LIST H5TEST_SEPARATE_TESTS)
@@ -679,6 +681,83 @@ set_tests_properties (H5TEST-cache_image PROPERTIES
)
endif ()
+#-- Adding test for external_env
+add_test (
+ NAME H5TEST-clear-external_env-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ extern_1r.raw
+ extern_2r.raw
+ extern_3r.raw
+ extern_4r.raw
+ extern_1w.raw
+ extern_2w.raw
+ extern_3w.raw
+ extern_4w.raw
+ external_env.txt
+ external_env.out
+ WORKING_DIRECTORY
+ ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+set_tests_properties (H5TEST-clear-external_env-objects PROPERTIES FIXTURES_SETUP external_env_clear_objects)
+if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5TEST-external_env COMMAND $<TARGET_FILE:external_env>)
+else ()
+ add_test (NAME H5TEST-external_env COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:external_env>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_ENV_VAR:STRING=HDF5_EXTFILE_PREFIX"
+ -D "TEST_ENV_VALUE:STRING=\${ORIGIN}"
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=external_env.txt"
+ #-D "TEST_REFERENCE=external_env.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+endif ()
+set_tests_properties (H5TEST-external_env PROPERTIES
+ FIXTURES_REQUIRED external_env_clear_objects
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+
+#-- Adding test for vds_env
+add_test (
+ NAME H5TEST-clear-vds_env-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ vds_virt_0.h5
+ vds_virt_3.h5
+ vds_src_2.h5
+ vds_env.txt
+ vds_env.out
+ WORKING_DIRECTORY
+ ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+set_tests_properties (H5TEST-clear-vds_env-objects PROPERTIES FIXTURES_SETUP vds_env_clear_objects)
+if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5TEST-vds_env COMMAND $<TARGET_FILE:vds_env>)
+else ()
+ add_test (NAME H5TEST-vds_env COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:vds_env>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX"
+ -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp"
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=vds_env.txt"
+ #-D "TEST_REFERENCE=vds_env.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+endif ()
+set_tests_properties (H5TEST-vds_env PROPERTIES
+ FIXTURES_REQUIRED vds_env_clear_objects
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+
if (BUILD_SHARED_LIBS)
#-- Adding test for cache
if (NOT CYGWIN AND NOT WIN32)
@@ -922,20 +1001,24 @@ add_test (NAME H5TEST-clear-links_env-objects
${HDF5_TEST_BINARY_DIR}/H5TEST
)
set_tests_properties (H5TEST-clear-links_env-objects PROPERTIES FIXTURES_SETUP links_env_clear_objects)
-add_test (NAME H5TEST-links_env COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:links_env>"
- -D "TEST_ARGS:STRING="
- -D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX"
- -D "TEST_ENV_VALUE:STRING=.:tmp"
- -D "TEST_EXPECT=0"
- -D "TEST_OUTPUT=links_env.txt"
- -D "TEST_REFERENCE=links_env.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
-)
+if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5TEST-links_env COMMAND $<TARGET_FILE:links_env>)
+else ()
+ add_test (NAME H5TEST-links_env COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:links_env>"
+ -D "TEST_ARGS:STRING="
+ #-D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX"
+ #-D "TEST_ENV_VALUE:STRING=.:tmp"
+ -D "TEST_EXPECT=0"
+ -D "TEST_OUTPUT=links_env.txt"
+ -D "TEST_REFERENCE=links_env.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+endif ()
set_tests_properties (H5TEST-links_env PROPERTIES
FIXTURES_REQUIRED links_env_clear_objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_EXT_PREFIX=.:tmp"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
@@ -1027,8 +1110,8 @@ if (BUILD_SHARED_LIBS)
add_test (NAME H5TEST-shared-links_env COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:links_env-shared>"
-D "TEST_ARGS:STRING="
- -D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX"
- -D "TEST_ENV_VALUE:STRING=.:tmp"
+ #-D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX"
+ #-D "TEST_ENV_VALUE:STRING=.:tmp"
-D "TEST_EXPECT=0"
-D "TEST_OUTPUT=links_env.txt"
-D "TEST_REFERENCE=links_env.out"
@@ -1037,6 +1120,67 @@ if (BUILD_SHARED_LIBS)
)
set_tests_properties (H5TEST-shared-links_env PROPERTIES
FIXTURES_REQUIRED shared_links_env_clear_objects
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5_EXT_PREFIX=.:tmp"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
+ )
+
+ #-- Adding test for external_env
+ add_test (NAME H5TEST-shared-clear-external_env-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ extern_1r.raw
+ extern_2r.raw
+ extern_3r.raw
+ extern_4r.raw
+ extern_1w.raw
+ extern_2w.raw
+ extern_3w.raw
+ extern_4w.raw
+ WORKING_DIRECTORY
+ ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
+ )
+ set_tests_properties (H5TEST-shared-clear-external_env-objects PROPERTIES FIXTURES_SETUP shared_external_env_clear_objects)
+ add_test (NAME H5TEST-shared-external_env COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:external_env-shared>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_ENV_VAR:STRING=HDF5_EXTFILE_PREFIX"
+ -D "TEST_ENV_VALUE:STRING=\${ORIGIN}"
+ -D "TEST_EXPECT=0"
+ -D "TEST_OUTPUT=external_env.txt"
+ -D "TEST_REFERENCE=external_env.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5TEST-shared-external_env PROPERTIES
+ FIXTURES_REQUIRED shared_external_env_clear_objects
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
+ )
+
+ #-- Adding test for vds_env
+ add_test (NAME H5TEST-shared-clear-vds_env-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ vds_virt_0.h5
+ vds_virt_3.h5
+ vds_src_2.h5
+ WORKING_DIRECTORY
+ ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
+ )
+ set_tests_properties (H5TEST-shared-clear-vds_env-objects PROPERTIES FIXTURES_SETUP shared_vds_env_clear_objects)
+ add_test (NAME H5TEST-shared-vds_env COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:vds_env-shared>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX"
+ -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp"
+ -D "TEST_EXPECT=0"
+ -D "TEST_OUTPUT=vds_env.txt"
+ -D "TEST_REFERENCE=vds_env.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5TEST-shared-vds_env PROPERTIES
+ FIXTURES_REQUIRED shared_vds_env_clear_objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
)
@@ -1149,8 +1293,8 @@ endif ()
##############################################################################
##############################################################################
-if (HDF5_TEST_VOL)
- include (CMakeVOLTests.cmake)
+if (HDF5_TEST_PASSTHROUGH_VOL)
+ include (CMakePassthroughVOLTests.cmake)
endif ()
##############################################################################
diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake
index 791f75c..64ccacd 100644
--- a/test/CMakeVFDTests.cmake
+++ b/test/CMakeVFDTests.cmake
@@ -142,7 +142,7 @@ endif ()
${vfdname}-shared/${vfdname}-${vfdtest}-shared.out
${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err
)
- add_test (NAME VFD-${vfdname}-${test}-shared
+ add_test (NAME VFD-${vfdname}-${vfdtest}-shared
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>"
-D "TEST_ARGS:STRING="
@@ -163,7 +163,7 @@ endif ()
COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}"
)
if (BUILD_SHARED_LIBS)
- add_test (NAME VFD-${vfdname}-${test}-shared
+ add_test (NAME VFD-${vfdname}-${vfdtest}-shared
COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}-shared"
)
endif ()
diff --git a/test/Makefile.am b/test/Makefile.am
index 88dc542..1b82aa4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -26,21 +26,23 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_builddir)/src
# testlibinfo.sh:
# testcheck_version.sh: tcheck_version
# testlinks_env.sh: links_env
+# testexternal_env.sh: external_env
# testflushrefresh.sh: flushrefresh
+# testvds_env.sh: vds_env
# testswmr.sh: swmr*
# testvdsswmr.sh: vds_swmr*
# testabort_fail.sh: filenotclosed.c and del_many_dense_attrs.c
# test_filter_plugin.sh: filter_plugin.c
# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes
-TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh \
- testswmr.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh testabort_fail.sh
+TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh testexternal_env.sh \
+ testswmr.sh testvds_env.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh testabort_fail.sh
SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) \
- filenotclosed$(EXEEXT) del_many_dense_attrs$(EXEEXT) \
+ external_env$(EXEEXT) filenotclosed$(EXEEXT) del_many_dense_attrs$(EXEEXT) \
flushrefresh$(EXEEXT) use_append_chunk$(EXEEXT) use_append_mchunks$(EXEEXT) use_disable_mdc_flushes$(EXEEXT) \
swmr_generator$(EXEEXT) swmr_reader$(EXEEXT) swmr_writer$(EXEEXT) \
swmr_remove_reader$(EXEEXT) swmr_remove_writer$(EXEEXT) swmr_addrem_writer$(EXEEXT) \
swmr_sparse_reader$(EXEEXT) swmr_sparse_writer$(EXEEXT) swmr_start_write$(EXEEXT) \
- vds_swmr_gen$(EXEEXT) vds_swmr_reader$(EXEEXT) vds_swmr_writer$(EXEEXT)
+ vds_env$(EXEEXT) vds_swmr_gen$(EXEEXT) vds_swmr_reader$(EXEEXT) vds_swmr_writer$(EXEEXT)
if HAVE_SHARED_CONDITIONAL
TEST_SCRIPT += test_filter_plugin.sh test_vol_plugin.sh
SCRIPT_DEPEND += filter_plugin$(EXEEXT) vol_plugin$(EXEEXT)
@@ -69,21 +71,23 @@ TEST_PROG= testhdf5 \
# accum_swmr_reader is used by accum.c.
# atomic_writer and atomic_reader are standalone programs.
# links_env is used by testlinks_env.sh
+# external_env is used by testexternal_env.sh
# filenotclosed and del_many_dense_attrs are used by testabort_fail.sh
# flushrefresh is used by testflushrefresh.sh.
# use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh
# swmr_* files (besides swmr.c) are used by testswmr.sh.
# vds_swmr_* files are used by testvdsswmr.sh
+# vds_env is used by testvds_env.sh
# 'make check' doesn't run them directly, so they are not included in TEST_PROG.
# Also build testmeta, which is used for timings test. It builds quickly,
# and this lets automake keep all its test programs in one place.
check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \
- testmeta accum_swmr_reader atomic_writer atomic_reader \
+ testmeta accum_swmr_reader atomic_writer atomic_reader external_env \
links_env filenotclosed del_many_dense_attrs flushrefresh \
use_append_chunk use_append_mchunks use_disable_mdc_flushes \
swmr_generator swmr_start_write swmr_reader swmr_writer swmr_remove_reader \
swmr_remove_writer swmr_addrem_writer swmr_sparse_reader swmr_sparse_writer \
- swmr_check_compat_vfd vds_swmr_gen vds_swmr_reader vds_swmr_writer
+ swmr_check_compat_vfd vds_env vds_swmr_gen vds_swmr_reader vds_swmr_writer
if HAVE_SHARED_CONDITIONAL
check_PROGRAMS+= filter_plugin vol_plugin
endif
@@ -131,7 +135,7 @@ else
noinst_LTLIBRARIES=libh5test.la
endif
-libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c
+libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c external_common.c
# Use libhd5test.la to compile all of the tests
LDADD=libh5test.la $(LIBHDF5)
@@ -223,7 +227,7 @@ use_disable_mdc_flushes_SOURCES=use_disable_mdc_flushes.c
# Temporary files.
DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filter_plugin.sh \
- testswmr.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh testabort_fail.sh \
+ testexternal_env.sh testswmr.sh testvds_env.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh testabort_fail.sh \
test_vol_plugin.sh
include $(top_srcdir)/config/conclude.am
diff --git a/test/cache_tagging.c b/test/cache_tagging.c
index b91f013..e03defa 100644
--- a/test/cache_tagging.c
+++ b/test/cache_tagging.c
@@ -448,7 +448,7 @@ check_file_creation_tags(hid_t fcpl_id, int type)
TESTING("tag application during file creation");
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl)) < 0 ) TEST_ERROR;
@@ -539,7 +539,7 @@ check_file_open_tags(hid_t fcpl, int type)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -652,7 +652,7 @@ check_group_creation_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -751,7 +751,7 @@ check_multi_group_creation_tags(void)
TESTING("tag application during multiple group creation");
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Set latest version of library */
if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR;
@@ -881,7 +881,7 @@ check_link_iteration_tags(void)
TESTING("tag application during iteration over links in a group");
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* =========== */
/* Create File */
@@ -1000,7 +1000,7 @@ check_dense_attribute_tags(void)
TESTING("tag application during dense attribute manipulation");
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR;
/* Create Dcpl */
@@ -1184,7 +1184,7 @@ check_group_open_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -1295,7 +1295,7 @@ check_attribute_creation_tags(hid_t fcpl, int type)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -1429,7 +1429,7 @@ check_attribute_open_tags(hid_t fcpl, int type)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -1576,7 +1576,7 @@ check_attribute_rename_tags(hid_t fcpl, int type)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -1761,7 +1761,7 @@ check_attribute_delete_tags(hid_t fcpl, int type)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -1917,7 +1917,7 @@ check_dataset_creation_tags(hid_t fcpl, int type)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -2051,7 +2051,7 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -2187,7 +2187,7 @@ check_dataset_open_tags(void)
/* ========= */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -2318,7 +2318,7 @@ check_dataset_write_tags(void)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -2457,7 +2457,7 @@ check_attribute_write_tags(hid_t fcpl, int type)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file with provided fcpl_t */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -2613,7 +2613,7 @@ check_dataset_read_tags(void)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -2751,7 +2751,7 @@ check_dataset_size_retrieval(void)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -2890,7 +2890,7 @@ check_dataset_extend_tags(void)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -3017,7 +3017,7 @@ check_object_info_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -3126,7 +3126,7 @@ check_object_copy_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -3257,7 +3257,7 @@ check_link_removal_tags(hid_t fcpl, int type)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
@@ -3416,7 +3416,7 @@ check_link_getname_tags(void)
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -3553,7 +3553,7 @@ check_external_link_creation_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -3660,7 +3660,7 @@ check_external_link_open_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
@@ -3787,7 +3787,7 @@ check_invalid_tag_application(void)
#if H5C_DO_TAGGING_SANITY_CHECKS
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
/* Create a test file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
diff --git a/test/direct_chunk.c b/test/direct_chunk.c
index 2edfe64..8de923e 100644
--- a/test/direct_chunk.c
+++ b/test/direct_chunk.c
@@ -58,6 +58,14 @@
#define OVERWRITE_CHUNK_NY 2
#define OVERWRITE_VALUE 42
+/* Test configurations */
+#define CONFIG_LATEST 0x01
+#define CONFIG_REOPEN_FILE 0x02
+#define CONFIG_REOPEN_DSET 0x04
+#define CONFIG_DIRECT_WRITE 0x08
+#define CONFIG_DIRECT_READ 0x10
+#define CONFIG_END 0x20
+
/* Defines used in test_single_chunk_latest() */
#define FILE "single_latest.h5"
#define DATASET "dataset"
@@ -1973,7 +1981,7 @@ error:
} /* test_read_unallocated_chunk() */
/*-------------------------------------------------------------------------
- * Function: test_single_chunk_latest
+ * Function: test_single_chunk
*
* Purpose: This is to verify the fix for jira issue HDFFV-10425.
* The problem was due to a bug in the internal ilbrary routine
@@ -1989,13 +1997,16 @@ error:
* index for the dataset.
* Verify that the data read is the same as the written data.
*
+ * Since expanded to test multiple combinations of cases
+ * involving a single chunk
+ *
* Return: Success: 0
* Failure: 1
*
*-------------------------------------------------------------------------
*/
static int
-test_single_chunk_latest(void)
+test_single_chunk(unsigned config)
{
hid_t fid; /* File ID */
hid_t fapl; /* File access property list ID */
@@ -2005,11 +2016,12 @@ test_single_chunk_latest(void)
hsize_t dims[2] = {DIM0, DIM1}; /* Dimension sizes */
hsize_t chunk[2] = {CHUNK0, CHUNK1}; /* Chunk dimension sizes */
hsize_t offset[2] = {0,0}; /* Offset for writing */
+ uint32_t filters; /* Filter mask out */
int wdata[DIM0][DIM1]; /* Write buffer */
int rdata[DIM0][DIM1]; /* Read buffer */
int i, j; /* Local index variable */
- TESTING("H5Dwrite_chunk with single chunk and latest format");
+ TESTING("Single chunk I/O");
/* Initialize data */
for (i=0; i<DIM0; i++) {
@@ -2020,8 +2032,9 @@ test_single_chunk_latest(void)
/* Create a new file with the latest format */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- goto error;
+ if(config & CONFIG_LATEST)
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
if((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
@@ -2039,37 +2052,57 @@ test_single_chunk_latest(void)
if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- /* Write the data directly to the dataset */
- if(H5Dwrite_chunk(did, H5P_DEFAULT, 0, offset, CHUNK0*CHUNK1*4, (void *)wdata) < 0)
- goto error;
+ if(config & CONFIG_DIRECT_WRITE) {
+ /* Write the data directly to the dataset */
+ if(H5Dwrite_chunk(did, H5P_DEFAULT, 0, offset, CHUNK0*CHUNK1*4, (void *)wdata) < 0)
+ goto error;
+ } /* end if */
+ else
+ /* Write the data to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)wdata) < 0)
+ goto error;
/*
* Close and release resources.
*/
if(H5Pclose(dcpl) < 0)
goto error;
- if(H5Dclose(did) < 0)
- goto error;
+ if(config & CONFIG_REOPEN_DSET)
+ if(H5Dclose(did) < 0)
+ goto error;
if(H5Sclose(sid) < 0)
goto error;
if(H5Pclose(fapl) < 0)
goto error;
- if(H5Fclose(fid) < 0)
- goto error;
+ if(config & CONFIG_REOPEN_FILE)
+ if(H5Fclose(fid) < 0)
+ goto error;
/* Open the file and dataset with default properties */
- if((fid = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- goto error;
- if((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0)
- goto error;
+ if(config & CONFIG_REOPEN_FILE)
+ if((fid = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ goto error;
+ if(config & CONFIG_REOPEN_DSET)
+ if((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0)
+ goto error;
/* Retrieve dataset creation property list */
if((dcpl = H5Dget_create_plist(did)) < 0)
goto error;
- /* Read the data */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
- goto error;
+ if(config & CONFIG_DIRECT_READ) {
+ /* Read the data directly */
+ if(H5Dread_chunk(did, H5P_DEFAULT, offset, &filters, rdata) < 0)
+ goto error;
+
+ /* Verify returned filter mask */
+ if(filters != 0)
+ goto error;
+ } /* end if */
+ else
+ /* Read the data */
+ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
+ goto error;
/* Verify that the data read was correct. */
for (i = 0; i < DIM0; i++) {
@@ -2122,6 +2155,7 @@ error:
int main( void )
{
hid_t file_id;
+ unsigned config;
int nerrors=0;
/*
@@ -2149,7 +2183,53 @@ int main( void )
nerrors += test_read_unfiltered_dset(file_id);
nerrors += test_read_unallocated_chunk(file_id);
- nerrors += test_single_chunk_latest();
+ /* Loop over test configurations */
+ for(config = 0; config < CONFIG_END; config++) {
+ hbool_t need_comma = FALSE;
+
+ /* Check for invalid combinations */
+ if((config & CONFIG_REOPEN_FILE) && !(config & CONFIG_REOPEN_DSET))
+ continue;
+
+ /* Print configuration */
+ printf("Configuration: ");
+ if(config == 0)
+ printf("<empty>");
+ if(config & CONFIG_LATEST) {
+ if(need_comma)
+ printf(", ");
+ printf("latest format");
+ need_comma = TRUE;
+ } /* end if */
+ if(config & CONFIG_REOPEN_FILE) {
+ if(need_comma)
+ printf(", ");
+ printf("reopen file");
+ need_comma = TRUE;
+ } /* end if */
+ else if(config & CONFIG_REOPEN_DSET) {
+ if(need_comma)
+ printf(", ");
+ printf("reopen dataset");
+ need_comma = TRUE;
+ } /* end if */
+ if(config & CONFIG_DIRECT_WRITE) {
+ if(need_comma)
+ printf(", ");
+ printf("direct write");
+ need_comma = TRUE;
+ } /* end if */
+ if(config & CONFIG_DIRECT_READ) {
+ if(need_comma)
+ printf(", ");
+ printf("direct read");
+ need_comma = TRUE;
+ } /* end if */
+ printf(":\n");
+ fflush(stdout);
+
+ nerrors += test_single_chunk(config);
+ } /* end for */
if(H5Fclose(file_id) < 0)
goto error;
@@ -2165,3 +2245,4 @@ error:
HDputs("*** TESTS FAILED ***");
return EXIT_FAILURE;
}
+
diff --git a/test/dsets.c b/test/dsets.c
index 5de9cfa..a317f14 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -835,8 +835,8 @@ test_compact_io(hid_t fapl)
skipping invalid combinations.
- Create a file, create and write a compact dataset, and verify its data
- Verify the dataset's layout and fill message versions */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Set version bounds */
H5E_BEGIN_TRY {
@@ -10331,8 +10331,8 @@ test_zero_dim_dset(hid_t fapl)
/* Loop through all the combinations of low/high library format bounds,
skipping invalid combination, and verify support for reading a 1D
chunked dataset with dimension size = 0 */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Set version bounds before opening the file */
H5E_BEGIN_TRY {
@@ -12961,8 +12961,8 @@ test_versionbounds(void)
/* Create a source file and a dataset in it. Create a virtual file and
virtual dataset. Creation of virtual dataset should only succeed in
H5F_LIBVER_V110 */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Set version bounds, skip for invalid low/high combination */
H5E_BEGIN_TRY {
@@ -12990,7 +12990,7 @@ test_versionbounds(void)
if (vdset > 0) /* dataset created successfully */
{
/* Virtual dataset is only available starting in V110 */
- VERIFY(high, H5F_LIBVER_V110, "virtual dataset");
+ VERIFY(high >= H5F_LIBVER_V110, TRUE, "virtual dataset");
if(H5Dclose(vdset) < 0) TEST_ERROR
vdset = -1;
diff --git a/test/dtypes.c b/test/dtypes.c
index 7e5a992..2056245 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -6837,8 +6837,8 @@ test_delete_obj_named(hid_t fapl)
/* Loop through all valid the combinations of low/high library format bounds,
to test delete objects that use named datatypes through different file IDs */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Skip invalid low/high combination */
if ((high == H5F_LIBVER_EARLIEST) || (low > high))
@@ -6938,8 +6938,8 @@ test_delete_obj_named_fileid(hid_t fapl)
h5_fixname(FILENAME[9], fapl2, filename2, sizeof filename2);
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Skip invalid low/high combination */
if ((high == H5F_LIBVER_EARLIEST) || (low > high))
@@ -7627,7 +7627,10 @@ test_versionbounds(void)
H5F_t *filep = NULL; /* Pointer to internal structure of a file */
H5T_t *dtypep = NULL; /* Pointer to internal structure of a datatype */
hsize_t arr_dim[] = {ARRAY_LEN}; /* Length of the array */
+ int i, j; /* Indices for iterating over versions */
H5F_libver_t low, high; /* File format bounds */
+ H5F_libver_t versions[] = {H5F_LIBVER_EARLIEST, H5F_LIBVER_V18, H5F_LIBVER_V110};
+ int versions_count = 3; /* Number of version bounds in the array */
unsigned highest_version; /* Highest version in nested datatypes */
color_t enum_val; /* Enum type index */
herr_t ret = 0; /* Generic return value */
@@ -7691,19 +7694,19 @@ test_versionbounds(void)
ret = H5Tenum_insert(enum_type, "RED", &enum_val);
if (ret < 0) TEST_ERROR
- enum_val++;
+ enum_val = E1_GREEN;
ret = H5Tenum_insert(enum_type, "GREEN", &enum_val);
if (ret < 0) TEST_ERROR
- enum_val++;
+ enum_val = E1_BLUE;
ret = H5Tenum_insert(enum_type, "BLUE", &enum_val);
if (ret < 0) TEST_ERROR
- enum_val++;
+ enum_val = E1_ORANGE;
ret = H5Tenum_insert(enum_type, "ORANGE", &enum_val);
if (ret < 0) TEST_ERROR
- enum_val++;
+ enum_val = E1_YELLOW;
ret = H5Tenum_insert(enum_type, "YELLOW", &enum_val);
if (ret < 0) TEST_ERROR
@@ -7727,8 +7730,9 @@ test_versionbounds(void)
skipping invalid combinations */
/* Create the file, create and write to a dataset with compound datatype */
/* Verify the dataset's datatype and its members */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(i = 0, low = versions[i]; i < versions_count; i++) {
+
+ for(j = 0, high = versions[j]; j < versions_count; j++) {
/* Set version bounds */
H5E_BEGIN_TRY {
diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c
index 33d23dc..2c8f691 100644
--- a/test/enc_dec_plist.c
+++ b/test/enc_dec_plist.c
@@ -15,75 +15,139 @@
* Serial tests for encoding/decoding plists
*/
-#include "h5test.h"
+#include "testhdf5.h"
#include "H5ACprivate.h"
#include "H5Pprivate.h"
+#define SRC_FNAME "source_file.h5"
+#define SRC_DSET "src_dset"
+
static int
-test_encode_decode(hid_t orig_pl)
+test_encode_decode(hid_t orig_pl, H5F_libver_t low, H5F_libver_t high, hbool_t support_virtual)
{
- hid_t pl = (-1); /* Decoded property list */
+ hid_t pl = (-1); /* Decoded property list */
+ hid_t fapl = -1; /* File access property list */
void *temp_buf = NULL; /* Pointer to encoding buffer */
size_t temp_size = 0; /* Size of encoding buffer */
+ herr_t ret; /* Return value */
- /* first call to encode returns only the size of the buffer needed */
- if(H5Pencode(orig_pl, NULL, &temp_size) < 0)
- STACK_ERROR
+ /* Create file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR
- if(NULL == (temp_buf = (void *)HDmalloc(temp_size)))
+ /* Set library version bounds */
+ if(H5Pset_libver_bounds(fapl, low, high) < 0)
TEST_ERROR
- if(H5Pencode(orig_pl, temp_buf, &temp_size) < 0)
- STACK_ERROR
+ H5E_BEGIN_TRY {
+ ret = H5Pencode2(orig_pl, NULL, &temp_size, fapl);
+ } H5E_END_TRY;
+
+ if(support_virtual && high < H5F_LIBVER_V110)
+ VERIFY(ret, FAIL, "H5Pencode2");
+ else {
+
+ VERIFY(ret, SUCCEED, "H5Pencode2");
+
+ /* Allocate the buffer for encoding */
+ if(NULL == (temp_buf = (void *)HDmalloc(temp_size)))
+ TEST_ERROR
+
+ /* Encode the property list to the buffer */
+ if(H5Pencode2(orig_pl, temp_buf, &temp_size, fapl) < 0)
+ TEST_ERROR
+
+ /* Decode the buffer */
+ if((pl = H5Pdecode(temp_buf)) < 0)
+ STACK_ERROR
+
+ /* Check if the original and the decoded property lists are equal */
+ if(!H5Pequal(orig_pl, pl))
+ PUTS_ERROR("encoding-decoding cycle failed\n")
+
+ /* Close the decoded property list */
+ if((H5Pclose(pl)) < 0)
+ TEST_ERROR
+
+ /* Free the buffer */
+ if(temp_buf)
+ HDfree(temp_buf);
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ /* Test H5Pencode1() */
+
+ /* first call to encode returns only the size of the buffer needed */
+ if(H5Pencode1(orig_pl, NULL, &temp_size) < 0)
+ STACK_ERROR
+
+ if(NULL == (temp_buf = (void *)HDmalloc(temp_size)))
+ TEST_ERROR
+
+ if(H5Pencode1(orig_pl, temp_buf, &temp_size) < 0)
+ STACK_ERROR
- if((pl = H5Pdecode(temp_buf)) < 0)
- STACK_ERROR
+ if((pl = H5Pdecode(temp_buf)) < 0)
+ STACK_ERROR
- if(!H5Pequal(orig_pl, pl))
- PUTS_ERROR("encoding-decoding cycle failed\n")
+ if(!H5Pequal(orig_pl, pl))
+ PUTS_ERROR("encoding-decoding cycle failed\n")
- if((H5Pclose(pl)) < 0)
- STACK_ERROR
+ if((H5Pclose(pl)) < 0)
+ STACK_ERROR
- HDfree(temp_buf);
+ if(temp_buf)
+ HDfree(temp_buf);
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+ }
+
+ if((H5Pclose(fapl)) < 0)
+ TEST_ERROR
/* Success */
return(0);
error:
- if(pl > 0)
- H5Pclose(pl);
if(temp_buf)
HDfree(temp_buf);
+ H5E_BEGIN_TRY {
+ H5Pclose(pl);
+ H5Pclose(fapl);
+ } H5E_END_TRY;
+
return(-1);
} /* end test_encode_decode() */
int
main(void)
{
- hid_t dcpl; /* dataset create prop. list */
- hid_t dapl; /* dataset access prop. list */
- hid_t dxpl; /* dataset xfer prop. list */
- hid_t gcpl; /* group create prop. list */
- hid_t ocpypl; /* object copy prop. list */
- hid_t ocpl; /* object create prop. list */
- hid_t lcpl; /* link create prop. list */
- hid_t lapl; /* link access prop. list */
- hid_t fapl; /* file access prop. list */
- hid_t fcpl; /* file create prop. list */
- hid_t strcpl; /* string create prop. list */
- hid_t acpl; /* attribute create prop. list */
-
+ hid_t dcpl; /* dataset create prop. list */
+ hid_t dapl; /* dataset access prop. list */
+ hid_t dxpl; /* dataset xfer prop. list */
+ hid_t gcpl; /* group create prop. list */
+ hid_t ocpypl; /* object copy prop. list */
+ hid_t ocpl; /* object create prop. list */
+ hid_t lcpl; /* link create prop. list */
+ hid_t lapl; /* link access prop. list */
+ hid_t fapl; /* file access prop. list */
+ hid_t fcpl; /* file create prop. list */
+ hid_t strcpl; /* string create prop. list */
+ hid_t acpl; /* attribute create prop. list */
+ hid_t srcspace = -1; /* Source dataspaces */
+ hid_t vspace = -1; /* Virtual dset dataspaces */
+ hsize_t dims[1] = {3}; /* Data space current size */
hsize_t chunk_size[2] = {16384, 4}; /* chunk size */
- double fill = 2.7f; /* Fill value */
- hsize_t max_size[1]; /* data space maximum size */
+ double fill = 2.7f; /* Fill value */
+ hsize_t max_size[1]; /* data space maximum size */
size_t nslots = 521 * 2;
size_t nbytes = 1048576 * 10;
double w0 = 0.5f;
unsigned max_compact;
unsigned min_dense;
const char* c_to_f = "x+32";
+ H5F_libver_t low, high; /* Low and high bounds */
+
H5AC_cache_config_t my_cache_config = {
H5AC__CURR_CACHE_CONFIG_VERSION,
TRUE,
@@ -115,467 +179,511 @@ main(void)
0.2f,
(256 * 2048),
H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
+
H5AC_cache_image_config_t my_cache_image_config = {
- H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION,
- TRUE,
+ H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION,
+ TRUE,
FALSE,
- -1};
-
- if(VERBOSE_MED)
- printf("Encode/Decode DCPLs\n");
+ -1 };
+
+ /* Loop through all the combinations of low/high version bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ char msg[80]; /* Message for file version bounds */
+ char* low_string; /* The low bound string */
+ char* high_string; /* The high bound string */
+
+ /* Invalid combinations, just continue */
+ if(high == H5F_LIBVER_EARLIEST || high < low)
+ continue;
+
+ /* Display testing info */
+ low_string = h5_get_version_string(low);
+ high_string = h5_get_version_string(high);
+ HDsprintf(msg, "Testing ENCODE/DECODE with file version bounds: (%s, %s):", low_string, high_string);
+ HDputs(msg);
+
+
+ if(VERBOSE_MED)
+ printf("Encode/Decode DCPLs\n");
+
+ /******* ENCODE/DECODE DCPLS *****/
+ TESTING("Default DCPL Encoding/Decoding");
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(dcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default DCPL encoding/decoding failed\n")
+
+ PASSED();
+
+ TESTING("DCPL Encoding/Decoding");
+
+ if((H5Pset_chunk(dcpl, 2, chunk_size)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fill)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_dset_no_attrs_hint(dcpl, FALSE)) < 0)
+ FAIL_STACK_ERROR
+
+ max_size[0] = 100;
+ if((H5Pset_external(dcpl, "ext1.data", (off_t)0,
+ (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_external(dcpl, "ext2.data", (off_t)0,
+ (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_external(dcpl, "ext3.data", (off_t)0,
+ (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_external(dcpl, "ext4.data", (off_t)0,
+ (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(dcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("DCPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(dcpl)) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+ /******* ENCODE/DECODE DCPLS *****/
+ TESTING("DCPL Encoding/Decoding for virtual layout");
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set virtual layout */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ if((srcspace = H5Screate_simple(1, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspace */
+ if((vspace = H5Screate_simple(1, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mapping */
+ if(H5Pset_virtual(dcpl, vspace, SRC_FNAME, SRC_DSET, srcspace) < 0)
+ TEST_ERROR
+
+ if(test_encode_decode(dcpl, low, high, TRUE) < 0)
+ FAIL_PUTS_ERROR("DCPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(dcpl)) < 0)
+ FAIL_STACK_ERROR
+
+ /******* ENCODE/DECODE DAPLS *****/
+ TESTING("Default DAPL Encoding/Decoding");
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(dapl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default DAPL encoding/decoding failed\n")
+
+ PASSED();
+
+ TESTING("DAPL Encoding/Decoding");
+
+ if((H5Pset_chunk_cache(dapl, nslots, nbytes, w0)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(dapl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("DAPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(dapl)) < 0)
+ FAIL_STACK_ERROR
- /******* ENCODE/DECODE DCPLS *****/
- TESTING("Default DCPL Encoding/Decoding");
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR
+ PASSED();
- /* Test encoding & decoding default property list */
- if(test_encode_decode(dcpl) < 0)
- FAIL_PUTS_ERROR("Default DCPL encoding/decoding failed\n")
+ /******* ENCODE/DECODE OCPLS *****/
+ TESTING("Default OCPL Encoding/Decoding");
+ if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(ocpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default OCPL encoding/decoding failed\n")
- PASSED();
+ PASSED();
- TESTING("DCPL Encoding/Decoding");
+ TESTING("OCPL Encoding/Decoding");
- if((H5Pset_chunk(dcpl, 2, chunk_size)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_attr_creation_order(ocpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_attr_phase_change (ocpl, 110, 105)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fill)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_filter (ocpl, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_dset_no_attrs_hint(dcpl, FALSE)) < 0)
- FAIL_STACK_ERROR
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(ocpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("OCPL encoding/decoding failed\n")
- max_size[0] = 100;
- if((H5Pset_external(dcpl, "ext1.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_external(dcpl, "ext2.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_external(dcpl, "ext3.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_external(dcpl, "ext4.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(ocpl)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding property list */
- if(test_encode_decode(dcpl) < 0)
- FAIL_PUTS_ERROR("DCPL encoding/decoding failed\n")
-
- /* release resource */
- if((H5Pclose(dcpl)) < 0)
- FAIL_STACK_ERROR
+ PASSED();
- PASSED();
+ /******* ENCODE/DECODE DXPLS *****/
+ TESTING("Default DXPL Encoding/Decoding");
+ if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ FAIL_STACK_ERROR
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(dxpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default DXPL encoding/decoding failed\n")
- /******* ENCODE/DECODE DAPLS *****/
- TESTING("Default DAPL Encoding/Decoding");
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
- FAIL_STACK_ERROR
+ PASSED();
- /* Test encoding & decoding default property list */
- if(test_encode_decode(dapl) < 0)
- FAIL_PUTS_ERROR("Default DAPL encoding/decoding failed\n")
+ TESTING("DXPL Encoding/Decoding");
- PASSED();
+ if((H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_hyper_vector_size(dxpl, 5)) < 0)
+ FAIL_STACK_ERROR
- TESTING("DAPL Encoding/Decoding");
+#ifdef H5_HAVE_PARALLEL
+ if((H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_dxpl_mpio_chunk_opt(dxpl, H5FD_MPIO_CHUNK_MULTI_IO)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl, 30)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_dxpl_mpio_chunk_opt_num(dxpl, 40)) < 0)
+ FAIL_STACK_ERROR
+#endif/* H5_HAVE_PARALLEL */
+ if((H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_data_transform(dxpl, c_to_f)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_chunk_cache(dapl, nslots, nbytes, w0)) < 0)
- FAIL_STACK_ERROR
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(dxpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("DXPL encoding/decoding failed\n")
- /* Test encoding & decoding property list */
- if(test_encode_decode(dapl) < 0)
- FAIL_PUTS_ERROR("DAPL encoding/decoding failed\n")
-
- /* release resource */
- if((H5Pclose(dapl)) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(dxpl)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ PASSED();
+ /******* ENCODE/DECODE GCPLS *****/
+ TESTING("Default GCPL Encoding/Decoding");
+ if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(gcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default GCPL encoding/decoding failed\n")
- /******* ENCODE/DECODE OCPLS *****/
- TESTING("Default OCPL Encoding/Decoding");
- if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0)
- FAIL_STACK_ERROR
+ PASSED();
- /* Test encoding & decoding default property list */
- if(test_encode_decode(ocpl) < 0)
- FAIL_PUTS_ERROR("Default OCPL encoding/decoding failed\n")
+ TESTING("GCPL Encoding/Decoding");
- PASSED();
+ if((H5Pset_local_heap_size_hint(gcpl, 256)) < 0)
+ FAIL_STACK_ERROR
- TESTING("OCPL Encoding/Decoding");
+ if((H5Pset_link_phase_change(gcpl, 2, 2)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_attr_creation_order(ocpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
- FAIL_STACK_ERROR
+ /* Query the group creation properties */
+ if((H5Pget_link_phase_change(gcpl, &max_compact, &min_dense)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_attr_phase_change (ocpl, 110, 105)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_est_link_info(gcpl, 3, 9)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_filter (ocpl, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_link_creation_order(gcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding property list */
- if(test_encode_decode(ocpl) < 0)
- FAIL_PUTS_ERROR("OCPL encoding/decoding failed\n")
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(gcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("GCPL encoding/decoding failed\n")
- /* release resource */
- if((H5Pclose(ocpl)) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(gcpl)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ PASSED();
+ /******* ENCODE/DECODE LCPLS *****/
+ TESTING("Default LCPL Encoding/Decoding");
+ if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ FAIL_STACK_ERROR
- /******* ENCODE/DECODE DXPLS *****/
- TESTING("Default DXPL Encoding/Decoding");
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- FAIL_STACK_ERROR
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(lcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default LCPL encoding/decoding failed\n")
- /* Test encoding & decoding default property list */
- if(test_encode_decode(dxpl) < 0)
- FAIL_PUTS_ERROR("Default DXPL encoding/decoding failed\n")
+ PASSED();
- PASSED();
+ TESTING("LCPL Encoding/Decoding");
- TESTING("DXPL Encoding/Decoding");
+ if((H5Pset_create_intermediate_group(lcpl, TRUE)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_hyper_vector_size(dxpl, 5)) < 0)
- FAIL_STACK_ERROR
-#ifdef H5_HAVE_PARALLEL
- if((H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_dxpl_mpio_chunk_opt(dxpl, H5FD_MPIO_CHUNK_MULTI_IO)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl, 30)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_dxpl_mpio_chunk_opt_num(dxpl, 40)) < 0)
- FAIL_STACK_ERROR
-#endif/* H5_HAVE_PARALLEL */
- if((H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_data_transform(dxpl, c_to_f)) < 0)
- FAIL_STACK_ERROR
-
- /* Test encoding & decoding property list */
- if(test_encode_decode(dxpl) < 0)
- FAIL_PUTS_ERROR("DXPL encoding/decoding failed\n")
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(lcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("LCPL encoding/decoding failed\n")
- /* release resource */
- if((H5Pclose(dxpl)) < 0)
- FAIL_STACK_ERROR
-
- PASSED();
+ /* release resource */
+ if((H5Pclose(lcpl)) < 0)
+ FAIL_STACK_ERROR
+ PASSED();
- /******* ENCODE/DECODE GCPLS *****/
- TESTING("Default GCPL Encoding/Decoding");
- if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0)
- FAIL_STACK_ERROR
- /* Test encoding & decoding default property list */
- if(test_encode_decode(gcpl) < 0)
- FAIL_PUTS_ERROR("Default GCPL encoding/decoding failed\n")
+ /******* ENCODE/DECODE LAPLS *****/
+ TESTING("Default LAPL Encoding/Decoding");
+ if((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(lapl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default LAPL encoding/decoding failed\n")
- TESTING("GCPL Encoding/Decoding");
-
- if((H5Pset_local_heap_size_hint(gcpl, 256)) < 0)
- FAIL_STACK_ERROR
-
- if((H5Pset_link_phase_change(gcpl, 2, 2)) < 0)
- FAIL_STACK_ERROR
-
- /* Query the group creation properties */
- if((H5Pget_link_phase_change(gcpl, &max_compact, &min_dense)) < 0)
- FAIL_STACK_ERROR
-
- if((H5Pset_est_link_info(gcpl, 3, 9)) < 0)
- FAIL_STACK_ERROR
-
- if((H5Pset_link_creation_order(gcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
- FAIL_STACK_ERROR
-
- /* Test encoding & decoding property list */
- if(test_encode_decode(gcpl) < 0)
- FAIL_PUTS_ERROR("GCPL encoding/decoding failed\n")
-
- /* release resource */
- if((H5Pclose(gcpl)) < 0)
- FAIL_STACK_ERROR
+ PASSED();
- PASSED();
+ TESTING("LAPL Encoding/Decoding");
+ if((H5Pset_nlinks(lapl, (size_t)134)) < 0)
+ FAIL_STACK_ERROR
- /******* ENCODE/DECODE LCPLS *****/
- TESTING("Default LCPL Encoding/Decoding");
- if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_elink_acc_flags(lapl, H5F_ACC_RDONLY)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding default property list */
- if(test_encode_decode(lcpl) < 0)
- FAIL_PUTS_ERROR("Default LCPL encoding/decoding failed\n")
+ if((H5Pset_elink_prefix(lapl, "/tmpasodiasod")) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ /* Create FAPL for the elink FAPL */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_alignment(fapl, 2, 1024)) < 0)
+ FAIL_STACK_ERROR
- TESTING("LCPL Encoding/Decoding");
+ if((H5Pset_elink_fapl(lapl, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_create_intermediate_group(lcpl, TRUE)) < 0)
- FAIL_STACK_ERROR
+ /* Close the elink's FAPL */
+ if((H5Pclose(fapl)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding property list */
- if(test_encode_decode(lcpl) < 0)
- FAIL_PUTS_ERROR("LCPL encoding/decoding failed\n")
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(lapl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("LAPL encoding/decoding failed\n")
- /* release resource */
- if((H5Pclose(lcpl)) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(lapl)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ PASSED();
- /******* ENCODE/DECODE LAPLS *****/
- TESTING("Default LAPL Encoding/Decoding");
- if((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0)
- FAIL_STACK_ERROR
+ /******* ENCODE/DECODE OCPYPLS *****/
+ TESTING("Default OCPYPL Encoding/Decoding");
+ if((ocpypl = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding default property list */
- if(test_encode_decode(lapl) < 0)
- FAIL_PUTS_ERROR("Default LAPL encoding/decoding failed\n")
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(ocpypl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default OCPYPL encoding/decoding failed\n")
- PASSED();
+ PASSED();
- TESTING("LAPL Encoding/Decoding");
+ TESTING("OCPYPL Encoding/Decoding");
- if((H5Pset_nlinks(lapl, (size_t)134)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_copy_object(ocpypl, H5O_COPY_EXPAND_EXT_LINK_FLAG)) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_elink_acc_flags(lapl, H5F_ACC_RDONLY)) < 0)
- FAIL_STACK_ERROR
+ if((H5Padd_merge_committed_dtype_path(ocpypl, "foo")) < 0)
+ FAIL_STACK_ERROR
+ if((H5Padd_merge_committed_dtype_path(ocpypl, "bar")) < 0)
+ FAIL_STACK_ERROR
- if((H5Pset_elink_prefix(lapl, "/tmpasodiasod")) < 0)
- FAIL_STACK_ERROR
-
- /* Create FAPL for the elink FAPL */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_alignment(fapl, 2, 1024)) < 0)
- FAIL_STACK_ERROR
-
- if((H5Pset_elink_fapl(lapl, fapl)) < 0)
- FAIL_STACK_ERROR
-
- /* Close the elink's FAPL */
- if((H5Pclose(fapl)) < 0)
- FAIL_STACK_ERROR
-
- /* Test encoding & decoding property list */
- if(test_encode_decode(lapl) < 0)
- FAIL_PUTS_ERROR("LAPL encoding/decoding failed\n")
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(ocpypl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("OCPYPL encoding/decoding failed\n")
- /* release resource */
- if((H5Pclose(lapl)) < 0)
- FAIL_STACK_ERROR
-
- PASSED();
+ /* release resource */
+ if((H5Pclose(ocpypl)) < 0)
+ FAIL_STACK_ERROR
+ PASSED();
- /******* ENCODE/DECODE OCPYPLS *****/
- TESTING("Default OCPYPL Encoding/Decoding");
- if((ocpypl = H5Pcreate(H5P_OBJECT_COPY)) < 0)
- FAIL_STACK_ERROR
+ /******* ENCODE/DECODE FAPLS *****/
+ TESTING("Default FAPL Encoding/Decoding");
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding default property list */
- if(test_encode_decode(ocpypl) < 0)
- FAIL_PUTS_ERROR("Default OCPYPL encoding/decoding failed\n")
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(fapl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default FAPL encoding/decoding failed\n")
- PASSED();
+ PASSED();
- TESTING("OCPYPL Encoding/Decoding");
+ TESTING("FAPL Encoding/Decoding");
- if((H5Pset_copy_object(ocpypl, H5O_COPY_EXPAND_EXT_LINK_FLAG)) < 0)
- FAIL_STACK_ERROR
+ if((H5Pset_family_offset(fapl, 1024)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_meta_block_size(fapl, 2098452)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_sieve_buf_size(fapl, 1048576)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_alignment(fapl, 2, 1024)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_cache(fapl, 1024, 128, 10485760, 0.3f)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_elink_file_cache_size(fapl, 10485760)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_gc_references(fapl, 1)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_small_data_block_size(fapl, 2048)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_fclose_degree(fapl, H5F_CLOSE_WEAK)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_multi_type(fapl, H5FD_MEM_GHEAP)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_mdc_config(fapl, &my_cache_config)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_mdc_image_config(fapl, &my_cache_image_config)) < 0)
+ FAIL_STACK_ERROR
- if((H5Padd_merge_committed_dtype_path(ocpypl, "foo")) < 0)
- FAIL_STACK_ERROR
- if((H5Padd_merge_committed_dtype_path(ocpypl, "bar")) < 0)
- FAIL_STACK_ERROR
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(fapl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("FAPL encoding/decoding failed\n")
- /* Test encoding & decoding property list */
- if(test_encode_decode(ocpypl) < 0)
- FAIL_PUTS_ERROR("OCPYPL encoding/decoding failed\n")
-
- /* release resource */
- if((H5Pclose(ocpypl)) < 0)
- FAIL_STACK_ERROR
-
- PASSED();
-
-
- /******* ENCODE/DECODE FAPLS *****/
- TESTING("Default FAPL Encoding/Decoding");
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- FAIL_STACK_ERROR
-
- /* Test encoding & decoding default property list */
- if(test_encode_decode(fapl) < 0)
- FAIL_PUTS_ERROR("Default FAPL encoding/decoding failed\n")
-
- PASSED();
-
- TESTING("FAPL Encoding/Decoding");
-
- if((H5Pset_family_offset(fapl, 1024)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_meta_block_size(fapl, 2098452)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_sieve_buf_size(fapl, 1048576)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_alignment(fapl, 2, 1024)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_cache(fapl, 1024, 128, 10485760, 0.3f)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_elink_file_cache_size(fapl, 10485760)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_gc_references(fapl, 1)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_small_data_block_size(fapl, 2048)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_fclose_degree(fapl, H5F_CLOSE_WEAK)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_multi_type(fapl, H5FD_MEM_GHEAP)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_mdc_config(fapl, &my_cache_config)) < 0)
- FAIL_STACK_ERROR
- if((H5Pset_mdc_image_config(fapl, &my_cache_image_config)) < 0)
- FAIL_STACK_ERROR
-
- /* Test encoding & decoding property list */
- if(test_encode_decode(fapl) < 0)
- FAIL_PUTS_ERROR("FAPL encoding/decoding failed\n")
-
- /* release resource */
- if((H5Pclose(fapl)) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(fapl)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ PASSED();
- /******* ENCODE/DECODE FCPLS *****/
- TESTING("Default FCPL Encoding/Decoding");
+ /******* ENCODE/DECODE FCPLS *****/
+ TESTING("Default FCPL Encoding/Decoding");
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- FAIL_STACK_ERROR
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding default property list */
- if(test_encode_decode(fcpl) < 0)
- FAIL_PUTS_ERROR("Default FCPL encoding/decoding failed\n")
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(fcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default FCPL encoding/decoding failed\n")
- PASSED();
+ PASSED();
- TESTING("FCPL Encoding/Decoding");
+ TESTING("FCPL Encoding/Decoding");
- if((H5Pset_userblock(fcpl, 1024) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_userblock(fcpl, 1024) < 0))
+ FAIL_STACK_ERROR
- if((H5Pset_istore_k(fcpl, 3) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_istore_k(fcpl, 3) < 0))
+ FAIL_STACK_ERROR
- if((H5Pset_sym_k(fcpl, 4, 5) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_sym_k(fcpl, 4, 5) < 0))
+ FAIL_STACK_ERROR
- if((H5Pset_shared_mesg_nindexes(fcpl, 8) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_shared_mesg_nindexes(fcpl, 8) < 0))
+ FAIL_STACK_ERROR
- if((H5Pset_shared_mesg_index(fcpl, 1, H5O_SHMESG_SDSPACE_FLAG, 32) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_shared_mesg_index(fcpl, 1, H5O_SHMESG_SDSPACE_FLAG, 32) < 0))
+ FAIL_STACK_ERROR
- if((H5Pset_shared_mesg_phase_change(fcpl, 60, 20) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_shared_mesg_phase_change(fcpl, 60, 20) < 0))
+ FAIL_STACK_ERROR
- if((H5Pset_sizes(fcpl, 8, 4) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_sizes(fcpl, 8, 4) < 0))
+ FAIL_STACK_ERROR
- /* Test encoding & decoding property list */
- if(test_encode_decode(fcpl) < 0)
- FAIL_PUTS_ERROR("FCPL encoding/decoding failed\n")
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(fcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("FCPL encoding/decoding failed\n")
- /* release resource */
- if((H5Pclose(fcpl)) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(fcpl)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ PASSED();
- /******* ENCODE/DECODE STRCPLS *****/
- TESTING("Default STRCPL Encoding/Decoding");
+ /******* ENCODE/DECODE STRCPLS *****/
+ TESTING("Default STRCPL Encoding/Decoding");
- if((strcpl = H5Pcreate(H5P_STRING_CREATE)) < 0)
- FAIL_STACK_ERROR
+ if((strcpl = H5Pcreate(H5P_STRING_CREATE)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding default property list */
- if(test_encode_decode(strcpl) < 0)
- FAIL_PUTS_ERROR("Default STRCPL encoding/decoding failed\n")
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(strcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default STRCPL encoding/decoding failed\n")
- PASSED();
+ PASSED();
- TESTING("STRCPL Encoding/Decoding");
+ TESTING("STRCPL Encoding/Decoding");
- if((H5Pset_char_encoding(strcpl, H5T_CSET_UTF8) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_char_encoding(strcpl, H5T_CSET_UTF8) < 0))
+ FAIL_STACK_ERROR
- /* Test encoding & decoding property list */
- if(test_encode_decode(strcpl) < 0)
- FAIL_PUTS_ERROR("STRCPL encoding/decoding failed\n")
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(strcpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("STRCPL encoding/decoding failed\n")
- /* release resource */
- if((H5Pclose(strcpl)) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(strcpl)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ PASSED();
- /******* ENCODE/DECODE ACPLS *****/
- TESTING("Default ACPL Encoding/Decoding");
+ /******* ENCODE/DECODE ACPLS *****/
+ TESTING("Default ACPL Encoding/Decoding");
- if((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0)
- FAIL_STACK_ERROR
+ if((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0)
+ FAIL_STACK_ERROR
- /* Test encoding & decoding default property list */
- if(test_encode_decode(acpl) < 0)
- FAIL_PUTS_ERROR("Default ACPL encoding/decoding failed\n")
+ /* Test encoding & decoding default property list */
+ if(test_encode_decode(acpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("Default ACPL encoding/decoding failed\n")
- PASSED();
+ PASSED();
- TESTING("ACPL Encoding/Decoding");
+ TESTING("ACPL Encoding/Decoding");
- if((H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0))
- FAIL_STACK_ERROR
+ if((H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0))
+ FAIL_STACK_ERROR
- /* Test encoding & decoding property list */
- if(test_encode_decode(acpl) < 0)
- FAIL_PUTS_ERROR("ACPL encoding/decoding failed\n")
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(acpl, low, high, FALSE) < 0)
+ FAIL_PUTS_ERROR("ACPL encoding/decoding failed\n")
- /* release resource */
- if((H5Pclose(acpl)) < 0)
- FAIL_STACK_ERROR
+ /* release resource */
+ if((H5Pclose(acpl)) < 0)
+ FAIL_STACK_ERROR
- PASSED();
+ PASSED();
+ } /* end high */
+ } /* end low */
return 0;
diff --git a/test/external.c b/test/external.c
index 20a9ed8..6aa9d1b 100644
--- a/test/external.c
+++ b/test/external.c
@@ -17,25 +17,7 @@
*
* Purpose: Tests datasets stored in external raw files.
*/
-#include "h5test.h"
-
-const char *FILENAME[] = {
- "extern_1",
- "extern_2",
- "extern_3",
- "extern_4",
- "extern_dir/file_1",
- "extern_5",
- NULL
-};
-
-/* A similar collection of files is used for the tests that
- * perform file I/O.
- */
-#define N_EXT_FILES 4
-#define PART_SIZE 25
-#define TOTAL_SIZE 100
-#define GARBAGE_PER_FILE 10
+#include "external_common.h"
/*-------------------------------------------------------------------------
@@ -99,106 +81,6 @@ out:
/*-------------------------------------------------------------------------
- * Function: reset_raw_data_files
- *
- * Purpose: Resets the data in the raw data files for tests that
- * perform dataset I/O on a set of files.
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: Dana Robinson
- * February 2016
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-reset_raw_data_files(void)
-{
- int fd = 0; /* external file descriptor */
- size_t i, j; /* iterators */
- hssize_t n; /* bytes of I/O */
- char filename[1024]; /* file name */
- int data[PART_SIZE]; /* raw data buffer */
- uint8_t *garbage = NULL; /* buffer of garbage data */
- size_t garbage_count; /* size of garbage buffer */
- size_t garbage_bytes; /* # of garbage bytes written to file */
-
- /* Set up garbage buffer */
- garbage_count = N_EXT_FILES * GARBAGE_PER_FILE;
- if(NULL == (garbage = (uint8_t *)HDcalloc(garbage_count, sizeof(uint8_t))))
- goto error;
- for(i = 0; i < garbage_count; i++)
- garbage[i] = 0xFF;
-
- /* The *r files are pre-filled with data and are used to
- * verify that read operations work correctly.
- */
- for(i = 0; i < N_EXT_FILES; i++) {
-
- /* Open file */
- HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1);
- if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
- goto error;
-
- /* Write garbage data to the file. This allows us to test the
- * the ability to set an offset in the raw data file.
- */
- garbage_bytes = i * 10;
- n = HDwrite(fd, garbage, garbage_bytes);
- if(n < 0 || (size_t)n != garbage_bytes)
- goto error;
-
- /* Fill array with data */
- for(j = 0; j < PART_SIZE; j++) {
- data[j] = (int)(i * 25 + j);
- } /* end for */
-
- /* Write raw data to the file. */
- n = HDwrite(fd, data, sizeof(data));
- if(n != sizeof(data))
- goto error;
-
- /* Close this file */
- HDclose(fd);
-
- } /* end for */
-
- /* The *w files are only pre-filled with the garbage data and are
- * used to verify that write operations work correctly. The individual
- * tests fill in the actual data.
- */
- for(i = 0; i < N_EXT_FILES; i++) {
-
- /* Open file */
- HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1);
- if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
- goto error;
-
- /* Write garbage data to the file. This allows us to test the
- * the ability to set an offset in the raw data file.
- */
- garbage_bytes = i * 10;
- n = HDwrite(fd, garbage, garbage_bytes);
- if(n < 0 || (size_t)n != garbage_bytes)
- goto error;
-
- /* Close this file */
- HDclose(fd);
-
- } /* end for */
- HDfree(garbage);
- return SUCCEED;
-
-error:
- if(fd)
- HDclose(fd);
- if(garbage)
- HDfree(garbage);
- return FAIL;
-} /* end reset_raw_data_files() */
-
-
-/*-------------------------------------------------------------------------
* Function: test_non_extendible
*
* Purpose: Tests a non-extendible dataset with a single external file.
@@ -753,14 +635,14 @@ test_read_file_set(hid_t fapl)
TEST_ERROR
/* Reset the raw data files */
- if(reset_raw_data_files() < 0)
+ if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the file and an initial group. This causes messages about
* debugging to be emitted before we start playing games with what the
* output looks like.
*/
- h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
+ h5_fixname(EXT_FNAME[1], fapl, filename, sizeof(filename));
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
if((grp = H5Gcreate2(file, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
@@ -871,7 +753,7 @@ test_write_file_set(hid_t fapl)
TEST_ERROR
/* Create another file */
- h5_fixname(FILENAME[2], fapl, filename, sizeof(filename));
+ h5_fixname(EXT_FNAME[2], fapl, filename, sizeof(filename));
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
@@ -893,7 +775,7 @@ test_write_file_set(hid_t fapl)
} /* end for */
/* Reset the raw data files */
- if(reset_raw_data_files() < 0)
+ if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the dataset */
@@ -989,12 +871,12 @@ test_path_absolute(hid_t fapl)
TESTING("absolute filenames for external file");
- h5_fixname(FILENAME[3], fapl, filename, sizeof(filename));
+ h5_fixname(EXT_FNAME[3], fapl, filename, sizeof(filename));
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Reset the raw data files */
- if(reset_raw_data_files() < 0)
+ if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the dcpl */
@@ -1085,12 +967,12 @@ test_path_relative(hid_t fapl)
if (HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR;
- h5_fixname(FILENAME[4], fapl, filename, sizeof(filename));
+ h5_fixname(EXT_FNAME[4], fapl, filename, sizeof(filename));
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR;
/* Reset the raw data files */
- if(reset_raw_data_files() < 0)
+ if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the dataset */
@@ -1180,12 +1062,12 @@ test_path_relative_cwd(hid_t fapl)
if(HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR;
- h5_fixname(FILENAME[4], fapl, filename, sizeof(filename));
+ h5_fixname(EXT_FNAME[4], fapl, filename, sizeof(filename));
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR;
/* Reset the raw data files */
- if(reset_raw_data_files() < 0)
+ if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the dataset */
@@ -1297,116 +1179,6 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_path_env
- *
- * Purpose: Test whether the value of HDF5_EXTFILE_PREFIX will overwrite
- * the efile_prefix dataset access property.
- * This will create an HDF5 file in a subdirectory which will
- * refer to ../extern_*a.raw
- * The files are then accessed by setting the HDF5_EXTFILE_PREFIX
- * environment variable to "${ORIGIN}".
- * The efile_prefix dataset access property is set to "someprefix",
- * which will cause an error if the value is not overwritten by
- * the environment variable.
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Steffen Kiess
- * March 10, 2015
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_path_env(hid_t fapl)
-{
- hid_t file = -1; /* file to write to */
- hid_t dcpl = -1; /* dataset creation properties */
- hid_t space = -1; /* data space */
- hid_t dapl = -1; /* dataset access property list */
- hid_t dset = -1; /* dataset */
- size_t i; /* miscellaneous counters */
- char cwdpath[1024]; /* working directory */
- char filename[1024]; /* file name */
- int part[PART_SIZE]; /* raw data buffer (partial) */
- int whole[TOTAL_SIZE]; /* raw data buffer (total) */
- hsize_t cur_size; /* current data space size */
- char buffer[1024]; /* buffer to read efile_prefix */
-
- TESTING("prefix in HDF5_EXTFILE_PREFIX");
-
- if(HDsetenv("HDF5_EXTFILE_PREFIX", "${ORIGIN}", 1))
- TEST_ERROR
-
- if(HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR;
-
- h5_fixname(FILENAME[4], fapl, filename, sizeof(filename));
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR
-
- /* Reset the raw data files */
- if(reset_raw_data_files() < 0)
- TEST_ERROR
-
- /* Create the dataset */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR
- if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath)))
- TEST_ERROR
- for(i = 0; i < N_EXT_FILES; i++) {
- HDsnprintf(filename, sizeof(filename), "..%sextern_%dr.raw", H5_DIR_SEPS, (int) i + 1);
- if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
- FAIL_STACK_ERROR
- } /* end for */
-
- cur_size = TOTAL_SIZE;
- if((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
- FAIL_STACK_ERROR
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
- FAIL_STACK_ERROR
-
- /* Set prefix to a nonexistent directory, will be overwritten by environment variable */
- if(H5Pset_efile_prefix(dapl, "someprefix") < 0)
- FAIL_STACK_ERROR
- if(H5Pget_efile_prefix(dapl, buffer, sizeof(buffer)) < 0)
- FAIL_STACK_ERROR
- if(HDstrcmp(buffer, "someprefix") != 0)
- FAIL_PUTS_ERROR("efile prefix not set correctly");
-
- /* Create dataset */
- if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, dapl)) < 0)
- FAIL_STACK_ERROR
-
- /* Read the entire dataset and compare with the original */
- HDmemset(whole, 0, sizeof(whole));
- if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
- FAIL_STACK_ERROR
- for(i = 0; i < TOTAL_SIZE; i++)
- if(whole[i] != (signed)i)
- FAIL_PUTS_ERROR("Incorrect value(s) read.");
-
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dapl) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Pclose(dapl);
- H5Dclose(dset);
- H5Pclose(dcpl);
- H5Sclose(space);
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-} /* end test_path_env() */
-
-
-/*-------------------------------------------------------------------------
* Function: test_h5d_get_access_plist
*
* Purpose: Ensure that H5Dget_access_plist returns correct values.
@@ -1437,11 +1209,11 @@ test_h5d_get_access_plist(hid_t fapl_id)
TEST_ERROR
/* Reset the raw data files */
- if(reset_raw_data_files() < 0)
+ if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the file */
- h5_fixname(FILENAME[5], fapl_id, filename, sizeof(filename));
+ h5_fixname(EXT_FNAME[5], fapl_id, filename, sizeof(filename));
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
FAIL_STACK_ERROR
@@ -1532,7 +1304,7 @@ main(void)
/* Get a fapl for the old (default) file format */
fapl_id_old = h5_fileaccess();
- h5_fixname(FILENAME[0], fapl_id_old, filename, sizeof(filename));
+ h5_fixname(EXT_FNAME[0], fapl_id_old, filename, sizeof(filename));
/* Copy and set up a fapl for the latest file format */
if((fapl_id_new = H5Pcopy(fapl_id_old)) < 0)
@@ -1585,10 +1357,9 @@ main(void)
nerrors += test_path_absolute(current_fapl_id);
nerrors += test_path_relative(current_fapl_id);
nerrors += test_path_relative_cwd(current_fapl_id);
- nerrors += test_path_env(current_fapl_id);
/* Verify symbol table messages are cached */
- nerrors += (h5_verify_cached_stabs(FILENAME, current_fapl_id) < 0 ? 1 : 0);
+ nerrors += (h5_verify_cached_stabs(EXT_FNAME, current_fapl_id) < 0 ? 1 : 0);
/* Close the common file */
if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
@@ -1603,7 +1374,7 @@ main(void)
HDputs("All external storage tests passed.");
/* Clean up files used by file set tests */
- if(h5_cleanup(FILENAME, fapl_id_old)) {
+ if(h5_cleanup(EXT_FNAME, fapl_id_old)) {
HDremove("extern_1r.raw");
HDremove("extern_2r.raw");
HDremove("extern_3r.raw");
@@ -1630,4 +1401,3 @@ error:
printf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s");
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/test/external_common.c b/test/external_common.c
new file mode 100644
index 0000000..c3aa455
--- /dev/null
+++ b/test/external_common.c
@@ -0,0 +1,127 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: Raymond Lu <songyulu@hdfgroup.org>
+ * April, 2019
+ *
+ * Purpose: Private function for external.c and external_env.c
+ */
+
+#include "external_common.h"
+
+
+/*-------------------------------------------------------------------------
+ * Function: reset_raw_data_files
+ *
+ * Purpose: Resets the data in the raw data files for tests that
+ * perform dataset I/O on a set of files.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * February 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+reset_raw_data_files(int is_env)
+{
+ int fd = 0; /* external file descriptor */
+ size_t i, j; /* iterators */
+ hssize_t n; /* bytes of I/O */
+ char filename[1024]; /* file name */
+ int data[PART_SIZE]; /* raw data buffer */
+ uint8_t *garbage = NULL; /* buffer of garbage data */
+ size_t garbage_count; /* size of garbage buffer */
+ size_t garbage_bytes; /* # of garbage bytes written to file */
+
+ /* Set up garbage buffer */
+ garbage_count = N_EXT_FILES * GARBAGE_PER_FILE;
+ if(NULL == (garbage = (uint8_t *)HDcalloc(garbage_count, sizeof(uint8_t))))
+ goto error;
+ for(i = 0; i < garbage_count; i++)
+ garbage[i] = 0xFF;
+
+ /* The *r files are pre-filled with data and are used to
+ * verify that read operations work correctly.
+ */
+ for(i = 0; i < N_EXT_FILES; i++) {
+
+ /* Open file */
+ if(is_env)
+ HDsprintf(filename, "extern_env_%lur.raw", (unsigned long)i + 1);
+ else
+ HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1);
+ if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
+ goto error;
+
+ /* Write garbage data to the file. This allows us to test the
+ * the ability to set an offset in the raw data file.
+ */
+ garbage_bytes = i * 10;
+ n = HDwrite(fd, garbage, garbage_bytes);
+ if(n < 0 || (size_t)n != garbage_bytes)
+ goto error;
+
+ /* Fill array with data */
+ for(j = 0; j < PART_SIZE; j++) {
+ data[j] = (int)(i * 25 + j);
+ } /* end for */
+
+ /* Write raw data to the file. */
+ n = HDwrite(fd, data, sizeof(data));
+ if(n != sizeof(data))
+ goto error;
+
+ /* Close this file */
+ HDclose(fd);
+
+ } /* end for */
+
+ /* The *w files are only pre-filled with the garbage data and are
+ * used to verify that write operations work correctly. The individual
+ * tests fill in the actual data.
+ */
+ for(i = 0; i < N_EXT_FILES; i++) {
+
+ /* Open file */
+ if(is_env)
+ HDsprintf(filename, "extern_env_%luw.raw", (unsigned long)i + 1);
+ else
+ HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1);
+ if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
+ goto error;
+
+ /* Write garbage data to the file. This allows us to test the
+ * the ability to set an offset in the raw data file.
+ */
+ garbage_bytes = i * 10;
+ n = HDwrite(fd, garbage, garbage_bytes);
+ if(n < 0 || (size_t)n != garbage_bytes)
+ goto error;
+
+ /* Close this file */
+ HDclose(fd);
+
+ } /* end for */
+ HDfree(garbage);
+ return SUCCEED;
+
+error:
+ if(fd)
+ HDclose(fd);
+ if(garbage)
+ HDfree(garbage);
+ return FAIL;
+}
diff --git a/test/external_common.h b/test/external_common.h
new file mode 100644
index 0000000..cc2b5fb
--- /dev/null
+++ b/test/external_common.h
@@ -0,0 +1,50 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: Raymond Lu <songyulu@hdfgroup.org>
+ * April, 2019
+ *
+ * Purpose: Private function for external.c and external_env.c
+ */
+#ifndef _EXTERNAL_COMMON_H
+#define _EXTERNAL_COMMON_H
+
+/* Include test header files */
+#include "h5test.h"
+
+static const char *EXT_FNAME[] = {
+ "extern_1",
+ "extern_2",
+ "extern_3",
+ "extern_4",
+ "extern_dir/file_1",
+ "extern_5",
+ NULL
+};
+
+static const char *EXT_ENV_FNAME[] = {
+ "extern_env_dir/env_file_1",
+ NULL
+};
+
+/* A similar collection of files is used for the tests that
+ * perform file I/O.
+ */
+#define N_EXT_FILES 4
+#define PART_SIZE 25
+#define TOTAL_SIZE 100
+#define GARBAGE_PER_FILE 10
+
+H5TEST_DLL herr_t reset_raw_data_files(int);
+#endif /* _EXTERNAL_COMMON_H */
diff --git a/test/external_env.c b/test/external_env.c
new file mode 100644
index 0000000..55f68be
--- /dev/null
+++ b/test/external_env.c
@@ -0,0 +1,213 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: Tests datasets stored in external raw files.
+ */
+#include "external_common.h"
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_path_env
+ *
+ * Purpose: Test whether the value of HDF5_EXTFILE_PREFIX will overwrite
+ * the efile_prefix dataset access property.
+ * This will create an HDF5 file in a subdirectory which will
+ * refer to ../extern_*a.raw
+ * The files are then accessed by setting the HDF5_EXTFILE_PREFIX
+ * environment variable to "${ORIGIN}".
+ * The efile_prefix dataset access property is set to "someprefix",
+ * which will cause an error if the value is not overwritten by
+ * the environment variable.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Steffen Kiess
+ * March 10, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_path_env(hid_t fapl)
+{
+ hid_t file = -1; /* file to write to */
+ hid_t dcpl = -1; /* dataset creation properties */
+ hid_t space = -1; /* data space */
+ hid_t dapl = -1; /* dataset access property list */
+ hid_t dset = -1; /* dataset */
+ size_t i; /* miscellaneous counters */
+ char cwdpath[1024]; /* working directory */
+ char filename[1024]; /* file name */
+ int part[PART_SIZE]; /* raw data buffer (partial) */
+ int whole[TOTAL_SIZE]; /* raw data buffer (total) */
+ hsize_t cur_size; /* current data space size */
+ char buffer[1024]; /* buffer to read efile_prefix */
+
+ TESTING("prefix in HDF5_EXTFILE_PREFIX");
+
+ if(HDmkdir("extern_env_dir", (mode_t)0755) < 0 && errno != EEXIST)
+ TEST_ERROR;
+
+ h5_fixname(EXT_ENV_FNAME[0], fapl, filename, sizeof(filename));
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Reset the raw data files */
+ if(reset_raw_data_files(1) < 0)
+ TEST_ERROR
+
+ /* Create the dataset */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath)))
+ TEST_ERROR
+ for(i = 0; i < N_EXT_FILES; i++) {
+ HDsnprintf(filename, sizeof(filename), "..%sextern_env_%dr.raw", H5_DIR_SEPS, (int) i + 1);
+ if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ cur_size = TOTAL_SIZE;
+ if((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
+ FAIL_STACK_ERROR
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set prefix to a nonexistent directory, will be overwritten by environment variable */
+ if(H5Pset_efile_prefix(dapl, "someprefix") < 0)
+ FAIL_STACK_ERROR
+ if(H5Pget_efile_prefix(dapl, buffer, sizeof(buffer)) < 0)
+ FAIL_STACK_ERROR
+ if(HDstrcmp(buffer, "someprefix") != 0)
+ FAIL_PUTS_ERROR("efile prefix not set correctly");
+
+ /* Create dataset */
+ if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, dapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Read the entire dataset and compare with the original */
+ HDmemset(whole, 0, sizeof(whole));
+ if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
+ FAIL_STACK_ERROR
+ for(i = 0; i < TOTAL_SIZE; i++)
+ if(whole[i] != (signed)i)
+ FAIL_PUTS_ERROR("Incorrect value(s) read.");
+
+ if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(dapl) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dapl);
+ H5Dclose(dset);
+ H5Pclose(dcpl);
+ H5Sclose(space);
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return 1;
+} /* end test_path_env() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Runs external dataset tests.
+ *
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 3, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ hid_t fapl_id_old = -1; /* file access properties (old format) */
+ hid_t fapl_id_new = -1; /* file access properties (new format) */
+ hid_t fid = -1; /* file for test_1* functions */
+ hid_t gid = -1; /* group to emit diagnostics */
+ unsigned latest_format; /* default or latest file format */
+ int nerrors = 0; /* number of errors */
+
+ h5_reset();
+
+ /* Get a fapl for the old (default) file format */
+ fapl_id_old = h5_fileaccess();
+
+ /* Copy and set up a fapl for the latest file format */
+ if((fapl_id_new = H5Pcopy(fapl_id_old)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_libver_bounds(fapl_id_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test with old & new format groups */
+ for(latest_format = FALSE; latest_format <= TRUE; latest_format++) {
+ hid_t current_fapl_id = -1;
+
+ /* Set the fapl for different file formats */
+ if(latest_format) {
+ HDputs("\nTesting with the latest file format:");
+ current_fapl_id = fapl_id_new;
+ } /* end if */
+ else {
+ HDputs("Testing with the default file format:");
+ current_fapl_id = fapl_id_old;
+ } /* end else */
+
+ nerrors += test_path_env(current_fapl_id);
+ } /* end for */
+
+ if(nerrors > 0) goto error;
+
+ /* Close the new ff fapl. h5_cleanup will take care of the old ff fapl */
+ if(H5Pclose(fapl_id_new) < 0) FAIL_STACK_ERROR
+
+ HDputs("All external storage tests passed.");
+
+ /* Clean up files used by file set tests */
+ if(h5_cleanup(EXT_FNAME, fapl_id_old)) {
+ HDremove("extern_env_1r.raw");
+ HDremove("extern_env_2r.raw");
+ HDremove("extern_env_3r.raw");
+ HDremove("extern_env_4r.raw");
+
+ HDremove("extern_env_1w.raw");
+ HDremove("extern_env_2w.raw");
+ HDremove("extern_env_3w.raw");
+ HDremove("extern_env_4w.raw");
+
+ HDrmdir("extern_env_dir");
+ } /* end if */
+
+ return EXIT_SUCCESS;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(fid);
+ H5Pclose(fapl_id_old);
+ H5Pclose(fapl_id_new);
+ H5Gclose(gid);
+ } H5E_END_TRY;
+ nerrors = MAX(1, nerrors);
+ printf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s");
+ return EXIT_FAILURE;
+} /* end main() */
+
diff --git a/test/gen_plist.c b/test/gen_plist.c
index 68da6cc..8f38b1a 100644
--- a/test/gen_plist.c
+++ b/test/gen_plist.c
@@ -466,13 +466,13 @@ encode_plist(hid_t plist_id, int little_endian, int word_length, const char *fil
HDassert(ret > 0);
/* first call to encode returns only the size of the buffer needed */
- if((ret = H5Pencode(plist_id, NULL, &temp_size)) < 0)
+ if((ret = H5Pencode2(plist_id, NULL, &temp_size, H5P_DEFAULT)) < 0)
HDassert(ret > 0);
temp_buf = (void *)HDmalloc(temp_size);
HDassert(temp_buf);
- if((ret = H5Pencode(plist_id, temp_buf, &temp_size)) < 0)
+ if((ret = H5Pencode2(plist_id, temp_buf, &temp_size, H5P_DEFAULT)) < 0)
HDassert(ret > 0);
fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW);
diff --git a/test/h5test.c b/test/h5test.c
index 0ba28f3..8634a4d 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -44,12 +44,6 @@
* is interpreted according to the driver. See
* 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.
*
@@ -106,6 +100,17 @@ static const char *multi_letters = "msbrglo";
/* The # of seconds to wait for the message file--used by h5_wait_message() */
#define MESSAGE_TIMEOUT 300 /* Timeout in seconds */
+/* The strings that correspond to library version bounds H5F_libver_t in H5Fpublic.h */
+/* This is used by h5_get_version_string() */
+const char *LIBVER_NAMES[] = {
+ "earliest", /* H5F_LIBVER_EARLIEST = 0 */
+ "v18", /* H5F_LIBVER_V18 = 1 */
+ "v110", /* H5F_LIBVER_V110 = 2 */
+ "latest", /* H5F_LIBVER_V112 = 3 */
+ NULL
+};
+
+
/* Previous error reporting function */
static H5E_auto2_t err_func = NULL;
@@ -785,10 +790,6 @@ h5_fileaccess(void)
if(h5_get_vfd_fapl(fapl_id) < 0)
goto error;
- /* Next, try to set up a VOL connector */
- if(h5_get_vol_fapl(fapl_id) < 0)
- goto error;
-
/* Finally, check for libver bounds */
if(h5_get_libver_fapl(fapl_id) < 0)
goto error;
@@ -829,10 +830,6 @@ h5_fileaccess_flags(unsigned flags)
if((flags & H5_FILEACCESS_VFD) && h5_get_vfd_fapl(fapl_id) < 0)
goto error;
- /* Next, try to set up a VOL connector */
- if((flags & H5_FILEACCESS_VOL) && h5_get_vol_fapl(fapl_id) < 0)
- goto error;
-
/* Finally, check for libver bounds */
if((flags & H5_FILEACCESS_LIBVER) && h5_get_libver_fapl(fapl_id) < 0)
goto error;
@@ -1046,110 +1043,6 @@ error:
/*-------------------------------------------------------------------------
- * 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: 0
- * Failure: -1
- *
- * Programmer: Jordan Henderson
- * November 2018
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-h5_get_vol_fapl(hid_t fapl)
-{
- const char *env = NULL;
- const char *tok = NULL;
- char *lasts = NULL; /* Context pointer for strtok_r() call */
- 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_r(buf, " \t\n\r", &lasts)))
- 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_r(NULL, " \t\n\r", &lasts)))
- 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.
@@ -2058,3 +1951,17 @@ error:
return NULL;
} /* h5_get_dummy_vol_class */
+/*-------------------------------------------------------------------------
+ * Function: h5_get_version_string
+ *
+ * Purpose: Get the string that corresponds to the libvery version bound.
+ *
+ * Return: The string
+ *
+ *-------------------------------------------------------------------------
+ */
+char *
+h5_get_version_string(H5F_libver_t libver)
+{
+ return(LIBVER_NAMES[libver]);
+} /* end of h5_get_version_string */
diff --git a/test/h5test.h b/test/h5test.h
index 66a7863..ada52ad 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -123,8 +123,7 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
/* Flags for h5_fileaccess_flags() */
#define H5_FILEACCESS_VFD 0x01
-#define H5_FILEACCESS_VOL 0x02
-#define H5_FILEACCESS_LIBVER 0x04
+#define H5_FILEACCESS_LIBVER 0x02
#ifdef __cplusplus
extern "C" {
@@ -149,10 +148,10 @@ H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_co
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);
+H5TEST_DLL char *h5_get_version_string(H5F_libver_t libver);
/* 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 */
diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c
index b62b370..b78e859 100644
--- a/test/null_vol_connector.c
+++ b/test/null_vol_connector.c
@@ -27,16 +27,21 @@ static const H5VL_class_t null_vol_g = {
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 */
+ { /* info_cls */
+ (size_t)0, /* size */
+ NULL, /* copy */
+ NULL, /* compare */
+ NULL, /* free */
+ NULL, /* to_str */
+ NULL, /* from_str */
+ },
+ { /* wrap_cls */
+ NULL, /* get_object */
+ NULL, /* get_wrap_ctx */
+ NULL, /* wrap_object */
+ NULL, /* unwrap_object */
+ NULL, /* free_wrap_ctx */
+ },
{ /* attribute_cls */
NULL, /* create */
NULL, /* open */
diff --git a/test/objcopy.c b/test/objcopy.c
index 4055781..df1c0e4 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -2197,8 +2197,8 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src)
/* Loop through all the combinations of low/high library format bounds,
skipping invalid combinations. Create a destination file and copy the
source dataset to it, then verify */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Set version bounds */
H5E_BEGIN_TRY {
@@ -7869,7 +7869,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open)
addr_reset();
/* Setup */
- if((src_fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR
+ if((src_fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR
/* open source file (read-only) */
if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
diff --git a/test/ohdr.c b/test/ohdr.c
index 85554a5..9fc5791 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -1627,45 +1627,6 @@ error:
return FAIL;
} /* test_minimized_dset_ohdr_fillvalue_backwards_compatability */
-#define STR_EARLIEST "earliest"
-#define STR_V18 "v18"
-#define STR_LATEST "latest"
-static char *
-version_string(H5F_libver_t libver)
-{
- char *str = NULL;
-
- str = (char *) HDmalloc(20);
- if (str == NULL) {
- HDfprintf(stderr, "Allocation failed\n");
- HDexit(1);
- }
-
- switch(libver) {
- case H5F_LIBVER_EARLIEST:
- HDstrcpy(str, STR_EARLIEST);
- break;
-
- case H5F_LIBVER_V18:
- HDstrcpy(str, STR_V18);
- break;
-
- case H5F_LIBVER_V110:
- HDassert(H5F_LIBVER_LATEST == H5F_LIBVER_V110);
- HDstrcpy(str, STR_LATEST);
- break;
-
- case H5F_LIBVER_ERROR:
- case H5F_LIBVER_NBOUNDS:
- default:
- HDsprintf(str, "%ld", (long)libver);
- break;
- } /* end switch */
-
- /* Return the formed version bound string */
- return str;
-} /* end version_string() */
-
/*-------------------------------------------------------------------------
* Function: main
@@ -1693,7 +1654,6 @@ main(void)
H5O_loc_t oh_loc; /* Object header locations */
H5F_libver_t low, high; /* File format bounds */
time_t time_new, ro;
- char msg[80]; /* Message for file format version */
int i; /* Local index variable */
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
herr_t ret; /* Generic return value */
@@ -1716,10 +1676,11 @@ main(void)
api_ctx_pushed = TRUE;
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- char *low_string = NULL;
- char *high_string = NULL;
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ char *low_string = NULL; /* Message for library version low bound */
+ char *high_string = NULL; /* Message for library version high bound */
+ char msg[80]; /* Message for file format version */
/* Set version bounds before opening the file */
H5E_BEGIN_TRY {
@@ -1730,13 +1691,11 @@ main(void)
continue;
/* Display info about testing */
- low_string = version_string(low);
- high_string = version_string(high);
+ low_string = h5_get_version_string(low);
+ high_string = h5_get_version_string(high);
sprintf(msg, "Using file format version: (%s, %s)", low_string,
high_string);
HDputs(msg);
- HDfree(high_string);
- HDfree(low_string);
/* test on object continuation block */
if(test_cont(filename, fapl) < 0)
diff --git a/test/set_extent.c b/test/set_extent.c
index 5d11819..f6b02cf 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -433,8 +433,8 @@ static int do_layouts( hid_t fapl )
TESTING("storage layout use - tested with all low/high library format bounds");
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Copy plist to use locally to avoid modifying the original */
new_fapl = H5Pcopy(fapl);
diff --git a/test/tattr.c b/test/tattr.c
index 454ea71..37763da 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -2626,6 +2626,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
H5O_info_t oinfo; /* Object info */
unsigned u; /* Local index variable */
int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
+ unsigned use_corder; /* Track creation order or not */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -2641,7 +2642,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Pset_file_space_strategy");
}
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl);
- CHECK(fid, FAIL, "H5Fcreate");
+ CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
if (use_min_dset_oh)
CHECK(H5Pclose(fcpl), FAIL, "H5Pclose");
@@ -2656,76 +2657,92 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
- CHECK(fid, FAIL, "H5Fopen");
+ CHECK(fid, H5I_INVALID_HID, "H5Fopen");
/* Create dataspace for dataset */
sid = H5Screate(H5S_SCALAR);
- CHECK(sid, FAIL, "H5Screate");
+ CHECK(sid, H5I_INVALID_HID, "H5Screate");
/* need DCPL to query the group creation properties */
if (use_min_dset_oh) {
dcpl = H5Pcopy(dcpl_g);
- CHECK(dcpl, FAIL, "H5Pcopy");
+ CHECK(dcpl, H5I_INVALID_HID, "H5Pcopy");
} else {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- CHECK(dcpl, FAIL, "H5Pcreate");
+ CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate");
}
- /* Create a dataset */
- dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- CHECK(dataset, FAIL, "H5Dcreate2");
-
/* Retrieve limits for compact/dense attribute storage */
ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense);
CHECK(ret, FAIL, "H5Pget_attr_phase_change");
- /* Close property list */
- ret = H5Pclose(dcpl);
- CHECK(ret, FAIL, "H5Pclose");
+ /* Using creation order or not */
+ for(use_corder = FALSE; use_corder <= TRUE; use_corder++) {
- /* Check on dataset's attribute storage status */
- is_dense = H5O__is_attr_dense_test(dataset);
- VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
+ if(use_corder) {
+ ret = H5Pset_attr_creation_order(dcpl, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);
+ CHECK(ret, FAIL, "H5Pset_attr_creation_order");
+ }
- /* Add attributes, until well into dense storage */
- for(u = 0; u < (max_compact * 2); u++) {
- /* Create attribute */
- sprintf(attrname, "attr %02u", u);
- attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(attr, FAIL, "H5Acreate2");
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
- /* Write data into the attribute */
- ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
- CHECK(ret, FAIL, "H5Awrite");
+ /* Check on dataset's attribute storage status */
+ is_dense = H5O__is_attr_dense_test(dataset);
+ VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
- /* Close attribute */
- ret = H5Aclose(attr);
- CHECK(ret, FAIL, "H5Aclose");
+ /* Add attributes, until well into dense storage */
+ for(u = 0; u < (max_compact * 2); u++) {
+ /* Create attribute */
+ sprintf(attrname, "attr %02u", u);
+ attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
- /* Rename attribute */
- sprintf(new_attrname, "new attr %02u", u);
+ /* Write data into the attribute */
+ ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
+ CHECK(ret, FAIL, "H5Awrite");
- /* Rename attribute */
- ret = H5Arename_by_name(fid, DSET1_NAME, attrname, new_attrname, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Arename_by_name");
+ /* Close attribute */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
- /* Check # of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info");
- } /* end for */
+ /* Rename attribute */
+ sprintf(new_attrname, "new attr %02u", u);
- /* Check on dataset's attribute storage status */
- is_dense = H5O__is_attr_dense_test(dataset);
- VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
+ /* Rename attribute */
+ ret = H5Arename_by_name(fid, DSET1_NAME, attrname, new_attrname, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Arename_by_name");
+
+ /* Check # of attributes */
+ ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info");
+ VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info");
+ } /* 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");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ if(!use_corder) {
+ /* Unlink dataset with attributes */
+ ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+ }
+
+ } /* end for use_corder */
/* Close dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
- /* Close Dataset */
- ret = H5Dclose(dataset);
- CHECK(ret, FAIL, "H5Dclose");
+ /* Close property list */
+ ret = H5Pclose(dcpl);
+ CHECK(ret, FAIL, "H5Pclose");
/* Close file */
ret = H5Fclose(fid);
@@ -2734,11 +2751,11 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
- CHECK(fid, FAIL, "H5Fopen");
+ CHECK(fid, H5I_INVALID_HID, "H5Fopen");
/* Open dataset */
dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT);
- CHECK(dataset, FAIL, "H5Dopen2");
+ CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
/* Verify renamed attributes */
for(u = 0; u < (max_compact * 2); u++) {
@@ -2747,7 +2764,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
/* Open attribute */
sprintf(attrname, "new attr %02u", u);
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
- CHECK(attr, FAIL, "H5Aopen");
+ CHECK(attr, H5I_INVALID_HID, "H5Aopen");
/* Read data from the attribute */
ret = H5Aread(attr, H5T_NATIVE_UINT, &value);
diff --git a/test/testerror.sh.in b/test/testerror.sh.in
index 734b051..ac2a109 100644
--- a/test/testerror.sh.in
+++ b/test/testerror.sh.in
@@ -22,7 +22,9 @@ CMP='cmp -s'
DIFF='diff -c'
# Skip plugin module to test missing filter
-ENVCMD="env HDF5_PLUGIN_PRELOAD=::"
+# Also reset the VOL connector to only use the native connector, because of the
+# error stack checking. QAK - 2019/03/09
+ENVCMD="env HDF5_PLUGIN_PRELOAD=:: HDF5_VOL_CONNECTOR=native"
nerrors=0
verbose=yes
diff --git a/test/testexternal_env.sh.in b/test/testexternal_env.sh.in
new file mode 100644
index 0000000..3cc140d
--- /dev/null
+++ b/test/testexternal_env.sh.in
@@ -0,0 +1,42 @@
+#! /bin/sh
+#
+# 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.
+#
+# Test for external file with environment variable: HDF5_EXTFILE_PREFIX
+
+srcdir=@srcdir@
+
+nerrors=0
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+# test for external file with HDF5_EXTFILE_PREFIX
+echo "Testing external file with HDF5_EXTFILE_PREFIX"
+TEST_NAME=external_env # The test name
+TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary
+ENVCMD="env HDF5_EXTFILE_PREFIX=\${ORIGIN}" # The environment variable & value
+#
+# Run the test
+# echo "$ENVCMD $RUNSERIAL $TEST_BIN"
+$ENVCMD $RUNSERIAL $TEST_BIN
+exitcode=$?
+if [ $exitcode -eq 0 ]; then
+ echo "Test prefix for HDF5_EXTFILE_PREFIX PASSED"
+ else
+ nerrors="`expr $nerrors + 1`"
+ echo "***Error encountered for HDF5_EXTFILE_PREFIX test***"
+fi
+exit $nerrors
diff --git a/test/testvds_env.sh.in b/test/testvds_env.sh.in
new file mode 100644
index 0000000..894e52e
--- /dev/null
+++ b/test/testvds_env.sh.in
@@ -0,0 +1,44 @@
+#! /bin/sh
+#
+# 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.
+#
+# Test for external file with environment variable: HDF5_VDS_PREFIX
+
+srcdir=@srcdir@
+
+nerrors=0
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+# test for VDS with HDF5_VDS_PREFIX
+echo "Testing basic virtual dataset I/O via H5Pset_vds_prefix(): all selection with ENV prefix"
+TEST_NAME=vds_env # The test name
+TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary
+ENVCMD="env HDF5_VDS_PREFIX=\${ORIGIN}/tmp" # Set the environment variable & value
+UNENVCMD="unset HDF5_VDS_PREFIX" # Unset the environment variable & value
+#
+# Run the test
+# echo "$ENVCMD $RUNSERIAL $TEST_BIN"
+$ENVCMD $RUNSERIAL $TEST_BIN
+exitcode=$?
+if [ $exitcode -eq 0 ]; then
+ echo "Test prefix for HDF5_VDS_PREFIX PASSED"
+ else
+ nerrors="`expr $nerrors + 1`"
+ echo "***Error encountered for HDF5_VDS_PREFIX test***"
+fi
+$UNENVCMD
+exit $nerrors
diff --git a/test/tfile.c b/test/tfile.c
index c5e913c..acf2bd6 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -1921,6 +1921,7 @@ test_file_open_overlap(void)
hid_t sid;
ssize_t nobjs; /* # of open objects */
unsigned intent;
+ unsigned long fileno1, fileno2; /* File number */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1939,6 +1940,19 @@ test_file_open_overlap(void)
CHECK(ret, FAIL, "H5Fget_intent");
VERIFY(intent, H5F_ACC_RDWR, "H5Fget_intent");
+ /* Check the file numbers */
+ fileno1 = 0;
+ ret = H5Fget_fileno(fid1, &fileno1);
+ CHECK(ret, FAIL, "H5Fget_fileno");
+ fileno2 = 0;
+ ret = H5Fget_fileno(fid2, &fileno2);
+ CHECK(ret, FAIL, "H5Fget_fileno");
+ VERIFY(fileno1, fileno2, "H5Fget_fileno");
+
+ /* Check that a file number pointer of NULL is ignored */
+ ret = H5Fget_fileno(fid1, NULL);
+ CHECK(ret, FAIL, "H5Fget_fileno");
+
/* Create a group in file */
gid = H5Gcreate2(fid1, GROUP1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(gid, FAIL, "H5Gcreate2");
@@ -2652,6 +2666,7 @@ test_userblock_file_size(void)
hid_t fcpl2_id;
hsize_t dims[2] = {3, 4};
hsize_t filesize1, filesize2, filesize;
+ unsigned long fileno1, fileno2; /* File number */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -2669,6 +2684,15 @@ test_userblock_file_size(void)
file2_id = H5Fcreate(FILE2, H5F_ACC_TRUNC, fcpl2_id, H5P_DEFAULT);
CHECK(file2_id, FAIL, "H5Fcreate");
+ /* Check the file numbers */
+ fileno1 = 0;
+ ret = H5Fget_fileno(file1_id, &fileno1);
+ CHECK(ret, FAIL, "H5Fget_fileno");
+ fileno2 = 0;
+ ret = H5Fget_fileno(file2_id, &fileno2);
+ CHECK(ret, FAIL, "H5Fget_fileno");
+ CHECK(fileno1, fileno2, "H5Fget_fileno");
+
/* Create groups */
group1_id = H5Gcreate2(file1_id, GROUP1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group1_id, FAIL, "H5Gcreate2");
@@ -5148,7 +5172,7 @@ test_libver_bounds_open(void)
/* Opening VERBFNAME in these combination should succeed.
For each low bound, verify that it is upgraded properly */
high = H5F_LIBVER_LATEST;
- for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++)
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low))
{
H5F_libver_t new_low = H5F_LIBVER_EARLIEST;
@@ -5167,7 +5191,7 @@ test_libver_bounds_open(void)
/* Get new low bound and verify that it has been upgraded properly */
ret = H5Pget_libver_bounds(new_fapl, &new_low, NULL);
CHECK(ret, FAIL, "H5Pget_libver_bounds");
- VERIFY(new_low, H5F_LIBVER_LATEST, "Low bound should be upgraded to H5F_LIBVER_LATEST");
+ VERIFY(new_low >= H5F_LIBVER_V110, TRUE, "Low bound should be upgraded to at least H5F_LIBVER_V110");
ret = H5Pclose(new_fapl);
CHECK(ret, FAIL, "H5Pclose");
@@ -5241,8 +5265,8 @@ test_libver_bounds_low_high(void)
CHECK(fapl, FAIL, "H5Pcreate");
/* Loop through all the combinations of low/high version bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++)
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low))
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
H5E_BEGIN_TRY {
/* Set the low/high version bounds */
@@ -5445,7 +5469,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr)
} H5E_END_TRY;
/* Get the internal file pointer if the create succeeds */
- if((ok = fid >= 0)) {
+ if(fid >= 0) {
f = (H5F_t *)H5VL_object(fid);
CHECK(f, NULL, "H5VL_object");
}
@@ -5456,34 +5480,35 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr)
if(is_swmr) { /* SWMR is enabled */
- if(high == H5F_LIBVER_LATEST) { /* Should succeed */
- VERIFY(ok, TRUE, "H5Fcreate");
+ if(high >= H5F_LIBVER_V110) { /* Should succeed */
+ VERIFY(fid >= 0, TRUE, "H5Fcreate");
VERIFY(HDF5_SUPERBLOCK_VERSION_3, f->shared->sblock->super_vers, "HDF5_superblock_ver_bounds");
- VERIFY(H5F_LIBVER_V110, f->shared->low_bound, "HDF5_superblock_ver_bounds");
+ VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, TRUE, "HDF5_superblock_ver_bounds");
} else /* Should fail */
- VERIFY(ok, FALSE, "H5Fcreate");
+ VERIFY(fid >= 0, FALSE, "H5Fcreate");
}
else { /* Should succeed */
- VERIFY(ok, TRUE, "H5Fcreate");
+ VERIFY(fid >= 0, TRUE, "H5Fcreate");
VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds");
switch(low) {
case H5F_LIBVER_EARLIEST:
- ok = (f->shared->sblock->super_vers == 0 ||
- f->shared->sblock->super_vers == 1 ||
- f->shared->sblock->super_vers == 2);
+ ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_DEF ||
+ f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_1 ||
+ f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2);
VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
break;
case H5F_LIBVER_V18:
- ok = (f->shared->sblock->super_vers == 2);
+ ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2);
VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
break;
case H5F_LIBVER_V110:
- ok = (f->shared->sblock->super_vers == 3);
+ case H5F_LIBVER_V112:
+ ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_3);
VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
break;
@@ -5495,7 +5520,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr)
} /* end switch */
}
- if(ok) { /* Close the file */
+ if(fid >= 0) { /* Close the file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
}
@@ -5587,7 +5612,6 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
hid_t new_fapl = -1; /* File access property list */
unsigned super_vers; /* Superblock version */
H5F_libver_t low, high; /* Low and high bounds */
- hbool_t ok; /* The result is ok or not */
herr_t ret; /* Return value */
/* Create the file with the input fcpl and fapl */
@@ -5610,8 +5634,8 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
CHECK(new_fapl, FAIL, "H5Pcreate");
/* Loop through all the combinations of low/high bounds in new_fapl */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
@@ -5626,7 +5650,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
} H5E_END_TRY;
/* Get the internal file pointer if the open succeeds */
- if((ok = fid >= 0)) {
+ if(fid >= 0) {
f = (H5F_t *)H5VL_object(fid);
CHECK(f, NULL, "H5VL_object");
}
@@ -5634,26 +5658,24 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
/* Verify the file open succeeds or fails */
switch(super_vers) {
case 3:
- if(high == H5F_LIBVER_LATEST) {
+ if(high >= H5F_LIBVER_V110) {
/* Should succeed */
- VERIFY(ok, TRUE, "H5Fopen");
- VERIFY(H5F_LIBVER_V110, f->shared->low_bound, "HDF5_superblock_ver_bounds");
+ VERIFY(fid >= 0, TRUE, "H5Fopen");
+ VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, TRUE, "HDF5_superblock_ver_bounds");
/* Close the file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
} else /* Should fail */
- VERIFY(ok, FALSE, "H5Fopen");
+ VERIFY(fid >= 0, FALSE, "H5Fopen");
break;
case 2:
if(is_swmr) /* Should fail */
- VERIFY(ok, FALSE, "H5Fopen");
+ VERIFY(fid >= 0, FALSE, "H5Fopen");
else { /* Should succeed */
- VERIFY(ok, TRUE, "H5Fopen");
-
- ok = f->shared->low_bound >= H5F_LIBVER_V18;
- VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
+ VERIFY(fid >= 0, TRUE, "H5Fopen");
+ VERIFY(f->shared->low_bound >= H5F_LIBVER_V18, TRUE, "HDF5_superblock_ver_bounds");
/* Close the file */
ret = H5Fclose(fid);
@@ -5664,10 +5686,10 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
case 1:
case 0:
if(is_swmr) /* Should fail */
- VERIFY(ok, FALSE, "H5Fopen");
+ VERIFY(fid >= 0, FALSE, "H5Fopen");
else { /* Should succeed */
- VERIFY(ok, TRUE, "H5Fopen");
- VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds");
+ VERIFY(fid >= 0, TRUE, "H5Fopen");
+ VERIFY(f->shared->low_bound, low, "HDF5_superblock_ver_bounds");
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
@@ -5782,8 +5804,8 @@ test_libver_bounds_obj(hid_t fapl)
/* Loop through all the combinations of low/high bounds in new_fapl */
/* Open the file with the fapl; create a group and verify the
object header version, then delete the group and close the file.*/
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
@@ -5993,8 +6015,8 @@ test_libver_bounds_dataset(hid_t fapl)
/* Loop through all the combinations of low/high bounds in new_fapl */
/* Open the file with the fapl and create the chunked dataset */
/* Verify the dataset's layout, fill value and filter pipleline message versions */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
@@ -6206,8 +6228,8 @@ test_libver_bounds_dataspace(hid_t fapl)
/* Loop through all the combinations of low/high bounds in new_fapl */
/* Open the file and create the chunked/compact/contiguous datasets */
/* Verify the dataspace message version for the three datasets */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
hid_t tmp_sid, tmp_sid_compact, tmp_sid_contig; /* Dataspace IDs */
H5S_t *tmp_space, *tmp_space_compact, *tmp_space_contig; /* Internal dataspace pointers */
@@ -6531,8 +6553,8 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
/* Open the file and create the chunked dataset with the input tid */
/* Verify the dataset's datatype message version */
/* Also verify the committed atatype message version */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
@@ -6852,8 +6874,8 @@ test_libver_bounds_attributes(hid_t fapl)
/* Loop through all the combinations of low/high bounds */
/* Open the file and group and attach an attribute to the group */
/* Verify the attribute version */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
diff --git a/test/th5o.c b/test/th5o.c
index 63fee5f..0aa589f 100644
--- a/test/th5o.c
+++ b/test/th5o.c
@@ -806,8 +806,8 @@ test_h5o_link(void)
CHECK(fapl_id, FAIL, "H5Pcreate");
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
/* Set version bounds */
H5E_BEGIN_TRY {
diff --git a/test/th5s.c b/test/th5s.c
index 14f5de9..6632a4c 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -90,7 +90,21 @@ struct space4_struct {
unsigned u;
float f;
char c2;
- } space4_data={'v',987123,-3.14F,'g'}; /* Test data for 4th dataspace */
+} space4_data={'v',987123,-3.14F,'g'}; /* Test data for 4th dataspace */
+
+/*
+ * Testing configuration defines used by:
+ * test_h5s_encode_regular_hyper()
+ * test_h5s_encode_irregular_hyper()
+ * test_h5s_encode_points()
+ */
+#define CONFIG_8 1
+#define CONFIG_16 2
+#define CONFIG_32 3
+#define POWER8 256 /* 2^8 */
+#define POWER16 65536 /* 2^16 */
+#define POWER32 4294967296 /* 2^32 */
+
/****************************************************************
**
@@ -1163,27 +1177,30 @@ test_h5s_zero_dim(void)
**
** test_h5s_encode(): Test H5S (dataspace) encoding and decoding.
**
+** Note: See "RFC: H5Sencode/H5Sdecode Format Change".
+**
****************************************************************/
static void
-test_h5s_encode(void)
+test_h5s_encode(H5F_libver_t low, H5F_libver_t high)
{
- hid_t sid1, sid2, sid3; /* Dataspace ID */
- hid_t decoded_sid1, decoded_sid2, decoded_sid3;
- int rank; /* Logical rank of dataspace */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- size_t sbuf_size=0, null_size=0, scalar_size=0;
- unsigned char *sbuf=NULL, *null_sbuf=NULL, *scalar_buf=NULL;
- hsize_t tdims[4]; /* Dimension array to test with */
- hssize_t n; /* Number of dataspace elements */
- hsize_t start[] = {0, 0, 0};
- hsize_t stride[] = {2, 5, 3};
- hsize_t count[] = {2, 2, 2};
- hsize_t block[] = {1, 3, 1};
- H5S_sel_type sel_type;
- H5S_class_t space_type;
- hssize_t nblocks;
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t sid1, sid2, sid3; /* Dataspace ID */
+ hid_t decoded_sid1, decoded_sid2, decoded_sid3;
+ int rank; /* Logical rank of dataspace */
+ hid_t fapl = -1; /* File access property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ size_t sbuf_size=0, null_size=0, scalar_size=0;
+ unsigned char *sbuf=NULL, *null_sbuf=NULL, *scalar_buf=NULL;
+ hsize_t tdims[4]; /* Dimension array to test with */
+ hssize_t n; /* Number of dataspace elements */
+ hsize_t start[] = {0, 0, 0};
+ hsize_t stride[] = {2, 5, 3};
+ hsize_t count[] = {2, 2, 2};
+ hsize_t block[] = {1, 3, 1};
+ H5S_sel_type sel_type;
+ H5S_class_t space_type;
+ hssize_t nblocks;
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataspace Encoding and Decoding\n"));
@@ -1192,26 +1209,40 @@ test_h5s_encode(void)
* Test encoding and decoding of simple dataspace and hyperslab selection.
*-------------------------------------------------------------------------
*/
+
+ /* Create the file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set low/high bounds in the fapl */
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create the dataspace */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
+ /* Set the hyperslab selection */
ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- /* Encode simple data space in a buffer */
- ret = H5Sencode(sid1, NULL, &sbuf_size);
- CHECK(ret, FAIL, "H5Sencode");
+ /* Encode simple data space in a buffer with the fapl setting */
+ ret = H5Sencode2(sid1, NULL, &sbuf_size, fapl);
+ CHECK(ret, FAIL, "H5Sencode2");
- if(sbuf_size>0)
+ if(sbuf_size>0) {
sbuf = (unsigned char*)HDcalloc((size_t)1, sbuf_size);
+ CHECK(sbuf, NULL, "HDcalloc");
+ }
/* Try decoding bogus buffer */
H5E_BEGIN_TRY {
- ret_id = H5Sdecode(sbuf);
+ ret_id = H5Sdecode(sbuf);
} H5E_END_TRY;
VERIFY(ret_id, FAIL, "H5Sdecode");
- ret = H5Sencode(sid1, sbuf, &sbuf_size);
+ /* Encode the simple data space in a buffer with the fapl setting */
+ ret = H5Sencode2(sid1, sbuf, &sbuf_size, fapl);
CHECK(ret, FAIL, "H5Sencode");
/* Decode from the dataspace buffer and return an object handle */
@@ -1224,22 +1255,26 @@ test_h5s_encode(void)
VERIFY(n, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3,
"H5Sget_simple_extent_npoints");
+ /* Retrieve and verify the dataspace rank */
rank = H5Sget_simple_extent_ndims(decoded_sid1);
CHECK(rank, FAIL, "H5Sget_simple_extent_ndims");
VERIFY(rank, SPACE1_RANK, "H5Sget_simple_extent_ndims");
+ /* Retrieve and verify the dataspace dimensions */
rank = H5Sget_simple_extent_dims(decoded_sid1, tdims, NULL);
CHECK(rank, FAIL, "H5Sget_simple_extent_dims");
VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0,
"H5Sget_simple_extent_dims");
- /* Verify hyperslabe selection */
+ /* Verify the type of dataspace selection */
sel_type = H5Sget_select_type(decoded_sid1);
VERIFY(sel_type, H5S_SEL_HYPERSLABS, "H5Sget_select_type");
+ /* Verify the number of hyperslab blocks */
nblocks = H5Sget_select_hyper_nblocks(decoded_sid1);
VERIFY(nblocks, 2*2*2, "H5Sget_select_hyper_nblocks");
+ /* Close the dataspaces */
ret = H5Sclose(sid1);
CHECK(ret, FAIL, "H5Sclose");
@@ -1254,23 +1289,27 @@ test_h5s_encode(void)
CHECK(sid2, FAIL, "H5Screate");
/* Encode null data space in a buffer */
- ret = H5Sencode(sid2, NULL, &null_size);
+ ret = H5Sencode2(sid2, NULL, &null_size, fapl);
CHECK(ret, FAIL, "H5Sencode");
- if(null_size>0)
+ if(null_size>0) {
null_sbuf = (unsigned char*)HDcalloc((size_t)1, null_size);
+ CHECK(null_sbuf, NULL, "HDcalloc");
+ }
- ret = H5Sencode(sid2, null_sbuf, &null_size);
- CHECK(ret, FAIL, "H5Sencode");
+ /* Encode the null data space in the buffer */
+ ret = H5Sencode2(sid2, null_sbuf, &null_size, fapl);
+ CHECK(ret, FAIL, "H5Sencode2");
/* Decode from the dataspace buffer and return an object handle */
decoded_sid2=H5Sdecode(null_sbuf);
CHECK(decoded_sid2, FAIL, "H5Sdecode");
- /* Verify decoded dataspace */
+ /* Verify the decoded dataspace type */
space_type = H5Sget_simple_extent_type(decoded_sid2);
VERIFY(space_type, H5S_NULL, "H5Sget_simple_extent_type");
+ /* Close the dataspaces */
ret = H5Sclose(sid2);
CHECK(ret, FAIL, "H5Sclose");
@@ -1286,16 +1325,211 @@ test_h5s_encode(void)
CHECK(sid3, FAIL, "H5Screate_simple");
/* Encode scalar data space in a buffer */
- ret = H5Sencode(sid3, NULL, &scalar_size);
+ ret = H5Sencode2(sid3, NULL, &scalar_size, fapl);
CHECK(ret, FAIL, "H5Sencode");
- if(scalar_size>0)
+ if(scalar_size>0) {
scalar_buf = (unsigned char*)HDcalloc((size_t)1, scalar_size);
+ CHECK(scalar_buf, NULL, "HDcalloc");
+ }
+
+ /* Encode the scalar data space in the buffer */
+ ret = H5Sencode2(sid3, scalar_buf, &scalar_size, fapl);
+ CHECK(ret, FAIL, "H5Sencode2");
+
+ /* Decode from the dataspace buffer and return an object handle */
+ decoded_sid3=H5Sdecode(scalar_buf);
+ CHECK(decoded_sid3, FAIL, "H5Sdecode");
+
+ /* Verify extent type */
+ space_type = H5Sget_simple_extent_type(decoded_sid3);
+ VERIFY(space_type, H5S_SCALAR, "H5Sget_simple_extent_type");
+
+ /* Verify decoded dataspace */
+ n = H5Sget_simple_extent_npoints(decoded_sid3);
+ CHECK(n, FAIL, "H5Sget_simple_extent_npoints");
+ VERIFY(n, 1, "H5Sget_simple_extent_npoints");
+
+ /* Retrieve and verify the dataspace rank */
+ rank = H5Sget_simple_extent_ndims(decoded_sid3);
+ CHECK(rank, FAIL, "H5Sget_simple_extent_ndims");
+ VERIFY(rank, 0, "H5Sget_simple_extent_ndims");
+
+ /* Close the dataspaces */
+ ret = H5Sclose(sid3);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ ret = H5Sclose(decoded_sid3);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close the file access property list */
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Release resources */
+ if(sbuf)
+ HDfree(sbuf);
+ if(null_sbuf)
+ HDfree(null_sbuf);
+ if(scalar_buf)
+ HDfree(scalar_buf);
+} /* test_h5s_encode() */
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/****************************************************************
+**
+** test_h5s_encode(): Test H5S (dataspace) encoding and decoding.
+**
+****************************************************************/
+static void
+test_h5s_encode1(void)
+{
+ hid_t sid1, sid2, sid3; /* Dataspace ID */
+ hid_t decoded_sid1, decoded_sid2, decoded_sid3;
+ int rank; /* Logical rank of dataspace */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ size_t sbuf_size=0, null_size=0, scalar_size=0;
+ unsigned char *sbuf=NULL, *null_sbuf=NULL, *scalar_buf=NULL;
+ hsize_t tdims[4]; /* Dimension array to test with */
+ hssize_t n; /* Number of dataspace elements */
+ hsize_t start[] = {0, 0, 0};
+ hsize_t stride[] = {2, 5, 3};
+ hsize_t count[] = {2, 2, 2};
+ hsize_t block[] = {1, 3, 1};
+ H5S_sel_type sel_type;
+ H5S_class_t space_type;
+ hssize_t nblocks;
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Dataspace Encoding (H5Sencode1) and Decoding\n"));
+
+ /*-------------------------------------------------------------------------
+ * Test encoding and decoding of simple dataspace and hyperslab selection.
+ *-------------------------------------------------------------------------
+ */
+ /* Create the dataspace */
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ CHECK(sid1, FAIL, "H5Screate_simple");
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Encode simple data space in a buffer with the fapl setting */
+ ret = H5Sencode1(sid1, NULL, &sbuf_size);
+ CHECK(ret, FAIL, "H5Sencode2");
+
+ if(sbuf_size>0) {
+ sbuf = (unsigned char*)HDcalloc((size_t)1, sbuf_size);
+ CHECK(sbuf, NULL, "HDcalloc");
+ }
+
+ /* Try decoding bogus buffer */
+ H5E_BEGIN_TRY {
+ ret_id = H5Sdecode(sbuf);
+ } H5E_END_TRY;
+ VERIFY(ret_id, FAIL, "H5Sdecode");
- ret = H5Sencode(sid3, scalar_buf, &scalar_size);
+ /* Encode the simple data space in a buffer */
+ ret = H5Sencode1(sid1, sbuf, &sbuf_size);
CHECK(ret, FAIL, "H5Sencode");
/* Decode from the dataspace buffer and return an object handle */
+ decoded_sid1=H5Sdecode(sbuf);
+ CHECK(decoded_sid1, FAIL, "H5Sdecode");
+
+ /* Verify the decoded dataspace */
+ n = H5Sget_simple_extent_npoints(decoded_sid1);
+ CHECK(n, FAIL, "H5Sget_simple_extent_npoints");
+ VERIFY(n, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3,
+ "H5Sget_simple_extent_npoints");
+
+ /* Retrieve and verify the dataspace rank */
+ rank = H5Sget_simple_extent_ndims(decoded_sid1);
+ CHECK(rank, FAIL, "H5Sget_simple_extent_ndims");
+ VERIFY(rank, SPACE1_RANK, "H5Sget_simple_extent_ndims");
+
+ /* Retrieve and verify the dataspace dimensions */
+ rank = H5Sget_simple_extent_dims(decoded_sid1, tdims, NULL);
+ CHECK(rank, FAIL, "H5Sget_simple_extent_dims");
+ VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0,
+ "H5Sget_simple_extent_dims");
+
+ /* Verify the type of dataspace selection */
+ sel_type = H5Sget_select_type(decoded_sid1);
+ VERIFY(sel_type, H5S_SEL_HYPERSLABS, "H5Sget_select_type");
+
+ /* Verify the number of hyperslab blocks */
+ nblocks = H5Sget_select_hyper_nblocks(decoded_sid1);
+ VERIFY(nblocks, 2*2*2, "H5Sget_select_hyper_nblocks");
+
+ /* Close the dataspaces */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ ret = H5Sclose(decoded_sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /*-------------------------------------------------------------------------
+ * Test encoding and decoding of null dataspace.
+ *-------------------------------------------------------------------------
+ */
+ sid2 = H5Screate(H5S_NULL);
+ CHECK(sid2, FAIL, "H5Screate");
+
+ /* Encode null data space in a buffer */
+ ret = H5Sencode1(sid2, NULL, &null_size);
+ CHECK(ret, FAIL, "H5Sencode");
+
+ if(null_size>0) {
+ null_sbuf = (unsigned char*)HDcalloc((size_t)1, null_size);
+ CHECK(null_sbuf, NULL, "HDcalloc");
+ }
+
+ /* Encode the null data space in the buffer */
+ ret = H5Sencode1(sid2, null_sbuf, &null_size);
+ CHECK(ret, FAIL, "H5Sencode2");
+
+ /* Decode from the dataspace buffer and return an object handle */
+ decoded_sid2=H5Sdecode(null_sbuf);
+ CHECK(decoded_sid2, FAIL, "H5Sdecode");
+
+ /* Verify the decoded dataspace type */
+ space_type = H5Sget_simple_extent_type(decoded_sid2);
+ VERIFY(space_type, H5S_NULL, "H5Sget_simple_extent_type");
+
+ /* Close the dataspaces */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ ret = H5Sclose(decoded_sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /*-------------------------------------------------------------------------
+ * Test encoding and decoding of scalar dataspace.
+ *-------------------------------------------------------------------------
+ */
+ /* Create scalar dataspace */
+ sid3 = H5Screate(H5S_SCALAR);
+ CHECK(sid3, FAIL, "H5Screate_simple");
+
+ /* Encode scalar data space in a buffer */
+ ret = H5Sencode1(sid3, NULL, &scalar_size);
+ CHECK(ret, FAIL, "H5Sencode");
+
+ if(scalar_size>0) {
+ scalar_buf = (unsigned char*)HDcalloc((size_t)1, scalar_size);
+ CHECK(scalar_buf, NULL, "HDcalloc");
+ }
+
+ /* Encode the scalar data space in the buffer */
+ ret = H5Sencode1(sid3, scalar_buf, &scalar_size);
+ CHECK(ret, FAIL, "H5Sencode2");
+
+ /* Decode from the dataspace buffer and return an object handle */
decoded_sid3=H5Sdecode(scalar_buf);
CHECK(decoded_sid3, FAIL, "H5Sdecode");
@@ -1308,20 +1542,628 @@ test_h5s_encode(void)
CHECK(n, FAIL, "H5Sget_simple_extent_npoints");
VERIFY(n, 1, "H5Sget_simple_extent_npoints");
+ /* Retrieve and verify the dataspace rank */
rank = H5Sget_simple_extent_ndims(decoded_sid3);
CHECK(rank, FAIL, "H5Sget_simple_extent_ndims");
VERIFY(rank, 0, "H5Sget_simple_extent_ndims");
+ /* Close the dataspaces */
ret = H5Sclose(sid3);
CHECK(ret, FAIL, "H5Sclose");
ret = H5Sclose(decoded_sid3);
CHECK(ret, FAIL, "H5Sclose");
- HDfree(sbuf);
- HDfree(null_sbuf);
- HDfree(scalar_buf);
-} /* test_h5s_encode() */
+ /* Release resources */
+ if(sbuf)
+ HDfree(sbuf);
+ if(null_sbuf)
+ HDfree(null_sbuf);
+ if(scalar_buf)
+ HDfree(scalar_buf);
+} /* test_h5s_encode1() */
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+
+/****************************************************************
+**
+** test_h5s_check_encoding():
+** This is the helper routine to verify that H5Sencode2()
+** works as specified in the RFC for the library format setting
+** in the file access property list.
+** See "RFC: H5Sencode/H5Sdeocde Format Change".
+**
+** This routine is used by:
+** test_h5s_encode_regular_hyper()
+** test_h5s_encode_irregular_hyper()
+** test_h5s_encode_points()
+**
+****************************************************************/
+static herr_t
+test_h5s_check_encoding(hid_t in_fapl, hid_t in_sid,
+ uint32_t expected_version, uint8_t expected_enc_size, hbool_t expected_to_fail)
+{
+ char *buf = NULL; /* Pointer to the encoded buffer */
+ size_t buf_size; /* Size of the encoded buffer */
+ hid_t d_sid = -1; /* The decoded dataspace ID */
+ htri_t check;
+ hsize_t in_low_bounds[1]; /* The low bounds for the selection for in_sid */
+ hsize_t in_high_bounds[1]; /* The high bounds for the selection for in_sid */
+ hsize_t d_low_bounds[1]; /* The low bounds for the selection for d_sid */
+ hsize_t d_high_bounds[1]; /* The high bounds for the selection for d_sid */
+ herr_t ret; /* Return value */
+
+ /* Get buffer size for encoding with the format setting in in_fapl */
+ H5E_BEGIN_TRY {
+ ret = H5Sencode2(in_sid, NULL, &buf_size, in_fapl);
+ } H5E_END_TRY
+
+ if(expected_to_fail) {
+ VERIFY(ret, FAIL, "H5Screate_simple");
+ } else {
+
+ CHECK(ret, FAIL, "H5Sencode2");
+
+ /* Allocate the buffer for encoding */
+ buf = (char *)HDmalloc(buf_size);
+ CHECK(buf, NULL, "H5Dmalloc");
+
+ /* Encode according to the setting in in_fapl */
+ ret = H5Sencode2(in_sid, buf, &buf_size, in_fapl);
+ CHECK(ret, FAIL, "H5Sencode2");
+
+ /* Decode the buffer */
+ d_sid = H5Sdecode(buf);
+ CHECK(d_sid, FAIL, "H5Sdecode");
+
+ /* Verify the number of selected points for in_sid and d_sid */
+ VERIFY(H5Sget_select_npoints(in_sid), H5Sget_select_npoints(d_sid), "Compare npoints");
+
+ /* Verify if the two dataspace selections (in_sid, d_sid) are the same shape */
+ check = H5S__select_shape_same_test(in_sid, d_sid);
+ VERIFY(check, TRUE, "H5S__select_shape_same_test");
+
+ /* Compare the starting/ending coordinates of the bounding box for in_sid and d_sid */
+ ret = H5Sget_select_bounds(in_sid, in_low_bounds, in_high_bounds);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ ret = H5Sget_select_bounds(d_sid, d_low_bounds, d_high_bounds);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(in_low_bounds[0], d_low_bounds[0], "Compare selection low bounds");
+ VERIFY(in_high_bounds[0], d_high_bounds[0], "Compare selection high bounds");
+
+ /*
+ * See "RFC: H5Sencode/H5Sdeocde Format Change" for the verification of:
+ * H5S_SEL_POINTS:
+ * --the expected version for point selection info
+ * --the expected encoded size (version 2 points selection info)
+ * H5S_SEL_HYPERSLABS:
+ * --the expected version for hyperslab selection info
+ * --the expected encoded size (version 3 hyperslab selection info)
+ */
+
+ if(H5Sget_select_type(in_sid) == H5S_SEL_POINTS) {
+
+ /* Verify the version */
+ VERIFY((uint32_t)buf[35], expected_version, "Version for point selection");
+
+ /* Verify the encoded size for version 2 */
+ if(expected_version == 2)
+ VERIFY((uint8_t)buf[39], expected_enc_size, "Encoded size of point selection info");
+ }
+
+ if(H5Sget_select_type(in_sid) == H5S_SEL_HYPERSLABS) {
+
+ /* Verify the version */
+ VERIFY((uint32_t)buf[35], expected_version, "Version for hyperslab selection info");
+
+ /* Verify the encoded size for version 3 */
+ if(expected_version == 3)
+ VERIFY((uint8_t)buf[40], expected_enc_size, "Encoded size of selection info");
+
+ } /* hyperslab selection */
+
+ ret = H5Sclose(d_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ if(buf)
+ HDfree(buf);
+
+ }
+
+ return(0);
+
+} /* test_h5s_check_encoding */
+
+/****************************************************************
+**
+** test_h5s_encode_regular_hyper():
+** This test verifies that H5Sencode2() works as specified in
+** the RFC for regular hyperslabs.
+** See "RFC: H5Sencode/H5Sdeocde Format Change".
+**
+****************************************************************/
+static void
+test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high)
+{
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t numparticles = 8388608; /* Used to calculate dimension size */
+ unsigned num_dsets = 513; /* Used to calculate dimension size */
+ hsize_t total_particles = numparticles * num_dsets;
+ hsize_t vdsdims[1] = {total_particles}; /* Dimension size */
+ hsize_t start, stride, count, block; /* Selection info */
+ unsigned config; /* Testing configuration */
+ unsigned unlim; /* H5S_UNLIMITED setting or not */
+ herr_t ret; /* Generic return value */
+ uint32_t expected_version = 0; /* Expected version for selection info */
+ uint8_t expected_enc_size = 0; /* Expected encoded size for selection info */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Dataspace encoding of regular hyperslabs\n"));
+
+ /* Create the file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set the low/high bounds in the fapl */
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create the dataspace */
+ sid = H5Screate_simple(1, vdsdims, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+
+ /* Testing with each configuration */
+ for(config = CONFIG_16; config <= CONFIG_32; config++) {
+ hbool_t expected_to_fail = FALSE;
+
+ /* Testing with unlimited or not */
+ for(unlim = 0; unlim <= 1; unlim++) {
+ start = 0;
+ count = unlim? H5S_UNLIMITED : 2;
+
+ if((high <= H5F_LIBVER_V18) &&
+ (unlim || config == CONFIG_32))
+ expected_to_fail = TRUE;
+
+ if(low >= H5F_LIBVER_V112)
+ expected_version = 3;
+ else if(config == CONFIG_16 && !unlim)
+ expected_version = 1;
+ else
+ expected_version = 2;
+
+ /* test 1 */
+ switch(config) {
+ case CONFIG_16:
+ stride = POWER16 - 1;
+ block = 4;
+ expected_enc_size = expected_version == 3 ? 2 : 4;
+ break;
+ case CONFIG_32:
+ stride = POWER32 - 1;
+ block = 4;
+ expected_enc_size = expected_version == 3 ? 4 : 8;
+
+ break;
+ default:
+ HDassert(0);
+ break;
+ } /* end switch */
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Verify the version and encoded size expected for this configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ /* test 2 */
+ switch(config) {
+ case CONFIG_16:
+ stride = POWER16 - 1;
+ block = POWER16 - 2;
+ expected_enc_size = expected_version == 3 ? 2 : 4;
+ break;
+ case CONFIG_32:
+ stride = POWER32 - 1;
+ block = POWER32 - 2;
+ expected_enc_size = expected_version == 3 ? 4 : 8;
+ break;
+ default:
+ HDassert(0);
+ break;
+ } /* end switch */
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Verify the version and encoded size for this configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ /* test 3 */
+ switch(config) {
+ case CONFIG_16:
+ stride = POWER16 - 1;
+ block = POWER16 - 1;
+ expected_enc_size = 4;
+ break;
+ case CONFIG_32:
+ stride = POWER32 - 1;
+ block = POWER32 - 1;
+ expected_enc_size = 8;
+ break;
+ default:
+ HDassert(0);
+ break;
+ }
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Verify the version and encoded size expected for this configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ /* test 4 */
+ switch(config) {
+ case CONFIG_16:
+ stride = POWER16;
+ block = POWER16 - 2;
+ expected_enc_size = 4;
+ break;
+ case CONFIG_32:
+ stride = POWER32;
+ block = POWER32 - 2;
+ expected_enc_size = 8;
+ break;
+ default:
+ HDassert(0);
+ break;
+ } /* end switch */
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Verify the version and encoded size expected for this configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ /* test 5 */
+ switch(config) {
+ case CONFIG_16:
+ stride = POWER16;
+ block = 1;
+ expected_enc_size = 4;
+ break;
+ case CONFIG_32:
+ stride = POWER32;
+ block = 1;
+ expected_enc_size = 8;
+ break;
+ default:
+ HDassert(0);
+ break;
+ }
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Verify the version and encoded size expected for this configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ } /* for unlim */
+ } /* for config */
+
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+} /* test_h5s_encode_regular_hyper() */
+
+/****************************************************************
+**
+** test_h5s_encode_irregular_hyper():
+** This test verifies that H5Sencode2() works as specified in
+** the RFC for irregular hyperslabs.
+** See "RFC: H5Sencode/H5Sdeocde Format Change".
+**
+****************************************************************/
+static void
+test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high)
+{
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t sid; /* Dataspace ID */
+ hsize_t numparticles = 8388608; /* Used to calculate dimension size */
+ unsigned num_dsets = 513; /* Used to calculate dimension size */
+ hsize_t total_particles = numparticles * num_dsets;
+ hsize_t vdsdims[1] = {total_particles}; /* Dimension size */
+ hsize_t start, stride, count, block; /* Selection info */
+ htri_t is_regular; /* Is this a regular hyperslab */
+ unsigned config; /* Testing configuration */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Dataspace encoding of irregular hyperslabs\n"));
+
+ /* Create the file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set the low/high bounds in the fapl */
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create the dataspace */
+ sid = H5Screate_simple(1, vdsdims, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+
+ /* Testing with each configuration */
+ for(config = CONFIG_8; config <= CONFIG_32; config++) {
+ hbool_t expected_to_fail = FALSE; /* Whether H5Sencode2 is expected to fail */
+ uint32_t expected_version = 0; /* Expected version for selection info */
+ uint8_t expected_enc_size = 0; /* Expected encoded size for selection info */
+
+ start = 0;
+ count = 2;
+ block = 4;
+
+ /* H5Sencode2 is expected to fail for library v110 and below
+ when the selection exceeds the 32 bits integer limit */
+ if(high <= H5F_LIBVER_V110 && config == CONFIG_32)
+ expected_to_fail = TRUE;
+
+ if(low >= H5F_LIBVER_V112 || config == CONFIG_32)
+ expected_version = 3;
+ else
+ expected_version = 1;
+
+ switch(config) {
+ case CONFIG_8:
+ stride = POWER8 - 2;
+ break;
+
+ case CONFIG_16:
+ stride = POWER16 - 2;
+ break;
+
+ case CONFIG_32:
+ stride = POWER32 - 2;
+ break;
+
+ default:
+ HDassert(0);
+ break;
+ }
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ start = 8;
+ count = 5;
+ block = 2;
+
+ switch(config) {
+ case CONFIG_8:
+ stride = POWER8;
+ expected_enc_size = expected_version == 3 ? 2 : 4;
+ break;
+
+ case CONFIG_16:
+ stride = POWER16;
+ expected_enc_size = 4;
+ break;
+
+ case CONFIG_32:
+ stride = POWER32;
+ expected_enc_size = 8;
+ break;
+
+ default:
+ assert(0);
+ break;
+ }
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Should be irregular hyperslab */
+ is_regular = H5Sis_regular_hyperslab(sid);
+ VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab");
+
+ /* Verify the version and encoded size expected for the configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ } /* for config */
+
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+} /* test_h5s_encode_irregular_hyper() */
+
+/****************************************************************
+**
+** test_h5s_encode_points():
+** This test verifies that H5Sencode2() works as specified in
+** the RFC for point selection.
+** See "RFC: H5Sencode/H5Sdeocde Format Change".
+**
+****************************************************************/
+static void
+test_h5s_encode_points(H5F_libver_t low, H5F_libver_t high)
+{
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t sid; /* Dataspace ID */
+ hsize_t numparticles = 8388608; /* Used to calculate dimenion size */
+ unsigned num_dsets = 513; /* used to calculate dimension size */
+ hsize_t total_particles = numparticles * num_dsets;
+ hsize_t vdsdims[1] = {total_particles}; /* Dimension size */
+ hsize_t coord[4]; /* The point coordinates */
+ herr_t ret; /* Generic return value */
+ hbool_t expected_to_fail = FALSE; /* Expected to fail or not */
+ uint32_t expected_version = 0; /* Expected version for selection info */
+ uint8_t expected_enc_size = 0; /* Expected encoded size of selection info */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Dataspace encoding of points selection\n"));
+
+ /* Create the file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set the low/high bounds in the fapl */
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create the dataspace */
+ sid = H5Screate_simple(1, vdsdims, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+
+ /* test 1 */
+ coord[0] = 5;
+ coord[1] = 15;
+ coord[2] = POWER16;
+ coord[3] = 19;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ expected_to_fail = FALSE;
+ expected_enc_size = 4;
+ expected_version = 1;
+
+ if(low >= H5F_LIBVER_V112)
+ expected_version = 2;
+
+ /* Verify the version and encoded size expected for the configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ /* test 2 */
+ coord[0] = 5;
+ coord[1] = 15;
+ coord[2] = POWER32 - 1;
+ coord[3] = 19;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ /* Expected result same as test 1 */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ /* test 3 */
+ if(high <= H5F_LIBVER_V110)
+ expected_to_fail = TRUE;
+
+ if(high >= H5F_LIBVER_V112) {
+ expected_version = 2;
+ expected_enc_size = 8;
+ }
+
+ coord[0] = 5;
+ coord[1] = 15;
+ coord[2] = POWER32 + 1;
+ coord[3] = 19;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ /* Verify the version and encoded size expected for the configuration */
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ CHECK(ret, FAIL, "test_h5s_check_encoding");
+
+ /* Close the dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+} /* test_h5s_encode_points() */
+
+/****************************************************************
+**
+** test_h5s_encode_length():
+** Test to verify HDFFV-10271 is fixed.
+** Verify that version 2 hyperslab encoding length is correct.
+**
+** See "RFC: H5Sencode/H5Sdecode Format Change" for the
+** description of the encoding format.
+**
+****************************************************************/
+static void
+test_h5s_encode_length(void)
+{
+ hid_t sid; /* Dataspace ID */
+ hid_t decoded_sid; /* Dataspace ID from H5Sdecode2 */
+ size_t sbuf_size=0; /* Buffer size for H5Sencode2/1 */
+ unsigned char *sbuf=NULL; /* Buffer for H5Sencode2/1 */
+ hsize_t dims[1] = {500}; /* Dimension size */
+ hsize_t start, count, block, stride; /* Hyperslab selection specifications */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Version 2 Hyperslab Encoding Length is correct\n"));
+
+ /* Create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+
+ /* Setting H5S_UNLIMITED in count will use version 2 for hyperslab encoding */
+ start = 0;
+ stride = 10;
+ block = 4;
+ count = H5S_UNLIMITED;
+
+ /* Set hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Encode simple data space in a buffer */
+ ret = H5Sencode2(sid, NULL, &sbuf_size, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Sencode");
+
+ /* Allocate the buffer */
+ if(sbuf_size > 0) {
+ sbuf = (unsigned char*)HDcalloc((size_t)1, sbuf_size);
+ CHECK(sbuf, NULL, "H5Sencode2");
+ }
+
+ /* Encode the dataspace */
+ ret = H5Sencode2(sid, sbuf, &sbuf_size, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Sencode");
+
+ /* Verify that length stored at this location in the buffer is correct */
+ VERIFY((uint32_t)sbuf[40], 36, "Length for encoding version 2");
+ VERIFY((uint32_t)sbuf[35], 2, "Hyperslab encoding version is 2");
+
+ /* Decode from the dataspace buffer and return an object handle */
+ decoded_sid = H5Sdecode(sbuf);
+ CHECK(decoded_sid, FAIL, "H5Sdecode");
+
+ /* Verify that the original and the decoded dataspace are equal */
+ VERIFY(H5Sget_select_npoints(sid), H5Sget_select_npoints(decoded_sid), "Compare npoints");
+
+ /* Close the decoded dataspace */
+ ret = H5Sclose(decoded_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Free the buffer */
+ if(sbuf)
+ HDfree(sbuf);
+
+ /* Close the original dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+} /* test_h5s_encode_length() */
/****************************************************************
**
@@ -1331,14 +2173,14 @@ test_h5s_encode(void)
static void
test_h5s_scalar_write(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- int rank; /* Logical rank of dataspace */
- hsize_t tdims[4]; /* Dimension array to test with */
- hssize_t n; /* Number of dataspace elements */
- H5S_class_t ext_type; /* Extent type */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ int rank; /* Logical rank of dataspace */
+ hsize_t tdims[4]; /* Dimension array to test with */
+ hssize_t n; /* Number of dataspace elements */
+ H5S_class_t ext_type; /* Extent type */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Scalar Dataspace Manipulation during Writing\n"));
@@ -1357,14 +2199,17 @@ test_h5s_scalar_write(void)
sid1 = H5Screate_simple(SPACE3_RANK, NULL, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
+ /* Retrieve the number of elements in the dataspace selection */
n = H5Sget_simple_extent_npoints(sid1);
CHECK(n, FAIL, "H5Sget_simple_extent_npoints");
VERIFY(n, 1, "H5Sget_simple_extent_npoints");
+ /* Get the dataspace rank */
rank = H5Sget_simple_extent_ndims(sid1);
CHECK(rank, FAIL, "H5Sget_simple_extent_ndims");
VERIFY(rank, SPACE3_RANK, "H5Sget_simple_extent_ndims");
+ /* Get the dataspace dimension sizes */
rank = H5Sget_simple_extent_dims(sid1, tdims, NULL);
VERIFY(rank, 0, "H5Sget_simple_extent_dims");
@@ -1376,6 +2221,7 @@ test_h5s_scalar_write(void)
dataset = H5Dcreate2(fid1, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
+ /* Write to the dataset */
ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &space3_data);
CHECK(ret, FAIL, "H5Dwrite");
@@ -1390,7 +2236,7 @@ test_h5s_scalar_write(void)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_h5s_scalar_write() */
+} /* test_h5s_scalar_write() */
/****************************************************************
**
@@ -2509,15 +3355,38 @@ test_versionbounds(void)
void
test_h5s(void)
{
+ H5F_libver_t low, high; /* Low and high bounds */
+
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataspaces\n"));
- test_h5s_basic(); /* Test basic H5S code */
- test_h5s_null(); /* Test Null dataspace H5S code */
+ test_h5s_basic(); /* Test basic H5S code */
+ test_h5s_null(); /* Test Null dataspace H5S code */
test_h5s_zero_dim(); /* Test dataspace with zero dimension size */
- test_h5s_encode(); /* Test encoding and decoding */
+
+ /* Loop through all the combinations of low/high version bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+
+ /* Invalid combinations, just continue */
+ if(high == H5F_LIBVER_EARLIEST || high < low)
+ continue;
+
+ test_h5s_encode(low, high); /* Test encoding and decoding */
+ test_h5s_encode_regular_hyper(low, high); /* Test encoding regular hyperslabs */
+ test_h5s_encode_irregular_hyper(low, high); /* Test encoding irregular hyperslabs */
+ test_h5s_encode_points(low, high); /* Test encoding points */
+
+ } /* end high bound */
+ } /* end low bound */
+
+ test_h5s_encode_length(); /* Test version 2 hyperslab encoding length is correct */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ test_h5s_encode1(); /* Test operations with old API routine (H5Sencode1) */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
test_h5s_scalar_write(); /* Test scalar H5S writing code */
- test_h5s_scalar_read(); /* Test scalar H5S reading code */
+ test_h5s_scalar_read(); /* Test scalar H5S reading code */
test_h5s_compound_scalar_write(); /* Test compound datatype scalar H5S writing code */
test_h5s_compound_scalar_read(); /* Test compound datatype scalar H5S reading code */
diff --git a/test/tid.c b/test/tid.c
index 8a27c3b..7f61c6a 100644
--- a/test/tid.c
+++ b/test/tid.c
@@ -251,7 +251,10 @@ static int id_predefined_test(void )
testObj = HDmalloc(sizeof(int));
- /* Try to perform illegal functions on various predefined types */
+ /*
+ * Attempt to perform public functions on various library types
+ */
+
H5E_BEGIN_TRY
testID = H5Iregister(H5I_FILE, testObj);
H5E_END_TRY
@@ -292,7 +295,26 @@ static int id_predefined_test(void )
if(testErr >= 0)
goto out;
- /* Create a datatype ID and try to perform illegal functions on it */
+ H5E_BEGIN_TRY
+ testErr = H5Itype_exists(H5I_GROUP);
+ H5E_END_TRY
+
+ VERIFY(testErr, -1, "H5Itype_exists");
+ if(testErr != -1)
+ goto out;
+
+ H5E_BEGIN_TRY
+ testErr = H5Itype_exists(H5I_ATTR);
+ H5E_END_TRY
+
+ VERIFY(testErr, -1, "H5Itype_exists");
+ if(testErr != -1)
+ goto out;
+
+ /*
+ * Create a datatype ID and try to perform illegal functions on it
+ */
+
typeID = H5Tcreate(H5T_OPAQUE, (size_t)42);
CHECK(typeID, H5I_INVALID_HID, "H5Tcreate");
if(typeID == H5I_INVALID_HID)
@@ -317,7 +339,7 @@ static int id_predefined_test(void )
H5Tclose(typeID);
/* testObj was never registered as an atom, so it will not be
- * automatically freed. */
+ * automatically freed. */
HDfree(testObj);
return 0;
diff --git a/test/titerate.c b/test/titerate.c
index 8c0ef24..54e9b5e 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -945,7 +945,7 @@ find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data)
searched_err_t *searched_err = (searched_err_t *)_client_data;
if (searched_err == NULL)
- return -1;
+ return H5_ITER_ERROR;
/* If the searched error message is found, stop the iteration */
if (err_desc->desc != NULL && strcmp(err_desc->desc, searched_err->message) == 0)
@@ -953,6 +953,7 @@ find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data)
searched_err->found = true;
status = H5_ITER_STOP;
}
+
return status;
} /* end find_err_msg_cb() */
@@ -988,6 +989,7 @@ static void test_corrupted_attnamelen(void)
/* Call H5Aiterate2 to trigger the failure in HDFFV-10588. Failure should
occur in the decoding stage, so some arguments are not needed. */
err_status = H5Aiterate2(did, H5_INDEX_NAME, H5_ITER_INC, NULL, NULL, NULL);
+ VERIFY(err_status, FAIL, "H5Aiterate2");
/* Make sure the intended error was caught */
if(err_status == -1)
diff --git a/test/trefer.c b/test/trefer.c
index 4f76cb3..4bf9caf 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -490,43 +490,48 @@ test_reference_obj(void)
** test_reference_region(): Test basic H5R (reference) object reference code.
** Tests references to various kinds of objects
**
+** Note: The libver_low/libver_high parameters are added to create the file
+** with the low and high bounds setting in fapl.
+** Please see the RFC for "H5Sencode/H5Sdecode Format Change".
+**
****************************************************************/
static void
-test_reference_region(void)
+test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dset1, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t sid1, /* Dataspace ID #1 */
- sid2; /* Dataspace ID #2 */
- hid_t dapl_id; /* Dataset access property list */
- hsize_t dims1[] = {SPACE1_DIM1},
- dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hsize_t * coords; /* Coordinate buffer */
- hsize_t low[SPACE2_RANK]; /* Selection bounds */
- hsize_t high[SPACE2_RANK]; /* Selection bounds */
- hdset_reg_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t fapl = -1; /* File access property list */
+ hid_t dset1, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid2; /* Dataspace ID #2 */
+ hid_t dapl_id; /* Dataset access property list */
+ hsize_t dims1[] = {SPACE1_DIM1},
+ dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t *coords; /* Coordinate buffer */
+ hsize_t low[SPACE2_RANK]; /* Selection bounds */
+ hsize_t high[SPACE2_RANK]; /* Selection bounds */
+ hdset_reg_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
hdset_reg_ref_t nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */
- uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
- *drbuf; /* Buffer for reading numeric data from disk */
- uint8_t *tu8; /* Temporary pointer to uint8 data */
- H5O_type_t obj_type; /* Type of object */
- int i, j; /* counting variables */
- hssize_t hssize_ret; /* hssize_t return value */
- htri_t tri_ret; /* htri_t return value */
- herr_t ret; /* Generic return value */
- haddr_t addr = HADDR_UNDEF; /* test for undefined reference */
- hid_t dset_NA; /* Dataset id for undefined reference */
- hid_t space_NA; /* Dataspace id for undefined reference */
- hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */
- hdset_reg_ref_t wdata_NA[1], /* Write buffer */
- rdata_NA[1]; /* Read buffer */
+ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
+ *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t *tu8; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Type of object */
+ int i, j; /* counting variables */
+ hssize_t hssize_ret; /* hssize_t return value */
+ htri_t tri_ret; /* htri_t return value */
+ herr_t ret; /* Generic return value */
+ haddr_t addr = HADDR_UNDEF; /* test for undefined reference */
+ hid_t dset_NA; /* Dataset id for undefined reference */
+ hid_t space_NA; /* Dataspace id for undefined reference */
+ hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */
+ hdset_reg_ref_t wdata_NA[1], /* Write buffer */
+ rdata_NA[1]; /* Read buffer */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataset Region Reference Functions\n"));
@@ -537,8 +542,16 @@ test_reference_region(void)
dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
- /* Create file */
- fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set the low/high version bounds in fapl */
+ ret = H5Pset_libver_bounds(fapl, libver_low, libver_high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create file with the fapl */
+ fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(fid1, FAIL, "H5Fcreate");
/* Create dataspace for datasets */
@@ -625,8 +638,15 @@ test_reference_region(void)
VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
/* Store third dataset region */
- ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
- CHECK(ret, FAIL, "H5Rcreate");
+ H5E_BEGIN_TRY {
+ ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
+ } H5E_END_TRY;
+
+ if(libver_high < H5F_LIBVER_V110)
+ VERIFY(ret, FAIL, "H5Rcreate");
+ else
+ CHECK(ret, FAIL, "H5Rcreate");
+
ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type2");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
@@ -677,7 +697,7 @@ test_reference_region(void)
CHECK(ret, FAIL, "H5Fclose");
/* Re-open the file */
- fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, fapl);
CHECK(fid1, FAIL, "H5Fopen");
/*
@@ -822,30 +842,32 @@ test_reference_region(void)
ret = H5Sclose(sid2);
CHECK(ret, FAIL, "H5Sclose");
- /* Get the unlimited selection */
- sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[2]);
- CHECK(sid2, FAIL, "H5Rget_region");
-
- /* Verify correct hyperslab selected */
- hssize_ret = H5Sget_select_npoints(sid2);
- VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
- tri_ret = H5Sis_regular_hyperslab(sid2);
- CHECK(tri_ret, FAIL, "H5Sis_regular_hyperslab");
- VERIFY(tri_ret, TRUE, "H5Sis_regular_hyperslab Result");
- ret = H5Sget_regular_hyperslab(sid2, start, stride, count, block);
- CHECK(ret, FAIL, "H5Sget_regular_hyperslab");
- VERIFY(start[0], (hsize_t)1, "Hyperslab Coordinates");
- VERIFY(start[1], (hsize_t)8, "Hyperslab Coordinates");
- VERIFY(stride[0], (hsize_t)4, "Hyperslab Coordinates");
- VERIFY(stride[1], (hsize_t)1, "Hyperslab Coordinates");
- VERIFY(count[0], H5S_UNLIMITED, "Hyperslab Coordinates");
- VERIFY(count[1], (hsize_t)1, "Hyperslab Coordinates");
- VERIFY(block[0], (hsize_t)2, "Hyperslab Coordinates");
- VERIFY(block[1], (hsize_t)2, "Hyperslab Coordinates");
-
- /* Close region space */
- ret = H5Sclose(sid2);
- CHECK(ret, FAIL, "H5Sclose");
+ if(libver_high >= H5F_LIBVER_V110) {
+ /* Get the unlimited selection */
+ sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[2]);
+ CHECK(sid2, FAIL, "H5Rget_region");
+
+ /* Verify correct hyperslab selected */
+ hssize_ret = H5Sget_select_npoints(sid2);
+ VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
+ tri_ret = H5Sis_regular_hyperslab(sid2);
+ CHECK(tri_ret, FAIL, "H5Sis_regular_hyperslab");
+ VERIFY(tri_ret, TRUE, "H5Sis_regular_hyperslab Result");
+ ret = H5Sget_regular_hyperslab(sid2, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sget_regular_hyperslab");
+ VERIFY(start[0], (hsize_t)1, "Hyperslab Coordinates");
+ VERIFY(start[1], (hsize_t)8, "Hyperslab Coordinates");
+ VERIFY(stride[0], (hsize_t)4, "Hyperslab Coordinates");
+ VERIFY(stride[1], (hsize_t)1, "Hyperslab Coordinates");
+ VERIFY(count[0], H5S_UNLIMITED, "Hyperslab Coordinates");
+ VERIFY(count[1], (hsize_t)1, "Hyperslab Coordinates");
+ VERIFY(block[0], (hsize_t)2, "Hyperslab Coordinates");
+ VERIFY(block[1], (hsize_t)2, "Hyperslab Coordinates");
+
+ /* Close region space */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+ }
/* Close first space */
ret = H5Sclose(sid1);
@@ -887,34 +909,39 @@ test_reference_region(void)
** test_reference_region_1D(): Test H5R (reference) object reference code.
** Tests 1-D references to various kinds of objects
**
+** Note: The libver_low/libver_high parameters are added to create the file
+** with the low and high bounds setting in fapl.
+** Please see the RFC for "H5Sencode/H5Sdecode Format Change".
+**
****************************************************************/
static void
-test_reference_region_1D(void)
+test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dset1, /* Dataset ID */
- dset3; /* Dereferenced dataset ID */
- hid_t sid1, /* Dataspace ID #1 */
- sid3; /* Dataspace ID #3 */
- hid_t dapl_id; /* Dataset access property list */
- hsize_t dims1[] = {SPACE1_DIM1},
- dims3[] = {SPACE3_DIM1};
- hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
- hsize_t * coords; /* Coordinate buffer */
- hsize_t low[SPACE3_RANK]; /* Selection bounds */
- hsize_t high[SPACE3_RANK]; /* Selection bounds */
- hdset_reg_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
- uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
- *drbuf; /* Buffer for reading numeric data from disk */
- uint8_t *tu8; /* Temporary pointer to uint8 data */
- H5O_type_t obj_type; /* Object type */
- int i; /* counting variables */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t fapl = -1; /* File access property list */
+ hid_t dset1, /* Dataset ID */
+ dset3; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid3; /* Dataspace ID #3 */
+ hid_t dapl_id; /* Dataset access property list */
+ hsize_t dims1[] = {SPACE1_DIM1},
+ dims3[] = {SPACE3_DIM1};
+ hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hsize_t *coords; /* Coordinate buffer */
+ hsize_t low[SPACE3_RANK]; /* Selection bounds */
+ hsize_t high[SPACE3_RANK]; /* Selection bounds */
+ hdset_reg_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
+ *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t *tu8; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Object type */
+ int i; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n"));
@@ -925,8 +952,16 @@ test_reference_region_1D(void)
dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
- /* Create file */
- fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create the file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set the low/high version bounds in fapl */
+ ret = H5Pset_libver_bounds(fapl, libver_low, libver_high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create file with the fapl */
+ fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(fid1, FAIL, "H5Fcreate");
/* Create dataspace for datasets */
@@ -1022,7 +1057,7 @@ test_reference_region_1D(void)
CHECK(ret, FAIL, "H5Fclose");
/* Re-open the file */
- fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, fapl);
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset */
@@ -1156,6 +1191,10 @@ test_reference_region_1D(void)
ret = H5Pclose(dapl_id);
CHECK(ret, FAIL, "H5Pclose");
+ /* Close file access property list */
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
@@ -1733,13 +1772,28 @@ test_reference_compat(void)
void
test_reference(void)
{
+ H5F_libver_t low, high; /* Low and high bounds */
+
/* Output message about test being performed */
MESSAGE(5, ("Testing References\n"));
test_reference_params(); /* Test for correct parameter checking */
test_reference_obj(); /* Test basic H5R object reference code */
- test_reference_region(); /* Test basic H5R dataset region reference code */
- test_reference_region_1D(); /* Test H5R dataset region reference code for 1-D datasets */
+
+ /* Loop through all the combinations of low/high version bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+
+ /* Invalid combinations, just continue */
+ if(high == H5F_LIBVER_EARLIEST || high < low)
+ continue;
+
+ test_reference_region(low, high); /* Test basic H5R dataset region reference code */
+ test_reference_region_1D(low, high); /* Test H5R dataset region reference code for 1-D datasets */
+
+ } /* end high bound */
+ } /* end low bound */
+
test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */
test_reference_group(); /* Test operations on dereferenced groups */
#ifndef H5_NO_DEPRECATED_SYMBOLS
diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c
index 56d87ee..5e26888 100644
--- a/test/ttsafe_error.c
+++ b/test/ttsafe_error.c
@@ -63,6 +63,8 @@ static void *tts_error_thread(void *);
void
tts_error(void)
{
+ hid_t def_fapl = H5I_INVALID_HID;
+ hid_t vol_id = H5I_INVALID_HID;
hid_t dataset = H5I_INVALID_HID;
H5TS_thread_t threads[NUM_THREAD];
H5TS_attr_t attribute;
@@ -111,39 +113,52 @@ tts_error(void)
H5TS_attr_setscope(&attribute, H5TS_SCOPE_SYSTEM);
#endif /* H5_HAVE_SYSTEM_SCOPE_THREADS */
- /* Create a hdf5 file using H5F_ACC_TRUNC access, default file
- * creation plist and default file access plist
- */
- error_file_g = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(error_file_g, H5I_INVALID_HID, "H5Fcreate");
+ def_fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(def_fapl, H5I_INVALID_HID, "H5Pcreate");
- for (i = 0; i < NUM_THREAD; i++)
- threads[i] = H5TS_create_thread(tts_error_thread, &attribute, NULL);
+ status = H5Pget_vol_id(def_fapl, &vol_id);
+ CHECK(status, FAIL, "H5Pget_vol_id");
- for (i = 0; i < NUM_THREAD; i++)
- H5TS_wait_for_thread(threads[i]);
+ if(vol_id == H5VL_NATIVE) {
+ /* Create a hdf5 file using H5F_ACC_TRUNC access, default file
+ * creation plist and default file access plist
+ */
+ error_file_g = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, def_fapl);
+ CHECK(error_file_g, H5I_INVALID_HID, "H5Fcreate");
- if (error_flag_g) {
- 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");
- }
+ for (i = 0; i < NUM_THREAD; i++)
+ threads[i] = H5TS_create_thread(tts_error_thread, &attribute, NULL);
+
+ for (i = 0; i < NUM_THREAD; i++)
+ H5TS_wait_for_thread(threads[i]);
+
+ if (error_flag_g) {
+ 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");
+ }
- if (error_count_g != NUM_THREAD - 1)
- TestErrPrintf("Error: %d threads failed instead of %d\n", error_count_g, NUM_THREAD-1);
+ if (error_count_g != NUM_THREAD - 1)
+ TestErrPrintf("Error: %d threads failed instead of %d\n", error_count_g, NUM_THREAD-1);
- dataset = H5Dopen2(error_file_g, DATASETNAME, H5P_DEFAULT);
- CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
+ dataset = H5Dopen2(error_file_g, DATASETNAME, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
- status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value);
- CHECK(status, FAIL, "H5Dread");
+ status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value);
+ CHECK(status, FAIL, "H5Dread");
- if (value != WRITE_NUMBER)
- TestErrPrintf("Error: Successful thread wrote value %d instead of %d\n", value, WRITE_NUMBER);
+ if (value != WRITE_NUMBER)
+ TestErrPrintf("Error: Successful thread wrote value %d instead of %d\n", value, WRITE_NUMBER);
- status = H5Dclose(dataset);
- CHECK(status, FAIL, "H5Dclose");
- status = H5Fclose(error_file_g);
- CHECK(status, FAIL, "H5Fclose");
+ status = H5Dclose(dataset);
+ CHECK(status, FAIL, "H5Dclose");
+ status = H5Fclose(error_file_g);
+ CHECK(status, FAIL, "H5Fclose");
+ } /* end if */
+ else
+ HDprintf("Non-native VOL connector used, skipping test\n");
+
+ status = H5Idec_ref(vol_id);
+ CHECK(status, FAIL, "H5Idec_ref");
H5TS_attr_destroy(&attribute);
} /* end tts_error() */
diff --git a/test/vds.c b/test/vds.c
index 67af8e3..c3b6181 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -420,11 +420,11 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
size_t plist_buf_size;
/* Encode property list to plist_buf */
- if(H5Pencode(dcpl, NULL, &plist_buf_size) < 0)
+ if(H5Pencode2(dcpl, NULL, &plist_buf_size, fapl) < 0)
TEST_ERROR
if(NULL == (plist_buf = HDmalloc(plist_buf_size)))
TEST_ERROR
- if(H5Pencode(dcpl, plist_buf, &plist_buf_size) < 0)
+ if(H5Pencode2(dcpl, plist_buf, &plist_buf_size, fapl) < 0)
TEST_ERROR
/* Decode serialized property list to *ex_dcpl */
@@ -469,7 +469,7 @@ error:
/* Main test function */
static int
-test_api(test_api_config_t config, hid_t fapl)
+test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
{
char filename[FILENAME_BUF_SIZE];
hid_t dcpl = -1; /* Dataset creation property list */
@@ -618,7 +618,8 @@ test_api(test_api_config_t config, hid_t fapl)
TEST_ERROR
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)213) < 0)
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename,
+ (low >= H5F_LIBVER_V112)?(hsize_t)99:(low >= H5F_LIBVER_V110?174:213)) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
@@ -1025,7 +1026,8 @@ test_api(test_api_config_t config, hid_t fapl)
}
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)697) < 0)
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename,
+ (low >= H5F_LIBVER_V112)?(hsize_t)607:(hsize_t)697) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
@@ -1119,7 +1121,7 @@ error:
} /* end test_api() */
/*-------------------------------------------------------------------------
- * Function: vds_link_prefix
+ * Function: test_vds_prefix_first
*
* Purpose: Set up vds link prefix via H5Pset_virtual_prefix() to be "tmp"
* Should be able to access the target source files in tmp directory via the prefix set
@@ -1130,18 +1132,16 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_vds_prefix(unsigned config, hid_t fapl)
+test_vds_prefix_first(unsigned config, hid_t fapl)
{
char srcfilename[FILENAME_BUF_SIZE];
char srcfilename_map[FILENAME_BUF_SIZE];
char vfilename[FILENAME_BUF_SIZE];
- char vfilename2[FILENAME_BUF_SIZE];
char srcfilenamepct[FILENAME_BUF_SIZE];
char srcfilenamepct_map[FILENAME_BUF_SIZE];
const char *srcfilenamepct_map_orig = "vds%%%%_src";
hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
hid_t vfile = -1; /* File with virtual dset */
- hid_t vfile2 = -1; /* File with copied virtual dset */
hid_t dcpl = -1; /* Dataset creation property list */
hid_t dapl = -1; /* Dataset access property list */
hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
@@ -1156,10 +1156,9 @@ test_vds_prefix(unsigned config, hid_t fapl)
int i, j;
char buffer[1024]; /* buffer to read vds_prefix */
- TESTING("basic virtual dataset I/O via H5Pset_vds_prefix()")
+ TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection")
h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename);
- h5_fixname(FILENAME[7], fapl, vfilename2, sizeof vfilename2);
h5_fixname(FILENAME[8], fapl, srcfilename, sizeof srcfilename);
h5_fixname_printf(FILENAME[8], fapl, srcfilename_map, sizeof srcfilename_map);
h5_fixname(FILENAME[10], fapl, srcfilenamepct, sizeof srcfilenamepct);
@@ -1189,9 +1188,6 @@ test_vds_prefix(unsigned config, hid_t fapl)
if(HDstrcmp(buffer, TMPDIR) != 0)
FAIL_PUTS_ERROR("vds prefix not set correctly");
- /*
- * Test 1: All - all selection
- */
/* Create source dataspace */
if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
@@ -1344,187 +1340,6 @@ test_vds_prefix(unsigned config, hid_t fapl)
TEST_ERROR
dcpl = -1;
- /*
- * Test 2: All - all selection with ENV prefix
- */
- if(HDsetenv("HDF5_VDS_PREFIX", "${ORIGIN}/tmp", 1))
- TEST_ERROR
-
- /* Create DCPL */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- TEST_ERROR
-
- /* Set fill value */
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
- TEST_ERROR
-
- /* Set prefix to a nonexistent directory, will be overwritten by environment variable */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
- TEST_ERROR
-
- if(H5Pset_virtual_prefix(dapl, "someprefix") < 0)
- TEST_ERROR
- if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0)
- TEST_ERROR
-
- if(HDstrcmp(buffer, "someprefix") != 0)
- FAIL_PUTS_ERROR("vds prefix not set correctly");
-
- /* Create source dataspace */
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
- TEST_ERROR
-
- /* Create virtual dataspace */
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
- TEST_ERROR
-
- /* Select all (should not be necessary, but just to be sure) */
- if(H5Sselect_all(srcspace[0]) < 0)
- TEST_ERROR
- if(H5Sselect_all(vspace[0]) < 0)
- TEST_ERROR
-
- /* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0)
- TEST_ERROR
-
- /* Create virtual file */
- if((vfile = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
-
- /* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- HDgetcwd(buffer, 1024);
- HDchdir(TMPDIR);
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
- HDchdir(buffer);
- }
- else {
- srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
- TEST_ERROR
- }
-
- /* Create source dataset */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- TEST_ERROR
-
- /* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
- TEST_ERROR
-
- /* Populate write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
-
- /* Write data directly to source dataset */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
- TEST_ERROR
-
- /* Close srcdset and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
- TEST_ERROR
- srcdset[0] = -1;
-
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
- TEST_ERROR
- srcfile[0] = -1;
- }
- }
-
- /* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
- TEST_ERROR
- vdset = -1;
- if(H5Fclose(vfile) < 0)
- TEST_ERROR
- vfile = -1;
- if((vfile = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0)
- TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
- TEST_ERROR
- }
-
- /* Read data through virtual dataset */
- HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
- TEST_ERROR
-
- /* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) {
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j]) {
- TEST_ERROR
- }
- }
-
- /* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
-
- /* Write data through virtual dataset */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
- TEST_ERROR
-
- /* Reopen srcdset and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE) {
- HDgetcwd(buffer, 1024);
- HDchdir(TMPDIR);
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
- TEST_ERROR
- HDchdir(buffer);
- }
- if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0)
- TEST_ERROR
- }
-
- /* Read data directly from source dataset */
- HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
- TEST_ERROR
-
- /* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j])
- TEST_ERROR
-
- /* Close */
- if(H5Dclose(vdset) < 0)
- TEST_ERROR
- vdset = -1;
- if(H5Dclose(srcdset[0]) < 0)
- TEST_ERROR
- srcdset[0] = -1;
- if(H5Fclose(srcfile[0]) < 0)
- TEST_ERROR
- srcfile[0] = -1;
- if(H5Fclose(vfile) < 0)
- TEST_ERROR
- vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
- TEST_ERROR
- srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
- TEST_ERROR
- vspace[0] = -1;
- if(H5Pclose(dapl) < 0)
- TEST_ERROR
- dapl = -1;
- if(H5Pclose(dcpl) < 0)
- TEST_ERROR
- dcpl = -1;
-
- if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0)
- TEST_ERROR
-
PASSED();
return 0;
@@ -1536,7 +1351,6 @@ test_vds_prefix(unsigned config, hid_t fapl)
for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++)
H5Fclose(srcfile[i]);
H5Fclose(vfile);
- H5Fclose(vfile2);
for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++)
H5Sclose(srcspace[i]);
for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
@@ -1550,7 +1364,7 @@ test_vds_prefix(unsigned config, hid_t fapl)
TEST_ERROR
return 1;
-} /* end vds_link_prefix() */
+} /* end test_vds_prefix */
/*-------------------------------------------------------------------------
@@ -11598,6 +11412,11 @@ test_dapl_values(hid_t fapl_id)
*
* Purpose: Tests datasets with virtual layout
*
+ * Note:
+ * Tests are modified to test with the low/high bounds combination
+ * set in fapl.
+ * Please see RFC for "H5Sencode/H5Sdecode Format Change".
+ *
* Return: EXIT_SUCCESS/EXIT_FAILURE
*-------------------------------------------------------------------------
*/
@@ -11606,8 +11425,11 @@ main(void)
{
char filename[FILENAME_BUF_SIZE];
hid_t fapl;
+ hid_t my_fapl = -1; /* File access property list */
int test_api_config;
unsigned bit_config;
+ unsigned latest = FALSE; /* Using the latest library version bound */
+ H5F_libver_t low, high; /* Low and high bounds */
int nerrors = 0;
/* Testing setup */
@@ -11616,21 +11438,59 @@ main(void)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- for(test_api_config = (int)TEST_API_BASIC; test_api_config < (int)TEST_API_NTESTS; test_api_config++)
- nerrors += test_api((test_api_config_t)test_api_config, fapl);
- for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) {
- HDprintf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : "");
- nerrors += test_basic_io(bit_config, fapl);
- nerrors += test_vds_prefix(bit_config, fapl);
- nerrors += test_unlim(bit_config, fapl);
- nerrors += test_printf(bit_config, fapl);
- nerrors += test_all(bit_config, fapl);
- }
+ /* Set to use the latest file format */
+ if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Loop through all the combinations of low/high version bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ char msg[80]; /* Message for file version bounds */
+ char *low_string; /* The low bound string */
+ char *high_string; /* The high bound string */
+
+ /* Invalid combinations, just continue */
+ if(high == H5F_LIBVER_EARLIEST || high < low)
+ continue;
+
+ /* Test virtual dataset only for V110 and above */
+ if(high < H5F_LIBVER_V110)
+ continue;
+
+ /* Whether to use latest hyperslab/point selection version */
+ if(low >= H5F_LIBVER_V112)
+ latest = TRUE;
+
+ /* Set the low/high version bounds */
+ if(H5Pset_libver_bounds(my_fapl, low, high) < 0)
+ TEST_ERROR
+
+ /* Display testing info */
+ low_string = h5_get_version_string(low);
+ high_string = h5_get_version_string(high);
+ HDsprintf(msg, "Testing virtual dataset with file version bounds: (%s, %s):", low_string, high_string);
+ HDputs(msg);
+
+ for(test_api_config = (int)TEST_API_BASIC; test_api_config < (int)TEST_API_NTESTS; test_api_config++)
+ nerrors += test_api((test_api_config_t)test_api_config, my_fapl, low);
+ for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) {
+ HDprintf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : "");
+ nerrors += test_basic_io(bit_config, my_fapl);
+ nerrors += test_vds_prefix_first(bit_config, my_fapl);
+ nerrors += test_unlim(bit_config, my_fapl);
+ nerrors += test_printf(bit_config, my_fapl);
+ nerrors += test_all(bit_config, my_fapl);
+ }
+
+ nerrors += test_dapl_values(my_fapl);
- nerrors += test_dapl_values(fapl);
+ /* Verify symbol table messages are cached */
+ nerrors += (h5_verify_cached_stabs(FILENAME, my_fapl) < 0 ? 1 : 0);
- /* Verify symbol table messages are cached */
- nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
+ } /* end for high */
+ } /* end for low */
+
+ if(H5Pclose(my_fapl) < 0)
+ TEST_ERROR
if(nerrors)
goto error;
diff --git a/test/vds_env.c b/test/vds_env.c
new file mode 100644
index 0000000..abdd7b7
--- /dev/null
+++ b/test/vds_env.c
@@ -0,0 +1,364 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Neil Fortner <nfortne2@hdfgroup.org>
+ * Monday, February 16, 2015
+ *
+ * Purpose: Tests datasets with virtual layout.
+ */
+#include "h5test.h"
+
+const char *FILENAME[] = {
+ "vds_env_virt_0",
+ "vds_env_virt_3",
+ "vds_env_src_2",
+ "vds_env%%_src2",
+ NULL
+};
+
+/* I/O test config flags */
+#define TEST_IO_CLOSE_SRC 0x01u
+#define TEST_IO_DIFFERENT_FILE 0x02u
+#define TEST_IO_REOPEN_VIRT 0x04u
+#define TEST_IO_NTESTS 0x08u
+
+#define FILENAME_BUF_SIZE 1024
+
+#define TMPDIR "tmp/"
+
+/*-------------------------------------------------------------------------
+ * Function: test_vds_prefix_second
+ *
+ * Purpose: Set up vds link prefix via H5Pset_virtual_prefix() to be "tmp"
+ * Should be able to access the target source files in tmp directory via the prefix set
+ * by H5Pset_virtual_prefix()
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+test_vds_prefix_second(unsigned config, hid_t fapl)
+{
+ char srcfilename[FILENAME_BUF_SIZE];
+ char srcfilename_map[FILENAME_BUF_SIZE];
+ char vfilename[FILENAME_BUF_SIZE];
+ char vfilename2[FILENAME_BUF_SIZE];
+ char srcfilenamepct[FILENAME_BUF_SIZE];
+ char srcfilenamepct_map[FILENAME_BUF_SIZE];
+ const char *srcfilenamepct_map_orig = "vds%%%%_src";
+ hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
+ hid_t vfile = -1; /* File with virtual dset */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t dapl = -1; /* Dataset access property list */
+ hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
+ hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */
+ hid_t memspace = -1; /* Memory dataspace */
+ hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */
+ hid_t vdset = -1; /* Virtual dataset */
+ hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */
+ int buf[10][26]; /* Write and expected read buffer */
+ int rbuf[10][26]; /* Read buffer */
+ int fill = -1; /* Fill value */
+ int i, j;
+ char buffer[1024]; /* buffer to read vds_prefix */
+
+ TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection with ENV prefix")
+
+ h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename);
+ h5_fixname(FILENAME[1], fapl, vfilename2, sizeof vfilename2);
+ h5_fixname(FILENAME[2], fapl, srcfilename, sizeof srcfilename);
+ h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map);
+ h5_fixname(FILENAME[3], fapl, srcfilenamepct, sizeof srcfilenamepct);
+ h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map);
+
+ /* create tmp directory and get current working directory path */
+ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
+ TEST_ERROR
+
+ /* Create DCPL */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+
+ /* Set fill value */
+ if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
+ TEST_ERROR
+
+ /* Set prefix to a nonexistent directory, will be overwritten by environment variable */
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ TEST_ERROR
+
+ if(H5Pset_virtual_prefix(dapl, "someprefix") < 0)
+ TEST_ERROR
+ if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0)
+ TEST_ERROR
+
+ if(HDstrcmp(buffer, "someprefix") != 0)
+ FAIL_PUTS_ERROR("vds prefix not set correctly");
+
+ /* Create source dataspace */
+ if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspace */
+ if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select all (should not be necessary, but just to be sure) */
+ if(H5Sselect_all(srcspace[0]) < 0)
+ TEST_ERROR
+ if(H5Sselect_all(vspace[0]) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mapping */
+ if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Create virtual file */
+ if((vfile = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create source file if requested */
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ HDgetcwd(buffer, 1024);
+ HDchdir(TMPDIR);
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ HDchdir(buffer);
+ }
+ else {
+ srcfile[0] = vfile;
+ if(H5Iinc_ref(srcfile[0]) < 0)
+ TEST_ERROR
+ }
+
+ /* Create source dataset */
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataset */
+ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ TEST_ERROR
+
+ /* Populate write buffer */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
+
+ /* Write data directly to source dataset */
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Close srcdset and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+ }
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ }
+
+ /* Read data through virtual dataset */
+ HDmemset(rbuf[0], 0, sizeof(rbuf));
+ if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) {
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if(rbuf[i][j] != buf[i][j]) {
+ TEST_ERROR
+ }
+ }
+
+ /* Adjust write buffer */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
+
+ /* Write data through virtual dataset */
+ if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Reopen srcdset and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ HDgetcwd(buffer, 1024);
+ HDchdir(TMPDIR);
+ if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
+ HDchdir(buffer);
+ }
+ if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ }
+
+ /* Read data directly from source dataset */
+ HDmemset(rbuf[0], 0, sizeof(rbuf));
+ if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if(rbuf[i][j] != buf[i][j])
+ TEST_ERROR
+
+ /* Close */
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if(H5Sclose(srcspace[0]) < 0)
+ TEST_ERROR
+ srcspace[0] = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
+ if(H5Pclose(dapl) < 0)
+ TEST_ERROR
+ dapl = -1;
+ if(H5Pclose(dcpl) < 0)
+ TEST_ERROR
+ dcpl = -1;
+
+ PASSED();
+ return 0;
+
+ error:
+ H5E_BEGIN_TRY {
+ for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++)
+ H5Dclose(srcdset[i]);
+ H5Dclose(vdset);
+ for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++)
+ H5Fclose(srcfile[i]);
+ H5Fclose(vfile);
+ for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++)
+ H5Sclose(srcspace[i]);
+ for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
+ H5Sclose(vspace[i]);
+ H5Sclose(memspace);
+ H5Pclose(dapl);
+ H5Pclose(dcpl);
+ } H5E_END_TRY;
+
+ return 1;
+} /* end test_vds_prefix2 */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Tests datasets with virtual layout
+ *
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ hid_t fapl, my_fapl;
+ unsigned bit_config;
+ H5F_libver_t low, high; /* Low and high bounds */
+ unsigned latest = FALSE; /* Using the latest library version bound */
+ int nerrors = 0;
+
+ /* Testing setup */
+ h5_reset();
+ fapl = h5_fileaccess();
+
+ /* Set to use the latest file format */
+ if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Loop through all the combinations of low/high version bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ char msg[80]; /* Message for file version bounds */
+ char *low_string; /* The low bound string */
+ char *high_string; /* The high bound string */
+
+ /* Invalid combinations, just continue */
+ if(high == H5F_LIBVER_EARLIEST || high < low)
+ continue;
+
+ /* Test virtual dataset only for V110 and above */
+ if(high < H5F_LIBVER_V110)
+ continue;
+
+ /* Whether to use latest hyperslab/point selection version */
+ if(low >= H5F_LIBVER_V112)
+ latest = TRUE;
+
+ /* Set the low/high version bounds */
+ if(H5Pset_libver_bounds(my_fapl, low, high) < 0)
+ TEST_ERROR
+
+ /* Display testing info */
+ low_string = h5_get_version_string(low);
+ high_string = h5_get_version_string(high);
+ HDsprintf(msg, "Testing virtual dataset with file version bounds: (%s, %s):", low_string, high_string);
+ HDputs(msg);
+
+ for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) {
+ HDprintf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : "");
+ nerrors += test_vds_prefix_second(bit_config, fapl);
+ }
+
+ /* Verify symbol table messages are cached */
+ nerrors += (h5_verify_cached_stabs(FILENAME, my_fapl) < 0 ? 1 : 0);
+
+ } /* end for high */
+ } /* end for low */
+
+ if(H5Pclose(my_fapl) < 0)
+ TEST_ERROR
+
+ if(nerrors)
+ goto error;
+ HDprintf("All virtual dataset tests passed.\n");
+ h5_cleanup(FILENAME, fapl);
+
+ return EXIT_SUCCESS;
+
+error:
+ nerrors = MAX(1, nerrors);
+ HDprintf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n",
+ nerrors, 1 == nerrors ? "" : "S");
+ return EXIT_FAILURE;
+} /* end main() */
diff --git a/test/vol.c b/test/vol.c
index e267084..3f6afaa 100644
--- a/test/vol.c
+++ b/test/vol.c
@@ -61,6 +61,7 @@ static const H5VL_class_t fake_vol_g = {
NULL, /* get_object */
NULL, /* get_wrap_ctx */
NULL, /* wrap_object */
+ NULL, /* unwrap_object */
NULL, /* free_wrap_ctx */
},
{ /* attribute_cls */
diff --git a/testpar/Makefile.am b/testpar/Makefile.am
index a11099d..0e7898e 100644
--- a/testpar/Makefile.am
+++ b/testpar/Makefile.am
@@ -42,6 +42,11 @@ testphdf5_SOURCES=testphdf5.c t_dset.c t_file.c t_file_image.c t_mdset.c \
# The tests all depend on the hdf5 library and the test library
LDADD = $(LIBH5TEST) $(LIBHDF5)
+# 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={}}"
+
# Temporary files
# MPItest.h5 is from t_mpi
# Para*.h5 are from testphdf
diff --git a/testpar/t_cache.c b/testpar/t_cache.c
index 41c95e2..50e6d50 100644
--- a/testpar/t_cache.c
+++ b/testpar/t_cache.c
@@ -24,6 +24,7 @@
#include "H5ACpkg.h"
#include "H5Cpkg.h"
+#include "H5CXprivate.h"
#include "H5Fpkg.h"
#include "H5Iprivate.h"
#include "H5MFprivate.h"
diff --git a/testpar/t_prop.c b/testpar/t_prop.c
index d5efa94..2eb3914 100644
--- a/testpar/t_prop.c
+++ b/testpar/t_prop.c
@@ -33,12 +33,12 @@ test_encode_decode(hid_t orig_pl, int mpi_rank, int recv_proc)
int send_size = 0;
/* first call to encode returns only the size of the buffer needed */
- ret = H5Pencode(orig_pl, NULL, &buf_size);
+ ret = H5Pencode2(orig_pl, NULL, &buf_size, H5P_DEFAULT);
VRFY((ret >= 0), "H5Pencode succeeded");
sbuf = (uint8_t *)HDmalloc(buf_size);
- ret = H5Pencode(orig_pl, sbuf, &buf_size);
+ ret = H5Pencode2(orig_pl, sbuf, &buf_size, H5P_DEFAULT);
VRFY((ret >= 0), "H5Pencode succeeded");
/* this is a temp fix to send this size_t */
diff --git a/tools/Makefile.am b/tools/Makefile.am
index b0c33ed..c53ecd6 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -24,4 +24,9 @@ CONFIG=ordered
# All subdirectories
SUBDIRS=lib src test
+# 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={}}"
+
include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake
index 16dbc4d..4393e8d 100644
--- a/tools/test/h5dump/CMakeTests.cmake
+++ b/tools/test/h5dump/CMakeTests.cmake
@@ -668,7 +668,7 @@
endif ()
endmacro ()
- macro (ADD_H5ERR_MASK_TEST resultfile resultcode)
+ macro (ADD_H5ERR_MASK_TEST resultfile resultcode result_errcheck)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
# Remove any output file left over from previous test run
add_test (
@@ -688,15 +688,14 @@
-D "TEST_OUTPUT=${resultfile}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=${resultfile}.ddl"
- -D "TEST_ERRREF=${resultfile}.err"
- -D "TEST_MASK_ERROR=true"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ -D "TEST_ERRREF=${result_errcheck}"
+ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
)
- set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects")
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects")
endif ()
endmacro ()
- macro (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode envvar envval)
+ macro (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode result_errcheck envvar envval)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
# Remove any output file left over from previous test run
add_test (
@@ -716,11 +715,10 @@
-D "TEST_OUTPUT=${resultfile}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=${resultfile}.ddl"
- -D "TEST_ERRREF=${resultfile}.err"
- -D "TEST_MASK_ERROR=true"
+ -D "TEST_ERRREF=${result_errcheck}"
-D "TEST_ENV_VAR:STRING=${envvar}"
-D "TEST_ENV_VALUE:STRING=${envval}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
)
set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects")
endif ()
@@ -1199,12 +1197,12 @@
# test for displaying groups
ADD_H5_TEST (tgroup-1 0 --enable-error-stack tgroup.h5)
# test for displaying the selected groups
- ADD_H5ERR_MASK_TEST (tgroup-2 1 --enable-error-stack --group=/g2 --group / -g /y tgroup.h5)
+ ADD_H5ERR_MASK_TEST (tgroup-2 1 "h5dump error: unable to open group \"/y\"" --enable-error-stack --group=/g2 --group / -g /y tgroup.h5)
# test for displaying simple space datasets
ADD_H5_TEST (tdset-1 0 --enable-error-stack tdset.h5)
# test for displaying selected datasets
- ADD_H5ERR_MASK_TEST (tdset-2 1 --enable-error-stack -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5)
+ ADD_H5ERR_MASK_TEST (tdset-2 1 "h5dump error: unable to get link info from \"dset3\"" --enable-error-stack -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5)
# test for displaying attributes
ADD_H5_TEST (tattr-1 0 --enable-error-stack tattr.h5)
@@ -1212,7 +1210,7 @@
ADD_H5_TEST (tattr-2 0 --enable-error-stack -a /\\\\/attr1 --attribute /attr4 --attribute=/attr5 tattr.h5)
ADD_H5_TEST_N (tattr-2 0 --enable-error-stack -N /\\\\/attr1 --any_path /attr4 --any_path=/attr5 tattr.h5)
# test for header and error messages
- ADD_H5ERR_MASK_TEST (tattr-3 1 --enable-error-stack --header -a /attr2 --attribute=/attr tattr.h5)
+ ADD_H5ERR_MASK_TEST (tattr-3 1 "h5dump error: unable to open attribute \"attr\"" --enable-error-stack --header -a /attr2 --attribute=/attr tattr.h5)
# test for displaying at least 9 attributes on root from a be machine
ADD_H5_TEST (tattr-4_be 0 --enable-error-stack tattr4_be.h5)
# test for displaying attributes in shared datatype (also in group and dataset)
@@ -1226,7 +1224,7 @@
ADD_H5_TEST_N (tslink-2 0 --enable-error-stack -N slink2 tslink.h5)
ADD_H5_TEST (tudlink-2 0 --enable-error-stack -l udlink2 tudlink.h5)
# test for displaying dangling soft links
- ADD_H5ERR_MASK_TEST (tslink-D 0 --enable-error-stack -d /slink1 tslink.h5)
+ ADD_H5ERR_MASK_TEST (tslink-D 0 "component not found" --enable-error-stack -d /slink1 tslink.h5)
# tests for hard links
ADD_H5_TEST (thlink-1 0 --enable-error-stack thlink.h5)
@@ -1243,7 +1241,7 @@
ADD_H5_TEST (tcomp-2 0 --enable-error-stack -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5)
ADD_H5_TEST_N (tcomp-2 0 --enable-error-stack -N /type1 --any_path /type2 --any_path=/group1/type3 tcompound.h5)
# test for unamed type
- ADD_H5ERR_MASK_TEST (tcomp-3 0 "--enable-error-stack;-t;/#6632;-g;/group2;tcompound.h5")
+ ADD_H5ERR_MASK_TEST (tcomp-3 0 "object '#6632' doesn't exist" "--enable-error-stack;-t;/#6632;-g;/group2;tcompound.h5")
# test complicated compound datatype
ADD_H5_TEST (tcomp-4 0 --enable-error-stack tcompound_complex.h5)
ADD_H5_TEST (tcompound_complex2 0 --enable-error-stack tcompound_complex2.h5)
@@ -1259,7 +1257,7 @@
ADD_H5_TEST (tnestedcmpddt 0 --enable-error-stack tnestedcmpddt.h5)
# test for options
- ADD_H5ERR_MASK_TEST (tall-1 0 --enable-error-stack tall.h5)
+ ADD_H5ERR_MASK_TEST (tall-1 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack tall.h5)
ADD_H5_TEST (tall-2 0 --enable-error-stack --header -g /g1/g1.1 -a attr2 tall.h5)
ADD_H5_TEST (tall-3 0 --enable-error-stack -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5)
ADD_H5_TEST_N (tall-3 0 --enable-error-stack -N /g2/dset2.1 -N /g1/g1.2/g1.2.1/slink tall.h5)
@@ -1290,7 +1288,7 @@
# test for files with array data
ADD_H5_TEST (tarray1 0 --enable-error-stack tarray1.h5)
# # added for bug# 2092 - tarray1_big.h5
- ADD_H5ERR_MASK_TEST (tarray1_big 0 --enable-error-stack -R tarray1_big.h5)
+ ADD_H5ERR_MASK_TEST (tarray1_big 0 "Undefined reference pointer" --enable-error-stack -R tarray1_big.h5)
ADD_H5_TEST (tarray2 0 --enable-error-stack tarray2.h5)
ADD_H5_TEST (tarray3 0 --enable-error-stack tarray3.h5)
ADD_H5_TEST (tarray4 0 --enable-error-stack tarray4.h5)
@@ -1319,13 +1317,13 @@
ADD_H5_TEST (tlarge_objname 0 --enable-error-stack -w157 tlarge_objname.h5)
# test '-A' to suppress data but print attr's
- ADD_H5ERR_MASK_TEST (tall-2A 0 --enable-error-stack -A tall.h5)
+ ADD_H5ERR_MASK_TEST (tall-2A 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack -A tall.h5)
# test '-A' to suppress attr's but print data
- ADD_H5ERR_MASK_TEST (tall-2A0 0 --enable-error-stack -A 0 tall.h5)
+ ADD_H5ERR_MASK_TEST (tall-2A0 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack -A 0 tall.h5)
# test '-r' to print attributes in ASCII instead of decimal
- ADD_H5ERR_MASK_TEST (tall-2B 0 --enable-error-stack -A -r tall.h5)
+ ADD_H5ERR_MASK_TEST (tall-2B 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack -A -r tall.h5)
# test Subsetting
ADD_H5_TEST (tall-4s 0 --enable-error-stack --dataset=/g1/g1.1/dset1.1.1 --start=1,1 --stride=2,3 --count=3,2 --block=1,1 tall.h5)
@@ -1354,7 +1352,7 @@
ADD_H5_TEST (file_space 0 --enable-error-stack -B file_space.h5)
# test -p with a non existing dataset
- ADD_H5ERR_MASK_TEST (tperror 1 --enable-error-stack -p -d bogus tfcontents1.h5)
+ ADD_H5ERR_MASK_TEST (tperror 1 "h5dump error: unable to get link info from \"bogus\"" --enable-error-stack -p -d bogus tfcontents1.h5)
# test for file contents
ADD_H5_TEST (tcontents 0 --enable-error-stack -n tfcontents1.h5)
@@ -1501,9 +1499,9 @@
# test for dataset region references
ADD_H5_TEST (tdatareg 0 --enable-error-stack tdatareg.h5)
- ADD_H5ERR_MASK_TEST (tdataregR 0 --enable-error-stack -R tdatareg.h5)
+ ADD_H5ERR_MASK_TEST (tdataregR 0 "Undefined reference pointer" --enable-error-stack -R tdatareg.h5)
ADD_H5_TEST (tattrreg 0 --enable-error-stack tattrreg.h5)
- ADD_H5ERR_MASK_TEST (tattrregR 0 -R --enable-error-stack tattrreg.h5)
+ ADD_H5ERR_MASK_TEST (tattrregR 0 "Undefined reference pointer" -R --enable-error-stack tattrreg.h5)
ADD_H5_EXPORT_TEST (tbinregR tdatareg.h5 0 --enable-error-stack -d /Dataset1 -s 0 -R -y -o)
# tests for group creation order
@@ -1521,21 +1519,21 @@
ADD_H5_TEST (torderattr4 0 --enable-error-stack -H --sort_by=creation_order --sort_order=descending torderattr.h5)
# tests for link references and order
- ADD_H5ERR_MASK_TEST (torderlinks1 0 --enable-error-stack --sort_by=name --sort_order=ascending tfcontents1.h5)
- ADD_H5ERR_MASK_TEST (torderlinks2 0 --enable-error-stack --sort_by=name --sort_order=descending tfcontents1.h5)
+ ADD_H5ERR_MASK_TEST (torderlinks1 0 "unable to open external file, external link file name = 'fname'" --enable-error-stack --sort_by=name --sort_order=ascending tfcontents1.h5)
+ ADD_H5ERR_MASK_TEST (torderlinks2 0 "unable to open external file, external link file name = 'fname'" --enable-error-stack --sort_by=name --sort_order=descending tfcontents1.h5)
# tests for floating point user defined printf format
ADD_H5_TEST (tfpformat 0 --enable-error-stack -m %.7f tfpformat.h5)
# tests for traversal of external links
- ADD_H5ERR_MASK_TEST (textlinksrc 0 --enable-error-stack textlinksrc.h5)
- ADD_H5ERR_MASK_TEST (textlinkfar 0 --enable-error-stack textlinkfar.h5)
+ ADD_H5ERR_MASK_TEST (textlinksrc 0 "Too many soft links in path" --enable-error-stack textlinksrc.h5)
+ ADD_H5ERR_MASK_TEST (textlinkfar 0 "Too many soft links in path" --enable-error-stack textlinkfar.h5)
# test for dangling external links
- ADD_H5ERR_MASK_TEST (textlink 0 --enable-error-stack textlink.h5)
+ ADD_H5ERR_MASK_TEST (textlink 0 "unable to open external file, external link file name = 'anotherfile'" --enable-error-stack textlink.h5)
# test for error stack display (BZ2048)
- ADD_H5ERR_MASK_ENV_TEST (filter_fail 1 "HDF5_PLUGIN_PRELOAD" "::" --enable-error-stack filter_fail.h5)
+ ADD_H5ERR_MASK_ENV_TEST (filter_fail 1 "filter plugins disabled" "HDF5_PLUGIN_PRELOAD" "::" --enable-error-stack filter_fail.h5)
# test for -o -y for dataset with attributes
ADD_H5_TEST_EXPORT (tall-6 tall.h5 0 --enable-error-stack -d /g1/g1.1/dset1.1.1 -y -o)
diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in
index af5d547..e1c02cf 100644
--- a/tools/test/h5dump/testh5dump.sh.in
+++ b/tools/test/h5dump/testh5dump.sh.in
@@ -40,7 +40,9 @@ LS='ls'
AWK='awk'
# Skip plugin module to test missing filter
-ENVCMD="env HDF5_PLUGIN_PRELOAD=::"
+# Also reset the VOL connector to only use the native connector, because of the
+# error stack checking. QAK - 2019/03/09
+ENVCMD="env HDF5_PLUGIN_PRELOAD=:: HDF5_VOL_CONNECTOR=native"
WORDS_BIGENDIAN="@WORDS_BIGENDIAN@"
@@ -754,7 +756,7 @@ TOOLTEST4() {
TESTING $DUMPER $@
(
cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ $ENVCMD $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake
index 5599c1b..718a877 100644
--- a/tools/test/h5format_convert/CMakeTests.cmake
+++ b/tools/test/h5format_convert/CMakeTests.cmake
@@ -186,7 +186,7 @@
endif ()
endmacro ()
- macro (ADD_H5_MASK_OUTPUT testname resultfile resultcode testfile)
+ macro (ADD_H5_MASK_OUTPUT testname resultfile resultcode result_errcheck testfile)
# If using memchecker add tests without using scripts
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -215,9 +215,8 @@
-D "TEST_OUTPUT=${testname}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=${resultfile}"
- -D "TEST_ERRREF=${resultfile}.err"
- -D "TEST_MASK_ERROR=true"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ -D "TEST_ERRREF=${result_errcheck}"
+ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
)
set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile")
set (last_test "H5FC-${testname}-${testfile}")
@@ -475,7 +474,7 @@
#
#
# h5format_convert -v h5fc_err_level.h5 (error encountered in converting the dataset)
- ADD_H5_MASK_OUTPUT (h5fc_v_err h5fc_v_err.ddl 1 h5fc_err_level.h5 -v)
+ ADD_H5_MASK_OUTPUT (h5fc_v_err h5fc_v_err.ddl 1 "h5format_convert error: unable to downgrade dataset \"/DSET_ERR\"" h5fc_err_level.h5 -v)
#
#
#
diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake
index 2ad12ad..7dbf2a1 100644
--- a/tools/test/h5repack/CMakeTests.cmake
+++ b/tools/test/h5repack/CMakeTests.cmake
@@ -304,7 +304,7 @@
endif ()
endmacro ()
- macro (ADD_H5_MASK_TEST testname testtype resultcode resultfile)
+ macro (ADD_H5_MASK_TEST testname testtype resultcode result_errcheck resultfile)
if ("${testtype}" STREQUAL "SKIP")
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -343,10 +343,10 @@
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}-${testname}.out"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_MASK_ERROR=true"
+ -D "TEST_SKIP_COMPARE=true"
-D "TEST_REFERENCE=${resultfile}.mty"
- -D "TEST_ERRREF=${resultfile}-${testname}.tst"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ -D "TEST_ERRREF=${result_errcheck}"
+ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
)
set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS H5REPACK_MASK-${testname}-clear-objects)
endif ()
@@ -1222,7 +1222,7 @@
ADD_H5_VERIFY_TEST (conti "TEST" 1 ${FILE4} null CONTIGUOUS -l CONTI)
ADD_H5_VERIFY_TEST (dset2_compa "TEST" 0 ${FILE4} dset2 COMPACT -l dset2:COMPA)
ADD_H5_VERIFY_TEST (compa "TEST" 1 ${FILE4} null COMPACT -l COMPA)
- ADD_H5_MASK_TEST (dset2_chunk_20x10-errstk "TEST" 0 ${FILE4} --layout=dset2:CHUNK=20x10x5 --enable-error-stack)
+ ADD_H5_MASK_TEST (dset2_chunk_20x10-errstk "TEST" 0 "dimensionality of chunks doesn't match the dataspace" ${FILE4} --layout=dset2:CHUNK=20x10x5 --enable-error-stack)
################################################################
# layout conversions (file has no filters)
diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in
index a36eb08..282ba76 100644
--- a/tools/test/h5repack/h5repack.sh.in
+++ b/tools/test/h5repack/h5repack.sh.in
@@ -48,6 +48,10 @@ DIRNAME='dirname'
LS='ls'
AWK='awk'
+# Reset the VOL connector to only use the native connector, because of the
+# error stack checking. QAK - 2019/03/09
+ENVCMD="env HDF5_VOL_CONNECTOR=native"
+
H5DETECTSZIP=testh5repack_detect_szip
H5DETECTSZIP_BIN=`pwd`/$H5DETECTSZIP
@@ -284,7 +288,7 @@ TOOLTEST()
TESTING $H5REPACK $@
(
cd $TESTDIR
- $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ $ENVCMD $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
)
RET=$?
if [ $RET != 0 ] ; then
@@ -716,7 +720,7 @@ TOOLTESTM() {
TESTING $H5REPACK $@
(
cd $TESTDIR
- $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ $ENVCMD $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
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 1d2914b..cbf8164 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 4 }
+ PARAMS { 9 1 11 5 }
}
}
FILLVALUE {
@@ -33,7 +33,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 4 }
+ PARAMS { 9 1 11 5 }
}
}
FILLVALUE {
@@ -55,7 +55,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 4 }
+ PARAMS { 9 1 11 5 }
}
}
FILLVALUE {
@@ -77,7 +77,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 4 }
+ PARAMS { 9 1 11 5 }
}
}
FILLVALUE {
@@ -99,7 +99,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 4 }
+ PARAMS { 9 1 11 5 }
}
}
FILLVALUE {
@@ -121,7 +121,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 4 }
+ PARAMS { 9 1 11 5 }
}
}
FILLVALUE {
@@ -143,7 +143,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 4 }
+ PARAMS { 9 1 11 5 }
}
}
FILLVALUE {
diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c
index 1c0d621..43a0f64 100644
--- a/tools/test/perform/pio_engine.c
+++ b/tools/test/perform/pio_engine.c
@@ -82,6 +82,12 @@
/* POSIX I/O macros */
+#ifdef H5_HAVE_WIN32_API
+/* Can't link against the library, so this test will use the older, non-Unicode
+ * _open() call on Windows.
+ */
+#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__)
+#endif /* H5_HAVE_WIN32_API */
#define POSIXCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600)
#define POSIXOPEN(fn, F) HDopen(fn, F, 0600)
#define POSIXCLOSE(F) HDclose(F)
diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c
index 4fead3f..11de229 100644
--- a/tools/test/perform/sio_engine.c
+++ b/tools/test/perform/sio_engine.c
@@ -54,6 +54,12 @@
} while(0)
/* POSIX I/O macros */
+#ifdef H5_HAVE_WIN32_API
+/* Can't link against the library, so this test will use the older, non-Unicode
+ * _open() call on Windows.
+ */
+#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__)
+#endif /* H5_HAVE_WIN32_API */
#define POSIXCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600)
#define POSIXOPEN(fn, F) HDopen(fn, F, 0600)
#define POSIXCLOSE(F) HDclose(F)