summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST1
-rw-r--r--c++/examples/run-c++-ex.sh.in2
-rw-r--r--config/cmake/CTestScript.cmake6
-rw-r--r--config/cmake/HDF5_Examples.cmake.in3
-rw-r--r--config/cmake/hdf5-config.cmake.in1
-rw-r--r--config/cmake/scripts/CTestScript.cmake12
-rw-r--r--config/cmake/scripts/HDF5config.cmake18
-rw-r--r--config/cmake_ext_mod/HDFMacros.cmake8
-rw-r--r--config/cmake_ext_mod/HDFUseFortran.cmake4
-rw-r--r--config/commence.am2
-rw-r--r--config/gnu-flags98
-rw-r--r--config/toolchain/clang.cmake4
-rw-r--r--configure.ac4
-rw-r--r--examples/run-c-ex.sh.in2
-rw-r--r--fortran/examples/run-fortran-ex.sh.in2
-rw-r--r--hl/c++/examples/run-hlc++-ex.sh.in2
-rw-r--r--hl/examples/run-hlc-ex.sh.in2
-rw-r--r--hl/src/H5DS.c4
-rw-r--r--hl/test/H5srcdir_str.h.in2
-rw-r--r--release_docs/INSTALL_CMake.txt14
-rw-r--r--release_docs/RELEASE.txt39
-rw-r--r--release_docs/USING_CMake_Examples.txt2
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/H5Aint.c4
-rw-r--r--src/H5CX.c222
-rw-r--r--src/H5CXprivate.h8
-rw-r--r--src/H5Cdbg.c5
-rw-r--r--src/H5Cpkg.h2
-rw-r--r--src/H5D.c3
-rw-r--r--src/H5Dchunk.c40
-rw-r--r--src/H5Dcompact.c2
-rw-r--r--src/H5Dcontig.c2
-rw-r--r--src/H5Dint.c4
-rw-r--r--src/H5Dio.c2
-rw-r--r--src/H5Dvirtual.c10
-rw-r--r--src/H5F.c26
-rw-r--r--src/H5FDhdfs.c1
-rw-r--r--src/H5FDlog.c4
-rw-r--r--src/H5FSsection.c10
-rw-r--r--src/H5Fefc.c12
-rw-r--r--src/H5Fint.c42
-rw-r--r--src/H5Fpkg.h2
-rw-r--r--src/H5Fprivate.h5
-rw-r--r--src/H5Fquery.c20
-rw-r--r--src/H5Fsuper_cache.c26
-rw-r--r--src/H5G.c3
-rw-r--r--src/H5HFcache.c8
-rw-r--r--src/H5HFtiny.c2
-rw-r--r--src/H5HGcache.c8
-rw-r--r--src/H5L.c31
-rw-r--r--src/H5Lexternal.c5
-rw-r--r--src/H5O.c5
-rw-r--r--src/H5Oattr.c2
-rw-r--r--src/H5Oattribute.c4
-rw-r--r--src/H5Ocopy.c3
-rw-r--r--src/H5Ocopy_ref.c2
-rw-r--r--src/H5Odtype.c4
-rw-r--r--src/H5Oint.c15
-rw-r--r--src/H5Pmapl.c3
-rw-r--r--src/H5Rint.c11
-rw-r--r--src/H5Rpublic.h8
-rw-r--r--src/H5SL.c4
-rw-r--r--src/H5SM.c4
-rw-r--r--src/H5Sall.c33
-rw-r--r--src/H5Shyper.c380
-rw-r--r--src/H5Smpio.c28
-rw-r--r--src/H5Snone.c33
-rw-r--r--src/H5Spkg.h34
-rw-r--r--src/H5Spoint.c122
-rw-r--r--src/H5Sprivate.h6
-rw-r--r--src/H5Spublic.h5
-rw-r--r--src/H5Sselect.c159
-rw-r--r--src/H5T.c78
-rw-r--r--src/H5Tcommit.c9
-rw-r--r--src/H5Tconv.c30
-rw-r--r--src/H5Tpkg.h28
-rw-r--r--src/H5Tprivate.h7
-rw-r--r--src/H5Tref.c235
-rw-r--r--src/H5Tvlen.c176
-rw-r--r--src/H5VL.c101
-rw-r--r--src/H5VLcallback.c46
-rw-r--r--src/H5VLconnector.h14
-rw-r--r--src/H5VLconnector_passthru.h2
-rw-r--r--src/H5VLint.c101
-rw-r--r--src/H5VLnative_blob.c11
-rw-r--r--src/H5VLnative_file.c9
-rw-r--r--src/H5VLnative_link.c5
-rw-r--r--src/H5VLnative_private.h2
-rw-r--r--src/H5VLpassthru.c6
-rw-r--r--src/H5VLpkg.h1
-rw-r--r--src/H5VLprivate.h7
-rw-r--r--src/H5private.h2
-rw-r--r--src/libhdf5.settings.in2
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/H5srcdir.c61
-rw-r--r--test/H5srcdir.h39
-rw-r--r--test/H5srcdir_str.h.in2
-rw-r--r--test/Makefile.am8
-rw-r--r--test/cache.c2
-rw-r--r--test/cache_common.c2
-rw-r--r--test/cache_tagging.c2
-rw-r--r--test/del_many_dense_attrs.c2
-rw-r--r--test/dsets.c152
-rw-r--r--test/dt_arith.c34
-rw-r--r--test/fillval.c5
-rw-r--r--test/null_vol_connector.c6
-rw-r--r--test/objcopy_ref.c8
-rw-r--r--test/swmr_sparse_reader.c4
-rw-r--r--test/tid.c25
-rw-r--r--test/trefer.c271
-rw-r--r--test/trefer_deprec.c2
-rw-r--r--test/tvlstr.c4
-rw-r--r--test/vds_swmr.h24
-rw-r--r--test/vds_swmr_common.c36
-rw-r--r--tools/lib/h5diff.c3
-rw-r--r--tools/lib/h5diff_array.c4
-rw-r--r--tools/lib/h5tools_utils.c2
-rw-r--r--tools/src/h5import/h5import.c2
-rw-r--r--tools/src/h5repack/h5repack_main.c14
-rw-r--r--tools/test/h5repack/h5repackgentest.c1
120 files changed, 2253 insertions, 944 deletions
diff --git a/MANIFEST b/MANIFEST
index a1b3b4a..73fb1ef 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -136,6 +136,7 @@
./config/linux-gnulibc2
./config/lt_vers.am
./config/Makefile.am.blank
+./config/netbsd
./config/pgi-fflags
./config/pgi-flags
./config/solaris
diff --git a/c++/examples/run-c++-ex.sh.in b/c++/examples/run-c++-ex.sh.in
index 08e9633..03e1eac 100644
--- a/c++/examples/run-c++-ex.sh.in
+++ b/c++/examples/run-c++-ex.sh.in
@@ -47,7 +47,7 @@ prefix=@prefix@
examplesdir=@examplesdir@
if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then
echo $(echo ${examplesdir##${prefix}/} | \
- sed -E 's,[^/]+,..,g')
+ sed 's,[^/][^/]*,..,g')
else
echo $prefix
fi
diff --git a/config/cmake/CTestScript.cmake b/config/cmake/CTestScript.cmake
index e819e58..e914c4d 100644
--- a/config/cmake/CTestScript.cmake
+++ b/config/cmake/CTestScript.cmake
@@ -119,8 +119,12 @@ set(CTEST_CONFIGURE_TOOLSET "")
if(CMAKE_GENERATOR_TOOLSET)
set(CTEST_CONFIGURE_TOOLSET "-T${CMAKE_GENERATOR_TOOLSET}")
endif()
+set(CTEST_CONFIGURE_ARCHITECTURE "")
+if(CMAKE_GENERATOR_ARCHITECTURE)
+ set(CTEST_CONFIGURE_ARCHITECTURE "-A${CMAKE_GENERATOR_ARCHITECTURE}")
+endif()
set (CTEST_CONFIGURE_COMMAND
- "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
+ "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_ARCHITECTURE}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
)
#-----------------------------------------------------------------------------
diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in
index 042b17b..4755ec8 100644
--- a/config/cmake/HDF5_Examples.cmake.in
+++ b/config/cmake/HDF5_Examples.cmake.in
@@ -20,6 +20,9 @@ set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
if("@CMAKE_GENERATOR_TOOLSET@")
set(CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@")
endif()
+if("@CMAKE_GENERATOR_ARCHITECTURE@")
+ set(CMAKE_GENERATOR_ARCHITECTURE "@CMAKE_GENERATOR_ARCHITECTURE@")
+endif()
set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY})
# handle input parameters to script.
diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in
index afb2a5c..b5a12a6 100644
--- a/config/cmake/hdf5-config.cmake.in
+++ b/config/cmake/hdf5-config.cmake.in
@@ -46,6 +46,7 @@ set (${HDF5_PACKAGE_NAME}_BUILD_SHARED_LIBS @H5_ENABLE_SHARED_LIB@)
set (${HDF5_PACKAGE_NAME}_BUILD_STATIC_LIBS @H5_ENABLE_STATIC_LIB@)
set (${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS @HDF5_PACKAGE_EXTLIBS@)
set (${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES @HDF5_LIBRARIES_TO_EXPORT@)
+set (${HDF5_PACKAGE_NAME}_ARCHITECTURE "@CMAKE_GENERATOR_ARCHITECTURE@")
set (${HDF5_PACKAGE_NAME}_TOOLSET "@CMAKE_GENERATOR_TOOLSET@")
set (${HDF5_PACKAGE_NAME}_DEFAULT_API_VERSION "@DEFAULT_API_VERSION@")
set (${HDF5_PACKAGE_NAME}_PARALLEL_FILTERED_WRITES "@PARALLEL_FILTERED_WRITES@")
diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake
index dc3939e..febe109 100644
--- a/config/cmake/scripts/CTestScript.cmake
+++ b/config/cmake/scripts/CTestScript.cmake
@@ -195,20 +195,28 @@ if (CMAKE_GENERATOR_TOOLSET)
else ()
set (CTEST_CONFIGURE_TOOLSET "")
endif()
+if (CMAKE_GENERATOR_ARCHITECTURE)
+ set (CTEST_CONFIGURE_ARCHITECTURE "-A${CMAKE_GENERATOR_ARCHITECTURE}")
+else ()
+ set (CTEST_CONFIGURE_ARCHITECTURE "")
+endif()
if (LOCAL_MEMCHECK_TEST)
find_program (CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
set (CTEST_CONFIGURE_COMMAND
- "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
+ "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_ARCHITECTURE}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
)
else ()
if (LOCAL_COVERAGE_TEST)
find_program (CTEST_COVERAGE_COMMAND NAMES gcov)
endif ()
set (CTEST_CONFIGURE_COMMAND
- "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
+ "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_ARCHITECTURE}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
)
endif ()
+set(CTEST_USE_LAUNCHERS 1)
+set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} 1)
+
#-----------------------------------------------------------------------------
## -- set output to english
set ($ENV{LC_MESSAGES} "en_EN")
diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake
index ad5fbdc..775fb37 100644
--- a/config/cmake/scripts/HDF5config.cmake
+++ b/config/cmake/scripts/HDF5config.cmake
@@ -22,6 +22,8 @@ cmake_minimum_required (VERSION 3.10)
# where valid options for OPTION are:
# BUILD_GENERATOR - The cmake build generator:
# Unix * Unix Makefiles
+# VS2019 * Visual Studio 16 2019
+# VS201964 * Visual Studio 16 2019
# VS2017 * Visual Studio 15 2017
# VS201764 * Visual Studio 15 2017 Win64
# VS2015 * Visual Studio 14 2015
@@ -106,8 +108,20 @@ if (NOT DEFINED HPC)
endif ()
if (WIN32 AND NOT MINGW)
set (SITE_OS_NAME "Windows")
- set (SITE_OS_VERSION "WIN7")
- if (BUILD_GENERATOR STREQUAL "VS201764")
+ set (SITE_OS_VERSION "WIN10")
+ if (BUILD_GENERATOR STREQUAL "VS201964")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 16 2019")
+ set (CMAKE_GENERATOR_ARCHITECTURE "x64")
+ set (SITE_OS_BITS "64")
+ set (SITE_COMPILER_NAME "vs2019")
+ set (SITE_COMPILER_VERSION "16")
+ elseif (BUILD_GENERATOR STREQUAL "VS2019")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 16 2019")
+ set (CMAKE_GENERATOR_ARCHITECTURE "Win32")
+ set (SITE_OS_BITS "32")
+ set (SITE_COMPILER_NAME "vs2019")
+ set (SITE_COMPILER_VERSION "16")
+ elseif (BUILD_GENERATOR STREQUAL "VS201764")
set (CTEST_CMAKE_GENERATOR "Visual Studio 15 2017 Win64")
set (SITE_OS_BITS "64")
set (SITE_COMPILER_NAME "vs2017")
diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake
index e320c07..148e9d7 100644
--- a/config/cmake_ext_mod/HDFMacros.cmake
+++ b/config/cmake_ext_mod/HDFMacros.cmake
@@ -261,6 +261,10 @@ macro (HDF_README_PROPERTIES target_fortran)
set (BINARY_PLATFORM "${BINARY_PLATFORM} Intel")
if (${CMAKE_C_COMPILER_VERSION} MATCHES "^17.*")
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel 17")
+ elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^18.*")
+ set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel 18")
+ elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.*")
+ set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel 19")
else ()
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel ${CMAKE_C_COMPILER_VERSION}")
endif ()
@@ -277,8 +281,10 @@ macro (HDF_README_PROPERTIES target_fortran)
elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.*")
if (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.0.*")
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2015")
- else ()
+ elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.16.*")
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2017")
+ else () #19.23
+ set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2019")
endif ()
else ()
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ${CMAKE_C_COMPILER_VERSION}")
diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake
index bfb45fa..1cce918 100644
--- a/config/cmake_ext_mod/HDFUseFortran.cmake
+++ b/config/cmake_ext_mod/HDFUseFortran.cmake
@@ -192,7 +192,7 @@ CHECK_FORTRAN_FEATURE(iso_c_binding
#-----------------------------------------------------------------------------
if (CMAKE_Fortran_COMPILER MATCHES ifort)
if (WIN32 AND NOT MINGW)
- set (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE)
- set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE)
+ set (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE STRING "flags" FORCE)
+ set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE STRING "flags" FORCE)
endif ()
endif ()
diff --git a/config/commence.am b/config/commence.am
index a16eee5..830c494 100644
--- a/config/commence.am
+++ b/config/commence.am
@@ -70,7 +70,7 @@ H5CPP=${DESTDIR}$(bindir)/h5c++
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS=@AM_CFLAGS@ @H5_CFLAGS@
+AM_CFLAGS=@AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
AM_FCFLAGS=@AM_FCFLAGS@ @H5_FCFLAGS@
AM_CXXFLAGS=@AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_CPPFLAGS=@AM_CPPFLAGS@ @H5_CPPFLAGS@
diff --git a/config/gnu-flags b/config/gnu-flags
index 6355ccf..bc120a8 100644
--- a/config/gnu-flags
+++ b/config/gnu-flags
@@ -168,12 +168,44 @@ if test "X-gcc" = "X-$cc_vendor"; then
# NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add
# it to the developer flags.
#
- H5_CFLAGS="$H5_CFLAGS -pedantic -Wall -Wextra -Wbad-function-cast -Wc++-compat -Wcast-align"
- H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal"
- H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs"
- H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked"
- H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-enum -Wswitch-default"
- H5_CFLAGS="$H5_CFLAGS -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings"
+ H5_CFLAGS="$H5_CFLAGS -pedantic -Wall -Wextra"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=bad-function-cast"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=cast-align"
+ H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=declaration-after-statement"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wdisabled-optimization"
+ H5_CFLAGS="$H5_CFLAGS -Wfloat-equal"
+ H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=missing-declarations"
+ H5_CFLAGS="$H5_CFLAGS -Wmissing-include-dirs"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=missing-prototypes"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=nested-externs"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=old-style-definition"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=packed"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=redundant-decls"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=shadow"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=strict-prototypes"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wswitch-default"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wswitch-enum"
+ H5_CFLAGS="$H5_CFLAGS -Wundef"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wunused-macros"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wunsafe-loop-optimizations"
+ H5_CFLAGS="$H5_CFLAGS -Wwrite-strings"
+
+ #
+ # HDF5 code should not trigger the following warnings under any
+ # circumstances, so ask the compiler to treat them as errors:
+ #
+# H5_ECFLAGS="$H5_ECFLAGS -Werror=discarded-qualifiers"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=implicit-function-declaration"
+ H5_CFLAGS="$H5_CFLAGS -Wmaybe-uninitialized"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=pointer-sign"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=pointer-to-int-cast"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=switch"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=unused-but-set-variable"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=unused-function"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=unused-parameter"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=unused-variable"
######################
# Developer warnings #
@@ -222,17 +254,34 @@ if test "X-gcc" = "X-$cc_vendor"; then
# gcc 4.3
if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 3; then
- H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560"
+ H5_CFLAGS="$H5_CFLAGS -Wlogical-op"
+ #
+ # Lots of noise, questionable benefit:
+ #
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wlarger-than=2560"
+ #
fi
# gcc 4.4
if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 4; then
- H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat"
+ H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wpacked-bitfield-compat"
+ #
+ # Lots of noise, questionable benefit:
+ #
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wframe-larger-than=16384"
+ #
fi
# gcc 4.5
if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5; then
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants"
+ H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wunsuffixed-float-constants"
+ #
+ # -Wjump-misses-init makes lots of noise for a questionable benefit.
+ # Can jumping over an initialization in C cause any harm, if
+ # the variable is never *used* before it has been initialized?
+ #
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wjump-misses-init"
+ #
fi
# gcc 4.6
@@ -244,7 +293,17 @@ if test "X-gcc" = "X-$cc_vendor"; then
# gcc 4.7
if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 7; then
- H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance"
+ #
+ # It's not clear that -Wvector-operation-performance warnings are
+ # actionable.
+ #
+ # -Wstack-usage=8192 warnings need better justification;
+ # if justifiable, should be enabled on a branch and swept up there
+ # before burdening the whole development team.
+ #
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstack-usage=8192"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wvector-operation-performance"
+
DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn"
NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn"
fi
@@ -263,11 +322,21 @@ if test "X-gcc" = "X-$cc_vendor"; then
# gcc 5
if test $cc_vers_major -ge 5; then
H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=incompatible-pointer-types"
fi
# gcc 6
if test $cc_vers_major -ge 6; then
- H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized"
+ H5_CFLAGS="$H5_CFLAGS -Wunused-const-variable -Whsa -Wnormalized"
+ #
+ # Unacceptably noisy on HDF5 right now.
+ #
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wnull-dereference"
+ #
+ # Careful! -Wduplicated-cond, combined with HDF5's heavy use of
+ # macros, can make a lot of noise.
+ #
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wduplicated-cond"
fi
# gcc 7
@@ -278,6 +347,13 @@ if test "X-gcc" = "X-$cc_vendor"; then
# gcc 8
if test $cc_vers_major -ge 8; then
+ # For GCC 8, promote maybe-initialized warnings to an error. GCC 8
+ # reports 0 maybe-uninitialized warnings where earlier versions
+ # make many false reports. GCC 8 seems to analyze calls to static
+ # in order to detect initializations that occur there. It's possible
+ # that GCC 8 only performs that analysis at -O3, though.
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=maybe-uninitialized"
+ H5_ECFLAGS="$H5_ECFLAGS -Werror=cast-function-type"
DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=4 -Wsuggest-attribute=cold -Wsuggest-attribute=malloc"
NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc"
H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2"
diff --git a/config/toolchain/clang.cmake b/config/toolchain/clang.cmake
index 7dac587..f9da787 100644
--- a/config/toolchain/clang.cmake
+++ b/config/toolchain/clang.cmake
@@ -13,8 +13,8 @@ find_program(
DOC "Path to clang-tidy executable"
)
-set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXE}" -checks=*,clang-analyzer-*)
-set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}" -checks=*,clang-analyzer-*)
+set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXE}" -checks=*,clang-analyzer-*,-clang-analyzer-cplusplus*,-readability-*,-google*)
+set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}" -checks=*,clang-analyzer-*,-clang-analyzer-cplusplus*,-readability-*,-google*)
#find_program(
# CLANG_FORMAT_EXE
diff --git a/configure.ac b/configure.ac
index 0eada60..5851b32 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,7 +103,11 @@ AC_SUBST([AR_FLAGS])
## H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but
## not exported to h5cc (or h5fc, etc.)
+##
+## H5_ECFLAGS is for warnings that should be treated as errors.
+##
AC_SUBST([H5_CFLAGS])
+AC_SUBST([H5_ECFLAGS])
AC_SUBST([H5_CPPFLAGS])
AC_SUBST([H5_FCFLAGS])
AC_SUBST([H5_CXXFLAGS])
diff --git a/examples/run-c-ex.sh.in b/examples/run-c-ex.sh.in
index b561617..90d5c6a 100644
--- a/examples/run-c-ex.sh.in
+++ b/examples/run-c-ex.sh.in
@@ -46,7 +46,7 @@ prefix=@prefix@
examplesdir=@examplesdir@
if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then
echo $(echo ${examplesdir##${prefix}/} | \
- sed -E 's,[^/]+,..,g')
+ sed 's,[^/][^/]*,..,g')
else
echo $prefix
fi
diff --git a/fortran/examples/run-fortran-ex.sh.in b/fortran/examples/run-fortran-ex.sh.in
index e2b444f..81e54ea 100644
--- a/fortran/examples/run-fortran-ex.sh.in
+++ b/fortran/examples/run-fortran-ex.sh.in
@@ -47,7 +47,7 @@ prefix=@prefix@
examplesdir=@examplesdir@
if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then
echo $(echo ${examplesdir##${prefix}/} | \
- sed -E 's,[^/]+,..,g')
+ sed 's,[^/][^/]*,..,g')
else
echo $prefix
fi
diff --git a/hl/c++/examples/run-hlc++-ex.sh.in b/hl/c++/examples/run-hlc++-ex.sh.in
index e46534a..43831f5 100644
--- a/hl/c++/examples/run-hlc++-ex.sh.in
+++ b/hl/c++/examples/run-hlc++-ex.sh.in
@@ -47,7 +47,7 @@ prefix=@prefix@
examplesdir=@examplesdir@
if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then
echo $(echo ${examplesdir##${prefix}/} | \
- sed -E 's,[^/]+,..,g')
+ sed 's,[^/][^/]*,..,g')
else
echo $prefix
fi
diff --git a/hl/examples/run-hlc-ex.sh.in b/hl/examples/run-hlc-ex.sh.in
index ceb77dd..e6d0cc9 100644
--- a/hl/examples/run-hlc-ex.sh.in
+++ b/hl/examples/run-hlc-ex.sh.in
@@ -46,7 +46,7 @@ prefix=@prefix@
examplesdir=@examplesdir@
if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then
echo $(echo ${examplesdir##${prefix}/} | \
- sed -E 's,[^/]+,..,g')
+ sed 's,[^/][^/]*,..,g')
else
echo $prefix
fi
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c
index b24f887..ce61028 100644
--- a/hl/src/H5DS.c
+++ b/hl/src/H5DS.c
@@ -1434,6 +1434,10 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
char ** buf; /* discarding the 'const' qualifier in the free */
char const ** const_buf; /* buf calls */
} u;
+
+ u.buf = NULL;
+ u.const_buf = NULL;
+
/*-------------------------------------------------------------------------
* parameter checking
*-------------------------------------------------------------------------
diff --git a/hl/test/H5srcdir_str.h.in b/hl/test/H5srcdir_str.h.in
index bab1df3..ba30a88 100644
--- a/hl/test/H5srcdir_str.h.in
+++ b/hl/test/H5srcdir_str.h.in
@@ -16,5 +16,5 @@
*/
/* Set the 'srcdir' path from configure time */
-static const char *config_srcdir = "@srcdir@";
+#define config_srcdir "@srcdir@"
diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt
index 49fef76..652e1f4 100644
--- a/release_docs/INSTALL_CMake.txt
+++ b/release_docs/INSTALL_CMake.txt
@@ -31,7 +31,8 @@ Obtaining HDF5 source code
CMake version
1. We suggest you obtain the latest CMake from the Kitware web site.
The HDF5 1.10."X" product requires a minimum CMake version 3.10,
- where "X" is the current HDF5 release version.
+ where "X" is the current HDF5 release version. If you are using
+ VS2019, the minimum version is 3.15.
Note:
To change the install prefix from the platform defaults initialize
@@ -90,6 +91,10 @@ To build HDF5 with the SZIP and ZLIB external libraries you will need to:
5. From the "myhdfstuff" directory execute the CTest Script with the
following options:
+ On 32-bit Windows with Visual Studio 2019, execute:
+ ctest -S HDF5config.cmake,BUILD_GENERATOR=VS2019 -C Release -VV -O hdf5.log
+ On 64-bit Windows with Visual Studio 2019, execute:
+ ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201964 -C Release -VV -O hdf5.log
On 32-bit Windows with Visual Studio 2017, execute:
ctest -S HDF5config.cmake,BUILD_GENERATOR=VS2017 -C Release -VV -O hdf5.log
On 64-bit Windows with Visual Studio 2017, execute:
@@ -439,12 +444,11 @@ These five steps are described in detail below.
* MinGW Makefiles
* NMake Makefiles
* Unix Makefiles
- * Visual Studio 11 2012
- * Visual Studio 11 2012 Win64
- * Visual Studio 12 2013
- * Visual Studio 12 2013 Win64
* Visual Studio 14 2015
* Visual Studio 14 2015 Win64
+ * Visual Studio 15 2017
+ * Visual Studio 15 2017 Win64
+ * Visual Studio 16 2019
<options> is:
* SZIP_INCLUDE_DIR:PATH=<path to szip includes directory>
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index c2f2ebe..f668207 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -48,6 +48,14 @@ New Features
Configuration:
-------------
+ - Update CMake for VS2019 support
+
+ CMake added support for VS2019 in version 3.15. Changes to the CMake
+ generator setting required changes to scripts. Also updated version
+ references in CMake files as necessary.
+
+ (ADB - 2019/11/18, HDFFV-10962)
+
- Update CMake tests to use FIXTURES
CMake test fixtures allow setup/cleanup tests and other dependency
@@ -991,17 +999,16 @@ Supported Platforms
(emu) Sun Fortran 95 8.6 SunOS_sparc
Sun C++ 5.12 SunOS_sparc
- Windows 7 Visual Studio 2015 w/ Intel Fortran 16 (cmake)
+ Windows 7 Visual Studio 2015 w/ Intel Fortran 18 (cmake)
- Windows 7 x64 Visual Studio 2013
- Visual Studio 2015 w/ Intel Fortran 16 (cmake)
- Visual Studio 2015 w/ Intel C, Fortran 2018 (cmake)
+ Windows 7 x64 Visual Studio 2015 w/ Intel C, Fortran 2018 (cmake)
Visual Studio 2015 w/ MSMPI 8 (cmake)
Windows 10 Visual Studio 2015 w/ Intel Fortran 18 (cmake)
Windows 10 x64 Visual Studio 2015 w/ Intel Fortran 18 (cmake)
- Visual Studio 2017 w/ Intel Fortran 18 (cmake)
+ Visual Studio 2017 w/ Intel Fortran 19 (cmake)
+ Visual Studio 2019 w/ Intel Fortran 19 (cmake)
Mac OS X Yosemite 10.10.5 Apple clang/clang++ version 6.1 from Xcode 7.0
64-bit gfortran GNU Fortran (GCC) 4.9.2
@@ -1109,24 +1116,10 @@ The following platforms are not supported but have been tested for this release.
#1 SMP ppc64 GNU/Linux IBM XL C/C++ for Linux, V13.1
(ostrich) and IBM XL Fortran for Linux, V15.1
- Debian 8.4 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1 x86_64 GNU/Linux
- gcc, g++ (Debian 4.9.2-10) 4.9.2
- GNU Fortran (Debian 4.9.2-10) 4.9.2
- (cmake and autotools)
-
- Fedora 24 4.7.2-201.fc24.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux
- gcc, g++ (GCC) 6.1.1 20160621
- (Red Hat 6.1.1-3)
- GNU Fortran (GCC) 6.1.1 20160621
- (Red Hat 6.1.1-3)
- (cmake and autotools)
-
- Ubuntu 16.04.1 4.4.0-38-generic #57-Ubuntu SMP x86_64 GNU/Linux
- gcc, g++ (Ubuntu 5.4.0-6ubuntu1~16.04.2)
- 5.4.0 20160609
- GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.2)
- 5.4.0 20160609
- (cmake and autotools)
+ Fedora30 5.3.11-200.fc30.x86_64
+ #1 SMP x86_64 GNU/Linux GNU gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1 20190827)
+ GNU Fortran (GCC) 9.2.1 20190827 (Red Hat 9.2.1 20190827)
+ (cmake and autotools)
Known Problems
diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt
index ea352fe..21e153f 100644
--- a/release_docs/USING_CMake_Examples.txt
+++ b/release_docs/USING_CMake_Examples.txt
@@ -22,7 +22,7 @@ I. Preconditions
1. We suggest you obtain the latest CMake for windows from the Kitware
web site. The HDF5 1.10.x product requires a minimum CMake version
- of 3.10.2.
+ of 3.10.2. If you are using VS2019, the minimum version is 3.15.
2. You have installed the HDF5 library built with CMake, by executing
the HDF Install Utility (the *.msi file in the binary package for
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9bb73a9..c794c1a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -254,7 +254,7 @@ set (H5FD_HDRS
${HDF5_SRC_DIR}/H5FDmulti.h
${HDF5_SRC_DIR}/H5FDpublic.h
${HDF5_SRC_DIR}/H5FDros3.h
- ${HDF5_SRC_DIR}/H5FDs3comms.c
+ ${HDF5_SRC_DIR}/H5FDs3comms.h
${HDF5_SRC_DIR}/H5FDsec2.h
${HDF5_SRC_DIR}/H5FDstdio.h
${HDF5_SRC_DIR}/H5FDwindows.h
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 2b43a64..436fced 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -208,7 +208,7 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type,
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't get shared datatype info")
/* Mark datatype as being on disk now */
- if(H5T_set_loc(attr->shared->dt, loc->oloc->file, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(attr->shared->dt, H5F_VOL_OBJ(loc->oloc->file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
/* Set the version for datatype */
@@ -2115,7 +2115,7 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "cannot copy datatype")
/* Set the location of the destination datatype */
- if(H5T_set_loc(attr_dst->shared->dt, file_dst, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(attr_dst->shared->dt, H5F_VOL_OBJ(file_dst), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "cannot mark datatype on disk")
if(!H5T_is_named(attr_src->shared->dt)) {
diff --git a/src/H5CX.c b/src/H5CX.c
index 96c1d72..649bd8f 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -181,6 +181,10 @@ typedef struct H5CX_t {
hid_t dxpl_id; /* DXPL ID for API operation */
H5P_genplist_t *dxpl; /* Dataset Transfer Property List */
+ /* LCPL */
+ hid_t lcpl_id; /* LCPL ID for API operation */
+ H5P_genplist_t *lcpl; /* Link Creation Property List */
+
/* LAPL */
hid_t lapl_id; /* LAPL ID for API operation */
H5P_genplist_t *lapl; /* Link Access Property List */
@@ -278,6 +282,12 @@ typedef struct H5CX_t {
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
+ /* Cached LCPL properties */
+ H5T_cset_t encoding; /* Link name character encoding */
+ hbool_t encoding_valid; /* Whether link name character encoding is valid */
+ unsigned intermediate_group; /* Whether to create intermediate groups */
+ hbool_t intermediate_group_valid; /* Whether create intermediate group flag is valid */
+
/* Cached LAPL properties */
size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */
@@ -285,6 +295,8 @@ typedef struct H5CX_t {
/* 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 */
+ uint8_t ohdr_flags; /* Object header flags */
+ hbool_t ohdr_flags_valid; /* Whether the object headers flags are valid */
/* Cached DAPL properties */
const char *extfile_prefix; /* Prefix for external file */
@@ -346,6 +358,13 @@ typedef struct H5CX_dxpl_cache_t {
H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */
} H5CX_dxpl_cache_t;
+/* Typedef for cached default link creation property list information */
+/* (Same as the cached DXPL struct, above, except for the default LCPL) */
+typedef struct H5CX_lcpl_cache_t {
+ H5T_cset_t encoding; /* Link name character encoding */
+ unsigned intermediate_group; /* Whether to create intermediate groups */
+} H5CX_lcpl_cache_t;
+
/* Typedef for cached default link access property list information */
/* (Same as the cached DXPL struct, above, except for the default LAPL) */
typedef struct H5CX_lapl_cache_t {
@@ -356,6 +375,7 @@ typedef struct H5CX_lapl_cache_t {
/* (Same as the cached DXPL struct, above, except for the default DCPL) */
typedef struct H5CX_dcpl_cache_t {
hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
+ uint8_t ohdr_flags; /* Object header flags */
} H5CX_dcpl_cache_t;
/* Typedef for cached default dataset access property list information */
@@ -401,6 +421,9 @@ static H5CX_node_t *H5CX_head_g = NULL; /* Pointer to head of context st
/* Define a "default" dataset transfer property list cache structure to use for default DXPLs */
static H5CX_dxpl_cache_t H5CX_def_dxpl_cache;
+/* Define a "default" link creation property list cache structure to use for default LCPLs */
+static H5CX_lcpl_cache_t H5CX_def_lcpl_cache;
+
/* Define a "default" link access property list cache structure to use for default LAPLs */
static H5CX_lapl_cache_t H5CX_def_lapl_cache;
@@ -435,6 +458,7 @@ herr_t
H5CX__init_package(void)
{
H5P_genplist_t *dx_plist; /* Data transfer property list */
+ H5P_genplist_t *lc_plist; /* Link creation 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 */
@@ -525,6 +549,23 @@ H5CX__init_package(void)
if(H5P_get(dx_plist, H5D_XFER_CONV_CB_NAME, &H5CX_def_dxpl_cache.dt_conv_cb) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve datatype conversion exception callback")
+ /* Reset the "default LCPL cache" information */
+ HDmemset(&H5CX_def_lcpl_cache, 0, sizeof(H5CX_lcpl_cache_t));
+
+ /* Get the default LCPL cache information */
+
+ /* Get the default link creation property list */
+ if(NULL == (lc_plist = (H5P_genplist_t *)H5I_object(H5P_LINK_CREATE_DEFAULT)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a link creation property list")
+
+ /* Get link name character encoding */
+ if(H5P_get(lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &H5CX_def_lcpl_cache.encoding) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve link name encoding")
+
+ /* Get flag whether to create intermediate groups */
+ if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &H5CX_def_lcpl_cache.intermediate_group) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve intermediate group creation flag")
+
/* Reset the "default LAPL cache" information */
HDmemset(&H5CX_def_lapl_cache, 0, sizeof(H5CX_lapl_cache_t));
@@ -552,6 +593,10 @@ 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")
+ /* Get object header flags */
+ if(H5P_get(dc_plist, H5O_CRT_OHDR_FLAGS_NAME, &H5CX_def_dcpl_cache.ohdr_flags) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve object header flags")
+
/* Reset the "default DAPL cache" information */
HDmemset(&H5CX_def_dapl_cache, 0, sizeof(H5CX_dapl_cache_t));
@@ -710,6 +755,7 @@ H5CX__push_common(H5CX_node_t *cnode)
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.lcpl_id = H5P_LINK_CREATE_DEFAULT;
cnode->ctx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
cnode->ctx.fapl_id = H5P_FILE_ACCESS_DEFAULT;
cnode->ctx.tag = H5AC__INVALID_TAG;
@@ -820,6 +866,18 @@ H5CX_retrieve_state(H5CX_state_t **api_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 DCPL */
+ if(H5P_DATASET_CREATE_DEFAULT != (*head)->ctx.dcpl_id) {
+ /* Retrieve the DCPL property list */
+ H5CX_RETRIEVE_PLIST(dcpl, FAIL)
+
+ /* Copy the DCPL ID */
+ if(((*api_state)->dcpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.dcpl, FALSE)) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list")
+ } /* end if */
+ else
+ (*api_state)->dcpl_id = H5P_DATASET_CREATE_DEFAULT;
+
/* Check for non-default DXPL */
if(H5P_DATASET_XFER_DEFAULT != (*head)->ctx.dxpl_id) {
/* Retrieve the DXPL property list */
@@ -844,6 +902,18 @@ H5CX_retrieve_state(H5CX_state_t **api_state)
else
(*api_state)->lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ /* Check for non-default LCPL */
+ if(H5P_LINK_CREATE_DEFAULT != (*head)->ctx.lcpl_id) {
+ /* Retrieve the LCPL property list */
+ H5CX_RETRIEVE_PLIST(lcpl, FAIL)
+
+ /* Copy the LCPL ID */
+ if(((*api_state)->lcpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.lcpl, FALSE)) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list")
+ } /* end if */
+ else
+ (*api_state)->lcpl_id = H5P_LINK_CREATE_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)
@@ -916,6 +986,10 @@ H5CX_restore_state(const H5CX_state_t *api_state)
HDassert(head && *head);
HDassert(api_state);
+ /* Restore the DCPL info */
+ (*head)->ctx.dcpl_id = api_state->dcpl_id;
+ (*head)->ctx.dcpl = NULL;
+
/* Restore the DXPL info */
(*head)->ctx.dxpl_id = api_state->dxpl_id;
(*head)->ctx.dxpl = NULL;
@@ -924,6 +998,10 @@ H5CX_restore_state(const H5CX_state_t *api_state)
(*head)->ctx.lapl_id = api_state->lapl_id;
(*head)->ctx.lapl = NULL;
+ /* Restore the LCPL info */
+ (*head)->ctx.lcpl_id = api_state->lcpl_id;
+ (*head)->ctx.lcpl = NULL;
+
/* Restore the VOL wrapper context */
(*head)->ctx.vol_wrap_ctx = api_state->vol_wrap_ctx;
@@ -964,6 +1042,11 @@ H5CX_free_state(H5CX_state_t *api_state)
/* Sanity check */
HDassert(api_state);
+ /* Release the DCPL */
+ if(api_state->dcpl_id != H5P_DATASET_CREATE_DEFAULT)
+ if(H5I_dec_ref(api_state->dcpl_id) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DCPL")
+
/* Release the DXPL */
if(api_state->dxpl_id != H5P_DATASET_XFER_DEFAULT)
if(H5I_dec_ref(api_state->dxpl_id) < 0)
@@ -974,6 +1057,11 @@ H5CX_free_state(H5CX_state_t *api_state)
if(H5I_dec_ref(api_state->lapl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LAPL")
+ /* Release the LCPL */
+ if(api_state->lcpl_id != H5P_LINK_CREATE_DEFAULT)
+ if(H5I_dec_ref(api_state->lcpl_id) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LCPL")
+
/* Release the VOL wrapper context */
if(api_state->vol_wrap_ctx)
if(H5VL_dec_vol_wrapper(api_state->vol_wrap_ctx) < 0)
@@ -1119,6 +1207,35 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_set_lcpl
+ *
+ * Purpose: Sets the LCPL for the current API call context.
+ *
+ * Return: <none>
+ *
+ * Programmer: Chris Hogan
+ * October 28, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5CX_set_lcpl(hid_t lcpl_id)
+{
+ 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);
+
+ /* Set the API context's LCPL to a new value */
+ (*head)->ctx.lcpl_id = lcpl_id;
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5CX_set_lcpl() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_set_lapl
*
* Purpose: Sets the LAPL for the current API call context.
@@ -2371,6 +2488,76 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_get_encoding
+ *
+ * Purpose: Retrieves the character encoding for the current API call context.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Gerd Heber
+ * October 21, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_encoding(H5T_cset_t* encoding)
+{
+ 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(encoding);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.lcpl_id);
+
+ H5CX_RETRIEVE_PROP_VALID(lcpl, H5P_LINK_CREATE_DEFAULT, H5P_STRCRT_CHAR_ENCODING_NAME, encoding)
+
+ /* Get the value */
+ *encoding = (*head)->ctx.encoding;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_encoding() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_get_intermediate_group
+ *
+ * Purpose: Retrieves the create intermediate group flag for the current API call context.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Gerd Heber
+ * October 21, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_intermediate_group(unsigned* crt_intermed_group)
+{
+ 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(crt_intermed_group);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.lcpl_id);
+
+ H5CX_RETRIEVE_PROP_VALID(lcpl, H5P_LINK_CREATE_DEFAULT, H5L_CRT_INTERMEDIATE_GROUP_NAME, intermediate_group)
+
+ /* Get the value */
+ *crt_intermed_group = (*head)->ctx.intermediate_group;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_create_intermediate_group() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_get_nlinks
*
* Purpose: Retrieves the # of soft / UD links to traverse for the current API call context.
@@ -3284,6 +3471,41 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_get_ohdr_flags
+ *
+ * Purpose: Retrieves the object header flags for the current API call context.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Chris Hogan
+ * November 15, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_ohdr_flags(uint8_t *ohdr_flags)
+{
+ 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(ohdr_flags);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id);
+
+ H5CX_RETRIEVE_PROP_VALID(dcpl, H5P_DATASET_CREATE_DEFAULT, H5O_CRT_OHDR_FLAGS_NAME, ohdr_flags)
+
+ /* Get the value */
+ *ohdr_flags = (*head)->ctx.ohdr_flags;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* End H5CX_get_ohdr_flags() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX__pop_common
*
* Purpose: Common code for popping the context for an API call.
diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h
index 2f86adf..2ae71f3 100644
--- a/src/H5CXprivate.h
+++ b/src/H5CXprivate.h
@@ -41,8 +41,10 @@
/* API context state */
typedef struct H5CX_state_t {
+ hid_t dcpl_id; /* DCPL for operation */
hid_t dxpl_id; /* DXPL for operation */
hid_t lapl_id; /* LAPL for operation */
+ hid_t lcpl_id; /* LCPL for operation */
void *vol_wrap_ctx; /* VOL connector's "wrap context" for creating IDs */
H5VL_connector_prop_t vol_connector_prop; /* VOL connector property */
@@ -77,6 +79,7 @@ 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_lcpl(hid_t lcpl_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);
@@ -122,11 +125,16 @@ H5_DLL herr_t H5CX_get_data_transform(H5Z_data_xform_t **data_transform);
H5_DLL herr_t H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info);
H5_DLL herr_t H5CX_get_dt_conv_cb(H5T_conv_cb_t *cb_struct);
+/* "Getter" routines for LCPL properties cached in API context */
+H5_DLL herr_t H5CX_get_encoding(H5T_cset_t* encoding);
+H5_DLL herr_t H5CX_get_intermediate_group(unsigned* crt_intermed_group);
+
/* "Getter" routines for LAPL properties cached in API context */
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);
+H5_DLL herr_t H5CX_get_ohdr_flags(uint8_t *ohdr_flags);
/* "Getter" routines for DAPL properties cached in API context */
H5_DLL herr_t H5CX_get_ext_file_prefix(const char **prefix_extfile);
diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c
index 1f55e86..cb1d0e2 100644
--- a/src/H5Cdbg.c
+++ b/src/H5Cdbg.c
@@ -319,9 +319,8 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn)
(int)(entry_ptr->is_dirty),
entry_ptr->type->name);
- HDfprintf(stdout, " node_ptr = 0x%llx, item = %p\n",
- (unsigned long long)node_ptr,
- H5SL_item(node_ptr));
+ HDfprintf(stdout, " node_ptr = %p, item = %p\n",
+ node_ptr, H5SL_item(node_ptr));
/* increment node_ptr before we delete its target */
node_ptr = H5SL_next(node_ptr);
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index 9156c0d..b8648f0 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -4694,7 +4694,7 @@ struct H5C_t {
uint32_t num_last_entries;
#if H5C_DO_SANITY_CHECKS
int32_t slist_len_increase;
- ssize_t slist_size_increase;
+ int64_t slist_size_increase;
#endif /* H5C_DO_SANITY_CHECKS */
/* Fields for maintaining list of tagged entries */
diff --git a/src/H5D.c b/src/H5D.c
index 9d811c6..a2e6f0a 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -137,6 +137,9 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
/* Set the DCPL for the API context */
H5CX_set_dcpl(dcpl_id);
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&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/H5Dchunk.c b/src/H5Dchunk.c
index 53ca7d1..4d139c7 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -284,7 +284,8 @@ static int H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *
static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims,
const hsize_t *curr_dims, const hsize_t *max_dims);
static void *H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline);
-static void *H5D__chunk_mem_xfree(void *chk, const void *pline);
+static void *H5D__chunk_mem_xfree(void *chk, void *pline);
+static void H5D__chunk_mem_xfree_wrapper(void *chk, void *pline);
static void *H5D__chunk_mem_realloc(void *chk, size_t size,
const H5O_pline_t *pline);
static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last);
@@ -1100,14 +1101,10 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
H5D_chunk_map_t *fm)
{
const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */
- H5S_t *tmp_mspace = NULL; /* Temporary memory dataspace */
hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */
htri_t file_space_normalized = FALSE; /* File dataspace was normalized */
- H5T_t *file_type = NULL; /* Temporary copy of file datatype for iteration */
- hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
unsigned f_ndims; /* The number of dimensions of the file's dataspace */
int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */
- char bogus; /* "bogus" buffer to pass to selection iterator */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1431,7 +1428,7 @@ H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline)
*-------------------------------------------------------------------------
*/
static void *
-H5D__chunk_mem_xfree(void *chk, const void *_pline)
+H5D__chunk_mem_xfree(void *chk, void *_pline)
{
const H5O_pline_t *pline = (const H5O_pline_t *)_pline;
@@ -1447,6 +1444,17 @@ H5D__chunk_mem_xfree(void *chk, const void *_pline)
FUNC_LEAVE_NOAPI(NULL)
} /* H5D__chunk_mem_xfree() */
+/* H5D__chunk_mem_xfree_wrapper() safely adapts the type of
+ * H5D__chunk_mem_xfree() to an H5MM_free_t callback, without making
+ * compilers warn. It is used with H5D__chunk_mem_xfree_wrapper(), for
+ * example.
+ */
+static void
+H5D__chunk_mem_xfree_wrapper(void *chk, void *_pline)
+{
+ (void)H5D__chunk_mem_xfree(chk, _pline);
+}
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_mem_realloc
@@ -2107,7 +2115,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
} /* end for */
/* Adjust the selection */
- if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0)
+ if(H5S_SELECT_ADJUST_S(chunk_info->mspace, chunk_adjust) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection")
} /* end else */
@@ -2120,7 +2128,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_chunk_mem_map_hyper() */
-
/*-------------------------------------------------------------------------
* Function: H5D__create_mem_map_1d
@@ -2140,12 +2147,6 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm)
{
H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */
H5SL_node_t *curr_node; /* Current node in skip list */
- hsize_t file_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
- hsize_t file_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
- hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
- hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
- hssize_t adjust[H5S_MAX_RANK]; /* Adjustment to make to all file chunks */
- unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2170,17 +2171,18 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm)
chunk_info->mspace_shared = TRUE;
} /* end if */
else {
- HDassert(fm->m_ndims == 1);
hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
+ HDassert(fm->m_ndims == 1);
+
if(H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Iterate over each chunk in the chunk list */
curr_node = H5SL_first(fm->sel_chunks);
while(curr_node) {
- hssize_t schunk_points; /* Number of elements in chunk selection */
+ hsize_t schunk_points; /* Number of elements in chunk selection */
hsize_t tmp_count = 1;
/* Get pointer to chunk's information */
@@ -4451,7 +4453,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
/* (delay allocating fill buffer for VL datatypes until refilling) */
/* (casting away const OK - QAK) */
if(H5D__fill_init(&fb_info, NULL, (H5MM_allocate_t)H5D__chunk_mem_alloc,
- (void *)pline, (H5MM_free_t)H5D__chunk_mem_xfree, (void *)pline,
+ (void *)pline, H5D__chunk_mem_xfree_wrapper, (void *)pline,
&dset->shared->dcpl_cache.fill, dset->shared->type,
dset->shared->type_id, (size_t)0, orig_chunk_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
@@ -6279,7 +6281,7 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
/* create variable-length datatype at the destinaton file */
if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0) {
+ if(H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) {
(void)H5T_close_real(dt_dst);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
} /* end if */
@@ -7153,7 +7155,6 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
hsize_t num_chunks = 0; /* Number of written chunks */
H5D_rdcc_ent_t *ent; /* Cache entry */
const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */
- const H5O_layout_t *layout; /* Dataset layout */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
@@ -7163,7 +7164,6 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
HDassert(space);
HDassert(nchunks);
- layout = &(dset->shared->layout); /* Dataset layout */
rdcc = &(dset->shared->cache.chunk); /* raw data chunk cache */
HDassert(rdcc);
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index edad3c5..809cdfc 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -476,7 +476,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
/* create variable-length datatype at the destinaton file */
if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0) {
+ if(H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) {
(void)H5T_close_real(dt_dst);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
} /* end if */
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 0be7364..e48c3b3 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -1398,7 +1398,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
/* create variable-length datatype at the destinaton file */
if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy")
- if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0) {
+ if(H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) {
(void)H5T_close_real(dt_dst);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
} /* end if */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 772a150..ee90db2 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -560,7 +560,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info")
/* Mark any datatypes as being on disk now */
- if(H5T_set_loc(dset->shared->type, file, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(dset->shared->type, H5F_VOL_OBJ(file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't set datatype location")
/* Set the version for datatype */
@@ -1697,7 +1697,7 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id)
if(NULL == (dataset->shared->type = (H5T_t *)H5O_msg_read(&(dataset->oloc), H5O_DTYPE_ID, NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load type info from dataset header")
- if(H5T_set_loc(dataset->shared->type, dataset->oloc.file, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(dataset->shared->type, H5F_VOL_OBJ(dataset->oloc.file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc))))
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 79a856a..1237063 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -917,7 +917,7 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write,
HDassert(dset);
/* Patch the top level file pointer for dt->shared->u.vlen.f if needed */
- if(H5T_patch_vlen_file(dset->shared->type, dset->oloc.file) < 0 )
+ if(H5T_patch_vlen_file(dset->shared->type, H5F_VOL_OBJ(dset->oloc.file)) < 0 )
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch VL datatype file pointer")
/* Initialize type info safely */
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index 53640e7..877aadb 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -2406,7 +2406,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
/* Project intersection of virtual space and clipped
* virtual space onto source space (create
* clipped_source_select) */
- if(H5S_select_project_intersection(storage->list[i].sub_dset[j].virtual_select, storage->list[i].source_select, storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].clipped_source_select) < 0)
+ if(H5S_select_project_intersection(storage->list[i].sub_dset[j].virtual_select, storage->list[i].source_select, storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].clipped_source_select, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto memory space")
/* Set extents of virtual_select and
@@ -2423,7 +2423,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
if(storage->list[i].sub_dset[j].clipped_virtual_select) {
/* Project intersection of file space and mapping virtual space
* onto memory space */
- if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].projected_mem_space) < 0)
+ if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].projected_mem_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto memory space")
/* Check number of elements selected */
@@ -2460,7 +2460,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
if(storage->list[i].source_dset.clipped_virtual_select) {
/* Project intersection of file space and mapping virtual space onto
* memory space */
- if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].source_dset.clipped_virtual_select, &storage->list[i].source_dset.projected_mem_space) < 0)
+ if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].source_dset.clipped_virtual_select, &storage->list[i].source_dset.projected_mem_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto memory space")
/* Check number of elements selected, add to tot_nelmts */
@@ -2590,7 +2590,7 @@ H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
/* Project intersection of file space and mapping virtual space onto
* mapping source space */
- if(H5S_select_project_intersection(source_dset->clipped_virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space) < 0)
+ if(H5S_select_project_intersection(source_dset->clipped_virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto source space")
/* Perform read on source dataset */
@@ -2781,7 +2781,7 @@ H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
* extent in the unlimited dimension. -NAF */
/* Project intersection of file space and mapping virtual space onto
* mapping source space */
- if(H5S_select_project_intersection(source_dset->virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space) < 0)
+ if(H5S_select_project_intersection(source_dset->virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto source space")
/* Perform write on source dataset */
diff --git a/src/H5F.c b/src/H5F.c
index d216cd2..b395ccc 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -624,6 +624,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
H5F_t *new_file = NULL; /* File struct for new file */
H5P_genplist_t *plist; /* Property list pointer */
H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ H5VL_object_t *vol_obj = NULL; /* VOL object for file */
hid_t ret_value; /* return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@@ -682,6 +683,14 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
+ /* Get the file object */
+ if(NULL == (vol_obj = H5VL_vol_object(ret_value)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier")
+
+ /* Make the post open callback */
+ if(H5VL_file_specific(vol_obj, H5VL_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file post open callback")
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fcreate() */
@@ -712,6 +721,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
H5F_t *new_file = NULL; /* File struct for new file */
H5P_genplist_t *plist; /* Property list pointer */
H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ H5VL_object_t *vol_obj = NULL; /* VOL object for file */
hid_t ret_value; /* return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@@ -756,6 +766,14 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
+ /* Get the file object */
+ if(NULL == (vol_obj = H5VL_vol_object(ret_value)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier")
+
+ /* Make the post open callback */
+ if(H5VL_file_specific(vol_obj, H5VL_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file post open callback")
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fopen() */
@@ -941,6 +959,14 @@ H5Freopen(hid_t file_id)
if((ret_value = H5VL_register(H5I_FILE, file, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
+ /* Get the file object */
+ if(NULL == (vol_obj = H5VL_vol_object(ret_value)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier")
+
+ /* Make the post open callback */
+ if(H5VL_file_specific(vol_obj, H5VL_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file post open callback")
+
done:
/* XXX (VOL MERGE): If registration fails, file will not be closed */
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c
index 819d200..0b954cf 100644
--- a/src/H5FDhdfs.c
+++ b/src/H5FDhdfs.c
@@ -581,7 +581,6 @@ hid_t
H5FD_hdfs_init(void)
{
hid_t ret_value = H5I_INVALID_HID; /* Return value */
- unsigned int bin_i;
FUNC_ENTER_NOAPI(FAIL)
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index ac5667f..1c7d549 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -489,8 +489,8 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
#endif
#ifdef H5_HAVE_GETTIMEOFDAY
struct timeval timeval_start;
- struct timeval open_timeval_diff;
- struct timeval stat_timeval_diff;
+ struct timeval open_timeval_diff = {0, 0};
+ struct timeval stat_timeval_diff = {0, 0};
#endif /* H5_HAVE_GETTIMEOFDAY */
h5_stat_t sb;
H5FD_t *ret_value = NULL; /* Return value */
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index df67bd9..cf4a587 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -371,10 +371,10 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n"
/* Check if section info lock count dropped to zero */
if(fspace->sinfo_lock_count == 0) {
hbool_t release_sinfo_space = FALSE; /* Flag to indicate section info space in file should be released */
- hbool_t flush_in_progress = FALSE; /* Is flushing in progress */
+ hbool_t closing_or_flushing = f->shared->closing; /* Is closing or flushing in progress */
- /* Check whether cache is flush_in_progress */
- if(H5AC_get_cache_flush_in_progress(f->shared->cache, &flush_in_progress) < 0)
+ /* Check whether cache-flush is in progress if closing is not. */
+ if(!closing_or_flushing && H5AC_get_cache_flush_in_progress(f->shared->cache, &closing_or_flushing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get flush_in_progress")
/* Check if we actually protected the section info */
@@ -390,7 +390,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n"
cache_flags |= H5AC__DIRTIED_FLAG;
/* On file close or flushing, does not allow section info to shrink in size */
- if(f->shared->closing || flush_in_progress) {
+ if(closing_or_flushing) {
if(fspace->sect_size > fspace->alloc_sect_size)
cache_flags |= H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG;
else
@@ -441,7 +441,7 @@ HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC);
/* Set flag to release section info space in file */
/* On file close or flushing, only need to release section info with size
bigger than previous section */
- if(f->shared->closing || flush_in_progress) {
+ if(closing_or_flushing) {
if(fspace->sect_size > fspace->alloc_sect_size)
release_sinfo_space = TRUE;
else
diff --git a/src/H5Fefc.c b/src/H5Fefc.c
index 66d68b2..264a623 100644
--- a/src/H5Fefc.c
+++ b/src/H5Fefc.c
@@ -179,6 +179,10 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi
if(NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file")
+ /* Make file post open call */
+ if(H5F__post_open(ret_value) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file")
+
/* Increment the number of open objects to prevent the file from being
* closed out from under us - "simulate" having an open file id. Note
* that this behaviour replaces the calls to H5F_incr_nopen_objs() and
@@ -251,6 +255,10 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi
if(NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file")
+ /* Make file post open call */
+ if(H5F__post_open(ret_value) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file")
+
/* Increment the number of open objects to prevent the file from
* being closed out from under us - "simulate" having an open
* file id */
@@ -273,6 +281,10 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file")
open_file = TRUE;
+ /* Make file post open call */
+ if(H5F__post_open(ent->file) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file")
+
/* Increment the number of open objects to prevent the file from being
* closed out from under us - "simulate" having an open file id */
ent->file->nopen_objs++;
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 2ebcd94..435c1be 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -1138,9 +1138,15 @@ done:
HDONE_ERROR(H5E_FILE, H5E_CANTDEC, NULL, "can't close property list")
f->shared = H5FL_FREE(H5F_shared_t, f->shared);
- }
+ } /* end if */
+
+ /* Free VOL object */
+ if(f->vol_obj)
+ if(H5VL_free_object(f->vol_obj) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, NULL, "unable to free VOL object")
+
f = H5FL_FREE(H5F_t, f);
- }
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__new() */
@@ -1407,6 +1413,9 @@ H5F__dest(H5F_t *f, hbool_t flush)
/* Free the non-shared part of the file */
f->open_name = (char *)H5MM_xfree(f->open_name);
f->actual_name = (char *)H5MM_xfree(f->actual_name);
+ if(f->vol_obj && H5VL_free_object(f->vol_obj) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object")
+ f->vol_obj = NULL;
if(H5FO_top_dest(f) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file")
f->shared = NULL;
@@ -1820,6 +1829,35 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5F__post_open
+ *
+ * Purpose: Finishes file open after wrapper context for file has been
+ * set.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F__post_open(H5F_t *f)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check arguments */
+ HDassert(f);
+
+ /* Store a vol object in the file struct */
+ if(NULL == (f->vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, f, f->shared->vol_id)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't create VOL object")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__flush() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_flush_phase1
*
* Purpose: First phase of flushing cached data.
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 4b5b788..7d9a090 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -375,6 +375,7 @@ struct H5F_t {
char *open_name; /* Name used to open file */
char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */
H5F_shared_t *shared; /* The shared file info */
+ H5VL_object_t *vol_obj; /* VOL object */
unsigned nopen_objs; /* Number of open object headers */
H5FO_t *obj_count; /* # of time each object is opened through top file structure */
hbool_t id_exists; /* Whether an ID for this struct exists */
@@ -399,6 +400,7 @@ H5FL_EXTERN(H5F_shared_t);
/******************************/
/* General routines */
+H5_DLL herr_t H5F__post_open(H5F_t *f);
H5_DLL H5F_t *H5F__reopen(H5F_t *f);
H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush);
H5_DLL herr_t H5F__flush(H5F_t *f);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index c9a1b25..e1a8a2f 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -26,7 +26,6 @@ typedef struct H5F_t H5F_t;
/* Public headers needed by this file */
#include "H5FDpublic.h" /* File drivers */
-#include "H5VLpublic.h" /* Virtual Object Layer */
/* Private headers needed by this file */
#include "H5MMprivate.h" /* Memory management */
@@ -34,6 +33,7 @@ typedef struct H5F_t H5F_t;
#include "H5Pprivate.h" /* Property lists */
#endif /* H5_HAVE_PARALLEL */
#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/**************************/
@@ -337,6 +337,7 @@ typedef struct H5F_t H5F_t;
#define H5F_GET_MIN_DSET_OHDR(F) ((F)->shared->crt_dset_min_ohdr_flag)
#define H5F_SET_MIN_DSET_OHDR(F, V) ((F)->shared->crt_dset_min_ohdr_flag = (V))
#define H5F_VOL_CLS(F) ((F)->shared->vol_cls)
+#define H5F_VOL_OBJ(F) ((F)->vol_obj)
#else /* H5F_MODULE */
#define H5F_LOW_BOUND(F) (H5F_get_low_bound(F))
#define H5F_HIGH_BOUND(F) (H5F_get_high_bound(F))
@@ -398,6 +399,7 @@ typedef struct H5F_t H5F_t;
#define H5F_GET_MIN_DSET_OHDR(F) (H5F_get_min_dset_ohdr(F))
#define H5F_SET_MIN_DSET_OHDR(F, V) (H5F_set_min_dset_ohdr((F), (V)))
#define H5F_VOL_CLS(F) (H5F_get_vol_cls(F))
+#define H5F_VOL_OBJ(F) (H5F_get_vol_obj(F))
#endif /* H5F_MODULE */
@@ -759,6 +761,7 @@ H5_DLL hbool_t H5F_get_null_fsm_addr(const H5F_t *f);
H5_DLL hbool_t H5F_get_min_dset_ohdr(const H5F_t *f);
H5_DLL herr_t H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize);
H5_DLL const H5VL_class_t *H5F_get_vol_cls(const H5F_t *f);
+H5_DLL H5VL_object_t *H5F_get_vol_obj(const H5F_t *f);
/* Functions than retrieve values set/cached from the superblock/FCPL */
H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f);
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 32743c4..68ad8e5 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -1306,6 +1306,26 @@ H5F_get_vol_cls(const H5F_t *f)
/*-------------------------------------------------------------------------
+ * Function: H5F_get_vol_obj
+ *
+ * Purpose: Get the VOL object for the file
+ *
+ * Return: VOL object pointer for file, can't fail
+ *
+ *-------------------------------------------------------------------------
+ */
+H5VL_object_t *
+H5F_get_vol_obj(const H5F_t *f)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(f);
+
+ FUNC_LEAVE_NOAPI(f->vol_obj)
+} /* end H5F_get_vol_obj */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_get_cont_info
*
* Purpose: Get the VOL container info for the file
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index 125d6cf..ce216a2 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -347,9 +347,9 @@ static herr_t
H5F__cache_superblock_get_final_load_size(const void *_image, size_t image_len,
void *_udata, size_t *actual_len)
{
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ const uint8_t *image = _image; /* Pointer into raw data buffer */
H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */
- H5F_super_t sblock; /* Temporary file superblock */
+ H5F_super_t sblock; /* Temporary file superblock */
htri_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -361,6 +361,15 @@ H5F__cache_superblock_get_final_load_size(const void *_image, size_t image_len,
HDassert(*actual_len == image_len);
HDassert(image_len >= H5F_SUPERBLOCK_FIXED_SIZE + 6);
+ /* Initialize because GCC 5.5 does not realize that
+ * H5F__superblock_prefix_decode() initializes it.
+ *
+ * TBD condition on compiler version.
+ */
+ sblock.super_vers = 0;
+ sblock.sizeof_addr = 0;
+ sblock.sizeof_size = 0;
+
/* Deserialize the file superblock's prefix */
if(H5F__superblock_prefix_decode(&sblock, &image, udata, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't decode file superblock prefix")
@@ -393,7 +402,7 @@ done:
static htri_t
H5F__cache_superblock_verify_chksum(const void *_image, size_t len, void *_udata)
{
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ const uint8_t *image = _image; /* Pointer into raw data buffer */
H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
@@ -439,7 +448,7 @@ H5F__cache_superblock_deserialize(const void *_image, size_t len, void *_udata,
{
H5F_super_t *sblock = NULL; /* File's superblock */
H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ const uint8_t *image = _image; /* Pointer into raw data buffer */
H5F_super_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -664,7 +673,7 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU
void *_thing)
{
H5F_super_t *sblock = (H5F_super_t *)_thing; /* Pointer to the object */
- uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */
+ uint8_t *image = _image; /* Pointer into raw data buffer */
haddr_t rel_eof; /* Relative EOF for file */
herr_t ret_value = SUCCEED; /* Return value */
@@ -870,7 +879,7 @@ static herr_t
H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t image_len,
void *_udata, size_t *actual_len)
{
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ const uint8_t *image = _image; /* Pointer into raw data buffer */
H5F_drvrinfo_cache_ud_t *udata = (H5F_drvrinfo_cache_ud_t *)_udata; /* User data */
H5O_drvinfo_t drvrinfo; /* Driver info */
herr_t ret_value = SUCCEED; /* Return value */
@@ -884,6 +893,7 @@ H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t image_len,
HDassert(*actual_len == image_len);
HDassert(image_len == H5F_DRVINFOBLOCK_HDR_SIZE);
+ drvrinfo.len = 0;
/* Deserialize the file driver info's prefix */
if(H5F__drvrinfo_prefix_decode(&drvrinfo, NULL, &image, udata, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't decode file driver info prefix")
@@ -916,7 +926,7 @@ H5F__cache_drvrinfo_deserialize(const void *_image, size_t len, void *_udata,
{
H5O_drvinfo_t *drvinfo = NULL; /* Driver info */
H5F_drvrinfo_cache_ud_t *udata = (H5F_drvrinfo_cache_ud_t *)_udata; /* User data */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ const uint8_t *image = _image; /* Pointer into raw data buffer */
char drv_name[9]; /* Name of driver */
H5O_drvinfo_t *ret_value = NULL; /* Return value */
@@ -1010,7 +1020,7 @@ H5F__cache_drvrinfo_serialize(const H5F_t *f, void *_image, size_t len,
void *_thing)
{
H5O_drvinfo_t *drvinfo = (H5O_drvinfo_t *)_thing; /* Pointer to the object */
- uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */
+ uint8_t *image = _image; /* Pointer into raw data buffer */
uint8_t *dbuf; /* Pointer to beginning of driver info */
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5G.c b/src/H5G.c
index fdf613c..85515d3 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -345,6 +345,9 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group creation property list")
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 2d1c1f2..ab448ef 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -406,7 +406,7 @@ static herr_t
H5HF__cache_hdr_get_final_load_size(const void *_image, size_t image_len,
void *_udata, size_t *actual_len)
{
- H5HF_hdr_t hdr; /* Temporary fractal heap header */
+ H5HF_hdr_t hdr; /* Temporary fractal heap header */
const uint8_t *image = (const uint8_t *)_image; /* Pointer into into supplied image */
H5HF_hdr_cache_ud_t *udata = (H5HF_hdr_cache_ud_t *)_udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -419,6 +419,12 @@ H5HF__cache_hdr_get_final_load_size(const void *_image, size_t image_len,
HDassert(actual_len);
HDassert(*actual_len == image_len);
+ /* Initialize because GCC 5.5 does not realize that the
+ * H5HF__hdr_prefix_decode() call is sufficient to initialize.
+ * GCC 8 is clever enough to see that the variable is initialized.
+ * TBD condition on compiler version.
+ */
+ hdr.filter_len = 0;
/* Deserialize the fractal heap header's prefix */
if(H5HF__hdr_prefix_decode(&hdr, &image) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode fractal heap header prefix")
diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c
index 0c27180..79d790b 100644
--- a/src/H5HFtiny.c
+++ b/src/H5HFtiny.c
@@ -377,7 +377,7 @@ done:
herr_t
H5HF_tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id)
{
- size_t enc_obj_size; /* Encoded object size */
+ size_t enc_obj_size = 0; /* Encoded object size */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index 29e88df..9f6e73f 100644
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -205,7 +205,7 @@ static herr_t
H5HG__cache_heap_get_final_load_size(const void *image, size_t image_len,
void *udata, size_t *actual_len)
{
- H5HG_heap_t heap; /* Global heap */
+ H5HG_heap_t heap; /* Global heap */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -217,6 +217,12 @@ H5HG__cache_heap_get_final_load_size(const void *image, size_t image_len,
HDassert(*actual_len == image_len);
HDassert(image_len == H5HG_MINSIZE);
+ /* Initialize because GCC 5.5 cannot see that
+ * H5HG__hdr_deserialize() initializes.
+ *
+ * TBD condition on compiler version.
+ */
+ heap.size = 0;
/* Deserialize the heap's header */
if(H5HG__hdr_deserialize(&heap, (const uint8_t *)image, (const H5F_t *)udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode global heap prefix")
diff --git a/src/H5L.c b/src/H5L.c
index 1e554a9..c8c8cde 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -299,6 +299,9 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC,
((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0)
@@ -386,6 +389,9 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC,
((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0)
@@ -473,10 +479,13 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name
if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
- /* Check the group access property list */
+ /* Get the link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* Set location fields */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = link_name;
@@ -549,6 +558,9 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, cur_loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
@@ -635,10 +647,13 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
if(!udata && udata_size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata cannot be NULL if udata_size is non-zero")
- /* Check the group access property list */
+ /* Get the link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
@@ -1850,8 +1865,8 @@ H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATT
/* Check for non-default link creation properties */
if(udata->lc_plist) {
/* Get character encoding property */
- if(H5P_get(udata->lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &udata->lnk->cset) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get property value for character encoding")
+ if(H5CX_get_encoding(&udata->lnk->cset) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'character set' property")
} /* end if */
else
udata->lnk->cset = H5F_DEFAULT_CSET; /* Default character encoding for link */
@@ -1992,8 +2007,8 @@ H5L__create_real(const H5G_loc_t *link_loc, const char *link_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Get intermediate group creation property */
- if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &crt_intmd_group) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups")
+ if(H5CX_get_intermediate_group(&crt_intmd_group) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'create intermediate group' property")
if(crt_intmd_group > 0)
target_flags |= H5G_CRT_INTMD_GROUP;
@@ -2881,7 +2896,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Get intermediate group creation property */
- if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &crt_intmd_group) < 0)
+ if(H5CX_get_intermediate_group(&crt_intmd_group) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups")
/* Set target flags for source and destination */
@@ -2889,7 +2904,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo
dst_target_flags |= H5G_CRT_INTMD_GROUP;
/* Get character encoding property */
- if(H5P_get(lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &char_encoding) < 0)
+ if(H5CX_get_encoding(&char_encoding) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for character encoding")
} /* end if */
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index 3c4ffcc..e075ed7 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -364,10 +364,13 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
if(!link_name || !*link_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified")
- /* Check the group access property list */
+ /* Get the link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* Get normalized copy of the link target */
if(NULL == (norm_obj_name = H5G_normalize(obj_name)))
HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize object name")
diff --git a/src/H5O.c b/src/H5O.c
index ffb49d9..b79914c 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -360,10 +360,13 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
- /* Check the group access property list */
+ /* Get the link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, obj_id, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index f685a00c..878cb8a 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -674,7 +674,7 @@ H5O__attr_copy_file(H5F_t *file_src, const H5O_msg_class_t H5_ATTR_UNUSED *mesg_
/* Mark datatype as being on disk now. This step used to be done in a lower level
* by H5O_dtype_decode. But it has been moved up. Not an ideal place, but no better
* place than here. */
- if(H5T_set_loc(((H5A_t *)native_src)->shared->dt, file_src, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(((H5A_t *)native_src)->shared->dt, H5F_VOL_OBJ(file_src), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location")
if(NULL == (ret_value = H5A__attr_copy_file((H5A_t *)native_src, file_dst, recompute_size, cpy_info)))
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 57ec9b8..71cbc1d 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -535,7 +535,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name)
} /* end else */
/* Mark datatype as being on disk now */
- if(H5T_set_loc(opened_attr->shared->dt, loc->file, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(opened_attr->shared->dt, H5F_VOL_OBJ(loc->file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location")
} /* end else */
@@ -642,7 +642,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy existing attribute")
} else {
/* Mark datatype as being on disk now */
- if(H5T_set_loc(opened_attr->shared->dt, loc->file, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(opened_attr->shared->dt, H5F_VOL_OBJ(loc->file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location")
} /* end if */
} /* end if */
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 6e0db25..55013c9 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -227,6 +227,9 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(TRUE != H5P_isa_class(ocpypl_id, H5P_OBJECT_COPY))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not object copy property list")
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(src_loc_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info")
diff --git a/src/H5Ocopy_ref.c b/src/H5Ocopy_ref.c
index 3b18073..d8efeb5 100644
--- a/src/H5Ocopy_ref.c
+++ b/src/H5Ocopy_ref.c
@@ -333,7 +333,7 @@ H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src, H5T_t *dt_src,
/* create reference datatype at the destinaton file */
if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy")
- if(H5T_set_loc(dt_dst, dst_oloc->file, H5T_LOC_DISK) < 0) {
+ if(H5T_set_loc(dt_dst, H5F_VOL_OBJ(dst_oloc->file), H5T_LOC_DISK) < 0) {
(void)H5T_close_real(dt_dst);
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
} /* end if */
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 805df2b..c27ece0 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -1559,7 +1559,7 @@ H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src,
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
/* Set the location of the source datatype to describe the disk form of the data */
- if(H5T_set_loc(udata->src_dtype, file_src, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(udata->src_dtype, H5F_VOL_OBJ(file_src), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
} /* end if */
@@ -1596,7 +1596,7 @@ H5O__dtype_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const H5O_msg_class_t *mesg
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy")
/* The datatype will be in the new file; set its location. */
- if(H5T_set_loc(dst_mesg, file_dst, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(dst_mesg, H5F_VOL_OBJ(file_dst), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to set location")
ret_value = dst_mesg;
diff --git a/src/H5Oint.c b/src/H5Oint.c
index ecf347c..0029976 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -31,6 +31,7 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
#include "H5FLprivate.h" /* Free lists */
@@ -352,8 +353,18 @@ H5O__create_ohdr(H5F_t *f, hid_t ocpl_id)
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a property list")
/* Get any object header status flags set by properties */
- if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags")
+ if(H5P_DATASET_CREATE_DEFAULT == ocpl_id)
+ {
+ /* If the OCPL is the default DCPL, we can get the header flags from the
+ * API context. Otherwise we have to call H5P_get */
+ if(H5CX_get_ohdr_flags(&oh_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags")
+ }
+ else
+ {
+ if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags")
+ }
if(H5O_set_version(f, oh, oh_flags, H5F_STORE_MSG_CRT_IDX(f)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, NULL, "can't set version of object header")
diff --git a/src/H5Pmapl.c b/src/H5Pmapl.c
index fe5be0f..59da91a 100644
--- a/src/H5Pmapl.c
+++ b/src/H5Pmapl.c
@@ -138,6 +138,7 @@ done:
} /* end H5P__macc_reg_prop() */
+#ifdef H5_HAVE_MAP_API
/*-------------------------------------------------------------------------
* Function: H5Pset_map_iterate_hints
*
@@ -214,4 +215,4 @@ H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size, size_t *key_a
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_map_iterate_hints() */
-
+#endif /* H5_HAVE_MAP_API */
diff --git a/src/H5Rint.c b/src/H5Rint.c
index 443a245..9fbc7ef 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -504,6 +504,7 @@ H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id)
H5VL_connector_prop_t connector_prop;
unsigned flags = H5F_ACC_RDWR; /* Must open file read-write to allow for object modifications */
H5P_genplist_t *plist;
+ H5VL_object_t *vol_obj = NULL; /* VOL object for file */
hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_PACKAGE
@@ -534,6 +535,14 @@ H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id)
if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
+ /* Get the file object */
+ if(NULL == (vol_obj = H5VL_vol_object(ret_value)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier")
+
+ /* Make the post open callback */
+ if(H5VL_file_specific(vol_obj, H5VL_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file post open callback")
+
/* Attach loc_id to reference */
if(H5R__set_loc_id((H5R_ref_priv_t *)ref, ret_value, FALSE) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "unable to attach location id to reference")
@@ -1160,8 +1169,8 @@ H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc)
/* Don't encode if buffer size isn't big enough or buffer is empty */
if(buf && *nalloc >= ((size_t)buf_size + 2 * H5_SIZEOF_UINT32_T)) {
- p = (uint8_t *)buf;
int rank;
+ p = (uint8_t *)buf;
/* Encode the size for safety check */
UINT32ENCODE(p, (uint32_t)buf_size);
diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h
index ce54ac4..045e04a 100644
--- a/src/H5Rpublic.h
+++ b/src/H5Rpublic.h
@@ -70,14 +70,18 @@ typedef haddr_t hobj_ref_t;
* machine (8 bytes currently) plus an int.
* Note! This type can only be used with the "native" HDF5 VOL connector.
*/
-typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE];
+typedef struct {
+ unsigned char content[H5R_DSET_REG_REF_BUF_SIZE];
+} hdset_reg_ref_t;
/**
* Opaque reference type. The same reference type is used for object,
* dataset region and attribute references. This is the type that
* should always be used with the current reference API.
*/
-typedef unsigned char H5R_ref_t[H5R_REF_BUF_SIZE];
+typedef struct {
+ unsigned char content[H5R_REF_BUF_SIZE];
+} H5R_ref_t;
/********************/
/* Public Variables */
diff --git a/src/H5SL.c b/src/H5SL.c
index 5f00fb8..ec06395 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -1394,7 +1394,7 @@ H5SL_search(H5SL_t *slist, const void *key)
{
H5SL_node_t *x; /* Current node to examine */
uint32_t hashval = 0; /* Hash value for key */
- void *ret_value; /* Return value */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1695,7 +1695,7 @@ H5SL_find(H5SL_t *slist, const void *key)
{
H5SL_node_t *x; /* Current node to examine */
uint32_t hashval = 0; /* Hash value for key */
- H5SL_node_t *ret_value; /* Return value */
+ H5SL_node_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
diff --git a/src/H5SM.c b/src/H5SM.c
index 290e575..91ef98b 100644
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -313,7 +313,7 @@ ssize_t
H5SM_get_index(const H5SM_master_table_t *table, unsigned type_id)
{
size_t x;
- unsigned type_flag;
+ unsigned type_flag = 0;
ssize_t ret_value = FAIL;
FUNC_ENTER_NOAPI_NOINIT
@@ -353,7 +353,7 @@ htri_t
H5SM_type_shared(H5F_t *f, unsigned type_id)
{
H5SM_master_table_t *table = NULL; /* Shared object master table */
- unsigned type_flag; /* Flag corresponding to message type */
+ unsigned type_flag = 0; /* Flag corresponding to message type */
size_t u; /* Local index variable */
htri_t ret_value = FALSE; /* Return value */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 9d0a65a..4a4245d 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -66,6 +66,7 @@ static htri_t H5S__all_shape_same(const H5S_t *space1, const H5S_t *space2);
static htri_t H5S__all_intersect_block(const H5S_t *space, const hsize_t *start,
const hsize_t *end);
static herr_t H5S__all_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S__all_adjust_s(H5S_t *space, const hssize_t *offset);
static herr_t H5S__all_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S__all_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
static herr_t H5S__all_iter_init(const H5S_t *space, H5S_sel_iter_t *iter);
@@ -112,6 +113,7 @@ const H5S_select_class_t H5S_sel_all[1] = {{
H5S__all_shape_same,
H5S__all_intersect_block,
H5S__all_adjust_u,
+ H5S__all_adjust_s,
H5S__all_project_scalar,
H5S__all_project_simple,
H5S__all_iter_init,
@@ -1043,6 +1045,37 @@ H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off
} /* end H5S__all_adjust_u() */
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__all_adjust_s
+ PURPOSE
+ Adjust an "all" selection by subtracting an offset
+ USAGE
+ herr_t H5S__all_adjust_u(space, offset)
+ H5S_t *space; IN/OUT: Pointer to dataspace to adjust
+ const hssize_t *offset; IN: Offset to subtract
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Moves selection by subtracting an offset from it.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__all_adjust_s(H5S_t H5_ATTR_UNUSED *space, const hssize_t H5_ATTR_UNUSED *offset)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(space);
+ HDassert(offset);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__all_adjust_s() */
+
+
/*-------------------------------------------------------------------------
* Function: H5S__all_project_scalar
*
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 9feb8de..ab06eff 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -96,6 +96,7 @@ typedef struct {
hsize_t skip; /* Number of elements to skip in projected space */
hsize_t nelem; /* Number of elements to add to projected space (after skip) */
uint64_t op_gen; /* Operation generation for counting elements */
+ hbool_t share_selection; /* Whether span trees in dst_space can be shared with proj_space */
} H5S_hyper_project_intersect_ud_t;
/* Assert that H5S_MAX_RANK is <= 32 so our trick with using a 32 bit bitmap
@@ -112,6 +113,9 @@ typedef struct {
static H5S_hyper_span_t *H5S__hyper_new_span(hsize_t low, hsize_t high,
H5S_hyper_span_info_t *down, H5S_hyper_span_t *next);
static H5S_hyper_span_info_t *H5S__hyper_new_span_info(unsigned rank);
+static H5S_hyper_span_info_t *H5S__hyper_copy_span_helper(
+ H5S_hyper_span_info_t *spans, unsigned rank, unsigned op_info_i,
+ uint64_t op_gen);
static H5S_hyper_span_info_t *H5S__hyper_copy_span(H5S_hyper_span_info_t *spans,
unsigned rank);
static hbool_t H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1,
@@ -132,7 +136,7 @@ static herr_t H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans,
H5S_hyper_span_info_t **a_and_b, H5S_hyper_span_info_t **b_not_a);
static herr_t H5S__hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans);
static hsize_t H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans,
- uint64_t op_gen);
+ unsigned op_info_i, uint64_t op_gen);
static hsize_t H5S__hyper_spans_nelem(H5S_hyper_span_info_t *spans);
static herr_t H5S__hyper_add_disjoint_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans);
static H5S_hyper_span_info_t *H5S__hyper_make_spans(unsigned rank,
@@ -190,6 +194,7 @@ static htri_t H5S__hyper_shape_same(const H5S_t *space1, const H5S_t *space2);
static htri_t H5S__hyper_intersect_block(const H5S_t *space, const hsize_t *start,
const hsize_t *end);
static herr_t H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S__hyper_adjust_s(H5S_t *space, const hssize_t *offset);
static herr_t H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S__hyper_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
static herr_t H5S__hyper_iter_init(const H5S_t *space, H5S_sel_iter_t *iter);
@@ -236,6 +241,7 @@ const H5S_select_class_t H5S_sel_hyper[1] = {{
H5S__hyper_shape_same,
H5S__hyper_intersect_block,
H5S__hyper_adjust_u,
+ H5S__hyper_adjust_s,
H5S__hyper_project_scalar,
H5S__hyper_project_simple,
H5S__hyper_iter_init,
@@ -2852,9 +2858,10 @@ done:
PURPOSE
Helper routine to copy a hyperslab span tree
USAGE
- H5S_hyper_span_info_t * H5S__hyper_copy_span_helper(spans, rank)
+ H5S_hyper_span_info_t * H5S__hyper_copy_span_helper(spans, rank, op_info_i, op_gen)
H5S_hyper_span_info_t *spans; IN: Span tree to copy
unsigned rank; IN: Rank of span tree
+ unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURNS
Pointer to the copied span tree on success, NULL on failure
@@ -2867,7 +2874,7 @@ done:
--------------------------------------------------------------------------*/
static H5S_hyper_span_info_t *
H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank,
- uint64_t op_gen)
+ unsigned op_info_i, uint64_t op_gen)
{
H5S_hyper_span_t *span; /* Hyperslab span */
H5S_hyper_span_t *new_span; /* Temporary hyperslab span */
@@ -2881,9 +2888,9 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank,
HDassert(spans);
/* Check if the span tree was already copied */
- if(spans->op_gen == op_gen) {
+ if(spans->op_info[op_info_i].op_gen == op_gen) {
/* Just return the value of the already copied span tree */
- ret_value = spans->u.copied;
+ ret_value = spans->op_info[op_info_i].u.copied;
/* Increment the reference count of the span tree */
ret_value->count++;
@@ -2899,10 +2906,10 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank,
ret_value->count = 1;
/* Set the operation generation for the span info, to avoid future copies */
- spans->op_gen = op_gen;
+ spans->op_info[op_info_i].op_gen = op_gen;
/* Set the 'copied' pointer in the node being copied to the newly allocated node */
- spans->u.copied = ret_value;
+ spans->op_info[op_info_i].u.copied = ret_value;
/* Copy over the nodes in the span list */
span = spans->head;
@@ -2920,7 +2927,7 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank,
/* Recurse to copy the 'down' spans, if there are any */
if(span->down != NULL) {
- if(NULL == (new_down = H5S__hyper_copy_span_helper(span->down, rank - 1, op_gen)))
+ if(NULL == (new_down = H5S__hyper_copy_span_helper(span->down, rank - 1, op_info_i, op_gen)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy hyperslab spans")
new_span->down = new_down;
} /* end if */
@@ -2976,7 +2983,9 @@ H5S__hyper_copy_span(H5S_hyper_span_info_t *spans, unsigned rank)
op_gen = H5S__hyper_get_op_gen();
/* Copy the hyperslab span tree */
- if(NULL == (ret_value = H5S__hyper_copy_span_helper(spans, rank, op_gen)))
+ /* Always use op_info[0] since we own this op_info, so there can be no
+ * simultaneous operations */
+ if(NULL == (ret_value = H5S__hyper_copy_span_helper(spans, rank, 0, op_gen)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy hyperslab span tree")
done:
@@ -3315,8 +3324,9 @@ done:
PURPOSE
Helper routine to count the number of blocks in a span tree
USAGE
- hsize_t H5S__hyper_span_nblocks_helper(spans)
+ hsize_t H5S__hyper_span_nblocks_helper(spans, op_info_i, op_gen)
H5S_hyper_span_info_t *spans; IN: Hyperslab span tree to count blocks of
+ unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURNS
Number of blocks in span tree on success; negative on failure
@@ -3328,7 +3338,8 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static hsize_t
-H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
+H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, unsigned op_info_i,
+ uint64_t op_gen)
{
hsize_t ret_value = 0; /* Return value */
@@ -3338,9 +3349,9 @@ H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
HDassert(spans);
/* Check if the span tree was already counted */
- if(spans->op_gen == op_gen)
+ if(spans->op_info[op_info_i].op_gen == op_gen)
/* Just return the # of blocks in the already counted span tree */
- ret_value = spans->u.nblocks;
+ ret_value = spans->op_info[op_info_i].u.nblocks;
else { /* Count the number of elements in the span tree */
H5S_hyper_span_t *span; /* Hyperslab span */
@@ -3348,7 +3359,7 @@ H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
if(span->down) {
while(span) {
/* If there are down spans, add the total down span blocks */
- ret_value += H5S__hyper_span_nblocks_helper(span->down, op_gen);
+ ret_value += H5S__hyper_span_nblocks_helper(span->down, op_info_i, op_gen);
/* Advance to next span */
span = span->next;
@@ -3365,10 +3376,10 @@ H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
} /* end else */
/* Set the operation generation for this span tree, to avoid re-computing */
- spans->op_gen = op_gen;
+ spans->op_info[op_info_i].op_gen = op_gen;
/* Hold a copy of the # of blocks */
- spans->u.nblocks = ret_value;
+ spans->op_info[op_info_i].u.nblocks = ret_value;
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
@@ -3406,7 +3417,10 @@ H5S__hyper_span_nblocks(H5S_hyper_span_info_t *spans)
/* Acquire an operation generation value for this operation */
op_gen = H5S__hyper_get_op_gen();
- ret_value = H5S__hyper_span_nblocks_helper(spans, op_gen);
+ /* Count the blocks */
+ /* Always use op_info[0] since we own this op_info, so there can be no
+ * simultaneous operations */
+ ret_value = H5S__hyper_span_nblocks_helper(spans, 0, op_gen);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -5946,7 +5960,7 @@ H5S__hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree,
/* Check if we've compared the 'stop' span's "down tree" to
* this span's "down tree" already.
*/
- if(tmp_span->down->op_gen != op_gen) {
+ if(tmp_span->down->op_info[0].op_gen != op_gen) {
if(H5S__hyper_cmp_spans(tmp_span->down, stop_span->down))
attempt_merge_spans = TRUE;
@@ -5954,7 +5968,7 @@ H5S__hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree,
/* (Because it wasn't the same as the 'stop' span's down tree
* and we don't need to compare it again)
*/
- tmp_span->down->op_gen = op_gen;
+ tmp_span->down->op_info[0].op_gen = op_gen;
} /* end if */
} /* end else */
@@ -6159,11 +6173,12 @@ done:
PURPOSE
Helper routine to detect intersections in span trees
USAGE
- hbool_t H5S__hyper_intersect_block_helper(spans, start, end)
+ hbool_t H5S__hyper_intersect_block_helper(spans, rank, start, end, op_info_i, op_gen)
H5S_hyper_span_info_t *spans; IN: First span tree to operate with
unsigned rank; IN: Number of dimensions for span tree
hsize_t *start; IN: Starting coordinate for block
hsize_t *end; IN: Ending coordinate for block
+ unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURN
Non-negative (TRUE/FALSE) on success, can't fail
@@ -6176,7 +6191,8 @@ done:
--------------------------------------------------------------------------*/
static hbool_t
H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans,
- unsigned rank, const hsize_t *start, const hsize_t *end, uint64_t op_gen)
+ unsigned rank, const hsize_t *start, const hsize_t *end, unsigned op_info_i,
+ uint64_t op_gen)
{
hbool_t ret_value = FALSE; /* Return value */
@@ -6188,7 +6204,7 @@ H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans,
HDassert(end);
/* Check if we've already visited this span tree */
- if(spans->op_gen != op_gen) {
+ if(spans->op_info[op_info_i].op_gen != op_gen) {
H5S_hyper_span_t *curr; /* Pointer to current span in 1st span tree */
unsigned u; /* Local index variable */
@@ -6221,7 +6237,7 @@ H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans,
/* If there is an intersection in the "down" dimensions,
* the span trees overlap.
*/
- if(H5S__hyper_intersect_block_helper(curr->down, rank - 1, start + 1, end + 1, op_gen))
+ if(H5S__hyper_intersect_block_helper(curr->down, rank - 1, start + 1, end + 1, op_info_i, op_gen))
HGOTO_DONE(TRUE)
/* No intersection in down dimensions, advance to next span */
@@ -6231,7 +6247,7 @@ H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans,
} /* end while */
/* Set the tree's operation generation */
- spans->op_gen = op_gen;
+ spans->op_info[op_info_i].op_gen = op_gen;
} /* end if */
/* Fall through with 'FALSE' return value */
@@ -6267,7 +6283,7 @@ H5S__hyper_intersect_block(const H5S_t *space, const hsize_t *start, const hsize
{
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(space);
@@ -6363,7 +6379,9 @@ H5S__hyper_intersect_block(const H5S_t *space, const hsize_t *start, const hsize
op_gen = H5S__hyper_get_op_gen();
/* Perform the span-by-span intersection check */
- ret_value = H5S__hyper_intersect_block_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, start, end, op_gen);
+ /* Always use op_info[0] since we own this op_info, so there can be no
+ * simultaneous operations */
+ ret_value = H5S__hyper_intersect_block_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, start, end, 0, op_gen);
} /* end else */
done:
@@ -6377,10 +6395,11 @@ done:
PURPOSE
Helper routine to adjust offsets in span trees
USAGE
- void H5S__hyper_adjust_u_helper(spans, offset)
+ void H5S__hyper_adjust_u_helper(spans, rank, offset, op_info_i, op_gen)
H5S_hyper_span_info_t *spans; IN: Span tree to operate with
unsigned rank; IN: Number of dimensions for span tree
const hsize_t *offset; IN: Offset to subtract
+ unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURNS
None
@@ -6393,7 +6412,7 @@ done:
--------------------------------------------------------------------------*/
static void
H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank,
- const hsize_t *offset, uint64_t op_gen)
+ const hsize_t *offset, unsigned op_info_i, uint64_t op_gen)
{
FUNC_ENTER_STATIC_NOERR
@@ -6402,7 +6421,7 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank,
HDassert(offset);
/* Check if we've already set this span tree */
- if(spans->op_gen != op_gen) {
+ if(spans->op_info[op_info_i].op_gen != op_gen) {
H5S_hyper_span_t *span; /* Pointer to current span in span tree */
unsigned u; /* Local index variable */
@@ -6423,14 +6442,14 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank,
/* Recursively adjust spans in next dimension down */
if(span->down != NULL)
- H5S__hyper_adjust_u_helper(span->down, rank - 1, offset + 1, op_gen);
+ H5S__hyper_adjust_u_helper(span->down, rank - 1, offset + 1, op_info_i, op_gen);
/* Advance to next span in this dimension */
span = span->next;
} /* end while */
/* Set the tree's operation generation */
- spans->op_gen = op_gen;
+ spans->op_info[op_info_i].op_gen = op_gen;
} /* end if */
FUNC_LEAVE_NOAPI_VOID
@@ -6458,36 +6477,50 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank,
static herr_t
H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset)
{
+ hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */
+ unsigned u; /* Local index variable */
+
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(space);
HDassert(offset);
- /* Subtract the offset from the "regular" coordinates, if they exist */
- /* (No need to rebuild the dimension info yet -QAK) */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
- unsigned u; /* Local index variable */
+ /* Check for an all-zero offset vector */
+ for(u = 0; u < space->extent.rank; u++)
+ if(0 != offset[u]) {
+ non_zero_offset = TRUE;
+ break;
+ } /* end if */
- for(u = 0; u < space->extent.rank; u++) {
- HDassert(space->select.sel_info.hslab->diminfo.opt[u].start >= offset[u]);
- space->select.sel_info.hslab->diminfo.opt[u].start -= offset[u];
+ /* Only perform operation if the offset is non-zero */
+ if(non_zero_offset) {
+ /* Subtract the offset from the "regular" coordinates, if they exist */
+ /* (No need to rebuild the dimension info yet -QAK) */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ for(u = 0; u < space->extent.rank; u++) {
+ HDassert(space->select.sel_info.hslab->diminfo.opt[u].start >= offset[u]);
+ space->select.sel_info.hslab->diminfo.opt[u].start -= offset[u];
- /* Adjust the low & high bounds */
- HDassert(space->select.sel_info.hslab->diminfo.low_bounds[u] >= offset[u]);
- space->select.sel_info.hslab->diminfo.low_bounds[u] -= offset[u];
- space->select.sel_info.hslab->diminfo.high_bounds[u] -= offset[u];
- } /* end for */
- } /* end if */
+ /* Adjust the low & high bounds */
+ HDassert(space->select.sel_info.hslab->diminfo.low_bounds[u] >= offset[u]);
+ space->select.sel_info.hslab->diminfo.low_bounds[u] -= offset[u];
+ space->select.sel_info.hslab->diminfo.high_bounds[u] -= offset[u];
+ } /* end for */
+ } /* end if */
- /* Subtract the offset from the span tree coordinates, if they exist */
- if(space->select.sel_info.hslab->span_lst) {
- uint64_t op_gen; /* Operation generation value */
+ /* Subtract the offset from the span tree coordinates, if they exist */
+ if(space->select.sel_info.hslab->span_lst) {
+ uint64_t op_gen; /* Operation generation value */
- /* Acquire an operation generation value for this operation */
- op_gen = H5S__hyper_get_op_gen();
+ /* Acquire an operation generation value for this operation */
+ op_gen = H5S__hyper_get_op_gen();
- H5S__hyper_adjust_u_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, offset, op_gen);
+ /* Perform adjustment */
+ /* Always use op_info[0] since we own this op_info, so there can be no
+ * simultaneous operations */
+ H5S__hyper_adjust_u_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, offset, 0, op_gen);
+ } /* end if */
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -6897,10 +6930,11 @@ done:
PURPOSE
Helper routine to adjust offsets in span trees
USAGE
- void H5S__hyper_adjust_s_helper(spans, offset)
+ void H5S__hyper_adjust_s_helper(spans, rank, offset, op_info_i, op_gen)
H5S_hyper_span_info_t *spans; IN: Span tree to operate with
unsigned rank; IN: Number of dimensions for span tree
const hssize_t *offset; IN: Offset to subtract
+ unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURNS
None
@@ -6913,7 +6947,7 @@ done:
--------------------------------------------------------------------------*/
static void
H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank,
- const hssize_t *offset, uint64_t op_gen)
+ const hssize_t *offset, unsigned op_info_i, uint64_t op_gen)
{
FUNC_ENTER_STATIC_NOERR
@@ -6922,7 +6956,7 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank,
HDassert(offset);
/* Check if we've already set this span tree */
- if(spans->op_gen != op_gen) {
+ if(spans->op_info[op_info_i].op_gen != op_gen) {
H5S_hyper_span_t *span; /* Pointer to current span in span tree */
unsigned u; /* Local index variable */
@@ -6943,14 +6977,14 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank,
/* Recursively adjust spans in next dimension down */
if(span->down != NULL)
- H5S__hyper_adjust_s_helper(span->down, rank - 1, offset + 1, op_gen);
+ H5S__hyper_adjust_s_helper(span->down, rank - 1, offset + 1, op_info_i, op_gen);
/* Advance to next span in this dimension */
span = span->next;
} /* end while */
/* Set the tree's operation generation */
- spans->op_gen = op_gen;
+ spans->op_info[op_info_i].op_gen = op_gen;
} /* end if */
FUNC_LEAVE_NOAPI_VOID
@@ -6959,11 +6993,11 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank,
/*--------------------------------------------------------------------------
NAME
- H5S_hyper_adjust_s
+ H5S__hyper_adjust_s
PURPOSE
Adjust a hyperslab selection by subtracting an offset
USAGE
- herr_t H5S_hyper_adjust_s(space,offset)
+ herr_t H5S__hyper_adjust_s(space,offset)
H5S_t *space; IN/OUT: Pointer to dataspace to adjust
const hssize_t *offset; IN: Offset to subtract
RETURNS
@@ -6975,8 +7009,8 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank,
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
-H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset)
+static herr_t
+H5S__hyper_adjust_s(H5S_t *space, const hssize_t *offset)
{
hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */
unsigned u; /* Local index variable */
@@ -7018,54 +7052,16 @@ H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset)
/* Acquire an operation generation value for this operation */
op_gen = H5S__hyper_get_op_gen();
- H5S__hyper_adjust_s_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, offset, op_gen);
+ /* Perform the adjustment */
+ /* Always use op_info[0] since we own this op_info, so there can be no
+ * simultaneous operations */
+ H5S__hyper_adjust_s_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, offset, 0, op_gen);
} /* end if */
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_adjust_s() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5Shyper_adjust_s
- PURPOSE
- Adjust a hyperslab selection by subtracting an offset
- USAGE
- herr_t H5Shyper_adjust_s(space_id,offset)
- hid_t space_id; IN: ID of the dataspace to adjust
- const hssize_t *offset; IN: Offset to subtract
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- Moves a hyperslab selection by subtracting an offset from it.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5Shyper_adjust_s(hid_t space_id, const hssize_t *offset)
-{
- H5S_t *space;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Hs", space_id, offset);
-
- if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
- if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection")
- if(NULL == offset)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "NULL offset pointer")
-
- if(H5S_hyper_adjust_s(space, offset) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Shyper_adjust_s() */
+} /* end H5S__hyper_adjust_s() */
/*--------------------------------------------------------------------------
@@ -7111,7 +7107,7 @@ H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset)
} /* end for */
/* Call the 'adjust' routine */
- if(H5S_hyper_adjust_s(space, space->select.offset) < 0)
+ if(H5S__hyper_adjust_s(space, space->select.offset) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection")
/* Zero out the selection offset */
@@ -7159,7 +7155,7 @@ H5S_hyper_denormalize_offset(H5S_t *space, const hssize_t *old_offset)
HDassert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS);
/* Call the 'adjust' routine */
- if(H5S_hyper_adjust_s(space, old_offset) < 0)
+ if(H5S__hyper_adjust_s(space, old_offset) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection")
/* Copy the selection offset over */
@@ -8281,8 +8277,9 @@ done:
PURPOSE
Count the number of elements in a span tree
USAGE
- hsize_t H5S__hyper_spans_nelem_helper(spans, op_gen)
+ hsize_t H5S__hyper_spans_nelem_helper(spans, op_info_i, op_gen)
const H5S_hyper_span_info_t *spans; IN: Hyperslan span tree to count elements of
+ unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURNS
Number of elements in span tree on success; negative on failure
@@ -8294,7 +8291,8 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static hsize_t
-H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
+H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, unsigned op_info_i,
+ uint64_t op_gen)
{
hsize_t ret_value = 0; /* Return value */
@@ -8304,9 +8302,9 @@ H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
HDassert(spans);
/* Check if the span tree was already counted */
- if(spans->op_gen == op_gen)
+ if(spans->op_info[op_info_i].op_gen == op_gen)
/* Just return the # of elements in the already counted span tree */
- ret_value = spans->u.nelmts;
+ ret_value = spans->op_info[op_info_i].u.nelmts;
else { /* Count the number of elements in the span tree */
const H5S_hyper_span_t *span; /* Hyperslab span */
@@ -8328,7 +8326,7 @@ H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
nelmts = (span->high - span->low) + 1;
/* Multiply the size of this span by the total down span elements */
- ret_value += nelmts * H5S__hyper_spans_nelem_helper(span->down, op_gen);
+ ret_value += nelmts * H5S__hyper_spans_nelem_helper(span->down, op_info_i, op_gen);
/* Advance to next span */
span = span->next;
@@ -8336,10 +8334,10 @@ H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
} /* end else */
/* Set the operation generation for this span tree, to avoid re-computing */
- spans->op_gen = op_gen;
+ spans->op_info[op_info_i].op_gen = op_gen;
/* Hold a copy of the # of elements */
- spans->u.nelmts = ret_value;
+ spans->op_info[op_info_i].u.nelmts = ret_value;
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
@@ -8378,7 +8376,9 @@ H5S__hyper_spans_nelem(H5S_hyper_span_info_t *spans)
op_gen = H5S__hyper_get_op_gen();
/* Count the number of elements in the span tree */
- ret_value = H5S__hyper_spans_nelem_helper(spans, op_gen);
+ /* Always use op_info[0] since we own this op_info, so there can be no
+ * simultaneous operations */
+ ret_value = H5S__hyper_spans_nelem_helper(spans, 0, op_gen);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_spans_nelem() */
@@ -8808,10 +8808,8 @@ H5S__hyper_update_diminfo(H5S_t *space, H5S_seloper_t op,
(It can be recovered with regular selection)
USAGE
herr_t H5S__hyper_rebuild_helper(space)
- const H5S_hyper_span_t *span; IN: Portion of span tree to check
- H5S_hyper_dim_t span_slab[]; OUT: Rebuilt section of hyperslab description
- unsigned rank; IN: Current dimension to work on
- uint64_t op_gen; IN: Operation generation
+ const H5S_hyper_span_t *spans; IN: Portion of span tree to check
+ H5S_hyper_dim_t span_slab_info[]; OUT: Rebuilt section of hyperslab description
RETURNS
TRUE/FALSE for hyperslab selection rebuilt
DESCRIPTION
@@ -10833,6 +10831,7 @@ done:
--------------------------------------------------------------------------*/
static herr_t
H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
+ H5S_hyper_span_info_t *copied_span_info = NULL; /* Temporary span info pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -10852,15 +10851,15 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
/* If we will run out of elements to skip in this span,
* advance to the first not fully skipped span and break
* out of this loop (start moving downwards) */
- if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
+ if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, 0, udata->op_gen)
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
- udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->u.nelmts;
- udata->skip %= udata->ds_span[udata->depth]->down->u.nelmts;
+ udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
+ udata->skip %= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
break;
} /* end if */
/* Skip over this entire span */
- udata->skip -= udata->ds_span[udata->depth]->down->u.nelmts
+ udata->skip -= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
} /* end if */
} /* end if */
@@ -10919,15 +10918,15 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
/* If we will run out of elements to skip in this span,
* advance to the first not fully skipped span and
* continue down */
- if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
+ if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, 0, udata->op_gen)
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
- udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->u.nelmts;
- udata->skip %= udata->ds_span[udata->depth]->down->u.nelmts;
+ udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
+ udata->skip %= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
break;
} /* end if */
/* Skip over this entire span */
- udata->skip -= udata->ds_span[udata->depth]->down->u.nelmts
+ udata->skip -= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
/* Advance to next span */
@@ -10972,27 +10971,59 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
* any complete spans, advance to the first not fully added
* span, and break out of this loop (start moving downwards)
*/
- if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
+ if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, 0, udata->op_gen)
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
- if(udata->nelem >= udata->ds_span[udata->depth]->down->u.nelmts) {
- if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
- udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
- udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts) - 1,
- udata->ds_span[udata->depth]->down) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
- udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts;
- udata->nelem %= udata->ds_span[udata->depth]->down->u.nelmts;
+ if(udata->nelem >= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) {
+ if(udata->share_selection) {
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) - 1,
+ udata->ds_span[udata->depth]->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ } /* end if */
+ else {
+ /* If we're not sharing the destination space's
+ * spans, we must copy it first (then release it
+ * afterwards) */
+ if(NULL == (copied_span_info = H5S__hyper_copy_span_helper(udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans")
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) - 1,
+ copied_span_info) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ H5S__hyper_free_span_info(copied_span_info);
+ copied_span_info = NULL;
+ } /* end else */
+ udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
+ udata->nelem %= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
} /* end if */
break;
} /* end if */
/* Append span tree for entire span */
- if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ if(udata->share_selection) {
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
udata->ds_span[udata->depth]->high,
udata->ds_span[udata->depth]->down) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
- udata->nelem -= udata->ds_span[udata->depth]->down->u.nelmts
+ } /* end if */
+ else {
+ /* If we're not sharing the destination space's
+ * spans, we must copy it first (then release it
+ * afterwards) */
+ if(NULL == (copied_span_info = H5S__hyper_copy_span_helper(udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans")
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_span[udata->depth]->high,
+ copied_span_info) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ H5S__hyper_free_span_info(copied_span_info);
+ copied_span_info = NULL;
+ } /* end else */
+ udata->nelem -= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
} /* end if */
} /* end if */
@@ -11063,27 +11094,59 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
* span and continue down
*/
HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high);
- if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
+ if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, 0, udata->op_gen)
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
- if(udata->nelem >= udata->ds_span[udata->depth]->down->u.nelmts) {
- if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
- udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
- udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts) - 1,
- udata->ds_span[udata->depth]->down) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
- udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts;
- udata->nelem %= udata->ds_span[udata->depth]->down->u.nelmts;
+ if(udata->nelem >= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) {
+ if(udata->share_selection) {
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) - 1,
+ udata->ds_span[udata->depth]->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ } /* end if */
+ else {
+ /* If we're not sharing the destination space's
+ * spans, we must copy it first (then release it
+ * afterwards) */
+ if(NULL == (copied_span_info = H5S__hyper_copy_span_helper(udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans")
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) - 1,
+ copied_span_info) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ H5S__hyper_free_span_info(copied_span_info);
+ copied_span_info = NULL;
+ } /* end else */
+ udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
+ udata->nelem %= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
} /* end if */
break;
} /* end if */
/* Append span tree for entire span */
- if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ if(udata->share_selection) {
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
udata->ds_span[udata->depth]->high,
udata->ds_span[udata->depth]->down) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
- udata->nelem -= udata->ds_span[udata->depth]->down->u.nelmts
+ } /* end if */
+ else {
+ /* If we're not sharing the destination space's
+ * spans, we must copy it first (then release it
+ * afterwards) */
+ if(NULL == (copied_span_info = H5S__hyper_copy_span_helper(udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans")
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_span[udata->depth]->high,
+ copied_span_info) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ H5S__hyper_free_span_info(copied_span_info);
+ copied_span_info = NULL;
+ } /* end else */
+ udata->nelem -= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
/* Advance to next span */
@@ -11128,6 +11191,13 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
udata->ps_clean_bitmap = 0;
done:
+ /* Cleanup on failure */
+ if(copied_span_info) {
+ HDassert(ret_value < 0);
+ H5S__hyper_free_span_info(copied_span_info);
+ copied_span_info = NULL;
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_proj_int_build_proj() */
@@ -11217,7 +11287,7 @@ H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
/* Add skipped elements if there's a pre-gap */
if(ss_low < sis_low) {
low = sis_low;
- H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (sis_low - ss_low), FAIL);
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, 0, udata->op_gen) * (sis_low - ss_low), FAIL);
} /* end if */
else
low = ss_low;
@@ -11273,7 +11343,7 @@ H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
if(ss_span->high < sis_low) {
/* Add skipped elements */
if(ss_span->down)
- H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL);
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, 0, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL);
else
H5S_HYPER_PROJ_INT_ADD_SKIP(udata, ss_span->high - ss_low + 1, FAIL);
@@ -11295,10 +11365,10 @@ H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
if(ss_span && !((depth == 0) && (u == count - 1))) {
/* Count remaining elements in ss_span_info */
if(ss_span->down) {
- H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL);
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, 0, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL);
ss_span = ss_span->next;
while(ss_span) {
- H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_span->low + 1), FAIL);
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, 0, udata->op_gen) * (ss_span->high - ss_span->low + 1), FAIL);
ss_span = ss_span->next;
} /* end while */
} /* end if */
@@ -11356,7 +11426,7 @@ H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
} /* end if */
else if(depth > 0)
/* Just count skipped elements */
- H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper((H5S_hyper_span_info_t *)ss_span_info, udata->op_gen) * count, FAIL); /* Casting away const OK -NAF */
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper((H5S_hyper_span_info_t *)ss_span_info, 0, udata->op_gen) * count, FAIL); /* Casting away const OK -NAF */
/* Clean up if we are done */
if(depth == 0) {
@@ -11391,11 +11461,12 @@ done:
src_intersect_space within the selection of src_space as a selection
within the selection of dst_space
USAGE
- herr_t H5S__hyper_project_intersection(src_space,dst_space,src_intersect_space,proj_space)
+ herr_t H5S__hyper_project_intersection(src_space,dst_space,src_intersect_space,proj_space,share_selection)
H5S_t *src_space; IN: Selection that is mapped to dst_space, and intersected with src_intersect_space
H5S_t *dst_space; IN: Selection that is mapped to src_space, and which contains the result
H5S_t *src_intersect_space; IN: Selection whose intersection with src_space is projected to dst_space to obtain the result
H5S_t *proj_space; OUT: Will contain the result (intersection of src_intersect_space and src_space projected from src_space to dst_space) after the operation
+ hbool_t share_selection; IN: Whether we are allowed to share structures inside dst_space with proj_space
RETURNS
Non-negative on success/Negative on failure.
DESCRIPTION
@@ -11414,7 +11485,8 @@ done:
--------------------------------------------------------------------------*/
herr_t
H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
- const H5S_t *src_intersect_space, H5S_t *proj_space)
+ const H5S_t *src_intersect_space, H5S_t *proj_space,
+ hbool_t share_selection)
{
H5S_hyper_project_intersect_ud_t udata; /* User data for subroutines */
const H5S_hyper_span_info_t *ss_span_info;
@@ -11485,12 +11557,14 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "can't construct span tree for source intersect hyperslab selection")
/* Initialize udata */
+ /* We will use op_info[0] for nelem and op_info[1] for copied spans */
HDmemset(&udata, 0, sizeof(udata));
udata.ds_span[0] = ds_span_info->head;
udata.ds_low[0] = udata.ds_span[0]->low;
udata.ss_rank = H5S_GET_EXTENT_NDIMS(src_space);
udata.ds_rank = H5S_GET_EXTENT_NDIMS(dst_space);
udata.op_gen = H5S__hyper_get_op_gen();
+ udata.share_selection = share_selection;
/* Iterate over selections and build projected span tree */
if(H5S__hyper_proj_int_iterate(ss_span_info, src_intersect_space->select.sel_info.hslab->span_lst, 1, 0, &udata) < 0)
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index f605a8a..800913f 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -86,7 +86,7 @@ static herr_t H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
static herr_t H5S__release_datatype(H5S_mpio_mpitype_list_t *type_list);
static herr_t H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
size_t elmt_size, const MPI_Datatype *elmt_type, MPI_Datatype *span_type,
- H5S_mpio_mpitype_list_t *type_list, uint64_t op_gen);
+ H5S_mpio_mpitype_list_t *type_list, unsigned op_info_i, uint64_t op_gen);
/*****************************/
@@ -1007,8 +1007,10 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
op_gen = H5S__hyper_get_op_gen();
/* Obtain derived MPI data type */
+ /* Always use op_info[0] since we own this op_info, so there can be no
+ * simultaneous operations */
type_list.head = type_list.tail = NULL;
- if(H5S__obtain_datatype(space->select.sel_info.hslab->span_lst, down, elmt_size, &elmt_type, &span_type, &type_list, op_gen) < 0)
+ if(H5S__obtain_datatype(space->select.sel_info.hslab->span_lst, down, elmt_size, &elmt_type, &span_type, &type_list, 0, op_gen) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
if(MPI_SUCCESS != (mpi_code = MPI_Type_dup(span_type, new_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
@@ -1096,7 +1098,7 @@ done:
static herr_t
H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
size_t elmt_size, const MPI_Datatype *elmt_type, MPI_Datatype *span_type,
- H5S_mpio_mpitype_list_t *type_list, uint64_t op_gen)
+ H5S_mpio_mpitype_list_t *type_list, unsigned op_info_i, uint64_t op_gen)
{
H5S_hyper_span_t *span; /* Hyperslab span to iterate with */
hsize_t bigio_count; /* Transition point to create derived type */
@@ -1119,7 +1121,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
bigio_count = H5_mpi_get_bigio_count();
/* Check if we've visited this span tree before */
- if(spans->op_gen != op_gen) {
+ if(spans->op_info[op_info_i].op_gen != op_gen) {
H5S_mpio_mpitype_node_t *type_node; /* Pointer to new node in MPI data type list */
/* Allocate the initial displacement & block length buffers */
@@ -1172,7 +1174,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
/* Everything fits into integers, so cast them and use hindexed */
if(bigio_count >= outercount && large_block == FALSE) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)outercount, blocklen, disp, *elmt_type, &spans->u.down_type)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)outercount, blocklen, disp, *elmt_type, &spans->op_info[op_info_i].u.down_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
} /* end if */
else { /* LARGE_DATATYPE:: Something doesn't fit into a 32 bit integer */
@@ -1190,17 +1192,17 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
/* Combine the current datatype that is created with this current block type */
if(0 == u) /* first iteration, there is no combined datatype yet */
- spans->u.down_type = temp_type;
+ spans->op_info[op_info_i].u.down_type = temp_type;
else {
int bl[2] = {1, 1};
MPI_Aint ds[2] = {disp[u - 1], disp[u]};
- MPI_Datatype dt[2] = {spans->u.down_type, temp_type};
+ MPI_Datatype dt[2] = {spans->op_info[op_info_i].u.down_type, temp_type};
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(2, /* count */
bl, /* blocklength */
ds, /* stride in bytes*/
dt, /* old type */
- &spans->u.down_type))) /* new type */
+ &spans->op_info[op_info_i].u.down_type))) /* new type */
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
/* Release previous temporary datatype */
@@ -1253,7 +1255,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
blocklen[outercount] = 1;
/* Generate MPI datatype for next dimension down */
- if(H5S__obtain_datatype(span->down, down + 1, elmt_size, elmt_type, &down_type, type_list, op_gen) < 0)
+ if(H5S__obtain_datatype(span->down, down + 1, elmt_size, elmt_type, &down_type, type_list, op_info_i, op_gen) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
/* Compute the number of elements to attempt in this span */
@@ -1270,7 +1272,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
/* Building the whole vector datatype */
H5_CHECK_OVERFLOW(outercount, size_t, int)
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)outercount, blocklen, disp, inner_type, &spans->u.down_type)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)outercount, blocklen, disp, inner_type, &spans->op_info[op_info_i].u.down_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
/* Release inner node types */
@@ -1285,7 +1287,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate MPI data type list node")
/* Set up MPI type node */
- type_node->type = spans->u.down_type;
+ type_node->type = spans->op_info[op_info_i].u.down_type;
type_node->next = NULL;
/* Add MPI type node to list */
@@ -1297,11 +1299,11 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
} /* end else */
/* Remember that we've visited this span tree */
- spans->op_gen = op_gen;
+ spans->op_info[op_info_i].op_gen = op_gen;
} /* end else */
/* Return MPI data type for span tree */
- *span_type = spans->u.down_type;
+ *span_type = spans->op_info[op_info_i].u.down_type;
done:
/* General cleanup */
diff --git a/src/H5Snone.c b/src/H5Snone.c
index c262d18..0949b2a 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -66,6 +66,7 @@ static htri_t H5S__none_shape_same(const H5S_t *space1, const H5S_t *space2);
static htri_t H5S__none_intersect_block(const H5S_t *space, const hsize_t *start,
const hsize_t *end);
static herr_t H5S__none_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S__none_adjust_s(H5S_t *space, const hssize_t *offset);
static herr_t H5S__none_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S__none_project_simple(const H5S_t *space, H5S_t *new_space,
hsize_t *offset);
@@ -113,6 +114,7 @@ const H5S_select_class_t H5S_sel_none[1] = {{
H5S__none_shape_same,
H5S__none_intersect_block,
H5S__none_adjust_u,
+ H5S__none_adjust_s,
H5S__none_project_scalar,
H5S__none_project_simple,
H5S__none_iter_init,
@@ -954,6 +956,37 @@ H5S__none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *of
} /* end H5S__none_adjust_u() */
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__none_adjust_s
+ PURPOSE
+ Adjust an "none" selection by subtracting an offset
+ USAGE
+ herr_t H5S__none_adjust_u(space, offset)
+ H5S_t *space; IN/OUT: Pointer to dataspace to adjust
+ const hssize_t *offset; IN: Offset to subtract
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Moves selection by subtracting an offset from it.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__none_adjust_s(H5S_t H5_ATTR_UNUSED *space, const hssize_t H5_ATTR_UNUSED *offset)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(space);
+ HDassert(offset);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__none_adjust_s() */
+
+
/*-------------------------------------------------------------------------
* Function: H5S__none_project_scalar
*
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index 278f08d..ba60cbf 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -147,6 +147,21 @@ struct H5S_hyper_span_t {
struct H5S_hyper_span_t *next; /* Pointer to next span in list */
};
+/* "Operation info" struct. Used to hold temporary information during copies,
+ * 'adjust', 'nelem', and 'rebuild' operations, and higher level algorithms that
+ * generate this information. */
+typedef struct H5S_hyper_op_info_t {
+ uint64_t op_gen; /* Generation of the scratch info */
+ union {
+ struct H5S_hyper_span_info_t *copied; /* Pointer to already copied span tree */
+ hsize_t nelmts; /* # of elements */
+ hsize_t nblocks; /* # of blocks */
+#ifdef H5_HAVE_PARALLEL
+ MPI_Datatype down_type; /* MPI datatype for span tree */
+#endif /* H5_HAVE_PARALLEL */
+ }u;
+} H5S_hyper_op_info_t;
+
/* Information about a list of hyperslab spans in one dimension (typedef'd in H5Sprivate.h) */
struct H5S_hyper_span_info_t {
unsigned count; /* Ref. count of number of spans which share this span */
@@ -165,17 +180,10 @@ struct H5S_hyper_span_info_t {
hsize_t *low_bounds; /* The smallest element selected in each dimension */
hsize_t *high_bounds; /* The largest element selected in each dimension */
- /* "Operation generation" fields */
+ /* "Operation info" fields */
/* (Used during copies, 'adjust', 'nelem', and 'rebuild' operations) */
- uint64_t op_gen; /* Generation of the scratch info */
- union {
- struct H5S_hyper_span_info_t *copied; /* Pointer to already copied span tree */
- hsize_t nelmts; /* # of elements */
- hsize_t nblocks; /* # of blocks */
-#ifdef H5_HAVE_PARALLEL
- MPI_Datatype down_type; /* MPI datatype for span tree */
-#endif /* H5_HAVE_PARALLEL */
- }u;
+ /* Currently the maximum number of simultaneous operations is 2 */
+ H5S_hyper_op_info_t op_info[2];
struct H5S_hyper_span_t *head; /* Pointer to the first span of list of spans in the current dimension */
struct H5S_hyper_span_t *tail; /* Pointer to the last span of list of spans in the current dimension */
@@ -253,6 +261,8 @@ typedef htri_t (*H5S_sel_shape_same_func_t)(const H5S_t *space1, const H5S_t *sp
typedef htri_t (*H5S_sel_intersect_block_func_t)(const H5S_t *space, const hsize_t *start, const hsize_t *end);
/* Method to adjust a selection by an offset */
typedef herr_t (*H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset);
+/* Method to adjust a selection by an offset (signed) */
+typedef herr_t (*H5S_sel_adjust_s_func_t)(H5S_t *space, const hssize_t *offset);
/* Method to construct single element projection onto scalar dataspace */
typedef herr_t (*H5S_sel_project_scalar)(const H5S_t *space, hsize_t *offset);
/* Method to construct selection projection onto/into simple dataspace */
@@ -281,6 +291,7 @@ typedef struct {
H5S_sel_shape_same_func_t shape_same; /* Method to determine if two dataspaces' selections are the same shape */
H5S_sel_intersect_block_func_t intersect_block; /* Method to determine if a dataspaces' selection intersects a block */
H5S_sel_adjust_u_func_t adjust_u; /* Method to adjust a selection by an offset */
+ H5S_sel_adjust_s_func_t adjust_s; /* Method to adjust a selection by an offset (signed) */
H5S_sel_project_scalar project_scalar; /* Method to construct scalar dataspace projection */
H5S_sel_project_simple project_simple; /* Method to construct simple dataspace projection */
H5S_sel_iter_init_func_t iter_init; /* Method to initialize iterator for current selection */
@@ -377,7 +388,8 @@ H5_DLL uint64_t H5S__hyper_get_op_gen(void);
H5_DLL void H5S__hyper_rebuild(H5S_t *space);
H5_DLL herr_t H5S__modify_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2);
H5_DLL herr_t H5S__hyper_project_intersection(const H5S_t *src_space,
- const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t *proj_space);
+ const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t *proj_space,
+ hbool_t share_space);
/* Testing functions */
#ifdef H5S_TESTING
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index ea6c9c5..721211e 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -78,7 +78,8 @@ static htri_t H5S__point_shape_same(const H5S_t *space1, const H5S_t *space2);
static htri_t H5S__point_intersect_block(const H5S_t *space, const hsize_t *start,
const hsize_t *end);
static herr_t H5S__point_adjust_u(H5S_t *space, const hsize_t *offset);
-static herr_t H5S__point_project_scalar(const H5S_t *space, hsize_t *offset);
+static herr_t H5S__point_adjust_s(H5S_t *space, const hssize_t *offset);
+static herr_t H5S__point_project_scalar(const H5S_t *spasce, 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(const H5S_t *space, H5S_sel_iter_t *iter);
@@ -128,6 +129,7 @@ const H5S_select_class_t H5S_sel_point[1] = {{
H5S__point_shape_same,
H5S__point_intersect_block,
H5S__point_adjust_u,
+ H5S__point_adjust_s,
H5S__point_project_scalar,
H5S__point_project_simple,
H5S__point_iter_init,
@@ -2078,6 +2080,7 @@ done:
static herr_t
H5S__point_adjust_u(H5S_t *space, const hsize_t *offset)
{
+ hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */
H5S_pnt_node_t *node; /* Point node */
unsigned rank; /* Dataspace rank */
unsigned u; /* Local index variable */
@@ -2087,31 +2090,110 @@ H5S__point_adjust_u(H5S_t *space, const hsize_t *offset)
HDassert(space);
HDassert(offset);
- /* Iterate through the nodes, checking the bounds on each element */
- node = space->select.sel_info.pnt_lst->head;
- rank = space->extent.rank;
- while(node) {
- /* Adjust each coordinate for point node */
- for(u = 0; u < rank; u++) {
- /* Check for offset moving selection negative */
- HDassert(node->pnt[u] >= offset[u]);
+ /* Check for an all-zero offset vector */
+ for(u = 0; u < space->extent.rank; u++)
+ if(0 != offset[u]) {
+ non_zero_offset = TRUE;
+ break;
+ } /* end if */
+
+ /* Only perform operation if the offset is non-zero */
+ if(non_zero_offset) {
+ /* Iterate through the nodes, checking the bounds on each element */
+ node = space->select.sel_info.pnt_lst->head;
+ rank = space->extent.rank;
+ while(node) {
+ /* Adjust each coordinate for point node */
+ for(u = 0; u < rank; u++) {
+ /* Check for offset moving selection negative */
+ HDassert(node->pnt[u] >= offset[u]);
+
+ /* Adjust node's coordinate location */
+ node->pnt[u] -= offset[u];
+ } /* end for */
+
+ /* Advance to next point node in selection */
+ node = node->next;
+ } /* end while */
- /* Adjust node's coordinate location */
- node->pnt[u] -= offset[u];
+ /* update the bound box of the selection */
+ for(u = 0; u < rank; u++) {
+ space->select.sel_info.pnt_lst->low_bounds[u] -= offset[u];
+ space->select.sel_info.pnt_lst->high_bounds[u] -= offset[u];
} /* end for */
+ } /* end if */
- /* Advance to next point node in selection */
- node = node->next;
- } /* end while */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__point_adjust_u() */
- /* update the bound box of the selection */
- for(u = 0; u < rank; u++) {
- space->select.sel_info.pnt_lst->low_bounds[u] -= offset[u];
- space->select.sel_info.pnt_lst->high_bounds[u] -= offset[u];
- } /* end for */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__point_adjust_s
+ PURPOSE
+ Adjust a "point" selection by subtracting an offset
+ USAGE
+ herr_t H5S__point_adjust_u(space, offset)
+ H5S_t *space; IN/OUT: Pointer to dataspace to adjust
+ const hssize_t *offset; IN: Offset to subtract
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Moves a point selection by subtracting an offset from it.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__point_adjust_s(H5S_t *space, const hssize_t *offset)
+{
+ hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */
+ H5S_pnt_node_t *node; /* Point node */
+ unsigned rank; /* Dataspace rank */
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ HDassert(space);
+ HDassert(offset);
+
+ /* Check for an all-zero offset vector */
+ for(u = 0; u < space->extent.rank; u++)
+ if(0 != offset[u]) {
+ non_zero_offset = TRUE;
+ break;
+ } /* end if */
+
+ /* Only perform operation if the offset is non-zero */
+ if(non_zero_offset) {
+ /* Iterate through the nodes, checking the bounds on each element */
+ node = space->select.sel_info.pnt_lst->head;
+ rank = space->extent.rank;
+ while(node) {
+ /* Adjust each coordinate for point node */
+ for(u = 0; u < rank; u++) {
+ /* Check for offset moving selection negative */
+ HDassert((hssize_t)node->pnt[u] >= offset[u]);
+
+ /* Adjust node's coordinate location */
+ node->pnt[u] = (hsize_t)((hssize_t)node->pnt[u] - offset[u]);
+ } /* end for */
+
+ /* Advance to next point node in selection */
+ node = node->next;
+ } /* end while */
+
+ /* update the bound box of the selection */
+ for(u = 0; u < rank; u++) {
+ HDassert((hssize_t)space->select.sel_info.pnt_lst->low_bounds[u] >= offset[u]);
+ space->select.sel_info.pnt_lst->low_bounds[u] = (hsize_t)((hssize_t)space->select.sel_info.pnt_lst->low_bounds[u] - offset[u]);
+ space->select.sel_info.pnt_lst->high_bounds[u] = (hsize_t)((hssize_t)space->select.sel_info.pnt_lst->high_bounds[u] - offset[u]);
+ } /* end for */
+ } /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__point_adjust_u() */
+} /* end H5S__point_adjust_s() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 3d68de0..f29319f 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -145,6 +145,7 @@ typedef struct H5S_sel_iter_op_t {
#define H5S_SELECT_IS_SINGLE(S) ((*(S)->select.type->is_single)(S))
#define H5S_SELECT_IS_REGULAR(S) ((*(S)->select.type->is_regular)(S))
#define H5S_SELECT_ADJUST_U(S,O) ((*(S)->select.type->adjust_u)(S, O))
+#define H5S_SELECT_ADJUST_S(S,O) ((*(S)->select.type->adjust_s)(S, O))
#define H5S_SELECT_PROJECT_SCALAR(S,O) ((*(S)->select.type->project_scalar)(S, O))
#define H5S_SELECT_PROJECT_SIMPLE(S,NS, O) ((*(S)->select.type->project_simple)(S, NS, O))
#define H5S_SELECT_ITER_COORDS(ITER,COORDS) ((*(ITER)->type->iter_coords)(ITER,COORDS))
@@ -170,6 +171,7 @@ typedef struct H5S_sel_iter_op_t {
#define H5S_SELECT_IS_SINGLE(S) (H5S_select_is_single(S))
#define H5S_SELECT_IS_REGULAR(S) (H5S_select_is_regular(S))
#define H5S_SELECT_ADJUST_U(S,O) (H5S_select_adjust_u(S, O))
+#define H5S_SELECT_ADJUST_S(S,O) (H5S_select_adjust_s(S, O))
#define H5S_SELECT_PROJECT_SCALAR(S,O) (H5S_select_project_scalar(S, O))
#define H5S_SELECT_PROJECT_SIMPLE(S,NS,O) (H5S_select_project_simple(S, NS, O))
#define H5S_SELECT_ITER_COORDS(ITER,COORDS) (H5S_select_iter_coords(ITER,COORDS))
@@ -257,11 +259,12 @@ H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space);
H5_DLL htri_t H5S_select_is_single(const H5S_t *space);
H5_DLL htri_t H5S_select_is_regular(const H5S_t *space);
H5_DLL herr_t H5S_select_adjust_u(H5S_t *space, const hsize_t *offset);
+H5_DLL herr_t H5S_select_adjust_s(H5S_t *space, const hssize_t *offset);
H5_DLL herr_t H5S_select_project_scalar(const H5S_t *space, hsize_t *offset);
H5_DLL herr_t H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
H5_DLL herr_t H5S_select_project_intersection(const H5S_t *src_space,
const H5S_t *dst_space, const H5S_t *src_intersect_space,
- H5S_t **new_space_ptr);
+ H5S_t **new_space_ptr, hbool_t share_space);
H5_DLL herr_t H5S_select_subtract(H5S_t *space, H5S_t *subtract_space);
/* Operations on all selections */
@@ -282,7 +285,6 @@ H5_DLL herr_t H5S_combine_hyperslab(H5S_t *old_space, H5S_seloper_t op,
const hsize_t *block, H5S_t **new_space);
H5_DLL herr_t H5S_hyper_add_span_element(H5S_t *space, unsigned rank,
const hsize_t *coords);
-H5_DLL herr_t H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset);
H5_DLL htri_t H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset);
H5_DLL herr_t H5S_hyper_denormalize_offset(H5S_t *space, const hssize_t *old_offset);
H5_DLL herr_t H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size);
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index a04f3c1..f7c5ae7 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -143,7 +143,7 @@ H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid);
H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id);
H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
-H5_DLL herr_t H5Sselect_adjust_u(hid_t spaceid, const hsize_t *offset);
+H5_DLL herr_t H5Sselect_adjust(hid_t spaceid, const hssize_t *offset);
H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[],
hsize_t end[]);
H5_DLL htri_t H5Sselect_shape_same(hid_t space1_id, hid_t space2_id);
@@ -171,7 +171,8 @@ H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[],
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*/]);
-H5_DLL herr_t H5Shyper_adjust_s(hid_t space_id, const hssize_t *offset);
+H5_DLL hid_t H5Sselect_project_intersection(hid_t src_space_id,
+ hid_t dst_space_id, hid_t src_intersect_space_id);
/* Operations on dataspace selection iterators */
H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags);
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 1a13f2c..bf0441f 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -947,8 +947,6 @@ H5S_select_is_regular(const H5S_t *space)
herr_t
H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
{
- hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */
- unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -957,23 +955,55 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
HDassert(space);
HDassert(offset);
- /* Check for an all-zero offset vector */
- for(u = 0; u < space->extent.rank; u++)
- if(0 != offset[u]) {
- non_zero_offset = TRUE;
- break;
- } /* end if */
-
- /* Only perform operation if the offset is non-zero */
- if(non_zero_offset)
- ret_value = (*space->select.type->adjust_u)(space, offset);
+ /* Perform operation */
+ ret_value = (*space->select.type->adjust_u)(space, offset);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_adjust_u() */
+
/*--------------------------------------------------------------------------
NAME
- H5Sselect_adjust_u
+ H5S_select_adjust_s
+ PURPOSE
+ Adjust a selection by subtracting an offset
+ USAGE
+ herr_t H5S_select_adjust_u(space, offset)
+ H5S_t *space; IN/OUT: Pointer to dataspace to adjust
+ const hssize_t *offset; IN: Offset to subtract
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Moves a selection by subtracting an offset from it.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5S_select_adjust_s(H5S_t *space, const hssize_t *offset)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check args */
+ HDassert(space);
+ HDassert(offset);
+
+ /* Perform operation */
+ ret_value = (*space->select.type->adjust_s)(space, offset);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_select_adjust_s() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Sselect_adjust
PURPOSE
Adjust a selection by subtracting an offset
USAGE
@@ -990,25 +1020,35 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Sselect_adjust_u(hid_t space_id, const hsize_t *offset)
+H5Sselect_adjust(hid_t space_id, const hssize_t *offset)
{
H5S_t *space;
+ hsize_t low_bounds[H5S_MAX_RANK];
+ hsize_t high_bounds[H5S_MAX_RANK];
+ unsigned u;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*h", space_id, offset);
+ H5TRACE2("e", "i*Hs", space_id, offset);
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
if(NULL == offset)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "NULL offset pointer")
- if(H5S_select_adjust_u(space, offset) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection");
+ /* Check bounds */
+ if(H5S_SELECT_BOUNDS(space, low_bounds, high_bounds) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds")
+ for(u = 0; u < space->extent.rank; u++)
+ if(offset[u] > (hssize_t)low_bounds[u])
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjustment would move selection below zero offset")
+
+ if(H5S_select_adjust_s(space, offset) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Sselect_adjust_u() */
+} /* end H5Sselect_adjust() */
/*--------------------------------------------------------------------------
@@ -2533,11 +2573,12 @@ done:
within the selection of dst_space
USAGE
- herr_t H5S_select_project_intersection(src_space,dst_space,src_intersect_space,proj_space)
+ herr_t H5S_select_project_intersection(src_space,dst_space,src_intersect_space,proj_space,share_selection)
H5S_t *src_space; IN: Selection that is mapped to dst_space, and intersected with src_intersect_space
- H5S_t *dst_space; IN: Selection that is mapped to src_space, and which contains the result
+ H5S_t *dst_space; IN: Selection that is mapped to src_space
H5S_t *src_intersect_space; IN: Selection whose intersection with src_space is projected to dst_space to obtain the result
H5S_t **new_space_ptr; OUT: Will contain the result (intersection of src_intersect_space and src_space projected from src_space to dst_space) after the operation
+ hbool_t share_selection; IN: Whether we are allowed to share structures inside dst_space with proj_space
RETURNS
Non-negative on success/Negative on failure.
@@ -2555,7 +2596,8 @@ done:
--------------------------------------------------------------------------*/
herr_t
H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
- const H5S_t *src_intersect_space, H5S_t **new_space_ptr)
+ const H5S_t *src_intersect_space, H5S_t **new_space_ptr,
+ hbool_t share_selection)
{
H5S_t *new_space = NULL; /* New dataspace constructed */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2602,8 +2644,8 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Intersecting space is hyperslab selection. Call the hyperslab
* routine to project to another hyperslab selection. */
- if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't project hyperslab ondot destination selection")
+ if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space, share_selection) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't project hyperslab onto destination selection")
} /* end else */
/* load the address of the new space into *new_space_ptr */
@@ -2621,6 +2663,75 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5Sselect_project_intersection
+
+ PURPOSE
+ Projects the intersection of of the selections of src_space_id and
+ src_intersect_space_id within the selection of src_space_id as a
+ selection within the selection of dst_space_id. Currently does not
+ support point selections.
+
+ USAGE
+ hid_t H5Sselect_project_intersection(src_space_id,dst_space_d,src_intersect_space_id)
+ hid_t src_space_id; IN: Selection that is mapped to dst_space_id, and intersected with src_intersect_space_id
+ hid_t dst_space_id; IN: Selection that is mapped to src_space_id
+ hid_t src_intersect_space_id; IN: Selection whose intersection with src_space_id is projected to dst_space_id to obtain the result
+
+ RETURNS
+ A dataspace with a selection equal to the intersection of
+ src_intersect_space_id and src_space_id projected from src_space to
+ dst_space on success, negative on failure.
+
+ DESCRIPTION
+ Projects the intersection of of the selections of src_space and
+ src_intersect_space within the selection of src_space as a selection
+ within the selection of dst_space. The result is placed in the
+ selection of new_space_ptr.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+hid_t
+H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id,
+ hid_t src_intersect_space_id)
+{
+ H5S_t *src_space, *dst_space, *src_intersect_space; /* Input dataspaces */
+ H5S_t *proj_space = NULL; /* Output dataspace */
+ hid_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("i", "iii", src_space_id, dst_space_id, src_intersect_space_id);
+
+ /* Check args */
+ if(NULL == (src_space = (H5S_t *)H5I_object_verify(src_space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(NULL == (dst_space = (H5S_t *)H5I_object_verify(dst_space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(NULL == (src_intersect_space = (H5S_t *)H5I_object_verify(src_intersect_space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ /* Perform operation */
+ if(H5S_select_project_intersection(src_space, dst_space,
+ src_intersect_space, &proj_space, FALSE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project dataspace intersection")
+
+ /* Atomize */
+ if((ret_value = H5I_register(H5I_DATASPACE, proj_space, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
+
+done:
+ if(ret_value < 0)
+ if(proj_space && H5S_close(proj_space) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Sselect_project_intersection() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5S_select_subtract
PURPOSE
@@ -2836,7 +2947,7 @@ H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxbytes,
HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "length array pointer is NULL")
/* Get the sequences of bytes */
- if(maxseq > 0 && maxbytes > 0) {
+ if(maxseq > 0 && maxbytes > 0 && sel_iter->elmt_left > 0) {
if(H5S_SELECT_ITER_GET_SEQ_LIST(sel_iter, maxseq, maxbytes, nseq, nbytes, off, len) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "sequence length generation failed")
} /* end if */
diff --git a/src/H5T.c b/src/H5T.c
index aafdd55..3fc59d0 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -227,7 +227,7 @@
H5T_INIT_TYPE_ALLOC_COMMON(H5T_REFERENCE) \
H5T_INIT_TYPE_NUM_COMMON(H5T_ORDER_NONE) \
dt->shared->force_conv = TRUE; \
- dt->shared->u.atomic.u.r.f = NULL; \
+ dt->shared->u.atomic.u.r.file = NULL; \
dt->shared->u.atomic.u.r.loc = H5T_LOC_BADLOC; \
dt->shared->u.atomic.u.r.cls = NULL; \
}
@@ -3320,7 +3320,7 @@ done:
*-------------------------------------------------------------------------
*/
H5T_t *
-H5T_copy(H5T_t *old_dt, H5T_copy_t method)
+H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
{
H5T_t *new_dt = NULL, *tmp = NULL;
H5T_shared_t *reopened_fo = NULL;
@@ -3345,6 +3345,9 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
/* No VOL object */
new_dt->vol_obj = NULL;
+ /* No owned VOL object */
+ new_dt->shared->owned_vol_obj = NULL;
+
/* Check what sort of copy we are making */
switch (method) {
case H5T_COPY_TRANSIENT:
@@ -3766,6 +3769,11 @@ H5T__free(H5T_t *dt)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close parent data type")
dt->shared->parent = NULL;
+ /* Close the owned VOL object */
+ if(dt->shared->owned_vol_obj && H5VL_free_object(dt->shared->owned_vol_obj) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object")
+ dt->shared->owned_vol_obj = NULL;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__free() */
@@ -4413,9 +4421,9 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
}
/* Don't allow VL types in different files to compare as equal */
- if(dt1->shared->u.vlen.f < dt2->shared->u.vlen.f)
+ if(dt1->shared->u.vlen.file < dt2->shared->u.vlen.file)
HGOTO_DONE(-1);
- if(dt1->shared->u.vlen.f > dt2->shared->u.vlen.f)
+ if(dt1->shared->u.vlen.file > dt2->shared->u.vlen.file)
HGOTO_DONE(1);
break;
@@ -5411,7 +5419,7 @@ done:
--------------------------------------------------------------------------
*/
htri_t
-H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
+H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
{
htri_t changed; /* Whether H5T_set_loc changed the type (even if the size didn't change) */
htri_t ret_value = 0; /* Indicate that success, but no location change */
@@ -5435,7 +5443,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
old_size=dt->shared->parent->shared->size;
/* Mark the VL, compound or array type */
- if((changed=H5T_set_loc(dt->shared->parent,f,loc))<0)
+ if((changed=H5T_set_loc(dt->shared->parent, file, loc))<0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed>0)
ret_value=changed;
@@ -5475,7 +5483,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
old_size = memb_type->shared->size;
/* Mark the VL, compound, enum or array type */
- if((changed = H5T_set_loc(memb_type,f,loc)) < 0)
+ if((changed = H5T_set_loc(memb_type, file, loc)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed > 0)
ret_value = changed;
@@ -5509,14 +5517,14 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* Recurse if it's VL, compound, enum or array */
/* (If the force_conv flag is _not_ set, the type cannot change in size, so don't recurse) */
if(dt->shared->parent->shared->force_conv && H5T_IS_COMPLEX(dt->shared->parent->shared->type)) {
- if((changed = H5T_set_loc(dt->shared->parent,f,loc)) < 0)
+ if((changed = H5T_set_loc(dt->shared->parent, file, loc)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed > 0)
ret_value = changed;
} /* end if */
/* Mark this VL sequence */
- if((changed = H5T__vlen_set_loc(dt, f, loc)) < 0)
+ if((changed = H5T__vlen_set_loc(dt, file, loc)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed > 0)
ret_value = changed;
@@ -5524,7 +5532,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
case H5T_REFERENCE:
/* Reference types go through type conversion */
- if((ret_value = H5T__ref_set_loc(dt, f, loc)) < 0)
+ if((ret_value = H5T__ref_set_loc(dt, file, loc)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "Unable to set reference location");
break;
@@ -5863,8 +5871,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5T_patch_vlen_file
*
- * Purpose: Patch the top-level file pointer contained in (dt->shared->u.vlen.f)
- * to point to f. This is possible because
+ * Purpose: Patch the top-level file pointer contained in (dt->shared->u.vlen.file)
+ * to point to file. This is possible because
* the top-level file pointer can be closed out from under
* dt while dt is contained in the shared file's cache.
*
@@ -5873,18 +5881,56 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5T_patch_vlen_file(H5T_t *dt, H5F_t *f)
+H5T_patch_vlen_file(H5T_t *dt, H5VL_object_t *file)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
HDassert(dt);
HDassert(dt->shared);
- HDassert(f);
+ HDassert(file);
- if((dt->shared->type == H5T_VLEN) && dt->shared->u.vlen.f != f)
- dt->shared->u.vlen.f = f;
+ if((dt->shared->type == H5T_VLEN) && dt->shared->u.vlen.file != file)
+ dt->shared->u.vlen.file = file;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5T_patch_vlen_file() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_own_vol_obj
+ *
+ * Purpose: Transfers ownership of the supplied VOL object to the
+ * datatype, the VOL object will be freed when the datatype
+ * is closed.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T_own_vol_obj(H5T_t *dt, H5VL_object_t *vol_obj)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(dt);
+ HDassert(dt->shared);
+ HDassert(vol_obj);
+
+ /* Currently no support for owning multiple VOL objects, free the previous
+ * owned object. Currently this is only used for holding open VOL objects
+ * used in the "loc" for vlens and references, so if this is being
+ * overwritten we don't need the old one anyways. */
+ if(dt->shared->owned_vol_obj && H5VL_free_object(dt->shared->owned_vol_obj) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object")
+
+ /* Take ownership */
+ dt->shared->owned_vol_obj = vol_obj;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_own_vol_obj() */
+
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index c6b85a5..e5d12c0 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -137,6 +137,9 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id,
if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list")
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
@@ -229,7 +232,7 @@ done:
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't remove dataset from list of open objects")
/* Close the datatype object */
- if(H5O_close(&(dt->oloc), NULL) < 0)
+ if(H5O_close(&(dt->oloc), NULL) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release object header")
/* Remove the datatype's object header from the file */
@@ -237,7 +240,7 @@ done:
HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to delete object header")
/* Mark datatype as being back in memory */
- if(H5T_set_loc(dt, dt->sh_loc.file, H5T_LOC_MEMORY))
+ if(H5T_set_loc(dt, NULL, H5T_LOC_MEMORY))
HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to return datatype to memory")
dt->sh_loc.type = H5O_SHARE_TYPE_UNSHARED;
dt->shared->state = old_state;
@@ -414,7 +417,7 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id)
/* Mark datatype as being on disk now. This step changes the size of
* datatype as stored on disk.
*/
- if(H5T_set_loc(type, file, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(type, H5F_VOL_OBJ(file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
/* Reset datatype location and path */
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 84642f4..6aea00e 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -3132,7 +3132,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info")
/* Set flags to indicate we are writing to or reading from the file */
- if(dst->shared->u.vlen.f != NULL)
+ if(dst->shared->u.vlen.file != NULL)
write_to_file = TRUE;
/* Set the flag for nested VL case */
@@ -3183,18 +3183,18 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
hbool_t is_nil; /* Whether sequence is "nil" */
/* Check for "nil" source sequence */
- if((*(src->shared->u.vlen.cls->isnull))(src->shared->u.vlen.f, s, &is_nil) < 0)
+ if((*(src->shared->u.vlen.cls->isnull))(src->shared->u.vlen.file, s, &is_nil) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if VL data is 'nil'")
else if(is_nil) {
/* Write "nil" sequence to destination location */
- if((*(dst->shared->u.vlen.cls->setnull))(dst->shared->u.vlen.f, d, b) < 0)
+ if((*(dst->shared->u.vlen.cls->setnull))(dst->shared->u.vlen.file, d, b) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set VL data to 'nil'")
} /* end else-if */
else {
size_t seq_len; /* The number of elements in the current sequence */
/* Get length of element sequences */
- if((*(src->shared->u.vlen.cls->getlen))(src->shared->u.vlen.f, s, &seq_len) < 0)
+ if((*(src->shared->u.vlen.cls->getlen))(src->shared->u.vlen.file, s, &seq_len) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "bad sequence length")
/* If we are reading from memory and there is no conversion, just get the pointer to sequence */
@@ -3226,7 +3226,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
} /* end else-if */
/* Read in VL sequence */
- if((*(src->shared->u.vlen.cls->read))(src->shared->u.vlen.f, s, conv_buf, src_size) < 0)
+ if((*(src->shared->u.vlen.cls->read))(src->shared->u.vlen.file, s, conv_buf, src_size) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data")
} /* end else */
@@ -3248,7 +3248,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HDassert(write_to_file);
/* Get length of background element sequence */
- if((*(dst->shared->u.vlen.cls->getlen))(dst->shared->u.vlen.f, b, &bg_seq_len) < 0)
+ if((*(dst->shared->u.vlen.cls->getlen))(dst->shared->u.vlen.file, b, &bg_seq_len) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "bad sequence length")
/* Read sequence if length > 0 */
@@ -3261,7 +3261,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
} /* end if */
/* Read in background VL sequence */
- if((*(dst->shared->u.vlen.cls->read))(dst->shared->u.vlen.f, b, tmp_buf, bg_seq_len) < 0)
+ if((*(dst->shared->u.vlen.cls->read))(dst->shared->u.vlen.file, b, tmp_buf, bg_seq_len * dst_base_size) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data")
} /* end if */
@@ -3276,7 +3276,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
} /* end if */
/* Write sequence to destination location */
- if((*(dst->shared->u.vlen.cls->write))(dst->shared->u.vlen.f, &vl_alloc_info, d, conv_buf, b, seq_len, dst_base_size) < 0)
+ if((*(dst->shared->u.vlen.cls->write))(dst->shared->u.vlen.file, &vl_alloc_info, d, conv_buf, b, seq_len, dst_base_size) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data")
if(!noop_conv) {
@@ -3291,7 +3291,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
tmp = (uint8_t *)tmp_buf + seq_len * dst_base_size;
for(u = seq_len; u < bg_seq_len; u++, tmp += dst_base_size) {
/* Delete sequence in destination location */
- if((*(dst->shared->u.vlen.cls->del))(dst->shared->u.vlen.f, tmp) < 0)
+ if((*(dst->shared->u.vlen.cls->del))(dst->shared->u.vlen.file, tmp) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove heap object")
} /* end for */
} /* end if */
@@ -3612,8 +3612,8 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/* Get size of references */
if(0 == (buf_size = src->shared->u.atomic.u.r.cls->getsize(
- src->shared->u.atomic.u.r.f, s, src->shared->size,
- dst->shared->u.atomic.u.r.f, &dst_copy)))
+ src->shared->u.atomic.u.r.file, s, src->shared->size,
+ dst->shared->u.atomic.u.r.file, &dst_copy)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect size")
/* Check if conversion buffer is large enough, resize if necessary. */
@@ -3629,8 +3629,8 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
} else {
/* Read reference */
if(src->shared->u.atomic.u.r.cls->read(
- src->shared->u.atomic.u.r.f, s, src->shared->size,
- dst->shared->u.atomic.u.r.f, conv_buf, buf_size) < 0)
+ src->shared->u.atomic.u.r.file, s, src->shared->size,
+ dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read reference data")
}
@@ -3639,8 +3639,8 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
} else {
/* Write reference to destination location */
if(dst->shared->u.atomic.u.r.cls->write(
- src->shared->u.atomic.u.r.f, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype,
- dst->shared->u.atomic.u.r.f, d, dst->shared->size, b) < 0)
+ src->shared->u.atomic.u.r.file, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype,
+ dst->shared->u.atomic.u.r.file, d, dst->shared->size, b) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write reference data")
}
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 9784abd..1dbc229 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -40,6 +40,7 @@
#include "H5Fprivate.h" /* Files */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Oprivate.h" /* Object headers */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/* Other public headers needed by this file */
#include "H5Spublic.h" /* Dataspace functions */
@@ -181,9 +182,9 @@ struct H5T_path_t {
};
/* Reference function pointers */
-typedef size_t (*H5T_ref_getsizefunc_t)(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, hbool_t *dst_copy);
-typedef herr_t (*H5T_ref_readfunc_t)(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, void *dst_buf, size_t dst_size);
-typedef herr_t (*H5T_ref_writefunc_t)(H5F_t *src_f, const void *src_buf, size_t src_size, H5R_type_t src_type, H5F_t *dst_f, void *dst_buf, size_t dst_size, void *bg_buf);
+typedef size_t (*H5T_ref_getsizefunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy);
+typedef herr_t (*H5T_ref_readfunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size);
+typedef herr_t (*H5T_ref_writefunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf);
typedef struct H5T_ref_class_t {
H5T_ref_getsizefunc_t getsize; /* get reference size (bytes) */
@@ -223,7 +224,7 @@ typedef struct H5T_atomic_t {
unsigned version; /* version of encoded reference */
hbool_t opaque; /* opaque reference type */
H5T_loc_t loc; /* location of data in buffer */
- H5F_t *f; /* file pointer (if data is on disk) */
+ H5VL_object_t *file; /* file VOL pointer (if data is on disk) */
const H5T_ref_class_t *cls; /* Pointer to ref class callbacks */
} r; /* reference types */
} u;
@@ -272,13 +273,13 @@ typedef enum {
} H5T_vlen_type_t;
/* VL function pointers */
-typedef herr_t (*H5T_vlen_getlen_func_t)(H5F_t *f, const void *vl_addr, size_t *len);
+typedef herr_t (*H5T_vlen_getlen_func_t)(H5VL_object_t *file, const void *vl_addr, size_t *len);
typedef void * (*H5T_vlen_getptr_func_t)(void *vl_addr);
-typedef herr_t (*H5T_vlen_isnull_func_t)(const H5F_t *f, void *vl_addr, hbool_t *isnull);
-typedef herr_t (*H5T_vlen_setnull_func_t)(H5F_t *f, void *_vl, void *_bg);
-typedef herr_t (*H5T_vlen_read_func_t)(H5F_t *f, void *_vl, void *buf, size_t len);
-typedef herr_t (*H5T_vlen_write_func_t)(H5F_t *f, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size);
-typedef herr_t (*H5T_vlen_delete_func_t)(H5F_t *f, const void *_vl);
+typedef herr_t (*H5T_vlen_isnull_func_t)(const H5VL_object_t *file, void *vl_addr, hbool_t *isnull);
+typedef herr_t (*H5T_vlen_setnull_func_t)(H5VL_object_t *file, void *_vl, void *_bg);
+typedef herr_t (*H5T_vlen_read_func_t)(H5VL_object_t *file, void *_vl, void *buf, size_t len);
+typedef herr_t (*H5T_vlen_write_func_t)(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size);
+typedef herr_t (*H5T_vlen_delete_func_t)(H5VL_object_t *file, const void *_vl);
/* VL datatype callbacks */
typedef struct H5T_vlen_class_t {
@@ -298,7 +299,7 @@ typedef struct H5T_vlen_t {
H5T_cset_t cset; /* For VL string: character set */
H5T_str_t pad; /* For VL string: space or null padding of
* extra bytes */
- H5F_t *f; /* File ID (if VL data is on disk) */
+ H5VL_object_t *file; /* File object (if VL data is on disk) */
const H5T_vlen_class_t *cls; /* Pointer to VL class callbacks */
} H5T_vlen_t;
@@ -331,6 +332,7 @@ typedef struct H5T_shared_t {
unsigned version; /* Version of object header message to encode this object with */
hbool_t force_conv;/* Set if this type always needs to be converted and H5T__conv_noop cannot be called */
struct H5T_t *parent;/*parent type for derived datatypes */
+ H5VL_object_t *owned_vol_obj; /* Vol object owned by this type (free on close) */
union {
H5T_atomic_t atomic; /* an atomic datatype */
H5T_compnd_t compnd; /* a compound datatype (struct) */
@@ -1173,7 +1175,7 @@ H5_DLL void H5T__bit_neg(uint8_t *buf, size_t start, size_t size);
/* VL functions */
H5_DLL H5T_t * H5T__vlen_create(const H5T_t *base);
-H5_DLL htri_t H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc);
+H5_DLL htri_t H5T__vlen_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc);
/* Array functions */
H5_DLL H5T_t *H5T__array_create(H5T_t *base, unsigned ndims, const hsize_t dim[/* ndims */]);
@@ -1181,7 +1183,7 @@ H5_DLL int H5T__get_array_ndims(const H5T_t *dt);
H5_DLL int H5T__get_array_dims(const H5T_t *dt, hsize_t dims[]);
/* Reference functions */
-H5_DLL htri_t H5T__ref_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc);
+H5_DLL htri_t H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc);
/* Compound functions */
H5_DLL herr_t H5T__insert(H5T_t *parent, const char *name, size_t offset,
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 13a0938..86bc174 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -109,7 +109,7 @@ H5_DLLVAR H5T_order_t H5T_native_order_g;
/* Private functions */
H5_DLL herr_t H5T_init(void);
-H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method);
+H5_DLL H5T_t *H5T_copy(const H5T_t *old_dt, H5T_copy_t method);
H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable);
H5_DLL herr_t H5T_close(H5T_t *dt);
H5_DLL herr_t H5T_close_real(H5T_t *dt);
@@ -138,12 +138,13 @@ H5_DLL herr_t H5T_reclaim_cb(void *elem, const H5T_t *dt, unsigned ndim, const h
H5_DLL herr_t H5T_ref_reclaim(void *elem, const H5T_t *dt);
H5_DLL herr_t H5T_vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info);
H5_DLL herr_t H5T_vlen_reclaim_elmt(void *elem, H5T_t *dt);
-H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc);
+H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc);
H5_DLL htri_t H5T_is_sensible(const H5T_t *dt);
H5_DLL uint32_t H5T_hash(H5F_t * file, const H5T_t *dt);
H5_DLL herr_t H5T_set_version(H5F_t *f, H5T_t *dt);
H5_DLL herr_t H5T_patch_file(H5T_t *dt, H5F_t *f);
-H5_DLL herr_t H5T_patch_vlen_file(H5T_t *dt, H5F_t *f);
+H5_DLL herr_t H5T_patch_vlen_file(H5T_t *dt, H5VL_object_t *file);
+H5_DLL herr_t H5T_own_vol_obj(H5T_t *dt, H5VL_object_t *vol_obj);
H5_DLL htri_t H5T_is_variable_str(const H5T_t *dt);
H5_DLL H5T_t *H5T_construct_datatype(H5VL_object_t *dt_obj);
H5_DLL H5VL_object_t *H5T_get_named_type(const H5T_t *dt);
diff --git a/src/H5Tref.c b/src/H5Tref.c
index 937dc92..b1bc9e8 100644
--- a/src/H5Tref.c
+++ b/src/H5Tref.c
@@ -27,6 +27,8 @@
#include "H5Rpkg.h" /* References */
#include "H5Tpkg.h" /* Datatypes */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
/****************/
/* Local Macros */
/****************/
@@ -52,20 +54,20 @@ struct H5Tref_dsetreg {
/* Local Prototypes */
/********************/
-static size_t H5T__ref_mem_getsize(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, hbool_t *dst_copy);
-static herr_t H5T__ref_mem_read(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, void *dst_buf, size_t dst_size);
-static herr_t H5T__ref_mem_write(H5F_t *src_f, const void *src_buf, size_t src_size, H5R_type_t src_type, H5F_t *dst_f, void *dst_buf, size_t dst_size, void *bg_buf);
+static size_t H5T__ref_mem_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy);
+static herr_t H5T__ref_mem_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size);
+static herr_t H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf);
-static size_t H5T__ref_disk_getsize(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, hbool_t *dst_copy);
-static herr_t H5T__ref_disk_read(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, void *dst_buf, size_t dst_size);
-static herr_t H5T__ref_disk_write(H5F_t *src_f, const void *src_buf, size_t src_size, H5R_type_t src_type, H5F_t *dst_f, void *dst_buf, size_t dst_size, void *bg_buf);
+static size_t H5T__ref_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy);
+static herr_t H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size);
+static herr_t H5T__ref_disk_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf);
/* For compatibility */
-static size_t H5T__ref_obj_disk_getsize(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, hbool_t *dst_copy);
-static herr_t H5T__ref_obj_disk_read(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, void *dst_buf, size_t dst_size);
+static size_t H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy);
+static herr_t H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size);
-static size_t H5T__ref_dsetreg_disk_getsize(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, hbool_t *dst_copy);
-static herr_t H5T__ref_dsetreg_disk_read(H5F_t *src_f, const void *src_buf, size_t src_size, H5F_t *dst_f, void *dst_buf, size_t dst_size);
+static size_t H5T__ref_dsetreg_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy);
+static herr_t H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size);
/*******************/
/* Local Variables */
@@ -112,7 +114,7 @@ static const H5T_ref_class_t H5T_ref_dsetreg_disk_g = {
*-------------------------------------------------------------------------
*/
htri_t
-H5T__ref_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
+H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
{
htri_t ret_value = FALSE; /* Indicate success, but no location change */
@@ -123,18 +125,18 @@ H5T__ref_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
HDassert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC);
/* Only change the location if it's different */
- if(loc == dt->shared->u.atomic.u.r.loc && f == dt->shared->u.atomic.u.r.f)
+ if(loc == dt->shared->u.atomic.u.r.loc && file == dt->shared->u.atomic.u.r.file)
HGOTO_DONE(FALSE)
switch(loc) {
case H5T_LOC_MEMORY: /* Memory based reference datatype */
- HDassert(NULL == f);
+ HDassert(NULL == file);
/* Mark this type as being stored in memory */
dt->shared->u.atomic.u.r.loc = H5T_LOC_MEMORY;
/* Reset file ID (since this reference is in memory) */
- dt->shared->u.atomic.u.r.f = f; /* f is NULL */
+ dt->shared->u.atomic.u.r.file = file; /* file is NULL */
if(dt->shared->u.atomic.u.r.opaque) {
/* Size in memory, disk size is different */
@@ -164,15 +166,24 @@ H5T__ref_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
break;
case H5T_LOC_DISK: /* Disk based reference datatype */
- HDassert(f);
+ HDassert(file);
/* Mark this type as being stored on disk */
dt->shared->u.atomic.u.r.loc = H5T_LOC_DISK;
/* Set file pointer (since this reference is on disk) */
- dt->shared->u.atomic.u.r.f = f;
+ dt->shared->u.atomic.u.r.file = file;
if(dt->shared->u.atomic.u.r.rtype == H5R_OBJECT1) {
+ H5F_t *f;
+
+ /* We should assert here that the terminal connector is H5VL_NATIVE once
+ * there is a facility to do so -NAF 2019/10/30 */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (f = (H5F_t *)H5VL_object_data(file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
/* Size on disk, memory size is different */
dt->shared->size = H5T_REF_OBJ_DISK_SIZE(f);
dt->shared->u.atomic.prec = 8 * dt->shared->size;
@@ -181,6 +192,15 @@ H5T__ref_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
dt->shared->u.atomic.u.r.cls = &H5T_ref_obj_disk_g;
} else if(dt->shared->u.atomic.u.r.rtype == H5R_DATASET_REGION1) {
+ H5F_t *f;
+
+ /* We should assert here that the terminal connector is H5VL_NATIVE once
+ * there is a facility to do so -NAF 2019/10/30 */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (f = (H5F_t *)H5VL_object_data(file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
/* Size on disk, memory size is different */
dt->shared->size = H5T_REF_DSETREG_DISK_SIZE(f);
dt->shared->u.atomic.prec = 8 * dt->shared->size;
@@ -194,8 +214,8 @@ H5T__ref_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
H5R_ref_priv_t fixed_ref;
/* Get container info */
- if(H5F__get_cont_info(f, &cont_info) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get file container info")
+ if(H5VL_file_get(file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info")
/* Retrieve min encode size (when references have no vlen part) */
HDmemset(&fixed_ref, 0, sizeof(fixed_ref));
@@ -226,7 +246,7 @@ H5T__ref_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
dt->shared->u.atomic.u.r.loc = H5T_LOC_BADLOC;
/* Reset file pointer */
- dt->shared->u.atomic.u.r.f = NULL;
+ dt->shared->u.atomic.u.r.file = NULL;
/* Reset the function pointers */
dt->shared->u.atomic.u.r.cls = NULL;
@@ -257,10 +277,12 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5T__ref_mem_getsize(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf,
- size_t H5_ATTR_UNUSED src_size, H5F_t *dst_f, hbool_t *dst_copy)
+H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
+ size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, hbool_t *dst_copy)
{
- void *vol_obj = NULL;
+ H5F_t *src_f;
+ H5F_t *dst_f;
+ H5VL_object_t *vol_obj = NULL;
const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf;
unsigned flags = 0;
size_t ret_value = 0;
@@ -274,9 +296,14 @@ H5T__ref_mem_getsize(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf,
if(NULL == (vol_obj = H5VL_vol_object(src_ref->loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier")
- /* Retrieve file from VOL object */
+ /* We should assert here that the terminal connector is H5VL_NATIVE once
+ * there is a facility to do so -NAF 2019/10/30 */
+
+ /* Retrieve files from VOL objects */
if(NULL == (src_f = (H5F_t *)H5VL_object_data(vol_obj)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
+ if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
/* Set external flag if referenced file is not destination file */
flags |= (src_f->shared != dst_f->shared) ? H5R_IS_EXTERNAL : 0;
@@ -315,11 +342,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__ref_mem_read(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf,
- size_t H5_ATTR_UNUSED src_size, H5F_t *dst_f, void *dst_buf,
+H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
+ size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, void *dst_buf,
size_t dst_size)
{
- void *vol_obj = NULL;
+ H5F_t *src_f;
+ H5F_t *dst_f;
+ H5VL_object_t *vol_obj = NULL;
const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf;
unsigned flags = 0;
herr_t ret_value = SUCCEED;
@@ -328,7 +357,7 @@ H5T__ref_mem_read(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf,
HDassert(src_buf);
HDassert(src_size == H5T_REF_MEM_SIZE);
- HDassert(dst_f);
+ HDassert(dst_file);
HDassert(dst_buf);
HDassert(dst_size);
@@ -336,9 +365,14 @@ H5T__ref_mem_read(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf,
if(NULL == (vol_obj = H5VL_vol_object(src_ref->loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier")
- /* Retrieve file from VOL object */
+ /* We should assert here that the terminal connector is H5VL_NATIVE once
+ * there is a facility to do so -NAF 2019/10/30 */
+
+ /* Retrieve files from VOL objects */
if(NULL == (src_f = (H5F_t *)H5VL_object_data(vol_obj)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
+ if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
/* Set external flag if referenced file is not destination file */
flags |= (src_f->shared != dst_f->shared) ? H5R_IS_EXTERNAL : 0;
@@ -349,7 +383,7 @@ H5T__ref_mem_read(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf,
H5CX_set_libver_bounds(dst_f);
/* Encode reference */
- if(H5R__encode(H5F_ACTUAL_NAME(src_f), src_ref, dst_buf, &dst_size, flags) < 0)
+ if(H5R__encode(H5F_ACTUAL_NAME(src_f), src_ref, (unsigned char *)dst_buf, &dst_size, flags) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "Cannot encode reference")
done:
@@ -367,22 +401,30 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__ref_mem_write(H5F_t *src_f, const void *src_buf, size_t src_size,
- H5R_type_t src_type, H5F_t H5_ATTR_UNUSED *dst_f, void *dst_buf,
+H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size,
+ H5R_type_t src_type, H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf,
size_t dst_size, void H5_ATTR_UNUSED *bg_buf)
{
+ H5F_t *src_f;
hid_t file_id = H5I_INVALID_HID;
H5R_ref_priv_t *dst_ref = (H5R_ref_priv_t *)dst_buf;
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
- HDassert(src_f);
+ HDassert(src_file);
HDassert(src_buf);
HDassert(src_size);
HDassert(dst_buf);
HDassert(dst_size == H5T_REF_MEM_SIZE);
+ /* We should assert here that the terminal connector is H5VL_NATIVE once
+ * there is a facility to do so -NAF 2019/10/30 */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
/* Make sure reference buffer is correctly initialized */
HDmemset(dst_buf, 0, dst_size);
@@ -451,8 +493,8 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5T__ref_disk_getsize(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf,
- size_t src_size, H5F_t H5_ATTR_UNUSED *dst_f, hbool_t *dst_copy)
+H5T__ref_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
+ size_t src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file, hbool_t *dst_copy)
{
const uint8_t *p = (const uint8_t *)src_buf;
unsigned flags;
@@ -499,50 +541,36 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__ref_disk_read(H5F_t *src_f, const void *src_buf, size_t src_size,
- H5F_t H5_ATTR_UNUSED *dst_f, void *dst_buf, size_t dst_size)
+H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size,
+ H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t dst_size)
{
- H5VL_object_t *vol_obj = NULL; /* Object info */
- hid_t file_id = H5I_INVALID_HID;
const uint8_t *p = (const uint8_t *)src_buf;
uint8_t *q = (uint8_t *)dst_buf;
- size_t buf_size_left = src_size;
- size_t expected_size = dst_size;
+ size_t blob_size = dst_size;
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
- HDassert(src_f);
+ HDassert(src_file);
HDassert(src_buf);
HDassert(dst_buf);
HDassert(dst_size);
- /* TODO temporary hack to retrieve file object */
- if((file_id = H5F__get_file_id(src_f, FALSE)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- if(NULL == (vol_obj = H5VL_vol_object(file_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
-
/* Copy header manually */
HDmemcpy(q, p, H5R_ENCODE_HEADER_SIZE);
p += H5R_ENCODE_HEADER_SIZE;
q += H5R_ENCODE_HEADER_SIZE;
- expected_size -= H5R_ENCODE_HEADER_SIZE;
+ blob_size -= H5R_ENCODE_HEADER_SIZE;
/* Skip the length of the sequence */
p += H5_SIZEOF_UINT32_T;
- HDassert(buf_size_left > H5_SIZEOF_UINT32_T);
- buf_size_left -= H5_SIZEOF_UINT32_T;
+ HDassert(src_size > (H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T));
/* Retrieve blob */
- if(H5VL_blob_get(vol_obj, p, q, &dst_size, NULL) < 0)
+ if(H5VL_blob_get(src_file, p, q, blob_size, NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get blob")
- if(dst_size != expected_size)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Expected data size does not match")
done:
- if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0))
- HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file id")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__ref_disk_read() */
@@ -557,12 +585,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__ref_disk_write(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf,
- size_t src_size, H5R_type_t H5_ATTR_UNUSED src_type, H5F_t *dst_f,
+H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
+ size_t src_size, H5R_type_t H5_ATTR_UNUSED src_type, H5VL_object_t *dst_file,
void *dst_buf, size_t dst_size, void *bg_buf)
{
- H5VL_object_t *vol_obj = NULL; /* Object info */
- hid_t file_id = H5I_INVALID_HID;
const uint8_t *p = (const uint8_t *)src_buf;
uint8_t *q = (uint8_t *)dst_buf;
size_t buf_size_left = dst_size;
@@ -573,15 +599,9 @@ H5T__ref_disk_write(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf,
HDassert(src_buf);
HDassert(src_size);
- HDassert(dst_f);
+ HDassert(dst_file);
HDassert(dst_buf);
- /* TODO temporary hack to retrieve file object */
- if((file_id = H5F__get_file_id(dst_f, FALSE)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- if(NULL == (vol_obj = H5VL_vol_object(file_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
-
/* TODO Should get rid of bg stuff */
if(p_bg) {
size_t p_buf_size_left = dst_size;
@@ -592,7 +612,7 @@ H5T__ref_disk_write(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf,
p_buf_size_left -= H5_SIZEOF_UINT32_T;
/* Remove blob for old data */
- if(H5VL_blob_specific(vol_obj, (void *)p_bg, H5VL_BLOB_DELETE) < 0)
+ if(H5VL_blob_specific(dst_file, (void *)p_bg, H5VL_BLOB_DELETE) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob")
} /* end if */
@@ -609,12 +629,10 @@ H5T__ref_disk_write(H5F_t H5_ATTR_UNUSED *src_f, const void *src_buf,
buf_size_left -= H5_SIZEOF_UINT32_T;
/* Store blob */
- if(H5VL_blob_put(vol_obj, p, src_size, q, NULL) < 0)
+ if(H5VL_blob_put(dst_file, p, src_size, q, NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to put blob")
done:
- if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0))
- HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file id")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__ref_disk_write() */
@@ -629,20 +647,30 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5T__ref_obj_disk_getsize(H5F_t *src_f, const void H5_ATTR_UNUSED *src_buf,
- size_t H5_ATTR_UNUSED src_size, H5F_t H5_ATTR_UNUSED *dst_f,
+H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *src_buf,
+ size_t H5_ATTR_UNUSED src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file,
hbool_t H5_ATTR_UNUSED *dst_copy)
{
+ H5F_t *src_f;
size_t ret_value = 0;
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
- HDassert(src_f);
+ HDassert(src_file);
HDassert(src_buf);
+
+ /* We should assert here that the terminal connector is H5VL_NATIVE once
+ * there is a facility to do so -NAF 2019/10/30 */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
+
HDassert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f));
ret_value = H5T_REF_OBJ_DISK_SIZE(src_f);
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__ref_obj_disk_getsize() */
@@ -657,22 +685,31 @@ H5T__ref_obj_disk_getsize(H5F_t *src_f, const void H5_ATTR_UNUSED *src_buf,
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__ref_obj_disk_read(H5F_t *src_f, const void *src_buf, size_t src_size,
- H5F_t H5_ATTR_UNUSED *dst_f, void *dst_buf, size_t H5_ATTR_UNUSED dst_size)
+H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size,
+ H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t H5_ATTR_UNUSED dst_size)
{
+ H5F_t *src_f;
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
- HDassert(src_f);
+ HDassert(src_file);
HDassert(src_buf);
- HDassert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f));
HDassert(dst_buf);
+
+ /* We should assert here that the terminal connector is H5VL_NATIVE once
+ * there is a facility to do so -NAF 2019/10/30 */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
+ HDassert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f));
HDassert(dst_size == H5F_SIZEOF_ADDR(src_f));
/* Get object address */
if(H5R__decode_token_obj_compat((const unsigned char *)src_buf, &src_size,
- dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0)
+ (H5VL_token_t *)dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address")
done:
@@ -690,17 +727,32 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5T__ref_dsetreg_disk_getsize(H5F_t H5_ATTR_UNUSED *f,
+H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *file,
const void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size,
- H5F_t H5_ATTR_UNUSED *dst_f, hbool_t H5_ATTR_UNUSED *dst_copy)
+ H5VL_object_t H5_ATTR_UNUSED *dst_file, hbool_t H5_ATTR_UNUSED *dst_copy)
{
size_t ret_value = sizeof(struct H5Tref_dsetreg);
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
HDassert(buf);
- HDassert(buf_size == H5T_REF_DSETREG_DISK_SIZE(f));
+#ifndef NDEBUG
+ {
+ H5F_t *f;
+
+ /* We should assert here that the terminal connector is H5VL_NATIVE once
+ * there is a facility to do so -NAF 2019/10/30 */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (f = (H5F_t *)H5VL_object_data(file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
+
+ HDassert(buf_size == H5T_REF_DSETREG_DISK_SIZE(f));
+ } /* end block */
+#endif /* NDEBUG */
+
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__ref_dsetreg_disk_getsize() */
@@ -715,20 +767,29 @@ H5T__ref_dsetreg_disk_getsize(H5F_t H5_ATTR_UNUSED *f,
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__ref_dsetreg_disk_read(H5F_t *src_f, const void *src_buf, size_t src_size,
- H5F_t H5_ATTR_UNUSED *dst_f, void *dst_buf, size_t H5_ATTR_UNUSED dst_size)
+H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size,
+ H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t H5_ATTR_UNUSED dst_size)
{
+ H5F_t *src_f;
struct H5Tref_dsetreg *dst_reg = (struct H5Tref_dsetreg *)dst_buf;
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
- HDassert(src_f);
+ HDassert(src_file);
HDassert(src_buf);
- HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f));
HDassert(dst_buf);
HDassert(dst_size == sizeof(struct H5Tref_dsetreg));
+ /* We should assert here that the terminal connector is H5VL_NATIVE once
+ * there is a facility to do so -NAF 2019/10/30 */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
+ HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f));
+
/* Retrieve object address and space */
if(H5R__decode_token_region_compat(src_f, (const unsigned char *)src_buf,
&src_size, &dst_reg->token, H5F_SIZEOF_ADDR(src_f), &dst_reg->space) < 0)
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 0253b01..ec84879 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -33,6 +33,7 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Tpkg.h" /* Datatypes */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
/* Local Macros */
@@ -54,28 +55,28 @@
/********************/
/* Memory-based VL sequence callbacks */
-static herr_t H5T__vlen_mem_seq_getlen(H5F_t *f, const void *_vl, size_t *len);
+static herr_t H5T__vlen_mem_seq_getlen(H5VL_object_t *file, const void *_vl, size_t *len);
static void * H5T__vlen_mem_seq_getptr(void *_vl);
-static herr_t H5T__vlen_mem_seq_isnull(const H5F_t *f, void *_vl, hbool_t *isnull);
-static herr_t H5T__vlen_mem_seq_setnull(H5F_t *f, void *_vl, void *_bg);
-static herr_t H5T__vlen_mem_seq_read(H5F_t *f, void *_vl, void *_buf, size_t len);
-static herr_t H5T__vlen_mem_seq_write(H5F_t *f, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size);
+static herr_t H5T__vlen_mem_seq_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull);
+static herr_t H5T__vlen_mem_seq_setnull(H5VL_object_t *file, void *_vl, void *_bg);
+static herr_t H5T__vlen_mem_seq_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len);
+static herr_t H5T__vlen_mem_seq_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size);
/* Memory-based VL string callbacks */
-static herr_t H5T__vlen_mem_str_getlen(H5F_t *f, const void *_vl, size_t *len);
+static herr_t H5T__vlen_mem_str_getlen(H5VL_object_t *file, const void *_vl, size_t *len);
static void * H5T__vlen_mem_str_getptr(void *_vl);
-static herr_t H5T__vlen_mem_str_isnull(const H5F_t *f, void *_vl, hbool_t *isnull);
-static herr_t H5T__vlen_mem_str_setnull(H5F_t *f, void *_vl, void *_bg);
-static herr_t H5T__vlen_mem_str_read(H5F_t *f, void *_vl, void *_buf, size_t len);
-static herr_t H5T__vlen_mem_str_write(H5F_t *f, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size);
+static herr_t H5T__vlen_mem_str_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull);
+static herr_t H5T__vlen_mem_str_setnull(H5VL_object_t *file, void *_vl, void *_bg);
+static herr_t H5T__vlen_mem_str_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len);
+static herr_t H5T__vlen_mem_str_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size);
/* Disk-based VL sequence (and string) callbacks */
-static herr_t H5T__vlen_disk_getlen(H5F_t *f, const void *_vl, size_t *len);
-static herr_t H5T__vlen_disk_isnull(const H5F_t *f, void *_vl, hbool_t *isnull);
-static herr_t H5T__vlen_disk_setnull(H5F_t *f, void *_vl, void *_bg);
-static herr_t H5T__vlen_disk_read(H5F_t *f, void *_vl, void *_buf, size_t len);
-static herr_t H5T__vlen_disk_write(H5F_t *f, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size);
-static herr_t H5T__vlen_disk_delete(H5F_t *f, const void *_vl);
+static herr_t H5T__vlen_disk_getlen(H5VL_object_t *file, const void *_vl, size_t *len);
+static herr_t H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull);
+static herr_t H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *_bg);
+static herr_t H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len);
+static herr_t H5T__vlen_disk_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size);
+static herr_t H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl);
/*********************/
@@ -252,8 +253,9 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
+H5T__vlen_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
{
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
htri_t ret_value = FALSE; /* Indicate success, but no location change */
FUNC_ENTER_PACKAGE
@@ -263,10 +265,10 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
HDassert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC);
/* Only change the location if it's different */
- if(loc != dt->shared->u.vlen.loc || f != dt->shared->u.vlen.f) {
+ if(loc != dt->shared->u.vlen.loc || file != dt->shared->u.vlen.file) {
switch(loc) {
case H5T_LOC_MEMORY: /* Memory based VL datatype */
- HDassert(NULL == f);
+ HDassert(NULL == file);
/* Mark this type as being stored in memory */
dt->shared->u.vlen.loc = H5T_LOC_MEMORY;
@@ -288,29 +290,30 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
else
HDassert(0 && "Invalid VL type");
- /* Reset file ID (since this VL is in memory) */
- dt->shared->u.vlen.f = NULL;
+ /* Reset file pointer (since this VL is in memory) */
+ dt->shared->u.vlen.file = NULL;
break;
case H5T_LOC_DISK: /* Disk based VL datatype */
- HDassert(f);
+ HDassert(file);
/* Mark this type as being stored on disk */
dt->shared->u.vlen.loc = H5T_LOC_DISK;
- /*
- * Size of element on disk is 4 bytes for the length, plus the size
- * of an address in this file, plus 4 bytes for the size of a heap
- * ID. Memory size is different.
- */
- dt->shared->size = 4 + (size_t)H5F_SIZEOF_ADDR(f) + 4;
+ /* Get container info */
+ if(H5VL_file_get(file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info")
+
+ /* The datatype size is equal to 4 bytes for the sequence length
+ * plus the size of a blob id */
+ dt->shared->size = 4 + cont_info.blob_id_size;
/* Set up the function pointers to access the VL information on disk */
/* VL sequences and VL strings are stored identically on disk, so use the same functions */
dt->shared->u.vlen.cls = &H5T_vlen_disk_g;
/* Set file ID (since this VL is on disk) */
- dt->shared->u.vlen.f = f;
+ dt->shared->u.vlen.file = file;
break;
case H5T_LOC_BADLOC:
@@ -323,7 +326,7 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
dt->shared->u.vlen.cls = NULL;
/* Reset file pointer */
- dt->shared->u.vlen.f = NULL;
+ dt->shared->u.vlen.file = NULL;
break;
case H5T_LOC_MAXLOC:
@@ -354,7 +357,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_mem_seq_getlen(H5F_t H5_ATTR_UNUSED *f, const void *_vl, size_t *len)
+H5T__vlen_mem_seq_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_t *len)
{
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */
@@ -430,7 +433,7 @@ H5T__vlen_mem_seq_getptr(void *_vl)
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_mem_seq_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl, hbool_t *isnull)
+H5T__vlen_mem_seq_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hbool_t *isnull)
{
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */
@@ -468,7 +471,7 @@ H5T__vlen_mem_seq_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl, hbool_t *isnu
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_mem_seq_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSED *_bg)
+H5T__vlen_mem_seq_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5_ATTR_UNUSED *_bg)
{
hvl_t vl; /* Temporary hvl_t to use during operation */
@@ -501,7 +504,7 @@ H5T__vlen_mem_seq_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSE
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_mem_seq_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len)
+H5T__vlen_mem_seq_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, size_t len)
{
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */
@@ -542,7 +545,7 @@ H5T__vlen_mem_seq_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_mem_seq_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size)
+H5T__vlen_mem_seq_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size)
{
hvl_t vl; /* Temporary hvl_t to use during operation */
herr_t ret_value = SUCCEED; /* Return value */
@@ -595,7 +598,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_mem_str_getlen(H5F_t H5_ATTR_UNUSED *f, const void *_vl, size_t *len)
+H5T__vlen_mem_str_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_t *len)
{
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
const char *s = *(const char * const *)_vl; /* Pointer to the user's string information */
@@ -666,7 +669,7 @@ H5T__vlen_mem_str_getptr(void *_vl)
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_mem_str_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl, hbool_t *isnull)
+H5T__vlen_mem_str_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hbool_t *isnull)
{
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
char *s = *(char **)_vl; /* Pointer to the user's string information */
@@ -699,7 +702,7 @@ H5T__vlen_mem_str_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl, hbool_t *isnu
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_mem_str_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSED *_bg)
+H5T__vlen_mem_str_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5_ATTR_UNUSED *_bg)
{
char *t = NULL; /* Pointer to temporary buffer allocated */
@@ -725,7 +728,7 @@ H5T__vlen_mem_str_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSE
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_mem_str_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len)
+H5T__vlen_mem_str_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, size_t len)
{
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
char *s = *(char **)_vl; /* Pointer to the user's string information */
@@ -765,7 +768,7 @@ H5T__vlen_mem_str_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_mem_str_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_alloc_info,
+H5T__vlen_mem_str_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc_info_t *vl_alloc_info,
void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size)
{
char *t; /* Pointer to temporary buffer allocated */
@@ -812,7 +815,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_disk_getlen(H5F_t H5_ATTR_UNUSED *f, const void *_vl, size_t *seq_len)
+H5T__vlen_disk_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_t *seq_len)
{
const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */
@@ -842,36 +845,26 @@ H5T__vlen_disk_getlen(H5F_t H5_ATTR_UNUSED *f, const void *_vl, size_t *seq_len)
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_disk_isnull(const H5F_t *f, void *_vl, hbool_t *isnull)
+H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull)
{
- H5VL_object_t *vol_obj = NULL;/* Object info */
- hid_t file_id = H5I_INVALID_HID;
uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check parameters */
- HDassert(f);
+ HDassert(file);
HDassert(vl);
HDassert(isnull);
/* Skip the sequence's length */
vl += 4;
- /* TODO temporary hack to retrieve file object */
- if((file_id = H5F__get_file_id((H5F_t *)f, FALSE)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- if(NULL == (vol_obj = H5VL_vol_object(file_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
-
/* Check if blob ID is "nil" */
- if(H5VL_blob_specific(vol_obj, vl, H5VL_BLOB_ISNULL, isnull) < 0)
+ if(H5VL_blob_specific(file, vl, H5VL_BLOB_ISNULL, isnull) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'")
done:
- if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0))
- HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file id")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__vlen_disk_isnull() */
@@ -889,41 +882,31 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_disk_setnull(H5F_t *f, void *_vl, void *bg)
+H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg)
{
- H5VL_object_t *vol_obj = NULL;/* Object info */
- hid_t file_id = H5I_INVALID_HID;
uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* check parameters */
- HDassert(f);
+ HDassert(file);
HDassert(vl);
/* Free heap object for old data */
if(bg != NULL)
/* Delete sequence in destination location */
- if(H5T__vlen_disk_delete(f, bg) < 0)
+ if(H5T__vlen_disk_delete(file, bg) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove background heap object")
/* Set the length of the sequence */
UINT32ENCODE(vl, 0);
- /* TODO temporary hack to retrieve file object */
- if((file_id = H5F__get_file_id(f, FALSE)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- if(NULL == (vol_obj = H5VL_vol_object(file_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
-
/* Set blob ID to "nil" */
- if(H5VL_blob_specific(vol_obj, vl, H5VL_BLOB_SETNULL) < 0)
+ if(H5VL_blob_specific(file, vl, H5VL_BLOB_SETNULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'")
done:
- if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0))
- HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file id")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__vlen_disk_setnull() */
@@ -941,36 +924,26 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_disk_read(H5F_t *f, void *_vl, void *buf, size_t H5_ATTR_UNUSED len)
+H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *buf, size_t len)
{
- H5VL_object_t *vol_obj = NULL;/* Object info */
- hid_t file_id = H5I_INVALID_HID;
const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check parameters */
- HDassert(f);
+ HDassert(file);
HDassert(vl);
HDassert(buf);
/* Skip the length of the sequence */
vl += 4;
- /* TODO temporary hack to retrieve file object */
- if((file_id = H5F__get_file_id(f, FALSE)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- if(NULL == (vol_obj = H5VL_vol_object(file_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
-
/* Retrieve blob */
- if(H5VL_blob_get(vol_obj, vl, buf, NULL, NULL) < 0)
+ if(H5VL_blob_get(file, vl, buf, len, NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get blob")
done:
- if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0))
- HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file id")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__vlen_disk_read() */
@@ -988,11 +961,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_disk_write(H5F_t *f, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_alloc_info,
- void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size)
+H5T__vlen_disk_write(H5VL_object_t *file,
+ const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_alloc_info, void *_vl,
+ void *buf, void *_bg, size_t seq_len, size_t base_size)
{
- H5VL_object_t *vol_obj = NULL; /* Object info */
- hid_t file_id = H5I_INVALID_HID;
uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
const uint8_t *bg = (const uint8_t *)_bg; /* Pointer to the old data hvl_t */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1002,29 +974,21 @@ H5T__vlen_disk_write(H5F_t *f, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_al
/* check parameters */
HDassert(vl);
HDassert(seq_len == 0 || buf);
- HDassert(f);
+ HDassert(file);
/* Free heap object for old data, if non-NULL */
if(bg != NULL)
- if(H5T__vlen_disk_delete(f, bg) < 0)
+ if(H5T__vlen_disk_delete(file, bg) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove background heap object")
/* Set the length of the sequence */
UINT32ENCODE(vl, seq_len);
- /* TODO temporary hack to retrieve file object */
- if((file_id = H5F__get_file_id(f, FALSE)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- if(NULL == (vol_obj = H5VL_vol_object(file_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
-
/* Store blob */
- if(H5VL_blob_put(vol_obj, buf, (seq_len * base_size), vl, NULL) < 0)
+ if(H5VL_blob_put(file, buf, (seq_len * base_size), vl, NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to put blob")
done:
- if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0))
- HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file id")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__vlen_disk_write() */
@@ -1042,16 +1006,15 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_disk_delete(H5F_t *f, const void *_vl)
+H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl)
{
const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */
- hid_t file_id = H5I_INVALID_HID;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check parameters */
- HDassert(f);
+ HDassert(file);
/* Free heap object for old data */
if(vl != NULL) {
@@ -1061,23 +1024,12 @@ H5T__vlen_disk_delete(H5F_t *f, const void *_vl)
UINT32DECODE(vl, seq_len);
/* Delete object, if length > 0 */
- if(seq_len > 0) {
- H5VL_object_t *vol_obj = NULL; /* Object info */
-
- /* TODO temporary hack to retrieve file object */
- if((file_id = H5F__get_file_id(f, FALSE)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- if(NULL == (vol_obj = H5VL_vol_object(file_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
-
- if(H5VL_blob_specific(vol_obj, (void *)vl, H5VL_BLOB_DELETE) < 0) /* Casting away 'const' OK -QAK */
+ if(seq_len > 0)
+ if(H5VL_blob_specific(file, (void *)vl, H5VL_BLOB_DELETE) < 0) /* Casting away 'const' OK -QAK */
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob")
- }
} /* end if */
done:
- if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0))
- HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file id")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__vlen_disk_delete() */
diff --git a/src/H5VL.c b/src/H5VL.c
index 5c62f6f..6790465 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -29,9 +29,11 @@
/***********/
#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5Pprivate.h" /* Property lists */
+#include "H5Tprivate.h" /* Datatypes */
#include "H5VLpkg.h" /* Virtual Object Layer */
/* VOL connectors */
@@ -279,6 +281,38 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VLpeek_connector_id
+ *
+ * Purpose: Retrieves the ID for a registered VOL connector.
+ *
+ * Return: A valid VOL connector ID if a connector by that name has
+ * been registered. This ID is *not* owned by the caller and
+ * H5VLclose() should not be called. Intended for use by VOL
+ * connectors to find their own ID.
+ *
+ * H5I_INVALID_HID on error or if a VOL connector of that
+ * name has not been registered.
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VLpeek_connector_id(const char *name)
+{
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE1("i", "*s", name);
+
+ /* Get connector ID with this name */
+ if((ret_value = H5VL__peek_connector_id(name)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLpeek_connector_id() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VLget_connector_name
*
* Purpose: Returns the connector name for the VOL associated with the
@@ -503,6 +537,73 @@ done:
} /* H5VLobject() */
+/*-------------------------------------------------------------------------
+ * Function: H5VLget_file_type
+ *
+ * Purpose: Returns a copy of dtype_id with its location set to be in
+ * the file, with updated size, etc.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VLget_file_type(void *file_obj, hid_t connector_id, hid_t dtype_id)
+{
+ H5T_t *dtype; /* unatomized type */
+ H5T_t *file_type = NULL; /* copied file type */
+ hid_t file_type_id = -1; /* copied file type id */
+ H5VL_object_t *file_vol_obj = NULL; /* VOL object for file */
+ hid_t ret_value = -1; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("i", "*xii", file_obj, connector_id, dtype_id);
+
+ /* Check args */
+ if(!file_obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "no file object supplied")
+ if(NULL == (dtype = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
+
+ /* Create VOL object for file */
+ if(NULL == (file_vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, file_obj, connector_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object")
+
+ /* Copy the datatype */
+ if(NULL == (file_type = H5T_copy(dtype, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy datatype")
+
+ /* Register file type id */
+ if((file_type_id = H5I_register(H5I_DATATYPE, file_type, FALSE)) < 0) {
+ (void)H5T_close_real(file_type);
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "unable to register file datatype")
+ } /* end if */
+
+ /* Set the location of the datatype to be in the file */
+ if(H5T_set_loc(file_type, file_vol_obj, H5T_LOC_DISK) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't set datatype location")
+
+ /* file_type now owns file_vol_obj */
+ if(H5T_own_vol_obj(file_type, file_vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't give ownership of VOL object")
+ file_vol_obj = NULL;
+
+ /* Set return value */
+ ret_value = file_type_id;
+
+done:
+ /* Cleanup on error */
+ if(ret_value < 0) {
+ if(file_vol_obj && H5VL_free_object(file_vol_obj) < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to free VOL object")
+ if(file_type_id >= 0 && H5I_dec_ref(file_type_id) < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close file datatype")
+ } /* end if */
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLget_file_type() */
+
+
/*---------------------------------------------------------------------------
* Function: H5VLretrieve_lib_state
*
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index e486fde..8d7368b 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -82,10 +82,10 @@ static void *H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params,
const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id,
void **req);
static herr_t H5VL__dataset_read(void *dset, const H5VL_class_t *cls,
- hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id,
+ hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
void *buf, void **req);
static herr_t H5VL__dataset_write(void *obj, const H5VL_class_t *cls,
- hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id,
+ hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
const void *buf, void **req);
static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type,
hid_t dxpl_id, void **req, va_list arguments);
@@ -180,7 +180,7 @@ static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls);
static herr_t H5VL__blob_put(void *obj, const H5VL_class_t *cls,
const void *buf, size_t size, void *blob_id, void *ctx);
static herr_t H5VL__blob_get(void *obj, const H5VL_class_t *cls,
- const void *blob_id, void *buf, size_t *size, void *ctx);
+ const void *blob_id, void *buf, size_t size, void *ctx);
static herr_t H5VL__blob_specific(void *obj, const H5VL_class_t *cls,
void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments);
@@ -2013,7 +2013,7 @@ done:
*/
static herr_t
H5VL__dataset_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
- hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf,
+ hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf,
void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2025,7 +2025,7 @@ H5VL__dataset_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset read' method")
/* Call the corresponding VOL callback */
- if((cls->dataset_cls.read)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ if((cls->dataset_cls.read)(obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed")
done:
@@ -2045,7 +2045,7 @@ done:
*/
herr_t
H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id,
- hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf,
+ hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf,
void **req)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
@@ -2059,7 +2059,7 @@ H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(H5VL__dataset_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ if(H5VL__dataset_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed")
done:
@@ -2083,14 +2083,14 @@ done:
*/
herr_t
H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t plist_id, void *buf, void **req)
+ hid_t file_space_id, hid_t dxpl_id, void *buf, void **req)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE8("e", "*xiiiii*x**x", obj, connector_id, mem_type_id, mem_space_id,
- file_space_id, plist_id, buf, req);
+ file_space_id, dxpl_id, buf, req);
/* Check args and get class pointer */
if(NULL == obj)
@@ -2099,7 +2099,7 @@ H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_spa
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if(H5VL__dataset_read(obj, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ if(H5VL__dataset_read(obj, cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset")
done:
@@ -2119,7 +2119,7 @@ done:
*/
static herr_t
H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
- hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf,
+ hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf,
void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2131,7 +2131,7 @@ H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset write' method")
/* Call the corresponding VOL callback */
- if((cls->dataset_cls.write)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ if((cls->dataset_cls.write)(obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed")
done:
@@ -2151,7 +2151,7 @@ done:
*/
herr_t
H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id,
- hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf,
+ hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf,
void **req)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
@@ -2165,7 +2165,7 @@ H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(H5VL__dataset_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ if(H5VL__dataset_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed")
done:
@@ -2189,14 +2189,14 @@ done:
*/
herr_t
H5VLdataset_write(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t plist_id, const void *buf, void **req)
+ hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE8("e", "*xiiiii*x**x", obj, connector_id, mem_type_id, mem_space_id,
- file_space_id, plist_id, buf, req);
+ file_space_id, dxpl_id, buf, req);
/* Check args and get class pointer */
if(NULL == obj)
@@ -2205,7 +2205,7 @@ H5VLdataset_write(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_sp
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if(H5VL__dataset_write(obj, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ if(H5VL__dataset_write(obj, cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset")
done:
@@ -6692,7 +6692,7 @@ done:
*/
static herr_t
H5VL__blob_get(void *obj, const H5VL_class_t *cls, const void *blob_id,
- void *buf, size_t *size, void *ctx)
+ void *buf, size_t size, void *ctx)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -6702,7 +6702,7 @@ H5VL__blob_get(void *obj, const H5VL_class_t *cls, const void *blob_id,
HDassert(obj);
HDassert(cls);
HDassert(blob_id);
- HDassert(size || buf);
+ HDassert(buf);
/* Check if the corresponding VOL callback exists */
if(NULL == cls->blob_cls.get)
@@ -6728,7 +6728,7 @@ done:
*/
herr_t
H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf,
- size_t *size, void *ctx)
+ size_t size, void *ctx)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -6738,7 +6738,7 @@ H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf,
/* Sanity check */
HDassert(vol_obj);
HDassert(blob_id);
- HDassert(size || buf);
+ HDassert(buf);
/* Set wrapper info in API context */
if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
@@ -6768,13 +6768,13 @@ done:
*/
herr_t
H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf,
- size_t *size, void *ctx)
+ size_t size, void *ctx)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xi*x*x*z*x", obj, connector_id, blob_id, buf, size, ctx);
+ H5TRACE6("e", "*xi*x*xz*x", obj, connector_id, blob_id, buf, size, ctx);
/* Get class pointer */
if(NULL == obj)
diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h
index 3597751..13cb2b5 100644
--- a/src/H5VLconnector.h
+++ b/src/H5VLconnector.h
@@ -116,6 +116,7 @@ typedef enum H5VL_file_get_t {
/* types for file SPECIFIC callback */
typedef enum H5VL_file_specific_t {
+ H5VL_FILE_POST_OPEN, /* Adjust file after open, with wrapping context */
H5VL_FILE_FLUSH, /* Flush file */
H5VL_FILE_REOPEN, /* Reopen the file */
H5VL_FILE_MOUNT, /* Mount a file */
@@ -285,9 +286,9 @@ typedef struct H5VL_dataset_class_t {
void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t dapl_id, hid_t dxpl_id, void **req);
herr_t (*read)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
- hid_t xfer_plist_id, void * buf, void **req);
+ hid_t dxpl_id, void * buf, void **req);
herr_t (*write)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
- hid_t xfer_plist_id, const void * buf, void **req);
+ hid_t dxpl_id, const void * buf, void **req);
herr_t (*get)(void *obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
herr_t (*specific)(void *obj, H5VL_dataset_specific_t specific_type,
hid_t dxpl_id, void **req, va_list arguments);
@@ -339,10 +340,10 @@ typedef struct H5VL_link_class_t {
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1,
void *dst_obj, const H5VL_loc_params_t *loc_params2,
- hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req);
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
herr_t (*move)(void *src_obj, const H5VL_loc_params_t *loc_params1,
void *dst_obj, const H5VL_loc_params_t *loc_params2,
- hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req);
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type,
hid_t dxpl_id, void **req, va_list arguments);
herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type,
@@ -380,7 +381,7 @@ typedef struct H5VL_request_class_t {
/* 'blob' routines */
typedef struct H5VL_blob_class_t {
herr_t (*put)(void *obj, const void *buf, size_t size, void *blob_id, void *ctx);
- herr_t (*get)(void *obj, const void *blob_id, void *buf, size_t *size, void *ctx);
+ herr_t (*get)(void *obj, const void *blob_id, void *buf, size_t size, void *ctx);
herr_t (*specific)(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments);
herr_t (*optional)(void *obj, void *blob_id, va_list arguments);
} H5VL_blob_class_t;
@@ -440,6 +441,9 @@ extern "C" {
/* Helper routines for VOL connector authors */
H5_DLL void *H5VLobject(hid_t obj_id);
+H5_DLL hid_t H5VLget_file_type(void *file_obj, hid_t connector_id,
+ hid_t dtype_id);
+H5_DLL hid_t H5VLpeek_connector_id(const char *name);
#ifdef __cplusplus
}
diff --git a/src/H5VLconnector_passthru.h b/src/H5VLconnector_passthru.h
index d0d73d2..a4c8742 100644
--- a/src/H5VLconnector_passthru.h
+++ b/src/H5VLconnector_passthru.h
@@ -160,7 +160,7 @@ H5_DLL herr_t H5VLrequest_free(void *req, hid_t connector_id);
/* Public wrappers for blob callbacks */
H5_DLL herr_t H5VLblob_put(void *obj, hid_t connector_id, const void *buf, size_t size, void *blob_id, void *ctx);
-H5_DLL herr_t H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf, size_t *size, void *ctx);
+H5_DLL herr_t H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf, size_t size, void *ctx);
H5_DLL herr_t H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments);
/* Public wrappers for generic 'optional' callback */
diff --git a/src/H5VLint.c b/src/H5VLint.c
index 09acb2a..733a2b5 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -424,7 +424,7 @@ H5VL__set_def_conn(void)
else {
/* Register the VOL connector */
/* (NOTE: No provisions for vipl_id currently) */
- if((connector_id = H5VL__register_connector_by_name(tok, FALSE, H5P_DEFAULT)) < 0)
+ if((connector_id = H5VL__register_connector_by_name(tok, TRUE, H5P_DEFAULT)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register connector")
} /* end else */
} /* end else */
@@ -815,6 +815,62 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL_create_object_using_vol_id
+ *
+ * Purpose: Similar to H5VL_register_using_vol_id but does not create
+ * an id. Intended for use by internal library routines,
+ * therefore it wraps the object.
+ *
+ * Return: Success: VOL object pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+H5VL_object_t *
+H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id)
+{
+ H5VL_class_t *cls = NULL; /* VOL connector class */
+ H5VL_t *connector = NULL; /* VOL connector struct */
+ hbool_t conn_id_incr = FALSE; /* Whether the VOL connector ID has been incremented */
+ H5VL_object_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Get the VOL class object from the connector's ID */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Setup VOL info struct */
+ if(NULL == (connector = H5FL_CALLOC(H5VL_t)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate VOL info struct")
+ connector->cls = cls;
+ connector->id = connector_id;
+ if(H5I_inc_ref(connector->id, FALSE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, NULL, "unable to increment ref count on VOL connector")
+ conn_id_incr = TRUE;
+
+ /* Set up VOL object for the passed-in data */
+ /* (Wraps object, since it's a library object) */
+ if(NULL == (ret_value = H5VL__new_vol_obj(type, obj, connector, TRUE)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't create VOL object")
+
+done:
+ /* Clean up on error */
+ if(!ret_value) {
+ /* Decrement VOL connector ID ref count on error */
+ if(conn_id_incr && H5I_dec_ref(connector_id) < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, NULL, "unable to decrement ref count on VOL connector")
+
+ /* Free VOL connector struct */
+ if(NULL != connector)
+ connector = H5FL_FREE(H5VL_t, connector);
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_create_object_using_vol_id() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL__conn_inc_rc
*
* Purpose: Wrapper to increment the ref. count on a connector.
@@ -1052,7 +1108,7 @@ H5VL__register_connector_by_name(const char *name, hbool_t app_ref, hid_t vipl_i
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)
+ if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, app_ref) < 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 */
@@ -1196,6 +1252,37 @@ done:
hid_t
H5VL__get_connector_id(const char *name, hbool_t is_api)
{
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Find connector with name */
+ if((ret_value = H5VL__peek_connector_id(name)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't find VOL connector")
+
+ /* Found a connector with that name */
+ if(H5I_inc_ref(ret_value, is_api) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__get_connector_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__peek_connector_id
+ *
+ * Purpose: Retrieves the ID for a registered VOL connector. Does not
+ * increment the ref count
+ *
+ * Return: Positive if the VOL class has been registered
+ * Negative on error (if the class is not a valid class or not registered)
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL__peek_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 */
@@ -1210,16 +1297,12 @@ H5VL__get_connector_id(const char *name, hbool_t is_api)
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 */
+ /* Set return value */
+ ret_value = op_data.found_id;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__get_connector_id() */
+} /* end H5VL__peek_connector_id() */
/*-------------------------------------------------------------------------
diff --git a/src/H5VLnative_blob.c b/src/H5VLnative_blob.c
index b16b407..6c7f9b2 100644
--- a/src/H5VLnative_blob.c
+++ b/src/H5VLnative_blob.c
@@ -109,12 +109,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t *size,
+H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size,
void H5_ATTR_UNUSED *ctx)
{
H5F_t *f = (H5F_t *)obj; /* Retrieve file pointer */
const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the disk blob ID */
H5HG_t hobjid; /* Global heap ID for sequence */
+ size_t hobj_size; /* Global heap object size returned from H5HG_read() */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -131,9 +132,13 @@ H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t *size,
/* Check if this sequence actually has any data */
if(hobjid.addr > 0)
/* Read the VL information from disk */
- if(NULL == H5HG_read(f, &hobjid, buf, size))
+ if(NULL == H5HG_read(f, &hobjid, buf, &hobj_size))
HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read VL information")
+ /* Verify the size is correct */
+ if(hobj_size != size)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "Expected global heap object size does not match")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL__native_blob_get() */
@@ -175,7 +180,7 @@ H5VL__native_blob_specific(void *obj, void *blob_id,
H5F_addr_decode(f, &id, &(hobjid.addr));
UINT32DECODE(id, hobjid.idx);
- /* Free heap object */
+ /* Get heap object's size */
if(hobjid.addr > 0) {
if(H5HG_get_obj_size(f, &hobjid, size) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTREMOVE, FAIL, "unable to remove heap object")
diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c
index 63574c6..094722e 100644
--- a/src/H5VLnative_file.c
+++ b/src/H5VLnative_file.c
@@ -305,6 +305,15 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type,
FUNC_ENTER_PACKAGE
switch(specific_type) {
+ /* Finalize H5Fopen */
+ case H5VL_FILE_POST_OPEN:
+ {
+ /* Call package routine */
+ if(H5F__post_open((H5F_t *)obj) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't finish opening file")
+ break;
+ }
+
/* H5Fflush */
case H5VL_FILE_FLUSH:
{
diff --git a/src/H5VLnative_link.c b/src/H5VLnative_link.c
index 5d5935d..2a8c27a 100644
--- a/src/H5VLnative_link.c
+++ b/src/H5VLnative_link.c
@@ -43,15 +43,10 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj,
const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id,
hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
{
- H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- /* Get the plist structure */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
switch(create_type) {
case H5VL_LINK_CREATE_HARD:
{
diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h
index 5ed0b1f..69a057e 100644
--- a/src/H5VLnative_private.h
+++ b/src/H5VLnative_private.h
@@ -103,7 +103,7 @@ H5_DLL herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req);
/* Blob callbacks */
H5_DLL herr_t H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx);
-H5_DLL herr_t H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t *size, void *ctx);
+H5_DLL herr_t H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx);
H5_DLL herr_t H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments);
#ifdef __cplusplus
diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c
index 85c2211..d9a207f 100644
--- a/src/H5VLpassthru.c
+++ b/src/H5VLpassthru.c
@@ -180,7 +180,7 @@ static herr_t H5VL_pass_through_request_free(void *req);
/* Blob callbacks */
static herr_t H5VL_pass_through_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx);
-static herr_t H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf, size_t *size, void *ctx);
+static herr_t H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx);
static herr_t H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments);
@@ -2580,7 +2580,7 @@ H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx)
herr_t ret_value;
#ifdef ENABLE_PASSTHRU_LOGGING
- printf("------- PASS THROUGH VOL REQUEST Wait\n");
+ printf("------- PASS THROUGH VOL REQUEST Notify\n");
#endif
ret_value = H5VLrequest_notify(o->under_object, o->under_vol_id, cb, ctx);
@@ -2885,7 +2885,7 @@ H5VL_pass_through_blob_put(void *obj, const void *buf, size_t size,
*/
herr_t
H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf,
- size_t *size, void *ctx)
+ size_t size, void *ctx)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
diff --git a/src/H5VLpkg.h b/src/H5VLpkg.h
index 69e51c2..fc3088d 100644
--- a/src/H5VLpkg.h
+++ b/src/H5VLpkg.h
@@ -55,6 +55,7 @@ H5_DLL hid_t H5VL__register_connector_by_value(H5VL_class_value_t value,
hbool_t app_ref, hid_t vipl_id);
H5_DLL htri_t H5VL__is_connector_registered(const char *name);
H5_DLL hid_t H5VL__get_connector_id(const char *name, hbool_t is_api);
+H5_DLL hid_t H5VL__peek_connector_id(const char *name);
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);
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index 2889524..c572b79 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -89,6 +89,7 @@ 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 H5VL_object_t *H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id);
H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj);
/* Functions that wrap / unwrap VOL objects */
@@ -139,8 +140,8 @@ H5_DLL herr_t H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void
/* Dataset functions */
H5_DLL void *H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL_dataset_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req);
-H5_DLL herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
+H5_DLL herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf, void **req);
+H5_DLL herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req);
H5_DLL herr_t H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...);
H5_DLL herr_t H5VL_dataset_specific(const H5VL_object_t *cls, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...);
H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...);
@@ -195,7 +196,7 @@ H5_DLL herr_t H5VL_request_free(const H5VL_object_t *vol_obj);
/* Blob functions */
H5_DLL herr_t H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_t size, void *blob_id, void *ctx);
-H5_DLL herr_t H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size_t *size, void *ctx);
+H5_DLL herr_t H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size_t size, void *ctx);
H5_DLL herr_t H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specific_t specific_type, ...);
/* Generic functions */
diff --git a/src/H5private.h b/src/H5private.h
index b5ee984..2b35bd4 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -2688,7 +2688,7 @@ H5_DLL herr_t H5_combine_path(const char *path1, const char *path2, char **ful
#ifdef H5_HAVE_PARALLEL
/* Generic MPI functions */
H5_DLL hsize_t H5_mpi_set_bigio_count(hsize_t new_count);
-H5_DLL hsize_t H5_mpi_get_bigio_count();
+H5_DLL hsize_t H5_mpi_get_bigio_count(void);
H5_DLL herr_t H5_mpi_comm_dup(MPI_Comm comm, MPI_Comm *comm_new);
H5_DLL herr_t H5_mpi_info_dup(MPI_Info info, MPI_Info *info_new);
H5_DLL herr_t H5_mpi_comm_free(MPI_Comm *comm);
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index 1591bed..0c2be75 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -39,7 +39,7 @@ Languages:
H5_CPPFLAGS: @H5_CPPFLAGS@
AM_CPPFLAGS: @AM_CPPFLAGS@
C Flags: @CFLAGS@
- H5 C Flags: @H5_CFLAGS@
+ H5 C Flags: @H5_CFLAGS@ @H5_ECFLAGS@
AM C Flags: @AM_CFLAGS@
Shared C Library: @enable_shared@
Static C Library: @enable_static@
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index c7a945e..d3f8ed8 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -16,9 +16,11 @@ set (TEST_LIB_SOURCES
${HDF5_TEST_SOURCE_DIR}/cache_common.c
${HDF5_TEST_SOURCE_DIR}/external_common.c
${HDF5_TEST_SOURCE_DIR}/swmr_common.c
+ ${HDF5_TEST_SOURCE_DIR}/vds_swmr_common.c
)
set (TEST_LIB_HEADERS
+ ${HDF5_TEST_SOURCE_DIR}/H5srcdir.h
${HDF5_TEST_SOURCE_DIR}/h5test.h
${HDF5_TEST_SOURCE_DIR}/cache_common.h
${HDF5_TEST_SOURCE_DIR}/external_common.h
diff --git a/test/H5srcdir.c b/test/H5srcdir.c
new file mode 100644
index 0000000..8268d2c
--- /dev/null
+++ b/test/H5srcdir.c
@@ -0,0 +1,61 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "H5private.h"
+#include "H5srcdir.h"
+
+/* Buffer to construct path in and return pointer to */
+char srcdir_path[1024] = "";
+
+/* Buffer to construct file in and return pointer to */
+char srcdir_testpath[1024] = "";
+
+/* Just return the srcdir path */
+const char *
+H5_get_srcdir(void)
+{
+ const char *srcdir = HDgetenv("srcdir");
+
+ /* Check for using the srcdir from configure time */
+ if(NULL == srcdir)
+ srcdir = config_srcdir;
+
+ /* Build path to all test files */
+ if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
+ HDsnprintf(srcdir_path, sizeof(srcdir_path), "%s/", srcdir);
+ return(srcdir_path);
+ } /* end if */
+ else
+ return(NULL);
+} /* end H5_get_srcdir() */
+
+/* Append the test file name to the srcdir path and return the whole string */
+const char *
+H5_get_srcdir_filename(const char *filename)
+{
+ const char *srcdir = H5_get_srcdir();
+
+ /* Check for error */
+ if(NULL == srcdir)
+ return(NULL);
+ else {
+ /* Build path to test file */
+ if((HDstrlen(srcdir) + HDstrlen(filename) + 1) < sizeof(srcdir_testpath)) {
+ HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s%s", srcdir, filename);
+ return(srcdir_testpath);
+ } /* end if */
+ else
+ return(NULL);
+ } /* end else */
+} /* end H5_get_srcdir_filename() */
+
diff --git a/test/H5srcdir.h b/test/H5srcdir.h
index 32fe8c9..d0a4bf7 100644
--- a/test/H5srcdir.h
+++ b/test/H5srcdir.h
@@ -24,47 +24,16 @@
#include "H5srcdir_str.h"
/* Buffer to construct path in and return pointer to */
-static char srcdir_path[1024] = "";
+extern char srcdir_path[1024];
/* Buffer to construct file in and return pointer to */
-static char srcdir_testpath[1024] = "";
+extern char srcdir_testpath[1024];
/* Just return the srcdir path */
-static const char *
-H5_get_srcdir(void)
-{
- const char *srcdir = HDgetenv("srcdir");
-
- /* Check for using the srcdir from configure time */
- if(NULL == srcdir)
- srcdir = config_srcdir;
-
- /* Build path to all test files */
- if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
- HDsnprintf(srcdir_path, sizeof(srcdir_path), "%s/", srcdir);
- return(srcdir_path);
- } /* end if */
- else
- return(NULL);
-} /* end H5_get_srcdir() */
+const char *H5_get_srcdir(void);
/* Append the test file name to the srcdir path and return the whole string */
-static const char *H5_get_srcdir_filename(const char *filename)
-{
- const char *srcdir = H5_get_srcdir();
+const char *H5_get_srcdir_filename(const char *);
- /* Check for error */
- if(NULL == srcdir)
- return(NULL);
- else {
- /* Build path to test file */
- if((HDstrlen(srcdir) + HDstrlen(filename) + 1) < sizeof(srcdir_testpath)) {
- HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s%s", srcdir, filename);
- return(srcdir_testpath);
- } /* end if */
- else
- return(NULL);
- } /* end else */
-} /* end H5_get_srcdir_filename() */
#endif /* _H5SRCDIR_H */
diff --git a/test/H5srcdir_str.h.in b/test/H5srcdir_str.h.in
index bab1df3..ba30a88 100644
--- a/test/H5srcdir_str.h.in
+++ b/test/H5srcdir_str.h.in
@@ -16,5 +16,5 @@
*/
/* Set the 'srcdir' path from configure time */
-static const char *config_srcdir = "@srcdir@";
+#define config_srcdir "@srcdir@"
diff --git a/test/Makefile.am b/test/Makefile.am
index 57080aa..d66200d 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -135,7 +135,7 @@ else
noinst_LTLIBRARIES=libh5test.la
endif
-libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c external_common.c
+libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c external_common.c H5srcdir.c
# Use libhd5test.la to compile all of the tests
LDADD=libh5test.la $(LIBHDF5)
@@ -145,6 +145,12 @@ ttsafe_SOURCES=ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \
ttsafe_acreate.c
cache_image_SOURCES=cache_image.c genall5.c
+#filter_plugin_SOURCES=filter_plugin.c H5srcdir.c
+
+vds_swmr_gen_SOURCES=vds_swmr_gen.c vds_swmr_common.c
+vds_swmr_writer_SOURCES=vds_swmr_writer.c vds_swmr_common.c
+vds_swmr_reader_SOURCES=vds_swmr_reader.c vds_swmr_common.c
+
VFD_LIST = sec2 stdio core core_paged split multi family
if DIRECT_VFD_CONDITIONAL
VFD_LIST += direct
diff --git a/test/cache.c b/test/cache.c
index 1a726fa..e59dc3e 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -16926,7 +16926,7 @@ check_move_entry_errs(unsigned paged)
{
herr_t result;
H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
+ H5C_t * cache_ptr;
test_entry_t * entry_ptr = NULL;
test_entry_t * entry_0_0_ptr;
test_entry_t * entry_0_1_ptr;
diff --git a/test/cache_common.c b/test/cache_common.c
index 24962bc..740523e 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -5522,7 +5522,7 @@ col_major_scan_backward(H5F_t * file_ptr,
int mile_stone = 1;
int32_t type;
int32_t idx;
- int32_t local_max_index[NUMBER_OF_ENTRY_TYPES];
+ int32_t local_max_index[NUMBER_OF_ENTRY_TYPES] = {0};
if ( verbose )
HDfprintf(stdout, "%s: entering.\n", FUNC);
diff --git a/test/cache_tagging.c b/test/cache_tagging.c
index 7ce4e88..c3921ea 100644
--- a/test/cache_tagging.c
+++ b/test/cache_tagging.c
@@ -528,7 +528,7 @@ check_file_open_tags(hid_t fcpl, int type)
hid_t fid = -1; /* File Identifier */
int verbose = FALSE; /* verbose file outout */
hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag; /* Root Group Tag */
+ haddr_t root_tag = HADDR_UNDEF; /* Root Group Tag */
haddr_t sbe_tag; /* Sblock Extension Tag */
/* Testing Macro */
diff --git a/test/del_many_dense_attrs.c b/test/del_many_dense_attrs.c
index ada7a6f..ce85d1b 100644
--- a/test/del_many_dense_attrs.c
+++ b/test/del_many_dense_attrs.c
@@ -70,7 +70,7 @@ main(void)
hid_t fapl = -1; /* File access property lists */
hid_t gcpl = -1; /* Group creation property list */
char aname[50]; /* Name of attribute */
- char *basename="attr"; /* Name prefix for attribute */
+ const char *basename="attr";/* Name prefix for attribute */
char filename[100]; /* File name */
int i; /* Local index variable */
diff --git a/test/dsets.c b/test/dsets.c
index 21d5431..aa84833 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -7022,6 +7022,69 @@ error:
return FAIL;
} /* end test_missing_chunk() */
+/* Using Euclid's algorithm, find the greatest common divisor (GCD) of
+ * the two arguments and return it.
+ *
+ * The GCD is negative if the arguments have opposite sign. Otherwise,
+ * it is positive.
+ *
+ * If either argument is zero, then the result is undefined.
+ */
+static long
+gcd(const long l0, const long r0)
+{
+ long magnitude, remainder;
+ bool negative = ((l0 < 0) != (r0 < 0));
+ long l = labs(l0), r = labs(r0);
+
+ do {
+ if (l < r) {
+ r = r % l;
+ remainder = r;
+ } else /* r <= l */ {
+ l = l % r;
+ remainder = l;
+ }
+ } while (remainder != 0);
+
+ magnitude = (l == 0) ? r : l;
+ return negative ? -magnitude : magnitude;
+}
+
+/* Choose a random offset into an array `nelts` elements long, and store
+ * it at `offsetp`. The offset will be in the range [0, nelts - 1].
+ * Also choose a random increment, `inc`, that "generates" all
+ * indices in [0, nelts - 1] when it is added to itself repeatedly.
+ * That is, the range of the discrete function `f(i) = (i * inc)
+ * mod nelts` on the domain [0, nelts - 1] is [0, nelts - 1]. Store
+ * `inc` at `incp`.
+ *
+ * If `nelts <= 0`, results are undefined.
+ */
+static void
+make_random_offset_and_increment(long nelts, long *offsetp, long *incp)
+{
+ long inc;
+ /* `maxinc` is chosen so that for any `x` in [0, nelts - 1],
+ * `x + maxinc` does not overflow a long.
+ */
+ const long maxinc = MIN(nelts - 1, LONG_MAX - nelts);
+
+ HDassert(0 < nelts);
+
+ *offsetp = HDrandom() % nelts;
+
+ /* Choose a random number in [1, nelts - 1]. If its greatest divisor
+ * in common with `nelts` is 1, then it will "generate" the additive ring
+ * [0, nelts - 1], so let it be our increment. Otherwise, choose a new
+ * number.
+ */
+ do {
+ inc = 1 + HDrandom() % maxinc;
+ } while (gcd(inc, nelts) != 1);
+
+ *incp = inc;
+}
/*-------------------------------------------------------------------------
* Function: test_random_chunks_real
@@ -7046,7 +7109,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl)
rbuf[NPOINTS],
check2[20][20];
hsize_t coord[NPOINTS][2];
- hsize_t dsize[2]={100,100}, dmax[2]={H5S_UNLIMITED, H5S_UNLIMITED}, csize[2]={10,10}, nsize[2]={200,200};
+ const hsize_t dsize[2]={100,100}, dmax[2]={H5S_UNLIMITED, H5S_UNLIMITED}, csize[2]={10,10}, nsize[2]={200,200};
hsize_t fixed_dmax[2] = {1000, 1000};
hsize_t msize[1]={NPOINTS};
const char dname[]="dataset";
@@ -7054,7 +7117,9 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl)
size_t i, j;
H5D_chunk_index_t idx_type; /* Dataset chunk index type */
H5F_libver_t low; /* File format low bound */
-
+ long ofs, inc;
+ long rows;
+ long cols;
TESTING(testname);
@@ -7088,12 +7153,16 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl)
for(j=0; j<dsize[1]/csize[1]; j++)
check2[i][j] = 0;
+ rows = (long)(dsize[0]/csize[0]);
+ cols = (long)(dsize[1]/csize[1]);
+ make_random_offset_and_increment(rows * cols, &ofs, &inc);
+
/* Generate random point coordinates. Only one point is selected per chunk */
for(i=0; i<NPOINTS; i++){
- do {
- chunk_row = (int)HDrandom () % (int)(dsize[0]/csize[0]);
- chunk_col = (int)HDrandom () % (int)(dsize[1]/csize[1]);
- } while (check2[chunk_row][chunk_col]);
+ chunk_row = ofs / cols;
+ chunk_col = ofs % cols;
+ ofs = (ofs + inc) % (rows * cols);
+ HDassert(!check2[chunk_row][chunk_col]);
wbuf[i] = check2[chunk_row][chunk_col] = chunk_row+chunk_col+1;
coord[i][0] = (hsize_t)chunk_row * csize[0];
@@ -7211,12 +7280,16 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl)
for(j = 0; j < nsize[1] / csize[1]; j++)
check2[i][j] = 0;
+ rows = nsize[0] / csize[0];
+ cols = nsize[1] / csize[1];
+ make_random_offset_and_increment(rows * cols, &ofs, &inc);
+
/* Generate random point coordinates. Only one point is selected per chunk */
for(i = 0; i < NPOINTS; i++){
- do {
- chunk_row = (int)HDrandom() % (int)(nsize[0] / csize[0]);
- chunk_col = (int)HDrandom() % (int)(nsize[1] / csize[1]);
- } while (check2[chunk_row][chunk_col]);
+ chunk_row = ofs / cols;
+ chunk_col = ofs % cols;
+ ofs = (ofs + inc) % (rows * cols);
+ HDassert(!check2[chunk_row][chunk_col]);
wbuf[i] = check2[chunk_row][chunk_col] = chunk_row + chunk_col + 1;
coord[i][0] = (hsize_t)chunk_row * csize[0];
@@ -7317,12 +7390,16 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl)
for(j = 0; j < nsize[1] / csize[1]; j++)
check2[i][j] = 0;
+ rows = (long)(nsize[0] / csize[0]);
+ cols = (long)(nsize[1] / csize[1]);
+ make_random_offset_and_increment(rows * cols, &ofs, &inc);
+
/* Generate random point coordinates. Only one point is selected per chunk */
for(i = 0; i < NPOINTS; i++){
- do {
- chunk_row = (int)HDrandom() % (int)(nsize[0] / csize[0]);
- chunk_col = (int)HDrandom() % (int)(nsize[1] / csize[1]);
- } while (check2[chunk_row][chunk_col]);
+ chunk_row = ofs / cols;
+ chunk_col = ofs % cols;
+ ofs = (ofs + inc) % (rows * cols);
+ HDassert(!check2[chunk_row][chunk_col]);
wbuf[i] = check2[chunk_row][chunk_col] = chunk_row + chunk_col + 1;
coord[i][0] = (hsize_t)chunk_row * csize[0];
@@ -9338,7 +9415,7 @@ test_fixed_array(hid_t fapl)
hid_t dsid_max = -1; /* Dataset ID for dataset with maximum dimensions set */
hsize_t dim2[2] = {48, 18}; /* Dataset dimensions */
- hsize_t dim2_big[2] = {500, 60}; /* Big dataset dimensions */
+ const hsize_t dim2_big[2] = {500, 60}; /* Big dataset dimensions */
hsize_t dim2_max[2] = {120, 50}; /* Maximum dataset dimensions */
hid_t mem_id; /* Memory space ID */
@@ -9352,7 +9429,7 @@ test_fixed_array(hid_t fapl)
int rbuf[POINTS]; /* read buffer */
int *rbuf_big = NULL; /* read buffer for big dataset */
- hsize_t chunk_dim2[2] = {4, 3}; /* Chunk dimensions */
+ const hsize_t chunk_dim2[2] = {4, 3}; /* Chunk dimensions */
int chunks[12][6]; /* # of chunks for dataset dimensions */
int chunks_big[125][20]; /* # of chunks for big dataset dimensions */
int chunk_row; /* chunk row index */
@@ -9374,6 +9451,9 @@ test_fixed_array(hid_t fapl)
size_t i, j; /* local index variables */
herr_t ret; /* Generic return value */
+ long ofs, inc;
+ long rows;
+ long cols;
TESTING("datasets w/fixed array as chunk index");
@@ -9432,16 +9512,20 @@ test_fixed_array(hid_t fapl)
for(j = 0; j < dim2[1]/chunk_dim2[1]; j++)
chunks[i][j] = 0;
+ rows = (long)(dim2[0]/chunk_dim2[0]);
+ cols = (long)(dim2[1]/chunk_dim2[1]);
+ make_random_offset_and_increment(rows * cols, &ofs, &inc);
+
/* Generate random point coordinates. Only one point is selected per chunk */
for(i = 0; i < POINTS; i++){
- do {
- chunk_row = (int)HDrandom () % (int)(dim2[0]/chunk_dim2[0]);
- chunk_col = (int)HDrandom () % (int)(dim2[1]/chunk_dim2[1]);
- } while (chunks[chunk_row][chunk_col]);
-
- wbuf[i] = chunks[chunk_row][chunk_col] = chunk_row+chunk_col+1;
- coord[i][0] = (hsize_t)chunk_row * chunk_dim2[0];
- coord[i][1] = (hsize_t)chunk_col * chunk_dim2[1];
+ chunk_row = ofs / cols;
+ chunk_col = ofs % cols;
+ ofs = (ofs + inc) % (rows * cols);
+ HDassert(!chunks[chunk_row][chunk_col]);
+
+ wbuf[i] = chunks[chunk_row][chunk_col] = chunk_row+chunk_col+1;
+ coord[i][0] = (hsize_t)chunk_row * chunk_dim2[0];
+ coord[i][1] = (hsize_t)chunk_col * chunk_dim2[1];
} /* end for */
/* Create first dataset with cur and max dimensions */
@@ -9557,16 +9641,20 @@ test_fixed_array(hid_t fapl)
for(j = 0; j < dim2_big[1]/chunk_dim2[1]; j++)
chunks_big[i][j] = 0;
+ rows = (long)(dim2_big[0]/chunk_dim2[0]);
+ cols = (long)(dim2_big[1]/chunk_dim2[1]);
+ make_random_offset_and_increment(rows * cols, &ofs, &inc);
+
/* Generate random point coordinates. Only one point is selected per chunk */
for(i = 0; i < POINTS_BIG; i++){
- do {
- chunk_row = (int)HDrandom () % (int)(dim2_big[0]/chunk_dim2[0]);
- chunk_col = (int)HDrandom () % (int)(dim2_big[1]/chunk_dim2[1]);
- } while (chunks_big[chunk_row][chunk_col]);
-
- wbuf_big[i] = chunks_big[chunk_row][chunk_col] = chunk_row+chunk_col+1;
- coord_big[i][0] = (hsize_t)chunk_row * chunk_dim2[0];
- coord_big[i][1] = (hsize_t)chunk_col * chunk_dim2[1];
+ chunk_row = ofs / cols;
+ chunk_col = ofs % cols;
+ ofs = (ofs + inc) % (rows * cols);
+ HDassert(!chunks_big[chunk_row][chunk_col]);
+
+ wbuf_big[i] = chunks_big[chunk_row][chunk_col] = chunk_row+chunk_col+1;
+ coord_big[i][0] = (hsize_t)chunk_row * chunk_dim2[0];
+ coord_big[i][1] = (hsize_t)chunk_col * chunk_dim2[1];
} /* end for */
/* Create dataspace for write buffer */
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 7e1adf5..8d04770 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -770,7 +770,7 @@ static int test_particular_fp_integer(void)
/* Print errors */
if(dst_c != SCHAR_MAX) {
- double x;
+ double x = 0.;
signed char y;
if(0 == fails_this_test++)
@@ -814,7 +814,7 @@ static int test_particular_fp_integer(void)
/* Print errors */
if(dst_i != fill_value) {
- float x;
+ float x = 0.;
int y;
if(0 == fails_this_test++)
@@ -2723,16 +2723,16 @@ my_isnan(dtype_t type, void *val)
char s[256];
if (FLT_FLOAT==type) {
- float x;
+ float x = 0.;
HDmemcpy(&x, val, sizeof(float));
retval = (x!=x);
} else if (FLT_DOUBLE==type) {
- double x;
+ double x = 0.;
HDmemcpy(&x, val, sizeof(double));
retval = (x!=x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (FLT_LDOUBLE==type) {
- long double x;
+ long double x = 0.;
HDmemcpy(&x, val, sizeof(long double));
retval = (x!=x);
#endif
@@ -2746,18 +2746,18 @@ my_isnan(dtype_t type, void *val)
*/
if (!retval) {
if (FLT_FLOAT==type) {
- float x;
+ float x = 0.;
HDmemcpy(&x, val, sizeof(float));
HDsnprintf(s, sizeof(s), "%g", (double)x);
} else if (FLT_DOUBLE==type) {
- double x;
+ double x = 0.;
HDmemcpy(&x, val, sizeof(double));
HDsnprintf(s, sizeof(s), "%g", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (FLT_LDOUBLE==type) {
- long double x;
+ long double x = 0.;
HDmemcpy(&x, val, sizeof(long double));
HDsnprintf(s, sizeof(s), "%Lg", x);
@@ -3197,7 +3197,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
int check_expo[2];
if (FLT_FLOAT==dst_type) {
- float x;
+ float x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
if (underflow &&
HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN)
@@ -3208,7 +3208,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
check_mant[0] = HDfrexpf(x, check_expo+0);
check_mant[1] = HDfrexpf(hw_f, check_expo+1);
} else if (FLT_DOUBLE==dst_type) {
- double x;
+ double x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
if (underflow &&
HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN)
@@ -3220,7 +3220,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
check_mant[1] = HDfrexp(hw_d, check_expo+1);
#if H5_SIZEOF_LONG_DOUBLE !=0 && (H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE)
} else {
- long double x;
+ long double x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(long double));
/* dst is largest float, no need to check underflow. */
check_mant[0] = (double)HDfrexpl(x, check_expo+0);
@@ -3265,16 +3265,16 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
HDprintf(" %02x", saved[j*src_size+ENDIAN(src_size,k,sendian)]);
HDprintf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
if (FLT_FLOAT==src_type) {
- float x;
+ float x = 0.;
HDmemcpy(&x, &saved[j*src_size], sizeof(float));
HDprintf(" %29.20e\n", (double)x);
} else if (FLT_DOUBLE==src_type) {
- double x;
+ double x = 0.;
HDmemcpy(&x, &saved[j*src_size], sizeof(double));
HDprintf(" %29.20e\n", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
} else {
- long double x;
+ long double x = 0.;
HDmemcpy(&x, &saved[j*src_size], sizeof(long double));
HDfprintf(stdout," %29.20Le\n", x);
#endif
@@ -3285,16 +3285,16 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
HDprintf(" %02x", buf[j*dst_size+ENDIAN(dst_size,k,dendian)]);
HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
if (FLT_FLOAT==dst_type) {
- float x;
+ float x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
HDprintf(" %29.20e\n", (double)x);
} else if (FLT_DOUBLE==dst_type) {
- double x;
+ double x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
HDprintf(" %29.20e\n", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
} else {
- long double x;
+ long double x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(long double));
HDfprintf(stdout," %29.20Le\n", x);
#endif
diff --git a/test/fillval.c b/test/fillval.c
index 47cd53a..dd0ca7f 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -762,6 +762,11 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
comp_datatype *buf_c=NULL;
H5D_space_status_t allocation;
+ fill_c.a = 0;
+ fill_c.x = 0;
+ fill_c.y = 0;
+ fill_c.z = 0;
+
if(datatype == H5T_INTEGER) {
fillval = *(int*)_fillval;
}
diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c
index 5ed8545..64f62c4 100644
--- a/test/null_vol_connector.c
+++ b/test/null_vol_connector.c
@@ -116,6 +116,12 @@ static const H5VL_class_t null_vol_g = {
NULL, /* optional */
NULL /* free */
},
+ { /* blob_cls */
+ NULL, /* put */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
+ },
NULL /* optional */
};
diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c
index 721a7c6..fdb3179 100644
--- a/test/objcopy_ref.c
+++ b/test/objcopy_ref.c
@@ -1587,7 +1587,6 @@ main(void)
unsigned max_compact, min_dense;
int configuration; /* Configuration of tests. */
int ExpressMode;
- hbool_t same_file; /* Whether to run tests that only use one file */
/* Setup */
h5_reset();
@@ -1620,11 +1619,6 @@ main(void)
hid_t fcpl_src;
hid_t fcpl_dst;
- /* Start with same_file == TRUE. Use source file settings for these
- * tests. Don't run with a non-default destination file setting, as
- * destination settings have no effect. */
- same_file = TRUE;
-
/* No need to test dense attributes with old format */
if(!(configuration & CONFIG_SRC_NEW_FORMAT) && (configuration & CONFIG_DENSE))
continue;
@@ -1646,7 +1640,6 @@ main(void)
if(configuration & CONFIG_SHARE_DST) {
HDputs("Testing with shared dst messages:");
fcpl_dst = fcpl_shared;
- same_file = FALSE;
}
else {
HDputs("Testing without shared dst messages:");
@@ -1678,7 +1671,6 @@ main(void)
if(configuration & CONFIG_DST_NEW_FORMAT) {
HDputs("Testing with latest format for destination file:");
dst_fapl = fapl2;
- same_file = FALSE;
} /* end if */
else {
HDputs("Testing with oldest file format for destination file:");
diff --git a/test/swmr_sparse_reader.c b/test/swmr_sparse_reader.c
index 6adc6c5..a969b16 100644
--- a/test/swmr_sparse_reader.c
+++ b/test/swmr_sparse_reader.c
@@ -115,7 +115,7 @@ check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t
/* Emit informational message */
if(verbose)
- HDfprintf(stderr, "Symbol = '%s', location = %lld\n", symbol->name, (long long)start);
+ HDfprintf(stderr, "Symbol = '%s', location = %ju,%ju\n", symbol->name, (uintmax_t)start[0], (uintmax_t)start[1]);
/* Read record from dataset */
record->rec_id = (uint64_t)ULLONG_MAX;
@@ -126,7 +126,7 @@ check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t
if(record->rec_id != start[1]) {
HDfprintf(stderr, "*** ERROR ***\n");
HDfprintf(stderr, "Incorrect record value!\n");
- HDfprintf(stderr, "Symbol = '%s', location = %lld, record->rec_id = %llu\n", symbol->name, (long long)start, (unsigned long long)record->rec_id);
+ HDfprintf(stderr, "Symbol = '%s', location = %ju,%ju, record->rec_id = %" PRIu64 "\n", symbol->name, (uintmax_t)start[0], (uintmax_t)start[1], record->rec_id);
return -1;
} /* end if */
diff --git a/test/tid.c b/test/tid.c
index d0ae3e4..7a839d2 100644
--- a/test/tid.c
+++ b/test/tid.c
@@ -19,6 +19,13 @@
#define H5I_FRIEND /*suppress error about including H5Ipkg */
#include "H5Ipkg.h"
+static herr_t
+free_wrapper(void *p)
+{
+ HDfree(p);
+ return SUCCEED;
+}
+
/* Test basic functionality of registering and deleting types and IDs */
static int basic_id_test(void)
{
@@ -69,7 +76,7 @@ static int basic_id_test(void)
goto out;
/* Register a type */
- myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free );
+ myType = H5Iregister_type((size_t)64, 0, free_wrapper);
CHECK(myType, H5I_BADID, "H5Iregister_type");
if(myType == H5I_BADID)
@@ -163,7 +170,7 @@ static int basic_id_test(void)
H5E_END_TRY
/* Register another type and another object in that type */
- myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free );
+ myType = H5Iregister_type((size_t)64, 0, free_wrapper);
CHECK(myType, H5I_BADID, "H5Iregister_type");
if(myType == H5I_BADID)
@@ -238,7 +245,7 @@ out:
/* A dummy search function for the next test */
-static int test_search_func(void H5_ATTR_UNUSED * ptr1, void H5_ATTR_UNUSED * ptr2) { return 0; }
+static int test_search_func(void H5_ATTR_UNUSED * ptr1, hid_t H5_ATTR_UNUSED id, void H5_ATTR_UNUSED * ptr2) { return 0; }
/* Ensure that public functions cannot access "predefined" ID types */
static int id_predefined_test(void )
@@ -264,7 +271,7 @@ static int id_predefined_test(void )
goto out;
H5E_BEGIN_TRY
- testPtr = H5Isearch(H5I_GENPROP_LST, (H5I_search_func_t) test_search_func, testObj);
+ testPtr = H5Isearch(H5I_GENPROP_LST, test_search_func, testObj);
H5E_END_TRY
CHECK_PTR_NULL(testPtr, "H5Isearch");
@@ -492,7 +499,7 @@ static int test_id_type_list(void)
H5I_type_t testType;
int i; /* Just a counter variable */
- startType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free );
+ startType = H5Iregister_type((size_t)8, 0, free_wrapper);
CHECK(startType, H5I_BADID, "H5Iregister_type");
if(startType == H5I_BADID)
goto out;
@@ -507,7 +514,7 @@ static int test_id_type_list(void)
/* Create types up to H5I_MAX_NUM_TYPES */
for(i = startType + 1; i < H5I_MAX_NUM_TYPES; i++)
{
- currentType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free );
+ currentType = H5Iregister_type((size_t)8, 0, free_wrapper);
CHECK(currentType, H5I_BADID, "H5Iregister_type");
if(currentType == H5I_BADID)
goto out;
@@ -516,7 +523,7 @@ static int test_id_type_list(void)
/* Wrap around to low type ID numbers */
for(i = H5I_NTYPES; i < startType; i++)
{
- currentType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free );
+ currentType = H5Iregister_type((size_t)8, 0, free_wrapper);
CHECK(currentType, H5I_BADID, "H5Iregister_type");
if(currentType == H5I_BADID)
goto out;
@@ -524,7 +531,7 @@ static int test_id_type_list(void)
/* There should be no room at the inn for a new ID type*/
H5E_BEGIN_TRY
- testType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free );
+ testType = H5Iregister_type((size_t)8, 0, free_wrapper);
H5E_END_TRY
VERIFY(testType, H5I_BADID, "H5Iregister_type");
@@ -533,7 +540,7 @@ static int test_id_type_list(void)
/* Now delete a type and try to insert again */
H5Idestroy_type(H5I_NTYPES);
- testType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free );
+ testType = H5Iregister_type((size_t)8, 0, free_wrapper);
VERIFY(testType, H5I_NTYPES, "H5Iregister_type");
if(testType != H5I_NTYPES)
diff --git a/test/trefer.c b/test/trefer.c
index 7d87ea9..4ffc2dc 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -89,9 +89,9 @@ test_reference_params(void)
H5R_ref_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf; /* temp. buffer read from disk */
+ unsigned *obuf;
H5R_type_t type; /* Reference type */
- unsigned *tu32; /* Temporary pointer to uint32 data */
- int i; /* Counters */
+ unsigned int i; /* Counters */
const char *write_comment = "Foo!"; /* Comments for group */
hid_t ret_id; /* Generic hid_t return value */
ssize_t name_size; /* Size of reference name */
@@ -101,12 +101,13 @@ test_reference_params(void)
MESSAGE(5, ("Testing Reference Parameters\n"));
/* Allocate write & read buffers */
- wbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1);
- rbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1);
- tbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1);
+ wbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ rbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ tbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1);
- for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++ = (unsigned)i * 3;
+ for(i = 0; i < SPACE1_DIM1; i++)
+ obuf[i] = i * 3;
/* Create file */
fid1 = H5Fcreate(FILE_REF_PARAM, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -137,7 +138,7 @@ test_reference_params(void)
CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
/* Write selection to disk */
- ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close Dataset */
@@ -153,7 +154,7 @@ test_reference_params(void)
CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
/* Write attribute to disk */
- ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf);
+ ret = H5Awrite(attr, H5T_NATIVE_UINT, obuf);
CHECK(ret, FAIL, "H5Awrite");
/* Close attribute */
@@ -233,19 +234,19 @@ test_reference_params(void)
VERIFY(type, H5R_BADTYPE, "H5Rget_type ref");
/* Test parameters to H5Requal */
- ret = H5Requal(NULL, (const H5R_ref_t *)&rbuf[0]);
+ ret = H5Requal(NULL, &rbuf[0]);
VERIFY(ret, FAIL, "H5Requal ref1");
- ret = H5Requal((const H5R_ref_t *)&rbuf[0], NULL);
+ ret = H5Requal(&rbuf[0], NULL);
VERIFY(ret, FAIL, "H5Requal ref2");
/* Test parameters to H5Rcopy */
ret = H5Rcopy(NULL, &wbuf[0]);
VERIFY(ret, FAIL, "H5Rcopy src_ref");
- ret = H5Rcopy((const H5R_ref_t *)&rbuf[0], NULL);
+ ret = H5Rcopy(&rbuf[0], NULL);
VERIFY(ret, FAIL, "H5Rcopy dest_ref");
/* Test parameters to H5Ropen_object */
- dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf[0], H5I_INVALID_HID, H5I_INVALID_HID);
+ dset2 = H5Ropen_object(&rbuf[0], H5I_INVALID_HID, H5I_INVALID_HID);
VERIFY(dset2, FAIL, "H5Ropen_object oapl_id");
dset2 = H5Ropen_object(NULL, H5P_DEFAULT, dapl_id);
VERIFY(dset2, FAIL, "H5Ropen_object ref");
@@ -298,6 +299,7 @@ test_reference_params(void)
HDfree(wbuf);
HDfree(rbuf);
HDfree(tbuf);
+ HDfree(obuf);
} /* test_reference_params() */
/****************************************************************
@@ -318,10 +320,9 @@ test_reference_obj(void)
hsize_t dims1[] = {SPACE1_DIM1};
hid_t dapl_id; /* Dataset access property list */
H5R_ref_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temp. buffer read from disk */
- unsigned *tu32; /* Temporary pointer to uint32 data */
- int i, j; /* Counters */
+ *rbuf; /* buffer read from disk */
+ unsigned *ibuf, *obuf;
+ unsigned i, j; /* Counters */
H5O_type_t obj_type; /* Object type */
herr_t ret; /* Generic return value */
@@ -329,12 +330,13 @@ test_reference_obj(void)
MESSAGE(5, ("Testing Object Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1);
- rbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1);
- tbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1);
+ wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ rbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ ibuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1);
+ obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1);
- for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++ = (unsigned)i * 3;
+ for (i = 0; i < SPACE1_DIM1; i++)
+ obuf[i] = i * 3;
/* Create file */
fid1 = H5Fcreate(FILE_REF_OBJ, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -357,7 +359,7 @@ test_reference_obj(void)
CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
/* Write selection to disk */
- ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close Dataset */
@@ -405,28 +407,28 @@ test_reference_obj(void)
/* Create reference to dataset */
ret = H5Rcreate_object(fid1, "/Group1/Dataset1", &wbuf[0]);
CHECK(ret, FAIL, "H5Rcreate_object");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
/* Create reference to dataset */
ret = H5Rcreate_object(fid1, "/Group1/Dataset2", &wbuf[1]);
CHECK(ret, FAIL, "H5Rcreate_object");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[1], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&wbuf[1], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
/* Create reference to group */
ret = H5Rcreate_object(fid1, "/Group1", &wbuf[2]);
CHECK(ret, FAIL, "H5Rcreate_object");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[2], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&wbuf[2], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3");
/* Create reference to named datatype */
ret = H5Rcreate_object(fid1, "/Group1/Datatype1", &wbuf[3]);
CHECK(ret, FAIL, "H5Rcreate_object");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[3], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&wbuf[3], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3");
@@ -459,7 +461,7 @@ test_reference_obj(void)
CHECK(ret, FAIL, "H5Dread");
/* Open dataset object */
- dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, dapl_id);
+ dset2 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id);
CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object");
/* Check information in referenced dataset */
@@ -470,18 +472,18 @@ test_reference_obj(void)
VERIFY(ret, SPACE1_DIM1, "H5Sget_simple_extent_npoints");
/* Read from disk */
- ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, tbuf);
+ ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf);
CHECK(ret, FAIL, "H5Dread");
- for(tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
- VERIFY(*tu32, (uint32_t)(i*3), "Data");
+ for(i = 0; i < SPACE1_DIM1; i++)
+ VERIFY(ibuf[i], i * 3, "Data");
/* Close dereferenced Dataset */
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
/* Open group object. GAPL isn't supported yet. But it's harmless to pass in */
- group = H5Ropen_object((const H5R_ref_t *)&rbuf[2], H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Ropen_object(&rbuf[2], H5P_DEFAULT, H5P_DEFAULT);
CHECK(group, H5I_INVALID_HID, "H5Ropen_object");
/* Close group */
@@ -489,7 +491,7 @@ test_reference_obj(void)
CHECK(ret, FAIL, "H5Gclose");
/* Open datatype object. TAPL isn't supported yet. But it's harmless to pass in */
- tid1 = H5Ropen_object((const H5R_ref_t *)&rbuf[3], H5P_DEFAULT, H5P_DEFAULT);
+ tid1 = H5Ropen_object(&rbuf[3], H5P_DEFAULT, H5P_DEFAULT);
CHECK(tid1, H5I_INVALID_HID, "H5Ropen_object");
/* Verify correct datatype */
@@ -530,7 +532,8 @@ test_reference_obj(void)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
- HDfree(tbuf);
+ HDfree(ibuf);
+ HDfree(obuf);
} /* test_reference_obj() */
/****************************************************************
@@ -565,7 +568,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
hsize_t high[SPACE2_RANK]; /* Selection bounds */
H5R_ref_t *wbuf, /* buffer to write to disk */
*rbuf; /* buffer read from disk */
- H5R_ref_t nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */
+ H5R_ref_t nvrbuf[3]={{{0}},{{101}},{{255}}}; /* buffer with non-valid refs */
uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
*drbuf; /* Buffer for reading numeric data from disk */
uint8_t *tu8; /* Temporary pointer to uint8 data */
@@ -583,8 +586,8 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
MESSAGE(5, ("Testing Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
- rbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ rbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
dwbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
@@ -647,7 +650,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
/* Store first dataset region */
ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[0]);
CHECK(ret, FAIL, "H5Rcreate_region");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
@@ -691,7 +694,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[2]);
CHECK(ret, FAIL, "H5Rcreate_region");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[2], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&wbuf[2], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
@@ -764,7 +767,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
* Dereference an undefined reference (should fail)
*/
H5E_BEGIN_TRY {
- dset2 = H5Ropen_object((const H5R_ref_t *)&rdata_NA[0], H5P_DEFAULT, H5P_DEFAULT);
+ dset2 = H5Ropen_object(&rdata_NA[0], H5P_DEFAULT, H5P_DEFAULT);
} H5E_END_TRY;
VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object");
@@ -798,11 +801,11 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Dread");
/* Try to open objects */
- dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, dapl_id);
+ dset2 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id);
CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object");
/* Check what H5Rget_obj_type3 function returns */
- ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&rbuf[0], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
@@ -821,7 +824,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
VERIFY(*tu8, (uint8_t)(i * 3), "Data");
/* Get the hyperslab selection */
- sid2 = H5Ropen_region((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, H5P_DEFAULT);
+ sid2 = H5Ropen_region(&rbuf[0], H5P_DEFAULT, H5P_DEFAULT);
CHECK(sid2, H5I_INVALID_HID, "H5Ropen_region");
/* Verify correct hyperslab selected */
@@ -849,7 +852,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Sclose");
/* Get the element selection */
- sid2 = H5Ropen_region((const H5R_ref_t *)&rbuf[1], H5P_DEFAULT, H5P_DEFAULT);
+ sid2 = H5Ropen_region(&rbuf[1], H5P_DEFAULT, H5P_DEFAULT);
CHECK(sid2, H5I_INVALID_HID, "H5Ropen_region");
/* Verify correct elements selected */
@@ -893,7 +896,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Sclose");
/* Get the unlimited selection */
- sid2 = H5Ropen_region((const H5R_ref_t *)&rbuf[2], H5P_DEFAULT, H5P_DEFAULT);
+ sid2 = H5Ropen_region(&rbuf[2], H5P_DEFAULT, H5P_DEFAULT);
CHECK(sid2, H5I_INVALID_HID, "H5Ropen_region");
/* Verify correct hyperslab selected */
@@ -928,7 +931,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
/* Attempting to retrieve type of object using non-valid refs */
for(j = 0; j < 3; j++) {
H5E_BEGIN_TRY {
- ret = H5Rget_obj_type3((const H5R_ref_t *)&nvrbuf[j], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&nvrbuf[j], H5P_DEFAULT, &obj_type);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Rget_obj_type3");
} /* end for */
@@ -1006,8 +1009,8 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1);
- rbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1);
+ wbuf = HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1);
+ rbuf = HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1);
dwbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
@@ -1070,7 +1073,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
/* Store first dataset region */
ret = H5Rcreate_region(fid1, "/Dataset2", sid3, &wbuf[0]);
CHECK(ret, FAIL, "H5Rcreate_region");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
@@ -1128,11 +1131,11 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Dread");
/* Try to open objects */
- dset3 = H5Ropen_object((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, dapl_id);
+ dset3 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id);
CHECK(dset3, H5I_INVALID_HID, "H5Ropen_object");
/* Check what H5Rget_obj_type3 function returns */
- ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&rbuf[0], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
@@ -1151,7 +1154,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
VERIFY(*tu8, (uint8_t)(i * 3), "Data");
/* Get the hyperslab selection */
- sid3 = H5Ropen_region((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, H5P_DEFAULT);
+ sid3 = H5Ropen_region(&rbuf[0], H5P_DEFAULT, H5P_DEFAULT);
CHECK(sid3, H5I_INVALID_HID, "H5Ropen_region");
/* Verify correct hyperslab selected */
@@ -1203,7 +1206,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Sclose");
/* Get the element selection */
- sid3 = H5Ropen_region((const H5R_ref_t *)&rbuf[1], H5P_DEFAULT, H5P_DEFAULT);
+ sid3 = H5Ropen_region(&rbuf[1], H5P_DEFAULT, H5P_DEFAULT);
CHECK(sid3, H5I_INVALID_HID, "H5Ropen_region");
/* Verify correct elements selected */
@@ -1313,7 +1316,7 @@ test_reference_obj_deleted(void)
/* Create reference to dataset */
ret = H5Rcreate_object(fid1, "/Dataset1", &oref);
CHECK(ret, FAIL, "H5Rcreate_object");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&oref, H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&oref, H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
@@ -1354,7 +1357,7 @@ test_reference_obj_deleted(void)
CHECK(ret, FAIL, "H5Dread");
/* Open deleted dataset object */
- dset2 = H5Ropen_object((const H5R_ref_t *)&oref, H5P_DEFAULT, H5P_DEFAULT);
+ dset2 = H5Ropen_object(&oref, H5P_DEFAULT, H5P_DEFAULT);
VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object");
/* Close Dataset */
@@ -1501,7 +1504,7 @@ test_reference_group(void)
CHECK(ret, FAIL, "H5Dread");
/* Dereference to get the group */
- gid = H5Ropen_object((const H5R_ref_t *)&rref, H5P_DEFAULT, H5P_DEFAULT);
+ gid = H5Ropen_object(&rref, H5P_DEFAULT, H5P_DEFAULT);
CHECK(gid, H5I_INVALID_HID, "H5Ropen_object");
/* Iterate through objects in dereferenced group */
@@ -1562,8 +1565,7 @@ test_reference_attr(void)
H5R_ref_t ref_wbuf[SPACE1_DIM1], /* Buffer to write to disk */
ref_rbuf[SPACE1_DIM1]; /* Buffer read from disk */
unsigned wbuf[SPACE1_DIM1], rbuf[SPACE1_DIM1];
- unsigned *tu32; /* Temporary pointer to uint32 data */
- int i; /* Local index variables */
+ unsigned i; /* Local index variables */
H5O_type_t obj_type; /* Object type */
herr_t ret; /* Generic return value */
@@ -1590,8 +1592,8 @@ test_reference_attr(void)
attr = H5Acreate2(group, "Attr2", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
- for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++ = (unsigned)((i * 3) + 1);
+ for(i = 0; i < SPACE1_DIM1; i++)
+ wbuf[i] = (i * 3) + 1;
/* Write attribute to disk */
ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf);
@@ -1609,8 +1611,8 @@ test_reference_attr(void)
attr = H5Acreate2(dataset, "Attr1", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
- for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++ = (unsigned)(i * 3);
+ for(i = 0; i < SPACE1_DIM1; i++)
+ wbuf[i] = i * 3;
/* Write attribute to disk */
ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf);
@@ -1654,8 +1656,8 @@ test_reference_attr(void)
attr = H5Acreate2(tid, "Attr3", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
- for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++ = (unsigned)((i * 3) + 2);
+ for(i = 0; i < SPACE1_DIM1; i++)
+ wbuf[i] = (i * 3) + 2;
/* Write attribute to disk */
ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf);
@@ -1680,28 +1682,28 @@ test_reference_attr(void)
/* Create reference to dataset1 attribute */
ret = H5Rcreate_attr(fid, "/Group1/Dataset1", "Attr1", &ref_wbuf[0]);
CHECK(ret, FAIL, "H5Rcreate_attr");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[0], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&ref_wbuf[0], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
/* Create reference to dataset2 attribute */
ret = H5Rcreate_attr(fid, "/Group1/Dataset2", "Attr1", &ref_wbuf[1]);
CHECK(ret, FAIL, "H5Rcreate_attr");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[1], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&ref_wbuf[1], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
/* Create reference to group attribute */
ret = H5Rcreate_attr(fid, "/Group1", "Attr2", &ref_wbuf[2]);
CHECK(ret, FAIL, "H5Rcreate_attr");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[2], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&ref_wbuf[2], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3");
/* Create reference to named datatype attribute */
ret = H5Rcreate_attr(fid, "/Group1/Datatype1", "Attr3", &ref_wbuf[3]);
CHECK(ret, FAIL, "H5Rcreate_attr");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[3], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&ref_wbuf[3], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3");
@@ -1734,7 +1736,7 @@ test_reference_attr(void)
CHECK(ret, FAIL, "H5Dread");
/* Open attribute on dataset object */
- attr = H5Ropen_attr((const H5R_ref_t *)&ref_rbuf[0], H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Ropen_attr(&ref_rbuf[0], H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr");
/* Check information in referenced dataset */
@@ -1748,38 +1750,38 @@ test_reference_attr(void)
ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
CHECK(ret, FAIL, "H5Aread");
- for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
- VERIFY(*tu32, (uint32_t)(i * 3), "Data");
+ for(i = 0; i < SPACE1_DIM1; i++)
+ VERIFY(rbuf[i], i * 3, "Data");
/* Close dereferenced Dataset */
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
/* Open attribute on group object */
- attr = H5Ropen_attr((const H5R_ref_t *)&ref_rbuf[2], H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Ropen_attr(&ref_rbuf[2], H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr");
/* Read from disk */
ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
CHECK(ret, FAIL, "H5Aread");
- for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
- VERIFY(*tu32, (uint32_t)((i * 3) + 1), "Data");
+ for(i = 0; i < SPACE1_DIM1; i++)
+ VERIFY(rbuf[i], (i * 3) + 1, "Data");
/* Close attribute */
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
/* Open attribute on named datatype object */
- attr = H5Ropen_attr((const H5R_ref_t *)&ref_rbuf[3], H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Ropen_attr(&ref_rbuf[3], H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr");
/* Read from disk */
ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
CHECK(ret, FAIL, "H5Aread");
- for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
- VERIFY(*tu32, (uint32_t)((i * 3) + 2), "Data");
+ for(i = 0; i < SPACE1_DIM1; i++)
+ VERIFY(rbuf[i], (i * 3) + 2, "Data");
/* Close attribute */
ret = H5Aclose(attr);
@@ -1826,8 +1828,7 @@ test_reference_external(void)
H5R_ref_t ref_wbuf[SPACE1_DIM1], /* Buffer to write to disk */
ref_rbuf[SPACE1_DIM1]; /* Buffer read from disk */
unsigned wbuf[SPACE1_DIM1], rbuf[SPACE1_DIM1];
- unsigned *tu32; /* Temporary pointer to uint32 data */
- int i; /* Local index variables */
+ unsigned i; /* Local index variables */
H5O_type_t obj_type; /* Object type */
herr_t ret; /* Generic return value */
@@ -1854,8 +1855,8 @@ test_reference_external(void)
attr = H5Acreate2(group, "Attr2", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
- for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++ = (unsigned)((i * 3) + 1);
+ for(i = 0; i < SPACE1_DIM1; i++)
+ wbuf[i] = (i * 3) + 1;
/* Write attribute to disk */
ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf);
@@ -1873,8 +1874,8 @@ test_reference_external(void)
attr = H5Acreate2(dataset, "Attr1", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
- for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++ = (unsigned)(i * 3);
+ for(i = 0; i < SPACE1_DIM1; i++)
+ wbuf[i] = i * 3;
/* Write attribute to disk */
ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf);
@@ -1918,8 +1919,8 @@ test_reference_external(void)
attr = H5Acreate2(tid, "Attr3", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
- for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++ = (unsigned)((i * 3) + 2);
+ for(i = 0; i < SPACE1_DIM1; i++)
+ wbuf[i] = (i * 3) + 2;
/* Write attribute to disk */
ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf);
@@ -1940,28 +1941,28 @@ test_reference_external(void)
/* Create reference to dataset1 attribute */
ret = H5Rcreate_attr(fid1, "/Group1/Dataset1", "Attr1", &ref_wbuf[0]);
CHECK(ret, FAIL, "H5Rcreate_attr");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[0], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&ref_wbuf[0], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
/* Create reference to dataset2 attribute */
ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr1", &ref_wbuf[1]);
CHECK(ret, FAIL, "H5Rcreate_attr");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[1], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&ref_wbuf[1], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
/* Create reference to group attribute */
ret = H5Rcreate_attr(fid1, "/Group1", "Attr2", &ref_wbuf[2]);
CHECK(ret, FAIL, "H5Rcreate_attr");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[2], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&ref_wbuf[2], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3");
/* Create reference to named datatype attribute */
ret = H5Rcreate_attr(fid1, "/Group1/Datatype1", "Attr3", &ref_wbuf[3]);
CHECK(ret, FAIL, "H5Rcreate_attr");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[3], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&ref_wbuf[3], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3");
@@ -2014,7 +2015,7 @@ test_reference_external(void)
CHECK(ret, FAIL, "H5Dread");
/* Open attribute on dataset object */
- attr = H5Ropen_attr((const H5R_ref_t *)&ref_rbuf[0], H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Ropen_attr(&ref_rbuf[0], H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr");
/* Check information in referenced dataset */
@@ -2028,38 +2029,38 @@ test_reference_external(void)
ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
CHECK(ret, FAIL, "H5Aread");
- for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
- VERIFY(*tu32, (uint32_t)(i * 3), "Data");
+ for(i = 0; i < SPACE1_DIM1; i++)
+ VERIFY(rbuf[i], i * 3, "Data");
/* Close dereferenced Dataset */
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
/* Open attribute on group object */
- attr = H5Ropen_attr((const H5R_ref_t *)&ref_rbuf[2], H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Ropen_attr(&ref_rbuf[2], H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr");
/* Read from disk */
ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
CHECK(ret, FAIL, "H5Aread");
- for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
- VERIFY(*tu32, (uint32_t)((i * 3) + 1), "Data");
+ for(i = 0; i < SPACE1_DIM1; i++)
+ VERIFY(rbuf[i], (i * 3) + 1, "Data");
/* Close attribute */
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
/* Open attribute on named datatype object */
- attr = H5Ropen_attr((const H5R_ref_t *)&ref_rbuf[3], H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Ropen_attr(&ref_rbuf[3], H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr");
/* Read from disk */
ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
CHECK(ret, FAIL, "H5Aread");
- for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
- VERIFY(*tu32, (uint32_t)((i * 3) + 2), "Data");
+ for(i = 0; i < SPACE1_DIM1; i++)
+ VERIFY(rbuf[i], (i * 3) + 2, "Data");
/* Close attribute */
ret = H5Aclose(attr);
@@ -2121,9 +2122,9 @@ test_reference_compat_conv(void)
/* Allocate write & read buffers */
wbuf_obj = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
- rbuf_obj = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ rbuf_obj = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
wbuf_reg = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), 2);
- rbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), 2);
+ rbuf_reg = HDcalloc(sizeof(H5R_ref_t), 2);
/* Create file */
fid1 = H5Fcreate(FILE_REF_COMPAT, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2286,43 +2287,43 @@ test_reference_compat_conv(void)
CHECK(ret, FAIL, "H5Dread");
/* Verify type of objects pointed at */
- ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf_obj[0], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&rbuf_obj[0], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf_obj[1], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&rbuf_obj[1], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf_obj[2], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&rbuf_obj[2], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf_obj[3], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&rbuf_obj[3], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3");
/* Make sure the referenced objects can be opened */
- dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf_obj[0], H5P_DEFAULT, H5P_DEFAULT);
+ dset2 = H5Ropen_object(&rbuf_obj[0], H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object");
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
- dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf_obj[1], H5P_DEFAULT, H5P_DEFAULT);
+ dset2 = H5Ropen_object(&rbuf_obj[1], H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object");
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
- group2 = H5Ropen_object((const H5R_ref_t *)&rbuf_obj[2], H5P_DEFAULT, H5P_DEFAULT);
+ group2 = H5Ropen_object(&rbuf_obj[2], H5P_DEFAULT, H5P_DEFAULT);
CHECK(group2, H5I_INVALID_HID, "H5Ropen_object");
ret = H5Gclose(group2);
CHECK(ret, FAIL, "H5Gclose");
- tid2 = H5Ropen_object((const H5R_ref_t *)&rbuf_obj[3], H5P_DEFAULT, H5P_DEFAULT);
+ tid2 = H5Ropen_object(&rbuf_obj[3], H5P_DEFAULT, H5P_DEFAULT);
CHECK(tid2, H5I_INVALID_HID, "H5Ropen_object");
ret = H5Tclose(tid2);
@@ -2342,22 +2343,22 @@ test_reference_compat_conv(void)
CHECK(ret, FAIL, "H5Dread");
/* Verify type of objects pointed at */
- ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf_reg[0], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&rbuf_reg[0], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf_reg[1], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&rbuf_reg[1], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
/* Make sure the referenced objects can be opened */
- dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf_reg[0], H5P_DEFAULT, H5P_DEFAULT);
+ dset2 = H5Ropen_object(&rbuf_reg[0], H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object");
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
- dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf_reg[1], H5P_DEFAULT, H5P_DEFAULT);
+ dset2 = H5Ropen_object(&rbuf_reg[1], H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object");
ret = H5Dclose(dset2);
@@ -2414,8 +2415,8 @@ test_reference_perf(void)
*rbuf_deprec;/* deprecated references */
hdset_reg_ref_t *wbuf_reg_deprec, /* deprecated references*/
*rbuf_reg_deprec; /* deprecated references*/
- unsigned *tu32; /* Temporary pointer to uint32 data */
- int i, j; /* Counters */
+ unsigned *ibuf, *obuf;
+ unsigned i, j; /* Counters */
H5O_type_t obj_type; /* Object type */
herr_t ret; /* Generic return value */
double t1, t2, t; /* Timers */
@@ -2424,18 +2425,20 @@ test_reference_perf(void)
MESSAGE(5, ("Testing Object Reference Performance\n"));
/* Allocate write & read buffers */
- wbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1);
- wbuf_deprec = (hobj_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)), SPACE1_DIM1);
- rbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1);
- rbuf_deprec = (hobj_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)), SPACE1_DIM1);
- tbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1);
- wbuf_reg = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1);
- rbuf_reg = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1);
- wbuf_reg_deprec = (hdset_reg_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(hdset_reg_ref_t)), SPACE1_DIM1);
- rbuf_reg_deprec = (hdset_reg_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(hdset_reg_ref_t)), SPACE1_DIM1);
-
- for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++ = (unsigned)i * 3;
+ wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1);
+ ibuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1);
+ wbuf_deprec = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
+ rbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ rbuf_deprec = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
+ tbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ wbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ rbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ wbuf_reg_deprec = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ rbuf_reg_deprec = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+
+ for(i = 0; i < SPACE1_DIM1; i++)
+ obuf[i] = i * 3;
/* Create file */
fid1 = H5Fcreate(FILE_REF_OBJ, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2458,7 +2461,7 @@ test_reference_perf(void)
CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
/* Write selection to disk */
- ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close Dataset */
@@ -2518,7 +2521,7 @@ test_reference_perf(void)
/* Create reference to dataset */
ret = H5Rcreate_object(fid1, "/Group1/Dataset1", &wbuf[0]);
CHECK(ret, FAIL, "H5Rcreate_object");
- ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type);
+ ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type);
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
@@ -2670,7 +2673,7 @@ test_reference_perf(void)
CHECK(ret, FAIL, "H5Dread");
/* Open dataset object */
- dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, dapl_id);
+ dset2 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id);
CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object");
/* Check information in referenced dataset */
@@ -2681,11 +2684,11 @@ test_reference_perf(void)
VERIFY(ret, dims1[0], "H5Sget_simple_extent_npoints");
/* Read from disk */
- ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, tbuf);
+ ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf);
CHECK(ret, FAIL, "H5Dread");
- for(tu32 = (unsigned *)tbuf, i = 0; i < (int)dims1[0]; i++, tu32++)
- VERIFY(*tu32, (uint32_t)(i*3), "Data");
+ for(i = 0; i < dims1[0]; i++)
+ VERIFY(ibuf[i], i * 3, "Data");
/* Close dereferenced Dataset */
ret = H5Dclose(dset2);
@@ -2767,7 +2770,7 @@ test_reference_perf(void)
CHECK(ret, FAIL, "H5Fclose");
/* Destroy references */
- for(j = 0; j < (int)dims1[0]; j++) {
+ for(j = 0; j < dims1[0]; j++) {
ret = H5Rdestroy(&wbuf[j]);
CHECK(ret, FAIL, "H5Rdestroy");
ret = H5Rdestroy(&wbuf_reg[j]);
@@ -2788,6 +2791,8 @@ test_reference_perf(void)
HDfree(wbuf_reg_deprec);
HDfree(rbuf_reg_deprec);
HDfree(tbuf);
+ HDfree(ibuf);
+ HDfree(obuf);
} /* test_reference_perf() */
/****************************************************************
diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c
index 949f41b..1b77e9c 100644
--- a/test/trefer_deprec.c
+++ b/test/trefer_deprec.c
@@ -517,7 +517,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
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 */
+ 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 */
diff --git a/test/tvlstr.c b/test/tvlstr.c
index 731270c..cc01084 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -861,12 +861,12 @@ static void test_write_same_element(void)
hid_t file1, dataset1;
hid_t mspace, fspace, dtype;
hsize_t fdim[] = {SPACE1_DIM1};
- char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"};
+ const char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"};
hsize_t marray[] = {NUMP};
hsize_t coord[SPACE1_RANK][NUMP];
herr_t ret;
- char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."};
+ const char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."};
file1 = H5Fcreate(DATAFILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(file1, FAIL, "H5Fcreate");
diff --git a/test/vds_swmr.h b/test/vds_swmr.h
index eb2dcf4..18d6b35 100644
--- a/test/vds_swmr.h
+++ b/test/vds_swmr.h
@@ -84,31 +84,17 @@
#define N_PLANES_TO_WRITE 25
/* Planes */
-static hsize_t PLANES[N_SOURCES][RANK] = {
- {1, SM_HEIGHT, WIDTH},
- {1, LG_HEIGHT, WIDTH},
- {1, SM_HEIGHT, WIDTH},
- {1, LG_HEIGHT, WIDTH},
- {1, SM_HEIGHT, WIDTH},
- {1, LG_HEIGHT, WIDTH}
-};
+extern hsize_t PLANES[N_SOURCES][RANK];
/* File names for source datasets */
-static char FILE_NAMES[N_SOURCES][NAME_LEN] = {
- {"vds_swmr_src_a.h5"},
- {"vds_swmr_src_b.h5"},
- {"vds_swmr_src_c.h5"},
- {"vds_swmr_src_d.h5"},
- {"vds_swmr_src_e.h5"},
- {"vds_swmr_src_f.h5"}
-};
+extern char FILE_NAMES[N_SOURCES][NAME_LEN];
/* VDS file name */
-static char VDS_FILE_NAME[NAME_LEN] = "vds_swmr.h5";
+extern char VDS_FILE_NAME[NAME_LEN];
/* Dataset names */
-static char SOURCE_DSET_PATH[NAME_LEN] = "/source_dset";
-static char VDS_DSET_NAME[NAME_LEN] = "vds_dset";
+extern char SOURCE_DSET_PATH[NAME_LEN];
+extern char VDS_DSET_NAME[NAME_LEN];
/* Fill values */
#endif /* VDS_SWMR_H */
diff --git a/test/vds_swmr_common.c b/test/vds_swmr_common.c
new file mode 100644
index 0000000..d2b4bd6
--- /dev/null
+++ b/test/vds_swmr_common.c
@@ -0,0 +1,36 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "vds_swmr.h"
+
+hsize_t PLANES[N_SOURCES][RANK] = {
+ {1, SM_HEIGHT, WIDTH},
+ {1, LG_HEIGHT, WIDTH},
+ {1, SM_HEIGHT, WIDTH},
+ {1, LG_HEIGHT, WIDTH},
+ {1, SM_HEIGHT, WIDTH},
+ {1, LG_HEIGHT, WIDTH}
+};
+
+char FILE_NAMES[N_SOURCES][NAME_LEN] = {
+ {"vds_swmr_src_a.h5"},
+ {"vds_swmr_src_b.h5"},
+ {"vds_swmr_src_c.h5"},
+ {"vds_swmr_src_d.h5"},
+ {"vds_swmr_src_e.h5"},
+ {"vds_swmr_src_f.h5"}
+};
+
+char VDS_FILE_NAME[NAME_LEN] = "vds_swmr.h5";
+char SOURCE_DSET_PATH[NAME_LEN] = "/source_dset";
+char VDS_DSET_NAME[NAME_LEN] = "vds_dset";
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index c2153e5..1b4bc56 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -258,6 +258,8 @@ free_exclude_path_list(diff_opt_t *opts)
* Parameter:
* table_out [OUT] : return the list
*------------------------------------------------------------------------*/
+#pragma GCC diagnostic push
+#pragma GCC diagnostic warning "-Wunused-but-set-variable"
static void
build_match_list (const char *objname1, trav_info_t *info1, const char *objname2, trav_info_t *info2,
trav_table_t ** table_out, diff_opt_t *opts)
@@ -374,6 +376,7 @@ done:
*table_out = table;
h5difftrace("build_match_list finish\n");
}
+#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 2a45913..55ad65c 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -2245,6 +2245,9 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u,
*-------------------------------------------------------------------------
*/
+#pragma GCC diagnostic push
+#pragma GCC diagnostic warning "-Wunused-but-set-variable"
+
static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
hsize_t i, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2, int *ph)
{
@@ -2305,6 +2308,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
return nfound;
}
+#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------
* Function: diff_float
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 47ce690..6fc9de4 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -1279,7 +1279,7 @@ done:
int
h5tools_set_configured_fapl(hid_t fapl_id,
const char vfd_name[],
- void *fapl_t_ptr)
+ void *fapl_t_ptr H5_ATTR_UNUSED)
{
int ret_value = 1;
diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c
index 1eef5ab..65c2359 100644
--- a/tools/src/h5import/h5import.c
+++ b/tools/src/h5import/h5import.c
@@ -1428,7 +1428,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
/* Initialize machine endian */
volatile uint32_t ibyte=0x01234567;
/* 0 for big endian, 1 for little endian. */
- if ((*((uint8_t*)(&ibyte))) == 0x67) {
+ if ((*((volatile uint8_t*)(&ibyte))) == 0x67) {
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
(void) HDfprintf(stderr, "%s", err11e);
return (-1);
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index c628beb..16899a3 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -281,7 +281,7 @@ int read_info(const char *filename, pack_opt_t *options)
char comp_info[1024];
FILE *fp = NULL;
char c;
- int i, rc = 1;
+ int i;
int ret_value = EXIT_SUCCESS;
if (NULL == (fp = HDfopen(filename, "r"))) {
@@ -412,7 +412,7 @@ set_sort_order(const char *form)
static
int parse_command_line(int argc, const char **argv, pack_opt_t* options)
{
- int opt;
+ int bound, opt;
int ret_value = 0;
/* parse command line options */
@@ -492,19 +492,21 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'j':
- options->low_bound = (H5F_libver_t)HDatoi(opt_arg);
- if (options->low_bound < H5F_LIBVER_EARLIEST || options->low_bound > H5F_LIBVER_LATEST) {
+ bound = HDatoi(opt_arg);
+ if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) {
error_msg("in parsing low bound\n");
goto done;
}
+ options->low_bound = bound;
break;
case 'k':
- options->high_bound = (H5F_libver_t)HDatoi(opt_arg);
- if (options->high_bound < H5F_LIBVER_EARLIEST || options->high_bound > H5F_LIBVER_LATEST) {
+ bound = HDatoi(opt_arg);
+ if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) {
error_msg("in parsing high bound\n");
goto done;
}
+ options->high_bound = bound;
break;
case 'c':
diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c
index aaac285..87ca31c 100644
--- a/tools/test/h5repack/h5repackgentest.c
+++ b/tools/test/h5repack/h5repackgentest.c
@@ -314,7 +314,6 @@ generate_f32le(hbool_t external) {
int
main(void) {
int i = 0;
- int ret_value = 0;
for (i = 0; i < 2; i++) {
hbool_t external = (i & 1) ? TRUE : FALSE;