summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2012-08-21 19:45:36 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2012-08-21 19:45:36 (GMT)
commit18d574106c5eaeb7addd6fa6b28d5197cedce992 (patch)
tree71b66031947de38674867f1826f60a8c872eb1d8
parent60d3b3091764c2ec9bede45aeacb6b2da1fa22d8 (diff)
parente53af0ed745a7bec1795681c473ba54025814fd5 (diff)
downloadhdf5-18d574106c5eaeb7addd6fa6b28d5197cedce992.zip
hdf5-18d574106c5eaeb7addd6fa6b28d5197cedce992.tar.gz
hdf5-18d574106c5eaeb7addd6fa6b28d5197cedce992.tar.bz2
[svn-r22704] merge from trunk up to 22703.
-rw-r--r--CMakeLists.txt22
-rw-r--r--MANIFEST1
-rw-r--r--README.txt2
-rw-r--r--c++/src/Makefile.in2
-rw-r--r--config/cmake/FindHDF5.cmake.in11
-rw-r--r--config/lt_vers.am2
-rwxr-xr-xconfigure24
-rw-r--r--configure.in2
-rw-r--r--fortran/src/Makefile.in2
-rw-r--r--hl/c++/src/Makefile.in2
-rw-r--r--hl/fortran/src/Makefile.in2
-rw-r--r--hl/src/H5IM.c4
-rw-r--r--hl/src/Makefile.in2
-rw-r--r--hl/test/test_image.c7
-rw-r--r--release_docs/RELEASE.txt5
-rw-r--r--src/H5ACprivate.h2
-rw-r--r--src/H5C.c468
-rw-r--r--src/H5Cpkg.h19
-rw-r--r--src/H5Cprivate.h27
-rw-r--r--src/H5Dchunk.c4
-rw-r--r--src/H5Doh.c2
-rw-r--r--src/H5Eint.c10
-rw-r--r--src/H5FD.c142
-rw-r--r--src/H5FDcore.c12
-rw-r--r--src/H5FDdirect.c2
-rw-r--r--src/H5FDfamily.c121
-rw-r--r--src/H5FDlog.c2
-rw-r--r--src/H5FDmpi.c19
-rw-r--r--src/H5FDmpio.c200
-rw-r--r--src/H5FDmpiposix.c1088
-rw-r--r--src/H5FDmpiposix.h9
-rw-r--r--src/H5FDmulti.c407
-rw-r--r--src/H5FDprivate.h2
-rw-r--r--src/H5FDsec2.c2
-rw-r--r--src/H5FDstdio.c2
-rw-r--r--src/H5FS.c129
-rw-r--r--src/H5FScache.c33
-rw-r--r--src/H5FSprivate.h2
-rw-r--r--src/H5FSsection.c117
-rw-r--r--src/H5Fint.c13
-rw-r--r--src/H5Fsuper.c2
-rw-r--r--src/H5Fsuper_cache.c44
-rw-r--r--src/H5HF.c14
-rw-r--r--src/H5HFman.c38
-rw-r--r--src/H5HFpkg.h2
-rw-r--r--src/H5HFsection.c12
-rw-r--r--src/H5HFtiny.c162
-rw-r--r--src/H5HG.c2
-rw-r--r--src/H5MF.c154
-rw-r--r--src/H5MFaggr.c161
-rw-r--r--src/H5MFpkg.h1
-rw-r--r--src/H5MFprivate.h1
-rw-r--r--src/H5MFsection.c4
-rw-r--r--src/H5Ocopy.c21
-rw-r--r--src/H5Otest.c2
-rw-r--r--src/H5P.c11
-rw-r--r--src/H5Pacpl.c1
-rw-r--r--src/H5Pdapl.c8
-rw-r--r--src/H5Pdcpl.c3
-rw-r--r--src/H5Pdxpl.c506
-rw-r--r--src/H5Pfapl.c355
-rw-r--r--src/H5Pfcpl.c1
-rw-r--r--src/H5Pfmpl.c1
-rw-r--r--src/H5Pgcpl.c1
-rw-r--r--src/H5Pint.c102
-rw-r--r--src/H5Plapl.c43
-rw-r--r--src/H5Plcpl.c3
-rw-r--r--src/H5Pocpl.c7
-rw-r--r--src/H5Pocpypl.c7
-rw-r--r--src/H5Ppkg.h30
-rw-r--r--src/H5Pprivate.h24
-rw-r--r--src/H5Pstrcpl.c1
-rw-r--r--src/H5Shyper.c2
-rw-r--r--src/H5Spoint.c2
-rw-r--r--src/H5Sselect.c2
-rw-r--r--src/H5Tarray.c3
-rw-r--r--src/H5Zscaleoffset.c6
-rw-r--r--src/H5public.h4
-rw-r--r--src/H5trace.c1
-rw-r--r--src/Makefile.in2
-rw-r--r--test/accum.c18
-rw-r--r--test/cache.c4
-rw-r--r--test/cache_common.c2
-rw-r--r--test/cache_tagging.c26
-rw-r--r--test/dsets.c14
-rw-r--r--test/dt_arith.c6
-rw-r--r--test/dtypes.c35
-rw-r--r--test/file_image.c26
-rw-r--r--test/freespace.c2
-rw-r--r--test/h5test.c4
-rw-r--r--test/mf.c401
-rw-r--r--test/ntypes.c1
-rw-r--r--test/objcopy.c2
-rw-r--r--test/tfile.c12
-rw-r--r--test/tsohm.c8
-rw-r--r--test/tunicode.c2
-rw-r--r--testpar/t_dset.c6
-rw-r--r--testpar/testphdf5.c20
-rw-r--r--tools/h5diff/CMakeLists.txt7
-rw-r--r--tools/h5diff/h5diffgentest.c17
-rw-r--r--tools/h5diff/testfiles/h5diff_59.txt11
-rw-r--r--tools/h5diff/testfiles/h5diff_dtypes.h5bin10776 -> 11416 bytes
-rwxr-xr-xtools/h5diff/testh5diff.sh5
-rw-r--r--tools/h5dump/CMakeLists.txt52
-rw-r--r--tools/h5dump/testh5dump.sh.in57
-rw-r--r--tools/h5import/CMakeLists.txt4
-rw-r--r--tools/h5repack/h5repack_copy.c2
-rw-r--r--tools/h5repack/h5repack_opttable.c2
-rw-r--r--tools/lib/CMakeLists.txt1
-rw-r--r--tools/lib/h5diff.c329
-rw-r--r--tools/lib/h5diff.h31
-rw-r--r--tools/lib/h5diff_array.c45
-rw-r--r--tools/lib/h5diff_attr.c8
-rw-r--r--tools/lib/h5diff_dset.c35
-rw-r--r--tools/lib/h5diff_util.c42
-rw-r--r--tools/lib/h5tools.c251
-rw-r--r--tools/lib/h5tools_utils.c2
-rw-r--r--tools/lib/h5tools_utils.h2
-rw-r--r--tools/lib/h5trav.c25
-rw-r--r--tools/lib/h5trav.h2
-rw-r--r--tools/misc/talign.c15
-rw-r--r--vms/src/h5pubconf.h6
-rw-r--r--windows/src/H5pubconf.h6
123 files changed, 3262 insertions, 2954 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f4a2451..340c4ec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -159,8 +159,10 @@ ENDIF (NOT HDF5_INSTALL_INCLUDE_DIR)
IF (NOT HDF5_INSTALL_DATA_DIR)
IF (NOT WIN32)
SET (HDF5_INSTALL_DATA_DIR share)
+ SET (HDF5_INSTALL_CMAKE_DIR share/cmake)
ELSE (NOT WIN32)
SET (HDF5_INSTALL_DATA_DIR ".")
+ SET (HDF5_INSTALL_CMAKE_DIR cmake)
ENDIF (NOT WIN32)
ENDIF (NOT HDF5_INSTALL_DATA_DIR)
@@ -174,7 +176,7 @@ STRING (REGEX REPLACE ".*#define[ \t]+H5_VERS_MINOR[ \t]+([0-9]*).*$"
"\\1" H5_VERS_MINOR ${_h5public_h_contents})
STRING (REGEX REPLACE ".*#define[ \t]+H5_VERS_RELEASE[ \t]+([0-9]*).*$"
"\\1" H5_VERS_RELEASE ${_h5public_h_contents})
-STRING (REGEX REPLACE ".*#define[ \t]+H5_VERS_SUBRELEASE[ \t]+\"([0-9A-Za-z.]*)\".*$"
+STRING (REGEX REPLACE ".*#define[ \t]+H5_VERS_SUBRELEASE[ \t]+\"([0-9A-Za-z._]*)\".*$"
"\\1" H5_VERS_SUBRELEASE ${_h5public_h_contents})
#MESSAGE (STATUS "VERSION: ${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}-${H5_VERS_SUBRELEASE}")
@@ -561,6 +563,9 @@ IF (HDF5_ENABLE_Z_LIB_SUPPORT)
IF (NOT H5_ZLIB_HEADER)
IF (NOT ZLIB_USE_EXTERNAL)
FIND_PACKAGE (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT})
+ IF (NOT ZLIB_FOUND)
+ FIND_PACKAGE (ZLIB) # Legacy find
+ ENDIF (NOT ZLIB_FOUND)
ENDIF (NOT ZLIB_USE_EXTERNAL)
IF (ZLIB_FOUND)
SET (H5_HAVE_FILTER_DEFLATE 1)
@@ -568,6 +573,7 @@ IF (HDF5_ENABLE_Z_LIB_SUPPORT)
SET (H5_HAVE_LIBZ 1)
SET (H5_ZLIB_HEADER "zlib.h")
SET (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR})
+ SET (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
ELSE (ZLIB_FOUND)
IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
EXTERNAL_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${LIB_TYPE})
@@ -601,12 +607,16 @@ IF (HDF5_ENABLE_SZIP_SUPPORT)
OPTION (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF)
IF (NOT SZIP_USE_EXTERNAL)
FIND_PACKAGE (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT})
+ IF (NOT SZIP_FOUND)
+ FIND_PACKAGE (SZIP) # Legacy find
+ ENDIF (NOT SZIP_FOUND)
ENDIF (NOT SZIP_USE_EXTERNAL)
IF (SZIP_FOUND)
SET (H5_HAVE_FILTER_SZIP 1)
SET (H5_HAVE_SZLIB_H 1)
SET (H5_HAVE_LIBSZ 1)
SET (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR})
+ SET (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR})
ELSE (SZIP_FOUND)
IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${LIB_TYPE} ${HDF5_ENABLE_SZIP_ENCODING})
@@ -835,7 +845,7 @@ ENDIF (NOT HDF5_INSTALL_NO_DEVELOPMENT)
IF (NOT HDF5_EXTERNALLY_CONFIGURED)
INSTALL (
EXPORT ${HDF5_EXPORTED_TARGETS}
- DESTINATION ${HDF5_INSTALL_DATA_DIR}/cmake/${HDF5_PACKAGE}
+ DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE}
FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake
COMPONENT configinstall
)
@@ -877,7 +887,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED)
)
INSTALL (
FILES ${HDF5_BINARY_DIR}/CMakeFiles/FindHDF5${HDF_PACKAGE_EXT}.cmake
- DESTINATION ${HDF5_INSTALL_DATA_DIR}/cmake/${HDF5_PACKAGE}
+ DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE}
COMPONENT configinstall
)
ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED)
@@ -892,7 +902,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED)
)
INSTALL (
FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake
- DESTINATION ${HDF5_INSTALL_DATA_DIR}/cmake/${HDF5_PACKAGE}
+ DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE}
COMPONENT configinstall
)
ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED)
@@ -907,7 +917,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED)
)
INSTALL (
FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF5_PACKAGE_EXT}-config-version.cmake
- DESTINATION ${HDF5_INSTALL_DATA_DIR}/cmake/${HDF5_PACKAGE}
+ DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE}
COMPONENT configinstall
)
ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED)
@@ -926,7 +936,7 @@ CONFIGURE_FILE (
)
INSTALL (
FILES ${HDF5_BINARY_DIR}/libhdf5.settings
- DESTINATION ${HDF5_INSTALL_DATA_DIR}/cmake/${HDF5_PACKAGE}
+ DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE}
COMPONENT libraries
)
diff --git a/MANIFEST b/MANIFEST
index 8076c7da..b888ccb 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1822,6 +1822,7 @@
./tools/h5diff/testfiles/h5diff_56.txt
./tools/h5diff/testfiles/h5diff_57.txt
./tools/h5diff/testfiles/h5diff_58.txt
+./tools/h5diff/testfiles/h5diff_59.txt
./tools/h5diff/testfiles/h5diff_600.txt
./tools/h5diff/testfiles/h5diff_601.txt
./tools/h5diff/testfiles/h5diff_603.txt
diff --git a/README.txt b/README.txt
index fcecd58..a819d9f 100644
--- a/README.txt
+++ b/README.txt
@@ -1,4 +1,4 @@
-HDF5 version 1.9.124 currently under development
+HDF5 version 1.9.127 currently under development
Please refer to the release_docs/INSTALL file for installation instructions.
------------------------------------------------------------------------------
diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in
index b83f4e1..c6b8507 100644
--- a/c++/src/Makefile.in
+++ b/c++/src/Makefile.in
@@ -431,7 +431,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 114
+LT_VERS_REVISION = 117
LT_VERS_AGE = 0
# Include src directory
diff --git a/config/cmake/FindHDF5.cmake.in b/config/cmake/FindHDF5.cmake.in
index 7be4de3..1b51ed4 100644
--- a/config/cmake/FindHDF5.cmake.in
+++ b/config/cmake/FindHDF5.cmake.in
@@ -1,5 +1,5 @@
#
-# To be used by projects that make use of Cmakeified hdf5-1.8
+# To be used by projects that make use of Cmakeified hdf5-@HDF5_PACKAGE_VERSION@
#
#
@@ -10,9 +10,9 @@
# HDF5_FOUND - True if found, otherwise all other vars are undefined
# HDF5_INCLUDE_DIR - The include dir for main *.h files
# HDF5_FORTRAN_INCLUDE_DIR - The include dir for fortran modules and headers
-# HDF5_VERSION_STRING - full version (e.g. 1.8.5)
-# HDF5_VERSION_MAJOR - major part of version (e.g. 1.8)
-# HDF5_VERSION_MINOR - minor part (e.g. 5)
+# HDF5_VERSION_STRING - full version (e.g. @HDF5_PACKAGE_VERSION@)
+# HDF5_VERSION_MAJOR - major part of version (e.g. @HDF5_PACKAGE_VERSION_MAJOR@)
+# HDF5_VERSION_MINOR - minor part (e.g. @HDF5_PACKAGE_VERSION_MINOR@)
#
# The following boolean vars will be defined
# HDF5_ENABLE_PARALLEL - 1 if HDF5 parallel supported
@@ -36,7 +36,7 @@
# hdf5_hl_cpp : High Level cpp interface library
#
# To aid in finding HDF5 as part of a subproject set
-# HDF5_ROOT_DIR_HINT to the location where hdf5-config.cmake lies
+# HDF5_ROOT_DIR_HINT to the location where @HDF5_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake lies
INCLUDE (SelectLibraryConfigurations)
INCLUDE (FindPackageHandleStandardArgs)
@@ -63,6 +63,7 @@ FIND_PATH (HDF5_ROOT_DIR "@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake"
HINTS ${_HDF5_HINTS}
PATHS ${_HDF5_PATHS}
PATH_SUFFIXES
+ cmake/@HDF5_PACKAGE@
lib/cmake/@HDF5_PACKAGE@
share/cmake/@HDF5_PACKAGE@
)
diff --git a/config/lt_vers.am b/config/lt_vers.am
index 4ad3051..34fa390 100644
--- a/config/lt_vers.am
+++ b/config/lt_vers.am
@@ -17,7 +17,7 @@
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 114
+LT_VERS_REVISION = 117
LT_VERS_AGE = 0
## If the API changes *at all*, increment LT_VERS_INTERFACE and
diff --git a/configure b/configure
index 0616c8d..8c55e67 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
#! /bin/sh
-# From configure.in Id: configure.in 22487 2012-06-24 14:29:36Z hdftest .
+# From configure.in Id: configure.in 22670 2012-08-12 20:28:06Z hdftest .
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for HDF5 1.9.124.
+# Generated by GNU Autoconf 2.68 for HDF5 1.9.127.
#
# Report bugs to <help@hdfgroup.org>.
#
@@ -571,8 +571,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='HDF5'
PACKAGE_TARNAME='hdf5'
-PACKAGE_VERSION='1.9.124'
-PACKAGE_STRING='HDF5 1.9.124'
+PACKAGE_VERSION='1.9.127'
+PACKAGE_STRING='HDF5 1.9.127'
PACKAGE_BUGREPORT='help@hdfgroup.org'
PACKAGE_URL=''
@@ -1464,7 +1464,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures HDF5 1.9.124 to adapt to many kinds of systems.
+\`configure' configures HDF5 1.9.127 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1534,7 +1534,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of HDF5 1.9.124:";;
+ short | recursive ) echo "Configuration of HDF5 1.9.127:";;
esac
cat <<\_ACEOF
@@ -1729,7 +1729,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-HDF5 configure 1.9.124
+HDF5 configure 1.9.127
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2818,7 +2818,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by HDF5 $as_me 1.9.124, which was
+It was created by HDF5 $as_me 1.9.127, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -3639,7 +3639,7 @@ fi
# Define the identity of the package.
PACKAGE='hdf5'
- VERSION='1.9.124'
+ VERSION='1.9.127'
cat >>confdefs.h <<_ACEOF
@@ -30702,7 +30702,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by HDF5 $as_me 1.9.124, which was
+This file was extended by HDF5 $as_me 1.9.127, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -30768,7 +30768,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-HDF5 config.status 1.9.124
+HDF5 config.status 1.9.127
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
@@ -33563,7 +33563,7 @@ Usage: $0 [OPTIONS]
Report bugs to <bug-libtool@gnu.org>."
lt_cl_version="\
-HDF5 config.lt 1.9.124
+HDF5 config.lt 1.9.127
configured by $0, generated by GNU Autoconf 2.68.
Copyright (C) 2010 Free Software Foundation, Inc.
diff --git a/configure.in b/configure.in
index b6f8c89..4439766 100644
--- a/configure.in
+++ b/configure.in
@@ -26,7 +26,7 @@ dnl
dnl NOTE: Don't forget to change the version number here when we do a
dnl release!!!
dnl
-AC_INIT([HDF5], [1.9.124], [help@hdfgroup.org])
+AC_INIT([HDF5], [1.9.127], [help@hdfgroup.org])
AC_CONFIG_SRCDIR([src/H5.c])
AM_CONFIG_HEADER([src/H5config.h])
diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in
index e0fd502..467b6a4 100644
--- a/fortran/src/Makefile.in
+++ b/fortran/src/Makefile.in
@@ -478,7 +478,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 114
+LT_VERS_REVISION = 117
LT_VERS_AGE = 0
# Include src directory in both Fortran and C flags (C compiler is used
diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in
index f22d1c8..5930c4b 100644
--- a/hl/c++/src/Makefile.in
+++ b/hl/c++/src/Makefile.in
@@ -421,7 +421,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 114
+LT_VERS_REVISION = 117
LT_VERS_AGE = 0
# Include src directory
diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in
index aeea150..65531d2 100644
--- a/hl/fortran/src/Makefile.in
+++ b/hl/fortran/src/Makefile.in
@@ -436,7 +436,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 114
+LT_VERS_REVISION = 117
LT_VERS_AGE = 0
INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \
-I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src
diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c
index 93d2b3f..e55aaf8 100644
--- a/hl/src/H5IM.c
+++ b/hl/src/H5IM.c
@@ -564,7 +564,7 @@ herr_t H5IMlink_palette( hid_t loc_id,
/* close */
if(H5Sclose(asid) < 0)
goto out;
- if ( H5Tclose( atid ) < 0)
+ if(H5Tclose(atid) < 0)
goto out;
if(H5Aclose(aid) < 0)
goto out;
@@ -630,6 +630,8 @@ herr_t H5IMlink_palette( hid_t loc_id,
/* close */
if(H5Sclose(asid) < 0)
goto out;
+ if(H5Tclose(atid) < 0)
+ goto out;
if(H5Aclose(aid) < 0)
goto out;
diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in
index 429ff08..4f5c078 100644
--- a/hl/src/Makefile.in
+++ b/hl/src/Makefile.in
@@ -420,7 +420,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 114
+LT_VERS_REVISION = 117
LT_VERS_AGE = 0
# This library is our main target.
diff --git a/hl/test/test_image.c b/hl/test/test_image.c
index 3914a9f..4cef1b4 100644
--- a/hl/test/test_image.c
+++ b/hl/test/test_image.c
@@ -513,6 +513,7 @@ static int test_generate(void)
FILE *f;
const char *data_file = H5_get_srcdir_filename(DATA_FILE4);
int i;
+ int retval = FAIL;
/* create a file using default properties */
if ((fid=H5Fcreate(FILE3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
@@ -674,15 +675,17 @@ static int test_generate(void)
if (H5Fclose(fid)<0)
goto out;
- return 0;
+ /* Indicate success */
+ retval = 0;
/* error zone, gracefully close */
out:
+ HDfree(data);
H5E_BEGIN_TRY {
H5Fclose(fid);
} H5E_END_TRY;
H5_FAILED();
- return FAIL;
+ return retval;
}
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 33599b1..baa995f 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -1,4 +1,4 @@
-HDF5 version 1.9.124 currently under development
+HDF5 version 1.9.127 currently under development
================================================================================
@@ -705,6 +705,9 @@ Bug Fixes since HDF5-1.8.0 release
Tools
-----
+ - h5diff: Fixed the incorrect result when comparing attribute data
+ values and the data type has same class but different size.
+ HDFFV-7942 (JKM 08/15/2012)
- ph5diff: Fixed intermittent hang issue on a certain operation in
parallel mode. It was detected by daily test for comparing
non-comparable objects, but it could have occurred in other
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 456eb0d..26fa051 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -321,6 +321,8 @@ H5_DLLVAR hid_t H5AC_ind_dxpl_id;
#define H5AC__FLUSH_IGNORE_PROTECTED_FLAG H5C__FLUSH_IGNORE_PROTECTED_FLAG
#define H5AC__FREE_FILE_SPACE_FLAG H5C__FREE_FILE_SPACE_FLAG
#define H5AC__TAKE_OWNERSHIP_FLAG H5C__TAKE_OWNERSHIP_FLAG
+#define H5AC__FLUSH_LAST_FLAG H5C__FLUSH_LAST_FLAG
+#define H5AC__FLUSH_COLLECTIVELY_FLAG H5C__FLUSH_COLLECTIVELY_FLAG
/* #defines of flags used to report entry status in the
diff --git a/src/H5C.c b/src/H5C.c
index f651fb2..c229a46 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -414,12 +414,6 @@ done:
* Programmer: John Mainzer
* 3/17/10
*
- * Modifications:
- *
- * Heavily reworked to have each process flush a group of
- * adjacent entries.
- * JRM -- 4/15/10
- *
*-------------------------------------------------------------------------
*/
#ifdef H5_HAVE_PARALLEL
@@ -442,8 +436,13 @@ H5C_apply_candidate_list(H5F_t * f,
int last_entry_to_flush;
int entries_to_clear = 0;
int entries_to_flush = 0;
+ int entries_to_flush_or_clear_last = 0;
+ int entries_to_flush_collectively = 0;
int entries_cleared = 0;
int entries_flushed = 0;
+ int entries_delayed = 0;
+ int entries_flushed_or_cleared_last = 0;
+ int entries_flushed_collectively = 0;
int entries_examined = 0;
int initial_list_len;
int * candidate_assignment_table = NULL;
@@ -451,6 +450,7 @@ H5C_apply_candidate_list(H5F_t * f,
H5C_cache_entry_t * clear_ptr = NULL;
H5C_cache_entry_t * entry_ptr = NULL;
H5C_cache_entry_t * flush_ptr = NULL;
+ H5C_cache_entry_t * delayed_ptr = NULL;
#if H5C_DO_SANITY_CHECKS
haddr_t last_addr;
#endif /* H5C_DO_SANITY_CHECKS */
@@ -612,12 +612,28 @@ H5C_apply_candidate_list(H5F_t * f,
(int)(cache_ptr->LRU_list_len));
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
+ /* ====================================================================== *
+ * Now scan the LRU and PEL lists, flushing or clearing entries as
+ * needed.
+ *
+ * The flush_me_last and flush_me_collectively flags may dictate how or
+ * when some entries can be flushed, and should be addressed here.
+ * However, in their initial implementation, these flags only apply to the
+ * superblock, so there's only a relatively small change to this function
+ * to account for this one case where they come into play. If these flags
+ * are ever expanded upon, this function and the following flushing steps
+ * should be reworked to account for additional cases.
+ * ====================================================================== */
+
entries_examined = 0;
initial_list_len = cache_ptr->LRU_list_len;
entry_ptr = cache_ptr->LRU_tail_ptr;
+ /* Examine each entry in the LRU list */
while((entry_ptr != NULL) && (entries_examined <= initial_list_len) &&
((entries_cleared + entries_flushed) < num_candidates)) {
+
+ /* If this process needs to clear this entry. */
if(entry_ptr->clear_on_unprotect) {
entry_ptr->clear_on_unprotect = FALSE;
clear_ptr = entry_ptr;
@@ -625,7 +641,7 @@ H5C_apply_candidate_list(H5F_t * f,
entries_cleared++;
#if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 )
- HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank,
+ HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank,
(long long)clear_ptr->addr);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
@@ -638,14 +654,18 @@ H5C_apply_candidate_list(H5F_t * f,
&first_flush,
TRUE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
- } else if(entry_ptr->flush_immediately) {
+ } /* end if */
+
+ /* Else, if this process needs to flush this entry. */
+ else if (entry_ptr->flush_immediately) {
+
entry_ptr->flush_immediately = FALSE;
flush_ptr = entry_ptr;
entry_ptr = entry_ptr->prev;
entries_flushed++;
#if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 )
- HDfprintf(stdout, "%s:%d: flushing 0x%llx.\n", FUNC, mpi_rank,
+ HDfprintf(stdout, "%s:%d: flushing 0x%llx.\n", FUNC, mpi_rank,
(long long)flush_ptr->addr);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
@@ -657,17 +677,20 @@ H5C_apply_candidate_list(H5F_t * f,
H5C__NO_FLAGS_SET,
&first_flush,
TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
- } else {
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry.")
+ } /* end else-if */
+
+ /* Otherwise, no action to be taken on this entry. Grab the next. */
+ else {
entry_ptr = entry_ptr->prev;
- }
+ } /* end else */
entries_examined++;
} /* end while */
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
- HDfprintf(stdout, "%s:%d: entries examined/cleared/flushed = %d/%d/%d.\n",
- FUNC, mpi_rank, entries_examined,
+ HDfprintf(stdout, "%s:%d: entries examined/cleared/flushed = %d/%d/%d.\n",
+ FUNC, mpi_rank, entries_examined,
entries_cleared, entries_flushed);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
@@ -676,69 +699,168 @@ H5C_apply_candidate_list(H5F_t * f,
*/
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
- HDfprintf(stdout, "%s:%d: scanning pinned entry list. len = %d\n",
+ HDfprintf(stdout, "%s:%d: scanning pinned entry list. len = %d\n",
FUNC, mpi_rank, (int)(cache_ptr->pel_len));
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
entry_ptr = cache_ptr->pel_head_ptr;
while((entry_ptr != NULL) &&
- ((entries_cleared + entries_flushed) < num_candidates)) {
- if(entry_ptr->clear_on_unprotect) {
- entry_ptr->clear_on_unprotect = FALSE;
- clear_ptr = entry_ptr;
- entry_ptr = entry_ptr->next;
- entries_cleared++;
+ ((entries_cleared + entries_flushed + entries_delayed)
+ < num_candidates)) {
+
+ /* If entry is marked for flush or for clear */
+ if((entry_ptr->clear_on_unprotect||entry_ptr->flush_immediately)) {
+
+ /* If this entry needs to be flushed last */
+ if (entry_ptr->flush_me_last) {
+
+ /* At this time, only the superblock supports being
+ flushed last. Conveniently, it also happens to be the only
+ entry that supports being flushed collectively, as well. Also
+ conveniently, it's always pinned, so we only need to check
+ for it while scanning the PEL here. Finally, it's never
+ included in a candidate list that excludes other dirty
+ entries in a cache, so we can handle this relatively simple
+ case here.
+
+ For now, this function asserts this and saves the entry
+ to flush it after scanning the rest of the PEL list.
+
+ If there are ever more entries that either need to be
+ flushed last and/or flushed collectively, this whole routine
+ will need to be reworked to handle all additional cases. As
+ it is the simple case of a single pinned entry needing
+ flushed last and collectively is just a minor addition to
+ this routine, but signficantly buffing up the usage of
+ flush_me_last or flush_me_collectively will require a more
+ intense rework of this function and potentially the function
+ of candidate lists as a whole. */
+
+ HDassert(entry_ptr->flush_me_collectively);
+ entries_to_flush_or_clear_last++;
+ entries_to_flush_collectively++;
+ HDassert(entries_to_flush_or_clear_last == 1);
+ HDassert(entries_to_flush_collectively == 1);
+
+ /* Delay the entry. It will be flushed later. */
+ delayed_ptr = entry_ptr;
+ entries_delayed++;
+ HDassert(entries_delayed == 1);
+
+ } /* end if */
+
+ /* Else, this process needs to clear this entry. */
+ else if (entry_ptr->clear_on_unprotect) {
+ HDassert(!entry_ptr->flush_immediately);
+ entry_ptr->clear_on_unprotect = FALSE;
+ clear_ptr = entry_ptr;
+ entry_ptr = entry_ptr->next;
+ entries_cleared++;
#if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 )
- HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank,
+ HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank,
(long long)clear_ptr->addr);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
- if(H5C_flush_single_entry(f,
- primary_dxpl_id,
- secondary_dxpl_id,
- clear_ptr->type,
- clear_ptr->addr,
- H5C__FLUSH_CLEAR_ONLY_FLAG,
- &first_flush,
- TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
- } else if(entry_ptr->flush_immediately) {
- entry_ptr->flush_immediately = FALSE;
- flush_ptr = entry_ptr;
- entry_ptr = entry_ptr->next;
- entries_flushed++;
+ if(H5C_flush_single_entry(f,
+ primary_dxpl_id,
+ secondary_dxpl_id,
+ clear_ptr->type,
+ clear_ptr->addr,
+ H5C__FLUSH_CLEAR_ONLY_FLAG,
+ &first_flush,
+ TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
+ } /* end else-if */
+
+ /* Else, if this process needs to independently flush this entry. */
+ else if (entry_ptr->flush_immediately) {
+ entry_ptr->flush_immediately = FALSE;
+ flush_ptr = entry_ptr;
+ entry_ptr = entry_ptr->next;
+ entries_flushed++;
#if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 )
- HDfprintf(stdout, "%s:%d: flushing 0x%llx.\n", FUNC, mpi_rank,
+ HDfprintf(stdout, "%s:%d: flushing 0x%llx.\n", FUNC, mpi_rank,
(long long)flush_ptr->addr);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
- if(H5C_flush_single_entry(f,
- primary_dxpl_id,
- secondary_dxpl_id,
- flush_ptr->type,
- flush_ptr->addr,
- H5C__NO_FLAGS_SET,
- &first_flush,
- TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
- } else {
+ if(H5C_flush_single_entry(f,
+ primary_dxpl_id,
+ secondary_dxpl_id,
+ flush_ptr->type,
+ flush_ptr->addr,
+ H5C__NO_FLAGS_SET,
+ &first_flush,
+ TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry.")
+ } /* end else-if */
+ } /* end if */
+
+ /* Otherwise, this entry is not marked for flush or clear. Grab the next. */
+ else {
entry_ptr = entry_ptr->next;
- }
+ } /* end else */
+
} /* end while */
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
- HDfprintf(stdout,
- "%s:%d: pel entries examined/cleared/flushed = %d/%d/%d.\n",
- FUNC, mpi_rank, entries_examined,
+ HDfprintf(stdout,
+ "%s:%d: pel entries examined/cleared/flushed = %d/%d/%d.\n",
+ FUNC, mpi_rank, entries_examined,
entries_cleared, entries_flushed);
HDfprintf(stdout, "%s:%d: done.\n", FUNC, mpi_rank);
fsync(stdout);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
- if((entries_flushed != entries_to_flush) || (entries_cleared != entries_to_clear))
+ /* ====================================================================== *
+ * Now, handle all delayed entries. *
+ * *
+ * This can *only* be the superblock at this time, so it's relatively *
+ * easy to deal with. We're collectively flushing the entry saved from *
+ * above. This will need to be handled differently if there are ever more *
+ * than one entry needing this special treatment.) *
+ * ====================================================================== */
+
+ if (delayed_ptr) {
+
+ if (delayed_ptr->clear_on_unprotect) {
+ entry_ptr->clear_on_unprotect = FALSE;
+ entries_cleared++;
+ } else if (delayed_ptr->flush_immediately) {
+ entry_ptr->flush_immediately = FALSE;
+ entries_flushed++;
+ } /* end if */
+
+ if(H5C_flush_single_entry(f,
+ primary_dxpl_id,
+ secondary_dxpl_id,
+ delayed_ptr->type,
+ delayed_ptr->addr,
+ H5C__NO_FLAGS_SET,
+ &first_flush,
+ TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
+ "Can't flush entry collectively.")
+
+ entries_flushed_collectively++;
+ entries_flushed_or_cleared_last++;
+ } /* end if */
+
+ /* ====================================================================== *
+ * Finished flushing everything. *
+ * ====================================================================== */
+
+ HDassert((entries_flushed == entries_to_flush));
+ HDassert((entries_cleared == entries_to_clear));
+ HDassert((entries_flushed_or_cleared_last == entries_to_flush_or_clear_last));
+ HDassert((entries_flushed_collectively == entries_to_flush_collectively));
+
+ if((entries_flushed != entries_to_flush) ||
+ (entries_cleared != entries_to_clear) ||
+ (entries_flushed_or_cleared_last != entries_to_flush_or_clear_last) ||
+ (entries_flushed_collectively != entries_to_flush_collectively))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry count mismatch.")
done:
@@ -924,7 +1046,8 @@ H5C_construct_candidate_list__min_clean(H5C_t * cache_ptr)
entry_ptr = cache_ptr->dLRU_tail_ptr;
while((nominated_entries_size < space_needed) &&
(nominated_entries_count < cache_ptr->slist_len) &&
- (entry_ptr != NULL)) {
+ (entry_ptr != NULL) &&
+ (!entry_ptr->flush_me_last)) {
haddr_t nominated_addr;
HDassert( ! (entry_ptr->is_protected) );
@@ -1771,8 +1894,12 @@ H5C_flush_cache(H5F_t *f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, unsign
HDassert( entry_ptr != NULL );
HDassert( entry_ptr->in_slist );
- if ( ( ! flush_marked_entries ) ||
- ( entry_ptr->flush_marker ) ) {
+ if ( ( ( ! flush_marked_entries ) ||
+ ( entry_ptr->flush_marker ) ) &&
+ ( ( ! entry_ptr->flush_me_last ) ||
+ ( ( entry_ptr->flush_me_last ) &&
+ ( cache_ptr->num_last_entries >=
+ cache_ptr->slist_len ) ) ) ) {
if ( entry_ptr->is_protected ) {
@@ -2524,6 +2651,10 @@ H5C_insert_entry(H5F_t * f,
herr_t result;
hbool_t first_flush = TRUE;
hbool_t insert_pinned;
+ hbool_t flush_last;
+#ifdef H5_HAVE_PARALLEL
+ hbool_t flush_collectively;
+#endif
hbool_t set_flush_marker;
hbool_t write_permitted = TRUE;
size_t empty_space;
@@ -2562,8 +2693,12 @@ H5C_insert_entry(H5F_t * f,
}
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
- set_flush_marker = ( (flags & H5C__SET_FLUSH_MARKER_FLAG) != 0 );
- insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 );
+ set_flush_marker = ( (flags & H5C__SET_FLUSH_MARKER_FLAG) != 0 );
+ insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 );
+ flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 );
+#ifdef H5_HAVE_PARALLEL
+ flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 );
+#endif
entry_ptr = (H5C_cache_entry_t *)thing;
@@ -2604,6 +2739,10 @@ H5C_insert_entry(H5F_t * f,
entry_ptr->is_pinned = insert_pinned;
entry_ptr->pinned_from_client = insert_pinned;
+ entry_ptr->flush_me_last = flush_last;
+#ifdef H5_HAVE_PARALLEL
+ entry_ptr->flush_me_collectively = flush_collectively;
+#endif
/* newly inserted entries are assumed to be dirty */
entry_ptr->is_dirty = TRUE;
@@ -7710,85 +7849,91 @@ H5C_flush_invalidate_cache(H5F_t * f,
HDassert( entry_ptr != NULL );
HDassert( entry_ptr->in_slist );
-#if H5C_DO_SANITY_CHECKS
- /* update actual_slist_len & actual_slist_size before
- * the flush. Note that the entry will be removed
- * from the slist after the flush, and thus may be
- * resized by the flush callback. This is OK, as
- * we will catch the size delta in
- * cache_ptr->slist_size_increase.
- *
- * Note that we include pinned entries in this count, even
- * though we will not actually flush them.
- */
- actual_slist_len++;
- actual_slist_size += entry_ptr->size;
-#endif /* H5C_DO_SANITY_CHECKS */
+ if ( ( ! entry_ptr->flush_me_last ) ||
+ ( ( entry_ptr->flush_me_last ) &&
+ ( cache_ptr->num_last_entries >=
+ cache_ptr->slist_len ) ) ) {
+
+ #if H5C_DO_SANITY_CHECKS
+ /* update actual_slist_len & actual_slist_size before
+ * the flush. Note that the entry will be removed
+ * from the slist after the flush, and thus may be
+ * resized by the flush callback. This is OK, as
+ * we will catch the size delta in
+ * cache_ptr->slist_size_increase.
+ *
+ * Note that we include pinned entries in this count, even
+ * though we will not actually flush them.
+ */
+ actual_slist_len++;
+ actual_slist_size += entry_ptr->size;
+ #endif /* H5C_DO_SANITY_CHECKS */
- if ( entry_ptr->is_protected ) {
+ if ( entry_ptr->is_protected ) {
- /* we have major problems -- but lets flush
- * everything we can before we flag an error.
- */
- protected_entries++;
+ /* we have major problems -- but lets flush
+ * everything we can before we flag an error.
+ */
+ protected_entries++;
- } else if ( entry_ptr->is_pinned ) {
+ } else if ( entry_ptr->is_pinned ) {
- /* Test to see if we are can flush the entry now.
- * If we can, go ahead and flush, but don't tell
- * H5C_flush_single_entry() to destroy the entry
- * as pinned entries can't be evicted.
- */
- if(entry_ptr->flush_dep_height == curr_flush_dep_height ) {
- status = H5C_flush_single_entry(f,
- primary_dxpl_id,
- secondary_dxpl_id,
- NULL,
- entry_ptr->addr,
- H5C__NO_FLAGS_SET,
- &first_flush,
- FALSE);
- if ( status < 0 ) {
-
- /* This shouldn't happen -- if it does, we are toast
- * so just scream and die.
- */
+ /* Test to see if we are can flush the entry now.
+ * If we can, go ahead and flush, but don't tell
+ * H5C_flush_single_entry() to destroy the entry
+ * as pinned entries can't be evicted.
+ */
+ if(entry_ptr->flush_dep_height == curr_flush_dep_height ) {
+ status = H5C_flush_single_entry(f,
+ primary_dxpl_id,
+ secondary_dxpl_id,
+ NULL,
+ entry_ptr->addr,
+ H5C__NO_FLAGS_SET,
+ &first_flush,
+ FALSE);
+ if ( status < 0 ) {
+
+ /* This shouldn't happen -- if it does, we are toast
+ * so just scream and die.
+ */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "dirty pinned entry flush failed.")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
+ "dirty pinned entry flush failed.")
+ } /* end if */
+ flushed_during_dep_loop = TRUE;
} /* end if */
- flushed_during_dep_loop = TRUE;
+ else if(entry_ptr->flush_dep_height < curr_flush_dep_height)
+ /* This shouldn't happen -- if it does, just scream and die. */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.")
} /* end if */
- else if(entry_ptr->flush_dep_height < curr_flush_dep_height)
- /* This shouldn't happen -- if it does, just scream and die. */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.")
- } /* end if */
- else {
- if(entry_ptr->flush_dep_height == curr_flush_dep_height ){
+ else {
+ if(entry_ptr->flush_dep_height == curr_flush_dep_height ){
- status = H5C_flush_single_entry(f,
- primary_dxpl_id,
- secondary_dxpl_id,
- NULL,
- entry_ptr->addr,
- (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG),
- &first_flush,
- TRUE);
- if ( status < 0 ) {
-
- /* This shouldn't happen -- if it does, we are toast so
- * just scream and die.
- */
+ status = H5C_flush_single_entry(f,
+ primary_dxpl_id,
+ secondary_dxpl_id,
+ NULL,
+ entry_ptr->addr,
+ (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG),
+ &first_flush,
+ TRUE);
+ if ( status < 0 ) {
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "dirty entry flush destroy failed.")
+ /* This shouldn't happen -- if it does, we are toast so
+ * just scream and die.
+ */
+
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
+ "dirty entry flush destroy failed.")
+ } /* end if */
+ flushed_during_dep_loop = TRUE;
} /* end if */
- flushed_during_dep_loop = TRUE;
- } /* end if */
- else if(entry_ptr->flush_dep_height < curr_flush_dep_height)
- /* This shouldn't happen -- if it does, just scream and die. */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.")
- } /* end else */
+ else if(entry_ptr->flush_dep_height < curr_flush_dep_height)
+ /* This shouldn't happen -- if it does, just scream and die. */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.")
+ } /* end else */
+ } /* end if */
} /* end while loop scanning skip list */
#if H5C_DO_SANITY_CHECKS
@@ -7835,45 +7980,52 @@ H5C_flush_invalidate_cache(H5F_t * f,
next_entry_ptr = entry_ptr->ht_next;
HDassert ( ( next_entry_ptr == NULL ) ||
( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ) );
- if ( entry_ptr->is_protected ) {
-
- /* we have major problems -- but lets flush and destroy
- * everything we can before we flag an error.
- */
- protected_entries++;
- if ( ! entry_ptr->in_slist ) {
+ if ( ( ! entry_ptr->flush_me_last ) ||
+ ( ( entry_ptr->flush_me_last ) &&
+ ( cache_ptr->num_last_entries >=
+ cache_ptr->slist_len ) ) ) {
- HDassert( !(entry_ptr->is_dirty) );
- }
- } else if ( ! ( entry_ptr->is_pinned ) ) {
+ if ( entry_ptr->is_protected ) {
- /* Test to see if we are can flush the entry now.
- * If we can, go ahead and flush.
- */
- if(entry_ptr->flush_dep_height == curr_flush_dep_height ){
- status = H5C_flush_single_entry(f,
- primary_dxpl_id,
- secondary_dxpl_id,
- NULL,
- entry_ptr->addr,
- (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG),
- &first_flush,
- TRUE);
- if ( status < 0 ) {
+ /* we have major problems -- but lets flush and destroy
+ * everything we can before we flag an error.
+ */
+ protected_entries++;
- /* This shouldn't happen -- if it does, we are toast so
- * just scream and die.
- */
+ if ( ! entry_ptr->in_slist ) {
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "Entry flush destroy failed.")
+ HDassert( !(entry_ptr->is_dirty) );
}
- flushed_during_dep_loop = TRUE;
+ } else if ( ! ( entry_ptr->is_pinned ) ) {
+
+ /* Test to see if we are can flush the entry now.
+ * If we can, go ahead and flush.
+ */
+ if(entry_ptr->flush_dep_height == curr_flush_dep_height ){
+ status = H5C_flush_single_entry(f,
+ primary_dxpl_id,
+ secondary_dxpl_id,
+ NULL,
+ entry_ptr->addr,
+ (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG),
+ &first_flush,
+ TRUE);
+ if ( status < 0 ) {
+
+ /* This shouldn't happen -- if it does, we are toast so
+ * just scream and die.
+ */
+
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
+ "Entry flush destroy failed.")
+ }
+ flushed_during_dep_loop = TRUE;
+ } /* end if */
+ else if(entry_ptr->flush_dep_height < curr_flush_dep_height)
+ /* This shouldn't happen -- if it does, just scream and die. */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.")
} /* end if */
- else if(entry_ptr->flush_dep_height < curr_flush_dep_height)
- /* This shouldn't happen -- if it does, just scream and die. */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.")
} /* end if */
/* We can't do anything if the entry is pinned. The
* hope is that the entry will be unpinned as the
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index 37068f1..909578b 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -282,6 +282,16 @@
* don't use this at present, I hope that this will allow
* some optimizations when I get to it.
*
+ * num_last_entries: The number of entries in the cache that can only be
+ * flushed after all other entries in the cache have
+ * been flushed. At this time, this will only ever be
+ * one entry (the superblock), and the code has been
+ * protected with HDasserts to enforce this. This restraint
+ * can certainly be relaxed in the future if the need for
+ * multiple entries being flushed last arises, though
+ * explicit tests for that case should be added when said
+ * HDasserts are removed.
+ *
* With the addition of the fractal heap, the cache must now deal with
* the case in which entries may be dirtied, moved, or have their sizes
* changed during a flush. To allow sanity checks in this situation, the
@@ -878,6 +888,7 @@ struct H5C_t
int32_t slist_len;
size_t slist_size;
H5SL_t * slist_ptr;
+ int32_t num_last_entries;
#if H5C_DO_SANITY_CHECKS
int64_t slist_len_increase;
int64_t slist_size_increase;
@@ -1964,6 +1975,10 @@ if ( (cache_ptr)->index_size != \
} else { \
(cache_ptr)->clean_index_size += (entry_ptr)->size; \
} \
+ if ((entry_ptr)->flush_me_last) { \
+ (cache_ptr)->num_last_entries++; \
+ HDassert((cache_ptr)->num_last_entries == 1); \
+ } \
H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \
}
@@ -1993,6 +2008,10 @@ if ( (cache_ptr)->index_size != \
} else { \
(cache_ptr)->clean_index_size -= (entry_ptr)->size; \
} \
+ if ((entry_ptr)->flush_me_last) { \
+ (cache_ptr)->num_last_entries--; \
+ HDassert((cache_ptr)->num_last_entries == 0); \
+ } \
H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr) \
}
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 0c7631a..7fde69b 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -371,6 +371,23 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t * cache_ptr,
* H5C__FLUSH_MARKED_ENTRIES_FLAG. The flag is reset when
* the entry is flushed for whatever reason.
*
+ * flush_me_last: Boolean flag indicating that this entry should not be
+ * flushed from the cache until all other entries without
+ * the flush_me_last flag set have been flushed.
+ *
+ * flush_me_collectively: Boolean flag indicating that this entry needs
+ * to be flushed collectively when in a parallel
+ * situation.
+ *
+ * Note: At this time, the flush_me_last and flush_me_collectively
+ * flags will only be applied to one entry, the superblock,
+ * and the code utilizing these flags is protected with HDasserts
+ * to enforce this. This restraint can certainly be relaxed in
+ * the future if the the need for multiple entries getting flushed
+ * last or collectively arises, though the code allowing for that
+ * will need to be expanded and tested appropriately if that
+ * functionality is desired.
+ *
* clear_on_unprotect: Boolean flag used only in PHDF5. When H5C is used
* to implement the metadata cache In the parallel case, only
* the cache with mpi rank 0 is allowed to actually write to
@@ -578,7 +595,7 @@ typedef struct H5C_cache_entry_t
haddr_t addr;
size_t size;
const H5C_class_t * type;
- haddr_t tag;
+ haddr_t tag;
hbool_t is_dirty;
hbool_t dirtied;
hbool_t is_protected;
@@ -587,13 +604,15 @@ typedef struct H5C_cache_entry_t
hbool_t is_pinned;
hbool_t in_slist;
hbool_t flush_marker;
+ hbool_t flush_me_last;
#ifdef H5_HAVE_PARALLEL
+ hbool_t flush_me_collectively;
hbool_t clear_on_unprotect;
- hbool_t flush_immediately;
+ hbool_t flush_immediately;
#endif /* H5_HAVE_PARALLEL */
hbool_t flush_in_progress;
hbool_t destroy_in_progress;
- hbool_t free_file_space_on_destroy;
+ hbool_t free_file_space_on_destroy;
/* fields supporting the 'flush dependency' feature: */
@@ -1042,6 +1061,8 @@ typedef struct H5C_auto_size_ctl_t
#define H5C__READ_ONLY_FLAG 0x0200
#define H5C__FREE_FILE_SPACE_FLAG 0x0800
#define H5C__TAKE_OWNERSHIP_FLAG 0x1000
+#define H5C__FLUSH_LAST_FLAG 0x2000
+#define H5C__FLUSH_COLLECTIVELY_FLAG 0x4000
#ifdef H5_HAVE_PARALLEL
H5_DLL herr_t H5C_apply_candidate_list(H5F_t * f,
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 93e8869..7a06477 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -3798,7 +3798,9 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim)
/*
* Determine the chunks which need to be filled or removed
*/
- for(op_dim=0; op_dim<space_ndims; op_dim++) {
+ HDmemset(min_mod_chunk_off, 0, sizeof(min_mod_chunk_off));
+ HDmemset(max_mod_chunk_off, 0, sizeof(max_mod_chunk_off));
+ for(op_dim = 0; op_dim < space_ndims; op_dim++) {
/* Calculate the largest offset of chunks that might need to be
* modified in this dimension */
max_mod_chunk_off[op_dim] = chunk_dim[op_dim] * ((old_dim[op_dim] - 1)
diff --git a/src/H5Doh.c b/src/H5Doh.c
index 641c8b8..2dab247 100644
--- a/src/H5Doh.c
+++ b/src/H5Doh.c
@@ -447,7 +447,7 @@ done:
static herr_t
H5O__dset_flush(H5G_loc_t *obj_loc, hid_t dxpl_id)
{
- H5D_t *dset; /* Dataset opened */
+ H5D_t *dset = NULL; /* Dataset opened */
H5O_type_t obj_type; /* Type of object at location */
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 594a69a..76eaaf5 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -264,7 +264,10 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
if(cls_ptr->lib_vers)
eprint->cls.lib_vers = cls_ptr->lib_vers;
- fprintf(stream, "%s-DIAG: Error detected in %s (%s) ", cls_ptr->cls_name, cls_ptr->lib_name, cls_ptr->lib_vers);
+ fprintf(stream, "%s-DIAG: Error detected in %s (%s) ",
+ (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"),
+ (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"),
+ (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)"));
/* try show the process or thread id in multiple processes cases*/
#ifdef H5_HAVE_PARALLEL
@@ -387,7 +390,10 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
if(cls_ptr->lib_vers)
eprint->cls.lib_vers = cls_ptr->lib_vers;
- fprintf(stream, "%s-DIAG: Error detected in %s (%s) ", cls_ptr->cls_name, cls_ptr->lib_name, cls_ptr->lib_vers);
+ fprintf(stream, "%s-DIAG: Error detected in %s (%s) ",
+ (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"),
+ (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"),
+ (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)"));
/* try show the process or thread id in multiple processes cases*/
#ifdef H5_HAVE_PARALLEL
diff --git a/src/H5FD.c b/src/H5FD.c
index e5fec54..0c375ed 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -71,7 +71,6 @@ static herr_t H5FD_pl_close(hid_t driver_id, herr_t (*free_func)(void *),
void *pl);
static herr_t H5FD_free_cls(H5FD_class_t *cls);
static herr_t H5FD_fapl_copy(hid_t driver_id, const void *fapl, void **copied_fapl);
-static herr_t H5FD_dxpl_copy(hid_t driver_id, const void *dxpl, void **copied_dxpl);
static int H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/);
static int H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/);
@@ -457,13 +456,9 @@ H5FD_get_class(hid_t id)
if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID")
ret_value = H5FD_get_class(driver_id);
- } else if(TRUE == H5P_isa_class(id, H5P_DATASET_XFER)) {
- if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID")
- ret_value = H5FD_get_class(driver_id);
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver id, file access property list or data transfer property list")
- }
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver id or file access property list")
} /* end if */
done:
@@ -827,125 +822,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_dxpl_open
- *
- * Purpose: Mark a driver as used by a data transfer property list
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Thursday, October 23, 2003
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5FD_dxpl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info)
-{
- void *copied_driver_info = NULL; /* Temporary VFL driver info */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Increment the reference count on the driver and copy the driver info */
- if(H5I_inc_ref(driver_id, FALSE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "can't increment VFL driver ID")
- if(H5FD_dxpl_copy(driver_id, driver_info, &copied_driver_info) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "can't copy VFL driver")
-
- /* Set the driver information for the new property list */
- if(H5P_set(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VFL driver ID")
- if(H5P_set(plist, H5D_XFER_VFL_INFO_NAME, &copied_driver_info) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VFL driver info")
-
-done:
- if(ret_value < 0)
- if(copied_driver_info && H5FD_dxpl_close(driver_id, copied_driver_info) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close copy of driver info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_dxpl_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5FD_dxpl_copy
- *
- * Purpose: Copies the driver-specific part of the data transfer property
- * list.
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Robb Matzke
- * Tuesday, August 3, 1999
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5FD_dxpl_copy(hid_t driver_id, const void *old_dxpl, void **copied_dxpl)
-{
- H5FD_class_t *driver;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
-
- /* Copy the file access property list */
- if(H5FD_pl_copy(driver->dxpl_copy, driver->dxpl_size, old_dxpl, copied_dxpl) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't copy driver data transfer property list")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_dxpl_copy() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5FD_dxpl_close
- *
- * Purpose: Closes a driver for a dataset transfer property list
- *
- * Return: Success: non-negative
- * Failure: negative
- *
- * Programmer: Robb Matzke
- * Tuesday, August 3, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5FD_dxpl_close(hid_t driver_id, void *dxpl)
-{
- H5FD_class_t *driver;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check args */
- if(driver_id > 0) {
- if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
-
- /* Close the driver for the property list */
- if(H5FD_pl_close(driver_id, driver->dxpl_free, dxpl) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver fapl_free request failed")
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_dxpl_close() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5FDopen
*
* Purpose: Opens a file named NAME for the type(s) of access described
@@ -1457,9 +1333,9 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
if(size == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request")
if(H5P_DEFAULT == dxpl_id)
- dxpl_id= H5P_DATASET_XFER_DEFAULT;
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
else
- if(TRUE != H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list")
/* Do the real work */
@@ -1509,9 +1385,9 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz
if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type")
if(H5P_DEFAULT == dxpl_id)
- dxpl_id= H5P_DATASET_XFER_DEFAULT;
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
else
- if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
/* Do the real work */
@@ -1797,7 +1673,7 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size
/* Get the default dataset transfer property list if the user didn't provide one */
if(H5P_DEFAULT == dxpl_id)
- dxpl_id= H5P_DATASET_XFER_DEFAULT;
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
else
if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
@@ -1966,7 +1842,7 @@ H5FDtruncate(H5FD_t *file, hid_t dxpl_id, unsigned closing)
if(H5P_DEFAULT == dxpl_id)
dxpl_id = H5P_DATASET_XFER_DEFAULT;
else
- if(TRUE != H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
/* Do the real work */
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 1fef36c..932e2af 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -184,7 +184,7 @@ static const H5FD_class_t H5FD_core_g = {
H5FD_core_truncate, /*truncate */
NULL, /*lock */
NULL, /*unlock */
- H5FD_FLMAP_SINGLE /*fl_map */
+ H5FD_FLMAP_DICHOTOMY /*fl_map */
};
@@ -427,8 +427,9 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id,
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "maxaddr overflow")
HDassert(H5P_DEFAULT != fapl_id);
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- fa = (H5FD_core_fapl_t *)H5P_get_driver_info(plist);
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
+ if(NULL == (fa = (H5FD_core_fapl_t *)H5P_get_driver_info(plist)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
/* Build the open flags */
o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY;
@@ -443,6 +444,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id,
/* If the file image exists and this is an open, make sure the file doesn't exist */
HDassert(((file_image_info.buffer != NULL) && (file_image_info.size > 0)) ||
((file_image_info.buffer == NULL) && (file_image_info.size == 0)));
+ HDmemset(&sb, 0, sizeof(sb));
if((file_image_info.buffer != NULL) && !(H5F_ACC_CREAT & flags)) {
if(HDopen(name, o_flags, 0666) >= 0)
HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file already exists")
@@ -462,7 +464,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id,
* store is off is when the backing_store flag is off and H5F_ACC_CREAT is
* on. */
else if(fa->backing_store || !(H5F_ACC_CREAT & flags)) {
- if(fa && (fd = HDopen(name, o_flags, 0666)) < 0)
+ if((fd = HDopen(name, o_flags, 0666)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
if(HDfstat(fd, &sb) < 0)
HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file")
@@ -479,7 +481,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id,
* default value. But if the file access property list was zero then use
* the default value instead.
*/
- file->increment = (fa && fa->increment>0) ? fa->increment : H5FD_CORE_INCREMENT;
+ file->increment = (fa->increment>0) ? fa->increment : H5FD_CORE_INCREMENT;
/* If save data in backing store. */
file->backing_store = fa->backing_store;
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 218a1dd..4721a44 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -205,7 +205,7 @@ static const H5FD_class_t H5FD_direct_g = {
H5FD_direct_truncate, /*truncate */
NULL, /*lock */
NULL, /*unlock */
- H5FD_FLMAP_SINGLE /*fl_map */
+ H5FD_FLMAP_DICHOTOMY /*fl_map */
};
/* Declare a free list to manage the H5FD_direct_t struct */
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 6f6d757..f051269 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -82,18 +82,11 @@ typedef struct H5FD_family_fapl_t {
hid_t memb_fapl_id; /*file access property list of each memb*/
} H5FD_family_fapl_t;
-/* Driver specific data transfer properties */
-typedef struct H5FD_family_dxpl_t {
- hid_t memb_dxpl_id; /*data xfer property list of each memb */
-} H5FD_family_dxpl_t;
-
/* Callback prototypes */
static herr_t H5FD_family_term(void);
static void *H5FD_family_fapl_get(H5FD_t *_file);
static void *H5FD_family_fapl_copy(const void *_old_fa);
static herr_t H5FD_family_fapl_free(void *_fa);
-static void *H5FD_family_dxpl_copy(const void *_old_dx);
-static herr_t H5FD_family_dxpl_free(void *_dx);
static hsize_t H5FD_family_sb_size(H5FD_t *_file);
static herr_t H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/,
unsigned char *buf/*out*/);
@@ -128,9 +121,9 @@ static const H5FD_class_t H5FD_family_g = {
H5FD_family_fapl_get, /*fapl_get */
H5FD_family_fapl_copy, /*fapl_copy */
H5FD_family_fapl_free, /*fapl_free */
- sizeof(H5FD_family_dxpl_t), /*dxpl_size */
- H5FD_family_dxpl_copy, /*dxpl_copy */
- H5FD_family_dxpl_free, /*dxpl_free */
+ 0, /*dxpl_size */
+ NULL, /*dxpl_copy */
+ NULL, /*dxpl_free */
H5FD_family_open, /*open */
H5FD_family_close, /*close */
H5FD_family_cmp, /*cmp */
@@ -148,7 +141,7 @@ static const H5FD_class_t H5FD_family_g = {
H5FD_family_truncate, /*truncate */
NULL, /*lock */
NULL, /*unlock */
- H5FD_FLMAP_SINGLE /*fl_map */
+ H5FD_FLMAP_DICHOTOMY /*fl_map */
};
@@ -482,92 +475,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_family_dxpl_copy
- *
- * Purpose: Copes the family-specific data transfer properties.
- *
- * Return: Success: Ptr to new property list
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5FD_family_dxpl_copy(const void *_old_dx)
-{
- const H5FD_family_dxpl_t *old_dx = (const H5FD_family_dxpl_t*)_old_dx;
- H5FD_family_dxpl_t *new_dx = NULL;
- H5P_genplist_t *plist; /* Property list pointer */
- void *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- if(NULL == (new_dx = (H5FD_family_dxpl_t *)H5MM_malloc(sizeof(H5FD_family_dxpl_t))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
-
- HDmemcpy(new_dx, old_dx, sizeof(H5FD_family_dxpl_t));
-
- if(old_dx->memb_dxpl_id == H5P_DATASET_XFER_DEFAULT) {
- if(H5I_inc_ref(new_dx->memb_dxpl_id, FALSE)<0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver")
- } /* end if */
- else {
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(old_dx->memb_dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- new_dx->memb_dxpl_id = H5P_copy_plist(plist, FALSE);
- } /* end else */
-
- /* Set return value */
- ret_value=new_dx;
-
-done:
- if(ret_value==NULL) {
- if(new_dx!=NULL)
- H5MM_xfree(new_dx);
- } /* end if */
- FUNC_LEAVE_NOAPI(ret_value)
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5FD_family_dxpl_free
- *
- * Purpose: Frees the family-specific data transfer properties.
- *
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5FD_family_dxpl_free(void *_dx)
-{
- H5FD_family_dxpl_t *dx = (H5FD_family_dxpl_t*)_dx;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- if(H5I_dec_ref(dx->memb_dxpl_id) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID")
- H5MM_xfree(dx);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-}
-
-
-/*-------------------------------------------------------------------------
* Function: H5FD_family_sb_size
*
* Purpose: Returns the size of the private information to be stored in
@@ -1239,7 +1146,6 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si
{
H5FD_family_t *file = (H5FD_family_t*)_file;
unsigned char *buf = (unsigned char*)_buf;
- hid_t memb_dxpl_id = H5P_DATASET_XFER_DEFAULT;
haddr_t sub;
size_t req;
hsize_t tempreq;
@@ -1255,13 +1161,6 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si
*/
if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- if(H5P_DATASET_XFER_DEFAULT != dxpl_id && H5FD_FAMILY == H5P_get_driver(plist)) {
- H5FD_family_dxpl_t *dx = (H5FD_family_dxpl_t *)H5P_get_driver_info(plist);
-
- HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
- assert(dx);
- memb_dxpl_id = dx->memb_dxpl_id;
- } /* end if */
/* Read from each member */
while(size > 0) {
@@ -1279,7 +1178,7 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si
assert(u<file->nmembs);
- if (H5FDread(file->memb[u], type, memb_dxpl_id, sub, req, buf)<0)
+ if (H5FDread(file->memb[u], type, dxpl_id, sub, req, buf)<0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "member file read failed")
addr += req;
@@ -1316,7 +1215,6 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s
{
H5FD_family_t *file = (H5FD_family_t*)_file;
const unsigned char *buf = (const unsigned char*)_buf;
- hid_t memb_dxpl_id = H5P_DATASET_XFER_DEFAULT;
haddr_t sub;
size_t req;
hsize_t tempreq;
@@ -1332,13 +1230,6 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s
*/
if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- if(H5P_DATASET_XFER_DEFAULT != dxpl_id && H5FD_FAMILY == H5P_get_driver(plist)) {
- H5FD_family_dxpl_t *dx = (H5FD_family_dxpl_t *)H5P_get_driver_info(plist);
-
- HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
- HDassert(dx);
- memb_dxpl_id = dx->memb_dxpl_id;
- } /* end if */
/* Write to each member */
while (size>0) {
@@ -1356,7 +1247,7 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s
assert(u<file->nmembs);
- if (H5FDwrite(file->memb[u], type, memb_dxpl_id, sub, req, buf)<0)
+ if (H5FDwrite(file->memb[u], type, dxpl_id, sub, req, buf)<0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "member file write failed")
addr += req;
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index b2c6398..6a2425c 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -233,7 +233,7 @@ static const H5FD_class_t H5FD_log_g = {
H5FD_log_truncate, /*truncate */
NULL, /*lock */
NULL, /*unlock */
- H5FD_FLMAP_SINGLE /*fl_map */
+ H5FD_FLMAP_DICHOTOMY /*fl_map */
};
/* Declare a free list to manage the H5FD_log_t struct */
diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c
index 01c28e6..866a2cf 100644
--- a/src/H5FDmpi.c
+++ b/src/H5FDmpi.c
@@ -56,12 +56,15 @@ char H5FD_mpi_native_g[] = "native";
int
H5FD_mpi_get_rank(const H5FD_t *file)
{
- const H5FD_class_mpi_t *cls=(const H5FD_class_mpi_t *)(file->cls);
+ const H5FD_class_mpi_t *cls;
+
int ret_value;
FUNC_ENTER_NOAPI(FAIL)
- assert(file && cls);
+ assert(file);
+ cls = (const H5FD_class_mpi_t *)(file->cls);
+ assert(cls);
assert(cls->get_rank); /* All MPI drivers must implement this */
/* Dispatch to driver */
@@ -92,12 +95,14 @@ done:
int
H5FD_mpi_get_size(const H5FD_t *file)
{
- const H5FD_class_mpi_t *cls=(const H5FD_class_mpi_t *)(file->cls);
+ const H5FD_class_mpi_t *cls;
int ret_value;
FUNC_ENTER_NOAPI(FAIL)
- assert(file && cls);
+ assert(file);
+ cls = (const H5FD_class_mpi_t *)(file->cls);
+ assert(cls);
assert(cls->get_size); /* All MPI drivers must implement this */
/* Dispatch to driver */
@@ -128,12 +133,14 @@ done:
MPI_Comm
H5FD_mpi_get_comm(const H5FD_t *file)
{
- const H5FD_class_mpi_t *cls=(const H5FD_class_mpi_t *)(file->cls);
+ const H5FD_class_mpi_t *cls;
MPI_Comm ret_value;
FUNC_ENTER_NOAPI(MPI_COMM_NULL)
- assert(file && cls);
+ assert(file);
+ cls = (const H5FD_class_mpi_t *)(file->cls);
+ assert(cls);
assert(cls->get_comm); /* All MPI drivers must implement this */
/* Dispatch to driver */
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 6dbe831..cac101b 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -127,7 +127,7 @@ static const H5FD_class_mpi_t H5FD_mpio_g = {
H5FD_mpio_truncate, /*truncate */
NULL, /*lock */
NULL, /*unlock */
- H5FD_FLMAP_SINGLE /*fl_map */
+ H5FD_FLMAP_DICHOTOMY /*fl_map */
}, /* End of superclass information */
H5FD_mpio_mpi_rank, /*get_rank */
H5FD_mpio_mpi_size, /*get_size */
@@ -449,27 +449,23 @@ done:
* Use collective I/O access.
*
* Return: Success: Non-negative
- *
* Failure: Negative
*
* Programmer: Albert Cheng
* April 2, 1998
*
- * Modifications:
- * Robb Matzke, 1999-08-06
- * Modified to work with the virtual file layer.
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iDt", dxpl_id, xfer_mode);
- if(dxpl_id==H5P_DEFAULT)
+ if(dxpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
/* Check arguments */
@@ -479,15 +475,12 @@ H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incorrect xfer_mode")
/* Set the transfer mode */
- if (H5P_set(plist,H5D_XFER_IO_XFER_MODE_NAME,&xfer_mode)<0)
+ if(H5P_set(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- /* Initialize driver-specific properties */
- ret_value= H5P_set_driver(plist, H5FD_MPIO, NULL);
-
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_dxpl_mpio() */
/*-------------------------------------------------------------------------
@@ -505,63 +498,54 @@ done:
* Programmer: Albert Cheng
* April 2, 1998
*
- * Modifications:
- * Robb Matzke, 1999-08-06
- * Modified to work with the virtual file layer.
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode/*out*/)
{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", dxpl_id, xfer_mode);
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
- if(H5FD_MPIO != H5P_get_driver(plist))
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver")
/* Get the transfer mode */
- if (xfer_mode)
- if (H5P_get(plist,H5D_XFER_IO_XFER_MODE_NAME,xfer_mode)<0)
+ if(xfer_mode)
+ if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, xfer_mode) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_dxpl_mpio() */
+
/*-------------------------------------------------------------------------
* Function: H5Pset_dxpl_mpio_collective_opt
-
-Purpose:
- To set a flag to choose linked chunk IO or multi-chunk IO without
- involving decision-making inside HDF5
-
-Description:
- The library will do linked chunk IO or multi-chunk IO without
- involving communications for decision-making process.
- The library won't behave as it asks for only when we find
- that the low-level MPI-IO package doesn't support this.
-
-Parameters:
- hid_t dxpl_id in: Data transfer property list identifier
- H5FD_mpio_chunk_opt_t in: The optimization flag for linked chunk IO
- or multi-chunk IO.
-
-
-Returns:
-Returns a non-negative value if successful. Otherwise returns a negative value.
-*
+ *
+ * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O
+ * without involving decision-making inside HDF5
+ *
+ * Note: The library will do linked chunk I/O or multi-chunk I/O without
+ * involving communications for decision-making process.
+ * The library won't behave as it asks for only when we find
+ * that the low-level MPI-IO package doesn't support this.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Kent Yang
+ * ? ?, ?
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_dxpl_mpio_collective_opt(hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mode)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iDc", dxpl_id, opt_mode);
@@ -577,9 +561,6 @@ H5Pset_dxpl_mpio_collective_opt(hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mo
if(H5P_set(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &opt_mode) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- /* Initialize driver-specific properties */
- ret_value = H5P_set_driver(plist, H5FD_MPIO, NULL);
-
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_dxpl_mpio_collective_opt() */
@@ -587,33 +568,28 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Pset_dxpl_mpio_chunk_opt
-
-Purpose:
- To set a flag to choose linked chunk IO or multi-chunk IO without
- involving decision-making inside HDF5
-
-Description:
- The library will do linked chunk IO or multi-chunk IO without
- involving communications for decision-making process.
- The library won't behave as it asks for only when we find
- that the low-level MPI-IO package doesn't support this.
-
-Parameters:
- hid_t dxpl_id in: Data transfer property list identifier
- H5FD_mpio_chunk_opt_t in: The optimization flag for linked chunk IO
- or multi-chunk IO.
-
-
-Returns:
-Returns a non-negative value if successful. Otherwise returns a negative value.
-*
+ *
+ * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O
+ * without involving decision-making inside HDF5
+ *
+ * Note: The library will do linked chunk I/O or multi-chunk I/O without
+ * involving communications for decision-making process.
+ * The library won't behave as it asks for only when we find
+ * that the low-level MPI-IO package doesn't support this.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Kent Yang
+ * ? ?, ?
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_dxpl_mpio_chunk_opt(hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iDh", dxpl_id, opt_mode);
@@ -626,41 +602,36 @@ H5Pset_dxpl_mpio_chunk_opt(hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode)
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Set the transfer mode */
- if (H5P_set(plist,H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME,&opt_mode)<0)
+ if(H5P_set(plist, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, &opt_mode) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- /* Initialize driver-specific properties */
- ret_value= H5P_set_driver(plist, H5FD_MPIO, NULL);
-
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_dxpl_mpio_chunk_opt() */
/*-------------------------------------------------------------------------
* Function: H5Pset_dxpl_mpio_chunk_opt_num
-
-Purpose:
- To set a threshold for doing linked chunk IO
-
-Description:
- If the number is greater than the threshold set by the user,
- the library will do linked chunk IO; otherwise, IO will be done for every chunk.
-
-Parameters:
- hid_t dxpl_id in: Data transfer property list identifier
- unsigned num_proc_per_chunk in: the threshold of the average number of chunks selected by each process
-
-Returns:
-Returns a non-negative value if successful. Otherwise returns a negative value.
-*
+ *
+ * Purpose: To set a threshold for doing linked chunk IO
+ *
+ * Note: If the number is greater than the threshold set by the user,
+ * the library will do linked chunk I/O; otherwise, I/O will be
+ * done for every chunk.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Kent Yang
+ * ? ?, ?
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_dxpl_mpio_chunk_opt_num(hid_t dxpl_id, unsigned num_chunk_per_proc)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iIu", dxpl_id, num_chunk_per_proc);
@@ -673,41 +644,39 @@ H5Pset_dxpl_mpio_chunk_opt_num(hid_t dxpl_id, unsigned num_chunk_per_proc)
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Set the transfer mode */
- if (H5P_set(plist,H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME,&num_chunk_per_proc)<0)
+ if(H5P_set(plist, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, &num_chunk_per_proc) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- /* Initialize driver-specific properties */
- ret_value= H5P_set_driver(plist, H5FD_MPIO, NULL);
-
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_dxpl_mpio_chunk_opt_num() */
/*-------------------------------------------------------------------------
* Function: H5Pset_dxpl_mpio_chunk_opt_ratio
-
-Purpose:
- To set a threshold for doing collective IO for each chunk
-Description:
- The library will calculate the percentage of the number of process holding selections at each chunk. If that percentage of number of process in the individual chunk is greater than the threshold set by the user, the library will do collective chunk IO for this chunk; otherwise, independent IO will be done for this chunk.
-Parameters:
- hid_t dxpl_id
- in: Data transfer property list identifier
- unsigned percent_num_proc_per_chunk
- in: the threshold of the percentage of the number of process holding selections per chunk
-Returns:
-Returns a non-negative value if successful. Otherwise returns a negative value.
-
-
-*
+ *
+ * Purpose: To set a threshold for doing collective I/O for each chunk
+ *
+ * Note: The library will calculate the percentage of the number of
+ * process holding selections at each chunk. If that percentage
+ * of number of process in the individual chunk is greater than
+ * the threshold set by the user, the library will do collective
+ * chunk I/O for this chunk; otherwise, independent I/O will be
+ * done for this chunk.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Kent Yang
+ * ? ?, ?
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_num_proc_per_chunk)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iIu", dxpl_id, percent_num_proc_per_chunk);
@@ -720,15 +689,12 @@ H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_num_proc_per_ch
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Set the transfer mode */
- if (H5P_set(plist,H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME,&percent_num_proc_per_chunk)<0)
+ if(H5P_set(plist, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, &percent_num_proc_per_chunk) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- /* Initialize driver-specific properties */
- ret_value= H5P_set_driver(plist, H5FD_MPIO, NULL);
-
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_dxpl_mpio_chunk_opt_ratio() */
/*-------------------------------------------------------------------------
@@ -745,10 +711,6 @@ done:
* Programmer: Robb Matzke
* Friday, August 13, 1999
*
- * Modifications:
- * Albert Cheng, 2003-04-17
- * Duplicate the communicator and Info object so that the new
- * property list is insulated from the old one.
*-------------------------------------------------------------------------
*/
static void *
@@ -790,8 +752,6 @@ done:
* Programmer: Albert Cheng
* Jan 8, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void *
diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c
index e6c23f0..261f427 100644
--- a/src/H5FDmpiposix.c
+++ b/src/H5FDmpiposix.c
@@ -37,15 +37,15 @@
#define H5_INTERFACE_INIT_FUNC H5FD_mpiposix_init_interface
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5FDmpi.h" /* MPI-based file drivers */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FDmpi.h" /* MPI-based file drivers */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
/* Features:
* H5_HAVE_GPFS -- issue gpfs_fcntl() calls to hopefully improve
@@ -71,107 +71,101 @@
*/
static hid_t H5FD_MPIPOSIX_g = 0;
-/* File operations */
-#define OP_UNKNOWN 0
-#define OP_READ 1
-#define OP_WRITE 2
+/* Since Windows doesn't follow the rest of the world when it comes
+ * to POSIX I/O types, some typedefs and constants are needed to avoid
+ * making the code messy with #ifdefs.
+ */
+#ifdef H5_HAVE_WIN32_API
+typedef unsigned int h5_mpiposix_io_t;
+typedef int h5_mpiposix_io_ret_t;
+static int H5_MPIPOSIX_MAX_IO_BYTES_g = INT_MAX;
+#else
+/* Unix, everyone else */
+typedef size_t h5_mpiposix_io_t;
+typedef ssize_t h5_mpiposix_io_ret_t;
+static size_t H5_MPIPOSIX_MAX_IO_BYTES_g = SSIZET_MAX;
+#endif /* H5_HAVE_WIN32_API */
/*
* The description of a file belonging to this driver.
- * The EOF value
- * is only used just after the file is opened in order for the library to
- * determine whether the file is empty, truncated, or okay. The MPIPOSIX driver
- * doesn't bother to keep it updated since it's an expensive operation.
+ * The EOF value is only used just after the file is opened in order for the
+ * library to determine whether the file is empty, truncated, or okay. The
+ * MPIPOSIX driver doesn't bother to keep it updated since it's an expensive
+ * operation.
*/
typedef struct H5FD_mpiposix_t {
- H5FD_t pub; /*public stuff, must be first */
- int fd; /*the unix file handle */
- MPI_Comm comm; /*communicator */
- int mpi_rank; /* This process's rank */
- int mpi_size; /* Total number of processes */
- haddr_t eof; /*end-of-file marker */
- haddr_t eoa; /*end-of-address marker */
- haddr_t last_eoa; /* Last known end-of-address marker */
- haddr_t pos; /* Current file I/O position */
- int op; /* Last file I/O operation */
- hsize_t naccess; /* Number of (write) accesses to file */
+ H5FD_t pub; /* public stuff, must be first */
+ int fd; /* the unix file handle */
+ MPI_Comm comm; /* communicator */
+ int mpi_rank; /* This process's rank */
+ int mpi_size; /* Total number of processes */
+ haddr_t eof; /* end-of-file marker */
+ haddr_t eoa; /* end-of-address marker */
+ haddr_t last_eoa; /* Last known end-of-address marker */
+ haddr_t pos; /* Current file I/O position */
+ H5FD_file_op_t op; /* Last file I/O operation */
+ hsize_t naccess; /* Number of (write) accesses to file */
#ifdef H5_HAVE_GPFS
- size_t blksize; /* Block size of file system */
+ size_t blksize; /* Block size of file system */
#endif
- hbool_t use_gpfs; /* Use GPFS to write things */
+ hbool_t use_gpfs; /* Use GPFS to write things */
#ifndef H5_HAVE_WIN32_API
- /*
- * On most systems the combination of device and i-node number uniquely
- * identify a file.
+ /* On most systems the combination of device and i-node number uniquely
+ * identify a file. Note that Cygwin, MinGW and other Windows POSIX
+ * environments have the stat function (which fakes inodes)
+ * and will use the 'device + inodes' scheme as opposed to the
+ * Windows code further below.
*/
- dev_t device; /*file device number */
- ino_t inode; /*file i-node number */
+ dev_t device; /* file device number */
+#ifdef H5_VMS
+ ino_t inode[3]; /* file i-node number */
#else
- /*
- * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the
- * file and the volume serial number uniquely identify a file. This number
- * (which, both? -rpm) may change when the system is restarted or when the
- * file is opened. After a process opens a file, the identifier is
- * constant until the file is closed. An application can use this
- * identifier and the volume serial number to determine whether two
- * handles refer to the same file.
+ ino_t inode; /* file i-node number */
+#endif /* H5_VMS */
+#else
+ /* Files in windows are uniquely identified by the volume serial
+ * number and the file index (both low and high parts).
+ *
+ * There are caveats where these numbers can change, especially
+ * on FAT file systems. On NTFS, however, a file should keep
+ * those numbers the same until renamed or deleted (though you
+ * can use ReplaceFile() on NTFS to keep the numbers the same
+ * while renaming).
+ *
+ * See the MSDN "BY_HANDLE_FILE_INFORMATION Structure" entry for
+ * more information.
+ *
+ * http://msdn.microsoft.com/en-us/library/aa363788(v=VS.85).aspx
*/
- int fileindexlo;
- int fileindexhi;
-#endif
+ DWORD nFileIndexLow;
+ DWORD nFileIndexHigh;
+ DWORD dwVolumeSerialNumber;
+
+ HANDLE hFile; /* Native windows file handle */
+#endif /* H5_HAVE_WIN32_API */
} H5FD_mpiposix_t;
/*
- * This driver supports systems that have the lseek64() function by defining
- * some macros here so we don't have to have conditional compilations later
- * throughout the code.
- *
- * file_offset_t: The datatype for file offsets, the second argument of
- * the lseek() or lseek64() call.
- *
- * file_seek: The function which adjusts the current file position,
- * either lseek() or lseek64().
- */
-/* adding for windows NT file system support. */
-
-#ifdef H5_HAVE_LSEEK64
-# define file_offset_t off64_t
-# define file_seek lseek64
-# define file_truncate ftruncate64
-#elif defined (H5_HAVE_WIN32_API)
-# /*MSVC*/
-# define file_offset_t __int64
-# define file_seek _lseeki64
-# define file_truncate _ftruncatei64
-#else
-# define file_offset_t off_t
-# define file_seek HDlseek
-# define file_truncate HDftruncate
-#endif
-
-/*
* These macros check for overflow of various quantities. These macros
- * assume that file_offset_t is signed and haddr_t and size_t are unsigned.
+ * assume that HDoff_t is signed and haddr_t and size_t are unsigned.
*
- * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t'
- * is too large to be represented by the second argument
- * of the file seek function.
+ * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t'
+ * is too large to be represented by the second argument
+ * of the file seek function.
*
- * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too
- * large to be represented by the `size_t' type.
+ * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too
+ * large to be represented by the `size_t' type.
*
- * REGION_OVERFLOW: Checks whether an address and size pair describe data
- * which can be addressed entirely by the second
- * argument of the file seek function.
+ * REGION_OVERFLOW: Checks whether an address and size pair describe data
+ * which can be addressed entirely by the second
+ * argument of the file seek function.
*/
-#define MAXADDR (((haddr_t)1<<(8*sizeof(file_offset_t)-1))-1)
-#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \
- ((A) & ~(haddr_t)MAXADDR))
-#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR)
-#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \
- sizeof(file_offset_t)<sizeof(size_t) || \
- HADDR_UNDEF==(A)+(Z) || \
- (file_offset_t)((A)+(Z))<(file_offset_t)(A))
+#define MAXADDR (((haddr_t)1 << (8*sizeof(HDoff_t) - 1)) - 1)
+#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR))
+#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR)
+#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \
+ HADDR_UNDEF == (A) + (Z) || \
+ (HDoff_t)((A) + (Z)) < (HDoff_t)(A))
/* Callbacks */
static herr_t H5FD_mpiposix_term(void);
@@ -198,49 +192,49 @@ static MPI_Comm H5FD_mpiposix_communicator(const H5FD_t *_file);
/* MPIPOSIX-specific file access properties */
typedef struct H5FD_mpiposix_fapl_t {
- hbool_t use_gpfs; /*use GPFS hints */
- MPI_Comm comm; /*communicator */
+ hbool_t use_gpfs; /* use GPFS hints */
+ MPI_Comm comm; /* communicator */
} H5FD_mpiposix_fapl_t;
/* The MPIPOSIX file driver information */
static const H5FD_class_mpi_t H5FD_mpiposix_g = {
{ /* Start of superclass information */
- "mpiposix", /*name */
- MAXADDR, /*maxaddr */
- H5F_CLOSE_SEMI, /* fc_degree */
- H5FD_mpiposix_term, /*terminate */
- NULL, /*sb_size */
- NULL, /*sb_encode */
- NULL, /*sb_decode */
- sizeof(H5FD_mpiposix_fapl_t), /*fapl_size */
- H5FD_mpiposix_fapl_get, /*fapl_get */
- H5FD_mpiposix_fapl_copy, /*fapl_copy */
- H5FD_mpiposix_fapl_free, /*fapl_free */
- 0, /*dxpl_size */
- NULL, /*dxpl_copy */
- NULL, /*dxpl_free */
- H5FD_mpiposix_open, /*open */
- H5FD_mpiposix_close, /*close */
- H5FD_mpiposix_cmp, /*cmp */
- H5FD_mpiposix_query, /*query */
- NULL, /*get_type_map */
- NULL, /*alloc */
- NULL, /*free */
- H5FD_mpiposix_get_eoa, /*get_eoa */
- H5FD_mpiposix_set_eoa, /*set_eoa */
- H5FD_mpiposix_get_eof, /*get_eof */
- H5FD_mpiposix_get_handle, /*get_handle */
- H5FD_mpiposix_read, /*read */
- H5FD_mpiposix_write, /*write */
- NULL, /*flush */
- H5FD_mpiposix_truncate, /*truncate */
- NULL, /*lock */
- NULL, /*unlock */
- H5FD_FLMAP_SINGLE /*fl_map */
+ "mpiposix", /* name */
+ MAXADDR, /* maxaddr */
+ H5F_CLOSE_SEMI, /* fc_degree */
+ H5FD_mpiposix_term, /* terminate */
+ NULL, /* sb_size */
+ NULL, /* sb_encode */
+ NULL, /* sb_decode */
+ sizeof(H5FD_mpiposix_fapl_t), /* fapl_size */
+ H5FD_mpiposix_fapl_get, /* fapl_get */
+ H5FD_mpiposix_fapl_copy, /* fapl_copy */
+ H5FD_mpiposix_fapl_free, /* fapl_free */
+ 0, /* dxpl_size */
+ NULL, /* dxpl_copy */
+ NULL, /* dxpl_free */
+ H5FD_mpiposix_open, /* open */
+ H5FD_mpiposix_close, /* close */
+ H5FD_mpiposix_cmp, /* cmp */
+ H5FD_mpiposix_query, /* query */
+ NULL, /* get_type_map */
+ NULL, /* alloc */
+ NULL, /* free */
+ H5FD_mpiposix_get_eoa, /* get_eoa */
+ H5FD_mpiposix_set_eoa, /* set_eoa */
+ H5FD_mpiposix_get_eof, /* get_eof */
+ H5FD_mpiposix_get_handle, /* get_handle */
+ H5FD_mpiposix_read, /* read */
+ H5FD_mpiposix_write, /* write */
+ NULL, /* flush */
+ H5FD_mpiposix_truncate, /* truncate */
+ NULL, /* lock */
+ NULL, /* unlock */
+ H5FD_FLMAP_SINGLE /* fl_map */
}, /* End of superclass information */
- H5FD_mpiposix_mpi_rank, /*get_rank */
- H5FD_mpiposix_mpi_size, /*get_size */
- H5FD_mpiposix_communicator /*get_comm */
+ H5FD_mpiposix_mpi_rank, /* get_rank */
+ H5FD_mpiposix_mpi_size, /* get_size */
+ H5FD_mpiposix_communicator /* get_comm */
};
@@ -267,34 +261,31 @@ H5FD_mpiposix_init_interface(void)
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_init
- *
- * Purpose: Initialize this driver by registering the driver with the
- * library.
+ * Function: H5FD_mpiposix_init
*
- * Return: Success: The driver ID for the mpiposix driver.
+ * Purpose: Initialize this driver by registering the driver with the
+ * library.
*
- * Failure: Negative.
+ * Return: Success: The driver ID for the mpiposix driver.
+ * Failure: Negative.
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
H5FD_mpiposix_init(void)
{
- hid_t ret_value=H5FD_MPIPOSIX_g; /* Return value */
+ hid_t ret_value = H5FD_MPIPOSIX_g; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if (H5I_VFL!=H5Iget_type(H5FD_MPIPOSIX_g))
+ if (H5I_VFL != H5Iget_type(H5FD_MPIPOSIX_g))
H5FD_MPIPOSIX_g = H5FD_register((const H5FD_class_t *)&H5FD_mpiposix_g,sizeof(H5FD_class_mpi_t),FALSE);
/* Set return value */
- ret_value=H5FD_MPIPOSIX_g;
+ ret_value = H5FD_MPIPOSIX_g;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -302,11 +293,11 @@ done:
/*---------------------------------------------------------------------------
- * Function: H5FD_mpiposix_term
+ * Function: H5FD_mpiposix_term
*
- * Purpose: Shut down the VFD
+ * Purpose: Shut down the VFD
*
- * Returns: Non-negative on success or negative on failure
+ * Returns: SUCCEED (can't fail)
*
* Programmer: Quincey Koziol
* Friday, Jan 30, 2004
@@ -319,52 +310,41 @@ H5FD_mpiposix_term(void)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Reset VFL ID */
- H5FD_MPIPOSIX_g=0;
+ H5FD_MPIPOSIX_g = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD_mpiposix_term() */
/*-------------------------------------------------------------------------
- * Function: H5Pset_fapl_mpiposix
+ * Function: H5Pset_fapl_mpiposix
*
- * Purpose: Store the user supplied MPI communicator COMM in
- * the file access property list FAPL_ID which can then be used
- * to create and/or open the file. This function is available
- * only in the parallel HDF5 library and is not collective.
+ * Purpose: Store the user supplied MPI communicator COMM in
+ * the file access property list FAPL_ID which can then be used
+ * to create and/or open the file. This function is available
+ * only in the parallel HDF5 library and is not collective.
*
- * comm is the MPI communicator to be used for file open as
- * defined in MPI_FILE_OPEN of MPI-2. This function makes a
- * duplicate of comm. Any modification to comm after this function
- * call returns has no effect on the access property list.
+ * comm is the MPI communicator to be used for file open as
+ * defined in MPI_FILE_OPEN of MPI-2. This function makes a
+ * duplicate of comm. Any modification to comm after this function
+ * call returns has no effect on the access property list.
*
* If fapl_id has previously set comm value, it will be replaced
* and the old communicator is freed.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * Thursday, July 11, 2002
- *
- * Modifications:
- * Albert Cheng, 2003-04-24
- * Modified the description of the function that it now stores
- * a duplicate of the communicator. Free the old duplicate if
- * previously set. (Work is actually done by H5P_set_driver.)
- *
- * Bill Wendling, 2003-05-01
- * Modified to take an extra flag indicating that we should
- * use the GPFS hints (if available) for this file.
+ * Thursday, July 11, 2002
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_fapl_mpiposix(hid_t fapl_id, MPI_Comm comm, hbool_t use_gpfs)
{
- H5FD_mpiposix_fapl_t fa;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value;
+ H5FD_mpiposix_fapl_t fa;
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value;
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iMcb", fapl_id, comm, use_gpfs);
@@ -373,14 +353,14 @@ H5Pset_fapl_mpiposix(hid_t fapl_id, MPI_Comm comm, hbool_t use_gpfs)
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list")
if (MPI_COMM_NULL == comm)
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator")
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator")
/* Initialize driver specific properties */
fa.comm = comm;
fa.use_gpfs = use_gpfs;
/* duplication is done during driver setting. */
- ret_value= H5P_set_driver(plist, H5FD_MPIPOSIX, &fa);
+ ret_value = H5P_set_driver(plist, H5FD_MPIPOSIX, &fa);
done:
FUNC_LEAVE_API(ret_value)
@@ -388,57 +368,49 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pget_fapl_mpiposix
- *
- * Purpose: If the file access property list is set to the H5FD_MPIPOSIX
- * driver then this function returns a duplicate of the MPI
- * communicator through the comm pointer. It is the responsibility
- * of the application to free the returned communicator.
- *
- * Return: Success: Non-negative with the communicator and
- * information returned through the COMM
- * argument if non-null. Since it is a duplicate
- * of the stored object, future modifications to
- * the access property list do not affect it and
- * it is the responsibility of the application to
- * free it.
- *
- * Failure: Negative
+ * Function: H5Pget_fapl_mpiposix
+ *
+ * Purpose: If the file access property list is set to the H5FD_MPIPOSIX
+ * driver then this function returns a duplicate of the MPI
+ * communicator through the comm pointer. It is the responsibility
+ * of the application to free the returned communicator.
+ *
+ * Return: Success: Non-negative with the communicator and
+ * information returned through the COMM
+ * argument if non-null. Since it is a duplicate
+ * of the stored object, future modifications to
+ * the access property list do not affect it and
+ * it is the responsibility of the application to
+ * free it.
+ * Failure: Negative
*
* Programmer: Quincey Koziol
- * Thursday, July 11, 2002
- *
- * Modifications:
- * Albert Cheng, 2003-04-24
- * Return duplicate of the stored communicator.
- *
- * Bill Wendling, 2003-05-01
- * Return the USE_GPFS flag.
+ * Thursday, July 11, 2002
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_fapl_mpiposix(hid_t fapl_id, MPI_Comm *comm/*out*/, hbool_t *use_gpfs/*out*/)
{
- H5FD_mpiposix_fapl_t *fa;
- H5P_genplist_t *plist; /* Property list pointer */
- int mpi_code; /* mpi return code */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5FD_mpiposix_fapl_t *fa;
+ H5P_genplist_t *plist; /* Property list pointer */
+ int mpi_code; /* mpi return code */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ixx", fapl_id, comm, use_gpfs);
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list")
- if (H5FD_MPIPOSIX!=H5P_get_driver(plist))
+ if (H5FD_MPIPOSIX != H5P_get_driver(plist))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver")
- if (NULL==(fa=H5P_get_driver_info(plist)))
+ if (NULL == (fa = H5P_get_driver_info(plist)))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info")
/* Get MPI Communicator */
if (comm){
- if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, comm)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code)
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_dup(fa->comm, comm)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code)
}
if (use_gpfs)
@@ -450,45 +422,39 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_fapl_get
- *
- * Purpose: Returns a file access property list which could be used to
- * create another file the same as this one.
+ * Function: H5FD_mpiposix_fapl_get
*
- * Return: Success: Ptr to new file access property list with all
- * fields copied from the file pointer.
+ * Purpose: Returns a file access property list which could be used to
+ * create another file the same as this one.
*
- * Failure: NULL
+ * Return: Success: Ptr to new file access property list with all
+ * fields copied from the file pointer.
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- * Albert Cheng, 2003-04-24
- * Duplicate the communicator object so that the new
- * property list is insulated from the old one.
- *
*-------------------------------------------------------------------------
*/
static void *
H5FD_mpiposix_fapl_get(H5FD_t *_file)
{
- H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
- H5FD_mpiposix_fapl_t *fa = NULL;
- int mpi_code; /* MPI return code */
- void *ret_value; /* Return value */
+ H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
+ H5FD_mpiposix_fapl_t *fa = NULL;
+ int mpi_code; /* MPI return code */
+ void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
- if (NULL==(fa=H5MM_calloc(sizeof(H5FD_mpiposix_fapl_t))))
+ if (NULL == (fa = H5MM_calloc(sizeof(H5FD_mpiposix_fapl_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Duplicate the communicator. */
if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(file->comm, &fa->comm)))
- HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code)
+ HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code)
fa->use_gpfs = file->use_gpfs;
@@ -501,19 +467,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_fapl_copy
+ * Function: H5FD_mpiposix_fapl_copy
*
- * Purpose: Copies the mpiposix-specific file access properties.
+ * Purpose: Copies the mpiposix-specific file access properties.
*
- * Return: Success: Ptr to a new property list
- *
- * Failure: NULL
+ * Return: Success: Ptr to a new property list
+ * Failure: NULL
*
* Programmer: Albert Cheng
* Apr 24, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void *
@@ -526,24 +489,24 @@ H5FD_mpiposix_fapl_copy(const void *_old_fa)
FUNC_ENTER_NOAPI_NOINIT
- if (NULL==(new_fa=H5MM_malloc(sizeof(H5FD_mpiposix_fapl_t))))
+ if (NULL == (new_fa = H5MM_malloc(sizeof(H5FD_mpiposix_fapl_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the general information */
HDmemcpy(new_fa, old_fa, sizeof(H5FD_mpiposix_fapl_t));
/* Duplicate communicator. */
- if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(old_fa->comm, &new_fa->comm)))
- HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code)
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_dup(old_fa->comm, &new_fa->comm)))
+ HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code)
new_fa->use_gpfs = old_fa->use_gpfs;
ret_value = new_fa;
done:
if (NULL == ret_value){
- /* cleanup */
- if (new_fa)
- H5MM_xfree(new_fa);
+ /* cleanup */
+ if (new_fa)
+ H5MM_xfree(new_fa);
}
FUNC_LEAVE_NOAPI(ret_value)
@@ -551,19 +514,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_fapl_free
+ * Function: H5FD_mpiposix_fapl_free
*
- * Purpose: Frees the mpiposix-specific file access properties.
+ * Purpose: Frees the mpiposix-specific file access properties.
*
- * Return: Success: 0
- *
- * Failure: -1
+ * Return: SUCCEED (can't fail)
*
* Programmer: Albert Cheng
* Apr 24, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -573,10 +532,10 @@ H5FD_mpiposix_fapl_free(void *_fa)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(fa);
+ HDassert(fa);
/* Free the internal communicator */
- assert(MPI_COMM_NULL!=fa->comm);
+ HDassert(MPI_COMM_NULL != fa->comm);
MPI_Comm_free(&fa->comm);
H5MM_xfree(fa);
@@ -588,53 +547,46 @@ H5FD_mpiposix_fapl_free(void *_fa)
* Function: H5FD_mpiposix_open
*
* Purpose: Opens a file with name NAME. The FLAGS are a bit field with
- * purpose similar to the second argument of open(2) and which
- * are defined in H5Fpublic.h. The file access property list
- * FAPL_ID contains the properties driver properties and MAXADDR
- * is the largest address which this file will be expected to
- * access. This is collective.
+ * purpose similar to the second argument of open(2) and which
+ * are defined in H5Fpublic.h. The file access property list
+ * FAPL_ID contains the properties driver properties and MAXADDR
+ * is the largest address which this file will be expected to
+ * access. This is collective.
*
- * Return: Success: A new file pointer.
- * Failure: NULL
+ * Return: Success: A new file pointer.
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- * Albert Cheng, 2003-04-24
- * Duplicate the communicator so that file is insulated from the
- * old one.
- *
*-------------------------------------------------------------------------
*/
static H5FD_t *
H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr)
{
- H5FD_mpiposix_t *file=NULL; /* New MPIPOSIX file struct */
- int o_flags; /* Flags for file open call */
- int fd=(-1); /* File handle for file opened */
- int mpi_rank; /* MPI rank of this process */
- int mpi_size; /* Total number of MPI processes */
- int mpi_code; /* mpi return code */
- const H5FD_mpiposix_fapl_t *fa=NULL; /* MPIPOSIX file access property list information */
- H5FD_mpiposix_fapl_t _fa; /* Private copy of default file access property list information */
- H5P_genplist_t *plist; /* Property list pointer */
- h5_stat_t sb; /* Portable 'stat' struct */
+ H5FD_mpiposix_t *file = NULL; /* New MPIPOSIX file struct */
+ int o_flags; /* Flags for file open call */
+ int fd = -1; /* File handle for file opened */
+ int mpi_rank; /* MPI rank of this process */
+ int mpi_size; /* Total number of MPI processes */
+ int mpi_code; /* mpi return code */
+ const H5FD_mpiposix_fapl_t *fa = NULL; /* MPIPOSIX file access property list information */
+ H5FD_mpiposix_fapl_t _fa; /* Private copy of default file access property list information */
+ H5P_genplist_t *plist; /* Property list pointer */
+ h5_stat_t sb; /* Portable 'stat' struct */
#ifdef H5_HAVE_WIN32_API
- HFILE filehandle;
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
- int results;
#endif
- H5FD_t *ret_value=NULL; /* Return value */
- MPI_Comm comm_dup=MPI_COMM_NULL;
+ H5FD_t *ret_value = NULL; /* Return value */
+ MPI_Comm comm_dup = MPI_COMM_NULL;
FUNC_ENTER_NOAPI_NOINIT
/* Check arguments */
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name")
- if (0==maxaddr || HADDR_UNDEF==maxaddr)
+ if (0 == maxaddr || HADDR_UNDEF == maxaddr)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr")
if (ADDR_OVERFLOW(maxaddr))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr")
@@ -642,31 +594,31 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
/* Obtain a pointer to mpiposix-specific file access properties */
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- if (H5P_FILE_ACCESS_DEFAULT==fapl_id || H5FD_MPIPOSIX!=H5P_get_driver(plist)) {
- _fa.comm = MPI_COMM_SELF; /*default*/
+ if (H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MPIPOSIX != H5P_get_driver(plist)) {
+ _fa.comm = MPI_COMM_SELF; /*default*/
_fa.use_gpfs = FALSE;
- fa = &_fa;
+ fa = &_fa;
} /* end if */
else {
- fa = H5P_get_driver_info(plist);
- assert(fa);
+ fa = H5P_get_driver_info(plist);
+ HDassert(fa);
} /* end else */
/* Duplicate the communicator for use by this file. */
- if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, &comm_dup)))
- HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code)
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_dup(fa->comm, &comm_dup)))
+ HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code)
/* Get the MPI rank of this process and the total number of processes */
- if (MPI_SUCCESS != (mpi_code=MPI_Comm_rank (comm_dup, &mpi_rank)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank (comm_dup, &mpi_rank)))
HMPI_GOTO_ERROR(NULL, "MPI_Comm_rank failed", mpi_code)
- if (MPI_SUCCESS != (mpi_code=MPI_Comm_size (comm_dup, &mpi_size)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_size (comm_dup, &mpi_size)))
HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code)
/* Build the open flags */
o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY;
/* Only set the creation flag(s) for process 0 */
- if(mpi_rank==0) {
+ if(0 == mpi_rank) {
if (H5F_ACC_TRUNC & flags)
o_flags |= O_TRUNC;
if (H5F_ACC_CREAT & flags)
@@ -680,13 +632,14 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
* open (never create) the file and all processes proceed.
*/
/* Process 0 opens (or creates) file and broadcasts result to other processes */
- if(mpi_rank==0) {
+ if(0 == mpi_rank) {
/* Open the file */
- fd=HDopen(name, o_flags, 0666);
+ fd = HDopen(name, o_flags, 0666);
} /* end if */
- /* Broadcast the results of the open() from process 0 */
- /* This is necessary because of the "tentative open" code in H5F_open()
+ /* Broadcast the results of the open() from process 0
+ *
+ * This is necessary because of the "tentative open" code in H5F_open()
* where the file is attempted to be opened with different flags from the
* user's, in order to check for the file's existence, etc. Here, process 0
* gets different flags from the other processes (since it is in charge of
@@ -698,34 +651,36 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
/* If the file open on process 0 failed, bail out on all processes now */
- if(fd<0)
+ if(fd < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
/* Other processes (non 0) wait for broadcast result from process 0 and then open file */
- if(mpi_rank!=0) {
+ if(mpi_rank != 0) {
/* Open the file */
- if ((fd=HDopen(name, o_flags, 0666))<0)
+ if ((fd = HDopen(name, o_flags, 0666)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
} /* end if */
/* Process 0 fstat()s the file and broadcasts the results to the other processes */
- if(mpi_rank==0) {
+ if(0 == mpi_rank) {
/* Get the stat information */
- if (HDfstat(fd, &sb)<0)
+ if (HDfstat(fd, &sb) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file")
} /* end if */
/* Broadcast the results of the fstat() from process 0 */
- if (MPI_SUCCESS != (mpi_code= MPI_Bcast(&sb, sizeof(h5_stat_t), MPI_BYTE, 0, comm_dup)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Bcast(&sb, sizeof(h5_stat_t), MPI_BYTE, 0, comm_dup)))
HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
#ifdef H5_HAVE_GPFS
if (fa->use_gpfs) {
/*
- * Free all byte range tokens. This is a good thing to do if raw data is aligned on 256kB boundaries (a GPFS page is
- * 256kB). Care should be taken that there aren't too many sub-page writes, or the mmfsd may become overwhelmed. This
- * should probably eventually be passed down here as a property. The gpfs_fcntl() will most likely fail if `fd' isn't
- * on a GPFS file system. */
+ * Free all byte range tokens. This is a good thing to do if raw data
+ * is aligned on 256kB boundaries (a GPFS page is 256kB). Care should
+ * be taken that there aren't too many sub-page writes, or the mmfsd
+ * may become overwhelmed. This should probably eventually be passed
+ * down here as a property. The gpfs_fcntl() will most likely fail if
+ * 'fd' isn't on a GPFS file system. */
struct {
gpfsFcntlHeader_t hdr;
gpfsFreeRange_t fr;
@@ -738,13 +693,13 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
hint.fr.start = 0;
hint.fr.length = 0;
- if (gpfs_fcntl(fd, &hint)<0)
+ if (gpfs_fcntl(fd, &hint) < 0)
HGOTO_ERROR(H5E_FILE, H5E_FCNTL, NULL, "failed to send hints to GPFS")
}
#endif /* H5_HAVE_GPFS */
/* Build the file struct and initialize it */
- if (NULL==(file=H5MM_calloc(sizeof(H5FD_mpiposix_t))))
+ if (NULL == (file=H5MM_calloc(sizeof(H5FD_mpiposix_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
#ifdef REPORT_IO
@@ -755,8 +710,9 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
file->fd = fd;
file->eof = sb.st_size;
- /* for H5_HAVE_WIN32_API support. H5_HAVE_WIN32_API 'stat' does not have st_blksize and st_blksize
- is only used for the H5_HAVE_GPFS case */
+ /* for H5_HAVE_WIN32_API support. H5_HAVE_WIN32_API 'stat' does not have
+ * st_blksize and st_blksize is only used for the H5_HAVE_GPFS case.
+ */
#ifdef H5_HAVE_GPFS
file->blksize = sb.st_blksize;
#endif
@@ -775,26 +731,38 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
/* Set the information for the file's device and inode */
#ifdef H5_HAVE_WIN32_API
- filehandle = _get_osfhandle(fd);
- results = GetFileInformationByHandle((HANDLE)filehandle, &fileinfo);
- file->fileindexhi = fileinfo.nFileIndexHigh;
- file->fileindexlo = fileinfo.nFileIndexLow;
-#else
+ file->hFile = (HANDLE)_get_osfhandle(fd);
+ if(INVALID_HANDLE_VALUE == file->hFile)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file handle")
+
+ if(!GetFileInformationByHandle((HANDLE)file->hFile, &fileinfo))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file information")
+
+ file->nFileIndexHigh = fileinfo.nFileIndexHigh;
+ file->nFileIndexLow = fileinfo.nFileIndexLow;
+ file->dwVolumeSerialNumber = fileinfo.dwVolumeSerialNumber;
+#else /* H5_HAVE_WIN32_API */
file->device = sb.st_dev;
+#ifdef H5_VMS
+ file->inode[0] = sb.st_ino[0];
+ file->inode[1] = sb.st_ino[1];
+ file->inode[2] = sb.st_ino[2];
+#else /* H5_VMS */
file->inode = sb.st_ino;
-#endif
+#endif /* H5_VMS */
+#endif /* H5_HAVE_WIN32_API */
/* Indicate success */
- ret_value=(H5FD_t *)file;
+ ret_value = (H5FD_t *)file;
done:
/* Error cleanup */
- if(ret_value==NULL) {
+ if(NULL == ret_value) {
/* Close the file if it was left open */
- if(fd!=(-1))
+ if(fd != -1)
HDclose(fd);
- if (MPI_COMM_NULL != comm_dup)
- MPI_Comm_free(&comm_dup);
+ if (MPI_COMM_NULL != comm_dup)
+ MPI_Comm_free(&comm_dup);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -806,30 +774,26 @@ done:
*
* Purpose: Closes a file.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- * Albert Cheng, 2003-04-24
- * Free the communicator stored.
*-------------------------------------------------------------------------
*/
static herr_t
H5FD_mpiposix_close(H5FD_t *_file)
{
- H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
- herr_t ret_value=SUCCEED; /* Return value */
+ H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
/* Close the unix file */
- if (HDclose(file->fd)<0)
+ if(HDclose(file->fd) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
/* make sure all processes have closed the file before returning. */
@@ -844,20 +808,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_cmp
+ * Function: H5FD_mpiposix_cmp
*
- * Purpose: Compares two files belonging to this driver using an
- * arbitrary (but consistent) ordering.
+ * Purpose: Compares two files belonging to this driver using an
+ * arbitrary (but consistent) ordering.
*
- * Return: Success: A value like strcmp()
- * Failure: never fails (arguments were checked by the
- * caller).
+ * Return: Success: A value like strcmp()
+ * Failure: never fails (arguments were checked by the caller).
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -865,33 +826,39 @@ H5FD_mpiposix_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
{
const H5FD_mpiposix_t *f1 = (const H5FD_mpiposix_t*)_f1;
const H5FD_mpiposix_t *f2 = (const H5FD_mpiposix_t*)_f2;
- int ret_value=0;
+ int ret_value = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
#ifdef H5_HAVE_WIN32_API
- if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1)
- if (f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1)
+ if(f1->dwVolumeSerialNumber < f2->dwVolumeSerialNumber) HGOTO_DONE(-1)
+ if(f1->dwVolumeSerialNumber > f2->dwVolumeSerialNumber) HGOTO_DONE(1)
- if (f1->fileindexlo < f2->fileindexlo) HGOTO_DONE(-1)
- if (f1->fileindexlo > f2->fileindexlo) HGOTO_DONE(1)
+ if(f1->nFileIndexHigh < f2->nFileIndexHigh) HGOTO_DONE(-1)
+ if(f1->nFileIndexHigh > f2->nFileIndexHigh) HGOTO_DONE(1)
-#else
+ if(f1->nFileIndexLow < f2->nFileIndexLow) HGOTO_DONE(-1)
+ if(f1->nFileIndexLow > f2->nFileIndexLow) HGOTO_DONE(1)
+#else /* H5_HAVE_WIN32_API */
#ifdef H5_DEV_T_IS_SCALAR
- if (f1->device < f2->device) HGOTO_DONE(-1)
- if (f1->device > f2->device) HGOTO_DONE(1)
+ if(f1->device < f2->device) HGOTO_DONE(-1)
+ if(f1->device > f2->device) HGOTO_DONE(1)
#else /* H5_DEV_T_IS_SCALAR */
/* If dev_t isn't a scalar value on this system, just use memcmp to
* determine if the values are the same or not. The actual return value
* shouldn't really matter...
*/
- if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))<0) HGOTO_DONE(-1)
- if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))>0) HGOTO_DONE(1)
+ if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t)) < 0) HGOTO_DONE(-1)
+ if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t)) > 0) HGOTO_DONE(1)
#endif /* H5_DEV_T_IS_SCALAR */
-
- if (f1->inode < f2->inode) HGOTO_DONE(-1)
- if (f1->inode > f2->inode) HGOTO_DONE(1)
-#endif
+#ifdef H5_VMS
+ if(HDmemcmp(&(f1->inode), &(f2->inode), 3 * sizeof(ino_t)) < 0) HGOTO_DONE(-1)
+ if(HDmemcmp(&(f1->inode), &(f2->inode), 3 * sizeof(ino_t)) > 0) HGOTO_DONE(1)
+#else /* H5_VMS */
+ if(f1->inode < f2->inode) HGOTO_DONE(-1)
+ if(f1->inode > f2->inode) HGOTO_DONE(1)
+#endif /* H5_VMS */
+#endif /* H5_HAVE_WIN32_API */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -899,25 +866,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_query
+ * Function: H5FD_mpiposix_query
*
- * Purpose: Set the flags that this VFL driver is capable of supporting.
+ * Purpose: Set the flags that this VFL driver is capable of supporting.
* (listed in H5FDpublic.h)
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: SUCCEED (can't fail)
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
- * John Mainzer -- 9/21/05
- * Modified code to turn off the
- * H5FD_FEAT_ACCUMULATE_METADATA_WRITE flag.
- * With the movement of all cache writes to process 0,
- * this flag has become problematic in PHDF5.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -928,10 +886,10 @@ H5FD_mpiposix_query(const H5FD_t UNUSED *_file, unsigned long *flags /* out */)
/* Set the VFL feature flags that this driver supports */
if(flags) {
*flags=0;
- *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */
- *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
- *flags|=H5FD_FEAT_HAS_MPI; /* This driver uses MPI */
- *flags|=H5FD_FEAT_ALLOCATE_EARLY; /* Allocate space early instead of late */
+ *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */
+ *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
+ *flags |= H5FD_FEAT_HAS_MPI; /* This driver uses MPI */
+ *flags |= H5FD_FEAT_ALLOCATE_EARLY; /* Allocate space early instead of late */
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -939,23 +897,18 @@ H5FD_mpiposix_query(const H5FD_t UNUSED *_file, unsigned long *flags /* out */)
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_get_eoa
+ * Function: H5FD_mpiposix_get_eoa
*
- * Purpose: Gets the end-of-address marker for the file. The EOA marker
- * is the first address past the last byte allocated in the
- * format address space.
+ * Purpose: Gets the end-of-address marker for the file. The EOA marker
+ * is the first address past the last byte allocated in the
+ * format address space.
*
- * Return: Success: The end-of-address marker.
- * Failure: HADDR_UNDEF
+ * Return: Success: The end-of-address marker.
+ * Failure: HADDR_UNDEF
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- * Raymond Lu
- * 21 Dec. 2006
- * Added the parameter TYPE. It's only used for MULTI driver.
- *
*-------------------------------------------------------------------------
*/
static haddr_t
@@ -965,31 +918,25 @@ H5FD_mpiposix_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->eoa)
} /* end H5FD_mpiposix_get_eoa() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_set_eoa
+ * Function: H5FD_mpiposix_set_eoa
*
- * Purpose: Set the end-of-address marker for the file. This function is
- * called shortly after an existing HDF5 file is opened in order
- * to tell the driver where the end of the HDF5 data is located.
+ * Purpose: Set the end-of-address marker for the file. This function is
+ * called shortly after an existing HDF5 file is opened in order
+ * to tell the driver where the end of the HDF5 data is located.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: SUCCEED (can't fail)
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- * Raymond Lu
- * 21 Dec. 2006
- * Added the parameter TYPE. It's only used for MULTI driver.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -999,8 +946,8 @@ H5FD_mpiposix_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
file->eoa = addr;
@@ -1009,25 +956,23 @@ H5FD_mpiposix_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr)
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_get_eof
+ * Function: H5FD_mpiposix_get_eof
*
- * Purpose: Gets the end-of-file marker for the file. The EOF marker
- * is the real size of the file.
+ * Purpose: Gets the end-of-file marker for the file. The EOF marker
+ * is the real size of the file.
*
- * The MPIPOSIX driver doesn't bother keeping this field updated
- * since that's a relatively expensive operation. Fortunately
- * the library only needs the EOF just after the file is opened
- * in order to determine whether the file is empty, truncated,
- * or okay.
+ * The MPIPOSIX driver doesn't bother keeping this field updated
+ * since that's a relatively expensive operation. Fortunately
+ * the library only needs the EOF just after the file is opened
+ * in order to determine whether the file is empty, truncated,
+ * or okay.
*
- * Return: Success: The end-of-address marker.
- * Failure: HADDR_UNDEF
+ * Return: Success: The end-of-address marker.
+ * Failure: HADDR_UNDEF
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static haddr_t
@@ -1037,10 +982,10 @@ H5FD_mpiposix_get_eof(const H5FD_t *_file)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
- FUNC_LEAVE_NOAPI(MAX(file->eof,file->eoa))
+ FUNC_LEAVE_NOAPI(MAX(file->eof, file->eoa))
} /* end H5FD_mpiposix_get_eof() */
@@ -1049,13 +994,11 @@ H5FD_mpiposix_get_eof(const H5FD_t *_file)
*
* Purpose: Returns the file handle of MPI-POSIX file driver.
*
- * Returns: Non-negative if succeed or negative if fails.
+ * Returns: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Sept. 16, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1077,43 +1020,41 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_read
+ * Function: H5FD_mpiposix_read
*
- * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR
- * into buffer BUF according to data transfer properties in
- * DXPL_ID using potentially complex file and buffer types to
- * effect the transfer.
+ * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR
+ * into buffer BUF according to data transfer properties in
+ * DXPL_ID using potentially complex file and buffer types to
+ * effect the transfer.
*
- * Reading past the end of the file returns zeros instead of
- * failing.
+ * Reading past the end of the file returns zeros instead of
+ * failing.
*
- * Return: Success: Non-negative. Result is stored in caller-supplied
- * buffer BUF.
- * Failure: Negative, Contents of buffer BUF are undefined.
+ * Return: Success: Non-negative. Result is stored in caller-supplied
+ * buffer BUF.
+ * Failure: Negative, Contents of buffer BUF are undefined.
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr, size_t size,
- void *buf/*out*/)
+H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id,
+ haddr_t addr, size_t size, void *buf/*out*/)
{
- H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
- ssize_t nbytes; /* Number of bytes read each I/O call */
- herr_t ret_value=SUCCEED;
+ H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
+ ssize_t nbytes; /* Number of bytes read each I/O call */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
- assert(buf);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
+ HDassert(buf);
/* Check for overflow conditions */
- if (HADDR_UNDEF==addr)
+ if (HADDR_UNDEF == addr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined")
if (REGION_OVERFLOW(addr, size))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
@@ -1130,31 +1071,52 @@ H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id,
#endif
/* Seek to the correct location */
- if ((addr!=file->pos || OP_READ!=file->op) &&
- file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0)
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+ if(addr != file->pos || OP_READ != file->op) {
+ if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+ } /* end if */
- /*
- * Read data, being careful of interrupted system calls, partial results,
+ /* Read data, being careful of interrupted system calls, partial results,
* and the end of the file.
*/
- while (size>0) {
+ while(size > 0) {
+
+ h5_mpiposix_io_t bytes_in = 0; /* # of bytes to read */
+ h5_mpiposix_io_ret_t bytes_read = -1; /* # of bytes actually read */
+
+ /* Trying to read more bytes than the return type can handle is
+ * undefined behavior in POSIX.
+ */
+ if(size > H5_MPIPOSIX_MAX_IO_BYTES_g)
+ bytes_in = H5_MPIPOSIX_MAX_IO_BYTES_g;
+ else
+ bytes_in = (h5_mpiposix_io_t)size;
+
do {
- nbytes = HDread(file->fd, buf, size);
- } while (-1==nbytes && EINTR==errno);
- if (-1==nbytes)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed")
- if (0==nbytes) {
+ bytes_read = HDread(file->fd, buf, bytes_in);
+ } while(-1 == bytes_read && EINTR == errno);
+
+ if(-1 == bytes_read) { /* error */
+ int myerrno = errno;
+ time_t mytime = HDtime(NULL);
+ HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset);
+ } /* end if */
+
+ if(0 == bytes_read) {
/* end of file but not end of format address space */
HDmemset(buf, 0, size);
break;
} /* end if */
- assert(nbytes>=0);
- assert((size_t)nbytes<=size);
- size -= nbytes;
- addr += (haddr_t)nbytes;
- buf = (char*)buf + nbytes;
- }
+
+ HDassert(bytes_read >= 0);
+ HDassert((size_t)bytes_read <= size);
+
+ size -= (size_t)bytes_read;
+ addr += (haddr_t)bytes_read;
+ buf = (char *)buf + bytes_read;
+ } /* end while */
/* Update current position */
file->pos = addr;
@@ -1162,7 +1124,7 @@ H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id,
done:
/* Check for error */
- if(ret_value<0) {
+ if(ret_value < 0) {
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
@@ -1173,55 +1135,46 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_write
+ * Function: H5FD_mpiposix_write
*
- * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR
- * from buffer BUF according to data transfer properties in
- * DXPL_ID using potentially complex file and buffer types to
- * effect the transfer.
+ * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR
+ * from buffer BUF according to data transfer properties in
+ * DXPL_ID using potentially complex file and buffer types to
+ * effect the transfer.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
- * Quincey Koziol - 2002/07/18
- * Added "block_before_meta_write" dataset transfer flag, which
- * is set during writes from a metadata cache flush and indicates
- * that all the processes must sync up before (one of them)
- * writing metadata.
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
size_t size, const void *buf)
{
- H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
+ H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
#if 0 /* JRM */
int mpi_code; /* MPI return code */
#endif /* JRM */
- ssize_t nbytes; /* Number of bytes written each I/O call */
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
+ ssize_t nbytes; /* Number of bytes written each I/O call */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
- assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id));
- assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
- assert(buf);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
+ HDassert(H5I_GENPROP_LST == H5I_get_type(dxpl_id));
+ HDassert(TRUE == H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
+ HDassert(buf);
/* Check for overflow conditions */
- if (HADDR_UNDEF==addr)
+ if (HADDR_UNDEF == addr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined")
if (REGION_OVERFLOW(addr, size))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
- if (addr+size>file->eoa)
+ if ((addr + size) > file->eoa)
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
/* Obtain the data transfer properties */
@@ -1237,26 +1190,26 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
* metadata.
* -- JRM 9/1/05
*/
- if(type!=H5FD_MEM_DRAW) {
- unsigned block_before_meta_write=0; /* Whether to block before a metadata write */
-
- /* Check if we need to syncronize all processes before attempting metadata write
- * (Prevents race condition where the process writing the metadata goes ahead
- * and writes the metadata to the file before all the processes have
- * read the data, "transmitting" data from the "future" to the reading
- * process. -QAK )
+ if(type != H5FD_MEM_DRAW) {
+ unsigned block_before_meta_write = 0; /* Whether to block before a metadata write */
+
+ /* Check if we need to synchronize all processes before attempting
+ * metadata write (Prevents race condition where the process writing
+ * the metadata goes ahead and writes the metadata to the file before
+ * all the processes have read the data, "transmitting" data from the
+ * "future" to the reading process. -QAK )
*
* The only time we don't want to block before a metadata write is when
* we are flushing out a bunch of metadata. Then, we block before the
* first write and don't block for further writes in the sequence.
*/
- if(H5P_exist_plist(plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME)>0)
- if(H5P_get(plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,&block_before_meta_write)<0)
+ if(H5P_exist_plist(plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME) > 0)
+ if(H5P_get(plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,&block_before_meta_write) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get H5AC property")
#if 0 /* JRM */
if(block_before_meta_write)
- if (MPI_SUCCESS!= (mpi_code=MPI_Barrier(file->comm)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Barrier(file->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code)
#endif /* JRM */
@@ -1273,11 +1226,11 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
MPI_Comm_rank(MPI_COMM_WORLD, &commrank);
HDfprintf(stderr, "write: rank=%d file=0x%08lx type=%d, addr=%a size=%Zu %s\n",
commrank, (unsigned long)file, (int)type, addr, size,
- 0==file->naccess?"(FIRST ACCESS)":"");
+ 0 == file->naccess ? "(FIRST ACCESS)" : "");
}
#endif
- if (0==file->naccess++) {
+ if (0 == file->naccess++) {
/* First write access to this file */
#ifdef H5_HAVE_GPFS
if (file->use_gpfs) {
@@ -1302,50 +1255,76 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
}
/* Seek to the correct location */
- if ((addr!=file->pos || OP_WRITE!=file->op) &&
- file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0)
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+ if(addr != file->pos || OP_WRITE != file->op) {
+ if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+ } /* end if */
- /*
- * Write the data, being careful of interrupted system calls and partial
- * results
+ /* Write data, being careful of interrupted system calls, partial results,
+ * and the end of the file.
*/
- while (size>0) {
+ while(size > 0) {
+
+ h5_mpiposix_io_t bytes_in = 0; /* # of bytes to write */
+ h5_mpiposix_io_ret_t bytes_wrote = -1; /* # of bytes actually written */
+
+ /* Trying to write more bytes than the return type can handle is
+ * undefined behavior in POSIX.
+ */
+ if(size > H5_MPIPOSIX_MAX_IO_BYTES_g)
+ bytes_in = H5_MPIPOSIX_MAX_IO_BYTES_g;
+ else
+ bytes_in = (h5_mpiposix_io_t)size;
+
do {
- nbytes = HDwrite(file->fd, buf, size);
- } while (-1==nbytes && EINTR==errno);
- if (-1==nbytes)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
- assert(nbytes>0);
- assert((size_t)nbytes<=size);
- size -= nbytes;
- addr += (haddr_t)nbytes;
- buf = (const char*)buf + nbytes;
+ bytes_wrote = HDwrite(file->fd, buf, bytes_in);
+ } while(-1 == bytes_wrote && EINTR == errno);
+
+ if(-1 == bytes_wrote) { /* error */
+ int myerrno = errno;
+ time_t mytime = HDtime(NULL);
+ HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file write failed: time = %s, file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset);
+ } /* end if */
+
+ if(0 == bytes_wrote) {
+ /* end of file but not end of format address space */
+ HDmemset(buf, 0, size);
+ break;
+ } /* end if */
+
+ HDassert(bytes_wrote >= 0);
+ HDassert((size_t)bytes_wrote <= size);
+
+ size -= (size_t)bytes_wrote;
+ addr += (haddr_t)bytes_wrote;
+ buf = (char *)buf + bytes_wrote;
} /* end while */
- /* Update current last file I/O information */
+ /* Update current position */
file->pos = addr;
file->op = OP_WRITE;
done:
/* Check for error */
- if(ret_value<0) {
+ if(ret_value < 0) {
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
} /* end if */
#if 0 /* JRM */
- /* Since metadata writes are now done by process 0 only, this broadcast
- * is no longer needed. I leave it in and commented out to remind us
- * that we need to re-work this function to reflect this reallity.
- *
- * -- JRM 9/1/05
- */
+ /* Since metadata writes are now done by process 0 only, this broadcast
+ * is no longer needed. I leave it in and commented out to remind us
+ * that we need to re-work this function to reflect this reallity.
+ *
+ * -- JRM 9/1/05
+ */
/* Guard against getting into metadata broadcast in failure cases */
else {
/* when only one process writes, need to broadcast the ret_value to other processes */
- if (type!=H5FD_MEM_DRAW) {
+ if (type != H5FD_MEM_DRAW) {
if (MPI_SUCCESS != (mpi_code= MPI_Bcast(&ret_value, sizeof(ret_value), MPI_BYTE, H5_PAR_META_WRITE, file->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code)
} /* end if */
@@ -1359,11 +1338,10 @@ done:
/*-------------------------------------------------------------------------
* Function: H5FD_mpiposix_truncate
*
- * Purpose: Makes sure that the true file size is the same (or larger)
- * than the end-of-address.
+ * Purpose: Makes sure that the true file size is the same (or larger)
+ * than the end-of-address.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
@@ -1374,12 +1352,8 @@ static herr_t
H5FD_mpiposix_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing)
{
H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
-#ifdef H5_HAVE_WIN32_API
- HFILE filehandle; /* Windows file handle */
- LARGE_INTEGER li; /* 64-bit integer for SetFilePointer() call */
-#endif /* H5_HAVE_WIN32_API */
- int mpi_code; /* MPI return code */
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
+ int mpi_code; /* MPI return code */
FUNC_ENTER_NOAPI_NOINIT
@@ -1390,19 +1364,42 @@ H5FD_mpiposix_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closi
if(file->eoa > file->last_eoa) {
/* Use the round-robin process to truncate (extend) the file */
if(file->mpi_rank == H5_PAR_META_WRITE) {
+
#ifdef H5_HAVE_WIN32_API
- /* Map the posix file handle to a Windows file handle */
- filehandle = _get_osfhandle(file->fd);
-
- /* Translate 64-bit integers into form Windows wants */
- /* [This algorithm is from the Windows documentation for SetFilePointer()] */
- li.QuadPart = file->eoa;
- SetFilePointer((HANDLE)filehandle, li.LowPart, &li.HighPart, FILE_BEGIN);
- if(SetEndOfFile((HANDLE)filehandle) == 0)
+ LARGE_INTEGER li; /* 64-bit (union) integer for SetFilePointer() call */
+ DWORD dwPtrLow; /* Low-order pointer bits from SetFilePointer()
+ * Only used as an error code here.
+ */
+ DWORD dwError; /* DWORD error code from GetLastError() */
+ BOOL bError; /* Boolean error flag */
+
+ /* Windows uses this odd QuadPart union for 32/64-bit portability */
+ li.QuadPart = (__int64)file->eoa;
+
+ /* Extend the file to make sure it's large enough.
+ *
+ * Since INVALID_SET_FILE_POINTER can technically be a valid return value
+ * from SetFilePointer(), we also need to check GetLastError().
+ */
+ dwPtrLow = SetFilePointer(file->hFile, li.LowPart, &li.HighPart, FILE_BEGIN);
+ if(INVALID_SET_FILE_POINTER == dwPtrLow) {
+ dwError = GetLastError();
+ if(dwError != NO_ERROR )
+ HGOTO_ERROR(H5E_FILE, H5E_FILEOPEN, FAIL, "unable to set file pointer")
+ }
+
+ bError = SetEndOfFile(file->hFile);
+ if(0 == bError)
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#else /* H5_HAVE_WIN32_API */
- if(-1==file_truncate(file->fd, (file_offset_t)file->eoa))
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
+#ifdef H5_VMS
+ /* Reset seek offset to the beginning of the file, so that the file isn't
+ * re-extended later. This may happen on Open VMS. */
+ if(-1 == HDlseek(file->fd, (HDoff_t)0, SEEK_SET))
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+#endif /* H5_VMS */
+ if(-1 == HDftruncate(file->fd, (HDoff_t)file->eoa))
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#endif /* H5_HAVE_WIN32_API */
} /* end if */
@@ -1430,18 +1427,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_mpi_rank
+ * Function: H5FD_mpiposix_mpi_rank
*
- * Purpose: Returns the MPI rank for a process
+ * Purpose: Returns the MPI rank for a process
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: MPI rank. Cannot report failure.
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -1451,26 +1445,23 @@ H5FD_mpiposix_mpi_rank(const H5FD_t *_file)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->mpi_rank)
} /* end H5FD_mpiposix_mpi_rank() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_mpi_size
+ * Function: H5FD_mpiposix_mpi_size
*
- * Purpose: Returns the number of MPI processes
+ * Purpose: Returns the number of MPI processes
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: The number of MPI processes. Cannot report failure.
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -1480,27 +1471,23 @@ H5FD_mpiposix_mpi_size(const H5FD_t *_file)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->mpi_size)
} /* end H5FD_mpiposix_mpi_size() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_communicator
- *
- * Purpose: Returns the MPI communicator for the file.
+ * Function: H5FD_mpiposix_communicator
*
- * Return: Success: The communicator
+ * Purpose: Returns the MPI communicator for the file.
*
- * Failure: NULL
+ * Return: The MPI communicator. Cannot report failure.
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static MPI_Comm
@@ -1510,11 +1497,10 @@ H5FD_mpiposix_communicator(const H5FD_t *_file)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->comm)
} /* end H5FD_mpi_posix_communicator() */
#endif /*H5_HAVE_PARALLEL*/
-
diff --git a/src/H5FDmpiposix.h b/src/H5FDmpiposix.h
index af13fad..e3764e1 100644
--- a/src/H5FDmpiposix.h
+++ b/src/H5FDmpiposix.h
@@ -14,7 +14,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol <koziol@hdfgroup.org>
* Thursday, July 11, 2002
*
* Purpose: The public header file for the mpiposix driver.
@@ -24,14 +24,14 @@
#define __H5FDmpiposix_H
#ifdef H5_HAVE_PARALLEL
-# define H5FD_MPIPOSIX (H5FD_mpiposix_init())
+# define H5FD_MPIPOSIX (H5FD_mpiposix_init())
#else
-# define H5FD_MPIPOSIX (-1)
+# define H5FD_MPIPOSIX (-1)
#endif
/* Macros */
-#define IS_H5FD_MPIPOSIX(f) /* (H5F_t *f) */ \
+#define IS_H5FD_MPIPOSIX(f) /* (H5F_t *f) */ \
(H5FD_MPIPOSIX==H5F_DRIVER_ID(f))
#ifdef H5_HAVE_PARALLEL
@@ -52,4 +52,3 @@ H5_DLL herr_t H5Pget_fapl_mpiposix(hid_t fapl_id, MPI_Comm *comm/*out*/, hbool_t
#endif /*H5_HAVE_PARALLEL*/
#endif /* __H5FDmpiposix_H */
-
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index b1d312f..08529e2 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -74,6 +74,10 @@
#define END_MEMBERS }}
+#define H5FD_MULTI_DXPL_PROP_NAME "H5FD_MULTI_DXPL"
+#define H5FD_MULTI_DXPL_PROP_SIZE sizeof(H5FD_multi_dxpl_t)
+
+
/* The driver identification number, initialized at runtime */
static hid_t H5FD_MULTI_g = 0;
@@ -126,8 +130,6 @@ static herr_t H5FD_multi_sb_decode(H5FD_t *file, const char *name,
static void *H5FD_multi_fapl_get(H5FD_t *file);
static void *H5FD_multi_fapl_copy(const void *_old_fa);
static herr_t H5FD_multi_fapl_free(void *_fa);
-static void *H5FD_multi_dxpl_copy(const void *_old_dx);
-static herr_t H5FD_multi_dxpl_free(void *_dx);
static H5FD_t *H5FD_multi_open(const char *name, unsigned flags,
hid_t fapl_id, haddr_t maxaddr);
static herr_t H5FD_multi_close(H5FD_t *_file);
@@ -161,9 +163,9 @@ static const H5FD_class_t H5FD_multi_g = {
H5FD_multi_fapl_get, /*fapl_get */
H5FD_multi_fapl_copy, /*fapl_copy */
H5FD_multi_fapl_free, /*fapl_free */
- sizeof(H5FD_multi_dxpl_t), /*dxpl_size */
- H5FD_multi_dxpl_copy, /*dxpl_copy */
- H5FD_multi_dxpl_free, /*dxpl_free */
+ 0, /*dxpl_size */
+ NULL, /*dxpl_copy */
+ NULL, /*dxpl_free */
H5FD_multi_open, /*open */
H5FD_multi_close, /*close */
H5FD_multi_cmp, /*cmp */
@@ -590,6 +592,127 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/,
/*-------------------------------------------------------------------------
+ * Function: H5FD_multi_dxpl_copy_cb
+ *
+ * Purpose: Multi VFD DXPL property 'copy' callback
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, August 15, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD_multi_dxpl_copy_cb(const char *name, size_t size, void *_dx)
+{
+ H5FD_multi_dxpl_t *dx = (H5FD_multi_dxpl_t *)_dx;
+ static const char *func = "H5FD_multi_dxpl_copy_cb"; /* Function Name for error reporting */
+
+ /* Shut compiler up */
+ name = name;
+
+ /* Sanity check */
+ assert(size == sizeof(H5FD_multi_dxpl_t));
+
+ ALL_MEMBERS(mt) {
+ if(dx->memb_dxpl[mt] >= 0)
+ if(H5Iinc_ref(dx->memb_dxpl[mt]) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTINC, "can't increment ref. count for multi VFD property", -1)
+ } END_MEMBERS;
+
+ return 0;
+} /* end H5FD_multi_dxpl_copy_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_multi_dxpl_cmp_cb
+ *
+ * Purpose: Multi VFD DXPL property 'compare' callback
+ *
+ * Return: Success: same as memcmp()
+ * Failure: <can't fail>
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, August 15, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5FD_multi_dxpl_cmp_cb(const void *_dx1, const void *_dx2, size_t size)
+{
+ const H5FD_multi_dxpl_t *dx1 = (const H5FD_multi_dxpl_t *)_dx1;
+ const H5FD_multi_dxpl_t *dx2 = (const H5FD_multi_dxpl_t *)_dx2;
+ int cmp_status;
+
+ /* Sanity check */
+ assert(size == sizeof(H5FD_multi_dxpl_t));
+
+ ALL_MEMBERS(mt) {
+ if(dx1->memb_dxpl[mt] >= 0) {
+ if(dx2->memb_dxpl[mt] >= 0) {
+ cmp_status = H5Pequal(dx1->memb_dxpl[mt], dx2->memb_dxpl[mt]);
+ if(cmp_status != 0)
+ return(cmp_status);
+ } /* end if */
+ else
+ return(1);
+ } /* end if */
+ else {
+ if(dx2->memb_dxpl[mt] >= 0)
+ return(-1);
+ else
+ if(dx1->memb_dxpl[mt] > dx2->memb_dxpl[mt])
+ return(1);
+ else if(dx1->memb_dxpl[mt] < dx2->memb_dxpl[mt])
+ return(-1);
+ else
+ continue;
+ } /* end else */
+ } END_MEMBERS;
+
+ return 0;
+} /* end H5FD_multi_dxpl_cmp_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_multi_dxpl_cls_cb
+ *
+ * Purpose: Multi VFD DXPL property 'close' callback
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, August 15, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD_multi_dxpl_cls_cb(const char *name, size_t size, void *_dx)
+{
+ H5FD_multi_dxpl_t *dx = (H5FD_multi_dxpl_t *)_dx;
+ static const char *func = "H5FD_multi_dxpl_cls_cb"; /* Function Name for error reporting */
+
+ /* Shut compiler up */
+ name = name;
+
+ /* Sanity check */
+ assert(size == sizeof(H5FD_multi_dxpl_t));
+
+ ALL_MEMBERS(mt) {
+ if(dx->memb_dxpl[mt] >= 0)
+ if(H5Idec_ref(dx->memb_dxpl[mt]) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTDEC, "can't increment ref. count for multi VFD property", -1)
+ } END_MEMBERS;
+
+ return 0;
+} /* end H5FD_multi_dxpl_cls_cb() */
+
+
+
+/*-------------------------------------------------------------------------
* Function: H5Pset_dxpl_multi
*
* Purpose: Set the data transfer property list DXPL_ID to use the multi
@@ -613,7 +736,8 @@ H5Pset_dxpl_multi(hid_t dxpl_id, const hid_t *memb_dxpl)
{
H5FD_multi_dxpl_t dx;
H5FD_mem_t mt;
- static const char *func="H5FDset_dxpl_multi"; /* Function Name for error reporting */
+ htri_t prop_exists; /* Whether the multi VFD DXPL property already exists */
+ static const char *func = "H5FDset_dxpl_multi"; /* Function Name for error reporting */
/*NO TRACE*/
@@ -621,26 +745,56 @@ H5Pset_dxpl_multi(hid_t dxpl_id, const hid_t *memb_dxpl)
H5Eclear2(H5E_DEFAULT);
/* Check arguments */
- if (TRUE!=H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
+ if(TRUE != H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1)
- if (!memb_dxpl)
+ if(!memb_dxpl)
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "invalid pointer", -1)
- for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) {
- if (memb_dxpl[mt]!=H5P_DEFAULT && TRUE!=H5Pisa_class(memb_dxpl[mt], H5P_DATASET_XFER))
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
+ if(memb_dxpl[mt] != H5P_DEFAULT && TRUE != H5Pisa_class(memb_dxpl[mt], H5P_DATASET_XFER))
H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1)
- }
+ } /* end for */
+
+ /* Check for existence of multi VFD DXPL property in DXPL */
+ if((prop_exists = H5Pexist(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME)) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't check for multi VFD property", -1)
+
+ /* Copy the DXPLs to internal property, converting "generic" default
+ * property lists into default dataset transfer property lists */
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
+ if(memb_dxpl[mt] == H5P_DEFAULT)
+ dx.memb_dxpl[mt] = H5P_DATASET_XFER_DEFAULT;
+ else {
+ if((dx.memb_dxpl[mt] = H5Pcopy(memb_dxpl[mt])) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTCOPY, "can't copy dataset transfer property list", -1)
+ } /* end else */
+ } /* end for */
+
+ /* Clear previous property, if it exists */
+ if(prop_exists) {
+ H5FD_multi_dxpl_t old_dx;
+
+ /* Get the old DXPL value */
+ if(H5Pget(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, &old_dx) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't get previous property value", -1)
- /* Initialize the data transfer property list */
- memcpy(dx.memb_dxpl, memb_dxpl, H5FD_MEM_NTYPES*sizeof(hid_t));
+ ALL_MEMBERS(mt) {
+ if(old_dx.memb_dxpl[mt] >= 0)
+ if(H5Pclose(old_dx.memb_dxpl[mt]) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTCLOSEOBJ, "can't close property list", -1)
+ } END_MEMBERS;
- /* Convert "generic" default property lists into default dataset transfer property lists */
- for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) {
- if (dx.memb_dxpl[mt]==H5P_DEFAULT)
- dx.memb_dxpl[mt]=H5P_DATASET_XFER_DEFAULT;
- }
+ /* Set the new value */
+ if(H5Pset(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, &dx) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't get previous property value", -1)
+ } /* end if */
+ else {
+ /* Insert multi VFD DXPL property into property list */
+ if(H5Pinsert2(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, H5FD_MULTI_DXPL_PROP_SIZE, &dx, NULL, NULL, NULL, H5FD_multi_dxpl_copy_cb, H5FD_multi_dxpl_cmp_cb, H5FD_multi_dxpl_cls_cb) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTINSERT, "can't insert multi VFD DXPL property", -1)
+ } /* end else */
- return H5Pset_driver(dxpl_id, H5FD_MULTI, &dx);
-}
+ return 0;
+} /* end H5Pset_dxpl_multi() */
/*-------------------------------------------------------------------------
@@ -663,33 +817,42 @@ H5Pset_dxpl_multi(hid_t dxpl_id, const hid_t *memb_dxpl)
herr_t
H5Pget_dxpl_multi(hid_t dxpl_id, hid_t *memb_dxpl/*out*/)
{
- H5FD_multi_dxpl_t *dx;
+ H5FD_multi_dxpl_t dx;
H5FD_mem_t mt;
- static const char *func="H5FDget_dxpl_multi"; /* Function Name for error reporting */
+ htri_t prop_exists; /* Whether the multi VFD DXPL property already exists */
+ static const char *func = "H5FDget_dxpl_multi"; /* Function Name for error reporting */
/*NO TRACE*/
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- if (TRUE!=H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
+ /* Argument checking */
+ if(TRUE != H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1)
- if (H5FD_MULTI!=H5Pget_driver(dxpl_id))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1)
- if(NULL == (dx = (H5FD_multi_dxpl_t *)H5Pget_driver_info(dxpl_id)))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1)
- if (memb_dxpl) {
- for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) {
- if (dx->memb_dxpl[mt]>=0)
- memb_dxpl[mt] = H5Pcopy(dx->memb_dxpl[mt]);
+ if(memb_dxpl) {
+ /* Check for existence of multi VFD DXPL property in DXPL */
+ if((prop_exists = H5Pexist(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME)) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't check for multi VFD property", -1)
+ if(!prop_exists)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "multi VFD DXPL property not set", -1)
+
+ /* Get the DXPL value */
+ if(H5Pget(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, &dx) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't get property value", -1)
+
+ /* Deep copy the multi VFD DXPL value */
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
+ if(dx.memb_dxpl[mt] >= 0)
+ memb_dxpl[mt] = H5Pcopy(dx.memb_dxpl[mt]);
else
- memb_dxpl[mt] = dx->memb_dxpl[mt]; /*default or bad ID */
- }
- }
+ memb_dxpl[mt] = dx.memb_dxpl[mt]; /*default or bad ID */
+ } /* end for */
+ } /* end if */
return 0;
-}
+} /* end H5Pget_dxpl_multi() */
/*-------------------------------------------------------------------------
@@ -1106,90 +1269,6 @@ H5FD_multi_fapl_free(void *_fa)
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_dxpl_copy
- *
- * Purpose: Copes the multi-specific data transfer properties.
- *
- * Return: Success: Ptr to new property list
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5FD_multi_dxpl_copy(const void *_old_dx)
-{
- const H5FD_multi_dxpl_t *old_dx = (const H5FD_multi_dxpl_t*)_old_dx;
- H5FD_multi_dxpl_t *new_dx = (H5FD_multi_dxpl_t *)malloc(sizeof(H5FD_multi_dxpl_t));
- int nerrors = 0;
- static const char *func="H5FD_multi_dxpl_copy"; /* Function Name for error reporting */
-
- assert(new_dx);
-
- /* Clear the error stack */
- H5Eclear2(H5E_DEFAULT);
-
- memcpy(new_dx, old_dx, sizeof(H5FD_multi_dxpl_t));
- ALL_MEMBERS(mt) {
- if (old_dx->memb_dxpl[mt]>=0) {
- new_dx->memb_dxpl[mt] = H5Pcopy(old_dx->memb_dxpl[mt]);
- if (new_dx->memb_dxpl[mt]<0) nerrors++;
- }
- } END_MEMBERS;
-
- if (nerrors) {
- ALL_MEMBERS(mt) {
- (void)H5Pclose(new_dx->memb_dxpl[mt]);
- } END_MEMBERS;
- free(new_dx);
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "invalid freespace objects", NULL)
- }
- return new_dx;
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5FD_multi_dxpl_free
- *
- * Purpose: Frees the multi-specific data transfer properties.
- *
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5FD_multi_dxpl_free(void *_dx)
-{
- H5FD_multi_dxpl_t *dx = (H5FD_multi_dxpl_t*)_dx;
- static const char *func="H5FD_multi_dxpl_free"; /* Function Name for error reporting */
-
- /* Clear the error stack */
- H5Eclear2(H5E_DEFAULT);
-
- ALL_MEMBERS(mt) {
- if (dx->memb_dxpl[mt]>=0)
- if(H5Pclose(dx->memb_dxpl[mt])<0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", -1)
- } END_MEMBERS;
-
- free(dx);
- return 0;
-}
-
-
-/*-------------------------------------------------------------------------
* Function: H5FD_multi_open
*
* Purpose: Creates and/or opens a multi HDF5 file.
@@ -1823,25 +1902,33 @@ H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsi
* Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
- void *_buf/*out*/)
+H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
+ size_t size, void *_buf/*out*/)
{
H5FD_multi_t *file = (H5FD_multi_t*)_file;
- H5FD_multi_dxpl_t *dx=NULL;
- H5FD_mem_t mt, mmt, hi=H5FD_MEM_DEFAULT;
- haddr_t start_addr=0;
+ H5FD_multi_dxpl_t dx;
+ htri_t prop_exists = FALSE; /* Whether the multi VFD DXPL property already exists */
+ H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT;
+ haddr_t start_addr = 0;
+ static const char *func = "H5FD_multi_read"; /* Function Name for error reporting */
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
/* Get the data transfer properties */
- if(H5P_FILE_ACCESS_DEFAULT != dxpl_id && H5FD_MULTI == H5Pget_driver(dxpl_id))
- dx = (H5FD_multi_dxpl_t *)H5Pget_driver_info(dxpl_id);
+ if(H5P_FILE_ACCESS_DEFAULT != dxpl_id) {
+ /* Check for existence of multi VFD DXPL property in DXPL */
+ if((prop_exists = H5Pexist(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME)) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't check for multi VFD property", -1)
+
+ /* Get the DXPL value, if it exists */
+ if(prop_exists)
+ if(H5Pget(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, &dx) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't get property value", -1)
+ } /* end if */
/* Find the file to which this address belongs */
for(mt = H5FD_MEM_SUPER; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
@@ -1850,18 +1937,19 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
mmt = mt;
assert(mmt > 0 && mmt < H5FD_MEM_NTYPES);
- if (file->fa.memb_addr[mmt]>addr) continue;
- if (file->fa.memb_addr[mmt]>=start_addr) {
+ if(file->fa.memb_addr[mmt] > addr)
+ continue;
+ if(file->fa.memb_addr[mmt] >= start_addr) {
start_addr = file->fa.memb_addr[mmt];
hi = mmt;
- }
- }
- assert(hi>0);
+ } /* end if */
+ } /* end for */
+ assert(hi > 0);
/* Read from that member */
- return H5FDread(file->memb[hi], type, dx?dx->memb_dxpl[hi]:H5P_DEFAULT,
- addr-start_addr, size, _buf);
-}
+ return H5FDread(file->memb[hi], type, (prop_exists ? dx.memb_dxpl[hi] : H5P_DEFAULT),
+ addr - start_addr, size, _buf);
+} /* end H5FD_multi_read() */
/*-------------------------------------------------------------------------
@@ -1878,45 +1966,54 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
* Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
- const void *_buf)
+H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
+ size_t size, const void *_buf)
{
H5FD_multi_t *file = (H5FD_multi_t*)_file;
- H5FD_multi_dxpl_t *dx=NULL;
- H5FD_mem_t mt, mmt, hi=H5FD_MEM_DEFAULT;
- haddr_t start_addr=0;
+ H5FD_multi_dxpl_t dx;
+ htri_t prop_exists = FALSE; /* Whether the multi VFD DXPL property already exists */
+ H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT;
+ haddr_t start_addr = 0;
+ static const char *func = "H5FD_multi_read"; /* Function Name for error reporting */
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
/* Get the data transfer properties */
- if(H5P_FILE_ACCESS_DEFAULT != dxpl_id && H5FD_MULTI == H5Pget_driver(dxpl_id))
- dx = (H5FD_multi_dxpl_t *)H5Pget_driver_info(dxpl_id);
+ if(H5P_FILE_ACCESS_DEFAULT != dxpl_id) {
+ /* Check for existence of multi VFD DXPL property in DXPL */
+ if((prop_exists = H5Pexist(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME)) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't check for multi VFD property", -1)
+
+ /* Get the DXPL value, if it exists */
+ if(prop_exists)
+ if(H5Pget(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, &dx) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't get property value", -1)
+ } /* end if */
/* Find the file to which this address belongs */
for(mt = H5FD_MEM_SUPER; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
mmt = file->fa.memb_map[mt];
if(H5FD_MEM_DEFAULT == mmt)
mmt = mt;
- assert(mmt>0 && mmt<H5FD_MEM_NTYPES);
+ assert(mmt > 0 && mmt<H5FD_MEM_NTYPES);
- if (file->fa.memb_addr[mmt]>addr) continue;
- if (file->fa.memb_addr[mmt]>=start_addr) {
+ if(file->fa.memb_addr[mmt] > addr)
+ continue;
+ if(file->fa.memb_addr[mmt] >= start_addr) {
start_addr = file->fa.memb_addr[mmt];
hi = mmt;
- }
- }
- assert(hi>0);
+ } /* end if */
+ } /* end for */
+ assert(hi > 0);
/* Write to that member */
- return H5FDwrite(file->memb[hi], type, dx?dx->memb_dxpl[hi]:H5P_DEFAULT,
- addr-start_addr, size, _buf);
-}
+ return H5FDwrite(file->memb[hi], type, (prop_exists ? dx.memb_dxpl[hi] : H5P_DEFAULT),
+ addr - start_addr, size, _buf);
+} /* end H5FD_multi_write() */
/*-------------------------------------------------------------------------
@@ -1931,8 +2028,6 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si
* Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 9c19562..64b71d4 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -96,8 +96,6 @@ H5_DLL herr_t H5FD_sb_decode(H5FD_t *file, const char *name, const uint8_t *buf)
H5_DLL void *H5FD_fapl_get(H5FD_t *file);
H5_DLL herr_t H5FD_fapl_open(struct H5P_genplist_t *plist, hid_t driver_id, const void *driver_info);
H5_DLL herr_t H5FD_fapl_close(hid_t driver_id, void *fapl);
-H5_DLL herr_t H5FD_dxpl_open(struct H5P_genplist_t *plist, hid_t driver_id, const void *driver_info);
-H5_DLL herr_t H5FD_dxpl_close(hid_t driver_id, void *dxpl);
H5_DLL hid_t H5FD_register(const void *cls, size_t size, hbool_t app_ref);
H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr);
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 4201e07..241609d 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -191,7 +191,7 @@ static const H5FD_class_t H5FD_sec2_g = {
H5FD_sec2_truncate, /*truncate */
NULL, /*lock */
NULL, /*unlock */
- H5FD_FLMAP_SINGLE /*fl_map */
+ H5FD_FLMAP_DICHOTOMY /*fl_map */
};
/* Declare a free list to manage the H5FD_sec2_t struct */
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index 4733eba..43bf6b9 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -226,7 +226,7 @@ static const H5FD_class_t H5FD_stdio_g = {
H5FD_stdio_truncate, /* truncate */
NULL, /* lock */
NULL, /* unlock */
- H5FD_FLMAP_SINGLE /* fl_map */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
};
diff --git a/src/H5FS.c b/src/H5FS.c
index fc1285f..7c09beb 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -284,6 +284,50 @@ HDfprintf(stderr, "%s: Deleting free space manager, fs_addr = %a\n", FUNC, fs_ad
cache_udata.cls_init_udata = NULL;
cache_udata.addr = fs_addr;
+#ifdef H5FS_DEBUG
+{
+ unsigned fspace_status = 0; /* Free space section info's status in the metadata cache */
+
+ /* Sanity check */
+ HDassert(H5F_addr_defined(fs_addr));
+
+ /* Check the free space section info's status in the metadata cache */
+ if(H5AC_get_entry_status(f, fs_addr, &fspace_status) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to check metadata cache status for free space section info")
+
+ HDfprintf(stderr, "%s: fspace_status = %0x: ", FUNC, fspace_status);
+ if(fspace_status) {
+ hbool_t printed = FALSE;
+
+ if(fspace_status & H5AC_ES__IN_CACHE) {
+ HDfprintf(stderr, "H5AC_ES__IN_CACHE");
+ printed = TRUE;
+ } /* end if */
+ if(fspace_status & H5AC_ES__IS_DIRTY) {
+ HDfprintf(stderr, "%sH5AC_ES__IS_DIRTY", (printed ? " | " : ""));
+ printed = TRUE;
+ } /* end if */
+ if(fspace_status & H5AC_ES__IS_PROTECTED) {
+ HDfprintf(stderr, "%sH5AC_ES__IS_PROTECTED", (printed ? " | " : ""));
+ printed = TRUE;
+ } /* end if */
+ if(fspace_status & H5AC_ES__IS_PINNED) {
+ HDfprintf(stderr, "%sH5AC_ES__IS_PINNED", (printed ? " | " : ""));
+ printed = TRUE;
+ } /* end if */
+ if(fspace_status & H5AC_ES__IS_FLUSH_DEP_PARENT) {
+ HDfprintf(stderr, "%sH5AC_ES__IS_FLUSH_DEP_PARENT", (printed ? " | " : ""));
+ printed = TRUE;
+ } /* end if */
+ if(fspace_status & H5AC_ES__IS_FLUSH_DEP_CHILD) {
+ HDfprintf(stderr, "%sH5AC_ES__IS_FLUSH_DEP_CHILD", (printed ? " | " : ""));
+ printed = TRUE;
+ } /* end if */
+ } /* end if */
+ HDfprintf(stderr, "\n");
+}
+#endif /* H5FS_DEBUG */
+
/* Protect the free space header */
if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space header")
@@ -324,9 +368,14 @@ HDfprintf(stderr, "%s: Done expunging free space section info from cache\n", FUN
#endif /* H5FS_DEBUG */
} /* end if */
else {
+#ifdef H5FS_DEBUG
+HDfprintf(stderr, "%s: Deleting free space section info from file\n", FUNC);
+#endif /* H5FS_DEBUG */
/* Release the space in the file */
- if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_addr, fspace->alloc_sect_size) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections")
+ if(!H5F_IS_TMP_ADDR(f, fspace->sect_addr)) {
+ if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_addr, fspace->alloc_sect_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections")
+ } /* end if */
} /* end else */
} /* end if */
@@ -387,8 +436,14 @@ HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC);
HDassert(fspace->sect_size > 0);
/* Allocate space for the section info in file */
- if(HADDR_UNDEF == (fspace->sect_addr = H5MF_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_size)))
- HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections")
+ if(H5F_USE_TMP_SPACE(f)) {
+ if(HADDR_UNDEF == (fspace->sect_addr = H5MF_alloc_tmp(f, fspace->sect_size)))
+ HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections")
+ } /* end if */
+ else {
+ if(HADDR_UNDEF == (fspace->sect_addr = H5MF_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_size)))
+ HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections")
+ } /* end if */
fspace->alloc_sect_size = (size_t)fspace->sect_size;
/* Mark free space header as dirty */
@@ -430,19 +485,9 @@ HDfprintf(stderr, "%s: Section info allocated though\n", FUNC);
HDfprintf(stderr, "%s: Section info is for file free space\n", FUNC);
#endif /* H5FS_DEBUG */
/* Try to shrink the file or absorb the section info into a block aggregator */
- if((status = H5MF_try_shrink(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_addr, fspace->alloc_sect_size)) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't check for absorbing section info")
- else if(status == FALSE) {
- /* Section info can't "go away", but it's free. Allow
- * header to record it
- */
-#ifdef H5FS_DEBUG
-HDfprintf(stderr, "%s: Section info can't 'go away', header will own it\n", FUNC);
-#endif /* H5FS_DEBUG */
- } /* end if */
- else {
+ if(H5F_IS_TMP_ADDR(f, fspace->sect_addr)) {
#ifdef H5FS_DEBUG
-HDfprintf(stderr, "%s: Section info went 'go away'\n", FUNC);
+HDfprintf(stderr, "%s: Section info in temp. address space went 'go away'\n", FUNC);
#endif /* H5FS_DEBUG */
/* Reset section info in header */
fspace->sect_addr = HADDR_UNDEF;
@@ -451,6 +496,30 @@ HDfprintf(stderr, "%s: Section info went 'go away'\n", FUNC);
/* Mark free space header as dirty */
if(H5AC_mark_entry_dirty(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
+ } /* end if */
+ else {
+ if((status = H5MF_try_shrink(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_addr, fspace->alloc_sect_size)) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't check for absorbing section info")
+ else if(status == FALSE) {
+ /* Section info can't "go away", but it's free. Allow
+ * header to record it
+ */
+#ifdef H5FS_DEBUG
+ HDfprintf(stderr, "%s: Section info can't 'go away', header will own it\n", FUNC);
+#endif /* H5FS_DEBUG */
+ } /* end if */
+ else {
+#ifdef H5FS_DEBUG
+ HDfprintf(stderr, "%s: Section info went 'go away'\n", FUNC);
+#endif /* H5FS_DEBUG */
+ /* Reset section info in header */
+ fspace->sect_addr = HADDR_UNDEF;
+ fspace->alloc_sect_size = 0;
+
+ /* Mark free space header as dirty */
+ if(H5AC_mark_entry_dirty(fspace) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
+ } /* end else */
} /* end else */
} /* end if */
else {
@@ -469,10 +538,12 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC);
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
/* Free previous serialized sections disk space */
- if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, old_sect_addr, old_alloc_sect_size) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections")
- } /* end if */
- } /* end else */
+ if(!H5F_IS_TMP_ADDR(f, old_sect_addr)) {
+ if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, old_sect_addr, old_alloc_sect_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections")
+ } /* end if */
+ } /* end else */
+ } /* end if */
/* Destroy section info */
if(H5FS_sinfo_dest(fspace->sinfo) < 0)
@@ -802,11 +873,11 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id)
HDassert(fspace);
if(!H5F_addr_defined(fspace->sect_addr) && fspace->sinfo && fspace->serial_sect_count > 0) {
- /* Allocate space for section info from aggregator/vfd */
- /* (The original version called H5MF_alloc(), but that may cause sect_size to change again) */
- if(HADDR_UNDEF == (fspace->sect_addr = H5MF_aggr_vfd_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_size)))
- HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for section info")
-
+ /* Allocate space for section info from aggregator/vfd (or temp. address space) */
+ /* (The original version called H5MF_alloc(), but that may cause sect_size to change again) */
+ /* (This routine is only called during file close operations, so don't allocate from temp. address space) */
+ if(HADDR_UNDEF == (fspace->sect_addr = H5MF_aggr_vfd_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_size)))
+ HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for section info")
fspace->alloc_sect_size = fspace->sect_size;
/* Mark free-space header as dirty */
@@ -882,8 +953,10 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id)
fspace->alloc_sect_size = 0;
/* Free space for the free-space manager section info */
- if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, saved_addr, saved_size) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections")
+ if(!H5F_IS_TMP_ADDR(f, saved_addr)) {
+ if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, saved_addr, saved_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections")
+ } /* end if */
/* Mark free-space manager header as dirty */
if(H5FS_dirty(fspace) < 0)
@@ -1120,7 +1193,7 @@ herr_t
H5FS_assert(const H5FS_t *fspace)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
-#ifndef QAK
+#ifdef QAK
HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", "H5FS_assert", fspace->tot_sect_count);
#endif /* QAK */
diff --git a/src/H5FScache.c b/src/H5FScache.c
index d186404..e441398 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -306,7 +306,7 @@ H5FS_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F
if(fspace->sinfo->dirty) {
if(fspace->serial_sect_count > 0) {
/* Check if we need to allocate space for section info */
- if(!H5F_addr_defined(fspace->sect_addr)) {
+ if(H5F_IS_TMP_ADDR(f, fspace->sect_addr) || !H5F_addr_defined(fspace->sect_addr)) {
/* Sanity check */
HDassert(fspace->sect_size > 0);
@@ -884,6 +884,32 @@ H5FS_cache_sinfo_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H
HDassert((size_t)(p - buf) == sinfo->fspace->sect_size);
HDassert(sinfo->fspace->sect_size <= sinfo->fspace->alloc_sect_size);
+ /* Check for section info at temporary address */
+ if(H5F_IS_TMP_ADDR(f, sinfo->fspace->sect_addr)) {
+ /* Sanity check */
+ HDassert(sinfo->fspace->sect_size > 0);
+ HDassert(H5F_addr_eq(sinfo->fspace->sect_addr, addr));
+
+ /* Allocate space for the section info in file */
+ if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, sinfo->fspace->sect_size)))
+ HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections")
+ sinfo->fspace->alloc_sect_size = (size_t)sinfo->fspace->sect_size;
+
+ /* Sanity check */
+ HDassert(!H5F_addr_eq(sinfo->fspace->sect_addr, addr));
+
+ /* Let the metadata cache know the section info moved */
+ if(H5AC_move_entry(f, H5AC_FSPACE_SINFO, sinfo->fspace->sect_addr, addr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move indirect block")
+
+ /* Update the internal address for the section info */
+ sinfo->fspace->sect_addr = addr;
+
+ /* Mark free space header as dirty */
+ if(H5AC_mark_entry_dirty(sinfo->fspace) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
+ } /* end if */
+
/* Write buffer to disk */
if(H5F_block_write(f, H5FD_MEM_FSPACE_SINFO, sinfo->fspace->sect_addr, (size_t)sinfo->fspace->sect_size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFLUSH, FAIL, "unable to save free space sections to disk")
@@ -936,8 +962,9 @@ H5FS_cache_sinfo_dest(H5F_t *f, H5FS_sinfo_t *sinfo)
/* Release the space on disk */
/* (XXX: Nasty usage of internal DXPL value! -QAK) */
- if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, H5AC_dxpl_id, sinfo->cache_info.addr, (hsize_t)sinfo->fspace->alloc_sect_size) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space section info")
+ if(!H5F_IS_TMP_ADDR(f, sinfo->cache_info.addr))
+ if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, H5AC_dxpl_id, sinfo->cache_info.addr, (hsize_t)sinfo->fspace->alloc_sect_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space section info")
} /* end if */
/* Destroy free space info */
diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h
index f6a0034..8cb3f95 100644
--- a/src/H5FSprivate.h
+++ b/src/H5FSprivate.h
@@ -200,6 +200,8 @@ H5_DLL herr_t H5FS_sect_stats(const H5FS_t *fspace, hsize_t *tot_space,
hsize_t *nsects);
H5_DLL herr_t H5FS_sect_change_class(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
H5FS_section_info_t *sect, unsigned new_class);
+H5_DLL htri_t H5FS_sect_try_shrink_eoa(const H5F_t *f, hid_t dxpl_id, const H5FS_t *fspace, void *op_data);
+H5_DLL herr_t H5FS_sect_query_last_sect(const H5FS_t *fspace, haddr_t *sect_addr, hsize_t *sect_size);
/* Statistics routine */
H5_DLL herr_t H5FS_stat_info(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *stats);
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index 0f126c2..fa24f85 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -445,8 +445,10 @@ HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC);
HDfprintf(stderr, "%s: Freeing section info on disk, old_sect_addr = %a, old_alloc_sect_size = %Hu\n", FUNC, old_sect_addr, old_alloc_sect_size);
#endif /* H5FS_SINFO_DEBUG */
/* Release space for section info in file */
- if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, old_sect_addr, old_alloc_sect_size) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections")
+ if(!H5F_IS_TMP_ADDR(f, old_sect_addr)) {
+ if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, old_sect_addr, old_alloc_sect_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections")
+ } /* end if */
} /* end if */
} /* end if */
@@ -2375,3 +2377,114 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a, sect->type = %u\n", "H
} /* end H5FS_sect_assert() */
#endif /* H5FS_DEBUG_ASSERT */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FS_sect_try_shrink_eoa
+ *
+ * Purpose: To shrink the last section on the merge list if the section
+ * is at EOF.
+ *
+ * Return: Success: non-negative (TRUE/FALSE)
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5FS_sect_try_shrink_eoa(const H5F_t *f, hid_t dxpl_id, const H5FS_t *fspace, void *op_data)
+{
+ hbool_t sinfo_valid = FALSE; /* Whether the section info is valid */
+ hbool_t section_removed = FALSE; /* Whether a section was removed */
+ htri_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments. */
+ HDassert(fspace);
+
+ if(H5FS_sinfo_lock(f, dxpl_id, fspace, H5AC_WRITE) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info")
+ sinfo_valid = TRUE;
+
+ if(fspace->sinfo && fspace->sinfo->merge_list) {
+ H5SL_node_t *last_node; /* Last node in merge list */
+
+ /* Check for last node in the merge list */
+ if(NULL != (last_node = H5SL_last(fspace->sinfo->merge_list))) {
+ H5FS_section_info_t *tmp_sect; /* Temporary free space section */
+ H5FS_section_class_t *tmp_sect_cls; /* Temporary section's class */
+
+ /* Get the pointer to the last section, from the last node */
+ tmp_sect = (H5FS_section_info_t *)H5SL_item(last_node);
+ HDassert(tmp_sect);
+ tmp_sect_cls = &fspace->sect_cls[tmp_sect->type];
+ if(tmp_sect_cls->can_shrink) {
+ /* Check if the section can be shrunk away */
+ if((ret_value = (*tmp_sect_cls->can_shrink)(tmp_sect, op_data)) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container")
+ if(ret_value > 0) {
+ HDassert(tmp_sect_cls->shrink);
+
+ /* Remove section from free space manager */
+ if(H5FS_sect_remove_real(fspace, tmp_sect) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures")
+ section_removed = TRUE;
+
+ /* Shrink away section */
+ if((*tmp_sect_cls->shrink)(&tmp_sect, op_data) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't shrink free space container")
+ } /* end if */
+ } /* end if */
+ } /* end if */
+ } /* end if */
+
+done:
+ /* Release the section info */
+ if(sinfo_valid && H5FS_sinfo_unlock(f, dxpl_id, fspace, section_removed) < 0)
+ HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5FS_sect_try_shrink_eoa() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FS_sect_query_last_sect
+ *
+ * Purpose: Retrieve info about the last section on the merge list
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FS_sect_query_last_sect(const H5FS_t *fspace, haddr_t *sect_addr, hsize_t *sect_size)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check arguments. */
+ HDassert(fspace);
+
+ if(fspace->sinfo && fspace->sinfo->merge_list) {
+ H5SL_node_t *last_node; /* Last node in merge list */
+
+ /* Check for last node in the merge list */
+ if(NULL != (last_node = H5SL_last(fspace->sinfo->merge_list))) {
+ H5FS_section_info_t *tmp_sect; /* Temporary free space section */
+
+ /* Get the pointer to the last section, from the last node */
+ tmp_sect = (H5FS_section_info_t *)H5SL_item(last_node);
+ HDassert(tmp_sect);
+ if(sect_addr)
+ *sect_addr = tmp_sect->addr;
+ if(sect_size)
+ *sect_size = tmp_sect->size;
+ } /* end if */
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5FS_sect_query_last_sect() */
+
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 65b5b08..538a22a 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -608,7 +608,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_is_hdf5() */
-
/*-------------------------------------------------------------------------
* Function: H5F_new
*
@@ -808,13 +807,15 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush)
* Only try to flush the file if it was opened with write access, and if
* the caller requested a flush.
*/
- if((f->shared->flags & H5F_ACC_RDWR) && flush)
+ if((H5F_ACC_RDWR & H5F_INTENT(f)) && flush)
if(H5F_flush(f, dxpl_id, TRUE) < 0)
+ /* Push error, but keep going*/
HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
/* Release the external file cache */
if(f->shared->efc) {
if(H5F_efc_destroy(f->shared->efc) < 0)
+ /* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't destroy external file cache")
f->shared->efc = NULL;
} /* end if */
@@ -832,6 +833,14 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush)
if(H5MF_close(f, dxpl_id) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file free space info")
+
+ /* Flush the file again (if requested), as shutting down the
+ * free space manager may dirty some data structures again.
+ */
+ if(flush)
+ if(H5F_flush(f, dxpl_id, TRUE) < 0)
+ /* Push error, but keep going*/
+ HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
} /* end if */
/* Unpin the superblock, since we're about to destroy the cache */
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 8bf4405..8205392 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -516,7 +516,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set EOA value for superblock")
/* Insert superblock into cache, pinned */
- if(H5AC_insert_entry(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, H5AC__PIN_ENTRY_FLAG | H5AC__FLUSH_LAST_FLAG | H5AC__FLUSH_COLLECTIVELY_FLAG) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "can't add superblock to cache")
sblock_in_cache = TRUE;
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index cc1137b..48fd139 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -153,6 +153,12 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
if(NULL == (sblock = H5FL_CALLOC(H5F_super_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ /* The superblock must be flushed last (and collectively in parallel) */
+ sblock->cache_info.flush_me_last = TRUE;
+#ifdef H5_HAVE_PARALLEL
+ sblock->cache_info.flush_me_collectively = TRUE;
+#endif
+
/* Read fixed-size portion of the superblock */
p = sbuf;
H5_CHECK_OVERFLOW(fixed_size, size_t, haddr_t);
@@ -638,6 +644,15 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
HDassert(f);
HDassert(H5F_addr_eq(addr, 0));
HDassert(sblock);
+
+ /* Assert that the superblock is marked as being flushed last (and
+ collectively in parallel) */
+ /* (We'll rely on the cache to make sure it actually *is* flushed
+ last (and collectively in parallel), but this check doesn't hurt) */
+ HDassert(sblock->cache_info.flush_me_last);
+#ifdef H5_HAVE_PARALLEL
+ HDassert(sblock->cache_info.flush_me_collectively);
+#endif
if(sblock->cache_info.is_dirty) {
uint8_t buf[H5F_MAX_SUPERBLOCK_SIZE + H5F_MAX_DRVINFOBLOCK_SIZE]; /* Superblock & driver info blockencoding buffer */
@@ -677,10 +692,15 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
*p++ = 0; /*reserved */
} /* end if */
+ /* Encode the base address */
H5F_addr_encode(f, &p, sblock->base_addr);
+
+ /* Encode the address of global free-space index */
H5F_addr_encode(f, &p, sblock->ext_addr);
rel_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_SUPER);
H5F_addr_encode(f, &p, (rel_eoa + sblock->base_addr));
+
+ /* Encode the driver informaton block address */
H5F_addr_encode(f, &p, sblock->driver_addr);
/* Encode the root group object entry, including the cached stab info */
@@ -731,9 +751,12 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
*p++ = (uint8_t)H5F_SIZEOF_SIZE(f);
*p++ = sblock->status_flags;
- /* Base, superblock extension & end of file addresses */
+ /* Encode the base address */
H5F_addr_encode(f, &p, sblock->base_addr);
+
+ /* Encode the address of the superblock extension */
H5F_addr_encode(f, &p, sblock->ext_addr);
+
rel_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_SUPER);
H5F_addr_encode(f, &p, (rel_eoa + sblock->base_addr));
@@ -767,13 +790,18 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
/* Check for newer version of superblock format & superblock extension */
if(sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_2 && H5F_addr_defined(sblock->ext_addr)) {
+ H5O_loc_t ext_loc; /* "Object location" for superblock extension */
+
+ /* Open the superblock extension's object header */
+ if(H5F_super_ext_open(f, sblock->ext_addr, &ext_loc) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension")
+
/* Check for ignoring the driver info for this file */
if(!H5F_HAS_FEATURE(f, H5FD_FEAT_IGNORE_DRVRINFO)) {
/* Check for driver info message */
H5_ASSIGN_OVERFLOW(driver_size, H5FD_sb_size(f->shared->lf), hsize_t, size_t);
if(driver_size > 0) {
H5O_drvinfo_t drvinfo; /* Driver info */
- H5O_loc_t ext_loc; /* "Object location" for superblock extension */
uint8_t dbuf[H5F_MAX_DRVINFOBLOCK_SIZE]; /* Driver info block encoding buffer */
/* Sanity check */
@@ -783,21 +811,19 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
if(H5FD_sb_encode(f->shared->lf, drvinfo.name, dbuf) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information")
- /* Open the superblock extension's object header */
- if(H5F_super_ext_open(f, sblock->ext_addr, &ext_loc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension")
-
/* Write driver info information to the superblock extension */
drvinfo.len = driver_size;
drvinfo.buf = dbuf;
if(H5O_msg_write(&ext_loc, H5O_DRVINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &drvinfo, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "unable to update driver info header message")
- /* Close the superblock extension object header */
- if(H5F_super_ext_close(f, &ext_loc, dxpl_id, FALSE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close file's superblock extension")
} /* end if */
+
} /* end if */
+
+ /* Close the superblock extension object header */
+ if(H5F_super_ext_close(f, &ext_loc, dxpl_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close file's superblock extension")
} /* end if */
/* Reset the dirty flag. */
diff --git a/src/H5HF.c b/src/H5HF.c
index a9750c9..64e8af2 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -439,14 +439,8 @@ H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *_id, size_t *obj_len_p)
/* Check type of object in heap */
if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) {
- /* Skip over the flag byte */
- id++;
-
- /* Skip over object offset */
- id += fh->hdr->heap_off_size;
-
- /* Retrieve the entry length */
- UINT64DECODE_VAR(id, *obj_len_p, fh->hdr->heap_len_size);
+ if(H5HF_man_get_obj_len(fh->hdr, id, obj_len_p) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'managed' object's length")
} /* end if */
else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) {
if(H5HF_huge_get_obj_len(fh->hdr, dxpl_id, id, obj_len_p) < 0)
@@ -457,8 +451,8 @@ H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *_id, size_t *obj_len_p)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'tiny' object's length")
} /* end if */
else {
-HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
-HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
+ HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
+ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
} /* end else */
done:
diff --git a/src/H5HFman.c b/src/H5HFman.c
index 62f5580..58e3318 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -218,6 +218,44 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HF_man_get_obj_len
+ *
+ * Purpose: Get the size of a managed heap object
+ *
+ * Return: SUCCEED (Can't fail)
+ *
+ * Programmer: Dana Robinson (derobins@hdfgroup.org)
+ * August 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p)
+{
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /*
+ * Check arguments.
+ */
+ HDassert(hdr);
+ HDassert(id);
+ HDassert(obj_len_p);
+
+ /* Skip over the flag byte */
+ id++;
+
+ /* Skip over object offset */
+ id += hdr->heap_off_size;
+
+ /* Retrieve the entry length */
+ UINT64DECODE_VAR(id, *obj_len_p, hdr->heap_len_size);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HF_man_get_obj_len() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HF_man_op_real
*
* Purpose: Internal routine to perform an operation on a managed heap
diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h
index 498c45e..e0deca7 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -662,6 +662,8 @@ H5_DLL herr_t H5HF_man_dblock_dest(H5HF_direct_t *dblock);
/* Managed object routines */
H5_DLL herr_t H5HF_man_insert(H5HF_hdr_t *fh, hid_t dxpl_id, size_t obj_size,
const void *obj, void *id);
+H5_DLL herr_t H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id,
+ size_t *obj_len_p);
H5_DLL herr_t H5HF_man_read(H5HF_hdr_t *fh, hid_t dxpl_id, const uint8_t *id,
void *obj);
H5_DLL herr_t H5HF_man_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
diff --git a/src/H5HFsection.c b/src/H5HFsection.c
index e9ea7e0..72ea100 100644
--- a/src/H5HFsection.c
+++ b/src/H5HFsection.c
@@ -2398,7 +2398,10 @@ H5HF_sect_indirect_init_rows(H5HF_hdr_t *hdr, hid_t dxpl_id,
HDassert(sect->u.indirect.span_size > 0);
/* Reset reference count for indirect section */
+ /* (Also reset the direct & indirect row pointers */
sect->u.indirect.rc = 0;
+ sect->u.indirect.dir_rows = NULL;
+ sect->u.indirect.indir_ents = NULL;
/* Set up direct block information, if necessary */
if(start_row < hdr->man_dtable.max_direct_rows) {
@@ -2424,7 +2427,6 @@ H5HF_sect_indirect_init_rows(H5HF_hdr_t *hdr, hid_t dxpl_id,
/* No rows of direct blocks covered, reset direct row information */
dir_nrows = 0;
sect->u.indirect.dir_nrows = 0;
- sect->u.indirect.dir_rows = NULL;
} /* end else */
/* Set up indirect block information, if necessary */
@@ -2459,7 +2461,6 @@ H5HF_sect_indirect_init_rows(H5HF_hdr_t *hdr, hid_t dxpl_id,
else {
/* No indirect block entries covered, reset indirect row information */
sect->u.indirect.indir_nents = 0;
- sect->u.indirect.indir_ents = NULL;
} /* end else */
/* Set up initial row information */
@@ -2598,6 +2599,13 @@ H5HF_sect_indirect_init_rows(H5HF_hdr_t *hdr, hid_t dxpl_id,
(sect->u.indirect.indir_nents + sect->u.indirect.dir_nrows));
done:
+ if(ret_value < 0) {
+ if(sect->u.indirect.indir_ents)
+ H5MM_xfree(sect->u.indirect.indir_ents);
+ if(sect->u.indirect.dir_rows)
+ H5MM_xfree(sect->u.indirect.dir_rows);
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_sect_indirect_init_rows() */
diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c
index a4cbdc1..27ab443 100644
--- a/src/H5HFtiny.c
+++ b/src/H5HFtiny.c
@@ -15,11 +15,11 @@
/*-------------------------------------------------------------------------
*
- * Created: H5HFtiny.c
- * Aug 14 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5HFtiny.c
+ * Aug 14 2006
+ * Quincey Koziol <koziol@hdfgroup.org>
*
- * Purpose: Routines for "tiny" objects in fractal heap
+ * Purpose: Routines for "tiny" objects in fractal heap
*
*-------------------------------------------------------------------------
*/
@@ -28,15 +28,15 @@
/* Module Setup */
/****************/
-#define H5HF_PACKAGE /*suppress error about including H5HFpkg */
+#define H5HF_PACKAGE /* suppress error about including H5HFpkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5HFpkg.h" /* Fractal heaps */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5HFpkg.h" /* Fractal heaps */
/****************/
@@ -44,11 +44,11 @@
/****************/
/* Tiny object length information */
-#define H5HF_TINY_LEN_SHORT 16 /* Max. length able to be encoded in first heap ID byte */
-#define H5HF_TINY_MASK_SHORT 0x0F /* Mask for length in first heap ID byte */
-#define H5HF_TINY_MASK_EXT 0x0FFF /* Mask for length in two heap ID bytes */
-#define H5HF_TINY_MASK_EXT_1 0x0F00 /* Mask for length in first byte of two heap ID bytes */
-#define H5HF_TINY_MASK_EXT_2 0x00FF /* Mask for length in second byte of two heap ID bytes */
+#define H5HF_TINY_LEN_SHORT 16 /* Max. length able to be encoded in first heap ID byte */
+#define H5HF_TINY_MASK_SHORT 0x0F /* Mask for length in first heap ID byte */
+#define H5HF_TINY_MASK_EXT 0x0FFF /* Mask for length in two heap ID bytes */
+#define H5HF_TINY_MASK_EXT_1 0x0F00 /* Mask for length in first byte of two heap ID bytes */
+#define H5HF_TINY_MASK_EXT_2 0x00FF /* Mask for length in second byte of two heap ID bytes */
/******************/
@@ -84,15 +84,15 @@ static herr_t H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id,
/*-------------------------------------------------------------------------
- * Function: H5HF_tiny_init
+ * Function: H5HF_tiny_init
*
- * Purpose: Initialize information for tracking 'tiny' objects
+ * Purpose: Initialize information for tracking 'tiny' objects
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Aug 14 2006
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Aug 14 2006
*
*-------------------------------------------------------------------------
*/
@@ -131,15 +131,15 @@ H5HF_tiny_init(H5HF_hdr_t *hdr)
/*-------------------------------------------------------------------------
- * Function: H5HF_tiny_insert
+ * Function: H5HF_tiny_insert
*
- * Purpose: Pack a 'tiny' object in a heap ID
+ * Purpose: Pack a 'tiny' object in a heap ID
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Aug 14 2006
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Aug 14 2006
*
*-------------------------------------------------------------------------
*/
@@ -196,15 +196,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5HF_tiny_get_obj_len
+ * Function: H5HF_tiny_get_obj_len
*
- * Purpose: Get the size of a 'tiny' object in a fractal heap
+ * Purpose: Get the size of a 'tiny' object in a fractal heap
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED (Can't fail)
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Aug 14 2006
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Aug 14 2006
*
*-------------------------------------------------------------------------
*/
@@ -226,9 +226,9 @@ H5HF_tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p)
if(!hdr->tiny_len_extended)
enc_obj_size = *id & H5HF_TINY_MASK_SHORT;
else
- /* (performed in this odd way to avoid compiler bug on tg-login3 with
- * gcc 3.2.2 - QAK)
- */
+ /* (performed in this odd way to avoid compiler bug on tg-login3 with
+ * gcc 3.2.2 - QAK)
+ */
enc_obj_size = *(id + 1) | ((*id & H5HF_TINY_MASK_EXT_1) << 8);
/* Set the object's length */
@@ -239,15 +239,15 @@ H5HF_tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p)
/*-------------------------------------------------------------------------
- * Function: H5HF_tiny_op_real
+ * Function: H5HF_tiny_op_real
*
- * Purpose: Internal routine to perform operation on 'tiny' object
+ * Purpose: Internal routine to perform operation on 'tiny' object
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Sep 11 2006
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
*
*-------------------------------------------------------------------------
*/
@@ -266,31 +266,23 @@ H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op,
HDassert(hdr);
HDassert(id);
HDassert(op);
-
- /* Check if 'tiny' object ID is in extended form */
- if(!hdr->tiny_len_extended) {
- /* Retrieve the object's encoded length */
- enc_obj_size = *id & H5HF_TINY_MASK_SHORT;
-
- /* Advance past flag byte(s) */
+
+ /* Get the object's encoded length */
+ /* H5HF_tiny_obj_len can't fail */
+ ret_value = H5HF_tiny_get_obj_len(hdr, id, &enc_obj_size);
+
+ /* Advance past flag byte(s) */
+ if(!hdr->tiny_len_extended)
id++;
- } /* end if */
else {
- /* Retrieve the object's encoded length */
- /* (performed in this odd way to avoid compiler bug on tg-login3 with
- * gcc 3.2.2 - QAK)
- */
- enc_obj_size = *(id + 1) | ((*id & H5HF_TINY_MASK_EXT_1) << 8);
-
- /* Advance past flag byte(s) */
- /* (performed in two steps to avoid compiler bug on tg-login3 with
- * gcc 3.2.2 - QAK)
- */
+ /* (performed in two steps to avoid compiler bug on tg-login3 with
+ * gcc 3.2.2 - QAK)
+ */
id++; id++;
- } /* end else */
+ }
/* Call the user's 'op' callback */
- if(op(id, (enc_obj_size + 1), op_data) < 0)
+ if(op(id, enc_obj_size, op_data) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "application's callback failed")
done:
@@ -299,15 +291,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5HF_tiny_read
+ * Function: H5HF_tiny_read
*
- * Purpose: Read a 'tiny' object from the heap
+ * Purpose: Read a 'tiny' object from the heap
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Aug 8 2006
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Aug 8 2006
*
*-------------------------------------------------------------------------
*/
@@ -335,15 +327,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5HF_tiny_op
+ * Function: H5HF_tiny_op
*
- * Purpose: Operate directly on a 'tiny' object
+ * Purpose: Operate directly on a 'tiny' object
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Sept 11 2006
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sept 11 2006
*
*-------------------------------------------------------------------------
*/
@@ -372,15 +364,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5HF_tiny_remove
+ * Function: H5HF_tiny_remove
*
- * Purpose: Remove a 'tiny' object from the heap statistics
+ * Purpose: Remove a 'tiny' object from the heap statistics
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Aug 14 2006
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Aug 14 2006
*
*-------------------------------------------------------------------------
*/
@@ -398,17 +390,12 @@ H5HF_tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id)
HDassert(hdr);
HDassert(id);
- /* Check if 'tiny' object ID is in extended form */
- if(!hdr->tiny_len_extended)
- enc_obj_size = *id & H5HF_TINY_MASK_SHORT;
- else
- /* (performed in this odd way to avoid compiler bug on tg-login3 with
- * gcc 3.2.2 - QAK)
- */
- enc_obj_size = *(id + 1) | ((*id & H5HF_TINY_MASK_EXT_1) << 8);
+ /* Get the object's encoded length */
+ /* H5HF_tiny_obj_len can't fail */
+ ret_value = H5HF_tiny_get_obj_len(hdr, id, &enc_obj_size);
/* Update statistics about heap */
- hdr->tiny_size -= (enc_obj_size + 1);
+ hdr->tiny_size -= enc_obj_size;
hdr->tiny_nobjs--;
/* Mark heap header as modified */
@@ -418,4 +405,3 @@ H5HF_tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_tiny_remove() */
-
diff --git a/src/H5HG.c b/src/H5HG.c
index 0a97e47..7a90475 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -136,7 +136,7 @@ H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size)
{
H5HG_heap_t *heap = NULL;
uint8_t *p = NULL;
- haddr_t addr;
+ haddr_t addr = HADDR_UNDEF;
size_t n;
haddr_t ret_value = HADDR_UNDEF; /* Return value */
diff --git a/src/H5MF.c b/src/H5MF.c
index 5b4505f..4b0668f 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -245,6 +245,7 @@ H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type)
*/
HDassert(f);
HDassert(f->shared);
+ HDassert(type != H5FD_MEM_NOLIST);
HDassert(H5F_addr_defined(f->shared->fs_addr[type]));
HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED);
@@ -292,6 +293,7 @@ H5MF_alloc_create(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type)
*/
HDassert(f);
HDassert(f->shared);
+ HDassert(type != H5FD_MEM_NOLIST);
HDassert(!H5F_addr_defined(f->shared->fs_addr[type]));
HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED);
@@ -342,6 +344,7 @@ H5MF_alloc_start(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type)
*/
HDassert(f);
HDassert(f->shared);
+ HDassert(type != H5FD_MEM_NOLIST);
/* Check if the free space manager exists already */
if(H5F_addr_defined(f->shared->fs_addr[type])) {
@@ -384,6 +387,7 @@ H5MF_alloc_close(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type)
*/
HDassert(f);
HDassert(f->shared);
+ HDassert(type != H5FD_MEM_NOLIST);
HDassert(f->shared->fs_man[type]);
HDassert(f->shared->fs_state[type] != H5F_FS_STATE_CLOSED);
@@ -483,6 +487,7 @@ HDfprintf(stderr, "%s: Check 1.6, freeing node\n", FUNC);
udata.dxpl_id = dxpl_id;
udata.alloc_type = alloc_type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Check 1.7, re-adding node, node->sect_info.size = %Hu\n", FUNC, node->sect_info.size);
@@ -688,6 +693,7 @@ HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, a
udata.dxpl_id = dxpl_id;
udata.alloc_type = alloc_type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* If size of section freed is larger than threshold, add it to the free space manager */
if(size >= f->shared->fs_threshold) {
@@ -819,6 +825,11 @@ H5MF_sects_dump(f, dxpl_id, stderr);
* Programmer: Quincey Koziol
* Monday, October 6, 2003
*
+ * Modifications:
+ * Vailin Choi; July 2012
+ * As the default free-list mapping is changed to H5FD_FLMAP_DICHOTOMY,
+ * checks are added to account for the last section of each free-space manager
+ * and the remaining space in the two aggregators are at EOF.
*-------------------------------------------------------------------------
*/
herr_t
@@ -832,6 +843,8 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si
hsize_t tot_fs_size = 0; /* Amount of all free space managed */
hsize_t tot_meta_size = 0; /* Amount of metadata for free space managers */
H5FD_mem_t type; /* Memory type for iteration */
+ H5FD_mem_t fs_started[H5FD_MEM_NTYPES]; /* Indicate whether the free-space manager has been started */
+ hbool_t eoa_shrank; /* Whether an EOA shrink occurs */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -855,14 +868,15 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si
/* Iterate over all the free space types that have managers and get each free list's space */
for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
- hbool_t fs_started = FALSE;
+
+ fs_started[type] = FALSE;
/* Check if the free space for the file has been initialized */
if(!f->shared->fs_man[type] && H5F_addr_defined(f->shared->fs_addr[type])) {
if(H5MF_alloc_open(f, dxpl_id, type) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space")
HDassert(f->shared->fs_man[type]);
- fs_started = TRUE;
+ fs_started[type] = TRUE;
} /* end if */
/* Check if there's free space of this type */
@@ -880,32 +894,54 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si
tot_fs_size += type_fs_size;
tot_meta_size += type_meta_size;
} /* end if */
+ } /* end for */
- /* Close the free space manager, if we opened it here */
- if(fs_started)
+ /* Iterate until no more EOA shrink occurs */
+ do {
+ eoa_shrank = FALSE;
+
+ /* Check the last section of each free-space manager */
+ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
+ haddr_t sect_addr = HADDR_UNDEF;
+ hsize_t sect_size = 0;
+
+ if(f->shared->fs_man[type]) {
+ if(H5FS_sect_query_last_sect(f->shared->fs_man[type], &sect_addr, &sect_size) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query last section on merge list")
+
+ /* Deduct space from previous accumulation if the section is at EOA */
+ if(H5F_addr_eq(sect_addr + sect_size, eoa)) {
+ eoa = sect_addr;
+ eoa_shrank = TRUE;
+ tot_fs_size -= sect_size;
+ } /* end if */
+ } /* end if */
+ } /* end for */
+
+ /* Check the metadata and raw data aggregators */
+ if(ma_size > 0 && H5F_addr_eq(ma_addr + ma_size, eoa)) {
+ eoa = ma_addr;
+ eoa_shrank = TRUE;
+ ma_size = 0;
+ } /* end if */
+ if(sda_size > 0 && H5F_addr_eq(sda_addr + sda_size, eoa)) {
+ eoa = sda_addr;
+ eoa_shrank = TRUE;
+ sda_size = 0;
+ } /* end if */
+ } while(eoa_shrank);
+
+ /* Close the free-space managers if they were opened earlier in this routine */
+ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
+ if(fs_started[type])
if(H5MF_alloc_close(f, dxpl_id, type) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't close file free space")
} /* end for */
- /* Check for aggregating metadata allocations */
- if(ma_size > 0) {
- /* Add in the reserved space for metadata to the available free space */
- /* (if it's not at the tail of the file) */
- if(H5F_addr_ne(ma_addr + ma_size, eoa))
- tot_fs_size += ma_size;
- } /* end if */
-
- /* Check for aggregating small data allocations */
- if(sda_size > 0) {
- /* Add in the reserved space for metadata to the available free space */
- /* (if it's not at the tail of the file) */
- if(H5F_addr_ne(sda_addr + sda_size, eoa))
- tot_fs_size += sda_size;
- } /* end if */
-
/* Set the value(s) to return */
+ /* (The metadata & small data aggregators count as free space now, since they aren't at EOA) */
if(tot_space)
- *tot_space = tot_fs_size;
+ *tot_space = tot_fs_size + ma_size + sda_size;
if(meta_size)
*meta_size = tot_meta_size;
@@ -957,6 +993,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN
udata.dxpl_id = dxpl_id;
udata.alloc_type = alloc_type;
udata.allow_sect_absorb = FALSE; /* Force section to be absorbed into aggregator */
+ udata.allow_eoa_shrink_only = FALSE;
/* Call the "can shrink" callback for the section */
if((ret_value = H5MF_sect_simple_can_shrink((const H5FS_section_info_t *)node, &udata)) < 0)
@@ -980,6 +1017,66 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
/*-------------------------------------------------------------------------
+ * Function: H5MF_close_shrink_eoa
+ *
+ * Purpose: Shrink the EOA while closing
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, July 7, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5MF_close_shrink_eoa(H5F_t *f, hid_t dxpl_id)
+{
+ H5FD_mem_t type; /* Memory type for iteration */
+ hbool_t eoa_shrank; /* Whether an EOA shrink occurs */
+ htri_t status; /* Status value */
+ H5MF_sect_ud_t udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* check args */
+ HDassert(f);
+ HDassert(f->shared);
+
+ /* Construct user data for callbacks */
+ udata.f = f;
+ udata.dxpl_id = dxpl_id;
+ udata.allow_sect_absorb = FALSE;
+ udata.allow_eoa_shrink_only = TRUE;
+
+ /* Iterate until no more EOA shrinking occurs */
+ do {
+ eoa_shrank = FALSE;
+
+ /* Check the last section of each free-space manager */
+ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
+ if(f->shared->fs_man[type]) {
+ udata.alloc_type = type;
+ if((status = H5FS_sect_try_shrink_eoa(f, dxpl_id, f->shared->fs_man[type], &udata)) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa")
+ else if(status > 0)
+ eoa_shrank = TRUE;
+ } /* end if */
+ } /* end for */
+
+ /* check the two aggregators */
+ if((status = H5MF_aggrs_try_shrink_eoa(f, dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa")
+ else if(status > 0)
+ eoa_shrank = TRUE;
+ } while(eoa_shrank);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5MF_close_shrink_eoa() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5MF_close
*
* Purpose: Close the free space tracker(s) for a file
@@ -989,6 +1086,12 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
* Programmer: Quincey Koziol
* Tuesday, January 22, 2008
*
+ * Modifications:
+ * Vailin Choi; July 2012
+ * As the default free-list mapping is changed to H5FD_FLMAP_DICHOTOMY,
+ * modifications are needed to shrink EOA if the last section of each free-space manager
+ * and the remaining space in the two aggregators are at EOA.
+
*-------------------------------------------------------------------------
*/
herr_t
@@ -1013,6 +1116,10 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
if(H5MF_free_aggrs(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't free aggregators")
+ /* Trying shrinking the EOA for the file */
+ if(H5MF_close_shrink_eoa(f, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa")
+
/* Making free-space managers persistent for superblock version >= 2 */
if(f->shared->sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_2
&& f->shared->fs_strategy == H5F_FILE_SPACE_ALL_PERSIST) {
@@ -1160,6 +1267,11 @@ HDfprintf(stderr, "%s: Before deleting free space manager\n", FUNC);
if(H5MF_free_aggrs(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't free aggregators")
+ /* Trying shrinking the EOA for the file */
+ /* (in case any free space is now at the EOA) */
+ if(H5MF_close_shrink_eoa(f, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa")
+
done:
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: Leaving\n", FUNC);
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index 6f68fd7..f015b19 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -57,6 +57,8 @@
/********************/
/* Local Prototypes */
/********************/
+static herr_t H5MF_aggr_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type,
+ H5F_blk_aggr_t *aggr);
/*********************/
@@ -231,15 +233,14 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
if(H5F_addr_gt((eoa + size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
+ /* Release "other" aggregator, if it exists, is at the end of the allocated space,
+ * has allocated more than one block and the unallocated space is greater than its
+ * allocation block size.
+ */
if ((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) &&
- ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
-
- if(H5FD_free(f->shared->lf, dxpl_id, other_alloc_type, f, other_aggr->addr, other_aggr->size) < 0)
+ (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
+ if(H5MF_aggr_free(f, dxpl_id, other_alloc_type, other_aggr) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block")
-
- other_aggr->addr = 0;
- other_aggr->tot_size = 0;
- other_aggr->size = 0;
} /* end if */
/* Allocate space from the VFD (i.e. at the end of the file) */
@@ -275,14 +276,14 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
if(H5F_addr_gt((eoa + aggr->alloc_size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
+ /* Release "other" aggregator, if it exists, is at the end of the allocated space,
+ * has allocated more than one block and the unallocated space is greater than its
+ * allocation block size.
+ */
if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) &&
- ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
-
- if(H5FD_free(f->shared->lf, dxpl_id, other_alloc_type, f, other_aggr->addr, other_aggr->size) < 0)
+ (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
+ if(H5MF_aggr_free(f, dxpl_id, other_alloc_type, other_aggr) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block")
- other_aggr->addr = 0;
- other_aggr->tot_size = 0;
- other_aggr->size = 0;
} /* end if */
/* Allocate space from the VFD (i.e. at the end of the file) */
@@ -633,8 +634,10 @@ H5MF_aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr,
/* Check if this aggregator is active */
if(f->shared->feature_flags & aggr->feature_flag) {
- *addr = aggr->addr;
- *size = aggr->size;
+ if(addr)
+ *addr = aggr->addr;
+ if(size)
+ *size = aggr->size;
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -766,3 +769,131 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF_free_aggrs() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5MF_aggr_can_shrink_eoa
+ *
+ * Purpose: Check if the remaining space in the aggregator is at EOA
+ *
+ * Return: Success: non-negative (TRUE/FALSE)
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ *
+ *-------------------------------------------------------------------------
+ */
+static htri_t
+H5MF_aggr_can_shrink_eoa(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr)
+{
+ haddr_t eoa = HADDR_UNDEF; /* EOA for the file */
+ htri_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(aggr);
+ HDassert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA);
+
+ /* Get the EOA for the file */
+ if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa")
+
+ /* Check if the aggregator is at EOA */
+ if(aggr->size > 0 && H5F_addr_defined(aggr->addr))
+ ret_value = H5F_addr_eq(eoa, aggr->addr + aggr->size);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5MF_aggr_can_shrink_eoa() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5MF_aggr_free
+ *
+ * Purpose: Free the aggregator's space in the file.
+ *
+ * Note: Does _not_ put the space on a free list
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Vailin Choi
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5MF_aggr_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, H5F_blk_aggr_t *aggr)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(f->shared->lf);
+ HDassert(aggr);
+ HDassert(H5F_addr_defined(aggr->addr));
+ HDassert(aggr->size > 0);
+ HDassert(H5F_INTENT(f) & H5F_ACC_RDWR);
+ HDassert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA);
+ HDassert(f->shared->feature_flags & aggr->feature_flag);
+
+ /* Free the remaining space at EOA in the aggregator */
+ if(H5FD_free(f->shared->lf, dxpl_id, type, f, aggr->addr, aggr->size) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free aggregation block")
+
+ /* Reset the aggregator */
+ aggr->tot_size = 0;
+ aggr->addr = HADDR_UNDEF;
+ aggr->size = 0;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5MF_aggr_free() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5MF_aggrs_try_shrink_eoa
+ *
+ * Purpose: Check the metadata & small block aggregators to see if
+ * EOA shrink is possible; if so, shrink each aggregator
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Vailin Choi
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5MF_aggrs_try_shrink_eoa(H5F_t *f, hid_t dxpl_id)
+{
+ htri_t ma_status; /* Whether the metadata aggregator can shrink the EOA */
+ htri_t sda_status; /* Whether the small data aggregator can shrink the EOA */
+ htri_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check args */
+ HDassert(f);
+ HDassert(f->shared);
+
+ if((ma_status = H5MF_aggr_can_shrink_eoa(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr))) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats")
+ if(ma_status > 0)
+ if(H5MF_aggr_free(f, dxpl_id, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr)) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa")
+
+ if((sda_status = H5MF_aggr_can_shrink_eoa(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr))) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats")
+ if(sda_status > 0)
+ if(H5MF_aggr_free(f, dxpl_id, H5FD_MEM_DRAW, &(f->shared->sdata_aggr)) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa")
+
+ ret_value = (ma_status || sda_status);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5MF_aggrs_try_shrink_eoa() */
+
diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h
index 25785ae..2071a0a 100644
--- a/src/H5MFpkg.h
+++ b/src/H5MFpkg.h
@@ -122,6 +122,7 @@ typedef struct H5MF_sect_ud_t {
hid_t dxpl_id; /* DXPL for VFD operations */
H5FD_mem_t alloc_type; /* Type of memory being allocated */
hbool_t allow_sect_absorb; /* Whether sections are allowed to absorb a block aggregator */
+ hbool_t allow_eoa_shrink_only; /* Whether shrinking eoa is allowed only for the section */
/* Up */
H5MF_shrink_type_t shrink; /* Type of shrink operation to perform */
diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h
index b471aa3..ad5e385 100644
--- a/src/H5MFprivate.h
+++ b/src/H5MFprivate.h
@@ -81,6 +81,7 @@ H5_DLL haddr_t H5MF_alloc_tmp(H5F_t *f, hsize_t size);
/* 'block aggregator' routines */
H5_DLL herr_t H5MF_free_aggrs(H5F_t *f, hid_t dxpl_id);
+H5_DLL htri_t H5MF_aggrs_try_shrink_eoa(H5F_t *f, hid_t dxpl_id);
/* Debugging routines */
#ifdef H5MF_DEBUGGING
diff --git a/src/H5MFsection.c b/src/H5MFsection.c
index 89b2219..0572def 100644
--- a/src/H5MFsection.c
+++ b/src/H5MFsection.c
@@ -328,6 +328,10 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect-
HGOTO_DONE(TRUE)
} /* end if */
else {
+ /* Shrinking can't occur if the 'eoa_shrink_only' flag is set and we're not shrinking the EOA */
+ if(udata->allow_eoa_shrink_only)
+ HGOTO_DONE(FALSE)
+
/* Check if this section is allowed to merge with metadata aggregation block */
if(udata->f->shared->fs_aggr_merge[udata->alloc_type] & H5F_FS_MERGE_METADATA) {
htri_t status; /* Status from aggregator adjoin */
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 98d8d95..149199f 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -1106,11 +1106,15 @@ H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
FUNC_ENTER_NOAPI_NOINIT
+ /* Sanity check */
HDassert(oloc_src);
HDassert(oloc_src->file);
HDassert(H5F_addr_defined(oloc_src->addr));
HDassert(oloc_dst->file);
+ /* Intialize copy info before errors can be thrown */
+ HDmemset(&cpy_info, 0, sizeof(H5O_copy_t));
+
/* Get the copy property list */
if(NULL == (ocpy_plist = (H5P_genplist_t *)H5I_object(ocpypl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
@@ -1128,7 +1132,6 @@ H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get callback info")
/* Convert copy flags into copy struct */
- HDmemset(&cpy_info, 0, sizeof(H5O_copy_t));
if((cpy_option & H5O_COPY_SHALLOW_HIERARCHY_FLAG) > 0) {
cpy_info.copy_shallow = TRUE;
cpy_info.max_depth = 1;
@@ -1602,6 +1605,10 @@ done:
* Programmer: Neil Fortner
* Nov 3 2011
*
+ * Modifications:
+ * Vailin Choi; August 2012
+ * Use H5O_obj_class to get object type instead of
+ * H5O_get_info(...TRUE....) saving time in traversing metadata.
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1611,8 +1618,8 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc,
H5O_copy_search_comm_dt_key_t *key = NULL; /* Skiplist key */
haddr_t *addr = NULL; /* Destination address */
hbool_t obj_inserted = FALSE; /* Object inserted into skip list */
- H5O_info_t oinfo; /* Object info */
H5A_attr_iter_op_t attr_op; /* Attribute iteration operator */
+ const H5O_obj_class_t *obj_class = NULL; /* Type of object */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1623,13 +1630,13 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc,
HDassert(udata->dst_dt_list);
HDassert(udata->dst_root_loc);
- /* Get the object's info */
- if(H5O_get_info(obj_oloc, udata->dxpl_id, TRUE, &oinfo) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info")
+ /* Get pointer to object class for this object */
+ if((obj_class = H5O_obj_class(obj_oloc, udata->dxpl_id)) == NULL)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type")
/* Check if the object is a datatype, a dataset using a committed
* datatype, or contains an attribute using a committed datatype */
- if(oinfo.type == H5O_TYPE_NAMED_DATATYPE) {
+ if(obj_class->type == H5O_TYPE_NAMED_DATATYPE) {
/* Allocate key */
if(NULL == (key = H5FL_MALLOC(H5O_copy_search_comm_dt_key_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
@@ -1654,7 +1661,7 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc,
obj_inserted = TRUE;
} /* end if */
} /* end if */
- else if(oinfo.type == H5O_TYPE_DATASET) {
+ else if(obj_class->type == H5O_TYPE_DATASET) {
/* Allocate key */
if(NULL == (key = H5FL_MALLOC(H5O_copy_search_comm_dt_key_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
diff --git a/src/H5Otest.c b/src/H5Otest.c
index 705f716..d1627ef 100644
--- a/src/H5Otest.c
+++ b/src/H5Otest.c
@@ -516,7 +516,7 @@ H5O_expunge_chunks_test(const H5O_loc_t *loc, hid_t dxpl_id)
/* Safety check */
nchunks = oh->nchunks;
- HDassert(nchunks < NELMTS(chk_addr));
+ HDassert(0 < nchunks && nchunks < NELMTS(chk_addr));
/* Iterate over all the chunks, saving the chunk addresses */
for(u = 0; u < oh->nchunks; u++)
diff --git a/src/H5P.c b/src/H5P.c
index abbfe4b..ba286fb 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -118,7 +118,7 @@ H5P_init_pub_interface(void)
hid_t
H5Pcopy(hid_t id)
{
- void *obj; /* Property object to copy */
+ void *obj; /* Property object to copy */
hid_t ret_value=FALSE; /* return value */
FUNC_ENTER_API(FAIL)
@@ -224,7 +224,7 @@ H5Pcreate_class(hid_t parent, const char *name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't retrieve parent class")
/* Create the new property list class */
- if(NULL == (pclass = H5P_create_class(par_class, name, FALSE, cls_create, create_data, cls_copy, copy_data, cls_close, close_data)))
+ if(NULL == (pclass = H5P_create_class(par_class, name, H5P_TYPE_USER, cls_create, create_data, cls_copy, copy_data, cls_close, close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list class")
/* Get an atom for the class */
@@ -1147,6 +1147,7 @@ H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data)
{
H5P_iter_ud_t udata; /* User data for internal iterator callback */
int fake_idx = 0; /* Index when user doesn't provide one */
+ void *obj; /* Property object to copy */
int ret_value; /* return value */
FUNC_ENTER_API(FAIL)
@@ -1155,6 +1156,8 @@ H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data)
/* Check arguments. */
if(H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property object");
+ if(NULL == (obj = H5I_object(id)))
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist");
if(iter_func == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration callback");
@@ -1165,13 +1168,13 @@ H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data)
if(H5I_GENPROP_LST == H5I_get_type(id)) {
/* Iterate over a property list */
- if((ret_value = H5P_iterate_plist(id, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
+ if((ret_value = H5P_iterate_plist((H5P_genplist_t *)obj, TRUE, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over list");
} /* end if */
else
if(H5I_GENPROP_CLS == H5I_get_type(id)) {
/* Iterate over a property class */
- if((ret_value = H5P_iterate_pclass(id, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
+ if((ret_value = H5P_iterate_pclass((H5P_genclass_t *)obj, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over class");
} /* end if */
else
diff --git a/src/H5Pacpl.c b/src/H5Pacpl.c
index be61bfc..206c1d3 100644
--- a/src/H5Pacpl.c
+++ b/src/H5Pacpl.c
@@ -70,6 +70,7 @@ static herr_t H5P_acrt_reg_prop(H5P_genclass_t *pclass);
/* Attribute creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_ACRT[1] = {{
"attribute create", /* Class name for debugging */
+ H5P_TYPE_ATTRIBUTE_CREATE, /* Class type */
&H5P_CLS_STRING_CREATE_g, /* Parent class ID */
&H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class ID */
&H5P_LST_ATTRIBUTE_CREATE_g, /* Pointer to default property list ID */
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index 9e75eaa..d21cdbf 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -82,15 +82,16 @@ static herr_t H5P__dacc_reg_prop(H5P_genclass_t *pclass);
/* Dataset access property list class library initialization object */
const H5P_libclass_t H5P_CLS_DACC[1] = {{
"dataset access", /* Class name for debugging */
+ H5P_TYPE_DATASET_ACCESS, /* Class type */
&H5P_CLS_LINK_ACCESS_g, /* Parent class ID */
&H5P_CLS_DATASET_ACCESS_g, /* Pointer to class ID */
&H5P_LST_DATASET_ACCESS_g, /* Pointer to default property list ID */
H5P__dacc_reg_prop, /* Default property registration routine */
- NULL, /* Class creation callback */
+ NULL, /* Class creation callback */
NULL, /* Class creation callback info */
- NULL, /* Class copy callback */
+ NULL, /* Class copy callback */
NULL, /* Class copy callback info */
- NULL, /* Class close callback */
+ NULL, /* Class close callback */
NULL /* Class close callback info */
}};
@@ -271,3 +272,4 @@ H5Pget_chunk_cache(hid_t dapl_id, size_t *rdcc_nslots, size_t *rdcc_nbytes, doub
done:
FUNC_LEAVE_API(ret_value)
}
+
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index a9b8079..ba5fa9e 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -128,6 +128,7 @@ static int H5P__dcrt_ext_file_list_cmp(const void *value1, const void *value2, s
/* Dataset creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_DCRT[1] = {{
"dataset create", /* Class name for debugging */
+ H5P_TYPE_DATASET_CREATE, /* Class type */
&H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */
&H5P_CLS_DATASET_CREATE_g, /* Pointer to class ID */
&H5P_LST_DATASET_CREATE_g, /* Pointer to default property list ID */
@@ -1526,7 +1527,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/,
+H5P_get_fill_value(H5P_genplist_t *plist, H5T_t *type, void *value/*out*/,
hid_t dxpl_id)
{
H5O_fill_t fill; /* Fill value to retrieve */
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index a4fc749..3eeb7d5 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -47,50 +47,46 @@
/* ======== Data transfer properties ======== */
/* Definitions for maximum temp buffer size property */
-#define H5D_XFER_MAX_TEMP_BUF_SIZE sizeof(size_t)
-#define H5D_XFER_MAX_TEMP_BUF_DEF H5D_TEMP_BUF_SIZE
+#define H5D_XFER_MAX_TEMP_BUF_SIZE sizeof(size_t)
+#define H5D_XFER_MAX_TEMP_BUF_DEF H5D_TEMP_BUF_SIZE
/* Definitions for type conversion buffer property */
-#define H5D_XFER_TCONV_BUF_SIZE sizeof(void *)
-#define H5D_XFER_TCONV_BUF_DEF NULL
+#define H5D_XFER_TCONV_BUF_SIZE sizeof(void *)
+#define H5D_XFER_TCONV_BUF_DEF NULL
/* Definitions for background buffer property */
-#define H5D_XFER_BKGR_BUF_SIZE sizeof(void *)
-#define H5D_XFER_BKGR_BUF_DEF NULL
+#define H5D_XFER_BKGR_BUF_SIZE sizeof(void *)
+#define H5D_XFER_BKGR_BUF_DEF NULL
/* Definitions for background buffer type property */
-#define H5D_XFER_BKGR_BUF_TYPE_SIZE sizeof(H5T_bkg_t)
+#define H5D_XFER_BKGR_BUF_TYPE_SIZE sizeof(H5T_bkg_t)
#define H5D_XFER_BKGR_BUF_TYPE_DEF H5T_BKG_NO
/* Definitions for B-tree node splitting ratio property */
/* (These default B-tree node splitting ratios are also used for splitting
* group's B-trees as well as chunked dataset's B-trees - QAK)
*/
-#define H5D_XFER_BTREE_SPLIT_RATIO_SIZE sizeof(double[3])
-#define H5D_XFER_BTREE_SPLIT_RATIO_DEF {0.1, 0.5, 0.9}
+#define H5D_XFER_BTREE_SPLIT_RATIO_SIZE sizeof(double[3])
+#define H5D_XFER_BTREE_SPLIT_RATIO_DEF {0.1, 0.5, 0.9}
/* Definitions for vlen allocation function property */
-#define H5D_XFER_VLEN_ALLOC_SIZE sizeof(H5MM_allocate_t)
-#define H5D_XFER_VLEN_ALLOC_DEF H5D_VLEN_ALLOC
+#define H5D_XFER_VLEN_ALLOC_SIZE sizeof(H5MM_allocate_t)
+#define H5D_XFER_VLEN_ALLOC_DEF H5D_VLEN_ALLOC
/* Definitions for vlen allocation info property */
-#define H5D_XFER_VLEN_ALLOC_INFO_SIZE sizeof(void *)
-#define H5D_XFER_VLEN_ALLOC_INFO_DEF H5D_VLEN_ALLOC_INFO
+#define H5D_XFER_VLEN_ALLOC_INFO_SIZE sizeof(void *)
+#define H5D_XFER_VLEN_ALLOC_INFO_DEF H5D_VLEN_ALLOC_INFO
/* Definitions for vlen free function property */
-#define H5D_XFER_VLEN_FREE_SIZE sizeof(H5MM_free_t)
-#define H5D_XFER_VLEN_FREE_DEF H5D_VLEN_FREE
+#define H5D_XFER_VLEN_FREE_SIZE sizeof(H5MM_free_t)
+#define H5D_XFER_VLEN_FREE_DEF H5D_VLEN_FREE
/* Definitions for vlen free info property */
-#define H5D_XFER_VLEN_FREE_INFO_SIZE sizeof(void *)
-#define H5D_XFER_VLEN_FREE_INFO_DEF H5D_VLEN_FREE_INFO
-/* Definitions for file driver ID property */
-#define H5D_XFER_VFL_ID_SIZE sizeof(hid_t)
-#define H5D_XFER_VFL_ID_DEF H5FD_VFD_DEFAULT
-/* Definitions for file driver info property */
-#define H5D_XFER_VFL_INFO_SIZE sizeof(void *)
-#define H5D_XFER_VFL_INFO_DEF NULL
+#define H5D_XFER_VLEN_FREE_INFO_SIZE sizeof(void *)
+#define H5D_XFER_VLEN_FREE_INFO_DEF H5D_VLEN_FREE_INFO
/* Definitions for hyperslab vector size property */
/* (Be cautious about increasing the default size, there are arrays allocated
* on the stack which depend on it - QAK)
*/
-#define H5D_XFER_HYPER_VECTOR_SIZE_SIZE sizeof(size_t)
-#define H5D_XFER_HYPER_VECTOR_SIZE_DEF H5D_IO_VECTOR_SIZE
+#define H5D_XFER_HYPER_VECTOR_SIZE_SIZE sizeof(size_t)
+#define H5D_XFER_HYPER_VECTOR_SIZE_DEF H5D_IO_VECTOR_SIZE
+
+#ifdef H5_HAVE_PARALLEL
/* Definitions for I/O transfer mode property */
-#define H5D_XFER_IO_XFER_MODE_SIZE sizeof(H5FD_mpio_xfer_t)
-#define H5D_XFER_IO_XFER_MODE_DEF H5FD_MPIO_INDEPENDENT
+#define H5D_XFER_IO_XFER_MODE_SIZE sizeof(H5FD_mpio_xfer_t)
+#define H5D_XFER_IO_XFER_MODE_DEF H5FD_MPIO_INDEPENDENT
/* Definitions for optimization of MPI-IO transfer mode property */
#define H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE sizeof(H5FD_mpio_collective_opt_t)
#define H5D_XFER_MPIO_COLLECTIVE_OPT_DEF H5FD_MPIO_COLLECTIVE_IO
@@ -106,6 +102,14 @@
/* Definitions for chunk io mode property. */
#define H5D_MPIO_ACTUAL_IO_MODE_SIZE sizeof(H5D_mpio_actual_io_mode_t)
#define H5D_MPIO_ACTUAL_IO_MODE_DEF H5D_MPIO_NO_COLLECTIVE
+/* Definitions for memory MPI type property */
+#define H5FD_MPI_XFER_MEM_MPI_TYPE_SIZE sizeof(MPI_Datatype)
+#define H5FD_MPI_XFER_MEM_MPI_TYPE_DEF MPI_DATATYPE_NULL
+/* Definitions for file MPI type property */
+#define H5FD_MPI_XFER_FILE_MPI_TYPE_SIZE sizeof(MPI_Datatype)
+#define H5FD_MPI_XFER_FILE_MPI_TYPE_DEF MPI_DATATYPE_NULL
+#endif /* H5_HAVE_PARALLEL */
+
/* Definitions for EDC property */
#define H5D_XFER_EDC_SIZE sizeof(H5Z_EDC_t)
#define H5D_XFER_EDC_DEF H5Z_ENABLE_EDC
@@ -118,15 +122,9 @@
/* Definitions for data transform property */
#define H5D_XFER_XFORM_SIZE sizeof(void *)
#define H5D_XFER_XFORM_DEF NULL
-#define H5D_XFER_XFORM_DEL H5P_dxfr_xform_del
-#define H5D_XFER_XFORM_COPY H5P_dxfr_xform_copy
-#define H5D_XFER_XFORM_CLOSE H5P_dxfr_xform_close
-/* Definitions for memory MPI type property */
-#define H5FD_MPI_XFER_MEM_MPI_TYPE_SIZE sizeof(MPI_Datatype)
-#define H5FD_MPI_XFER_MEM_MPI_TYPE_DEF MPI_DATATYPE_NULL
-/* Definitions for file MPI type property */
-#define H5FD_MPI_XFER_FILE_MPI_TYPE_SIZE sizeof(MPI_Datatype)
-#define H5FD_MPI_XFER_FILE_MPI_TYPE_DEF MPI_DATATYPE_NULL
+#define H5D_XFER_XFORM_DEL H5P__dxfr_xform_del
+#define H5D_XFER_XFORM_COPY H5P__dxfr_xform_copy
+#define H5D_XFER_XFORM_CLOSE H5P__dxfr_xform_close
/******************/
/* Local Typedefs */
@@ -143,15 +141,12 @@
/********************/
/* Property class callbacks */
-static herr_t H5P_dxfr_reg_prop(H5P_genclass_t *pclass);
-static herr_t H5P_dxfr_create(hid_t dxpl_id, void *create_data);
-static herr_t H5P_dxfr_copy(hid_t dst_dxpl_id, hid_t src_dxpl_id, void *copy_data);
-static herr_t H5P_dxfr_close(hid_t dxpl_id, void *close_data);
+static herr_t H5P__dxfr_reg_prop(H5P_genclass_t *pclass);
/* Property list callbacks */
-static herr_t H5P_dxfr_xform_del(hid_t prop_id, const char* name, size_t size, void* value);
-static herr_t H5P_dxfr_xform_copy(const char* name, size_t size, void* value);
-static herr_t H5P_dxfr_xform_close(const char* name, size_t size, void* value);
+static herr_t H5P__dxfr_xform_del(hid_t prop_id, const char* name, size_t size, void* value);
+static herr_t H5P__dxfr_xform_copy(const char* name, size_t size, void* value);
+static herr_t H5P__dxfr_xform_close(const char* name, size_t size, void* value);
/*********************/
@@ -161,15 +156,16 @@ static herr_t H5P_dxfr_xform_close(const char* name, size_t size, void* value);
/* Data transfer property list class library initialization object */
const H5P_libclass_t H5P_CLS_DXFR[1] = {{
"data transfer", /* Class name for debugging */
+ H5P_TYPE_DATASET_XFER, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_DATASET_XFER_g, /* Pointer to class ID */
&H5P_LST_DATASET_XFER_g, /* Pointer to default property list ID */
- H5P_dxfr_reg_prop, /* Default property registration routine */
- H5P_dxfr_create, /* Class creation callback */
+ H5P__dxfr_reg_prop, /* Default property registration routine */
+ NULL, /* Class creation callback */
NULL, /* Class creation callback info */
- H5P_dxfr_copy, /* Class copy callback */
+ NULL, /* Class copy callback */
NULL, /* Class copy callback info */
- H5P_dxfr_close, /* Class close callback */
+ NULL, /* Class close callback */
NULL /* Class close callback info */
}};
@@ -181,7 +177,7 @@ const H5P_libclass_t H5P_CLS_DXFR[1] = {{
/*-------------------------------------------------------------------------
- * Function: H5P_dxfr_reg_prop
+ * Function: H5P__dxfr_reg_prop
*
* Purpose: Register the data transfer property list class's properties
*
@@ -192,7 +188,7 @@ const H5P_libclass_t H5P_CLS_DXFR[1] = {{
*-------------------------------------------------------------------------
*/
static herr_t
-H5P_dxfr_reg_prop(H5P_genclass_t *pclass)
+H5P__dxfr_reg_prop(H5P_genclass_t *pclass)
{
size_t def_max_temp_buf = H5D_XFER_MAX_TEMP_BUF_DEF; /* Default value for maximum temp buffer size */
void *def_tconv_buf = H5D_XFER_TCONV_BUF_DEF; /* Default value for type conversion buffer */
@@ -203,8 +199,6 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass)
void *def_vlen_alloc_info = H5D_XFER_VLEN_ALLOC_INFO_DEF; /* Default value for vlen allocation information */
H5MM_free_t def_vlen_free = H5D_XFER_VLEN_FREE_DEF; /* Default value for vlen free function */
void *def_vlen_free_info = H5D_XFER_VLEN_FREE_INFO_DEF; /* Default value for vlen free information */
- hid_t def_vfl_id = H5D_XFER_VFL_ID_DEF; /* Default value for file driver ID */
- void *def_vfl_info = H5D_XFER_VFL_INFO_DEF; /* Default value for file driver info */
size_t def_hyp_vec_size = H5D_XFER_HYPER_VECTOR_SIZE_DEF; /* Default value for vector size */
haddr_t metadata_tag = H5AC_METADATA_TAG_DEF; /* Default value for metadata tag */
#ifdef H5_HAVE_PARALLEL
@@ -224,7 +218,7 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass)
void *def_xfer_xform = H5D_XFER_XFORM_DEF; /* Default value for data transform */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Register the max. temp buffer size property */
if(H5P_register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &def_max_temp_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
@@ -266,14 +260,6 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass)
if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &def_vlen_free_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the file driver ID property */
- if(H5P_register_real(pclass, H5D_XFER_VFL_ID_NAME, H5D_XFER_VFL_ID_SIZE, &def_vfl_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- /* Register the file driver info property */
- if(H5P_register_real(pclass, H5D_XFER_VFL_INFO_NAME, H5D_XFER_VFL_INFO_SIZE, &def_vfl_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
/* Register the vector size property */
if(H5P_register_real(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &def_hyp_vec_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
@@ -295,7 +281,7 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass)
if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE, &def_mpio_actual_chunk_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the actual io mode property. */
+ /* Register the actual I/O mode property. */
if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_IO_MODE_NAME, H5D_MPIO_ACTUAL_IO_MODE_SIZE, &def_mpio_actual_io_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
@@ -329,157 +315,9 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dxfr_reg_prop() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5P_dxfr_create
- *
- * Purpose: Callback routine which is called whenever any dataset transfer
- * property list is created. This routine performs any generic
- * initialization needed on the properties the library put into
- * the list.
- * Right now, it's just allocating the driver-specific dataset
- * transfer information.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * Thursday, August 2, 2001
- *
- *-------------------------------------------------------------------------
- */
-/* ARGSUSED */
-static herr_t
-H5P_dxfr_create(hid_t dxpl_id, void UNUSED *create_data)
-{
- hid_t driver_id; /* VFL driver ID */
- void *driver_info; /* VFL driver info */
- H5P_genplist_t *plist; /* Property list */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check arguments */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
-
- /* Get the driver information */
- if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID")
- if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver info")
-
- /* Check if we have a valid driver ID */
- if(driver_id > 0) {
- /* Set the driver for the property list */
- if(H5FD_dxpl_open(plist, driver_id, driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dxfr_create() */
+} /* end H5P__dxfr_reg_prop() */
-/*-------------------------------------------------------------------------
- * Function: H5P_dxfr_copy
- *
- * Purpose: Callback routine which is called whenever any dataset
- * transfer property list is copied. This routine copies
- * the properties from the old list to the new list.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Raymond Lu
- * Tuesday, October 2, 2001
- *
- *-------------------------------------------------------------------------
- */
-/* ARGSUSED */
-static herr_t
-H5P_dxfr_copy(hid_t dst_dxpl_id, hid_t src_dxpl_id, void UNUSED *copy_data)
-{
- hid_t driver_id;
- void* driver_info;
- H5P_genplist_t *dst_plist; /* Destination property list */
- H5P_genplist_t *src_plist; /* Source property list */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
- if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
-
- /* Get values from old property list */
- if(H5P_get(src_plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID")
- if(H5P_get(src_plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver info")
-
- if(driver_id > 0) {
- /* Set the driver for the property list */
- if(H5FD_dxpl_open(dst_plist, driver_id, driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dxfr_copy() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5P_dxfr_close
- *
- * Purpose: Callback routine which is called whenever any dataset transfer
- * property list is closed. This routine performs any generic
- * cleanup needed on the properties the library put into the list.
- * Right now, it's just freeing the driver-specific dataset
- * transfer information.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * Wednesday, July 11, 2001
- *
- *-------------------------------------------------------------------------
- */
-/* ARGSUSED */
-static herr_t
-H5P_dxfr_close(hid_t dxpl_id, void UNUSED *close_data)
-{
- hid_t driver_id; /* VFL driver ID */
- void *driver_info; /* VFL driver info */
- H5P_genplist_t *plist; /* Property list */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check arguments */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
-
- if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID")
- if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info")
- if(driver_id > 0) {
- /* Close the driver for the property list */
- if(H5FD_dxpl_close(driver_id, driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset driver")
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dxfr_close() */
/*-------------------------------------------------------------------------
@@ -497,11 +335,11 @@ done:
*/
/* ARGSUSED */
static herr_t
-H5P_dxfr_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED size, void *value)
+H5P__dxfr_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED size, void *value)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(value);
@@ -510,11 +348,11 @@ H5P_dxfr_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dxfr_xform_del() */
+} /* end H5P__dxfr_xform_del() */
/*-------------------------------------------------------------------------
- * Function: H5P_dxfr_xform_copy
+ * Function: H5P__dxfr_xform_copy
*
* Purpose: Creates a copy of the user's data transform string and its
* associated parse tree.
@@ -529,11 +367,11 @@ done:
*/
/* ARGSUSED */
static herr_t
-H5P_dxfr_xform_copy(const char UNUSED *name, size_t UNUSED size, void *value)
+H5P__dxfr_xform_copy(const char UNUSED *name, size_t UNUSED size, void *value)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(value);
@@ -542,11 +380,11 @@ H5P_dxfr_xform_copy(const char UNUSED *name, size_t UNUSED size, void *value)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dxfr_xform_copy() */
+} /* end H5P__dxfr_xform_copy() */
/*-------------------------------------------------------------------------
- * Function: H5P_dxfr_xform_close
+ * Function: H5P__dxfr_xform_close
*
* Purpose: Frees memory allocated by H5P_dxfr_xform_set
*
@@ -560,11 +398,11 @@ done:
*/
/* ARGSUSED */
static herr_t
-H5P_dxfr_xform_close(const char UNUSED *name, size_t UNUSED size, void *value)
+H5P__dxfr_xform_close(const char UNUSED *name, size_t UNUSED size, void *value)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(value);
@@ -573,18 +411,15 @@ H5P_dxfr_xform_close(const char UNUSED *name, size_t UNUSED size, void *value)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dxfr_xform_close() */
+} /* end H5P__dxfr_xform_close() */
/*-------------------------------------------------------------------------
* Function: H5Pset_data_transform
*
- * Purpose:
- * Sets data transform expression.
- *
- *
- * Return: Returns a non-negative value if successful; otherwise returns a negative value.
+ * Purpose: Sets data transform expression.
*
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Leon Arber
* Monday, March 07, 2004
@@ -606,7 +441,7 @@ H5Pset_data_transform(hid_t plist_id, const char *expression)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "expression cannot be NULL")
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* See if a data transform is already set, and free it if it is */
@@ -623,9 +458,8 @@ H5Pset_data_transform(hid_t plist_id, const char *expression)
done:
if(ret_value < 0) {
- if(data_xform_prop)
- if(H5Z_xform_destroy(data_xform_prop) < 0)
- HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression")
+ if(data_xform_prop && H5Z_xform_destroy(data_xform_prop) < 0)
+ HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression")
} /* end if */
FUNC_LEAVE_API(ret_value)
@@ -635,10 +469,9 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Pget_data_transform
*
- * Purpose:
- * Gets data transform expression.
+ * Purpose: Gets data transform expression.
*
- * Return: Returns a non-negative value if successful; otherwise returns a negative value.
+ * Return: Non-negative on success/Negative on failure
*
* Comments:
* If `expression' is non-NULL then write up to `size' bytes into that
@@ -678,9 +511,7 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "data transform has not been set")
/* Get the data transform string */
- pexp = H5Z_xform_extract_xform_str(data_xform_prop);
-
- if(!pexp)
+ if(NULL == (pexp = H5Z_xform_extract_xform_str(data_xform_prop)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "failed to retrieve transform expression")
len = HDstrlen(pexp);
@@ -694,9 +525,8 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size)
done:
if(ret_value < 0) {
- if(data_xform_prop)
- if(H5Z_xform_destroy(data_xform_prop) < 0)
- HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression")
+ if(data_xform_prop && H5Z_xform_destroy(data_xform_prop) < 0)
+ HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression")
} /* end if */
FUNC_LEAVE_API(ret_value)
@@ -722,21 +552,19 @@ done:
* Programmer: Robb Matzke
* Monday, March 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iz*x*x", plist_id, size, tconv, bkg);
/* Check arguments */
- if (size<=0)
+ if(size == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size must not be zero")
/* Get the plist structure */
@@ -744,16 +572,16 @@ H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Update property list */
- if(H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
+ if(H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer buffer size")
- if(H5P_set(plist, H5D_XFER_TCONV_BUF_NAME, &tconv)<0)
+ if(H5P_set(plist, H5D_XFER_TCONV_BUF_NAME, &tconv) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer type conversion buffer")
- if(H5P_set(plist, H5D_XFER_BKGR_BUF_NAME, &bkg)<0)
+ if(H5P_set(plist, H5D_XFER_BKGR_BUF_NAME, &bkg) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set background type conversion buffer")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_buffer() */
/*-------------------------------------------------------------------------
@@ -768,8 +596,6 @@ done:
* Programmer: Robb Matzke
* Monday, March 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
size_t
@@ -783,27 +609,27 @@ H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/)
H5TRACE3("z", "ixx", plist_id, tconv, bkg);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, 0, "can't find object for ID")
/* Return values */
- if (tconv)
- if(H5P_get(plist, H5D_XFER_TCONV_BUF_NAME, tconv)<0)
+ if(tconv)
+ if(H5P_get(plist, H5D_XFER_TCONV_BUF_NAME, tconv) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "Can't get transfer type conversion buffer")
- if (bkg)
- if(H5P_get(plist, H5D_XFER_BKGR_BUF_NAME, bkg)<0)
+ if(bkg)
+ if(H5P_get(plist, H5D_XFER_BKGR_BUF_NAME, bkg) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "Can't get background type conversion buffer")
/* Get the size */
- if(H5P_get(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
+ if(H5P_get(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, 0, "Can't set transfer buffer size")
/* Set the return value */
- ret_value=size;
+ ret_value = size;
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_buffer() */
/*-------------------------------------------------------------------------
@@ -820,32 +646,30 @@ done:
* Programmer: Robb Matzke
* Tuesday, March 17, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_preserve(hid_t plist_id, hbool_t status)
{
- H5T_bkg_t need_bkg; /* Value for background buffer type */
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ H5T_bkg_t need_bkg; /* Value for background buffer type */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ib", plist_id, status);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Update property list */
need_bkg = status ? H5T_BKG_YES : H5T_BKG_NO;
- if (H5P_set(plist,H5D_XFER_BKGR_BUF_TYPE_NAME,&need_bkg)<0)
+ if(H5P_set(plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_preserve() */
/*-------------------------------------------------------------------------
@@ -860,8 +684,6 @@ done:
* Programmer: Robb Matzke
* Tuesday, March 17, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -875,19 +697,19 @@ H5Pget_preserve(hid_t plist_id)
H5TRACE1("Is", "i", plist_id);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get value */
- if (H5P_get(plist,H5D_XFER_BKGR_BUF_TYPE_NAME,&need_bkg)<0)
+ if(H5P_get(plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
/* Set return value */
- ret_value= need_bkg ? TRUE : FALSE;
+ ret_value = need_bkg ? TRUE : FALSE;
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_preserve() */
/*-------------------------------------------------------------------------
@@ -903,21 +725,19 @@ done:
* Programmer: Raymond Lu
* Jan 3, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iZe", plist_id, check);
/* Check argument */
- if (check != H5Z_ENABLE_EDC && check != H5Z_DISABLE_EDC)
+ if(check != H5Z_ENABLE_EDC && check != H5Z_DISABLE_EDC)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid value")
/* Get the plist structure */
@@ -925,12 +745,12 @@ H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Update property list */
- if (H5P_set(plist,H5D_XFER_EDC_NAME,&check)<0)
+ if(H5P_set(plist, H5D_XFER_EDC_NAME, &check) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_edc_check() */
/*-------------------------------------------------------------------------
@@ -946,15 +766,13 @@ done:
* Programmer: Raymond Lu
* Jan 3, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5Z_EDC_t
H5Pget_edc_check(hid_t plist_id)
{
H5P_genplist_t *plist; /* Property list pointer */
- H5Z_EDC_t ret_value; /* return value */
+ H5Z_EDC_t ret_value; /* Return value */
FUNC_ENTER_API(H5Z_ERROR_EDC)
H5TRACE1("Ze", "i", plist_id);
@@ -964,16 +782,12 @@ H5Pget_edc_check(hid_t plist_id)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_ERROR_EDC, "can't find object for ID")
/* Update property list */
- if (H5P_get(plist,H5D_XFER_EDC_NAME,&ret_value)<0)
+ if(H5P_get(plist, H5D_XFER_EDC_NAME, &ret_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5Z_ERROR_EDC, "unable to set value")
- /* check valid value */
- if (ret_value != H5Z_ENABLE_EDC && ret_value != H5Z_DISABLE_EDC)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_ERROR_EDC, "not a valid value")
-
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_edc_check() */
/*-------------------------------------------------------------------------
@@ -1116,40 +930,38 @@ done:
* Programmer: Robb Matzke
* Monday, September 28, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_btree_ratios(hid_t plist_id, double *left/*out*/, double *middle/*out*/,
- double *right/*out*/)
+ double *right/*out*/)
{
+ H5P_genplist_t *plist; /* Property list pointer */
double btree_split_ratio[3]; /* B-tree node split ratios */
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "ixxx", plist_id, left, middle, right);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get the split ratios */
- if (H5P_get(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&btree_split_ratio)<0)
+ if(H5P_get(plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &btree_split_ratio) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
/* Get values */
- if (left)
+ if(left)
*left = btree_split_ratio[0];
- if (middle)
+ if(middle)
*middle = btree_split_ratio[1];
- if (right)
+ if(right)
*right = btree_split_ratio[2];
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_btree_ratios() */
/*-------------------------------------------------------------------------
@@ -1170,28 +982,26 @@ done:
* Programmer: Robb Matzke
* Monday, September 28, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_btree_ratios(hid_t plist_id, double left, double middle,
- double right)
+ double right)
{
- double split_ratio[3]; /* B-tree node split ratios */
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ double split_ratio[3]; /* B-tree node split ratios */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iddd", plist_id, left, middle, right);
/* Check arguments */
- if (left<0.0 || left>1.0 || middle<0.0 || middle>1.0 ||
- right<0.0 || right>1.0)
+ if(left < 0.0 || left > 1.0 || middle < 0.0 || middle > 1.0 ||
+ right < 0.0 || right > 1.0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0<=X<=1.0")
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set values */
@@ -1200,12 +1010,12 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle,
split_ratio[2] = right;
/* Set the split ratios */
- if (H5P_set(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&split_ratio)<0)
+ if(H5P_set(plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &split_ratio) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_btree_ratios() */
/*-------------------------------------------------------------------------
@@ -1225,28 +1035,26 @@ done:
* Programmer: Quincey Koziol
* Thursday, July 1, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func,
- void *alloc_info, H5MM_free_t free_func, void *free_info)
+ void *alloc_info, H5MM_free_t free_func, void *free_info)
{
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- assert(plist);
+ HDassert(plist);
/* Update property list */
- if (H5P_set(plist,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0)
+ if(H5P_set(plist, H5D_XFER_VLEN_ALLOC_NAME, &alloc_func) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- if (H5P_set(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0)
+ if(H5P_set(plist, H5D_XFER_VLEN_ALLOC_INFO_NAME, &alloc_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- if (H5P_set(plist,H5D_XFER_VLEN_FREE_NAME,&free_func)<0)
+ if(H5P_set(plist, H5D_XFER_VLEN_FREE_NAME, &free_func) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- if (H5P_set(plist,H5D_XFER_VLEN_FREE_INFO_NAME,&free_info)<0)
+ if(H5P_set(plist, H5D_XFER_VLEN_FREE_INFO_NAME, &free_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
@@ -1271,27 +1079,25 @@ done:
* Programmer: Quincey Koziol
* Thursday, July 1, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func,
- void *alloc_info, H5MM_free_t free_func, void *free_info)
+ void *alloc_info, H5MM_free_t free_func, void *free_info)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "ix*xx*x", plist_id, alloc_func, alloc_info, free_func,
free_info);
/* Check arguments */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
/* Update property list */
- if (H5P_set_vlen_mem_manager(plist,alloc_func,alloc_info,free_func,free_info)<0)
+ if(H5P_set_vlen_mem_manager(plist, alloc_func, alloc_info, free_func, free_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set values")
done:
@@ -1309,42 +1115,38 @@ done:
* Programmer: Quincey Koziol
* Thursday, July 1, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func/*out*/,
- void **alloc_info/*out*/,
- H5MM_free_t *free_func/*out*/,
- void **free_info/*out*/)
+ void **alloc_info/*out*/, H5MM_free_t *free_func/*out*/, void **free_info/*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "ixxxx", plist_id, alloc_func, alloc_info, free_func, free_info);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
- if(alloc_func!=NULL)
- if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_NAME,alloc_func)<0)
+ if(alloc_func)
+ if(H5P_get(plist, H5D_XFER_VLEN_ALLOC_NAME, alloc_func) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
- if(alloc_info!=NULL)
- if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,alloc_info)<0)
+ if(alloc_info)
+ if(H5P_get(plist, H5D_XFER_VLEN_ALLOC_INFO_NAME, alloc_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
- if(free_func!=NULL)
- if (H5P_get(plist,H5D_XFER_VLEN_FREE_NAME,free_func)<0)
+ if(free_func)
+ if(H5P_get(plist, H5D_XFER_VLEN_FREE_NAME, free_func) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
- if(free_info!=NULL)
- if (H5P_get(plist,H5D_XFER_VLEN_FREE_INFO_NAME,free_info)<0)
+ if(free_info)
+ if(H5P_get(plist, H5D_XFER_VLEN_FREE_INFO_NAME, free_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_vlen_mem_manager() */
/*-------------------------------------------------------------------------
@@ -1366,29 +1168,27 @@ done:
* Programmer: Quincey Koziol
* Monday, July 9, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_hyper_vector_size(hid_t plist_id, size_t vector_size)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iz", plist_id, vector_size);
/* Check arguments */
- if (vector_size<1)
+ if(vector_size < 1)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "vector size too small")
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Update property list */
- if (H5P_set(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0)
+ if(H5P_set(plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &vector_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
@@ -1406,34 +1206,32 @@ done:
* Programmer: Quincey Koziol
* Monday, July 9, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_hyper_vector_size(hid_t plist_id, size_t *vector_size/*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", plist_id, vector_size);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Return values */
- if (vector_size)
- if (H5P_get(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,vector_size)<0)
+ if(vector_size)
+ if(H5P_get(plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, vector_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_hyper_vector_size() */
-
#ifdef H5_HAVE_PARALLEL
+
/*-------------------------------------------------------------------------
* Function: H5Pget_mpio_actual_chunk_opt_mode
*
@@ -1443,6 +1241,7 @@ done:
*
* Programmer: Jacob Gruber
* Wednesday, May 4, 2011
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1478,6 +1277,7 @@ done:
*
* Programmer: Jacob Gruber
* Wednesday, May 4, 2011
+ *
*-------------------------------------------------------------------------
*/
herr_t
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 1479cd5..26b6862 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -178,6 +178,7 @@ static herr_t H5P_file_image_info_close(const char *name, size_t size, void *val
/* File access property list class library initialization object */
const H5P_libclass_t H5P_CLS_FACC[1] = {{
"file access", /* Class name for debugging */
+ H5P_TYPE_FILE_ACCESS, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_FILE_ACCESS_g, /* Pointer to class ID */
&H5P_LST_FILE_ACCESS_g, /* Pointer to default property list ID */
@@ -609,47 +610,40 @@ done:
* Programmer: Robb Matzke
* Tuesday, June 9, 1998
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list design to the new generic
- * property list.
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_alignment(hid_t fapl_id, hsize_t *threshold/*out*/,
- hsize_t *alignment/*out*/)
+ hsize_t *alignment/*out*/)
{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ixx", fapl_id, threshold, alignment);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get values */
- if (threshold)
+ if(threshold)
if(H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, threshold) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get threshold");
- if (alignment)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get threshold")
+ if(alignment)
if(H5P_get(plist, H5F_ACS_ALIGN_NAME, alignment) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_alignment() */
/*-------------------------------------------------------------------------
* Function: H5P_set_driver
*
- * Purpose: Set the file driver (DRIVER_ID) for a file access or data
- * transfer property list (PLIST_ID) and supply an optional
+ * Purpose: Set the file driver (DRIVER_ID) for a file access
+ * property list (PLIST_ID) and supply an optional
* struct containing the driver-specific properites
* (DRIVER_INFO). The driver properties will be copied into the
* property list and the reference count on the driver will be
@@ -657,19 +651,11 @@ done:
* still use the property list.
*
* Return: Success: Non-negative
- *
* Failure: Negative
*
* Programmer: Robb Matzke
* Tuesday, August 3, 1999
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list design to the new generic
- * property list.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -677,7 +663,7 @@ H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_drive
{
hid_t driver_id; /* VFL driver ID */
void *driver_info; /* VFL driver info */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -692,29 +678,15 @@ H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_drive
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL,"can't get driver info")
/* Close the driver for the property list */
- if(H5FD_fapl_close(driver_id, driver_info)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset driver")
-
- /* Set the driver for the property list */
- if(H5FD_fapl_open(plist, new_driver_id, new_driver_info)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
- } else if(TRUE == H5P_isa_class(plist->plist_id, H5P_DATASET_XFER)) {
- /* Get the current driver information */
- if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID")
- if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver info")
-
- /* Close the driver for the property list */
- if(H5FD_dxpl_close(driver_id, driver_info) < 0)
+ if(H5FD_fapl_close(driver_id, driver_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset driver")
/* Set the driver for the property list */
- if(H5FD_dxpl_open(plist, new_driver_id, new_driver_info) < 0)
+ if(H5FD_fapl_open(plist, new_driver_id, new_driver_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list")
- }
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -724,8 +696,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Pset_driver
*
- * Purpose: Set the file driver (DRIVER_ID) for a file access or data
- * transfer property list (PLIST_ID) and supply an optional
+ * Purpose: Set the file driver (DRIVER_ID) for a file access
+ * property list (PLIST_ID) and supply an optional
* struct containing the driver-specific properites
* (DRIVER_INFO). The driver properties will be copied into the
* property list and the reference count on the driver will be
@@ -733,19 +705,11 @@ done:
* still use the property list.
*
* Return: Success: Non-negative
- *
* Failure: Negative
*
* Programmer: Robb Matzke
* Tuesday, August 3, 1999
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list design to the new generic
- * property list.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -776,7 +740,7 @@ done:
* Function: H5P_get_driver
*
* Purpose: Return the ID of the low-level file driver. PLIST_ID should
- * be a file access property list or data transfer propert list.
+ * be a file access property list.
*
* Return: Success: A low-level driver ID which is the same ID
* used when the driver was set for the property
@@ -788,54 +752,36 @@ done:
* Programmer: Robb Matzke
* Thursday, February 26, 1998
*
- * Modifications:
- * Robb Matzke, 1999-08-03
- * Rewritten to use the virtual file layer.
- *
- * Robb Matzke, 1999-08-05
- * If the driver ID is H5FD_VFD_DEFAULT then substitute the
- * current value of H5FD_SEC2.
- *
- * Quincey Koziol 2000-11-28
- * Added internal function..
- *
- * Raymond Lu, 2001-10-23
- * Changed the file access list design to the new generic
- * property list.
- *
*-------------------------------------------------------------------------
*/
hid_t
H5P_get_driver(H5P_genplist_t *plist)
{
- hid_t ret_value=FAIL; /* Return value */
+ hid_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Get the current driver ID */
- if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &ret_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID");
- } else if( TRUE == H5P_isa_class(plist->plist_id, H5P_DATASET_XFER) ) {
- if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &ret_value)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list");
- }
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
- if (H5FD_VFD_DEFAULT==ret_value)
+ if(H5FD_VFD_DEFAULT == ret_value)
ret_value = H5_DEFAULT_VFD;
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5P_get_driver() */
/*-------------------------------------------------------------------------
* Function: H5Pget_driver
*
* Purpose: Return the ID of the low-level file driver. PLIST_ID should
- * be a file access property list or data transfer propert list.
+ * be a file access property list.
*
* Return: Success: A low-level driver ID which is the same ID
* used when the driver was set for the property
@@ -847,16 +793,6 @@ done:
* Programmer: Robb Matzke
* Thursday, February 26, 1998
*
- * Modifications:
- * Robb Matzke, 1999-08-03
- * Rewritten to use the virtual file layer.
- *
- * Robb Matzke, 1999-08-05
- * If the driver ID is H5FD_VFD_DEFAULT then substitute the current value of
- * H5FD_SEC2.
- *
- * Quincey Koziol 2000-11-28
- * Added internal function..
*-------------------------------------------------------------------------
*/
hid_t
@@ -871,7 +807,9 @@ H5Pget_driver(hid_t plist_id)
if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
- ret_value = H5P_get_driver(plist);
+ /* Get the driver */
+ if((ret_value = H5P_get_driver(plist)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver")
done:
FUNC_LEAVE_API(ret_value)
@@ -882,7 +820,7 @@ done:
* Function: H5P_get_driver_info
*
* Purpose: Returns a pointer directly to the file driver-specific
- * information of a file access or data transfer property list.
+ * information of a file access.
*
* Return: Success: Ptr to *uncopied* driver specific data
* structure if any.
@@ -895,32 +833,22 @@ done:
* Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list design to the new generic
- * property list.
- *
*-------------------------------------------------------------------------
*/
void *
H5P_get_driver_info(H5P_genplist_t *plist)
{
- void *ret_value=NULL;
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
/* Get the current driver info */
- if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &ret_value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,NULL,"can't get driver info");
- } else if( TRUE == H5P_isa_class(plist->plist_id, H5P_DATASET_XFER) ) {
- if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &ret_value)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, NULL, "Can't retrieve VFL driver ID");
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access or data transfer property list");
- }
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -931,7 +859,7 @@ done:
* Function: H5Pget_driver_info
*
* Purpose: Returns a pointer directly to the file driver-specific
- * information of a file access or data transfer property list.
+ * information of a file access.
*
* Return: Success: Ptr to *uncopied* driver specific data
* structure if any.
@@ -944,26 +872,20 @@ done:
* Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list design to the new generic
- * property list.
- *
*-------------------------------------------------------------------------
*/
void *
H5Pget_driver_info(hid_t plist_id)
{
H5P_genplist_t *plist; /* Property list pointer */
- void *ret_value; /* Return value */
+ void *ret_value; /* Return value */
FUNC_ENTER_API(NULL)
if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
+ /* Get the driver info */
if(NULL == (ret_value = H5P_get_driver_info(plist)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info")
@@ -980,37 +902,35 @@ done:
* to retrieve VFD file handle.
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_family_offset(hid_t fapl_id, hsize_t offset)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ih", fapl_id, offset);
/* Get the plist structure */
if(H5P_DEFAULT == fapl_id)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list");
- if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- /* Set values */
- if((ret_value=H5P_set_family_offset(plist, offset)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set family offset");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list")
+ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Set value */
+ if((ret_value = H5P_set_family_offset(plist, offset)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set family offset")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_family_offset() */
/*-------------------------------------------------------------------------
@@ -1020,33 +940,30 @@ done:
* H5Pset_family_offset
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5P_set_family_offset(H5P_genplist_t *plist, hsize_t offset)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
if(H5P_set(plist, H5F_ACS_FAMILY_OFFSET_NAME, &offset) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,"can't set offset for family file");
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list");
- }
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set offset for family file")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5P_set_family_offset() */
/*-------------------------------------------------------------------------
@@ -1057,37 +974,35 @@ done:
* to retrieve VFD file handle.
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_family_offset(hid_t fapl_id, hsize_t *offset)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", fapl_id, offset);
/* Get the plist structure */
if(H5P_DEFAULT == fapl_id)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list");
- if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- /* Set values */
- if((ret_value=H5P_get_family_offset(plist, offset)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get family offset");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list")
+ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get value */
+ if((ret_value = H5P_get_family_offset(plist, offset)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get family offset")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_family_offset() */
/*-------------------------------------------------------------------------
@@ -1097,33 +1012,30 @@ done:
* H5Pget_family_offset
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5P_get_family_offset(H5P_genplist_t *plist, hsize_t *offset)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
if(H5P_get(plist, H5F_ACS_FAMILY_OFFSET_NAME, offset) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,"can't set offset for family file");
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list");
- }
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set offset for family file")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5P_get_family_offset() */
/*-------------------------------------------------------------------------
@@ -1134,14 +1046,11 @@ done:
* to retrieve VFD file handle.
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1155,16 +1064,17 @@ H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type)
/* Get the plist structure */
if(H5P_DEFAULT == fapl_id)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list");
- if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- /* Set values */
- if((ret_value=H5P_set_multi_type(plist, type)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data type for multi driver");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list")
+ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Set value */
+ if((ret_value = H5P_set_multi_type(plist, type)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data type for multi driver")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_multi_type() */
/*-------------------------------------------------------------------------
@@ -1174,33 +1084,30 @@ done:
* H5Pset_multi_type.
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5P_set_multi_type(H5P_genplist_t *plist, H5FD_mem_t type)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
if(H5P_set(plist, H5F_ACS_MULTI_TYPE_NAME, &type) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,"can't set type for multi driver");
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list");
- }
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set type for multi driver")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5P_set_multi_type() */
/*-------------------------------------------------------------------------
@@ -1211,37 +1118,35 @@ done:
* to retrieve VFD file handle.
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*Mt", fapl_id, type);
/* Get the plist structure */
if(H5P_DEFAULT == fapl_id)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list");
- if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- /* Set values */
- if((ret_value=H5P_get_multi_type(plist, type)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get data type for multi driver");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list")
+ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get value */
+ if((ret_value = H5P_get_multi_type(plist, type)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get data type for multi driver")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_multi_type() */
/*-------------------------------------------------------------------------
@@ -1251,33 +1156,30 @@ done:
* H5Pget_multi_type.
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5P_get_multi_type(H5P_genplist_t *plist, H5FD_mem_t *type)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
if(H5P_get(plist, H5F_ACS_MULTI_TYPE_NAME, type) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,"can't get type for multi driver");
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
- }
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get type for multi driver")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5P_get_multi_type() */
/*-------------------------------------------------------------------------
@@ -2724,12 +2626,13 @@ done:
herr_t
H5P_file_image_info_copy(const char UNUSED *name, size_t UNUSED size, void *value)
{
- H5FD_file_image_info_t *info; /* Image info struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
if(value) {
+ H5FD_file_image_info_t *info; /* Image info struct */
+
info = (H5FD_file_image_info_t *)value;
/* verify file image field consistancy */
@@ -2763,16 +2666,17 @@ H5P_file_image_info_copy(const char UNUSED *name, size_t UNUSED size, void *valu
else
HDmemcpy(info->buffer, old_buffer, info->size);
} /* end if */
- } /* end if */
- /* Copy udata if it exists */
- if(info->callbacks.udata) {
- void *old_udata = info->callbacks.udata;
+ /* Copy udata if it exists */
+ if(info->callbacks.udata) {
+ void *old_udata = info->callbacks.udata;
- if(NULL == info->callbacks.udata_copy)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_copy not defined")
+ if(NULL == info->callbacks.udata_copy)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_copy not defined")
+
+ info->callbacks.udata = info->callbacks.udata_copy(old_udata);
+ } /* end if */
- info->callbacks.udata = info->callbacks.udata_copy(old_udata);
} /* end if */
done:
@@ -2797,32 +2701,33 @@ done:
herr_t
H5P_file_image_info_close(const char UNUSED *name, size_t UNUSED size, void *value)
{
- H5FD_file_image_info_t info; /* Image info struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
if(value) {
- info = *(H5FD_file_image_info_t *)value;
+ H5FD_file_image_info_t *info; /* Image info struct */
+
+ info = (H5FD_file_image_info_t *)value;
- if(info.buffer != NULL && info.size > 0) {
+ if(info->buffer != NULL && info->size > 0) {
/* Free buffer */
- if(info.callbacks.image_free) {
- if(info.callbacks.image_free(info.buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE,
- info.callbacks.udata) < 0)
+ if(info->callbacks.image_free) {
+ if(info->callbacks.image_free(info->buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE,
+ info->callbacks.udata) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "image_free callback failed")
} /* end if */
else
- H5MM_xfree(info.buffer);
+ H5MM_xfree(info->buffer);
} /* end if */
- } /* end if */
- /* Free udata if it exists */
- if(info.callbacks.udata) {
- if(NULL == info.callbacks.udata_free)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_free not defined")
- if(info.callbacks.udata_free(info.callbacks.udata) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed")
+ /* Free udata if it exists */
+ if(info->callbacks.udata) {
+ if(NULL == info->callbacks.udata_free)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_free not defined")
+ if(info->callbacks.udata_free(info->callbacks.udata) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed")
+ } /* end if */
} /* end if */
done:
diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c
index 2e8cf1e..7351beb 100644
--- a/src/H5Pfcpl.c
+++ b/src/H5Pfcpl.c
@@ -106,6 +106,7 @@ static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass);
/* File creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_FCRT[1] = {{
"file create", /* Class name for debugging */
+ H5P_TYPE_FILE_CREATE, /* Class type */
&H5P_CLS_GROUP_CREATE_g, /* Parent class ID */
&H5P_CLS_FILE_CREATE_g, /* Pointer to class ID */
&H5P_LST_FILE_CREATE_g, /* Pointer to default property list ID */
diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c
index 7828fb2..0158bf1 100644
--- a/src/H5Pfmpl.c
+++ b/src/H5Pfmpl.c
@@ -74,6 +74,7 @@ static herr_t H5P_fmnt_reg_prop(H5P_genclass_t *pclass);
/* File mount property list class library initialization object */
const H5P_libclass_t H5P_CLS_FMNT[1] = {{
"file mount", /* Class name for debugging */
+ H5P_TYPE_FILE_MOUNT, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_FILE_MOUNT_g, /* Pointer to class ID */
&H5P_LST_FILE_MOUNT_g, /* Pointer to default property list ID */
diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c
index 4947029..90e8d8c 100644
--- a/src/H5Pgcpl.c
+++ b/src/H5Pgcpl.c
@@ -68,6 +68,7 @@ static herr_t H5P_gcrt_reg_prop(H5P_genclass_t *pclass);
/* Group creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_GCRT[1] = {{
"group create", /* Class name for debugging */
+ H5P_TYPE_GROUP_CREATE, /* Class type */
&H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */
&H5P_CLS_GROUP_CREATE_g, /* Pointer to class ID */
&H5P_LST_GROUP_CREATE_g, /* Pointer to default property list ID */
diff --git a/src/H5Pint.c b/src/H5Pint.c
index d17903f..63862ef 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -132,6 +132,7 @@ hid_t H5P_LST_LINK_ACCESS_g = FAIL;
/* Root property list class library initialization object */
const H5P_libclass_t H5P_CLS_ROOT[1] = {{
"root", /* Class name for debugging */
+ H5P_TYPE_ROOT, /* Class type */
NULL, /* Parent class ID */
&H5P_CLS_ROOT_g, /* Pointer to class ID */
NULL, /* Pointer to default property list ID */
@@ -148,6 +149,7 @@ const H5P_libclass_t H5P_CLS_ROOT[1] = {{
/* (move to proper source code file when used for real) */
const H5P_libclass_t H5P_CLS_GACC[1] = {{
"group access", /* Class name for debugging */
+ H5P_TYPE_GROUP_ACCESS, /* Class type */
&H5P_CLS_LINK_ACCESS_g, /* Parent class ID */
&H5P_CLS_GROUP_ACCESS_g, /* Pointer to class ID */
&H5P_LST_GROUP_ACCESS_g, /* Pointer to default property list ID */
@@ -164,6 +166,7 @@ const H5P_libclass_t H5P_CLS_GACC[1] = {{
/* (move to proper source code file when used for real) */
const H5P_libclass_t H5P_CLS_TCRT[1] = {{
"datatype create", /* Class name for debugging */
+ H5P_TYPE_DATATYPE_CREATE, /* Class type */
&H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */
&H5P_CLS_DATATYPE_CREATE_g, /* Pointer to class ID */
&H5P_LST_DATATYPE_CREATE_g, /* Pointer to default property list ID */
@@ -180,6 +183,7 @@ const H5P_libclass_t H5P_CLS_TCRT[1] = {{
/* (move to proper source code file when used for real) */
const H5P_libclass_t H5P_CLS_TACC[1] = {{
"datatype access", /* Class name for debugging */
+ H5P_TYPE_DATATYPE_ACCESS, /* Class type */
&H5P_CLS_LINK_ACCESS_g, /* Parent class ID */
&H5P_CLS_DATATYPE_ACCESS_g, /* Pointer to class ID */
&H5P_LST_DATATYPE_ACCESS_g, /* Pointer to default property list ID */
@@ -436,7 +440,7 @@ H5P_init_interface(void)
} /* end if */
/* Allocate the new class */
- if(NULL == (new_pclass = H5P_create_class(par_pclass, lib_class->name, 1, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data)))
+ if(NULL == (new_pclass = H5P_create_class(par_pclass, lib_class->name, lib_class->type, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed")
/* Call routine to register properties for class */
@@ -602,11 +606,11 @@ H5P_copy_pclass(H5P_genclass_t *pclass)
*/
/* Create the new property list class */
- if(NULL==(new_pclass=H5P_create_class(pclass->parent, pclass->name, 0, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data)))
+ if(NULL == (new_pclass = H5P_create_class(pclass->parent, pclass->name, pclass->type, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "unable to create property list class")
/* Copy the properties registered for this class */
- if(pclass->nprops>0) {
+ if(pclass->nprops > 0) {
H5SL_node_t *curr_node; /* Current node in skip list */
/* Walk through the properties in the old class */
@@ -1095,7 +1099,7 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5P_find_prop_plist
+ H5P__find_prop_plist
PURPOSE
Internal routine to check for a property in a property list's skip list
USAGE
@@ -1111,12 +1115,12 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static H5P_genprop_t *
-H5P_find_prop_plist(H5P_genplist_t *plist, const char *name)
+H5P_genprop_t *
+H5P__find_prop_plist(H5P_genplist_t *plist, const char *name)
{
H5P_genprop_t *ret_value; /* Property pointer return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
HDassert(plist);
HDassert(name);
@@ -1150,7 +1154,7 @@ H5P_find_prop_plist(H5P_genplist_t *plist, const char *name)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_find_prop_plist() */
+} /* H5P__find_prop_plist() */
/*--------------------------------------------------------------------------
@@ -1451,11 +1455,11 @@ H5P_open_class_path_cb(void *_obj, hid_t UNUSED id, void *_key)
PURPOSE
Internal routine to create a new property list class.
USAGE
- H5P_genclass_t H5P_create_class(par_class, name, internal,
+ H5P_genclass_t H5P_create_class(par_class, name, type,
cls_create, create_data, cls_close, close_data)
H5P_genclass_t *par_class; IN: Pointer to parent class
const char *name; IN: Name of class we are creating
- hbool_t internal; IN: Whether this is an internal class or not
+ H5P_plist_type_t type; IN: Type of class we are creating
H5P_cls_create_func_t; IN: The callback function to call when each
property list in this class is created.
void *create_data; IN: Pointer to user data to pass along to class
@@ -1479,7 +1483,7 @@ H5P_open_class_path_cb(void *_obj, hid_t UNUSED id, void *_key)
REVISION LOG
--------------------------------------------------------------------------*/
H5P_genclass_t *
-H5P_create_class(H5P_genclass_t *par_class, const char *name, hbool_t internal,
+H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type,
H5P_cls_create_func_t cls_create, void *create_data,
H5P_cls_copy_func_t cls_copy, void *copy_data,
H5P_cls_close_func_t cls_close, void *close_data)
@@ -1492,7 +1496,7 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, hbool_t internal,
HDassert(name);
/* Allow internal classes to break some rules */
/* (This allows the root of the tree to be created with this routine -QAK) */
- if(!internal)
+ if(type == H5P_TYPE_USER)
HDassert(par_class);
/* Allocate room for the class */
@@ -1503,11 +1507,11 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, hbool_t internal,
pclass->parent = par_class;
if(NULL == (pclass->name = H5MM_xstrdup(name)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "propery list class name allocation failed")
+ pclass->type = type;
pclass->nprops = 0; /* Classes are created without properties initially */
pclass->plists = 0; /* No properties lists of this class yet */
pclass->classes = 0; /* No classes derived from this class yet */
pclass->ref_count = 1; /* This is the first reference to the new class */
- pclass->internal = internal;
pclass->deleted = FALSE; /* Not deleted yet... :-) */
pclass->revision = H5P_GET_NEXT_REV; /* Get a revision number for the class */
@@ -2144,7 +2148,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size,
*/
if(pclass->plists > 0 || pclass->classes > 0) {
if(NULL == (new_class = H5P_create_class(pclass->parent, pclass->name,
- pclass->internal, pclass->create_func, pclass->create_data,
+ pclass->type, pclass->create_func, pclass->create_data,
pclass->copy_func, pclass->copy_data,
pclass->close_func, pclass->close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy class")
@@ -2714,11 +2718,11 @@ H5P_get_size_plist(H5P_genplist_t *plist, const char *name, size_t *size)
HDassert(size);
/* Find property */
- if((prop=H5P_find_prop_plist(plist,name)) == NULL)
+ if(NULL == (prop = H5P__find_prop_plist(plist, name)))
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist")
/* Get property size */
- *size=prop->size;
+ *size = prop->size;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3035,9 +3039,9 @@ H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2)
if(pclass1->ref_count < pclass2->ref_count) HGOTO_DONE(-1);
if(pclass1->ref_count > pclass2->ref_count) HGOTO_DONE(1);
- /* Check whether they are internal or not */
- if(pclass1->internal < pclass2->internal) HGOTO_DONE(-1);
- if(pclass1->internal > pclass2->internal) HGOTO_DONE(1);
+ /* Check the property list types */
+ if(pclass1->type < pclass2->type) HGOTO_DONE(-1);
+ if(pclass1->type > pclass2->type) HGOTO_DONE(1);
/* Check whether they are deleted or not */
if(pclass1->deleted < pclass2->deleted) HGOTO_DONE(-1);
@@ -3441,8 +3445,11 @@ H5P__iterate_plist_pclass_cb(void *_item, void *_key, void *_udata)
PURPOSE
Internal routine to iterate over the properties in a property list
USAGE
- int H5P_iterate_plist(plist_id, idx, cb_func, iter_data)
- hid_t plist_id; IN: ID of property list to iterate over
+ int H5P_iterate_plist(plist, iter_all_prop, idx, cb_func, iter_data)
+ const H5P_genplist_t *plist; IN: Property list to iterate over
+ hbool_t iter_all_prop; IN: Whether to iterate over all properties
+ (TRUE), or just non-default (i.e. changed)
+ properties (FALSE).
int *idx; IN/OUT: Index of the property to begin with
H5P_iterate_t cb_func; IN: Function pointer to function to be
called with each property iterated over.
@@ -3487,10 +3494,10 @@ iteration, the function's behavior is undefined.
REVISION LOG
--------------------------------------------------------------------------*/
int
-H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_int_t cb_func, void *udata)
+H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx,
+ H5P_iterate_int_t cb_func, void *udata)
{
H5P_genclass_t *tclass; /* Temporary class pointer */
- H5P_genplist_t *plist; /* Property list pointer */
H5P_iter_plist_ud_t udata_int; /* User data for skip list iterator */
H5SL_t *seen = NULL; /* Skip list to hold names of properties already seen */
int curr_idx = 0; /* Current iteration index */
@@ -3498,13 +3505,11 @@ H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_int_t cb_func, void *uda
FUNC_ENTER_NOAPI_NOINIT
+ /* Sanity check */
+ HDassert(plist);
HDassert(idx);
HDassert(cb_func);
- /* Get the property list object */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
-
/* Create the skip list to hold names of properties already seen */
if(NULL == (seen = H5SL_create(H5SL_TYPE_STR, NULL)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't create skip list for seen properties")
@@ -3523,17 +3528,20 @@ H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_int_t cb_func, void *uda
if(ret_value != 0)
HGOTO_DONE(ret_value);
- /* Walk up the class hiearchy */
- tclass = plist->pclass;
- while(tclass != NULL) {
- /* Iterate over properties in property list class */
- ret_value = H5SL_iterate(tclass->props, H5P__iterate_plist_pclass_cb, &udata_int);
- if(ret_value != 0)
- HGOTO_DONE(ret_value);
+ /* Check for iterating over all properties, or just non-default ones */
+ if(iter_all_prop) {
+ /* Walk up the class hiearchy */
+ tclass = plist->pclass;
+ while(tclass != NULL) {
+ /* Iterate over properties in property list class */
+ ret_value = H5SL_iterate(tclass->props, H5P__iterate_plist_pclass_cb, &udata_int);
+ if(ret_value != 0)
+ HGOTO_DONE(ret_value);
- /* Go up to parent class */
- tclass = tclass->parent;
- } /* end while */
+ /* Go up to parent class */
+ tclass = tclass->parent;
+ } /* end while */
+ } /* end if */
done:
/* Set the index we stopped at */
@@ -3604,8 +3612,8 @@ done:
PURPOSE
Internal routine to iterate over the properties in a property class
USAGE
- herr_t H5P_iterate_pclass(pclass_id, idx, cb_func, iter_data)
- hid_t pclass_id; IN: ID of property class to iterate over
+ herr_t H5P_iterate_pclass(pclass, idx, cb_func, iter_data)
+ const H5P_genpclass_t *pclass; IN: Property list class to iterate over
int *idx; IN/OUT: Index of the property to begin with
H5P_iterate_t cb_func; IN: Function pointer to function to be
called with each property iterated over.
@@ -3650,22 +3658,20 @@ iteration, the function's behavior is undefined.
REVISION LOG
--------------------------------------------------------------------------*/
int
-H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_int_t cb_func, void *udata)
+H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx,
+ H5P_iterate_int_t cb_func, void *udata)
{
- H5P_genclass_t *pclass; /* Property list pointer */
H5P_iter_pclass_ud_t udata_int; /* User data for skip list iterator */
int curr_idx = 0; /* Current iteration index */
int ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
+ /* Sanity check */
+ HDassert(pclass);
HDassert(idx);
HDassert(cb_func);
- /* Get the property list object */
- if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class")
-
/* Set up iterator callback info */
udata_int.cb_func = cb_func;
udata_int.udata = udata;
@@ -4193,13 +4199,13 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist")
/* If the property exists in the destination alread */
- if(H5P_find_prop_plist(dst_plist,name)!=NULL) {
+ if(NULL != H5P__find_prop_plist(dst_plist, name)) {
/* Delete the property from the destination list, calling the 'close' callback if necessary */
if(H5P_remove(dst_id,dst_plist,name) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property")
/* Get the pointer to the source property */
- prop=H5P_find_prop_plist(src_plist,name);
+ prop = H5P__find_prop_plist(src_plist, name);
/* Make a copy of the source property */
if((new_prop=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL)
@@ -4221,7 +4227,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
/* If not, get the information required to do an H5Pinsert2 with the property into the destination list */
else {
/* Get the pointer to the source property */
- prop = H5P_find_prop_plist(src_plist, name);
+ prop = H5P__find_prop_plist(src_plist, name);
/* Create property object from parameters */
if(NULL == (new_prop = H5P_create_prop(prop->name, prop->size, H5P_PROP_WITHIN_LIST, prop->value,
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index 6c80493..ba5f9d7 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -53,6 +53,7 @@
#define H5L_ACS_ELINK_PREFIX_DEF NULL /*default is no prefix */
#define H5L_ACS_ELINK_PREFIX_DEL H5P_lacc_elink_pref_del
#define H5L_ACS_ELINK_PREFIX_COPY H5P_lacc_elink_pref_copy
+#define H5L_ACS_ELINK_PREFIX_CMP H5P_lacc_elink_pref_cmp
#define H5L_ACS_ELINK_PREFIX_CLOSE H5P_lacc_elink_pref_close
/* Definitions for setting fapl of external link access */
@@ -70,6 +71,7 @@
#define H5L_ACS_ELINK_CB_SIZE sizeof(H5L_elink_cb_t)
#define H5L_ACS_ELINK_CB_DEF {NULL,NULL}
+
/******************/
/* Local Typedefs */
/******************/
@@ -90,8 +92,8 @@ static herr_t H5P_lacc_reg_prop(H5P_genclass_t *pclass);
/* Property list callbacks */
static herr_t H5P_lacc_elink_pref_del(hid_t prop_id, const char* name, size_t size, void* value);
static herr_t H5P_lacc_elink_pref_copy(const char* name, size_t size, void* value);
+static int H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t size);
static herr_t H5P_lacc_elink_pref_close(const char* name, size_t size, void* value);
-
static herr_t H5P_lacc_elink_fapl_del(hid_t prop_id, const char* name, size_t size, void* value);
static herr_t H5P_lacc_elink_fapl_copy(const char* name, size_t size, void* value);
static herr_t H5P_lacc_elink_fapl_close(const char* name, size_t size, void* value);
@@ -104,6 +106,7 @@ static herr_t H5P_lacc_elink_fapl_close(const char* name, size_t size, void* val
/* Dataset creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_LACC[1] = {{
"link access", /* Class name for debugging */
+ H5P_TYPE_LINK_ACCESS, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_LINK_ACCESS_g, /* Pointer to class ID */
&H5P_LST_LINK_ACCESS_g, /* Pointer to default property list ID */
@@ -162,7 +165,7 @@ H5P_lacc_reg_prop(H5P_genclass_t *pclass)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for external link prefix */
- if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &elink_prefix, NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, NULL, H5L_ACS_ELINK_PREFIX_CLOSE) < 0)
+ if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &elink_prefix, NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, H5L_ACS_ELINK_PREFIX_CMP, H5L_ACS_ELINK_PREFIX_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register fapl for link access */
@@ -343,6 +346,41 @@ H5P_lacc_elink_pref_copy(const char UNUSED *name, size_t UNUSED size, void *valu
/*-------------------------------------------------------------------------
+ * Function: H5P_lacc_elink_pref_cmp
+ *
+ * Purpose: Callback routine which is called whenever the elink prefix
+ * property in the dataset creation property list is
+ * compared.
+ *
+ * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise.
+ *
+ * Programmer: Mohamad Chaarawi
+ * Thursday, November 3, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t UNUSED size)
+{
+ const char *pref1 = *(const char **)value1;
+ const char *pref2 = *(const char **)value2;
+ int ret_value = 0;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ if(NULL == pref1 && NULL != pref2)
+ HGOTO_DONE(1);
+ if(NULL != pref1 && NULL == pref2)
+ HGOTO_DONE(-1);
+ if(NULL != pref1 && NULL != pref2)
+ ret_value = HDstrcmp(pref1, pref2);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_lacc_elink_pref_cmp() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5P_lacc_elink_pref_close
*
* Purpose: Frees memory used to store the external link prefix string
@@ -815,3 +853,4 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_elink_cb() */
+
diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c
index 0129f39..bc045be 100644
--- a/src/H5Plcpl.c
+++ b/src/H5Plcpl.c
@@ -98,6 +98,7 @@ static herr_t H5P_lcrt_reg_prop(H5P_genclass_t *pclass);
/* Link creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_LCRT[1] = {{
"link create", /* Class name for debugging */
+ H5P_TYPE_LINK_CREATE, /* Class type */
&H5P_CLS_STRING_CREATE_g, /* Parent class ID */
&H5P_CLS_LINK_CREATE_g, /* Pointer to class ID */
&H5P_LST_LINK_CREATE_g, /* Pointer to default property list ID */
@@ -149,7 +150,7 @@ H5P_lcrt_reg_prop(H5P_genclass_t *pclass)
/* Register create intermediate groups property */
if(H5P_register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &intmd_group, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
if(H5P_register_real(pclass, H5VL_LINK_TARGET, H5L_CRT_TARGET_SIZE, &target,
NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index 7a52f11..024f79b 100644
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -87,6 +87,7 @@ static int H5P_ocrt_pipeline_cmp(const void *value1, const void *value2, size_t
/* Object creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_OCRT[1] = {{
"object create", /* Class name for debugging */
+ H5P_TYPE_OBJECT_CREATE, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_OBJECT_CREATE_g, /* Pointer to class ID */
NULL, /* Pointer to default property list ID */
@@ -137,15 +138,15 @@ H5P_ocrt_reg_prop(H5P_genclass_t *pclass)
/* Register max. compact attribute storage property */
if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &attr_max_compact, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register min. dense attribute storage property */
if(H5P_register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &attr_min_dense, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register object header flags property */
if(H5P_register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &ohdr_flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the pipeline property */
if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &pline, NULL, NULL, NULL, NULL, NULL, H5O_CRT_PIPELINE_CMP, NULL) < 0)
diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c
index 23f8e4b..adea906 100644
--- a/src/H5Pocpypl.c
+++ b/src/H5Pocpypl.c
@@ -91,6 +91,7 @@ static int H5P_ocpy_merge_comm_dt_list_cmp(const void *value1, const void *value
/* Object copy property list class library initialization object */
const H5P_libclass_t H5P_CLS_OCPY[1] = {{
"object copy", /* Class name for debugging */
+ H5P_TYPE_OBJECT_COPY, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_OBJECT_COPY_g, /* Pointer to class ID */
&H5P_LST_OBJECT_COPY_g, /* Pointer to default property list ID */
@@ -141,15 +142,15 @@ H5P_ocpy_reg_prop(H5P_genclass_t *pclass)
/* Register copy options property */
if(H5P_register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &ocpy_option, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register merge named dtype list property */
if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &merge_comm_dtype_list, NULL, NULL, NULL, NULL, NULL, H5O_CPY_MERGE_COMM_DT_LIST_CMP, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for callback when completing the search for a matching named datatype from the named dtype list */
if(H5P_register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &mcdt_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h
index 65d314e..803abfd 100644
--- a/src/H5Ppkg.h
+++ b/src/H5Ppkg.h
@@ -84,23 +84,23 @@ typedef struct H5P_genprop_t {
/* Define structure to hold class information */
struct H5P_genclass_t {
struct H5P_genclass_t *parent; /* Pointer to parent class */
- char *name; /* Name of property list class */
- size_t nprops; /* Number of properties in class */
+ char *name; /* Name of property list class */
+ H5P_plist_type_t type; /* Type of property */
+ size_t nprops; /* Number of properties in class */
unsigned plists; /* Number of property lists that have been created since the last modification to the class */
unsigned classes; /* Number of classes that have been derived since the last modification to the class */
unsigned ref_count; /* Number of oustanding ID's open on this class object */
- hbool_t internal; /* Whether this class is internal to the library or not */
hbool_t deleted; /* Whether this class has been deleted and is waiting for dependent classes & proplists to close */
unsigned revision; /* Revision number of a particular class (global) */
- H5SL_t *props; /* Skip list containing properties */
+ H5SL_t *props; /* Skip list containing properties */
/* Callback function pointers & info */
H5P_cls_create_func_t create_func; /* Function to call when a property list is created */
- void *create_data; /* Pointer to user data to pass along to create callback */
- H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */
- void *copy_data; /* Pointer to user data to pass along to copy callback */
- H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */
- void *close_data; /* Pointer to user data to pass along to close callback */
+ void *create_data; /* Pointer to user data to pass along to create callback */
+ H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */
+ void *copy_data; /* Pointer to user data to pass along to copy callback */
+ H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */
+ void *close_data; /* Pointer to user data to pass along to close callback */
};
/* Define structure to hold property list information */
@@ -123,6 +123,7 @@ typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass);
*/
typedef struct H5P_libclass_t {
const char *name; /* Class name */
+ H5P_plist_type_t type; /* Class type */
hid_t const * const par_class_id; /* Pointer to global parent class property list class ID */
hid_t * const class_id; /* Pointer to global property list class ID */
@@ -152,7 +153,7 @@ typedef int (*H5P_iterate_int_t)(H5P_genprop_t *prop, void *udata);
/* Private functions, not part of the publicly documented API */
H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class,
- const char *name, unsigned internal,
+ const char *name, H5P_plist_type_t type,
H5P_cls_create_func_t cls_create, void *create_data,
H5P_cls_copy_func_t cls_copy, void *copy_data,
H5P_cls_close_func_t cls_close, void *close_data);
@@ -178,10 +179,10 @@ H5_DLL H5P_genclass_t *H5P_get_class(const H5P_genplist_t *plist);
H5_DLL herr_t H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops);
H5_DLL int H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2);
H5_DLL int H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2);
-H5_DLL int H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_int_t iter_func,
- void *iter_data);
-H5_DLL int H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_int_t iter_func,
- void *iter_data);
+H5_DLL int H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop,
+ int *idx, H5P_iterate_int_t iter_func, void *iter_data);
+H5_DLL int H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx,
+ H5P_iterate_int_t iter_func, void *iter_data);
H5_DLL herr_t H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name);
H5_DLL herr_t H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name);
H5_DLL herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name);
@@ -192,6 +193,7 @@ H5_DLL herr_t H5P_close_class(void *_pclass);
H5_DLL herr_t H5P_get_filter(const H5Z_filter_info_t *filter,
unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[],
size_t namelen, char name[], unsigned *filter_config);
+H5_DLL H5P_genprop_t *H5P__find_prop_plist(H5P_genplist_t *plist, const char *name);
/* Testing functions */
#ifdef H5P_TESTING
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 45e9ada..0332079 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -44,6 +44,28 @@
typedef struct H5P_genplist_t H5P_genplist_t;
typedef struct H5P_genclass_t H5P_genclass_t;
+typedef enum H5P_plist_type_t {
+ H5P_TYPE_USER = 0,
+ H5P_TYPE_ROOT = 1,
+ H5P_TYPE_OBJECT_CREATE = 2,
+ H5P_TYPE_FILE_CREATE = 3,
+ H5P_TYPE_FILE_ACCESS = 4,
+ H5P_TYPE_DATASET_CREATE = 5,
+ H5P_TYPE_DATASET_ACCESS = 6,
+ H5P_TYPE_DATASET_XFER = 7,
+ H5P_TYPE_FILE_MOUNT = 8,
+ H5P_TYPE_GROUP_CREATE = 9,
+ H5P_TYPE_GROUP_ACCESS = 10,
+ H5P_TYPE_DATATYPE_CREATE = 11,
+ H5P_TYPE_DATATYPE_ACCESS = 12,
+ H5P_TYPE_STRING_CREATE = 13,
+ H5P_TYPE_ATTRIBUTE_CREATE = 14,
+ H5P_TYPE_OBJECT_COPY = 15,
+ H5P_TYPE_LINK_CREATE = 16,
+ H5P_TYPE_LINK_ACCESS = 17,
+ H5P_TYPE_MAX_TYPE
+} H5P_plist_type_t;
+
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -103,7 +125,7 @@ H5_DLL size_t H5P_peek_size_t(H5P_genplist_t *plist, const char *name);
/* Private DCPL routines */
H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist,
H5D_fill_value_t *status);
-H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type,
+H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, H5T_t *type,
void *value, hid_t dxpl_id);
#endif /* _H5Pprivate_H */
diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c
index 188fdd2..8573985 100644
--- a/src/H5Pstrcpl.c
+++ b/src/H5Pstrcpl.c
@@ -73,6 +73,7 @@ static herr_t H5P_strcrt_reg_prop(H5P_genclass_t *pclass);
/* String creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_STRCRT[1] = {{
"string create", /* Class name for debugging */
+ H5P_TYPE_STRING_CREATE, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_STRING_CREATE_g, /* Pointer to class ID */
NULL, /* Pointer to default property list ID */
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index d9b306d..d88ac35 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -2784,7 +2784,7 @@ H5S_hyper_offset(const H5S_t *space, hsize_t *offset)
FUNC_ENTER_NOAPI(FAIL)
- HDassert(space);
+ HDassert(space && space->extent.rank>0);
HDassert(offset);
/* Start at linear offset 0 */
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 817b2f2..b758a92 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -643,7 +643,7 @@ H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t UNUSED share_selection)
} /* end while */
done:
- if(ret_value < 0) {
+ if(ret_value < 0 && dst->select.sel_info.pnt_lst) {
/* Traverse the (incomplete?) dst list, freeing all memory */
curr = dst->select.sel_info.pnt_lst->head;
while(curr) {
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 91aed1e..9a993a5 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -67,7 +67,7 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset)
/* Check args */
HDassert(space);
- HDassert(space->extent.rank);
+ HDassert(0 < space->extent.rank && space->extent.rank <= H5S_MAX_RANK);
HDassert(offset);
/* Copy the offset over */
diff --git a/src/H5Tarray.c b/src/H5Tarray.c
index 9986631..c73b934 100644
--- a/src/H5Tarray.c
+++ b/src/H5Tarray.c
@@ -194,7 +194,8 @@ H5T__array_create(H5T_t *base, unsigned ndims, const hsize_t dim[/* ndims */])
ret_value->shared->type = H5T_ARRAY;
/* Copy the base type of the array */
- ret_value->shared->parent = H5T_copy(base, H5T_COPY_ALL);
+ if(NULL == (ret_value->shared->parent = H5T_copy(base, H5T_COPY_ALL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to copy base datatype")
/* Set the array parameters */
ret_value->shared->u.array.ndims = ndims;
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index e6ae53e..1538765 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -45,7 +45,7 @@ static htri_t H5Z_can_apply_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t spac
static enum H5Z_scaleoffset_t H5Z_scaleoffset_get_type(unsigned dtype_class,
unsigned dtype_size, unsigned dtype_sign);
static herr_t H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist,
- const H5T_t *type, enum H5Z_scaleoffset_t scale_type, unsigned cd_values[],
+ H5T_t *type, enum H5Z_scaleoffset_t scale_type, unsigned cd_values[],
int need_convert, hid_t dxpl_id);
static herr_t H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static size_t H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts,
@@ -804,7 +804,7 @@ done:
*/
static herr_t
H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist,
- const H5T_t *type, enum H5Z_scaleoffset_t scale_type,
+ H5T_t *type, enum H5Z_scaleoffset_t scale_type,
unsigned cd_values[], int need_convert, hid_t dxpl_id)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -861,7 +861,7 @@ static herr_t
H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id)
{
H5P_genplist_t *dcpl_plist; /* Property list pointer */
- const H5T_t *type; /* Datatype */
+ H5T_t *type; /* Datatype */
const H5S_t *ds; /* Dataspace */
unsigned flags; /* Filter flags */
size_t cd_nelmts = H5Z_SCALEOFFSET_USER_NPARMS; /* Number of filter parameters */
diff --git a/src/H5public.h b/src/H5public.h
index b6ee623..e3919c7 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -75,10 +75,10 @@ extern "C" {
/* Version numbers */
#define H5_VERS_MAJOR 1 /* For major interface/format changes */
#define H5_VERS_MINOR 9 /* For minor interface/format changes */
-#define H5_VERS_RELEASE 124 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 127 /* For tweaks, bug-fixes, or development */
#define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */
/* Empty string for real releases. */
-#define H5_VERS_INFO "HDF5 library version: 1.9.124" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.9.127" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)
diff --git a/src/H5trace.c b/src/H5trace.c
index b711f40..b559669 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -212,6 +212,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
if('[' == *type) {
if('a' == type[1]) {
asize_idx = (int)HDstrtol(type + 2, &rest, 10);
+ HDassert(0 <= asize_idx && asize_idx < (int) NELMTS(asize));
HDassert(']'==*rest);
type = rest + 1;
} else {
diff --git a/src/Makefile.in b/src/Makefile.in
index 09dda4e..1d199dc 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -485,7 +485,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 114
+LT_VERS_REVISION = 117
LT_VERS_AGE = 0
H5detect_CFLAGS = -g $(AM_CFLAGS)
diff --git a/test/accum.c b/test/accum.c
index 11d44d4..7f65151 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -1793,15 +1793,17 @@ accum_printf(void)
printf("=====================================================\n");
} else {
printf("=====================================================\n");
- printf(" accumulator allocated size == %lu\n", (unsigned long)accum->alloc_size);
- printf(" accumulated data size == %lu\n", (unsigned long)accum->size);
- printf(" accumulator dirty? == %d\n", accum->dirty);
+ printf(" accumulator allocated size == %zu\n", accum->alloc_size);
+ printf(" accumulated data size == %zu\n", accum->size);
+ HDfprintf(stdout, " accumulator dirty? == %t\n", accum->dirty);
printf("=====================================================\n");
- printf(" start of accumulated data, loc = %llu\n", accum->loc);
- if (accum->dirty) printf(" start of dirty region, loc = %llu\n", accum->loc + accum->dirty_off);
- if (accum->dirty) printf(" end of dirty region, loc = %llu\n", accum->loc + accum->dirty_off + accum->dirty_len);
- printf(" end of accumulated data, loc = %llu\n", accum->loc + accum->size);
- printf(" end of accumulator allocation, loc = %llu\n", accum->loc + accum->alloc_size);
+ HDfprintf(stdout, " start of accumulated data, loc = %a\n", accum->loc);
+ if(accum->dirty) {
+ HDfprintf(stdout, " start of dirty region, loc = %a\n", (haddr_t)(accum->loc + accum->dirty_off));
+ HDfprintf(stdout, " end of dirty region, loc = %a\n", (haddr_t)(accum->loc + accum->dirty_off + accum->dirty_len));
+ } /* end if */
+ HDfprintf(stdout, " end of accumulated data, loc = %a\n", (haddr_t)(accum->loc + accum->size));
+ HDfprintf(stdout, " end of accumulator allocation, loc = %a\n", (haddr_t)(accum->loc + accum->alloc_size));
printf("=====================================================\n");
}
printf("\n\n");
diff --git a/test/cache.c b/test/cache.c
index 0e6cb42..ba51a38 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -33532,6 +33532,7 @@ check_notify_cb(void)
reset_entries();
file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024));
+ if ( !file_ptr ) CACHE_ERROR("setup_cache returned NULL")
cache_ptr = file_ptr->shared->cache;
base_addr = entries[entry_type];
@@ -33675,8 +33676,7 @@ check_notify_cb(void)
} /* end for */
done:
- if(file_ptr)
- takedown_cache(file_ptr, FALSE, FALSE);
+ takedown_cache(file_ptr, FALSE, FALSE);
if ( pass )
PASSED()
diff --git a/test/cache_common.c b/test/cache_common.c
index e6dd020..7b26714 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -2031,7 +2031,7 @@ verify_entry_status(H5C_t * cache_ptr,
int num_entries,
struct expected_entry_status expected[])
{
- static char msg[128];
+ static char msg[256];
int i;
i = 0;
diff --git a/test/cache_tagging.c b/test/cache_tagging.c
index a133daa..e4eddf2 100644
--- a/test/cache_tagging.c
+++ b/test/cache_tagging.c
@@ -740,7 +740,7 @@ check_group_creation_tags(hid_t fcpl, int type)
hid_t fid = -1; /* File Identifier */
hid_t gid = -1; /* Group Identifier */
int verbose = FALSE; /* verbose file outout */
- haddr_t root_tag; /* Root Group Tag */
+ haddr_t root_tag = HADDR_UNDEF; /* Root Group Tag */
haddr_t g_tag; /* Group Tag */
haddr_t sbe_tag; /* Sblock Extension Tag */
@@ -1249,7 +1249,7 @@ check_group_open_tags(hid_t fcpl, int type)
hid_t fid = -1; /* File Identifier */
hid_t gid = -1; /* Group Identifier */
int verbose = FALSE; /* verbose file output */
- haddr_t root_tag;
+ haddr_t root_tag = HADDR_UNDEF;
haddr_t sbe_tag;
haddr_t g_tag;
@@ -1633,6 +1633,8 @@ error:
* March 3, 2010
*
* Modifications:
+ * Vailin Choi; July 2012
+ * Add verify_tag() calls because H5FD_FLMAP_DICHOTOMY is now the default free-list mapping.
*
*-------------------------------------------------------------------------
*/
@@ -1756,7 +1758,12 @@ check_attribute_rename_tags(hid_t fcpl, int type)
/* verify shared header message stored as a list */
if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
- /* verify free space header */
+ /*
+ * 3 calls to verify_tag() for verifying free space:
+ * one freespace header tag for H5FD_MEM_DRAW manager,
+ * one freespace header tag for H5FD_MEM_SUPER manager
+ */
+ if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR;
if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR;
/* verify btree header and leaf node belonging to group */
@@ -1799,6 +1806,8 @@ error:
* March 3, 2010
*
* Modifications:
+ * Vailin Choi; July 2012
+ * Add verify_tag() call because H5FD_FLMAP_DICHOTOMY is now the default free-list mapping.
*
*-------------------------------------------------------------------------
*/
@@ -1901,7 +1910,12 @@ check_attribute_delete_tags(hid_t fcpl, int type)
/* verify shared header message master table */
if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
- /* verify free space */
+ /*
+ * 2 calls to verify_tag() for verifying free space:
+ * one freespace header tag for H5FD_MEM_DRAW manager,
+ * one freespace header tag for H5FD_MEM_SUPER manager
+ */
+ if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR;
if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR;
} /* end if */
@@ -3056,7 +3070,7 @@ check_object_info_tags(hid_t fcpl, int type)
hid_t fid = -1; /* File Identifier */
hid_t gid = -1; /* Group Identifier */
int verbose = FALSE; /* verbose file output */
- haddr_t root_tag;
+ haddr_t root_tag = HADDR_UNDEF;
haddr_t sbe_tag;
haddr_t g_tag;
H5O_info_t oinfo; /* Object info struct */
@@ -3170,7 +3184,7 @@ check_object_copy_tags(hid_t fcpl, int type)
hid_t fid = -1; /* File Identifier */
hid_t gid = -1; /* Group Identifier */
int verbose = FALSE; /* verbose file output */
- haddr_t root_tag;
+ haddr_t root_tag = HADDR_UNDEF;
haddr_t sbe_tag;
haddr_t g_tag;
haddr_t copy_tag;
diff --git a/test/dsets.c b/test/dsets.c
index ee341c9..3b081da 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -999,8 +999,8 @@ test_conv_buffer(hid_t fid)
herr_t status = -1;
int j, k, l;
- CmpField *cf;
- CmpFieldR *cfrR;
+ CmpField *cf = NULL;
+ CmpFieldR *cfrR = NULL;
hid_t dataset = -1; /* dataset ID */
hid_t space = -1; /* data space ID */
@@ -1014,7 +1014,7 @@ test_conv_buffer(hid_t fid)
TESTING("data type conversion buffer size");
- cf = (CmpField *)HDcalloc((size_t)1, sizeof(CmpField));
+ if ((cf = (CmpField *)HDcalloc((size_t)1, sizeof(CmpField))) == 0) goto error;
/* Populate the data members */
for(j = 0; j < DIM1; j++)
@@ -1063,7 +1063,7 @@ test_conv_buffer(hid_t fid)
if(H5Tinsert(ctype2, "C", HOFFSET(CmpFieldR, c), arr_type5) < 0) goto error;
/* Read should succeed since library will set conversion buffer big enough */
- cfrR = (CmpFieldR *)HDcalloc((size_t)1, sizeof(CmpFieldR));
+ if ((cfrR = (CmpFieldR *)HDcalloc((size_t)1, sizeof(CmpFieldR))) == 0) goto error;
if(H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfrR) < 0) goto error;
/* Read should fail since conversion buffer isn't big enough */
@@ -1100,10 +1100,8 @@ test_conv_buffer(hid_t fid)
if(H5Tclose(arr_type5) < 0) goto error;
if(H5Dclose(dataset) < 0) goto error;
- if(cf)
- HDfree(cf);
- if(cfrR)
- HDfree(cfrR);
+ HDfree(cf);
+ HDfree(cfrR);
puts(" PASSED");
return(0);
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 0001755..096b83e 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -1105,9 +1105,9 @@ test_derived_flt(void)
}
fails_this_test = 0;
- if(buf) free(buf);
- if(saved_buf) free(saved_buf);
- if(aligned) free(aligned);
+ free(buf);
+ free(saved_buf);
+ free(aligned);
buf = NULL;
saved_buf = NULL;
aligned = NULL;
diff --git a/test/dtypes.c b/test/dtypes.c
index 3db9bf8..117a21a 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -1127,10 +1127,8 @@ test_compound_5(void)
}
/* Free memory buffers */
- if(buf)
- HDfree(buf);
- if(bkg)
- HDfree(bkg);
+ HDfree(buf);
+ HDfree(bkg);
return retval;
}
@@ -4698,11 +4696,12 @@ test_bitfield_funcs(void)
{
hid_t type=-1, ntype=-1, super=-1;
int size;
- char* tag;
+ char* tag=0;
H5T_pad_t inpad;
H5T_cset_t cset;
H5T_str_t strpad;
herr_t ret;
+ int retval=-1;
TESTING("some type functions for bitfield");
@@ -4786,16 +4785,18 @@ test_bitfield_funcs(void)
goto error;
} /* end if */
- H5Tclose(type);
- H5Tclose(ntype);
- PASSED();
- reset_hdf5();
- return 0;
+ retval = 0;
error:
+
+ if (retval == -1) retval = 1;
+
+ HDfree(tag);
+ H5Tclose(ntype);
H5Tclose(type);
+ if (retval == 0) PASSED();
reset_hdf5();
- return 1;
+ return retval;
}
@@ -7049,11 +7050,13 @@ error:
*/
int test_utf_ascii_conv(void)
{
- hid_t fid;
- hid_t did;
- hid_t utf8_vtid, ascii_vtid;
- hid_t utf8_tid, ascii_tid;
- hid_t sid;
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t utf8_vtid = -1;
+ hid_t ascii_vtid = -1;
+ hid_t utf8_tid = -1;
+ hid_t ascii_tid = -1;
+ hid_t sid = -1;
const char *utf8_w = "foo!";
char *ascii_r = NULL;
const char *ascii_w = "bar!";
diff --git a/test/file_image.c b/test/file_image.c
index 73c901e..9d7a48c 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -86,15 +86,16 @@ typedef struct {
static int
test_properties(void)
{
- hid_t fapl_1;
- hid_t fapl_2;
- char *buffer;
+ hid_t fapl_1 = -1;
+ hid_t fapl_2 = -1;
+ char *buffer = 0;
int count = 10;
- void *temp;
- char *temp2;
+ void *temp = 0;
+ char *temp2 = 0;
int i;
size_t size;
size_t temp_size;
+ int retval = 1;
TESTING("File image property list functions");
@@ -145,18 +146,21 @@ test_properties(void)
VERIFY(temp2 != temp, "Retrieved buffer is the same as previously retrieved buffer");
VERIFY(0 == HDmemcmp(temp2, buffer, size),"Buffers contain different data");
+ retval = 0;
+
+error:
+
/* Close everything */
- if(H5Pclose(fapl_1) < 0) FAIL_STACK_ERROR
- if(H5Pclose(fapl_2) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(fapl_1) < 0) retval = 1;
+ if(H5Pclose(fapl_2) < 0) retval = 1;
HDfree(buffer);
HDfree(temp);
HDfree(temp2);
- PASSED();
- return 0;
+ if(retval == 0)
+ PASSED();
-error:
- return 1;
+ return retval;
} /* end test_properties() */
/******************************************************************************
diff --git a/test/freespace.c b/test/freespace.c
index 3beec76..d9949b5 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -1522,8 +1522,10 @@ test_fs_sect_merge(hid_t fapl)
/* Free the section node(s) */
if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
TEST_ERROR
+ sect_node1 = NULL;
if(TEST_sect_free((H5FS_section_info_t *)sect_node2) < 0)
TEST_ERROR
+ sect_node2 = NULL;
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
diff --git a/test/h5test.c b/test/h5test.c
index 7faba81..ea30fad 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -735,6 +735,8 @@ h5_set_info_object(void)
valp = envp = next = HDstrdup(envp);
+ if (!valp) return 0;
+
/* create an INFO object if not created yet */
if (h5_io_info_g == MPI_INFO_NULL)
MPI_Info_create(&h5_io_info_g);
@@ -761,6 +763,8 @@ h5_set_info_object(void)
while (*namep && (*namep == ' ' || *namep == '\t'))
namep++;
+ if (!*namep) continue; /* was all white space, so move to next k/v pair */
+
/* eat up any ending white spaces */
endp = &namep[strlen(namep) - 1];
diff --git a/test/mf.c b/test/mf.c
index b0668fd..11d6f20 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -127,12 +127,19 @@ static unsigned test_mf_fs_drivers(hid_t fapl);
/*
* Verify statistics for the free-space manager
+ *
+ * Modifications:
+ * Vailin Choi; July 2012
+ * To ensure "f" and "frsp" are valid pointers
*/
static int
check_stats(const H5F_t *f, const H5FS_t *frsp, frspace_state_t *state)
{
H5FS_stat_t frspace_stats; /* Statistics about the heap */
+ HDassert(f);
+ HDassert(frsp);
+
/* Get statistics for free-space and verify they are correct */
if(H5FS_stat_info(f, frsp, &frspace_stats) < 0)
FAIL_STACK_ERROR
@@ -1071,6 +1078,10 @@ error:
* The block is allocated from file allocation
* Deallocate the block which will be returned to free-space manager
* (the space is shrunk and freed since it is at end of file)
+ *
+ * Modifications:
+ * Vailin Choi; July 2012
+ * Initialize the new field "allow_eoa_shrink_only" for user data.
*/
static unsigned
test_mf_fs_alloc_free(hid_t fapl)
@@ -1136,6 +1147,7 @@ test_mf_fs_alloc_free(hid_t fapl)
udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
udata.alloc_type = type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space manager */
if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
@@ -1222,6 +1234,7 @@ test_mf_fs_alloc_free(hid_t fapl)
udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
udata.alloc_type = type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space manager */
if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
@@ -1306,6 +1319,7 @@ test_mf_fs_alloc_free(hid_t fapl)
udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
udata.alloc_type = type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space manager */
if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
@@ -1421,6 +1435,10 @@ error:
* Try to extend the allocated block by 50 from the free-space_manager:
* Fail: section A does not adjoin section B (70+20 != address of section B) even though
* the requested-size (50) equal to size of section B (50)
+ *
+ * Modifications:
+ * Vailin Choi; July 2012
+ * Initialize the new field "allow_eoa_shrink_only" for user data.
*/
static unsigned
test_mf_fs_extend(hid_t fapl)
@@ -1487,6 +1505,7 @@ test_mf_fs_extend(hid_t fapl)
udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
udata.alloc_type = type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space manager */
if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata))
@@ -1604,6 +1623,7 @@ test_mf_fs_extend(hid_t fapl)
udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
udata.alloc_type = type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space */
if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata))
@@ -1716,6 +1736,7 @@ test_mf_fs_extend(hid_t fapl)
udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
udata.alloc_type = type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space */
if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata))
@@ -1828,6 +1849,7 @@ test_mf_fs_extend(hid_t fapl)
udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
udata.alloc_type = type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* Add section A of size=20 to free-space */
if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata))
@@ -1957,6 +1979,10 @@ error:
* which will absorb meta_aggr to the section:
* section size + remaining size of aggregator is > aggr->alloc_size,
* section is allowed to absorb an aggregator (allow_sect_absorb is true)
+ *
+ * Modifications:
+ * Vailin Choi; July 2012
+ * Initialize the new field "allow_eoa_shrink_only" for user data.
*/
static unsigned
test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
@@ -2020,6 +2046,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
udata.alloc_type = type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* When adding, meta_aggr is absorbed onto the beginning of the section */
if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
@@ -2092,6 +2119,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
udata.alloc_type = type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* When adding, meta_aggr is absorbed onto the end of the section */
if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
@@ -3133,7 +3161,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
/* sdata_aggr info is reset to 0 */
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != 0) TEST_ERROR
+ if (sdata_addr != HADDR_UNDEF) TEST_ERROR
if (sdata_size != 0) TEST_ERROR
/* Verify that meta_aggr's unused space of 1968 is freed to free-space */
@@ -3481,15 +3509,18 @@ error:
*
* Test 2: H5MF_alloc() block A from meta_aggr
* H5MF_alloc() block B from sdata_aggr
- * H5MF_try_shrink() block B should merge it onto the end of meta_aggr
- * because H5F_FS_MERGE_METADATA|H5F_FS_MERGE_RAWDATA is on for
- * sec2 driver's FLMAP_SINGLE
+ * H5MF_try_shrink() block B should merge it back to the end of sdata_aggr
+ * because sec2 driver is FLMAP_DICHOTOMY by default
*
* Test 3: H5MF_alloc() block A from meta_aggr
* H5MF_alloc() block B from meta_aggr
* H5MF_alloc() block C from meta_aggr
* H5MF_try_shrink() block B should fail since it does not adjoin the
* beginning nor the end of meta_aggr
+ *
+ * Modifications:
+ * Vailin Choi; July 2012
+ * Changes due to the switch to H5FD_FLMAP_DICHOTOMY
*/
static unsigned
test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
@@ -3501,7 +3532,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
H5FD_mem_t type, stype;
haddr_t addr1, addr2, addr3, saddr1;
haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
- haddr_t sdata_addr=HADDR_UNDEF, new_sdata_addr=HADDR_UNDEF;
+ haddr_t new_sdata_addr=HADDR_UNDEF;
hsize_t ma_size=0, new_ma_size=0;
hsize_t sdata_size=0, new_sdata_size=0;
hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
@@ -3593,20 +3624,20 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
- H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
+ H5MF_aggr_query(f, &(f->shared->sdata_aggr), NULL, &sdata_size);
/* should succeed */
if(H5MF_try_shrink(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE50) <= 0)
TEST_ERROR
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &new_sdata_addr, &new_sdata_size);
- if (new_sdata_addr != sdata_addr) TEST_ERROR
- if (new_sdata_size != sdata_size) TEST_ERROR
+ if (new_sdata_addr != saddr1) TEST_ERROR
+ if (new_sdata_size != sdata_size + TEST_BLOCK_SIZE50) TEST_ERROR
/* meta_aggr info should be updated because the block is absorbed into the meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
if (new_ma_addr != ma_addr) TEST_ERROR
- if (new_ma_size != (ma_size+TEST_BLOCK_SIZE50)) TEST_ERROR
+ if (new_ma_size != (ma_size)) TEST_ERROR
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30);
@@ -4004,6 +4035,10 @@ error:
* Allocate a block of size=40
* The free-space manager is unable to fulfill the request
* The block is allocated from file allocation and should be aligned
+ *
+ * Modifications:
+ * Vailin Choi; July 2012
+ * Initialize the new field "allow_eoa_shrink_only" for user data.
*/
static unsigned
test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
@@ -4063,6 +4098,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
udata.alloc_type = type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space manager */
if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
@@ -4132,6 +4168,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
udata.alloc_type = type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space manager */
if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
@@ -4221,6 +4258,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
udata.alloc_type = type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space manager */
if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
@@ -4602,8 +4640,7 @@ error:
* request-size < aggr->alloc_size
* fragment size > (aggr->alloc_size - request-size)
* Result:
- * A block of aggr->alloc_size + (fragment size - (aggr->alloc_size - request-size))
- * is extended from file allocation for the aggregator
+ * A block of (fragment size + request-size) is extended from file allocation for the aggregator
* The second block of 50 is allocated from the aggregator and should be aligned
* Fragment from alignment of aggregator allocation is freed to free-space:[4126, 4066]
* There is space of 2018 left in meta_aggr
@@ -4628,12 +4665,14 @@ error:
* Result:
* A block of meta_aggr->alloc_size is allocated from file allocation for the aggregator
* Fragment from alignment of file allocation is freed to free-space:[14336, 2048]
- * Since this fragment adjoins sdata_aggr and fulfills "absorb" condition,
- * the space left in sdata_aggr is absorbed into the fragment and freed to free-space: [12318, 2018]
- * other_aggr is reset to 0
+ * other_aggr is [12318, 2018]
* The third block of 80 is allocated from the aggregator and should be aligned
* There is space of 1968 left in meta_aggr
* EOA is at 18432
+ *
+ * Modifications:
+ * Vailin Choi; July 2012
+ * Changes due to the switch to H5FD_FLMAP_DICHOTOMY
*/
static unsigned
test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
@@ -4644,7 +4683,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
h5_stat_size_t file_size; /* File size */
H5FD_mem_t type, stype;
haddr_t addr1, addr2, addr3, saddr1;
- frspace_state_t state;
+ frspace_state_t state[H5FD_MEM_NTYPES];
haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
hsize_t ma_size=0, sdata_size=0, mis_align=0;
hsize_t alignment=0, tmp=0;
@@ -4697,11 +4736,11 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
if (addr1 % alignment) TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
- HDmemset(&state, 0, sizeof(frspace_state_t));
+ HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES);
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[type].tot_space += mis_align;
+ state[type].tot_sect_count += 1;
+ state[type].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -4721,9 +4760,9 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* fragment for alignment of block 50 is freed to free-space */
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[type].tot_space += mis_align;
+ state[type].tot_sect_count += 1;
+ state[type].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -4754,9 +4793,9 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* fragment for alignment of block 30 for sdata_aggr is freed to free-space */
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[stype].tot_space += mis_align;
+ state[stype].tot_sect_count += 1;
+ state[stype].serial_sect_count += 1;
}
/* Verify that the allocated block is aligned */
@@ -4773,12 +4812,13 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
* For alignment = 1024, alloc_size = 2048:
* fragment for unused space in meta_aggr is freed to free-space
* For alignment = 4096, alloc_size = 2048:
- * fragment from alignment of file allocation absorbs sdata_aggr's remaining space
+ * fragment from alignment of ma_addr is freed
+ * block 30 is allocated from ma_addr
*/
mis_align = 0;
if ((alignment == TEST_ALIGN1024) && (tmp = (ma_addr % alignment)))
mis_align = alignment - tmp;
- else if ((alignment == TEST_ALIGN4096) && (tmp = (sdata_addr % alignment)))
+ else if ((alignment == TEST_ALIGN4096) && (tmp = ((sdata_addr + sdata_size) % alignment)))
mis_align = alignment - tmp;
/* Allocate a block of 80 from meta_aggr */
@@ -4789,9 +4829,9 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* fragment for alignment of block 80 is freed to free-space */
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[type].tot_space += mis_align;
+ state[type].tot_sect_count += 1;
+ state[type].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -4800,8 +4840,15 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
TEST_ERROR
/* Verify total size of free space after all the allocations */
- if(check_stats(f, f->shared->fs_man[type], &state))
- TEST_ERROR
+ if(f->shared->fs_man[type]) {
+ if(check_stats(f, f->shared->fs_man[type], &(state[type])))
+ TEST_ERROR
+ }
+
+ if(f->shared->fs_man[stype]) {
+ if(check_stats(f, f->shared->fs_man[stype], &(state[stype])))
+ TEST_ERROR
+ }
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50);
@@ -4961,6 +5008,11 @@ error:
* The meta_aggr is updated to point to the new space
* The block of 1034 is allocated from the new block and should be aligned
* There is space of 1014 left in meta_aggr
+ *
+ * Modifications:
+ * Vailin Choi; July 2012
+ * Changes due to the switch to H5FD_FLMAP_DICHOTOMY
+ *
*/
static unsigned
test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
@@ -4972,7 +5024,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5FD_mem_t type, stype;
haddr_t addr1, addr2, addr3;
haddr_t saddr1, saddr2, saddr3;
- frspace_state_t state;
+ frspace_state_t state[H5FD_MEM_NTYPES];
haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
hsize_t ma_size=0, sdata_size=0, mis_align=0;
hsize_t alignment=0, tmp=0;
@@ -5026,11 +5078,11 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
if (addr1 % alignment) TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
- HDmemset(&state, 0, sizeof(frspace_state_t));
+ HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES);
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[type].tot_space += mis_align;
+ state[type].tot_sect_count += 1;
+ state[type].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -5050,9 +5102,9 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* fragment for alignment of block 50 is freed to free-space */
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[type].tot_space += mis_align;
+ state[type].tot_sect_count += 1;
+ state[type].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -5085,9 +5137,9 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* fragment for alignment of block 30 for sdata_aggr is freed to free-space */
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[stype].tot_space += mis_align;
+ state[stype].tot_sect_count += 1;
+ state[stype].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
@@ -5106,9 +5158,9 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* fragment for alignment of block 50 for sdata_aggr is freed to free-space */
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[stype].tot_space += mis_align;
+ state[stype].tot_sect_count += 1;
+ state[stype].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
@@ -5127,9 +5179,9 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* fragment for alignment of block 80 for sdata_aggr is freed to free-space */
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[stype].tot_space += mis_align;
+ state[stype].tot_sect_count += 1;
+ state[stype].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
@@ -5149,9 +5201,9 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* fragment for alignment of block 1034 for meta_aggr is freed to free-space */
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[type].tot_space += mis_align;
+ state[type].tot_sect_count += 1;
+ state[type].serial_sect_count += 1;
}
/* calculate unused space in meta_aggr that is freed to free-space after block 1034 */
@@ -5161,9 +5213,9 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* fragment for unused space in meta_aggr after block 1034 is freed to free-space */
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[type].tot_space += mis_align;
+ state[type].tot_sect_count += 1;
+ state[type].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -5172,8 +5224,15 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
TEST_ERROR
/* Verify total size of free space after all allocations */
- if(check_stats(f, f->shared->fs_man[type], &state))
- TEST_ERROR
+ if(f->shared->fs_man[type]) {
+ if(check_stats(f, f->shared->fs_man[type], &(state[type])))
+ TEST_ERROR
+ }
+
+ if(f->shared->fs_man[stype]) {
+ if(check_stats(f, f->shared->fs_man[stype], &(state[stype])))
+ TEST_ERROR
+ }
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -5377,8 +5436,10 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
if (addr3 % alignment) TEST_ERROR
/* Verify total size of free space after all allocations */
- if(check_stats(f, f->shared->fs_man[type], &state))
- TEST_ERROR
+ if(f->shared->fs_man[type]) {
+ if(check_stats(f, f->shared->fs_man[type], &state))
+ TEST_ERROR
+ }
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -5464,6 +5525,10 @@ error:
* sdata_aggr is reset to 0
* EOA is 14346
* meta_aggr and sdata_aggr are all 0
+ *
+ * Modifications:
+ * Vailin Choi; July 2012
+ * Changes due to the switch to H5FD_FLMAP_DICHOTOMY
*/
static unsigned
test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
@@ -5474,7 +5539,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
h5_stat_size_t file_size;
H5FD_mem_t type, stype;
haddr_t addr1, addr2, saddr1;
- frspace_state_t state;
+ frspace_state_t state[H5FD_MEM_NTYPES];
haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
haddr_t sdata_addr=HADDR_UNDEF, new_sdata_addr=HADDR_UNDEF;
hsize_t ma_size=0, new_ma_size=0, sdata_size=0, new_sdata_size=0;
@@ -5533,18 +5598,16 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
- HDmemset(&state, 0, sizeof(frspace_state_t));
+ HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES);
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[type].tot_space += mis_align;
+ state[type].tot_sect_count += 1;
+ state[type].serial_sect_count += 1;
}
/* calculate fragment for alignment of block 30 from sdata_aggr */
mis_align = 0;
- if ((alignment == TEST_ALIGN1024) && (tmp = (ma_addr + ma_size) % alignment))
- mis_align = alignment - tmp;
- else if ((alignment == TEST_ALIGN4096) && (tmp = (ma_addr % alignment)))
+ if ((tmp = (ma_addr + ma_size) % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from sdata_aggr */
@@ -5556,9 +5619,9 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* fragment of alignment for block 30 in sdata_aggr is freed to free-space */
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[stype].tot_space += mis_align;
+ state[stype].tot_sect_count += 1;
+ state[stype].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
@@ -5566,9 +5629,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* calculate fragment for alignment of block 2058 from meta_aggr */
mis_align = 0;
- if ((alignment == TEST_ALIGN1024) && (tmp = (sdata_addr + sdata_size) % alignment))
- mis_align = alignment - tmp;
- else if ((alignment == TEST_ALIGN4096) && (tmp = (sdata_addr % alignment)))
+ if ((tmp = (sdata_addr + sdata_size) % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 2058 from meta_aggr */
@@ -5579,27 +5640,30 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* fragment for alignment of block 2058 is freed to free-space */
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[type].tot_space += mis_align;
+ state[type].tot_sect_count += 1;
+ state[type].serial_sect_count += 1;
}
/* Verify total size of free space after all allocations */
- if(check_stats(f, f->shared->fs_man[type], &state))
- TEST_ERROR
+ if(f->shared->fs_man[type]) {
+ if(check_stats(f, f->shared->fs_man[type], &(state[type])))
+ TEST_ERROR
+ }
+
+ if(f->shared->fs_man[stype]) {
+ if(check_stats(f, f->shared->fs_man[stype], &(state[stype])))
+ TEST_ERROR
+ }
/* nothing is changed in meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (alignment == TEST_ALIGN1024 && (new_ma_addr != ma_addr || new_ma_size != ma_size))
- TEST_ERROR
- else if (alignment == TEST_ALIGN4096 && (new_ma_addr != 0 || new_ma_size != 0))
+ if (new_ma_addr != ma_addr || new_ma_size != ma_size)
TEST_ERROR
/* nothing is changed in sdata_aggr */
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &new_sdata_addr, &new_sdata_size);
- if (alignment == TEST_ALIGN1024 && (new_sdata_addr != sdata_addr || new_sdata_size != sdata_size))
- TEST_ERROR
- else if (alignment == TEST_ALIGN4096 && ((new_sdata_addr != 0 || new_sdata_size != 0)))
+ if (new_sdata_addr != sdata_addr || new_sdata_size != sdata_size)
TEST_ERROR
if(H5Fclose(file) < 0)
@@ -5691,21 +5755,16 @@ error:
* Result:
* A block of sdata_aggr->alloc_size is allocated from file allocation
* Fragment from alignment of file allocation is freed to free-space: [6144, 2048]
- * This fragment adjoins meta_aggr and fulfills "absorb" condition,
- * the remaining space left in meta_aggr is absorbed into the fragment and
- * freed to free-space:[4126, 2018]
- * meta_aggr is reset to 0
* The first block of 30 is allocated from the aggregator and should be aligned
* There is space of 2018 left in sdata_aggr
- * EOA is 5120
+ * EOA is 10240
*
* Allocate second block (50) from sdata_aggr:
- * (request-size+fragment size) is <= sdata_aggr->size
+ * (request-size+fragment size) is > sdata_aggr->size
* request-size < sdata_aggr->alloc_size
* fragment size > (sdata_aggr->alloc_size - request-size)
* Result:
- * A block of sdata_aggr->alloc_size + (fragment size - (sdata_aggr->alloc_size - request-size))
- * is extended from file allocation for the aggregator
+ * A block of (fragment size + request-size) is extended from file allocation for the aggregator
* The second block of 50 is allocated from sdata_aggr and should be aligned
* Fragment from alignment of aggregator allocation is freed to free-space:[8222, 4066]
* There is space of 2018 left in sdata_aggr
@@ -5716,8 +5775,7 @@ error:
* request-size < sdata_aggr->alloc_size
* fragment size > (sdata_aggr->alloc_size - request-size)
* Result:
- * A block of sdata_aggr->alloc_size+(fragment size-(sdata_aggr->alloc_size-request-size))
- * is extended from file allocation for sdata_aggr
+ * A block of (fragment size + request-size) is extended from file allocation for sdata_aggr
* The third block of 80 is allocated from sdata_aggr and should be aligned
* Fragment from alignment of aggregator allocation is freed to free-space:[12338, 4046]
* There is space of 2018 left in sdata_aggr
@@ -5734,6 +5792,10 @@ error:
* Fragment from alignment of file allocation is freed to free-space:[16464, 4016]
* EOA is at 22538
* meta_aggr is unchanged
+ *
+ * Modifications:
+ * Vailin Choi; July 2012
+ * Changes due to the switch to H5FD_FLMAP_DICHOTOMY
*/
static unsigned
test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
@@ -5745,7 +5807,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5FD_mem_t type, stype;
haddr_t addr1, addr2;
haddr_t saddr1, saddr2, saddr3;
- frspace_state_t state;
+ frspace_state_t state[H5FD_MEM_NTYPES];
haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
hsize_t ma_size=0, new_ma_size=0, sdata_size=0;
hsize_t alignment=0, mis_align=0, tmp=0;
@@ -5798,11 +5860,11 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
if (addr1 % alignment) TEST_ERROR
/* fragment for alignment of block 30 in meta_aggr is freed to free-space */
- HDmemset(&state, 0, sizeof(frspace_state_t));
+ HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES);
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[type].tot_space += mis_align;
+ state[type].tot_sect_count += 1;
+ state[type].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -5811,9 +5873,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* calculate fragment for alignment of block 30 in sdata_aggr */
mis_align = 0;
- if ((alignment == TEST_ALIGN1024) && (tmp = (ma_addr + ma_size) % alignment))
- mis_align = alignment - tmp;
- else if ((alignment == TEST_ALIGN4096) && (tmp = (ma_addr % alignment)))
+ if ((tmp = (ma_addr + ma_size) % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from sdata_aggr */
@@ -5825,9 +5885,9 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* fragment for alignment of block 30 in sdata_aggr is freed to free-space */
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[stype].tot_space += mis_align;
+ state[stype].tot_sect_count += 1;
+ state[stype].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
@@ -5846,9 +5906,9 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* fragment for alignment of block 50 in sdata_aggr is freed to free-space */
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[stype].tot_space += mis_align;
+ state[stype].tot_sect_count += 1;
+ state[stype].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
@@ -5867,9 +5927,9 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* fragment for alignment of block 80 in sdata_aggr is freed to free-space */
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[stype].tot_space += mis_align;
+ state[stype].tot_sect_count += 1;
+ state[stype].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
@@ -5889,24 +5949,30 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* fragment for alignment of block 2058 is freed to free-space */
if (mis_align) {
- state.tot_space += mis_align;
- state.tot_sect_count += 1;
- state.serial_sect_count += 1;
+ state[type].tot_space += mis_align;
+ state[type].tot_sect_count += 1;
+ state[type].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (alignment == TEST_ALIGN1024 && (new_ma_addr != ma_addr || new_ma_size != ma_size))
- TEST_ERROR
- else if (alignment == TEST_ALIGN4096 && (new_ma_addr != 0 || new_ma_size != 0))
+ if (new_ma_addr != ma_addr && new_ma_size != ma_size)
TEST_ERROR
- if (sdata_addr != 0 || sdata_size != 0)
+ if (sdata_addr != HADDR_UNDEF || sdata_size != 0)
TEST_ERROR
- if(check_stats(f, f->shared->fs_man[type], &state))
- TEST_ERROR
+ if(f->shared->fs_man[type]) {
+ if(check_stats(f, f->shared->fs_man[type], &(state[type])))
+ TEST_ERROR
+ }
+
+
+ if(f->shared->fs_man[stype]) {
+ if(check_stats(f, f->shared->fs_man[stype], &(state[stype])))
+ TEST_ERROR
+ }
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -7282,6 +7348,100 @@ error:
return(1);
} /* test_filespace_drivers() */
+/*
+ * To verify that file space is allocated from the corresponding free-space manager
+ * because H5FD_FLMAP_DICHOTOMY is used as the default free-list mapping.
+ *
+ * (1) Allocate the first block (size 30) of type H5FD_MEM_SUPER
+ * (2) Allocate the second block (size 50) of type H5FD_MEM_SUPER
+ *
+ * (3) Allocate the first block (size 30) of type H5FD_MEM_DRAW
+ *
+ * (4) Free the first block (size 30) of type H5FD_MEM_SUPER
+ *
+ * (5) Allocate the second block (size 30) of type H5FD_MEM_DRAW
+ * (6) Verify that this second block is not the freed block from (3)
+ *
+ * (7) Allocate the second block (size 30) of type H5FD_MEM_DRAW
+ * (8) Free the first block (size 30) of type H5FD_MEM_DRAW
+ *
+ * (9) Allocate the third block (size 30) of type H5FD_MEM_SUPER
+ * (10) Verify that this third block is not freed block from (8)
+ */
+static unsigned
+test_dichotomy(const char *env_h5_drvr, hid_t fapl)
+{
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type, stype;
+ haddr_t addr1, addr2, addr3, saddr1, saddr2;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+
+ TESTING("Allocation from raw or metadata free-space manager");
+
+ /* Skip test when using VFDs that don't use the metadata aggregator */
+ contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
+ if(contig_addr_vfd) {
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ /* Create the file to work on */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Allocate the first block of type H5FD_MEM_SUPER */
+ type = H5FD_MEM_SUPER;
+ addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
+
+ /* Allocate the second block of type H5FD_MEM_SUPER */
+ addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
+
+ /* Allocate the first block of type H5FD_MEM_DRAW */
+ stype = H5FD_MEM_DRAW;
+ saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
+
+ /* Free the first block of type H5FD_MEM_SUPER */
+ H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30);
+
+ /* Allocate the second block of type H5FD_MEM_DRAW */
+ saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
+
+ /* Verify that saddr1 is not addr1 */
+ if(saddr2 == addr1) TEST_ERROR
+
+ /* Free the first block of type H5FD_MEM_DRAW */
+ H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE30);
+
+ /* Allocate the third block of type H5FD_MEM_SUPER */
+ addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
+
+ /* Verify that addr3 is not saddr1 */
+ if(addr3 == saddr1) TEST_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED()
+ } /* end if */
+ else {
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
+ } /* end else */
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return(1);
+} /* test_dichotomy() */
+
int
main(void)
{
@@ -7324,6 +7484,7 @@ main(void)
nerrors += test_mf_fs_alloc_free(fapl);
nerrors += test_mf_fs_extend(fapl);
nerrors += test_mf_fs_absorb(env_h5_drvr, fapl);
+ nerrors += test_dichotomy(env_h5_drvr, new_fapl);
/* interaction with meta/sdata aggregator */
nerrors += test_mf_aggr_alloc1(env_h5_drvr, fapl);
diff --git a/test/ntypes.c b/test/ntypes.c
index 165d21b..0af3a3f 100644
--- a/test/ntypes.c
+++ b/test/ntypes.c
@@ -1776,6 +1776,7 @@ test_vl_dtype(hid_t file)
} /* end for */
HDfree(tmp);
+ tmp = NULL;
} /* end for */
} /* end for */
diff --git a/test/objcopy.c b/test/objcopy.c
index 6b56b66..d7da8f3 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -10343,7 +10343,7 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
hid_t did = -1; /* Dataset ID */
hid_t exp_did = -1; /* Dataset ID */
hid_t tid_short = -1; /* Datatype ID */
- hid_t exp_tid; /* Expected datatype ID */
+ hid_t exp_tid = -1; /* Expected datatype ID */
hid_t ocpypl_id = -1; /* Object copy plist ID */
unsigned int i; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
diff --git a/test/tfile.c b/test/tfile.c
index 1cfcdbd..74d7442 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -1337,6 +1337,11 @@ test_file_perm2(void)
** This test checks the free space available in a file in various
** situations.
**
+** Modifications:
+** Vailin Choi; July 2012
+** Remove datasets in reverse order so that all file spaces are shrunk.
+** (A change due to H5FD_FLMAP_DICHOTOMY.)
+**
*****************************************************************/
static void
test_file_freespace(void)
@@ -1348,6 +1353,7 @@ test_file_freespace(void)
hid_t dspace; /* Dataspace ID */
hid_t dset; /* Dataset ID */
hid_t dcpl; /* Dataset creation property list */
+ int k; /* Local index variable */
unsigned u; /* Local index variable */
char name[32]; /* Dataset name */
herr_t ret;
@@ -1407,11 +1413,11 @@ test_file_freespace(void)
/* Check that there is the right amount of free space in the file */
free_space = H5Fget_freespace(file);
CHECK(free_space, FAIL, "H5Fget_freespace");
- VERIFY(free_space, 2008, "H5Fget_freespace");
+ VERIFY(free_space, 2360, "H5Fget_freespace");
/* Delete datasets in file */
- for(u = 0; u < 10; u++) {
- sprintf(name, "Dataset %u", u);
+ for(k = 9; k >= 0; k--) {
+ sprintf(name, "Dataset %u", (unsigned)k);
ret = H5Ldelete(file, name, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
} /* end for */
diff --git a/test/tsohm.c b/test/tsohm.c
index 62154b1..fddb552 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -2463,11 +2463,11 @@ static void test_sohm_size2(int close_reopen)
* this happens because it's hard to predict exactly how much space this
* will take.
*/
- if((mult_index_med.attrs2 - mult_index_med.attrs1) !=
- (list_index_med.attrs2 - list_index_med.attrs1))
+ if((mult_index_med.attrs2 - mult_index_med.attrs1) >
+ (list_index_med.attrs2 - list_index_med.attrs1) * OVERHEAD_ALLOWED)
VERIFY(0, 1, "h5_get_file_size");
- if((mult_index_btree.attrs2 - mult_index_btree.attrs1) !=
- (btree_index.attrs2 - btree_index.attrs1))
+ if((mult_index_btree.attrs2 - mult_index_btree.attrs1) >
+ (btree_index.attrs2 - btree_index.attrs1) * OVERHEAD_ALLOWED)
VERIFY(0, 1, "h5_get_file_size");
/* The final file size for both of the multiple index files should be
diff --git a/test/tunicode.c b/test/tunicode.c
index 3b949e9..0386352 100644
--- a/test/tunicode.c
+++ b/test/tunicode.c
@@ -161,6 +161,7 @@ void test_strpad(hid_t UNUSED fid, const char *string)
/* Create a src_type that holds the UTF-8 string and its final NULL */
big_len = length + 1; /* +1 byte for final NULL */
+ HDassert((2*big_len)<=sizeof(cmpbuf));
src_type = mkstr(big_len, H5T_STR_NULLTERM);
CHECK(src_type, FAIL, "mkstr");
/* Create a dst_type that holds half of the UTF-8 string and a final
@@ -224,6 +225,7 @@ void test_strpad(hid_t UNUSED fid, const char *string)
/* Create a src_type that holds the UTF-8 string */
big_len = length;
+ HDassert((2*big_len)<=sizeof(cmpbuf));
src_type = mkstr(big_len, H5T_STR_NULLPAD);
CHECK(src_type, FAIL, "mkstr");
/* Create a dst_type that holds half of the UTF-8 string */
diff --git a/testpar/t_dset.c b/testpar/t_dset.c
index 456c01e..84d69b0 100644
--- a/testpar/t_dset.c
+++ b/testpar/t_dset.c
@@ -3088,8 +3088,12 @@ dataset_atomicity(void)
dim0 = 64; dim1 = 32;
filename = GetTestParameters();
+ if (facc_type != FACC_MPIO) {
+ printf("Atomicity tests will not work without the MPIO VFD\n");
+ return;
+ }
if(VERBOSE_MED)
- printf("Independent write test on file %s\n", filename);
+ printf("atomic writes to file %s\n", filename);
/* set up MPI parameters */
MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index f27d09b..2837e71 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -513,16 +513,6 @@ int main(int argc, char **argv)
AddTest((mpi_size < 2)? "-fiodc" : "fiodc", file_image_daisy_chain_test, NULL,
"file image ops daisy chain", NULL);
- /* Display testing information */
- TestInfo(argv[0]);
-
- /* setup file access property list */
- fapl = H5Pcreate (H5P_FILE_ACCESS);
- H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL);
-
- /* Parse command line arguments */
- TestParseCmdLine(argc, argv);
-
if((mpi_size < 2)&& MAINPROCESS ) {
printf("Atomicity tests need at least 2 processes to participate\n");
printf("8 is more recommended.. Atomicity tests will be skipped \n");
@@ -535,6 +525,16 @@ int main(int argc, char **argv)
"dataset atomic updates", PARATESTFILE);
}
+ /* Display testing information */
+ TestInfo(argv[0]);
+
+ /* setup file access property list */
+ fapl = H5Pcreate (H5P_FILE_ACCESS);
+ H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL);
+
+ /* Parse command line arguments */
+ TestParseCmdLine(argc, argv);
+
if (facc_type == FACC_MPIPOSIX && MAINPROCESS){
printf("===================================\n"
" Using MPIPOSIX driver\n"
diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt
index 3357b97..903564f 100644
--- a/tools/h5diff/CMakeLists.txt
+++ b/tools/h5diff/CMakeLists.txt
@@ -202,6 +202,7 @@ IF (BUILD_TESTING)
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_56.txt
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_57.txt
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_58.txt
+ ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_59.txt
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_500.txt
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_501.txt
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_502.txt
@@ -702,6 +703,8 @@ IF (BUILD_TESTING)
h5diff_57.out.err
h5diff_58.out
h5diff_58.out.err
+ h5diff_59.out
+ h5diff_59.out.err
h5diff_500.out
h5diff_500.out.err
h5diff_501.out
@@ -960,6 +963,10 @@ ADD_H5_TEST (h5diff_57 0 -v ${FILE4} ${FILE4} dset7a dset7b)
# 5.8 (region reference)
ADD_H5_TEST (h5diff_58 1 -v ${FILE7} ${FILE8} refreg)
+# test for both dset and attr with same type but with different size
+# ( HDDFV-7942 )
+ADD_H5_TEST (h5diff_59 0 -v ${FILE4} ${FILE4} dset11a dset11b)
+
# ##############################################################################
# # Error messages
# ##############################################################################
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index c370f79..7c69154 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -759,6 +759,7 @@ int test_datatypes(const char *fname)
{
hid_t fid1;
+ hid_t dset;
hsize_t dims[2]={3,2};
herr_t status;
char buf1a[3][2] = {{1,1},{1,1},{1,1}};
@@ -790,6 +791,9 @@ int test_datatypes(const char *fname)
unsigned int buf10a[3][2] = {{UIMAX,1},{1,1},{1,1}};
unsigned int buf10b[3][2] = {{UIMAX-1,1},{3,4},{5,6}};
+ unsigned short buf11a[3][2] = {{204,205},{2,3},{1,1}};
+ unsigned int buf11b[3][2] = {{204,205},{2,3},{1,1}};
+
/*-------------------------------------------------------------------------
* Create a file
@@ -880,6 +884,19 @@ int test_datatypes(const char *fname)
write_dset(fid1,2,dims,"dset10a",H5T_NATIVE_UINT,buf10a);
write_dset(fid1,2,dims,"dset10b",H5T_NATIVE_UINT,buf10b);
+ /*-------------------------------------------------------------------------
+ * Same type class, different size
+ *-------------------------------------------------------------------------
+ */
+ write_dset(fid1,2,dims,"dset11a",H5T_STD_U16LE,buf11a);
+ dset=H5Dopen2 (fid1, "dset11a", H5P_DEFAULT);
+ write_attr(dset,2,dims,"attr",H5T_STD_U16LE,buf11a);
+ H5Dclose (dset);
+
+ write_dset(fid1,2,dims,"dset11b",H5T_STD_U32LE,buf11b);
+ dset=H5Dopen2 (fid1, "dset11b", H5P_DEFAULT);
+ write_attr(dset,2,dims,"attr",H5T_STD_U32LE,buf11b);
+ H5Dclose (dset);
/*-------------------------------------------------------------------------
* Close
diff --git a/tools/h5diff/testfiles/h5diff_59.txt b/tools/h5diff/testfiles/h5diff_59.txt
new file mode 100644
index 0000000..aeefa3a
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_59.txt
@@ -0,0 +1,11 @@
+dataset: </dset11a> and </dset11b>
+Warning: different storage datatype
+</dset11a> has file datatype H5T_STD_U16LE
+</dset11b> has file datatype H5T_STD_U32LE
+Warning: different storage datatype
+<attr> has file datatype H5T_STD_U16LE
+<attr> has file datatype H5T_STD_U32LE
+attribute: <attr of </dset11a>> and <attr of </dset11b>>
+0 differences found
+0 differences found
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_dtypes.h5 b/tools/h5diff/testfiles/h5diff_dtypes.h5
index 7c3cd9d..ffa5264 100644
--- a/tools/h5diff/testfiles/h5diff_dtypes.h5
+++ b/tools/h5diff/testfiles/h5diff_dtypes.h5
Binary files differ
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index 7e95e80..db37f24 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -234,6 +234,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_55.txt
$SRC_H5DIFF_TESTFILES/h5diff_56.txt
$SRC_H5DIFF_TESTFILES/h5diff_57.txt
$SRC_H5DIFF_TESTFILES/h5diff_58.txt
+$SRC_H5DIFF_TESTFILES/h5diff_59.txt
$SRC_H5DIFF_TESTFILES/h5diff_500.txt
$SRC_H5DIFF_TESTFILES/h5diff_501.txt
$SRC_H5DIFF_TESTFILES/h5diff_502.txt
@@ -626,6 +627,10 @@ TOOLTEST h5diff_57.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset7a dset7b
# 5.8 (region reference)
TOOLTEST h5diff_58.txt -v h5diff_dset1.h5 h5diff_dset2.h5 refreg
+# test for both dset and attr with same type but with different size
+# ( HDDFV-7942 )
+TOOLTEST h5diff_59.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset11a dset11b
+
# ##############################################################################
# # Error messages
# ##############################################################################
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index 02327b4..9c91827 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -781,16 +781,6 @@ IF (BUILD_TESTING)
ENDIF (HDF5_ENABLE_USING_MEMCHECKER)
ENDMACRO (ADD_XML_H5_TEST file)
- # --------------------------------------------------------------------
- # Determine which filters are available
- # --------------------------------------------------------------------
- SET (USE_FILTER_SZIP H5_HAVE_FILTER_SZIP)
- SET (USE_FILTER_DEFLATE H5_HAVE_FILTER_DEFLATE)
- SET (USE_FILTER_SHUFFLE H5_HAVE_FILTER_SHUFFLE)
- SET (USE_FILTER_FLETCHER32 H5_HAVE_FILTER_FLETCHER32)
- SET (USE_FILTER_NBIT H5_HAVE_FILTER_NBIT)
- SET (USE_FILTER_SCALEOFFSET H5_HAVE_FILTER_SCALEOFFSET)
-
##############################################################################
##############################################################################
### T H E T E S T S HDF5_ENABLE_USING_MEMCHECKER ###
@@ -1280,53 +1270,25 @@ IF (BUILD_TESTING)
# tests for filters
# SZIP
- SET (TESTTYPE "TEST")
- IF (NOT USE_FILTER_SZIP)
- SET (TESTTYPE "SKIP")
- ENDIF (NOT USE_FILTER_SZIP)
- ADD_SKIP_H5_TEST (tszip 0 ${TESTTYPE} --enable-error-stack -H -p -d szip tfilters.h5)
+ ADD_H5_TEST (tszip 0 --enable-error-stack -H -p -d szip tfilters.h5)
# deflate
- SET (TESTTYPE "TEST")
- IF (NOT USE_FILTER_DEFLATE)
- SET (TESTTYPE "SKIP")
- ENDIF (NOT USE_FILTER_DEFLATE)
- ADD_SKIP_H5_TEST (tdeflate 0 ${TESTTYPE} --enable-error-stack -H -p -d deflate tfilters.h5)
+ ADD_H5_TEST (tdeflate 0 --enable-error-stack -H -p -d deflate tfilters.h5)
# shuffle
- SET (TESTTYPE "TEST")
- IF (NOT USE_FILTER_SHUFFLE)
- SET (TESTTYPE "SKIP")
- ENDIF (NOT USE_FILTER_SHUFFLE)
- ADD_SKIP_H5_TEST (tshuffle 0 ${TESTTYPE} --enable-error-stack -H -p -d shuffle tfilters.h5)
+ ADD_H5_TEST (tshuffle 0 --enable-error-stack -H -p -d shuffle tfilters.h5)
# fletcher32
- SET (TESTTYPE "TEST")
- IF (NOT USE_FILTER_FLETCHER32)
- SET (TESTTYPE "SKIP")
- ENDIF (NOT USE_FILTER_FLETCHER32)
- ADD_SKIP_H5_TEST (tfletcher32 0 ${TESTTYPE} --enable-error-stack -H -p -d fletcher32 tfilters.h5)
+ ADD_H5_TEST (tfletcher32 0 --enable-error-stack -H -p -d fletcher32 tfilters.h5)
# nbit
- SET (TESTTYPE "TEST")
- IF (NOT USE_FILTER_NBIT)
- SET (TESTTYPE "SKIP")
- ENDIF (NOT USE_FILTER_NBIT)
- ADD_SKIP_H5_TEST (tnbit 0 ${TESTTYPE} --enable-error-stack -H -p -d nbit tfilters.h5)
+ ADD_H5_TEST (tnbit 0 --enable-error-stack -H -p -d nbit tfilters.h5)
# scaleoffset
- SET (TESTTYPE "TEST")
- IF (NOT USE_FILTER_SCALEOFFSET)
- SET (TESTTYPE "SKIP")
- ENDIF (NOT USE_FILTER_SCALEOFFSET)
- ADD_SKIP_H5_TEST (tscaleoffset 0 ${TESTTYPE} --enable-error-stack -H -p -d scaleoffset tfilters.h5)
+ ADD_H5_TEST (tscaleoffset 0 --enable-error-stack -H -p -d scaleoffset tfilters.h5)
# all
- SET (TESTTYPE "TEST")
- IF (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_NBIT OR NOT USE_FILTER_SCALEOFFSET)
- SET (TESTTYPE "SKIP")
- ENDIF (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_NBIT OR NOT USE_FILTER_SCALEOFFSET)
- ADD_SKIP_H5_TEST (tallfilters 0 ${TESTTYPE} --enable-error-stack -H -p -d all tfilters.h5)
+ ADD_H5_TEST (tallfilters 0 --enable-error-stack -H -p -d all tfilters.h5)
# user defined
ADD_H5_TEST (tuserfilter 0 --enable-error-stack -H -p -d myfilter tfilters.h5)
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 0ca6aa9..f969876 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -15,14 +15,6 @@
#
# Tests for the h5dump tool
-# Determine which filters are available
-USE_FILTER_SZIP="@USE_FILTER_SZIP@"
-USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
-USE_FILTER_SHUFFLE="@USE_FILTER_SHUFFLE@"
-USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@"
-USE_FILTER_NBIT="@USE_FILTER_NBIT@"
-USE_FILTER_SCALEOFFSET="@USE_FILTER_SCALEOFFSET@"
-
TESTNAME=h5dump
EXIT_SUCCESS=0
EXIT_FAILURE=1
@@ -881,54 +873,19 @@ TOOLTEST texceedsubblock.ddl --enable-error-stack -d 1d -k 1,3 taindices.h5
# tests for filters
# SZIP
-option="--enable-error-stack -H -p -d szip tfilters.h5"
-if test $USE_FILTER_SZIP != "yes"; then
- SKIP $option
-else
-TOOLTEST tszip.ddl $option
-fi
+TOOLTEST tszip.ddl --enable-error-stack -H -p -d szip tfilters.h5
# deflate
-option="--enable-error-stack -H -p -d deflate tfilters.h5"
-if test $USE_FILTER_DEFLATE != "yes"; then
- SKIP $option
-else
- TOOLTEST tdeflate.ddl $option
-fi
+TOOLTEST tdeflate.ddl --enable-error-stack -H -p -d deflate tfilters.h5
# shuffle
-option="--enable-error-stack -H -p -d shuffle tfilters.h5"
-if test $USE_FILTER_SHUFFLE != "yes"; then
- SKIP $option
-else
- TOOLTEST tshuffle.ddl $option
-fi
+TOOLTEST tshuffle.ddl --enable-error-stack -H -p -d shuffle tfilters.h5
# fletcher32
-option="--enable-error-stack -H -p -d fletcher32 tfilters.h5"
-if test $USE_FILTER_FLETCHER32 != "yes"; then
- SKIP $option
-else
- TOOLTEST tfletcher32.ddl $option
-fi
+TOOLTEST tfletcher32.ddl --enable-error-stack -H -p -d fletcher32 tfilters.h5
# nbit
-option="--enable-error-stack -H -p -d nbit tfilters.h5"
-if test $USE_FILTER_NBIT != "yes"; then
- SKIP $option
-else
- TOOLTEST tnbit.ddl $option
-fi
+TOOLTEST tnbit.ddl --enable-error-stack -H -p -d nbit tfilters.h5
# scaleoffset
-option="--enable-error-stack -H -p -d scaleoffset tfilters.h5"
-if test $USE_FILTER_SCALEOFFSET != "yes"; then
- SKIP $option
-else
- TOOLTEST tscaleoffset.ddl $option
-fi
+TOOLTEST tscaleoffset.ddl --enable-error-stack -H -p -d scaleoffset tfilters.h5
# all
-option="--enable-error-stack -H -p -d all tfilters.h5"
-if test $USE_FILTER_FLETCHER32 != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_DEFLATE != "yes" -o $USE_FILTER_SHUFFLE != "yes" -o $USE_FILTER_NBIT != "yes" -o $USE_FILTER_SCALEOFFSET != "yes"; then
- SKIP $option
-else
- TOOLTEST tallfilters.ddl $option
-fi
+TOOLTEST tallfilters.ddl --enable-error-stack -H -p -d all tfilters.h5
# user defined
TOOLTEST tuserfilter.ddl --enable-error-stack -H -p -d myfilter tfilters.h5
diff --git a/tools/h5import/CMakeLists.txt b/tools/h5import/CMakeLists.txt
index a655bf2..4e320a1 100644
--- a/tools/h5import/CMakeLists.txt
+++ b/tools/h5import/CMakeLists.txt
@@ -273,7 +273,9 @@ IF (BUILD_TESTING)
# --------------------------------------------------------------------
# Determine if filter is available for h5diff
# --------------------------------------------------------------------
- SET (USE_FILTER_DEFLATE H5_HAVE_FILTER_DEFLATE)
+ IF (H5_HAVE_FILTER_DEFLATE)
+ SET (USE_FILTER_DEFLATE "true")
+ ENDIF (H5_HAVE_FILTER_DEFLATE)
##############################################################################
##############################################################################
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 957d3c8..cf55d7f 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -1541,7 +1541,7 @@ static void print_dataset_info(hid_t dcpl_id,
printf(FORMAT_OBJ,"dset",objname );
else
{
- char str[255], temp[20];
+ char str[255], temp[28];
HDstrcpy(str,"dset ");
HDstrcat(str,strfilter);
sprintf(temp," (%.3f:1)",ratio);
diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c
index 4ec7fcf..00e4bea 100644
--- a/tools/h5repack/h5repack_opttable.c
+++ b/tools/h5repack/h5repack_opttable.c
@@ -388,7 +388,7 @@ pack_info_t* options_get_object( const char *path,
pack_opttbl_t *table )
{
unsigned int i;
- const char tbl_path[MAX_NC_NAME];
+ const char tbl_path[MAX_NC_NAME+1]; /* +1 for start with "/" case */
for ( i = 0; i < table->nelems; i++)
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt
index 6d48d5f..21420ce 100644
--- a/tools/lib/CMakeLists.txt
+++ b/tools/lib/CMakeLists.txt
@@ -40,6 +40,7 @@ H5_SET_LIB_OPTIONS (
HDF5_TOOLS_LIB_NAME_RELEASE
HDF5_TOOLS_LIB_NAME_DEBUG
)
+#SET_TARGET_PROPERTIES (hdf5_tools PROPERTIES COMPILE_DEFINITIONS H5DIFF_DEBUG)
SET_TARGET_PROPERTIES (hdf5_tools PROPERTIES FOLDER libraries/tools)
##############################################################################
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 0c1f3d3..f2eb3ab 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -21,23 +21,6 @@
#include "h5diff.h"
#include "ph5diff.h"
-/*
- * Debug printf macros. The prefix allows output filtering by test scripts.
- */
-#ifdef H5DIFF_DEBUG
-#define h5diffdebug(x) HDfprintf(stderr, "h5diff debug: " x)
-#define h5diffdebug2(x1, x2) HDfprintf(stderr, "h5diff debug: " x1, x2)
-#define h5diffdebug3(x1, x2, x3) HDfprintf(stderr, "h5diff debug: " x1, x2, x3)
-#define h5diffdebug4(x1, x2, x3, x4) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4)
-#define h5diffdebug5(x1, x2, x3, x4, x5) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4, x5)
-#else
-#define h5diffdebug(x)
-#define h5diffdebug2(x1, x2)
-#define h5diffdebug3(x1, x2, x3)
-#define h5diffdebug4(x1, x2, x3, x4)
-#define h5diffdebug5(x1, x2, x3, x4, x5)
-#endif
-
/*-------------------------------------------------------------------------
* Function: print_objname
@@ -369,6 +352,7 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
trav_table_t *table;
size_t idx;
+ h5difftrace("build_match_list start\n");
/* init */
trav_table_init( &table );
@@ -378,6 +362,7 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
* All the objects belong to given groups are the cadidates.
* So prepare to compare paths without the group names.
*/
+
/* if obj1 is not root */
if (HDstrcmp (objname1,"/") != 0)
path1_offset = HDstrlen(objname1);
@@ -390,7 +375,6 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
*/
while(curr1 < info1->nused && curr2 < info2->nused)
{
-
path1_lp = (info1->paths[curr1].path) + path1_offset;
path2_lp = (info2->paths[curr2].path) + path2_offset;
type1_l = info1->paths[curr1].type;
@@ -399,7 +383,8 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
/* criteria is string compare */
cmp = HDstrcmp(path1_lp, path2_lp);
- if(cmp == 0) {
+ if(cmp == 0)
+ {
if(!is_exclude_path(path1_lp, type1_l, options))
{
infile[0] = 1;
@@ -470,29 +455,9 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
} /* end while */
free_exclude_path_list (options);
- /*------------------------------------------------------
- * print the list
- */
- if(options->m_verbose)
- {
- parallel_print("\n");
- /* if given objects is group under root */
- if (HDstrcmp (objname1,"/") || HDstrcmp (objname2,"/"))
- parallel_print("group1 group2\n");
- else
- parallel_print("file1 file2\n");
- parallel_print("---------------------------------------\n");
- for(i = 0; i < table->nobjs; i++)
- {
- char c1, c2;
- c1 = (table->objs[i].flags[0]) ? 'x' : ' ';
- c2 = (table->objs[i].flags[1]) ? 'x' : ' ';
- parallel_print("%5c %6c %-15s\n", c1, c2, table->objs[i].name);
- } /* end for */
- parallel_print ("\n");
- } /* end if */
*table_out = table;
+ h5difftrace("build_match_list finish\n");
}
@@ -653,6 +618,7 @@ hsize_t h5diff(const char *fname1,
int l_ret2 = -1;
const char * obj1fullname = NULL;
const char * obj2fullname = NULL;
+ int both_objs_grp = 0;
/* init to group type */
h5trav_type_t obj1type = H5TRAV_TYPE_GROUP;
h5trav_type_t obj2type = H5TRAV_TYPE_GROUP;
@@ -675,6 +641,7 @@ hsize_t h5diff(const char *fname1,
/* list for common objects */
trav_table_t *match_list = NULL;
+ h5difftrace("h5diff start\n");
/* init filenames */
HDmemset(filenames, 0, MAX_FILENAME * 2);
/* init link info struct */
@@ -723,6 +690,7 @@ hsize_t h5diff(const char *fname1,
trav_info_init(fname1, file1_id, &info1_obj);
trav_info_init(fname2, file2_id, &info2_obj);
+ h5difftrace("trav_info_init initialized\n");
/* if any object is specified */
if (objname1)
{
@@ -751,6 +719,7 @@ hsize_t h5diff(const char *fname1,
/*----------------------------------------------------------
* check if obj1 is root, group, single object or symlink
*/
+ h5difftrace("h5diff check if obj1 is root, group, single object or symlink\n");
if(!HDstrcmp((char *)obj1fullname, "/"))
{
obj1type = H5TRAV_TYPE_GROUP;
@@ -778,6 +747,7 @@ hsize_t h5diff(const char *fname1,
*/
if(src_linfo1.type == H5L_TYPE_HARD)
{
+ int idx = 0;
/* optional data pass */
info1_obj->opts = (diff_opt_t*)options;
@@ -789,6 +759,9 @@ hsize_t h5diff(const char *fname1,
}
obj1type = oinfo1.type;
trav_info_add(info1_obj, obj1fullname, obj1type);
+ idx = info1_obj->nused - 1;
+ info1_obj->paths[idx].objno = oinfo1.addr;
+ info1_obj->paths[idx].fileno = oinfo1.fileno;
}
else if (src_linfo1.type == H5L_TYPE_SOFT)
{
@@ -805,6 +778,7 @@ hsize_t h5diff(const char *fname1,
/*----------------------------------------------------------
* check if obj2 is root, group, single object or symlink
*/
+ h5difftrace("h5diff check if obj2 is root, group, single object or symlink\n");
if(!HDstrcmp(obj2fullname, "/"))
{
obj2type = H5TRAV_TYPE_GROUP;
@@ -832,6 +806,7 @@ hsize_t h5diff(const char *fname1,
*/
if(src_linfo2.type == H5L_TYPE_HARD)
{
+ int idx = 0;
/* optional data pass */
info2_obj->opts = (diff_opt_t*)options;
@@ -843,6 +818,9 @@ hsize_t h5diff(const char *fname1,
}
obj2type = oinfo2.type;
trav_info_add(info2_obj, obj2fullname, obj2type);
+ idx = info2_obj->nused - 1;
+ info2_obj->paths[idx].objno = oinfo2.addr;
+ info2_obj->paths[idx].fileno = oinfo2.fileno;
}
else if (src_linfo2.type == H5L_TYPE_SOFT)
{
@@ -859,11 +837,14 @@ hsize_t h5diff(const char *fname1,
/* if no object specified */
else
{
+ h5difftrace("h5diff no object specified\n");
/* set root group */
obj1fullname = (char*)HDcalloc(2, sizeof(char));
HDstrcat((char *)obj1fullname, "/");
+ obj1type = H5TRAV_TYPE_GROUP;
obj2fullname = (char*)HDcalloc(2, sizeof(char));
HDstrcat((char *)obj2fullname, "/");
+ obj2type = H5TRAV_TYPE_GROUP;
}
@@ -883,9 +864,11 @@ hsize_t h5diff(const char *fname1,
/*-------------------------------
* check symbolic link (object1)
*/
+ h5difftrace("h5diff check symbolic link (object1)\n");
/* dangling link */
if (l_ret1 == 0)
{
+ h5difftrace("h5diff ... dangling link\n");
if (options->no_dangle_links)
{
/* treat dangling link is error */
@@ -913,15 +896,27 @@ hsize_t h5diff(const char *fname1,
goto out;
}
else if(l_ret1 != 2) /* symbolic link */
+ {
obj1type = trg_linfo1.trg_type;
+ h5difftrace("h5diff ... ... trg_linfo1.trg_type == H5L_TYPE_HARD\n");
+ if (info1_lp != NULL) {
+ int idx = info1_lp->nused - 1;
+ h5difftrace("h5diff ... ... ... info1_obj not null\n");
+ info1_lp->paths[idx].type = trg_linfo1.trg_type;
+ info1_lp->paths[idx].objno = trg_linfo1.objno;
+ info1_lp->paths[idx].fileno = trg_linfo1.fileno;
+ }
+ h5difftrace("h5diff check symbolic link (object1) finished\n");
+ }
/*-------------------------------
* check symbolic link (object2)
*/
-
+ h5difftrace("h5diff check symbolic link (object2)\n");
/* dangling link */
if (l_ret2 == 0)
{
+ h5difftrace("h5diff ... dangling link\n");
if (options->no_dangle_links)
{
/* treat dangling link is error */
@@ -949,11 +944,21 @@ hsize_t h5diff(const char *fname1,
goto out;
}
else if(l_ret2 != 2) /* symbolic link */
+ {
obj2type = trg_linfo2.trg_type;
+ if (info2_lp != NULL) {
+ int idx = info2_lp->nused - 1;
+ h5difftrace("h5diff ... ... ... info2_obj not null\n");
+ info2_lp->paths[idx].type = trg_linfo2.trg_type;
+ info2_lp->paths[idx].objno = trg_linfo2.objno;
+ info2_lp->paths[idx].fileno = trg_linfo2.fileno;
+ }
+ h5difftrace("h5diff check symbolic link (object1) finished\n");
+ }
} /* end of if follow symlinks */
/*
- * If verbose options is not used, don't need to traverse thorugh the list
+ * If verbose options is not used, don't need to traverse through the list
* of objects in the group to display objects information,
* So use h5tools_is_obj_same() to improve performance by skipping
* comparing details of same objects.
@@ -961,26 +966,26 @@ hsize_t h5diff(const char *fname1,
if(!(options->m_verbose || options->m_report))
{
+ h5difftrace("h5diff NOT (options->m_verbose || options->m_report)\n");
/* if no danglink links */
if ( l_ret1 > 0 && l_ret2 > 0 )
- if (h5tools_is_obj_same(file1_id,obj1fullname,file2_id,obj2fullname)!=0)
+ if (h5tools_is_obj_same(file1_id, obj1fullname, file2_id, obj2fullname)!=0)
goto out;
}
-
- /* if both obj1 and obj2 are group */
- if (obj1type == H5TRAV_TYPE_GROUP && obj2type == H5TRAV_TYPE_GROUP)
+ both_objs_grp = (obj1type == H5TRAV_TYPE_GROUP && obj2type == H5TRAV_TYPE_GROUP);
+ if (both_objs_grp)
{
-
- /*
- * traverse group1
+ h5difftrace("h5diff both_objs_grp TRUE\n");
+ /*
+ * traverse group1
*/
trav_info_init(fname1, file1_id, &info1_grp);
/* optional data pass */
info1_grp->opts = (diff_opt_t*)options;
- if(h5trav_visit(file1_id,obj1fullname,TRUE,TRUE,
- trav_grp_objs,trav_grp_symlinks, info1_grp) < 0)
+ if(h5trav_visit(file1_id, obj1fullname, TRUE, TRUE,
+ trav_grp_objs, trav_grp_symlinks, info1_grp) < 0)
{
parallel_print("Error: Could not get file contents\n");
options->err_stat = 1;
@@ -988,59 +993,71 @@ hsize_t h5diff(const char *fname1,
}
info1_lp = info1_grp;
- /*
- * traverse group2
+ /*
+ * traverse group2
*/
trav_info_init(fname2, file2_id, &info2_grp);
/* optional data pass */
info2_grp->opts = (diff_opt_t*)options;
- if(h5trav_visit(file2_id,obj2fullname,TRUE,TRUE,
- trav_grp_objs,trav_grp_symlinks, info2_grp) < 0)
+ if(h5trav_visit(file2_id, obj2fullname, TRUE, TRUE,
+ trav_grp_objs, trav_grp_symlinks, info2_grp) < 0)
{
parallel_print("Error: Could not get file contents\n");
options->err_stat = 1;
goto out;
} /* end if */
info2_lp = info2_grp;
-
+ }
#ifdef H5_HAVE_PARALLEL
- if(g_Parallel)
+ if(g_Parallel)
+ {
+ if((HDstrlen(fname1) > MAX_FILENAME) || (HDstrlen(fname2) > MAX_FILENAME))
{
- if((HDstrlen(fname1) > MAX_FILENAME) ||
- (HDstrlen(fname2) > MAX_FILENAME))
- {
- HDfprintf(stderr, "The parallel diff only supports path names up to %d characters\n", MAX_FILENAME);
- MPI_Abort(MPI_COMM_WORLD, 0);
- } /* end if */
+ HDfprintf(stderr, "The parallel diff only supports path names up to %d characters\n", MAX_FILENAME);
+ MPI_Abort(MPI_COMM_WORLD, 0);
+ } /* end if */
- HDstrcpy(filenames[0], fname1);
- HDstrcpy(filenames[1], fname2);
+ HDstrcpy(filenames[0], fname1);
+ HDstrcpy(filenames[1], fname2);
- /* Alert the worker tasks that there's going to be work. */
- for(i = 1; i < g_nTasks; i++)
- MPI_Send(filenames, (MAX_FILENAME * 2), MPI_CHAR, i, MPI_TAG_PARALLEL, MPI_COMM_WORLD);
- } /* end if */
-#endif
- build_match_list (obj1fullname, info1_lp, obj2fullname, info2_lp,
- &match_list, options);
- nfound = diff_match(file1_id, obj1fullname, info1_lp,
- file2_id, obj2fullname, info2_lp,
- match_list, options);
- }
- else
- {
-#ifdef H5_HAVE_PARALLEL
- if(g_Parallel)
- /* Only single object diff, parallel workers won't be needed */
- phdiff_dismiss_workers();
+ /* Alert the worker tasks that there's going to be work. */
+ for(i = 1; i < g_nTasks; i++)
+ MPI_Send(filenames, (MAX_FILENAME * 2), MPI_CHAR, i, MPI_TAG_PARALLEL, MPI_COMM_WORLD);
+ } /* end if */
#endif
- nfound = diff_compare(file1_id, fname1, obj1fullname, info1_lp,
- file2_id, fname2, obj2fullname, info2_lp,
- options);
+ /* process the objects */
+ build_match_list (obj1fullname, info1_lp, obj2fullname, info2_lp,
+ &match_list, options);
+ if (both_objs_grp)
+ {
+ /*------------------------------------------------------
+ * print the list
+ */
+ if(options->m_verbose)
+ {
+ parallel_print("\n");
+ /* if given objects is group under root */
+ if (HDstrcmp (obj1fullname,"/") || HDstrcmp (obj2fullname,"/"))
+ parallel_print("group1 group2\n");
+ else
+ parallel_print("file1 file2\n");
+ parallel_print("---------------------------------------\n");
+ for(i = 0; i < match_list->nobjs; i++)
+ {
+ char c1, c2;
+ c1 = (match_list->objs[i].flags[0]) ? 'x' : ' ';
+ c2 = (match_list->objs[i].flags[1]) ? 'x' : ' ';
+ parallel_print("%5c %6c %-15s\n", c1, c2, match_list->objs[i].name);
+ } /* end for */
+ parallel_print ("\n");
+ } /* end if */
}
+ nfound = diff_match(file1_id, obj1fullname, info1_lp,
+ file2_id, obj2fullname, info2_lp,
+ match_list, options);
out:
#ifdef H5_HAVE_PARALLEL
@@ -1077,6 +1094,7 @@ out:
H5Fclose(file1_id);
H5Fclose(file2_id);
} H5E_END_TRY;
+ h5difftrace("h5diff finish\n");
return nfound;
}
@@ -1125,6 +1143,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
size_t idx2 = 0;
+ h5difftrace("diff_match start\n");
/*
* if not root, prepare object name to be pre-appended to group path to
* make full path
@@ -1142,7 +1161,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
*-------------------------------------------------------------------------
*/
- /* not valid compare nused when --exclude-path option is used */
+ /* not valid compare used when --exclude-path option is used */
if (!options->exclude_path)
{
/* number of different objects */
@@ -1222,7 +1241,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
{
int workerFound = 0;
- h5diffdebug("beginning of big else block\n");
+ h5difftrace("Beginning of big else block\n");
/* We're in parallel mode */
/* Since the data type of diff value is hsize_t which can
* be arbitary large such that there is no MPI type that
@@ -1247,7 +1266,6 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
args.argdata.type[1] = info2->paths[idx2].type;
args.argdata.is_same_trgobj = table->objs[i].is_same_trgobj;
- h5diffdebug2("busyTasks=%d\n", busyTasks);
/* if there are any outstanding print requests, let's handle one. */
if(busyTasks > 0)
{
@@ -1319,7 +1337,6 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
} /* end if */
} /* end for */
- h5diffdebug2("workerfound is %d \n", workerFound);
if(!workerFound)
{
/* if they were all busy, we've got to wait for one free up
@@ -1395,7 +1412,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
HDfree (obj2_fullpath);
} /* end if */
} /* end for */
- h5diffdebug("done with for loop\n");
+ h5difftrace("done with for loop\n");
#ifdef H5_HAVE_PARALLEL
if(g_Parallel)
@@ -1482,7 +1499,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
/* Print any final data waiting in our queue */
print_incoming_data();
} /* end if */
- h5diffdebug("done with if block\n");
+ h5difftrace("done with if block\n");
HDfree(workerTasks);
}
@@ -1491,130 +1508,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
/* free table */
if (table)
trav_table_free(table);
-
- return nfound;
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: diff_compare
- *
- * Purpose: get objects from list, and check for the same type
- *
- * Return: Number of differences found
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- * Date: May 9, 2003
- *
- * Programmer: Jonathan Kim
- * - add following links feature (Feb 11,2010)
- *-------------------------------------------------------------------------
- */
-
-hsize_t diff_compare(hid_t file1_id,
- const char *file1_name,
- const char *obj1_name,
- trav_info_t *info1,
- hid_t file2_id,
- const char *file2_name,
- const char *obj2_name,
- trav_info_t *info2,
- diff_opt_t *options)
-{
- int f1 = 0;
- int f2 = 0;
- hsize_t nfound = 0;
- ssize_t i,j;
- int l_ret;
- int is_dangle_link1 = 0;
- int is_dangle_link2 = 0;
- const char *obj1name = obj1_name;
- const char *obj2name = obj2_name;
- diff_args_t argdata;
-
- /* local variables for diff() */
- h5trav_type_t obj1type, obj2type;
-
- /* to get link info */
- h5tool_link_info_t linkinfo1;
- h5tool_link_info_t linkinfo2;
-
- /* init link info struct */
- HDmemset(&linkinfo1, 0, sizeof(h5tool_link_info_t));
- HDmemset(&linkinfo2, 0, sizeof(h5tool_link_info_t));
-
- i = h5trav_getindex (info1, obj1name);
- j = h5trav_getindex (info2, obj2name);
-
- if (i == -1)
- {
- parallel_print ("Object <%s> could not be found in <%s>\n", obj1name,
- file1_name);
- f1 = 1;
- }
- if (j == -1)
- {
- parallel_print ("Object <%s> could not be found in <%s>\n", obj2name,
- file2_name);
- f2 = 1;
- }
- if (f1 || f2)
- {
- options->err_stat = 1;
- return 0;
- }
- /* use the name with "/" first, as obtained by iterator function */
- obj1name = info1->paths[i].path;
- obj2name = info2->paths[j].path;
-
- obj1type = info1->paths[i].type;
- obj2type = info2->paths[j].type;
-
- /* Set argdata to pass other args into diff() */
- argdata.type[0] = obj1type;
- argdata.type[1] = obj2type;
- argdata.is_same_trgobj = 0;
-
- nfound = diff(file1_id, obj1name,
- file2_id, obj2name,
- options, &argdata);
-
-out:
- /*-------------------------------
- * handle dangling link(s) */
- /* both obj1 and obj2 are dangling links */
- if(is_dangle_link1 && is_dangle_link2)
- {
- if(print_objname(options, nfound))
- {
- do_print_objname("dangling link", obj1name, obj2name, options);
- print_found(nfound);
- }
- }
- /* obj1 is dangling link */
- else if (is_dangle_link1)
- {
- if(options->m_verbose)
- parallel_print("obj1 <%s> is a dangling link.\n", obj1name);
- nfound++;
- if(print_objname(options, nfound))
- print_found(nfound);
- }
- /* obj2 is dangling link */
- else if (is_dangle_link2)
- {
- if(options->m_verbose)
- parallel_print("obj2 <%s> is a dangling link.\n", obj2name);
- nfound++;
- if(print_objname(options, nfound))
- print_found(nfound);
- }
-
- /* free link info buffer */
- if (linkinfo1.trg_path)
- HDfree((char *)linkinfo1.trg_path);
- if (linkinfo2.trg_path)
- HDfree((char *)linkinfo2.trg_path);
+ h5difftrace("diff_match finish\n");
return nfound;
}
@@ -1664,11 +1558,12 @@ hsize_t diff(hid_t file1_id,
hsize_t nfound = 0;
h5trav_type_t object_type;
-
/* to get link info */
h5tool_link_info_t linkinfo1;
h5tool_link_info_t linkinfo2;
+ h5difftrace("diff start\n");
+
/*init link info struct */
HDmemset(&linkinfo1,0,sizeof(h5tool_link_info_t));
HDmemset(&linkinfo2,0,sizeof(h5tool_link_info_t));
@@ -1768,6 +1663,7 @@ hsize_t diff(hid_t file1_id,
*/
if (argdata->is_same_trgobj)
{
+ h5difftrace("argdata->is_same_trgobj\n");
is_hard_link = (object_type == H5TRAV_TYPE_DATASET ||
object_type == H5TRAV_TYPE_NAMED_DATATYPE ||
object_type == H5TRAV_TYPE_GROUP);
@@ -2053,6 +1949,7 @@ out2:
H5Tclose(grp2_id);
/* enable error reporting */
} H5E_END_TRY;
+ h5difftrace("diff finish\n");
return nfound;
}
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 6985b68..2530805 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -19,6 +19,23 @@
#include "hdf5.h"
#include "h5trav.h"
+/*
+ * Debug printf macros. The prefix allows output filtering by test scripts.
+ */
+#ifdef H5DIFF_DEBUG
+#define h5difftrace(x) HDfprintf(stderr, "h5diff debug: " x)
+#define h5diffdebug2(x1, x2) HDfprintf(stderr, "h5diff debug: " x1, x2)
+#define h5diffdebug3(x1, x2, x3) HDfprintf(stderr, "h5diff debug: " x1, x2, x3)
+#define h5diffdebug4(x1, x2, x3, x4) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4)
+#define h5diffdebug5(x1, x2, x3, x4, x5) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4, x5)
+#else
+#define h5difftrace(x)
+#define h5diffdebug2(x1, x2)
+#define h5diffdebug3(x1, x2, x3)
+#define h5diffdebug4(x1, x2, x3, x4)
+#define h5diffdebug5(x1, x2, x3, x4, x5)
+#endif
+
#define MAX_FILENAME 1024
/*-------------------------------------------------------------------------
@@ -118,15 +135,6 @@ hsize_t diff_datasetid( hid_t dset1_id,
const char *obj2_name,
diff_opt_t *options);
-hsize_t diff_compare( hid_t file1_id,
- const char *file1_name,
- const char *obj1_name,
- trav_info_t *info1,
- hid_t file2_id,
- const char *file2_name,
- const char *obj2_name,
- trav_info_t *info2,
- diff_opt_t *options );
hsize_t diff_match( hid_t file1_id, const char *grp1, trav_info_t *info1,
hid_t file2_id, const char *grp2, trav_info_t *info2,
@@ -172,6 +180,7 @@ hsize_t diff_attr(hid_t loc1_id,
*-------------------------------------------------------------------------
*/
+/* in h5diff_util.c */
void print_found(hsize_t nfound);
void print_type(hid_t type);
const char* diff_basename(const char *name);
@@ -179,6 +188,10 @@ const char* get_type(h5trav_type_t type);
const char* get_class(H5T_class_t tclass);
const char* get_sign(H5T_sign_t sign);
void print_dimensions (int rank, hsize_t *dims);
+herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
+ hid_t *m_tid1, hid_t *m_tid2,
+ size_t *m_size1, size_t *m_size2);
+/* in h5diff.c */
int print_objname(diff_opt_t *options, hsize_t nfound);
void do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_opt_t * opts);
void do_print_attrname (const char *attr, const char *path1, const char *path2);
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 604a825..1e7f88b 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -230,6 +230,7 @@ hsize_t diff_array( void *_mem1,
mcomp_t members;
H5T_class_t type_class;
+ h5difftrace("diff_array start\n");
/* get the size. */
size = H5Tget_size( m_type );
type_class = H5Tget_class(m_type);
@@ -344,6 +345,7 @@ hsize_t diff_array( void *_mem1,
} /* i */
close_member_types(&members);
} /* switch */
+ h5difftrace("diff_array finish\n");
return nfound;
}
@@ -423,6 +425,7 @@ hsize_t diff_datum(void *_mem1,
double per;
int both_zero;
+ h5difftrace("diff_datum start\n");
type_size = H5Tget_size( m_type );
type_class = H5Tget_class(m_type);
@@ -2537,6 +2540,7 @@ hsize_t diff_datum(void *_mem1,
break; /* H5T_FLOAT class */
} /* switch */
+ h5difftrace("diff_datum finish\n");
return nfound;
}
@@ -2822,6 +2826,7 @@ hsize_t character_compare(unsigned char *mem1,
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
+ h5difftrace("character_compare start\n");
if (temp1_uchar != temp2_uchar)
{
@@ -2836,6 +2841,7 @@ hsize_t character_compare(unsigned char *mem1,
}
nfound++;
}
+ h5difftrace("character_compare finish\n");
return nfound;
}
@@ -2872,6 +2878,7 @@ hsize_t character_compare_opt(unsigned char *mem1,
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
+ h5difftrace("character_compare_opt start\n");
/* -d and !-p */
if (options->d && !options->p)
@@ -2927,6 +2934,7 @@ hsize_t character_compare_opt(unsigned char *mem1,
}
nfound++;
}
+ h5difftrace("character_compare_opt finish\n");
return nfound;
@@ -2965,6 +2973,7 @@ hsize_t diff_float(unsigned char *mem1,
int isnan1=0;
int isnan2=0;
+ h5difftrace("diff_float start\n");
/*-------------------------------------------------------------------------
* -d and !-p
@@ -3202,6 +3211,7 @@ hsize_t diff_float(unsigned char *mem1,
}
+ h5difftrace("diff_float finish\n");
return nfound;
}
@@ -3239,6 +3249,7 @@ hsize_t diff_double(unsigned char *mem1,
int isnan1=0;
int isnan2=0;
+ h5difftrace("diff_double start\n");
/*-------------------------------------------------------------------------
* -d and !-p
*-------------------------------------------------------------------------
@@ -3479,6 +3490,7 @@ hsize_t diff_double(unsigned char *mem1,
}
+ h5difftrace("diff_double finish\n");
return nfound;
}
@@ -3521,6 +3533,7 @@ hsize_t diff_ldouble(unsigned char *mem1,
int isnan1=0;
int isnan2=0;
+ h5difftrace("diff_ldouble start\n");
/*-------------------------------------------------------------------------
* -d and !-p
@@ -3762,6 +3775,7 @@ hsize_t diff_ldouble(unsigned char *mem1,
}
+ h5difftrace("diff_ldouble finish\n");
return nfound;
}
@@ -3802,6 +3816,7 @@ hsize_t diff_schar(unsigned char *mem1,
double per;
int both_zero;
+ h5difftrace("diff_schar start\n");
/* -d and !-p */
if (options->d && !options->p)
@@ -3943,6 +3958,7 @@ hsize_t diff_schar(unsigned char *mem1,
} /* nelmts */
}
+ h5difftrace("diff_schar finish\n");
return nfound;
}
@@ -3979,6 +3995,7 @@ hsize_t diff_uchar(unsigned char *mem1,
double per;
int both_zero;
+ h5difftrace("diff_uchar start\n");
/* -d and !-p */
if (options->d && !options->p)
@@ -4121,6 +4138,7 @@ hsize_t diff_uchar(unsigned char *mem1,
} /* nelmts */
}
+ h5difftrace("diff_uchar finish\n");
return nfound;
}
@@ -4155,6 +4173,7 @@ hsize_t diff_short(unsigned char *mem1,
double per;
int both_zero;
+ h5difftrace("diff_short start\n");
/* -d and !-p */
if (options->d && !options->p)
{
@@ -4298,6 +4317,7 @@ hsize_t diff_short(unsigned char *mem1,
} /* nelmts */
}
+ h5difftrace("diff_short finish\n");
return nfound;
}
@@ -4333,6 +4353,7 @@ hsize_t diff_ushort(unsigned char *mem1,
double per;
int both_zero;
+ h5difftrace("diff_ushort start\n");
/* -d and !-p */
if (options->d && !options->p)
{
@@ -4476,6 +4497,7 @@ hsize_t diff_ushort(unsigned char *mem1,
} /* nelmts */
}
+ h5difftrace("diff_ushort finish\n");
return nfound;
}
@@ -4512,6 +4534,7 @@ hsize_t diff_int(unsigned char *mem1,
double per;
int both_zero;
+ h5difftrace("diff_int start\n");
/* -d and !-p */
if (options->d && !options->p)
{
@@ -4655,6 +4678,7 @@ hsize_t diff_int(unsigned char *mem1,
} /* nelmts */
}
+ h5difftrace("diff_int finish\n");
return nfound;
}
@@ -4691,6 +4715,7 @@ hsize_t diff_uint(unsigned char *mem1,
double per;
int both_zero;
+ h5difftrace("diff_uint start\n");
/* -d and !-p */
if (options->d && !options->p)
{
@@ -4832,6 +4857,7 @@ hsize_t diff_uint(unsigned char *mem1,
} /* nelmts */
}
+ h5difftrace("diff_uint finish\n");
return nfound;
}
@@ -4868,6 +4894,7 @@ hsize_t diff_long(unsigned char *mem1,
double per;
int both_zero;
+ h5difftrace("diff_long start\n");
/* -d and !-p */
if (options->d && !options->p)
{
@@ -5014,6 +5041,7 @@ hsize_t diff_long(unsigned char *mem1,
} /* nelmts */
}
+ h5difftrace("diff_long finish\n");
return nfound;
}
@@ -5051,6 +5079,7 @@ hsize_t diff_ulong(unsigned char *mem1,
double per;
int both_zero;
+ h5difftrace("diff_ulong start\n");
/* -d and !-p */
if (options->d && !options->p)
@@ -5198,6 +5227,7 @@ hsize_t diff_ulong(unsigned char *mem1,
} /* nelmts */
}
+ h5difftrace("diff_ulong finish\n");
return nfound;
}
@@ -5234,6 +5264,7 @@ hsize_t diff_llong(unsigned char *mem1,
double per;
int both_zero;
+ h5difftrace("diff_llong start\n");
/* -d and !-p */
if (options->d && !options->p)
{
@@ -5371,6 +5402,7 @@ hsize_t diff_llong(unsigned char *mem1,
} /* nelmts */
}
+ h5difftrace("diff_llong finish\n");
return nfound;
}
@@ -5408,6 +5440,7 @@ hsize_t diff_ullong(unsigned char *mem1,
double per;
int both_zero;
+ h5difftrace("diff_ullong start\n");
/* -d and !-p */
if (options->d && !options->p)
{
@@ -5549,6 +5582,7 @@ hsize_t diff_ullong(unsigned char *mem1,
} /* nelmts */
}
+ h5difftrace("diff_ullong finish\n");
return nfound;
}
@@ -5575,6 +5609,7 @@ int ull2float(unsigned long long ull_value, float *f_value)
size_t src_size;
size_t dst_size;
+ h5difftrace("ull2float start\n");
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0)
return -1;
@@ -5592,6 +5627,7 @@ int ull2float(unsigned long long ull_value, float *f_value)
if(buf)
HDfree(buf);
+ h5difftrace("ull2float finish\n");
return 0;
@@ -5601,6 +5637,7 @@ error:
} H5E_END_TRY;
if(buf)
HDfree(buf);
+ h5difftrace("ull2float errored\n");
return -1;
}
@@ -5620,6 +5657,7 @@ error:
static
hbool_t equal_double(double value, double expected, diff_opt_t *options)
{
+ h5difftrace("equal_double start\n");
if ( options->do_nans )
{
@@ -5656,6 +5694,7 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options)
if ( ABS( (value-expected) ) < DBL_EPSILON)
return TRUE;
}
+ h5difftrace("equal_double finish\n");
return FALSE;
}
@@ -5673,6 +5712,7 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options)
static
hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *options)
{
+ h5difftrace("equal_ldouble start\n");
if ( options->do_nans )
{
@@ -5709,6 +5749,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
if ( ABS( (value-expected) ) < DBL_EPSILON)
return TRUE;
}
+ h5difftrace("equal_ldouble finish\n");
return FALSE;
}
@@ -5730,6 +5771,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
static
hbool_t equal_float(float value, float expected, diff_opt_t *options)
{
+ h5difftrace("equal_float start\n");
if ( options->do_nans )
{
@@ -5766,6 +5808,7 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options)
if ( ABS( (value-expected) ) < FLT_EPSILON)
return TRUE;
}
+ h5difftrace("equal_float finish\n");
return FALSE;
@@ -5795,6 +5838,7 @@ my_isnan(dtype_t type, void *val)
int retval = 0;
char s[256];
+ h5difftrace("my_isnan start\n");
if (FLT_FLOAT==type)
{
float x;
@@ -5893,6 +5937,7 @@ my_isnan(dtype_t type, void *val)
}
}
#endif /*H5_VMS*/
+ h5difftrace("my_isnan finish\n");
return retval;
}
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 85cd01f..144159a 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -405,6 +405,14 @@ hsize_t diff_attr(hid_t loc1_id,
continue;
}
+ /*-----------------------------------------------------------------
+ * "upgrade" the smaller memory size
+ *------------------------------------------------------------------
+ */
+ if (FAIL == match_up_memsize (ftype1_id, ftype2_id,
+ &mtype1_id, &mtype2_id,
+ &msize1, &msize2))
+ goto error;
/*---------------------------------------------------------------------
* read
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index c1ed429..f9c7d1c 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -218,6 +218,7 @@ hsize_t diff_datasetid( hid_t did1,
int i;
unsigned int vl_data = 0; /*contains VL datatypes */
+ h5difftrace("diff_datasetid start\n");
/* Get the dataspace handle */
if ( (sid1 = H5Dget_space(did1)) < 0 )
goto error;
@@ -263,6 +264,7 @@ hsize_t diff_datasetid( hid_t did1,
* check for empty datasets
*-------------------------------------------------------------------------
*/
+ h5difftrace("check for empty datasets\n");
storage_size1=H5Dget_storage_size(did1);
storage_size2=H5Dget_storage_size(did2);
@@ -300,6 +302,7 @@ hsize_t diff_datasetid( hid_t did1,
* memory type and sizes
*-------------------------------------------------------------------------
*/
+ h5difftrace("check for memory type and sizes\n");
if ((m_tid1=h5tools_get_native_type(f_tid1)) < 0)
goto error;
@@ -315,10 +318,12 @@ hsize_t diff_datasetid( hid_t did1,
*/
if (can_compare)
{
+ h5difftrace("can_compare for sign\n");
sign1=H5Tget_sign(m_tid1);
sign2=H5Tget_sign(m_tid2);
if ( sign1 != sign2 )
{
+ h5difftrace("sign1 != sign2\n");
if ((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
{
parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1));
@@ -341,6 +346,7 @@ hsize_t diff_datasetid( hid_t did1,
*/
if(can_compare) /* it is possible to compare */
{
+ h5difftrace("can_compare attempt\n");
/*-----------------------------------------------------------------
* get number of elements
@@ -360,26 +366,12 @@ hsize_t diff_datasetid( hid_t did1,
* "upgrade" the smaller memory size
*------------------------------------------------------------------
*/
+ h5difftrace("upgrade the smaller memory size?\n");
- if(m_size1 != m_size2) {
- if(m_size1 < m_size2) {
- H5Tclose(m_tid1);
-
- if((m_tid1 = h5tools_get_native_type(f_tid2)) < 0)
- goto error;
-
- m_size1 = H5Tget_size(m_tid1);
- } /* end if */
- else {
- H5Tclose(m_tid2);
-
- if((m_tid2 = h5tools_get_native_type(f_tid1)) < 0)
- goto error;
-
- m_size2 = H5Tget_size(m_tid2);
- } /* end else */
- } /* end if */
- HDassert(m_size1 == m_size2);
+ if (FAIL == match_up_memsize (f_tid1, f_tid2,
+ &m_tid1, &m_tid2,
+ &m_size1, &m_size2))
+ goto error;
/* print names */
if(obj1_name)
@@ -399,6 +391,7 @@ hsize_t diff_datasetid( hid_t did1,
} /* end if */
if(buf1 != NULL && buf2 != NULL) {
+ h5difftrace("buf1 != NULL && buf2 != NULL\n");
if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0)
goto error;
if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0)
@@ -519,6 +512,7 @@ hsize_t diff_datasetid( hid_t did1,
* the if condition refers to cases when the dataset is a referenced object
*-------------------------------------------------------------------------
*/
+ h5difftrace("compare attributes?\n");
if(obj1_name)
nfound += diff_attr(did1,did2,obj1_name,obj2_name,options);
@@ -526,6 +520,7 @@ hsize_t diff_datasetid( hid_t did1,
* close
*-------------------------------------------------------------------------
*/
+ h5difftrace("compare attributes?\n");
/* free */
if(buf1 != NULL) {
@@ -553,6 +548,7 @@ hsize_t diff_datasetid( hid_t did1,
H5Tclose(m_tid1);
H5Tclose(m_tid2);
} H5E_END_TRY;
+ h5difftrace("diff_datasetid finish\n");
return nfound;
@@ -603,6 +599,7 @@ error:
H5Tclose(m_tid2);
/* enable error reporting */
} H5E_END_TRY;
+ h5difftrace("diff_datasetid errored\n");
return nfound;
}
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index 0d476b6..aefd641 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -311,4 +311,46 @@ void print_found(hsize_t nfound)
}
+/*-----------------------------------------------------------------
+ * Function: match_up_memsize
+ *
+ * Purpose: match smaller memory size up to bigger memory size
+ *------------------------------------------------------------------
+ */
+herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
+ hid_t *m_tid1, hid_t *m_tid2,
+ size_t *m_size1, size_t *m_size2)
+{
+ herr_t ret = SUCCEED;
+
+ if( (*m_size1) != (*m_size2) )
+ {
+ if( (*m_size1) < (*m_size2) )
+ {
+ H5Tclose( *m_tid1 );
+
+ if(( (*m_tid1) = h5tools_get_native_type(f_tid2_id)) < 0)
+ {
+ ret = FAIL;
+ goto out;
+ }
+
+ *m_size1 = H5Tget_size( *m_tid1 );
+ } /* end if */
+ else {
+ H5Tclose(*m_tid2);
+ if(( (*m_tid2) = h5tools_get_native_type(f_tid1_id)) < 0)
+ {
+ ret = FAIL;
+ goto out;
+ }
+
+ *m_size2 = H5Tget_size(*m_tid2);
+ } /* end else */
+ } /* end if */
+ HDassert( (*m_size1) == (*m_size2) );
+
+out:
+ return ret;
+}
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 495aca1..7b6098d 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -1072,256 +1072,6 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
* Failure: FAIL
*-------------------------------------------------------------------------
*/
-
-#ifdef DEBUG_H5DUMP_BIN
-int
-render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem)
-{
- HERR_INIT(int, SUCCEED)
- unsigned char *mem = (unsigned char*)_mem;
- size_t size; /* datum size */
- float tempfloat;
- double tempdouble;
- unsigned long long tempullong;
- long long templlong;
- unsigned long tempulong;
- long templong;
- unsigned int tempuint;
- int tempint;
- unsigned short tempushort;
- short tempshort;
- unsigned char tempuchar;
- char tempschar;
-#if H5_SIZEOF_LONG_DOUBLE !=0
- long double templdouble;
-#endif
- static char fmt_llong[8], fmt_ullong[8];
- if (!fmt_llong[0]) {
- HDsprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH);
- HDsprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH);
- }
-
- if((size = H5Tget_size(tid)) == 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
-
- if (H5Tequal(tid, H5T_NATIVE_FLOAT)) {
- HDmemcpy(&tempfloat, mem, sizeof(float));
- HDfprintf(stream, "%g ", tempfloat);
- }
- else if (H5Tequal(tid, H5T_NATIVE_DOUBLE)) {
- HDmemcpy(&tempdouble, mem, sizeof(double));
- HDfprintf(stream, "%g ", tempdouble);
- }
-#if H5_SIZEOF_LONG_DOUBLE !=0
- else if (H5Tequal(tid, H5T_NATIVE_LDOUBLE)) {
- HDmemcpy(&templdouble, mem, sizeof(long double));
- HDfprintf(stream, "%Lf ", templdouble);
- }
-#endif
- else if (H5T_STRING == H5Tget_class(tid)) {
- unsigned int i;
- H5T_str_t pad;
- char *s;
-
- pad = H5Tget_strpad(tid);
-
- if (H5Tis_variable_str(tid)) {
- s = *(char**) mem;
- if (s != NULL)
- size = HDstrlen(s);
- }
- else {
- s = (char *) mem;
- if((size = H5Tget_size(tid)) == 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
- }
- for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) {
- HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char));
- HDfprintf(stream, "%d", tempuchar);
- } /* i */
- }
- else if (H5Tequal(tid, H5T_NATIVE_INT)) {
- HDmemcpy(&tempint, mem, sizeof(int));
- HDfprintf(stream, "%d ", tempint);
- }
- else if (H5Tequal(tid, H5T_NATIVE_UINT)) {
- HDmemcpy(&tempuint, mem, sizeof(unsigned int));
- HDfprintf(stream, "%u ", tempuint);
- }
- else if (H5Tequal(tid, H5T_NATIVE_SCHAR)) {
- HDmemcpy(&tempschar, mem, sizeof(char));
- HDfprintf(stream, "%d ", tempschar);
- }
- else if (H5Tequal(tid, H5T_NATIVE_UCHAR)) {
- HDmemcpy(&tempuchar, mem, sizeof(unsigned char));
- HDfprintf(stream, "%u ", tempuchar);
- }
- else if (H5Tequal(tid, H5T_NATIVE_SHORT)) {
- HDmemcpy(&tempshort, mem, sizeof(short));
- HDfprintf(stream, "%d ", tempshort);
- }
- else if (H5Tequal(tid, H5T_NATIVE_USHORT)) {
- HDmemcpy(&tempushort, mem, sizeof(unsigned short));
- HDfprintf(stream, "%u ", tempushort);
- }
- else if (H5Tequal(tid, H5T_NATIVE_LONG)) {
- HDmemcpy(&templong, mem, sizeof(long));
- HDfprintf(stream, "%ld ", templong);
- }
- else if (H5Tequal(tid, H5T_NATIVE_ULONG)) {
- HDmemcpy(&tempulong, mem, sizeof(unsigned long));
- HDfprintf(stream, "%lu ", tempulong);
- }
- else if (H5Tequal(tid, H5T_NATIVE_LLONG)) {
- HDmemcpy(&templlong, mem, sizeof(long long));
- HDfprintf(stream, fmt_llong, templlong);
- }
- else if (H5Tequal(tid, H5T_NATIVE_ULLONG)) {
- HDmemcpy(&tempullong, mem, sizeof(unsigned long long));
- HDfprintf(stream, fmt_ullong, tempullong);
- }
- else if (H5Tequal(tid, H5T_NATIVE_HSSIZE)) {
- if (sizeof(hssize_t) == sizeof(int)) {
- HDmemcpy(&tempint, mem, sizeof(int));
- HDfprintf(stream, "%d ", tempint);
- }
- else if (sizeof(hssize_t) == sizeof(long)) {
- HDmemcpy(&templong, mem, sizeof(long));
- HDfprintf(stream, "%ld ", templong);
- }
- else {
- HDmemcpy(&templlong, mem, sizeof(long long));
- HDfprintf(stream, fmt_llong, templlong);
- }
- }
- else if (H5Tequal(tid, H5T_NATIVE_HSIZE)) {
- if (sizeof(hsize_t) == sizeof(int)) {
- HDmemcpy(&tempuint, mem, sizeof(unsigned int));
- HDfprintf(stream, "%u ", tempuint);
- }
- else if (sizeof(hsize_t) == sizeof(long)) {
- HDmemcpy(&tempulong, mem, sizeof(unsigned long));
- HDfprintf(stream, "%lu ", tempulong);
- }
- else {
- HDmemcpy(&tempullong, mem, sizeof(unsigned long long));
- HDfprintf(stream, fmt_ullong, tempullong);
- }
- }
- else if (H5Tget_class(tid) == H5T_COMPOUND) {
- unsigned j;
- hid_t memb;
- unsigned nmembs;
- size_t offset;
-
- nmembs = H5Tget_nmembers(tid);
-
- for (j = 0; j < nmembs; j++) {
- offset = H5Tget_member_offset(tid, j);
- memb = H5Tget_member_type(tid, j);
-
- if (render_bin_output(stream, container, memb, mem + offset) < 0)
- return FAIL;
-
- H5Tclose(memb);
- }
- }
- else if (H5Tget_class(tid) == H5T_ENUM) {
- unsigned int i;
- if (1 == size) {
- HDfprintf(stream, "0x%02x", mem[0]);
- }
- else {
- for (i = 0; i < size; i++) {
- HDfprintf(stream, "%s%02x", i?":":"", mem[i]);
- } /*i*/
- }/*else 1 */
- }
- else if (H5Tget_class(tid) == H5T_ARRAY) {
- int k, ndims;
- hsize_t i, dims[H5S_MAX_RANK], temp_nelmts, nelmts;
- hid_t memb;
-
- /* get the array's base datatype for each element */
- memb = H5Tget_super(tid);
- size = H5Tget_size(memb);
- ndims = H5Tget_array_ndims(tid);
- H5Tget_array_dims2(tid, dims);
- HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK);
-
- /* calculate the number of array elements */
- for (k = 0, nelmts = 1; k < ndims; k++) {
- temp_nelmts = nelmts;
- temp_nelmts *= dims[k];
- nelmts = (size_t) temp_nelmts;
- }
-
- /* dump the array element */
- for (i = 0; i < nelmts; i++) {
- if (render_bin_output(stream, container, memb, mem + i * size) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
- }
-
- H5Tclose(memb);
- }
- else if (H5Tget_class(tid) == H5T_VLEN) {
- unsigned int i;
- hsize_t nelmts;
- hid_t memb;
-
- /* get the VL sequences's base datatype for each element */
- memb = H5Tget_super(tid);
- size = H5Tget_size(memb);
-
- /* Get the number of sequence elements */
- nelmts = ((hvl_t *) mem)->len;
-
- for (i = 0; i < nelmts; i++) {
- /* dump the array element */
- if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)) + i * size) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
- }
- H5Tclose(memb);
- }
- else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) {
- if (region_output) {
- /* region data */
- hid_t region_id, region_space;
- H5S_sel_type region_type;
-
- region_id = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, mem);
- if (region_id >= 0) {
- region_space = H5Rget_region(container, H5R_DATASET_REGION, mem);
- if (region_space >= 0) {
- region_type = H5Sget_select_type(region_space);
- if(region_type == H5S_SEL_POINTS)
- render_bin_output_region_points(region_space, region_id, stream, container);
- else
- render_bin_output_region_blocks(region_space, region_id, stream, container);
- H5Sclose(region_space);
- } /* end if (region_space >= 0) */
- H5Dclose(region_id);
- } /* end if (region_id >= 0) */
- } /* end if (region_output... */
- }
- else if (H5Tequal(tid, H5T_STD_REF_OBJ)) {
- }
- else {
- size_t i;
- if (1 == size) {
- HDfprintf(stream, "0x%02x", mem[0]);
- }
- else {
- for (i = 0; i < size; i++) {
- HDfprintf(stream, "%s%02x", i?":":"", mem[i]);
- } /*i*/
- }/*else 1 */
- }
-
-CATCH
- return ret_value;
-}
-#else
int
render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts)
{
@@ -1504,7 +1254,6 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
CATCH
return ret_value;
}
-#endif
/*-------------------------------------------------------------------------
* Audience: Public
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 11ab5f3..79322bc 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -852,6 +852,8 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_
/* set target obj type to return */
link_info->trg_type = trg_oinfo.type;
+ link_info->objno = trg_oinfo.addr;
+ link_info->fileno = trg_oinfo.fileno;
} /* end if */
else
link_info->trg_type = H5O_TYPE_UNKNOWN;
diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h
index f30974a..10c643d 100644
--- a/tools/lib/h5tools_utils.h
+++ b/tools/lib/h5tools_utils.h
@@ -161,6 +161,8 @@ typedef struct {
H5O_type_t trg_type; /* OUT: target type */
const char *trg_path; /* OUT: target obj path. This must be freed
* when used with H5tools_get_symlink_info() */
+ haddr_t objno; /* OUT: target object address */
+ unsigned long fileno; /* OUT: File number that target object is located in */
H5L_info_t linfo; /* OUT: link info */
h5tool_opt_t opt; /* IN: options */
} h5tool_link_info_t;
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 0215c46..8455360 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -354,6 +354,31 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type)
info->paths[idx].objno = HADDR_UNDEF;
} /* end trav_info_add() */
+
+/*-------------------------------------------------------------------------
+ * Function: trav_fileinfo_add
+ *
+ * Purpose: Add a file addr & fileno to info struct
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+trav_fileinfo_add(trav_info_t *info, hid_t loc_id)
+{
+ H5O_info_t oinfo;
+ size_t idx = info->nused - 1;
+
+ if ( info->paths[idx].path && HDstrcmp(info->paths[idx].path, "."))
+ H5Oget_info_by_name(loc_id, info->paths[idx].path, &oinfo, H5P_DEFAULT);
+ else
+ H5Oget_info(loc_id, &oinfo);
+
+ info->paths[idx].objno = oinfo.addr;
+ info->paths[idx].fileno = oinfo.fileno;
+} /* end trav_fileinfo_add() */
+
/*-------------------------------------------------------------------------
* Function: trav_info_visit_obj
diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h
index c416cf8..3548c6b 100644
--- a/tools/lib/h5trav.h
+++ b/tools/lib/h5trav.h
@@ -177,6 +177,8 @@ H5TOOLS_DLL void trav_info_free(trav_info_t *info);
H5TOOLS_DLL void trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type);
+H5TOOLS_DLL void trav_fileinfo_add(trav_info_t *info, hid_t loc_id);
+
/*-------------------------------------------------------------------------
* table private functions
*-------------------------------------------------------------------------
diff --git a/tools/misc/talign.c b/tools/misc/talign.c
index 88ebaa6..b77d846 100644
--- a/tools/misc/talign.c
+++ b/tools/misc/talign.c
@@ -148,28 +148,31 @@ out:
result = 1;
mname = H5Tget_member_name(fix, 0);
printf("%14s (%2d) %6s = %s\n",
- mname, (int)H5Tget_member_offset(fix,0),
+ mname ? mname : "(null)", (int)H5Tget_member_offset(fix,0),
string5, (char *)(data + H5Tget_member_offset(fix, 0)));
- free(mname);
+ if(mname)
+ free(mname);
fptr = (float *)(data + H5Tget_member_offset(fix, 1));
mname = H5Tget_member_name(fix, 1);
printf("Data comparison:\n"
"%14s (%2d) %6f = %f\n"
" %6f = %f\n",
- mname, (int)H5Tget_member_offset(fix,1),
+ mname ? mname : "(null)", (int)H5Tget_member_offset(fix,1),
fok[0], fptr[0],
fok[1], fptr[1]);
- free(mname);
+ if(mname)
+ free(mname);
fptr = (float *)(data + H5Tget_member_offset(fix, 2));
mname = H5Tget_member_name(fix, 2);
printf("%14s (%2d) %6f = %f\n"
" %6f = %6f\n",
- mname, (int)H5Tget_member_offset(fix,2),
+ mname ? mname : "(null)", (int)H5Tget_member_offset(fix,2),
fnok[0], fptr[0],
fnok[1], fptr[1]);
- free(mname);
+ if(mname)
+ free(mname);
fptr = (float *)(data + H5Tget_member_offset(fix, 1));
printf("\n"
diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h
index b9463c0..06b62be 100644
--- a/vms/src/h5pubconf.h
+++ b/vms/src/h5pubconf.h
@@ -505,7 +505,7 @@
#define H5_PACKAGE_NAME "HDF5"
/* Define to the full name and version of this package. */
-#define H5_PACKAGE_STRING "HDF5 1.9.124"
+#define H5_PACKAGE_STRING "HDF5 1.9.127"
/* Define to the one symbol short name of this package. */
#define H5_PACKAGE_TARNAME "hdf5"
@@ -514,7 +514,7 @@
#define H5_PACKAGE_URL ""
/* Define to the version of this package. */
-#define H5_PACKAGE_VERSION "1.9.124"
+#define H5_PACKAGE_VERSION "1.9.127"
/* Width for printf() for type `long long' or `__int64', use `ll' */
#define H5_PRINTF_LL_WIDTH "ll"
@@ -677,7 +677,7 @@
/* #undef H5_USING_MEMCHECKER */
/* Version number of package */
-#define H5_VERSION "1.9.124"
+#define H5_VERSION "1.9.127"
/* Define if vsnprintf() returns the correct value for formatted strings that
don't fit into size allowed */
diff --git a/windows/src/H5pubconf.h b/windows/src/H5pubconf.h
index d3a041e..23a8b6c 100644
--- a/windows/src/H5pubconf.h
+++ b/windows/src/H5pubconf.h
@@ -530,7 +530,7 @@
#define H5_PACKAGE_NAME "HDF5"
/* Define to the full name and version of this package. */
-#define H5_PACKAGE_STRING "HDF5 1.9.124"
+#define H5_PACKAGE_STRING "HDF5 1.9.127"
/* Define to the one symbol short name of this package. */
#define H5_PACKAGE_TARNAME "hdf5"
@@ -539,7 +539,7 @@
#define H5_PACKAGE_URL ""
/* Define to the version of this package. */
-#define H5_PACKAGE_VERSION "1.9.124"
+#define H5_PACKAGE_VERSION "1.9.127"
/* Width for printf() for type `long long' or `__int64', use `ll' */
#define H5_PRINTF_LL_WIDTH "I64"
@@ -710,7 +710,7 @@
/* #undef H5_USING_MEMCHECKER */
/* Version number of package */
-#define H5_VERSION "1.9.124"
+#define H5_VERSION "1.9.127"
/* Define if vsnprintf() returns the correct value for formatted strings that
don't fit into size allowed */