diff options
227 files changed, 11010 insertions, 4416 deletions
diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index f87119e..bb5f046 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -295,7 +295,11 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/RELEASE.txt") endif (EXISTS "${HDF5_SOURCE_DIR}/release_docs") set (CPACK_PACKAGE_RELOCATABLE TRUE) - set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}") + if (OVERRIDE_INSTALL_VERSION) + set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_NAME}/${OVERRIDE_INSTALL_VERSION}") + else (OVERRIDE_INSTALL_VERSION) + set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}") + endif (OVERRIDE_INSTALL_VERSION) set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.bmp") set (CPACK_GENERATOR "TGZ") @@ -324,7 +328,11 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) # set the package header icon for MUI set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}\\\\hdf.bmp") set (CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_PACKAGE_NAME}") - set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\${CPACK_PACKAGE_NAME}\\\\${CPACK_PACKAGE_VERSION}") + if (OVERRIDE_INSTALL_VERSION) + set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\${CPACK_PACKAGE_NAME}\\\\${OVERRIDE_INSTALL_VERSION}") + else (OVERRIDE_INSTALL_VERSION) + set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\${CPACK_PACKAGE_NAME}\\\\${CPACK_PACKAGE_VERSION}") + endif (OVERRIDE_INSTALL_VERSION) set (CPACK_NSIS_CONTACT "${HDF5_PACKAGE_BUGREPORT}") set (CPACK_NSIS_MODIFY_PATH ON) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef91cfb..65124ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,7 +193,7 @@ endif (NOT HDF5_INSTALL_LIB_DIR) if (NOT HDF5_INSTALL_INCLUDE_DIR) set (HDF5_INSTALL_INCLUDE_DIR include) endif (NOT HDF5_INSTALL_INCLUDE_DIR) -option (HDF5_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" TRUE) +option (HDF5_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) if (NOT HDF5_INSTALL_DATA_DIR) if (NOT WIN32) if (APPLE) @@ -434,10 +434,6 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) set (H5_HAVE_INSTRUMENTED_LIBRARY 1) endif (HDF5_ENABLE_INSTRUMENT) mark_as_advanced (HDF5_ENABLE_INSTRUMENT) - #-- NMake Makefiles will overwhelm the console with warnings if -Wall is used. - if (NOT WIN32) - add_definitions (-Wall) - endif (NOT WIN32) else (CMAKE_BUILD_TYPE MATCHES Debug) add_definitions (-DNDEBUG) if (HDF5_ENABLE_TRACE) @@ -539,48 +535,54 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) endif (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- # Option to use threadsafe -# Note: Currently CMake only allows configuring of threadsafe on -# non-Cygwin WINDOWS. #----------------------------------------------------------------------------- -if (WIN32) - option (HDF5_ENABLE_THREADSAFE "Enable thread-safety" OFF) - if (HDF5_ENABLE_THREADSAFE) - # check for unsupported options - message (STATUS " **** thread-safety option not supported with static library **** ") - message (STATUS " **** thread-safety option will not be used building static library **** ") - if (HDF5_ENABLE_PARALLEL) - if (NOT ALLOW_UNSUPPORTED) - message (FATAL_ERROR " **** parallel and thread-safety options are not supported **** ") - else (NOT ALLOW_UNSUPPORTED) - message (STATUS " **** Allowing unsupported parallel and thread-safety options **** ") - endif (NOT ALLOW_UNSUPPORTED) - endif (HDF5_ENABLE_PARALLEL) - if (HDF5_BUILD_FORTRAN) - if (NOT ALLOW_UNSUPPORTED) - message (STATUS " **** Fortran and thread-safety options are not supported **** ") - message (STATUS " **** thread-safety option will not be used building Fortran library **** ") - else (NOT ALLOW_UNSUPPORTED) - message (STATUS " **** Allowing unsupported Fortran and thread-safety options **** ") - endif (NOT ALLOW_UNSUPPORTED) - endif (HDF5_BUILD_FORTRAN) - if (HDF5_BUILD_CPP_LIB) - if (NOT ALLOW_UNSUPPORTED) - message (STATUS " **** C++ and thread-safety options are not supported **** ") - message (STATUS " **** thread-safety option will not be used building C++ library **** ") - else (NOT ALLOW_UNSUPPORTED) - message (STATUS " **** Allowing unsupported C++ and thread-safety options **** ") - endif (NOT ALLOW_UNSUPPORTED) - endif (HDF5_BUILD_CPP_LIB) - if (H5_HAVE_IOEO) - message (STATUS " **** Win32 threads requires WINVER>=0x600 (Windows Vista/7/8) **** ") - set (H5_HAVE_WIN_THREADS 1) - else (H5_HAVE_IOEO) - if (NOT H5_HAVE_PTHREAD_H) - message (FATAL_ERROR " **** thread-safe option requires Win32 threads or Pthreads **** ") - endif (NOT H5_HAVE_PTHREAD_H) - endif (H5_HAVE_IOEO) - endif (HDF5_ENABLE_THREADSAFE) -endif (WIN32) +option (HDF5_ENABLE_THREADSAFE "Enable thread-safety" OFF) +if (HDF5_ENABLE_THREADSAFE) + # check for unsupported options + message (STATUS " **** thread-safety option not supported with static library **** ") + message (STATUS " **** thread-safety option will not be used building static library **** ") + if (HDF5_ENABLE_PARALLEL) + if (NOT ALLOW_UNSUPPORTED) + message (FATAL_ERROR " **** parallel and thread-safety options are not supported **** ") + else (NOT ALLOW_UNSUPPORTED) + message (STATUS " **** Allowing unsupported parallel and thread-safety options **** ") + endif (NOT ALLOW_UNSUPPORTED) + endif (HDF5_ENABLE_PARALLEL) + if (HDF5_BUILD_FORTRAN) + if (NOT ALLOW_UNSUPPORTED) + message (FATAL_ERROR " **** Fortran and thread-safety options are not supported **** ") + else (NOT ALLOW_UNSUPPORTED) + message (STATUS " **** Allowing unsupported Fortran and thread-safety options **** ") + endif (NOT ALLOW_UNSUPPORTED) + endif (HDF5_BUILD_FORTRAN) + if (HDF5_BUILD_CPP_LIB) + if (NOT ALLOW_UNSUPPORTED) + message (FATAL_ERROR " **** C++ and thread-safety options are not supported **** ") + else (NOT ALLOW_UNSUPPORTED) + message (STATUS " **** Allowing unsupported C++ and thread-safety options **** ") + endif (NOT ALLOW_UNSUPPORTED) + endif (HDF5_BUILD_CPP_LIB) + if (HDF5_BUILD_HL_LIB) + if (NOT ALLOW_UNSUPPORTED) + message (FATAL_ERROR " **** HL and thread-safety options are not supported **** ") + else (NOT ALLOW_UNSUPPORTED) + message (STATUS " **** Allowing unsupported HL and thread-safety options **** ") + endif (NOT ALLOW_UNSUPPORTED) + endif (HDF5_BUILD_HL_LIB) + if (H5_HAVE_IOEO) + message (STATUS " **** Win32 threads requires WINVER>=0x600 (Windows Vista/7/8) **** ") + set (H5_HAVE_WIN_THREADS 1) + else (H5_HAVE_IOEO) + if (NOT H5_HAVE_PTHREAD_H) + message (FATAL_ERROR " **** thread-safe option requires Win32 threads or Pthreads **** ") + endif (NOT H5_HAVE_PTHREAD_H) + endif (H5_HAVE_IOEO) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads) + if (NOT Threads_FOUND) + message (STATUS " **** thread-safe package not found - threads still might work **** ") + endif (NOT Threads_FOUND) +endif (HDF5_ENABLE_THREADSAFE) # ----------------------------------------------------------------------- # wrapper script variables @@ -32,7 +32,7 @@ ./README.txt ./BRANCH.txt ./acsite.m4 -./autogen.sh +./autogen.sh ./configure.ac ./bin/COPYING @@ -49,6 +49,7 @@ ./bin/deploy ./bin/distdep ./bin/errors _DO_NOT_DISTRIBUTE_ +./bin/genparser ./bin/gcov_script _DO_NOT_DISTRIBUTE_ ./bin/h5vers ./bin/iostats @@ -583,12 +584,12 @@ ./src/H5FScache.c ./src/H5FSdbg.c ./src/H5FSmodule.h -./src/H5FStest.c -./src/H5FSstat.c ./src/H5FSpkg.h ./src/H5FSprivate.h ./src/H5FSpublic.h ./src/H5FSsection.c +./src/H5FSstat.c +./src/H5FStest.c ./src/H5G.c ./src/H5Gbtree2.c ./src/H5Gcache.c @@ -2252,7 +2253,6 @@ ./tools/perform/sio_standalone.h ./tools/perform/zip_perf.c - # high level libraries ./hl/COPYING ./hl/Makefile.am @@ -2293,7 +2293,10 @@ ./hl/src/H5IMprivate.h ./hl/src/H5IMpublic.h ./hl/src/H5LT.c +./hl/src/H5LTanalyze.c ./hl/src/H5LTanalyze.l +./hl/src/H5LTparse.c +./hl/src/H5LTparse.h ./hl/src/H5LTparse.y ./hl/src/H5LTprivate.h ./hl/src/H5LTpublic.h @@ -2520,5 +2523,73 @@ ./tools/perform/CMakeTests.cmake # CMake-specific User Scripts -./config/cmake/scripts/CTestScript.cmake _DO_NOT_DISTRIBUTE_ -./config/cmake/scripts/HDF518config.cmake _DO_NOT_DISTRIBUTE_ +./config/cmake/scripts/CTestScript.cmake +./config/cmake/scripts/HDF5config.cmake + +# Files generated by autogen +./aclocal.m4 +./autom4te.cache/output.0 +./autom4te.cache/requests +./autom4te.cache/traces.0 +./bin/compile +./bin/config.guess +./bin/config.sub +./bin/depcomp +./bin/install-sh +./bin/ltmain.sh +./bin/missing +./bin/test-driver +./c++/examples/Makefile.in +./c++/Makefile.in +./configure +./c++/src/Makefile.in +./c++/test/Makefile.in +./examples/Makefile.in +./fortran/examples/Makefile.in +./fortran/Makefile.in +./fortran/src/Makefile.in +./fortran/test/Makefile.in +./fortran/testpar/Makefile.in +./hl/c++/examples/Makefile.in +./hl/c++/Makefile.in +./hl/c++/src/Makefile.in +./hl/c++/test/Makefile.in +./hl/examples/Makefile.in +./hl/fortran/examples/Makefile.in +./hl/fortran/Makefile.in +./hl/fortran/src/Makefile.in +./hl/fortran/test/Makefile.in +./hl/Makefile.in +./hl/src/Makefile.in +./hl/test/Makefile.in +./hl/tools/gif2h5/Makefile.in +./hl/tools/Makefile.in +./m4/libtool.m4 +./m4/lt~obsolete.m4 +./m4/ltoptions.m4 +./m4/ltsugar.m4 +./m4/ltversion.m4 +./Makefile.in +./src/H5config.h.in +./src/H5Edefin.h +./src/H5Einit.h +./src/H5Epubgen.h +./src/H5Eterm.h +./src/H5overflow.h +./src/H5version.h +./src/Makefile.in +./test/Makefile.in +./testpar/Makefile.in +./tools/h5copy/Makefile.in +./tools/h5diff/Makefile.in +./tools/h5dump/Makefile.in +./tools/h5import/Makefile.in +./tools/h5jam/Makefile.in +./tools/h5ls/Makefile.in +./tools/h5repack/Makefile.in +./tools/h5stat/Makefile.in +./tools/lib/Makefile.in +./tools/Makefile.in +./tools/misc/Makefile.in +./tools/misc/vds/Makefile.in +./tools/perform/Makefile.in @@ -19,22 +19,18 @@ # IMPORTANT OS X NOTE # # If you are using OS X, you will probably not have the autotools -# installed, even if you have the Xcode command-line tools. The -# bison version you have installed may also have a bug that makes -# it unable to process our input files. +# installed, even if you have the Xcode command-line tools. # # The easiest way to fix this is to install everything via Homebrew: # # http://brew.sh/ # # After you install the base packages, install autoconf, automake, -# libtool, and flex/bison. +# and libtool. # # brew install autoconf # brew install automake # brew install libtool -# brew install flex -# brew install bison # # This only takes a few minutes. Note that libtool and libtoolize will # be glibtool and glibtoolize so as not to conflict with Apple's non-gnu @@ -52,8 +48,6 @@ # HDF5_AUTOCONF # HDF5_LIBTOOL # HDF5_M4 -# HDF5_FLEX -# HDF5_BISON # # Note that aclocal will attempt to include libtool's share/aclocal # directory. @@ -149,12 +143,6 @@ if [ "$production" = true ] ; then if test -z ${HDF5_M4}; then HDF5_M4=/usr/hdf/bin/AUTOTOOLS/m4 fi - if test -z ${HDF5_BISON}; then - HDF5_BISON=/usr/hdf/bin/AUTOTOOLS/bison - fi - if test -z ${HDF5_FLEX}; then - HDF5_FLEX=/usr/hdf/bin/AUTOTOOLS/flex - fi else @@ -189,12 +177,6 @@ else if test -z ${HDF5_M4}; then HDF5_M4=$(which m4) fi - if test -z ${HDF5_BISON}; then - HDF5_BISON=$(which bison) - fi - if test -z ${HDF5_FLEX}; then - HDF5_FLEX=$(which flex) - fi fi # production @@ -203,9 +185,7 @@ fi # production AUTOCONF_DIR=`dirname ${HDF5_AUTOCONF}` LIBTOOL_DIR=`dirname ${HDF5_LIBTOOL}` M4_DIR=`dirname ${HDF5_M4}` -BISON_DIR=`dirname ${HDF5_BISON}` -FLEX_DIR=`dirname ${HDF5_FLEX}` -PATH=${AUTOCONF_DIR}:${LIBTOOL_DIR}:${M4_DIR}:${FLEX_DIR}:${BISON_DIR}:$PATH +PATH=${AUTOCONF_DIR}:${LIBTOOL_DIR}:${M4_DIR}:$PATH # Make libtoolize match the specified libtool case "`uname`" in @@ -315,94 +295,6 @@ echo echo "Running overflow macro generation script:" bin/make_overflow src/H5overflow.txt || exit 1 -# Run flex and bison -# automatically generates hl/src/H5LTanalyze.c and hl/src/H5LTparse.c -# Note that, as of Xcode 6.1 (2015), the default bison version on OS X -# is old enough to have the circular dependency bug. You'll have -# to install a later version of bison. See the OS X note at the top -# of this script. -echo -echo "Generating H5LT parser code (requires yacc/bison):" -echo "Generate hl/src/H5LTparse.c from hl/src/H5LTparse.y" -# HDF5_BISON is set via the environment or 'which bison', above -if test -z ${HDF5_BISON}; then - echo - echo "*************************" - echo " ERROR - bison not found" - echo "*************************" - echo "bison is required to generate parser code in H5LT" - echo - exit 127 -fi -cd hl/src -if [ "$verbose" = true ] ; then - ${HDF5_BISON} --version -fi -${HDF5_BISON} -pH5LTyy -o H5LTparse.c -d H5LTparse.y - -echo -echo "Generating H5LT lexer code (requires lex/flex):" -echo "Generate hl/src/H5LTanalyze.c from hl/src/H5LTanalyze.l" -# HDF5_FLEX is set via the environment or 'which flex', above -if test -z ${HDF5_FLEX}; then - echo - echo "************************" - echo " ERROR - flex not found" - echo "************************" - echo "flex is required to generate lexer code in H5LT" - echo - exit 127 -fi -if [ "$verbose" = true ] ; then - ${HDF5_FLEX} --version -fi -${HDF5_FLEX} --nounistd -PH5LTyy -o H5LTanalyze.c H5LTanalyze.l - -# fix H5LTparse.c to declare H5LTyyparse return type as an hid_t -# instead of int. Currently the generated function H5LTyyparse is -# generated with a return value of type int, which is a mapping to the -# flex yyparse function. The return value in the HL library should be -# an hid_t. -# I propose to not use flex to generate this function, but for now I am -# adding a perl command to find and replace this function declaration in -# H5LTparse.c. -perl -0777 -pi -e 's/int yyparse/hid_t yyparse/igs' H5LTparse.c -perl -0777 -pi -e 's/int\nyyparse/hid_t\nyyparse/igs' H5LTparse.c -perl -0777 -pi -e 's/int H5LTyyparse/hid_t H5LTyyparse/igs' H5LTparse.c - -# Add code that disables warnings in the flex/bison-generated code. -# -# Note that the GCC pragmas did not exist until gcc 4.2. Earlier versions -# will simply ignore them, but we want to avoid those warnings. -for f in H5LTparse.c H5LTanalyze.c -do - echo '#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2 ' >> tmp.out - echo '#pragma GCC diagnostic ignored "-Wconversion" ' >> tmp.out - echo '#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" ' >> tmp.out - echo '#pragma GCC diagnostic ignored "-Wlarger-than=" ' >> tmp.out - echo '#pragma GCC diagnostic ignored "-Wmissing-prototypes" ' >> tmp.out - echo '#pragma GCC diagnostic ignored "-Wnested-externs" ' >> tmp.out - echo '#pragma GCC diagnostic ignored "-Wold-style-definition" ' >> tmp.out - echo '#pragma GCC diagnostic ignored "-Wsign-compare" ' >> tmp.out - echo '#pragma GCC diagnostic ignored "-Wsign-conversion" ' >> tmp.out - echo '#pragma GCC diagnostic ignored "-Wstrict-prototypes" ' >> tmp.out - echo '#pragma GCC diagnostic ignored "-Wswitch-default" ' >> tmp.out - echo '#pragma GCC diagnostic ignored "-Wunused-function" ' >> tmp.out - echo '#pragma GCC diagnostic ignored "-Wunused-macros" ' >> tmp.out - echo '#pragma GCC diagnostic ignored "-Wunused-parameter" ' >> tmp.out - echo '#pragma GCC diagnostic ignored "-Wredundant-decls" ' >> tmp.out - echo '#elif defined __SUNPRO_CC ' >> tmp.out - echo '#pragma disable_warn ' >> tmp.out - echo '#elif defined _MSC_VER ' >> tmp.out - echo '#pragma warning(push, 1) ' >> tmp.out - echo '#endif ' >> tmp.out - - cat $f >> tmp.out - mv tmp.out $f -done - -cd ../.. - echo exit 0 diff --git a/bin/bbrelease b/bin/bbrelease index 119dc7a..cb79528 100755 --- a/bin/bbrelease +++ b/bin/bbrelease @@ -304,7 +304,6 @@ fi # Create a manifest that contains only files for distribution. MANIFEST=$tmpdir/H5_MANIFEST grep '^\.' MANIFEST | grep -v _DO_NOT_DISTRIBUTE_ >$MANIFEST -echo "./autogen.sh" >>$MANIFEST # Prepare the source tree for a release. #ln -s `pwd` $tmpdir/$HDF5_VERS || exit 1 diff --git a/bin/chkmanifest b/bin/chkmanifest index 646f815..701b6c4 100755 --- a/bin/chkmanifest +++ b/bin/chkmanifest @@ -17,9 +17,12 @@ # Check that all the files in MANIFEST exist and that (if this is a # SVN checkout) that all the SVN-managed files appear in the # MANIFEST. +# verbose=yes MANIFEST=/tmp/HD_MANIFEST.$$ +AUTOGEN=./autogen.sh +AUTOGEN_LOG=/tmp/autogen.log.$$ # Main test "$verbose" && echo " Checking MANIFEST..." 1>&2 @@ -49,6 +52,19 @@ else fi fi +# Do an autogen if generated files (e.g., configure) is not present +if [ ! -f configure ]; then + echo " running $AUTOGEN -p" + $AUTOGEN -p > $AUTOGEN_LOG 2>&1 + if [ $? -ne 0 ]; then + echo $AUTOGEN encountered error. Abort. + echo output from $AUTOGEN: + cat $AUTOGEN_LOG + exit 1 + fi + rm $AUTOGEN_LOG +fi + # Check for duplicate entries. This can be done at any time, but it may as # well be sooner so that if something else fails the presence of duplicates # will already be known. diff --git a/bin/cmakehdf5 b/bin/cmakehdf5 index afd4604..772e54c 100755 --- a/bin/cmakehdf5 +++ b/bin/cmakehdf5 @@ -23,6 +23,7 @@ makelog="#${progname}_2build.log" testlog="#${progname}_3test.log" packlog="#${progname}_4pack.log" installlog="#${progname}_5install.log" +vflag=1 # verbose flag default to on. config_summary=libhdf5.settings exit_code=0 @@ -53,7 +54,10 @@ with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT=ON # enable zlib filter default on with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT=OFF # enables szip filter default off szlib_path="" # szip lib path default off shared_lib=-DBUILD_SHARED_LIBS:BOOL=ON # enables shared lib; default on - +njobs="" # number of jobs (commands) to + # run simultaneously; default is + # value from $MAKE if defined, + # otherwise none (1) #============= # Function definitions @@ -90,6 +94,11 @@ Usage: $progname [<options>] Use zlib library for external deflate I/O filter. Default is on. --with-szlib | --with-szlib=<libpath> | --without-szlib: Use szlib library for external deflate I/O filter. Default is on. + --njobs=<-j N>: + number of jobs (commands) to run simultaneously; default is value from + $MAKE if defined, otherwise none + --enable-verbose | --disable-verbose: + enable or disable verbose output. Default is on. --help: shows details help page <libpath>: the file path to the library, expect <libpath>/lib and <libpath>/include. @@ -117,12 +126,12 @@ STEP() echo "$banner" with output saved in $logfile (TIMESTAMP; nerror=0 ; - echo "eval $command" - eval $command || nerror=1 ; - TIMESTAMP; exit $nerror) < /dev/null > "$logfile" 2>&1 + echo "eval $command" + eval $command || nerror=1 ; + TIMESTAMP; exit $nerror) < /dev/null > "$logfile" 2>&1 if [ $? -ne 0 ]; then - echo "error in '$banner'. $progname aborted." - exit 1 + echo "error in '$banner'. $progname aborted." + exit 1 fi } @@ -136,28 +145,44 @@ INSTALL_HDF5() { myos="`uname -s`" case "$myos" in - Linux) - install_file=./HDF5-${version}-Linux.sh - $install_file --skip-license $* - ;; - Darwin) # Mac OSX DMG file - install_file=HDF5-${version}-Darwin.dmg - test -d hdf5 || mkdir hdf5 - basename=`basename $install_file .dmg` - # mount the DMG file as /Volumes/$basename - # echo 'Y' as yes for license. - echo Y | hdiutil mount $install_file - # copy the contents to the install location - cp -R "/Volumes/$basename/HDF_Group" hdf5 - # unmount the DMG file - hdiutil unmount /Volumes/$basename - ;; - *) # unknown/unsupported OS. - echo "INSTALL_HDF5: Error--unknown/unsupported OS($myos)" - return 1 - ;; + Linux) + install_file=./HDF5-${version}-Linux.sh + $install_file --skip-license $* + ;; + Darwin) # Mac OSX DMG file + install_file=HDF5-${version}-Darwin.dmg + test -d hdf5 || mkdir hdf5 + basename=`basename $install_file .dmg` + # mount the DMG file as /Volumes/$basename + # echo 'Y' as yes for license. + echo Y | hdiutil mount $install_file + # copy the contents to the install location + cp -R "/Volumes/$basename/HDF_Group" hdf5 + # unmount the DMG file + hdiutil unmount /Volumes/$basename + ;; + *) # unknown/unsupported OS. + echo "INSTALL_HDF5: Error--unknown/unsupported OS($myos)" + return 1 + ;; esac - return 0 +} + + +# Print logfiles. +# $*: logfiles +DUMP_LOGFILE() +{ + for x in $*; do + if [ -f $x ]; then + echo "==================================" + echo "Dumping $x" + echo "==================================" + cat $x + echo "==== END $x =====" + echo + fi + done } @@ -168,6 +193,12 @@ INSTALL_HDF5() # Show a start time stamp TIMESTAMP +# Initialize njobs if $AMKE is defined +if [ -n "$MAKE" ]; then + # assume all arguments are for --jobs + njobs=`echo $MAKE | cut -s -d' ' -f2-` +fi + # Parse Cmake configure options # --enable-XXX or --disable-XXX will enable or disable feature XXX. # XXX can be: @@ -178,78 +209,88 @@ TIMESTAMP # tools Build tools while [ $# -gt 0 ]; do case "$1" in - --enable-fortran) - build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=ON - ;; - --disable-fortran) - build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=OFF - ;; - --enable-cxx) - build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=ON - ;; - --disable-cxx) - build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=OFF - ;; - --enable-hl) - build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=ON - ;; - --disable-hl) - build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=OFF - ;; - --enable-shared) - shared_lib=-DBUILD_SHARED_LIBS:BOOL=ON - ;; - --disable-shared) - shared_lib=-DBUILD_SHARED_LIBS:BOOL=OFF - ;; - --enable-tools) - build_tools=-DHDF5_BUILD_TOOLS:BOOL=ON - ;; - --disable-tools) - build_tools=-DHDF5_BUILD_TOOLS:BOOL=OFF - ;; - --enable-testing) - build_testing=-DBUILD_TESTING:BOOL=ON - ;; - --disable-testing) - build_testing=-DBUILD_TESTING:BOOL=OFF - ;; - --with-zlib) - with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON - ;; - --with-zlib=*) - xarg=`echo $1 | cut -d= -f2-` - with_zlib="-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DZLIB_ROOT=$xarg" - ;; - --without-zlib) - with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF - ;; - --with-szlib) - with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON - szlib_path="" # szlib is in default paths - ;; - --with-szlib=*) - xarg=`echo $1 | cut -d= -f2-` - with_szlib="-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON" - szlib_path="SZIP_INSTALL=$xarg" - ;; - --without-szlib) - with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF - szlib_path="" # reset the path - ;; - --help) - # print the detail help page and exit - HELP - exit 0 - ;; - *) - echo "Unknown options: $1" - HELP - exit 1 - ;; + --enable-fortran) + build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=ON + ;; + --disable-fortran) + build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=OFF + ;; + --enable-cxx) + build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=ON + ;; + --disable-cxx) + build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=OFF + ;; + --enable-hl) + build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=ON + ;; + --disable-hl) + build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=OFF + ;; + --enable-shared) + shared_lib=-DBUILD_SHARED_LIBS:BOOL=ON + ;; + --disable-shared) + shared_lib=-DBUILD_SHARED_LIBS:BOOL=OFF + ;; + --enable-tools) + build_tools=-DHDF5_BUILD_TOOLS:BOOL=ON + ;; + --disable-tools) + build_tools=-DHDF5_BUILD_TOOLS:BOOL=OFF + ;; + --enable-testing) + build_testing=-DBUILD_TESTING:BOOL=ON + ;; + --disable-testing) + build_testing=-DBUILD_TESTING:BOOL=OFF + ;; + --with-zlib) + with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON + ;; + --with-zlib=*) + xarg=`echo $1 | cut -d= -f2-` + with_zlib="-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DZLIB_ROOT=$xarg" + ;; + --without-zlib) + with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF + ;; + --with-szlib) + with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON + szlib_path="" # szlib is in default paths + ;; + --with-szlib=*) + xarg=`echo $1 | cut -d= -f2-` + with_szlib="-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON" + szlib_path="SZIP_INSTALL=$xarg" + ;; + --without-szlib) + with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF + szlib_path="" # reset the path + ;; + --njobs=*) + njobs=`echo $1 | cut -d= -f2-` + ;; + --enable-verbose) + vflag=1 + ;; + --disable-verbose) + vflag=0 + ;; + --help) + # print the detail help page and exit + HELP + exit 0 + ;; + *) + echo "Unknown options: $1" + HELP + exit 1 + ;; esac shift done +$DPRINT after option parsing vflag=$vflag # Always display the brief help page HELP_BRIEF @@ -271,7 +312,13 @@ if [ $? != 0 ]; then echo $vers failed. Aborted. exit 1 fi -echo Running Cmake for HDF5-${version} ... + +# setup output of all the log files if verbose is on upon exit +trap \ +"if [ $vflag -ne 0 ]; then DUMP_LOGFILE \$configlog \$makelog \$testlog \$packlog \$installlog; fi" \ +0 + +echo Running Cmake for HDF5-${version} ... # 4. Configure the C library, tools and tests with this command: # If successful, append the configure summary to the configure logfile. STEP "Configure..." \ @@ -288,18 +335,17 @@ STEP "Configure..." \ $with_szlib \ $srcdir" $configlog &&\ cat $config_summary >> $configlog - + # 5. Build the C library, tools and tests with this command: -STEP "Build the library, tools and tests, ..." "cmake --build . --config Release" $makelog - +STEP "Build the library, tools and tests, ..." "cmake --build . --config Release -- $njobs" $makelog + # 6. Test the C library and tools with this command: -STEP "Test the library and tools..." "ctest . -C Release" $testlog - +STEP "Test the library and tools..." "ctest . -C Release $njobs" $testlog + # 7. Create an install image with this command: STEP "Create an install image..." "cpack -C Release CPackConfig.cmake" $packlog - + # 8. Install with this command: -#STEP "Install..." "./HDF5-${version}-Linux.sh --skip-license" $installlog STEP "Install..." "INSTALL_HDF5" $installlog # save the last exit code exit_code=$? @@ -387,7 +433,7 @@ set (SITE_BUILDNAME_SUFFIX "cmakehdf5") # -- URL set for internal check, default is to not update set (LOCAL_SKIP_UPDATE TRUE) set (REPOSITORY_URL "http://svn.${hdfgroup_url}/hdf5/branches/hdf5_1_8") -# -- Standard build options +# -- Standard build options set (ADD_BUILD_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=${CTEST_BINARY_DIRECTORY} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=\"SVN\" -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") # Use multiple CPU cores to build @@ -401,9 +447,9 @@ if(NOT N EQUAL 0) set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) endif() -# ----------------------------------------------------------- +# ----------------------------------------------------------- # -- Get environment -# ----------------------------------------------------------- +# ----------------------------------------------------------- ## -- set hostname ## -------------------------- find_program (HOSTNAME_CMD NAMES hostname) @@ -423,10 +469,10 @@ endif() else (SITE_BUILDNAME_SUFFIX) set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}") endif (SITE_BUILDNAME_SUFFIX) -# ----------------------------------------------------------- - +# ----------------------------------------------------------- + set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") - + #----------------------------------------------------------------------------- # MAC machines need special option #----------------------------------------------------------------------------- @@ -434,21 +480,25 @@ if (APPLE) # Compiler choice execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) - SET(ENV{CC} "${XCODE_CC}") - SET(ENV{CXX} "${XCODE_CXX}") - # Shared fortran is not supported, build static + set(ENV{CC} "${XCODE_CC}") + set(ENV{CXX} "${XCODE_CXX}") + # Shared fortran is not supported, build static set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") endif (APPLE) -# ----------------------------------------------------------- +# ----------------------------------------------------------- find_package (Subversion) set (CTEST_UPDATE_COMMAND "${Subversion_SVN_EXECUTABLE}") -# -- Only clean build folder if LOCAL_CLEAR_BUILD is set +# -- Only clean build folder if LOCAL_CLEAR_BUILD is set if (LOCAL_CLEAR_BUILD) set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) - ctest_empty_binary_directory (${CTEST_BINARY_DIRECTORY}) + if(NOT EXISTS "${CTEST_BINARY_DIRECTORY}") + file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") + else() + ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) + endif() endif (LOCAL_CLEAR_BUILD) #----------------------------------------------------------------------------- @@ -471,7 +521,7 @@ endforeach (req) ## -- set output to english set($ENV{LC_MESSAGES} "en_EN") - + #----------------------------------------------------------------------------- # Initialize the CTEST commands #------------------------------ @@ -494,31 +544,32 @@ foreach (v endforeach (v) message ("Dashboard script configuration:\n${vars}\n") -CTEST_START (${MODEL} TRACK ${MODEL}) +ctest_start (${MODEL} TRACK ${MODEL}) if (NOT LOCAL_SKIP_UPDATE) - CTEST_UPDATE (SOURCE "${CTEST_SOURCE_DIRECTORY}") + ctest_update (SOURCE "${CTEST_SOURCE_DIRECTORY}") endif (NOT LOCAL_SKIP_UPDATE) -CTEST_CONFIGURE (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) if(NOT res STREQUAL "0") message (FATAL_ERROR "Configure FAILED") endif() message ("Configure DONE") -CTEST_READ_CUSTOM_FILES ("${CTEST_BINARY_DIRECTORY}") +configure_file(${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) +ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") +ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) if (NOT LOCAL_NO_SUBMIT) - CTEST_SUBMIT (PARTS Update Configure Notes) + ctest_submit (PARTS Update Configure Notes) endif (NOT LOCAL_NO_SUBMIT) -CTEST_BUILD (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND RETURN_VALUE res) +ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND RETURN_VALUE res) if (NOT LOCAL_NO_SUBMIT) - CTEST_SUBMIT (PARTS Build) + ctest_submit (PARTS Build) endif (NOT LOCAL_NO_SUBMIT) if(NOT res STREQUAL "0") message (FATAL_ERROR "Build FAILED") endif() message ("build DONE") if (NOT LOCAL_SKIP_TEST) - CTEST_TEST (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) + ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) if (NOT LOCAL_NO_SUBMIT) - CTEST_SUBMIT (PARTS Test) + ctest_submit (PARTS Test) endif (NOT LOCAL_NO_SUBMIT) if(NOT res STREQUAL "0") message (FATAL_ERROR "Test FAILED") diff --git a/bin/genparser b/bin/genparser new file mode 100755 index 0000000..71a8ae2 --- /dev/null +++ b/bin/genparser @@ -0,0 +1,252 @@ +#! /bin/bash +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic document set and is +# linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access +# to either file, you may request a copy from help@hdfgroup.org. +# + +# This script runs flex/lex and bison/yacc to generate parser code for +# the high-level library. It used to be a part of autogen.sh, but many +# people encountered problems with installing flex and bison on their +# system and the parser code rarely changes, so those parts of the +# script were moved to their own file. +# +# NOTE CAREFULLY! +# +# There is NO dependency in either the autotools or CMake to regenerate +# the parser code. If you modify H5LT analyze.l or H5LTparse.y, you +# will need to run this scrpit manually on a system with a suitable +# lexer and parser generator. +# +# IMPORTANT OS X NOTE +# +# If you are using OS X, you will probably not have flex or bison +# installed. In addtion, even if you do have bison installed, the bison +# version you have installed may also have a bug that makes it unable to +# process our input files. +# +# The easiest way to fix this is to install everything via Homebrew: +# +# http://brew.sh/ +# +# After you install the base packages, install flex/bison. +# +# brew install flex +# brew install bison +# +# END IMPORTANT OS X NOTE +# +# If you want to use a particular version of flex or bison, the paths +# to each tool can be overridden using the following environment +# variables: +# +# HDF5_FLEX +# HDF5_BISON +# +# This script takes two potential options: +# +# -p +# +# When this is selected, the flex/bison versions are set to the paths +# and versions used by The HDF Group to produce the released versions +# of the library. +# +# NOTE: This is probably temporary. Once we update our dev machines +# to have recent versions of the autotools this option will probably +# be removed. +# +# -v +# +# This emits some extra information, mainly tool versions. + +echo +echo "*******************************************" +echo "* HDF5 high-level parser generator script *" +echo "*******************************************" +echo + +# Default is not verbose output +verbose=false + +optspec=":hpv-" +while getopts "$optspec" optchar; do + case "${optchar}" in + h) + echo "usage: $0 [OPTIONS] /path/to/hl/src/directory" + echo + echo " -h Print this help message." + echo + echo " -p Used by THG to use hard-codes flex/bison" + echo " paths on THG machines. Not for non-HDF-Group" + echo " users!" + echo + echo " -v Show more verbose output." + echo + echo " NOTE: Each tool can be set via an environment variable." + echo " These are documented inside this script." + echo + exit 0 + ;; + p) + echo "Setting THG production mode..." + echo + production=true + ;; + v) + echo "Setting verbosity: high" + echo + verbose=true + ;; + *) + if [ "$OPTERR" != 1 ] || [ "${optspec:0:1}" = ":" ]; then + echo "Non-option argument: '-${OPTARG}'" >&2 + fi + ;; + esac +done + +# Get the path to the hl src directory +shift $(($OPTIND - 1)) +path_to_hl_src=$1 +if test -z ${path_to_hl_src}; then + echo "*** ERROR *** - Path to hl/src not set" + echo "Please add the path to the hl/src directory as a parameter" + echo "See $0 -h for more help." + echo + exit -1 +fi + +if [ "$production" = true ] ; then + + # Production mode + # + # Hard-code canonical HDF Group tool locations. + + # If paths to tools are not specified, assume they are + # located in /usr/hdf/bin/AUTOTOOLS and set paths accordingly. + if test -z ${HDF5_BISON}; then + HDF5_BISON=/usr/hdf/bin/AUTOTOOLS/bison + fi + if test -z ${HDF5_FLEX}; then + HDF5_FLEX=/usr/hdf/bin/AUTOTOOLS/flex + fi + +else + + # Not in production mode + # + # If paths to autotools are not specified, use whatever the system + # has installed as the default. We use 'which <tool>' to + # show exactly what's being used. + if test -z ${HDF5_BISON}; then + HDF5_BISON=$(which bison) + fi + if test -z ${HDF5_FLEX}; then + HDF5_FLEX=$(which flex) + fi + +fi # production + +# Make sure that these versions of the tools are in the path +BISON_DIR=`dirname ${HDF5_BISON}` +FLEX_DIR=`dirname ${HDF5_FLEX}` +PATH=${FLEX_DIR}:${BISON_DIR}:$PATH + +# Run flex and bison +# automatically generates hl/src/H5LTanalyze.c and hl/src/H5LTparse.c +# Note that, as of Xcode 6.1 (2015), the default bison version on OS X +# is old enough to have the circular dependency bug. You'll have +# to install a later version of bison. See the OS X note at the top +# of this script. +echo +echo "Generating H5LT parser code (requires yacc/bison):" +echo "Generate hl/src/H5LTparse.c from hl/src/H5LTparse.y" +# HDF5_BISON is set via the environment or 'which bison', above +if test -z ${HDF5_BISON}; then + echo + echo "*************************" + echo " ERROR - bison not found" + echo "*************************" + echo "bison is required to generate parser code in H5LT" + echo + exit 127 +fi +if [ "$verbose" = true ] ; then + ${HDF5_BISON} --version +fi +${HDF5_BISON} -pH5LTyy -o ${path_to_hl_src}/H5LTparse.c -d ${path_to_hl_src}/H5LTparse.y + +echo +echo "Generating H5LT lexer code (requires lex/flex):" +echo "Generate hl/src/H5LTanalyze.c from hl/src/H5LTanalyze.l" +# HDF5_FLEX is set via the environment or 'which flex', above +if test -z ${HDF5_FLEX}; then + echo + echo "************************" + echo " ERROR - flex not found" + echo "************************" + echo "flex is required to generate lexer code in H5LT" + echo + exit 127 +fi +if [ "$verbose" = true ] ; then + ${HDF5_FLEX} --version +fi +${HDF5_FLEX} --nounistd -PH5LTyy -o ${path_to_hl_src}/H5LTanalyze.c ${path_to_hl_src}/H5LTanalyze.l + +# fix H5LTparse.c to declare H5LTyyparse return type as an hid_t +# instead of int. Currently the generated function H5LTyyparse is +# generated with a return value of type int, which is a mapping to the +# flex yyparse function. The return value in the HL library should be +# an hid_t. +# I propose to not use flex to generate this function, but for now I am +# adding a perl command to find and replace this function declaration in +# H5LTparse.c. +perl -0777 -pi -e 's/int yyparse/hid_t yyparse/igs' ${path_to_hl_src}/H5LTparse.c +perl -0777 -pi -e 's/int\nyyparse/hid_t\nyyparse/igs' ${path_to_hl_src}/H5LTparse.c +perl -0777 -pi -e 's/int H5LTyyparse/hid_t H5LTyyparse/igs' ${path_to_hl_src}/H5LTparse.c + +# Add code that disables warnings in the flex/bison-generated code. +# +# Note that the GCC pragmas did not exist until gcc 4.2. Earlier versions +# will simply ignore them, but we want to avoid those warnings. +for f in ${path_to_hl_src}/H5LTparse.c ${path_to_hl_src}/H5LTanalyze.c +do + echo '#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2 ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wconversion" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wlarger-than=" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wmissing-prototypes" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wnested-externs" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wold-style-definition" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wredundant-decls" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wsign-compare" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wsign-conversion" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wstrict-overflow" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wstrict-prototypes" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wswitch-default" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wunused-function" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wunused-macros" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wunused-parameter" ' >> tmp.out + echo '#elif defined __SUNPRO_CC ' >> tmp.out + echo '#pragma disable_warn ' >> tmp.out + echo '#elif defined _MSC_VER ' >> tmp.out + echo '#pragma warning(push, 1) ' >> tmp.out + echo '#endif ' >> tmp.out + + cat $f >> tmp.out + mv tmp.out $f +done + +echo +exit 0 + @@ -377,12 +377,12 @@ sub gen_configure { $conf =~ /^(.*?)\/?configure.ac$/; if ($1) { - $rc = system("cd $1 && bin/reconfigure >/dev/null 2>/dev/null && rm -rf autom4te.cache"); + $rc = system("cd $1 && ./autogen.sh -p >/dev/null 2>/dev/null && rm -rf autom4te.cache"); } else { - $rc = system("bin/reconfigure >/dev/null 2>/dev/null && rm -rf autom4te.cache"); + $rc = system("./autogen.sh -p >/dev/null 2>/dev/null && rm -rf autom4te.cache"); } if ($rc) { - printf("bin/reconfigure failed with exit code %d. Aborted.\n", $rc); + printf("./autogen.sh -p failed with exit code %d. Aborted.\n", $rc); exit 1; } } @@ -37,6 +37,7 @@ $Source = ""; "H5D_fill_value_t" => "DF", "H5FD_mpio_chunk_opt_t" => "Dh", "H5D_mpio_actual_io_mode_t" => "Di", + "H5D_chunk_index_t" => "Dk", "H5D_layout_t" => "Dl", "H5D_mpio_no_collective_cause_t" => "Dn", "H5D_mpio_actual_chunk_opt_mode_t" => "Do", @@ -101,6 +102,7 @@ $Source = ""; "H5A_operator2_t" => "x", "H5A_info_t" => "x", "H5AC_cache_config_t" => "x", + "H5D_append_cb_t" => "x", "H5D_gather_func_t" => "x", "H5D_operator_t" => "x", "H5D_scatter_func_t" => "x", @@ -110,8 +112,10 @@ $Source = ""; "H5E_walk_t" => "x", "H5E_walk1_t" => "x", "H5E_walk2_t" => "x", + "H5F_flush_cb_t" => "x", "H5F_info1_t" => "x", "H5F_info2_t" => "x", + "H5F_retry_info_t" => "x", "H5FD_t" => "x", "H5FD_class_t" => "x", "H5FD_stream_fapl_t" => "x", diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp index 5929444..06b3e22 100644 --- a/c++/src/H5AbstractDs.cpp +++ b/c++/src/H5AbstractDs.cpp @@ -52,18 +52,6 @@ AbstractDs::AbstractDs(){} AbstractDs::AbstractDs(const hid_t ds_id){} //-------------------------------------------------------------------------- -// Function: AbstractDs copy constructor -///\brief Copy constructor: makes a copy of the original AbstractDs object. -// Programmer Binh-Minh Ribler - 2000 -// *** Deprecation warning *** -// This constructor is no longer appropriate because the data member "id" had -// been moved to the sub-classes. It is removed from 1.8.15 because it is -// a noop and it can be generated by the compiler if needed. -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -// AbstractDs::AbstractDs(const AbstractDs& original){} - -//-------------------------------------------------------------------------- // Function: AbstractDs::getTypeClass ///\brief Returns the class of the datatype that is used by this /// object, which can be a dataset or an attribute. diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index 810dc8b..ee2e45e 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -68,7 +68,7 @@ class H5_DLLCPP AbstractDs { ///\brief Returns the amount of storage size required - pure virtual. virtual hsize_t getStorageSize() const = 0; - ///\brief Returns this class name. + // Returns this class name - pure virtual. virtual H5std_string fromClass() const = 0; // Destructor @@ -91,7 +91,7 @@ class H5_DLLCPP AbstractDs { // AbstractDs( const AbstractDs& original ); private: - // This member function is implemented by DataSet and Attribute. + // This member function is implemented by DataSet and Attribute - pure virtual. virtual hid_t p_get_type() const = 0; }; #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h index eced64e..f5ee4a9 100644 --- a/c++/src/H5Attribute.h +++ b/c++/src/H5Attribute.h @@ -86,8 +86,8 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent { // Destructor: properly terminates access to this attribute. virtual ~Attribute(); - protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS + protected: // Sets the attribute id. virtual void p_setId(const hid_t new_id); #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5CppDoc.h b/c++/src/H5CppDoc.h index 388fc25..2420586 100644 --- a/c++/src/H5CppDoc.h +++ b/c++/src/H5CppDoc.h @@ -29,10 +29,10 @@ * The C++ API provides C++ wrappers for the HDF5 C Library. * * It is assumed that the user has knowledge of the - * <a href="http://www.hdfgroup.org/HDF5/doc/H5.format.html"> + * <a href="https://www.hdfgroup.org/HDF5/doc/H5.format.html"> * HDF5 file format</a> and its components. * For more information on the HDF5 C Library, see the - * <a href="http://www.hdfgroup.org/HDF5/doc/index.html"> + * <a href="https://www.hdfgroup.org/HDF5/doc/index.html"> * HDF5 Software Documentation</a> page. * * Because the HDF5 C Library maps very well to @@ -57,8 +57,8 @@ * * The HDF5 C++ API is included with the HDF5 source code and can * be obtained from - * <a href="http://www.hdfgroup.org/HDF5/release/obtainsrc.html"> - * http://www.hdfgroup.org/HDF5/release/obtainsrc.html</a>. + * <a href="https://www.hdfgroup.org/HDF5/release/obtainsrc.html"> + * https://www.hdfgroup.org/HDF5/release/obtainsrc.html</a>. * * Please refer to the release_docs/INSTALL file under the top directory * of the HDF5 source code for information about installing, building, diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 0fc9105..059da85 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -60,6 +60,12 @@ DataSet::DataSet() : H5Object(), AbstractDs(), id(H5I_INVALID_HID) {} ///\brief Creates an DataSet object using the id of an existing dataset. ///\param existing_id - IN: Id of an existing dataset // Programmer Binh-Minh Ribler - 2000 +// Description +// incRefCount() is needed here to prevent the id from being closed +// prematurely. That is, when application uses the id of an +// existing DataSet object to create another DataSet object. So, +// when one of those objects is deleted, the id will be closed if +// the reference counter is only 1. //-------------------------------------------------------------------------- DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs() { @@ -172,8 +178,10 @@ DSetCreatPropList DataSet::getCreatePlist() const { throw DataSetIException("DataSet::getCreatePlist", "H5Dget_create_plist failed"); } + // create and return the DSetCreatPropList object - DSetCreatPropList create_plist(create_plist_id); // ok to use existing id const + DSetCreatPropList create_plist; + f_PropList_setId(&create_plist, create_plist_id); return(create_plist); } @@ -772,6 +780,22 @@ void DataSet::p_setId(const hid_t new_id) // reset object's id to the given id id = new_id; } + +//-------------------------------------------------------------------------- +// Function: f_PropList_setId - friend +// Purpose: This function is friend to class H5::PropList so that it +// can set PropList::id in order to work around a problem +// described in the JIRA issue HDFFV-7947. +// Applications shouldn't need to use it. +// param dset - IN/OUT: DataSet object to be changed +// param new_id - IN: New id to set +// Programmer Binh-Minh Ribler - 2015 +//-------------------------------------------------------------------------- +void f_PropList_setId(PropList* plist, hid_t new_id) +{ + plist->p_setId(new_id); +} + #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 88dff89..1bbabe3 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -144,10 +144,10 @@ DataType::DataType(const DataType& original) : H5Object() //-------------------------------------------------------------------------- // Function: DataType overloaded constructor -///\brief Creates a integer type using a predefined type +///\brief Creates a DataType instance using a predefined type ///\param pred_type - IN: Predefined datatype ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2015 // Description // Copying the type so that when a predefined type is passed in, // a copy of it is made, not just a duplicate of the HDF5 id. @@ -239,8 +239,7 @@ DataType& DataType::operator=( const DataType& rhs ) { if (this != &rhs) { - id = rhs.id; - incRefCount(); // increment number of references to this id + setId(rhs.id); } return(*this); } diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 6c8a312..5705b83 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -14,6 +14,9 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +// Class DataType inherits from H5Object and has several subclasses for +// specific HDF5 data types. + #ifndef __H5DataType_H #define __H5DataType_H diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index ebdadc4..792956a 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -14,6 +14,9 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +// Class DSetCreatPropList represents the HDF5 dataset creation property list +// and inherits from PropList. + #ifndef __H5DSCreatPropList_H #define __H5DSCreatPropList_H diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h index 85d2ec2..52a9a48 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -14,6 +14,9 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +// Class DSetMemXferPropList represents the HDF5 dataset transfer property list +// and inherits from PropList. + #ifndef __H5DSetMemXferPropList_H #define __H5DSetMemXferPropList_H @@ -132,4 +135,3 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { } #endif #endif // __H5DSetMemXferPropList_H - diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index fb1e42e..1ca059b 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -309,9 +309,9 @@ const char* Exception::getCFuncName() const //-------------------------------------------------------------------------- void Exception::printErrorStack(FILE* stream, hid_t err_stack) { - herr_t ret_value = H5Eprint2(err_stack, stream); - if( ret_value < 0 ) - throw Exception( "Printing error stack", "H5Eprint2 failed" ); + herr_t ret_value = H5Eprint2(err_stack, stream); + if( ret_value < 0 ) + throw Exception( "Printing error stack", "H5Eprint2 failed" ); } //-------------------------------------------------------------------------- diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index 639b633..d49c19a 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -86,8 +86,8 @@ class H5_DLLCPP Exception { virtual ~Exception() throw(); protected: - // Default value for detail_message - static const char DEFAULT_MSG[]; + // Default value for detail_message + static const char DEFAULT_MSG[]; private: H5std_string detail_message; diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index 7d6529e..b214447 100644 --- a/c++/src/H5FaccProp.h +++ b/c++/src/H5FaccProp.h @@ -14,6 +14,9 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +// Class FileAccPropList represents the HDF5 file access property list and +// inherits from DataType. + #ifndef __H5FileAccPropList_H #define __H5FileAccPropList_H diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 44fc53c..b169472 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -133,28 +133,26 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro // create the file. if( flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC)) { - hid_t create_plist_id = create_plist.getId(); - hid_t access_plist_id = access_plist.getId(); - id = H5Fcreate( name, flags, create_plist_id, access_plist_id ); - if( id < 0 ) // throw an exception when open/create fail - { - throw FileIException("H5File constructor", "H5Fcreate failed"); - } + hid_t create_plist_id = create_plist.getId(); + hid_t access_plist_id = access_plist.getId(); + id = H5Fcreate( name, flags, create_plist_id, access_plist_id ); + if( id < 0 ) // throw an exception when open/create fail + { + throw FileIException("H5File constructor", "H5Fcreate failed"); + } } // Open the file if none of the bits above are set. else { - hid_t access_plist_id = access_plist.getId(); - id = H5Fopen( name, flags, access_plist_id ); - if( id < 0 ) // throw an exception when open/create fail - { - throw FileIException("H5File constructor", "H5Fopen failed"); - } + hid_t access_plist_id = access_plist.getId(); + id = H5Fopen( name, flags, access_plist_id ); + if( id < 0 ) // throw an exception when open/create fail + { + throw FileIException("H5File constructor", "H5Fopen failed"); + } } } -#endif // DOXYGEN_SHOULD_SKIP_THIS - //-------------------------------------------------------------------------- // Function: H5File overloaded constructor ///\brief Creates an H5File object using an existing file id. @@ -174,6 +172,8 @@ H5File::H5File(hid_t existing_id) : H5Location(), CommonFG() incRefCount(); // increment number of references to this id } +#endif // DOXYGEN_SHOULD_SKIP_THIS + //-------------------------------------------------------------------------- // Function: H5File copy constructor ///\brief Copy constructor: makes a copy of the original @@ -523,16 +523,16 @@ hsize_t H5File::getFileSize() const } //-------------------------------------------------------------------------- -// Function: H5File::getId +// Function: H5File::getId ///\brief Get the id of this file ///\return File identifier // Modification: -// May 2008 - BMR -// Class hierarchy is revised to address bugzilla 1068. Class -// AbstractDS and Attribute are moved out of H5Object. In -// addition, member IdComponent::id is moved into subclasses, and -// IdComponent::getId now becomes pure virtual function. -// Programmer Binh-Minh Ribler - May, 2008 +// May 2008 - BMR +// Class hierarchy is revised to address bugzilla 1068. Class +// AbstractDS and Attribute are moved out of H5Object. In +// addition, member IdComponent::id is moved into subclasses, and +// IdComponent::getId now becomes pure virtual function. +// Programmer Binh-Minh Ribler - May, 2008 //-------------------------------------------------------------------------- hid_t H5File::getId() const { @@ -541,42 +541,42 @@ hid_t H5File::getId() const #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5File::getLocId -// Purpose: Get the id of this file +// Function: H5File::reopen +// Purpose: Reopens this file. +// Exception H5::FileIException // Description -// This function is a redefinition of CommonFG::getLocId. It -// is used by CommonFG member functions to get the file id. +// This function is replaced by the above function reOpen. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -hid_t H5File::getLocId() const +void H5File::reopen() { - return( getId() ); + H5File::reOpen(); } //-------------------------------------------------------------------------- -// Function: H5File::reopen -// Purpose: Reopens this file. -// Exception H5::FileIException +// Function: H5File::getLocId +// Purpose: Get the id of this file // Description -// This function is replaced by the above function reOpen. +// This function is a redefinition of CommonFG::getLocId. It +// is used by CommonFG member functions to get the file id. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void H5File::reopen() +hid_t H5File::getLocId() const { - H5File::reOpen(); + return( getId() ); } //-------------------------------------------------------------------------- -// Function: H5File::p_setId (protected) -///\brief Sets the identifier of this object to a new value. +// Function: H5File::p_setId (protected) +///\brief Sets the identifier of this object to a new value. /// -///\exception H5::IdComponentException when the attempt to close the HDF5 -/// object fails +///\exception H5::IdComponentException when the attempt to close the HDF5 +/// object fails // Description: -// The underlaying reference counting in the C library ensures -// that the current valid id of this object is properly closed. -// Then the object's id is reset to the new id. -// Programmer Binh-Minh Ribler - 2000 +// The underlaying reference counting in the C library ensures +// that the current valid id of this object is properly closed. +// Then the object's id is reset to the new id. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5File::p_setId(const hid_t new_id) { diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h index 06a5450..e88093e 100644 --- a/c++/src/H5FloatType.h +++ b/c++/src/H5FloatType.h @@ -24,10 +24,10 @@ namespace H5 { //! Class FloatType operates on HDF5 floating point datatype. class H5_DLLCPP FloatType : public AtomType { public: - // Creates a floating-point type using a predefined type - FloatType( const PredType& pred_type ); + // Creates a floating-point type using a predefined type. + FloatType( const PredType& pred_type ); - // Gets the floating-point datatype of the specified dataset + // Gets the floating-point datatype of the specified dataset. FloatType( const DataSet& dataset ); // Retrieves the exponent bias of a floating-point type. @@ -60,7 +60,7 @@ class H5_DLLCPP FloatType : public AtomType { // Default constructor FloatType(); - // Creates a floating-point datatype using an existing id + // Creates a floating-point datatype using an existing id. FloatType( const hid_t existing_id ); // Copy constructor: makes a copy of the original FloatType object. diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index 93ee4fd..60735f0 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -26,14 +26,19 @@ namespace H5 { #endif -// This flag controls whether H5Library::initH5cpp has been called to register -// terminating functions with atexit() +// This flag indicates whether H5Library::initH5cpp has been called to register +// the terminating functions with atexit() bool IdComponent::H5cppinit = false; + +// This flag is used to decide whether H5dont_atexit should be called. +// Subclasses that have global constants use it. This is a temporary +// work-around in 1.8.16. It will be removed after HDFFV-9540 is fixed. bool IdComponent::H5dontAtexit_called = false; //-------------------------------------------------------------------------- // Function: IdComponent overloaded constructor -// Purpose Creates an IdComponent object using the id of an existing object. +///\brief Creates an IdComponent object using the id of an existing +/// object. - Obsolete, will be removed in 1.8.17 // Param h5_id - IN: Id of an existing object // Exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 @@ -43,25 +48,10 @@ bool IdComponent::H5dontAtexit_called = false; // been moved to the sub-classes. It will be removed in 1.10 release. If its // removal does not raise any problems in 1.10, it will be removed from 1.8 in // subsequent releases. -// - Removed from documentation in 1.8.16 -BMR (October 2015) //-------------------------------------------------------------------------- IdComponent::IdComponent(const hid_t h5_id) {} //-------------------------------------------------------------------------- -// Function: IdComponent copy constructor -// Purpose: This noop copy constructor is removed as a result of the data -// member "id" being moved down to sub-classes. (Mar 2015) -// Parameters: original - IN: IdComponent instance to copy -// Programmer Binh-Minh Ribler - 2000 -// -// *** Deprecation warning *** -// This constructor is no longer appropriate because the data member "id" had -// been moved to the sub-classes. It is removed from 1.8.15 because it is -// a noop and it can be generated by the compiler if needed. -//-------------------------------------------------------------------------- -// IdComponent::IdComponent(const IdComponent& original) {} - -//-------------------------------------------------------------------------- // Function: IdComponent::incRefCount ///\brief Increment reference counter for a given id. // Programmer Binh-Minh Ribler - May 2005 @@ -227,7 +217,7 @@ IdComponent& IdComponent::operator=( const IdComponent& rhs ) //-------------------------------------------------------------------------- // Function: IdComponent::setId ///\brief Sets the identifier of this object to a new value. -/// +///\param new_id - IN: New identifier to be set to ///\exception H5::IdComponentException when the attempt to close the HDF5 /// object fails // Description: @@ -242,8 +232,8 @@ IdComponent& IdComponent::operator=( const IdComponent& rhs ) // C++ API object, which will be destroyed properly, and so // p_setId does not call incRefCount. On the other hand, the // public version setId is used by other applications, in which -// the id passed to setId already has a reference count, so setId -// must call incRefCount. +// the id passed to setId is that of another C++ API object, so +// setId must call incRefCount. //-------------------------------------------------------------------------- void IdComponent::setId(const hid_t new_id) { @@ -295,10 +285,10 @@ H5std_string IdComponent::inMemFunc(const char* func_name) const IdComponent::IdComponent() { // initH5cpp will register the terminating functions with atexit(). - // We only do this once. + // This should only be done once. if (!H5cppinit) { - H5Library::getInstance()->initH5cpp(); + H5Library::initH5cpp(); H5cppinit = true; } } diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index 1c29f09..61c8bd6 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -17,6 +17,8 @@ #ifndef __IdComponent_H #define __IdComponent_H +// IdComponent represents an HDF5 object that has an identifier. + #ifndef H5_NO_NAMESPACE namespace H5 { #endif @@ -30,12 +32,7 @@ class DataSpace; rarely needs them. */ class H5_DLLCPP IdComponent { - public: - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - static bool H5cppinit; - static bool H5dontAtexit_called; -#endif // DOXYGEN_SHOULD_SKIP_THIS + public: // Increment reference counter. void incRefCount(const hid_t obj_id) const; @@ -58,11 +55,6 @@ class H5_DLLCPP IdComponent { // Assignment operator. IdComponent& operator=( const IdComponent& rhs ); -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // Gets the identifier of this object. - virtual hid_t getId () const = 0; -#endif // DOXYGEN_SHOULD_SKIP_THIS - // Sets the identifier of this object to a new value. void setId(const hid_t new_id); @@ -76,10 +68,14 @@ class H5_DLLCPP IdComponent { // Creates an object to hold an HDF5 identifier. IdComponent( const hid_t h5_id ); +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Copy constructor: makes copy of the original IdComponent object. - // IdComponent( const IdComponent& original ); + // IdComponent( const IdComponent& original ); - removed from 1.8.15 + + // Gets the identifier of this object. + virtual hid_t getId () const = 0; -#ifndef DOXYGEN_SHOULD_SKIP_THIS // Pure virtual function for there are various H5*close for the // subclasses. virtual void close() = 0; @@ -96,11 +92,12 @@ class H5_DLLCPP IdComponent { // Destructor virtual ~IdComponent(); - protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + protected: // Default constructor. IdComponent(); -#ifndef DOXYGEN_SHOULD_SKIP_THIS // Gets the name of the file, in which an HDF5 object belongs. H5std_string p_get_file_name() const; @@ -110,7 +107,14 @@ class H5_DLLCPP IdComponent { // Sets the identifier of this object to a new value. - this one // doesn't increment reference count virtual void p_setId(const hid_t new_id) = 0; - //virtual void p_setId(const hid_t new_id); + + // This flag is used to decide whether H5dont_atexit should be called + static bool H5dontAtexit_called; + + private: + // This flag indicates whether H5Library::initH5cpp has been called + // to register various terminating functions with atexit() + static bool H5cppinit; #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp index e7e9fb6..40c766a 100644 --- a/c++/src/H5Library.cpp +++ b/c++/src/H5Library.cpp @@ -38,11 +38,14 @@ namespace H5 { #endif #ifndef DOXYGEN_SHOULD_SKIP_THIS -H5Library* H5Library::instance = 0; + +// This static variable is unused, will be removed in future releases. +bool H5Library::need_cleanup = false; + #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Library::open +// Function: H5Library::open (static) ///\brief Initializes the HDF5 library. /// ///\exception H5::LibraryIException @@ -58,7 +61,7 @@ void H5Library::open() } //-------------------------------------------------------------------------- -// Function: H5Library::close +// Function: H5Library::close (static) ///\brief Flushes all data to disk, closes files, and cleans up memory. /// ///\exception H5::LibraryIException @@ -74,7 +77,7 @@ void H5Library::close() } //-------------------------------------------------------------------------- -// Function: H5Library::dontAtExit +// Function: H5Library::dontAtExit (static) ///\brief Instructs library not to install the C \c atexit cleanup routine /// ///\exception H5::LibraryIException @@ -89,7 +92,7 @@ void H5Library::dontAtExit() } //-------------------------------------------------------------------------- -// Function: H5Library::getLibVersion +// Function: H5Library::getLibVersion (static) ///\brief Returns the HDF library release number. ///\param majnum - OUT: Major version of the library ///\param minnum - OUT: Minor version of the library @@ -107,7 +110,7 @@ void H5Library::getLibVersion( unsigned& majnum, unsigned& minnum, unsigned& rel } //-------------------------------------------------------------------------- -// Function: H5Library::checkVersion +// Function: H5Library::checkVersion (static) ///\brief Verifies that the arguments match the version numbers /// compiled into the library ///\param majnum - IN: Major version of the library @@ -130,7 +133,7 @@ void H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum) } //-------------------------------------------------------------------------- -// Function: H5Library::garbageCollect +// Function: H5Library::garbageCollect (static) ///\brief Walks through all the garbage collection routines for the /// library, which are supposed to free any unused memory they /// have allocated. @@ -159,7 +162,7 @@ void H5Library::garbageCollect() } //-------------------------------------------------------------------------- -// Function: H5Library::initH5cpp +// Function: H5Library::initH5cpp (static) ///\brief Initializes C++ library and registers terminating functions at /// exit. Only for the library functions, not for user-defined /// functions. @@ -167,52 +170,56 @@ void H5Library::garbageCollect() // initH5cpp registers the following functions with std::atexit(): // termH5cpp() - calls H5close() after all cleanup in // the C++ library is done -// <classname>::deleteConstants - deletes all references for -// <classname> global constants +// <classname>::deleteConstants - deletes all references +// for <classname> global constants ///\exception H5::LibraryIException // // Programmer Binh-Minh Ribler - September, 2015 //-------------------------------------------------------------------------- void H5Library::initH5cpp() { - // Register terminating functions with atexit(); they will be invoked in the - // reversed order + // Register terminating functions with atexit(); they will be invoked in + // the reversed order int ret_value = 0; ret_value = std::atexit(termH5cpp); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of termH5cpp failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating termH5cpp failed"); ret_value = std::atexit(PredType::deleteConstants); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of PredType::deleteConstants failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating PredType::deleteConstants failed"); ret_value = std::atexit(PropList::deleteConstants); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of PropList::deleteConstants failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating PropList::deleteConstants failed"); ret_value = std::atexit(FileAccPropList::deleteConstants); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of FileAccPropList::deleteConstants failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating FileAccPropList::deleteConstants failed"); ret_value = std::atexit(FileCreatPropList::deleteConstants); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of FileCreatPropList::deleteConstants failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating FileCreatPropList::deleteConstants failed"); ret_value = std::atexit(DSetMemXferPropList::deleteConstants); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of DSetMemXferPropList::deleteConstants failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating DSetMemXferPropList::deleteConstants failed"); ret_value = std::atexit(DSetCreatPropList::deleteConstants); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of DSetCreatPropList::deleteConstants failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating DSetCreatPropList::deleteConstants failed"); + + ret_value = std::atexit(ObjCreatPropList::deleteConstants); + if (ret_value != 0) + throw LibraryIException("H5Library::initH5cpp", "Registrating ObjCreatPropList::deleteConstants failed"); ret_value = std::atexit(DataSpace::deleteConstants); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of DataSpace::deleteConstants failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating DataSpace::deleteConstants failed"); } //-------------------------------------------------------------------------- -// Function: H5Library::termH5cpp +// Function: H5Library::termH5cpp (static) ///\brief Sends request for the C layer to terminate. ///\par Description /// If the C library fails to terminate, exit with a failure. @@ -227,24 +234,7 @@ void H5Library::termH5cpp() } //-------------------------------------------------------------------------- -// Function: H5Library::getInstance -///\brief Provides a way to instantiate the class. -///\par Description -/// getInstance ensures that only one instance of the H5Library -/// is created. -// Programmer Binh-Minh Ribler - September, 2015 -//-------------------------------------------------------------------------- -H5Library* H5Library::getInstance() -{ - if (H5Library::instance == 0) - { - instance = new H5Library(); - } - return(instance); -} - -//-------------------------------------------------------------------------- -// Function: H5Library::setFreeListLimits +// Function: H5Library::setFreeListLimits (static) ///\brief Sets limits on the different kinds of free lists. ///\param reg_global_lim - IN: Limit on all "regular" free list memory used ///\param reg_list_lim - IN: Limit on memory used in each "regular" free list @@ -271,10 +261,10 @@ void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim, } } -// Default constructor - no instance ever created by outsiders +// Default constructor - private H5Library::H5Library(){}; -// Destructor +// Destructor - private H5Library::~H5Library(){}; #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5Library.h b/c++/src/H5Library.h index 68ab039..336f9c8 100644 --- a/c++/src/H5Library.h +++ b/c++/src/H5Library.h @@ -29,6 +29,11 @@ namespace H5 { */ class H5_DLLCPP H5Library { public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static bool need_cleanup; // indicates if H5close should be called + // - unused, will be removed in future releases. +#endif // DOXYGEN_SHOULD_SKIP_THIS + // Initializes the HDF5 library. static void open(); @@ -60,15 +65,10 @@ class H5_DLLCPP H5Library { // Sends request for terminating the HDF5 library. static void termH5cpp(void); - static H5Library* getInstance(); - #ifndef DOXYGEN_SHOULD_SKIP_THIS private: - // private instance to be created by H5Library only - static H5Library* instance; - // Default constructor - no instance ever created from outsiders H5Library(); diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 79a8d5c..9e4ec05 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -150,9 +150,6 @@ class H5_DLLCPP H5Location : public IdComponent { // Creates a copy of an existing object giving the location id. H5Location(const hid_t loc_id); - // Copy constructor. - // H5Location(const H5Location& original); - // Creates a reference to an HDF5 object or a dataset region. void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index be04451..7f6ee31 100644 --- a/c++/src/H5PropList.h +++ b/c++/src/H5PropList.h @@ -127,6 +127,9 @@ class H5_DLLCPP PropList : public IdComponent { // Dynamically allocates the PropList global constant static PropList* getConstant(); + // Friend function to set PropList id. For library use only. + friend void f_PropList_setId(PropList* plist, hid_t new_id); + #endif // DOXYGEN_SHOULD_SKIP_THIS }; diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 5b32554..936ee63 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -1794,7 +1794,7 @@ void test_attr() // use_shared test // Loop over using new group format - hbool_t new_format; + unsigned new_format; for (new_format = FALSE; new_format <= TRUE; new_format++) { FileAccPropList curr_fapl; diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index 572f649..57738d7 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -466,7 +466,7 @@ extern "C" void test_links() { hid_t fapl_id, fapl2_id; /* File access property lists */ - hbool_t new_format; /* Whether to use the new format or not */ + unsigned new_format; /* Whether to use the new format or not */ const char *envval; envval = HDgetenv("HDF5_DRIVER"); diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c index d964bf8..b8946a8 100644 --- a/config/cmake/ConversionTests.c +++ b/config/cmake/ConversionTests.c @@ -1,5 +1,8 @@ #ifdef H5_LDOUBLE_TO_LONG_SPECIAL_TEST +#include <string.h> +#include <stdlib.h> + int main(void) { long double ld = 20041683600089727.779961L; @@ -58,6 +61,9 @@ done: #ifdef H5_LONG_TO_LDOUBLE_SPECIAL_TEST +#include <string.h> +#include <stdlib.h> + int main(void) { long double ld; @@ -117,6 +123,10 @@ done: #endif #ifdef H5_LDOUBLE_TO_LLONG_ACCURATE_TEST + +#include <string.h> +#include <stdlib.h> + int main(void) { long double ld = 20041683600089727.779961L; @@ -156,6 +166,10 @@ done: #endif #ifdef H5_LLONG_TO_LDOUBLE_CORRECT_TEST + +#include <string.h> +#include <stdlib.h> + int main(void) { long double ld; diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index fd3a1d6..ce8219f 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -100,6 +100,9 @@ /* Define if library information should be embedded in the executables */ #cmakedefine H5_HAVE_EMBEDDED_LIBINFO @H5_HAVE_EMBEDDED_LIBINFO@ +/* Define to 1 if you have the `fcntl' function. */ +#cmakedefine H5_HAVE_FCNTL @H5_HAVE_FCNTL@ + /* Define to 1 if you have the <features.h> header file. */ #cmakedefine H5_HAVE_FEATURES_H @H5_HAVE_FEATURES_H@ @@ -109,6 +112,9 @@ /* Define if support for szip filter is enabled */ #cmakedefine H5_HAVE_FILTER_SZIP @H5_HAVE_FILTER_SZIP@ +/* Define to 1 if you have the `flock' function. */ +#cmakedefine H5_HAVE_FLOCK @H5_HAVE_FLOCK@ + /* Define to 1 if you have the `fork' function. */ #cmakedefine H5_HAVE_FORK @H5_HAVE_FORK@ @@ -157,6 +163,9 @@ /* Define to 1 if you have the `gettimeofday' function. */ #cmakedefine H5_HAVE_GETTIMEOFDAY @H5_HAVE_GETTIMEOFDAY@ +/* Define if the compiler understands inline */ +#cmakedefine H5_HAVE_INLINE @H5_HAVE_INLINE@ + /* Define if library will contain instrumentation to detect correct optimization operation */ #cmakedefine H5_HAVE_INSTRUMENTED_LIBRARY @H5_HAVE_INSTRUMENTED_LIBRARY@ @@ -371,6 +380,12 @@ /* Define to 1 if you have the `_scrsize' function. */ #cmakedefine H5_HAVE__SCRSIZE @H5_HAVE__SCRSIZE@ +/* Define if the compiler understands __inline */ +#cmakedefine H5_HAVE___INLINE @H5_HAVE___INLINE@ + +/* Define if the compiler understands __inline__ */ +#cmakedefine H5_HAVE___INLINE__ @H5_HAVE___INLINE__@ + /* Define if HDF5's high-level library headers should be included in hdf5.h */ #cmakedefine H5_INCLUDE_HL @H5_INCLUDE_HL@ @@ -563,6 +578,12 @@ /* The size of `__int64', as computed by sizeof. */ #define H5_SIZEOF___INT64 @H5_SIZEOF___INT64@ +/* Define to 1 if you have the <stdbool.h> header file. */ +#cmakedefine H5_HAVE_STDBOOL_H @H5_HAVE_STDBOOL_H@ + +/* The size of `bool', as computed by sizeof. */ +#cmakedefine H5_SIZEOF_BOOL @H5_SIZEOF_BOOL@ + /* Define to 1 if you have the ANSI C header files. */ #cmakedefine H5_STDC_HEADERS @H5_STDC_HEADERS@ @@ -619,12 +640,6 @@ /* Define to empty if `const' does not conform to ANSI C. */ #cmakedefine H5_const -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#cmakedefine H5_inline @H5_inline@ -#endif - /* Define to `long int' if <sys/types.h> does not define. */ #cmakedefine H5_off_t diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in index c82fcf2..1be5c65 100644 --- a/config/cmake/HDF518_Examples.cmake.in +++ b/config/cmake/HDF518_Examples.cmake.in @@ -1,47 +1,85 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) ############################################################################################################### -# This script will build and run the examples from a compressed file +# This script will build and run the examples from a folder # Execute from a command line: -# ctest -S HDF518_Examples.cmake,HDF5Examples-0.1.1-Source -C Release -VV -O test.log +# ctest -S HDF518_Examples.cmake,OPTION=VALUE -C Release -VV -O test.log ############################################################################################################### -set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -set(STATICLIBRARIES "@H5_ENABLE_STATIC_LIB@") -set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG}) set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) -set(CTEST_BUILD_CONFIGURATION "Release") -#set(NO_MAC_FORTRAN "true") -#set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") -#set(CTEST_USE_TAR_SOURCE "${CTEST_SCRIPT_ARG}") + +# handle input parameters to script. +#INSTALLDIR - HDF5-1.8 root folder +#CTEST_BUILD_CONFIGURATION - Release, Debug, RelWithDebInfo +#CTEST_SOURCE_NAME - name of source folder; HDF4Examples +#STATIC_LIBRARIES - Default is YES +#FORTRAN_LIBRARIES - Default is NO +##NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac) +if(DEFINED CTEST_SCRIPT_ARG) + # transform ctest script arguments of the form + # script.ctest,var1=value1,var2=value2 + # to variables with the respective names set to the respective values + string(REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}") + foreach(current_var ${script_args}) + if ("${current_var}" MATCHES "^([^=]+)=(.+)$") + set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") + endif() + endforeach() +endif() +if(NOT DEFINED INSTALLDIR) + set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") +endif() +if(NOT DEFINED CTEST_BUILD_CONFIGURATION) + set(CTEST_BUILD_CONFIGURATION "Release") +endif() +if(NOT DEFINED CTEST_SOURCE_NAME) + set(CTEST_SOURCE_NAME "HDF5Examples") +endif() +if(NOT DEFINED STATIC_LIBRARIES) + set(STATICLIBRARIES "YES") +endif() +if(NOT DEFINED FORTRAN_LIBRARIES) + set(FORTRANLIBRARIES "NO") +endif() + +#TAR_SOURCE - name of tarfile +#if(NOT DEFINED TAR_SOURCE) +# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.2.1-Source") +#endif() ############################################################################################################### # Adjust the following SET Commands as needed ############################################################################################################### if(WIN32) - if(STATICLIBRARIES) + if(${STATICLIBRARIES}) set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") - endif(STATICLIBRARIES) + endif() set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake") set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") else(WIN32) - if(STATICLIBRARIES) + if(${STATICLIBRARIES}) set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - endif(STATICLIBRARIES) + endif() set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake") set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") endif(WIN32) +if(${FORTRANLIBRARIES}) + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") +else() + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") +endif() +set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") ############################################################################################################### # For any comments please contact cdashhelp@hdfgroup.org # ############################################################################################################### - + #----------------------------------------------------------------------------- # MAC machines need special option #----------------------------------------------------------------------------- @@ -52,14 +90,14 @@ if(APPLE) set(ENV{CC} "${XCODE_CC}") set(ENV{CXX} "${XCODE_CXX}") if(NOT NO_MAC_FORTRAN) - # Shared fortran is not supported, build static + # Shared fortran is not supported, build static set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - else(NOT NO_MAC_FORTRAN) + else() set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") - endif(NOT NO_MAC_FORTRAN) + endif() set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") -endif(APPLE) - +endif() + #----------------------------------------------------------------------------- set(CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") ## -------------------------- @@ -68,28 +106,28 @@ if(CTEST_USE_TAR_SOURCE) ## -------------------------- if(WIN32) message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip]") - execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) - else(WIN32) + execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) + else() message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]") - execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) - endif(WIN32) - + execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) + endif() + if(NOT rv EQUAL 0) message(STATUS "extracting... [error-(${rv}) clean up]") file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") message(FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed") - endif(NOT rv EQUAL 0) + endif() endif(CTEST_USE_TAR_SOURCE) - + #----------------------------------------------------------------------------- ## Clear the build directory ## -------------------------- set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) if (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) -else (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") +else () file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") -endif (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") +endif () # Use multiple CPU cores to build include(ProcessorCount) @@ -97,17 +135,17 @@ ProcessorCount(N) if(NOT N EQUAL 0) if(NOT WIN32) set(CTEST_BUILD_FLAGS -j${N}) - endif(NOT WIN32) + endif() set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) endif() set (CTEST_CONFIGURE_COMMAND "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" ) - + #----------------------------------------------------------------------------- ## -- set output to english set($ENV{LC_MESSAGES} "en_EN") - + #----------------------------------------------------------------------------- configure_file(${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") @@ -115,11 +153,20 @@ ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") ## -------------------------- ctest_start (Experimental) ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}") +if(LOCAL_SUBMIT) + ctest_submit (PARTS Configure Notes) +endif() ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) +if(LOCAL_SUBMIT) + ctest_submit (PARTS Build) +endif() ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) +if(LOCAL_SUBMIT) + ctest_submit (PARTS Test) +endif() if(res GREATER 0) message (FATAL_ERROR "tests FAILED") -endif(res GREATER 0) +endif() #----------------------------------------------------------------------------- -############################################################################################################## -message(STATUS "DONE") +############################################################################################################## +message(STATUS "DONE")
\ No newline at end of file diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 8ca10a7..c3e5a24 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -217,9 +217,9 @@ list(GET PROG_OUTPUT 4 NUM_RKIND) set(H5CONFIG_F_NUM_IKIND "INTEGER, PARAMETER :: num_ikinds = ${NUM_IKIND}") set(H5CONFIG_F_IKIND "INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/${pac_validIntKinds}/)") -message ( " ........REAL KINDS FOUND ${PAC_FC_ALL_REAL_KINDS}") -message ( " ........INTEGER KINDS FOUND ${PAC_FC_ALL_REAL_KINDS}") -message ( " ........MAX DECIMAL PRECISION ${H5_PAC_FC_MAX_REAL_PRECISION}") +message (STATUS "....REAL KINDS FOUND ${PAC_FC_ALL_REAL_KINDS}") +message (STATUS "....INTEGER KINDS FOUND ${PAC_FC_ALL_REAL_KINDS}") +message (STATUS "....MAX DECIMAL PRECISION ${H5_PAC_FC_MAX_REAL_PRECISION}") #----------------------------------------------------------------------------- # Determine the available KINDs for REALs and INTEGERs @@ -258,7 +258,7 @@ string(REGEX REPLACE " " "" pack_int_sizeof "${pack_int_sizeof}") set(PAC_FC_ALL_INTEGER_KINDS_SIZEOF "\{${pack_int_sizeof}\}") -message("...FOUND SIZEOF for INTEGER KINDs ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF}") +message(STATUS "....FOUND SIZEOF for INTEGER KINDs ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF}") # ********** # REALS # ********** @@ -297,7 +297,7 @@ string(REGEX REPLACE " " "" pack_real_sizeof "${pack_real_sizeof}") set(H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${pack_real_sizeof}/)") -message("...FOUND SIZEOF for REAL KINDs \{${pack_real_sizeof}\}") +message(STATUS "....FOUND SIZEOF for REAL KINDs \{${pack_real_sizeof}\}") set(PAC_FC_ALL_REAL_KINDS_SIZEOF "\{${pack_real_sizeof}\}") diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index 65e2e9e..40e2b32 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -7,14 +7,14 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) -#set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") # handle input parameters to script. #INSTALLDIR - HDF5 root folder #CTEST_BUILD_CONFIGURATION - Release, Debug, RelWithDebInfo #CTEST_SOURCE_NAME - name of source folder; HDF4Examples -#STATICLIBRARIES - Default is YES -#NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac) +#STATIC_LIBRARIES - Default is YES +#FORTRAN_LIBRARIES - Default is NO +##NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac) if(DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form # script.ctest,var1=value1,var2=value2 @@ -35,9 +35,12 @@ endif() if(NOT DEFINED CTEST_SOURCE_NAME) set(CTEST_SOURCE_NAME "HDF5Examples") endif() -if(NOT DEFINED STATICLIBRARIES) +if(NOT DEFINED STATIC_LIBRARIES) set(STATICLIBRARIES "YES") endif() +if(NOT DEFINED FORTRAN_LIBRARIES) + set(FORTRANLIBRARIES "NO") +endif() #TAR_SOURCE - name of tarfile #if(NOT DEFINED TAR_SOURCE) @@ -48,23 +51,29 @@ endif() # Adjust the following SET Commands as needed ############################################################################################################### if(WIN32) - if(STATICLIBRARIES) + if(${STATICLIBRARIES}) set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") - endif(STATICLIBRARIES) + endif() set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake") set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") else(WIN32) - if(STATICLIBRARIES) + if(${STATICLIBRARIES}) set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - endif(STATICLIBRARIES) + endif() set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake") set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") endif(WIN32) +if(${FORTRANLIBRARIES}) + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") +else() + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") +endif() +set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") ############################################################################################################### # For any comments please contact cdashhelp@hdfgroup.org @@ -83,11 +92,11 @@ if(APPLE) if(NOT NO_MAC_FORTRAN) # Shared fortran is not supported, build static set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - else(NOT NO_MAC_FORTRAN) + else() set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") - endif(NOT NO_MAC_FORTRAN) + endif() set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") -endif(APPLE) +endif() #----------------------------------------------------------------------------- set(CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") @@ -107,7 +116,7 @@ if(CTEST_USE_TAR_SOURCE) message(STATUS "extracting... [error-(${rv}) clean up]") file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") message(FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed") - endif(NOT rv EQUAL 0) + endif() endif(CTEST_USE_TAR_SOURCE) #----------------------------------------------------------------------------- @@ -116,9 +125,9 @@ endif(CTEST_USE_TAR_SOURCE) set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) if (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) -else (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") +else () file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") -endif (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") +endif () # Use multiple CPU cores to build include(ProcessorCount) @@ -126,7 +135,7 @@ ProcessorCount(N) if(NOT N EQUAL 0) if(NOT WIN32) set(CTEST_BUILD_FLAGS -j${N}) - endif(NOT WIN32) + endif() set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) endif() set (CTEST_CONFIGURE_COMMAND @@ -144,11 +153,20 @@ ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") ## -------------------------- ctest_start (Experimental) ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}") +if(LOCAL_SUBMIT) + ctest_submit (PARTS Configure Notes) +endif() ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) +if(LOCAL_SUBMIT) + ctest_submit (PARTS Build) +endif() ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) +if(LOCAL_SUBMIT) + ctest_submit (PARTS Test) +endif() if(res GREATER 0) message (FATAL_ERROR "tests FAILED") -endif(res GREATER 0) +endif() #----------------------------------------------------------------------------- ############################################################################################################## message(STATUS "DONE")
\ No newline at end of file diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index c637c73..665db32 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -16,12 +16,12 @@ if (CMAKE_COMPILER_IS_GNUCC) endif (CMAKE_COMPILER_IS_GNUCC) if (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_BUILD_TYPE MATCHES Debug) - set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS} -std=c99") + set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common") endif () else (CMAKE_BUILD_TYPE MATCHES Debug) - set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS} -std=c99") + set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstdarg-opt") endif () diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index 9d0953e..403eedd 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -56,6 +56,13 @@ if(APPLE) set(ENV{CC} "${XCODE_CC}")
set(ENV{CXX} "${XCODE_CXX}")
+ if(NOT NO_MAC_FORTRAN)
+ # Shared fortran is not supported, build static
+ set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC")
+ else(NOT NO_MAC_FORTRAN)
+ set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF")
+ endif(NOT NO_MAC_FORTRAN)
+
set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF")
endif(APPLE)
@@ -66,13 +73,13 @@ if(CTEST_USE_TAR_SOURCE) ## Uncompress source if tar file provided
## --------------------------
if(WIN32)
- message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} x ${CTEST_USE_TAR_SOURCE}.zip]")
+ message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} x ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip]")
execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv)
else()
- message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]")
+ message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar]")
execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv)
endif()
-
+
if(NOT rv EQUAL 0)
message(STATUS "extracting... [error-(${rv}) clean up]")
file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}")
@@ -159,12 +166,23 @@ endif() #-----------------------------------------------------------------------------
# Send the main script as a note.
-list(APPEND CTEST_NOTES_FILES
- "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}"
- "${CMAKE_CURRENT_LIST_FILE}"
- "${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake"
-)
-
+if(USE_AUTOTOOLS)
+ ## autotools builds need to use make and does not use the cacheinit.cmake file
+ ## -- make command
+ ## -----------------
+ find_program(MAKE NAMES make)
+ list(APPEND CTEST_NOTES_FILES
+ "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}"
+ "${CMAKE_CURRENT_LIST_FILE}"
+ )
+else()
+ list(APPEND CTEST_NOTES_FILES
+ "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}"
+ "${CMAKE_CURRENT_LIST_FILE}"
+ "${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake"
+ )
+endif()
+
#-----------------------------------------------------------------------------
# Check for required variables.
# --------------------------
@@ -181,20 +199,27 @@ endforeach(req) #-----------------------------------------------------------------------------
# Initialize the CTEST commands
#------------------------------
-if(LOCAL_MEMCHECK_TEST)
- find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
- set (CTEST_CONFIGURE_COMMAND
- "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
- )
-else()
- if(LOCAL_COVERAGE_TEST)
- find_program(CTEST_COVERAGE_COMMAND NAMES gcov)
+if(USE_AUTOTOOLS)
+ set(CTEST_CONFIGURE_COMMAND "${CTEST_SOURCE_DIRECTORY}/configure ${ADD_BUILD_OPTIONS}")
+ set(CTEST_BUILD_COMMAND "${MAKE} ${CTEST_BUILD_FLAGS}")
+ configure_file(${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake)
+ file(WRITE ${CTEST_BINARY_DIRECTORY}/CTestTestfile.cmake "ADD_TEST(makecheck \"${MAKE}\" \"${CTEST_BUILD_FLAGS}\" \"-i\" \"check\")")
+else(USE_AUTOTOOLS)
+ if(LOCAL_MEMCHECK_TEST)
+ find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
+ set (CTEST_CONFIGURE_COMMAND
+ "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
+ )
+ else()
+ if(LOCAL_COVERAGE_TEST)
+ find_program(CTEST_COVERAGE_COMMAND NAMES gcov)
+ endif()
+ set (CTEST_CONFIGURE_COMMAND
+ "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
+ )
endif()
- set (CTEST_CONFIGURE_COMMAND
- "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
- )
endif()
-
+
#-----------------------------------------------------------------------------
## -- set output to english
set($ENV{LC_MESSAGES} "en_EN")
diff --git a/config/cmake/scripts/HDF518config.cmake b/config/cmake/scripts/HDF5config.cmake index 897bcbe..8bcc56b 100755 --- a/config/cmake/scripts/HDF518config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -1,8 +1,8 @@ -##########################################################################################
-### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ###
-### BUILD_GENERATOR required [Unix, VS2013, VS201364, VS2012, VS201264] ###
-### ctest -S HDF518config.cmake,BUILD_GENERATOR=VS201264 -C Release -V -O hdf518.log ###
-##########################################################################################
+#############################################################################################
+### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ###
+### BUILD_GENERATOR required [Unix, VS2015, VS201564, VS2013, VS201364, VS2012, VS201264] ###
+### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201264 -C Release -V -O hdf519.log ###
+#############################################################################################
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
############################################################################
@@ -11,6 +11,8 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # where valid options for OPTION are:
# BUILD_GENERATOR - The cmake build generator:
# Unix * Unix Makefiles
+# VS2015 * Visual Studio 14 2015
+# VS201564 * Visual Studio 14 2015 Win64
# VS2013 * Visual Studio 12 2013
# VS201364 * Visual Studio 12 2013 Win64
# VS2012 * Visual Studio 11 2012
@@ -19,11 +21,13 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # INSTALLDIR - root folder where hdf5 is installed
# CTEST_BUILD_CONFIGURATION - Release, Debug, etc
# CTEST_SOURCE_NAME - source folder
-# STATICLIBRARIES - Build/use static libraries
+# STATIC_LIBRARIES - Build/use static libraries
+# FORTRAN_LIBRARIES - Build/use fortran libraries
# NO_MAC_FORTRAN - Yes to be SHARED on a Mac
##############################################################################
set(CTEST_SOURCE_VERSION 1.9)
+set(CTEST_SOURCE_VERSEXT "")
##############################################################################
# handle input parameters to script.
@@ -31,7 +35,8 @@ set(CTEST_SOURCE_VERSION 1.9) #INSTALLDIR - HDF5-1.9 root folder
#CTEST_BUILD_CONFIGURATION - Release, Debug, RelWithDebInfo
#CTEST_SOURCE_NAME - name of source folder; HDF5-1.9
-#STATICLIBRARIES - Default is YES
+#STATIC_LIBRARIES - Default is YES
+#FORTRAN_LIBRARIES - Default is NO
#NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac
if(DEFINED CTEST_SCRIPT_ARG)
# transform ctest script arguments of the form
@@ -47,28 +52,32 @@ endif() # build generator must be defined
if(NOT DEFINED BUILD_GENERATOR)
- message(FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2013, VS201364, VS2012, or VS201264")
+ message(FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264")
else()
if(${BUILD_GENERATOR} STREQUAL "Unix")
- set(CMAKE_GENERATOR "Unix Makefiles")
+ set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
+ elseif(${BUILD_GENERATOR} STREQUAL "VS2015")
+ set(CTEST_CMAKE_GENERATOR "Visual Studio 14 2015")
+ elseif(${BUILD_GENERATOR} STREQUAL "VS201564")
+ set(CTEST_CMAKE_GENERATOR "Visual Studio 14 2015 Win64")
elseif(${BUILD_GENERATOR} STREQUAL "VS2013")
- set(CMAKE_GENERATOR "Visual Studio 12 2013")
+ set(CTEST_CMAKE_GENERATOR "Visual Studio 12 2013")
elseif(${BUILD_GENERATOR} STREQUAL "VS201364")
- set(CMAKE_GENERATOR "Visual Studio 12 2013 Win64")
+ set(CTEST_CMAKE_GENERATOR "Visual Studio 12 2013 Win64")
elseif(${BUILD_GENERATOR} STREQUAL "VS2012")
- set(CMAKE_GENERATOR "Visual Studio 11 2012")
+ set(CTEST_CMAKE_GENERATOR "Visual Studio 11 2012")
elseif(${BUILD_GENERATOR} STREQUAL "VS201264")
- set(CMAKE_GENERATOR "Visual Studio 11 2012 Win64")
+ set(CTEST_CMAKE_GENERATOR "Visual Studio 11 2012 Win64")
else()
- message(FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2013, VS201364, VS2012, or VS201264")
+ message(FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264")
endif()
endif()
if(NOT DEFINED INSTALLDIR)
if(WIN32)
- set(INSTALLDIR "/usr/local/myhdf5")
- else()
set(INSTALLDIR "C:\\Program\ Files\\myhdf5")
+ else()
+ set(INSTALLDIR "/usr/local/myhdf5")
endif()
endif()
if(NOT DEFINED CTEST_BUILD_CONFIGURATION)
@@ -77,10 +86,10 @@ endif() if(NOT DEFINED CTEST_SOURCE_NAME)
set(CTEST_SOURCE_NAME "hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}")
endif()
-if(NOT DEFINED STATICLIBRARIES)
+if(NOT DEFINED STATIC_LIBRARIES)
set(STATICLIBRARIES "YES")
endif()
-if(NOT DEFINED FORTRANLIBRARIES)
+if(NOT DEFINED FORTRAN_LIBRARIES)
set(FORTRANLIBRARIES "NO")
endif()
@@ -99,7 +108,15 @@ endif() if(WIN32)
set(SITE_OS_NAME "Windows")
set(SITE_OS_VERSION "WIN7")
- if(${BUILD_GENERATOR} STREQUAL "VS201364")
+ if(${BUILD_GENERATOR} STREQUAL "VS201564")
+ set(SITE_OS_BITS "64")
+ set(SITE_COMPILER_NAME "vs2015")
+ set(SITE_COMPILER_VERSION "14")
+ elseif(${BUILD_GENERATOR} STREQUAL "VS2015")
+ set(SITE_OS_BITS "32")
+ set(SITE_COMPILER_NAME "vs2015")
+ set(SITE_COMPILER_VERSION "14")
+ elseif(${BUILD_GENERATOR} STREQUAL "VS201364")
set(SITE_OS_BITS "64")
set(SITE_COMPILER_NAME "vs2013")
set(SITE_COMPILER_VERSION "12")
@@ -155,12 +172,12 @@ set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/trunk") #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ")
###################################################################
-if(STATICLIBRARIES)
+if(${STATICLIBRARIES})
set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF")
######### Following describes computer ############
## following is optional to describe build ##
set(SITE_BUILDNAME_SUFFIX "STATIC")
-endif(STATICLIBRARIES)
+endif()
###################################################################
### uncomment/comment and change the following lines for other configuration options
@@ -178,11 +195,11 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF")
#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF")
#### fortran ####
-if(FORTRANLIBRARIES)
- set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON")
- ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN
- set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=ON")
-endif(FORTRANLIBRARIES)
+if(${FORTRANLIBRARIES})
+ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON")
+else()
+ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF")
+endif()
### disable test program builds
#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF")
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 6885187..cfda66b 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -31,13 +31,13 @@ if (APPLE) endif (APPLE) # Check for Darwin (not just Apple - we also want to catch OpenDarwin) -if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set (${HDF_PREFIX}_HAVE_DARWIN 1) +if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set (${HDF_PREFIX}_HAVE_DARWIN 1) endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # Check for Solaris -if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - set (${HDF_PREFIX}_HAVE_SOLARIS 1) +if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + set (${HDF_PREFIX}_HAVE_SOLARIS 1) endif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") #----------------------------------------------------------------------------- @@ -141,10 +141,6 @@ MACRO (HDF_FUNCTION_TEST OTHER_TEST) set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") endif (CMAKE_REQUIRED_LIBRARIES) - foreach (def ${HDF_EXTRA_TEST_DEFINITIONS}) - set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}=${${def}}") - endforeach (def) - foreach (def HAVE_SYS_TIME_H HAVE_UNISTD_H @@ -266,27 +262,23 @@ set (LINUX_LFS 0) set (HDF_EXTRA_C_FLAGS) set (HDF_EXTRA_FLAGS) if (NOT WINDOWS) - if (NOT ${HDF_PREFIX}_HAVE_SOLARIS) + # Might want to check explicitly for Linux and possibly Cygwin + # instead of checking for not Solaris or Darwin. + if (NOT ${HDF_PREFIX}_HAVE_SOLARIS AND NOT ${HDF_PREFIX}_HAVE_DARWIN) # Linux Specific flags # This was originally defined as _POSIX_SOURCE which was updated to # _POSIX_C_SOURCE=199506L to expose a greater amount of POSIX # functionality so clock_gettime and CLOCK_MONOTONIC are defined - # correctly. + # correctly. This was later updated to 200112L so that + # posix_memalign() is visible for the direct VFD code on Linux + # systems. # POSIX feature information can be found in the gcc manual at: # http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html - set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=199506L) - # _BSD_SOURCE deprecated in GLIBC >= 2.20 - TRY_RUN (HAVE_DEFAULT_SOURCE_RUN HAVE_DEFAULT_SOURCE_COMPILE - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DHAVE_DEFAULT_SOURCE - OUTPUT_VARIABLE OUTPUT - ) - if (HAVE_DEFAULT_SOURCE_COMPILE AND HAVE_DEFAULT_SOURCE_RUN) - set (HDF_EXTRA_FLAGS -D_DEFAULT_SOURCE) - else (HAVE_DEFAULT_SOURCE_COMPILE AND HAVE_DEFAULT_SOURCE_RUN) - set (HDF_EXTRA_FLAGS -D_BSD_SOURCE) - endif (HAVE_DEFAULT_SOURCE_COMPILE AND HAVE_DEFAULT_SOURCE_RUN) + set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200112L) + + # Need to add this so that O_DIRECT is visible for the direct + # VFD on Linux systems. + set (HDF_EXTRA_C_FLAGS -D_GNU_SOURCE) option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON) if (HDF_ENABLE_LARGE_FILE) @@ -297,6 +289,11 @@ if (NOT WINDOWS) CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DTEST_LFS_WORKS OUTPUT_VARIABLE OUTPUT ) + + # The LARGEFILE definitions were from the transition period + # and are probably no longer needed. The FILE_OFFSET_BITS + # check should be generalized for all POSIX systems as it + # is in the Autotools. if (TEST_LFS_WORKS_COMPILE) if (TEST_LFS_WORKS_RUN MATCHES 0) set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg}) @@ -319,7 +316,7 @@ if (NOT WINDOWS) endif (TEST_LFS_WORKS_COMPILE) endif (HDF_ENABLE_LARGE_FILE) set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF_EXTRA_FLAGS}) - endif (NOT ${HDF_PREFIX}_HAVE_SOLARIS) + endif (NOT ${HDF_PREFIX}_HAVE_SOLARIS AND NOT ${HDF_PREFIX}_HAVE_DARWIN) endif (NOT WINDOWS) add_definitions (${HDF_EXTRA_FLAGS}) @@ -422,6 +419,19 @@ if (NOT ${HDF_PREFIX}_SIZEOF_OFF64_T) set (${HDF_PREFIX}_SIZEOF_OFF64_T 0) endif (NOT ${HDF_PREFIX}_SIZEOF_OFF64_T) +#----------------------------------------------------------------------------- +# Extra C99 types +#----------------------------------------------------------------------------- + +# _Bool type support +CHECK_INCLUDE_FILE_CONCAT (stdbool.h ${HDF_PREFIX}_HAVE_STDBOOL_H) +if (HAVE_STDBOOL_H) + set (CMAKE_EXTRA_INCLUDE_FILES stdbool.h) + HDF_CHECK_TYPE_SIZE (bool ${HDF_PREFIX}_SIZEOF_BOOL) +else (HAVE_STDBOOL_H) + HDF_CHECK_TYPE_SIZE (_Bool ${HDF_PREFIX}_SIZEOF_BOOL) +endif (HAVE_STDBOOL_H) + if (NOT WINDOWS) #----------------------------------------------------------------------------- # Check if the dev_t type is a scalar type @@ -437,6 +447,7 @@ if (NOT WINDOWS) #----------------------------------------------------------------------------- # Check a bunch of time functions #----------------------------------------------------------------------------- + CHECK_FUNCTION_EXISTS (gettimeofday ${HDF_PREFIX}_HAVE_GETTIMEOFDAY) foreach (test HAVE_TM_GMTOFF HAVE___TM_GMTOFF @@ -479,6 +490,8 @@ endif (NOT WINDOWS) # Check for some functions that are used # CHECK_FUNCTION_EXISTS (alarm ${HDF_PREFIX}_HAVE_ALARM) +CHECK_FUNCTION_EXISTS (fcntl ${HDF_PREFIX}_HAVE_FCNTL) +CHECK_FUNCTION_EXISTS (flock ${HDF_PREFIX}_HAVE_FLOCK) CHECK_FUNCTION_EXISTS (fork ${HDF_PREFIX}_HAVE_FORK) CHECK_FUNCTION_EXISTS (frexpf ${HDF_PREFIX}_HAVE_FREXPF) CHECK_FUNCTION_EXISTS (frexpl ${HDF_PREFIX}_HAVE_FREXPL) @@ -556,10 +569,6 @@ MACRO (HDF_CXX_FUNCTION_TEST OTHER_TEST) set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") endif (CMAKE_REQUIRED_LIBRARIES) - foreach (def ${HDF_EXTRA_TEST_DEFINITIONS}) - set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}=${${def}}") - endforeach (def) - foreach (def HAVE_SYS_TIME_H HAVE_UNISTD_H @@ -626,7 +635,7 @@ if (WINDOWS) "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" ) endif (LARGEFILE) - set (MACRO_CHECK_FUNCTION_DEFINITIONS + set (MACRO_CHECK_FUNCTION_DEFINITIONS "-DHAVE_IOEO ${CMAKE_REQUIRED_FLAGS}") if (CMAKE_REQUIRED_LIBRARIES) set (CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES @@ -658,7 +667,7 @@ if (WINDOWS) if ("${HAVE_IOEO_EXITCODE}" EQUAL 0) set (${HDF_PREFIX}_HAVE_IOEO 1 CACHE INTERNAL "Test InitOnceExecuteOnce") message (STATUS "Performing Test InitOnceExecuteOnce - Success") - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C SOURCE FILE Test InitOnceExecuteOnce succeded with the following output:\n" "${OUTPUT}\n" "Return value: ${HAVE_IOEO}\n") @@ -670,7 +679,7 @@ if (WINDOWS) endif (CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") message (STATUS "Performing Test InitOnceExecuteOnce - Failed") - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing InitOnceExecuteOnce Test failed with the following output:\n" "${OUTPUT}\n" "Return value: ${HAVE_IOEO_EXITCODE}\n") @@ -682,60 +691,45 @@ endif (WINDOWS) #----------------------------------------------------------------------------- # Determine how 'inline' is used #----------------------------------------------------------------------------- -set (HDF_EXTRA_TEST_DEFINITIONS INLINE_TEST_INLINE) foreach (inline_test inline __inline__ __inline) - set (INLINE_TEST_INLINE ${inline_test}) - HDF_FUNCTION_TEST (INLINE_TEST_${inline_test}) + string (TOUPPER ${inline_test} INLINE_TEST_MACRO) + HDF_FUNCTION_TEST (HAVE_${INLINE_TEST_MACRO}) endforeach (inline_test) -set (HDF_EXTRA_TEST_DEFINITIONS) -if (INLINE_TEST___inline__) - set (${HDF_PREFIX}_inline __inline__) -else (INLINE_TEST___inline__) - if (INLINE_TEST___inline) - set (${HDF_PREFIX}_inline __inline) - else (INLINE_TEST___inline) - if (INLINE_TEST_inline) - set (${HDF_PREFIX}_inline inline) - endif (INLINE_TEST_inline) - endif (INLINE_TEST___inline) -endif (INLINE_TEST___inline__) - #----------------------------------------------------------------------------- # Check how to print a Long Long integer #----------------------------------------------------------------------------- if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES "unknown") set (PRINT_LL_FOUND 0) message (STATUS "Checking for appropriate format for 64 bit long:") - foreach (HDF5_PRINTF_LL l64 l L q I64 ll) - set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH=${HDF5_PRINTF_LL}") - if (${HDF_PREFIX}_SIZEOF_LONG_LONG) - set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") - endif (${HDF_PREFIX}_SIZEOF_LONG_LONG) - TRY_RUN (HDF5_PRINTF_LL_TEST_RUN HDF5_PRINTF_LL_TEST_COMPILE - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS} - OUTPUT_VARIABLE OUTPUT + set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH") + if (${HDF_PREFIX}_SIZEOF_LONG_LONG) + set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") + endif (${HDF_PREFIX}_SIZEOF_LONG_LONG) + TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_EXT_DIR}/HDFTests.c + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS} + OUTPUT_VARIABLE OUTPUT + ) + if (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) + if (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) + string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}") + set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") + set (PRINT_LL_FOUND 1) + else (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) + message ("Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}") + endif (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) + else (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) + file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed with the following output:\n ${OUTPUT}\n" ) - if (HDF5_PRINTF_LL_TEST_COMPILE) - if (HDF5_PRINTF_LL_TEST_RUN MATCHES 0) - set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${HDF5_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") - set (PRINT_LL_FOUND 1) - else (HDF5_PRINTF_LL_TEST_RUN MATCHES 0) - message ("Width with ${HDF5_PRINTF_LL} failed with result: ${HDF5_PRINTF_LL_TEST_RUN}") - endif (HDF5_PRINTF_LL_TEST_RUN MATCHES 0) - else (HDF5_PRINTF_LL_TEST_COMPILE) - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH for ${HDF5_PRINTF_LL} failed with the following output:\n ${OUTPUT}\n" - ) - endif (HDF5_PRINTF_LL_TEST_COMPILE) - endforeach (HDF5_PRINTF_LL) + endif (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) if (PRINT_LL_FOUND) - message (STATUS "Checking for apropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}") + message (STATUS "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}") else (PRINT_LL_FOUND) - message (STATUS "Checking for apropriate format for 64 bit long: not found") + message (STATUS "Checking for appropriate format for 64 bit long: not found") set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll" ) diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake index 7660a8a..3f91405 100644 --- a/config/cmake_ext_mod/HDFLibMacros.cmake +++ b/config/cmake_ext_mod/HDFLibMacros.cmake @@ -1,12 +1,12 @@ #------------------------------------------------------------------------------- -MACRO (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) +macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) # May need to build JPEG with PIC on x64 machines with gcc # Need to use CMAKE_ANSI_CFLAGS define so that compiler test works if (${compress_type} MATCHES "SVN") EXTERNALPROJECT_ADD (JPEG SVN_REPOSITORY ${JPEG_URL} - # [SVN_REVISION rev] + # [SVN_REVISION rev] INSTALL_COMMAND "" CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} @@ -18,7 +18,7 @@ MACRO (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} - ) + ) elseif (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (JPEG GIT_REPOSITORY ${JPEG_URL} @@ -33,7 +33,7 @@ MACRO (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} - ) + ) elseif (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (JPEG URL ${JPEG_URL} @@ -49,34 +49,34 @@ MACRO (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} - ) + ) endif (${compress_type} MATCHES "SVN") - externalproject_get_property (JPEG BINARY_DIR SOURCE_DIR) + externalproject_get_property (JPEG BINARY_DIR SOURCE_DIR) -##include (${BINARY_DIR}/${JPEG_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) +##include (${BINARY_DIR}/${JPEG_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) # Create imported target jpeg-static add_library(jpeg-static STATIC IMPORTED) -# Create imported target jpeg-shared - add_library(jpeg-shared SHARED IMPORTED) - if (BUILD_SHARED_LIBS) - HDF_IMPORT_SET_LIB_OPTIONS (jpeg-shared "jpeg" SHARED "") - add_dependencies (JPEG jpeg-shared) - set (JPEG_SHARED_LIBRARY "jpeg-shared") - set (JPEG_LIBRARIES ${JPEG_shared_LIBRARY}) - endif (BUILD_SHARED_LIBS) HDF_IMPORT_SET_LIB_OPTIONS (jpeg-static "jpeg" STATIC "") add_dependencies (JPEG jpeg-static) set (JPEG_STATIC_LIBRARY "jpeg-static") set (JPEG_LIBRARIES ${JPEG_static_LIBRARY}) - + if (BUILD_SHARED_LIBS) + # Create imported target jpeg-shared + add_library(jpeg-shared SHARED IMPORTED) + HDF_IMPORT_SET_LIB_OPTIONS (jpeg-shared "jpeg" SHARED "") + add_dependencies (JPEG jpeg-shared) + set (JPEG_SHARED_LIBRARY "jpeg-shared") + set (JPEG_LIBRARIES ${JPEG_LIBRARIES} ${JPEG_shared_LIBRARY}) + endif (BUILD_SHARED_LIBS) + set (JPEG_INCLUDE_DIR_GEN "${BINARY_DIR}") set (JPEG_INCLUDE_DIR "${SOURCE_DIR}/src") set (JPEG_FOUND 1) set (JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIR_GEN} ${JPEG_INCLUDE_DIR}) -ENDMACRO (EXTERNAL_JPEG_LIBRARY) +endmacro (EXTERNAL_JPEG_LIBRARY) #------------------------------------------------------------------------------- -MACRO (PACKAGE_JPEG_LIBRARY compress_type) +macro (PACKAGE_JPEG_LIBRARY compress_type) add_custom_target (JPEG-GenHeader-Copy ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different ${JPEG_INCLUDE_DIR_GEN}/jconfig.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ COMMENT "Copying ${JPEG_INCLUDE_DIR_GEN}/jconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" @@ -85,14 +85,14 @@ MACRO (PACKAGE_JPEG_LIBRARY compress_type) if (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") add_dependencies (JPEG-GenHeader-Copy JPEG) endif (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") -ENDMACRO (PACKAGE_JPEG_LIBRARY) +endmacro (PACKAGE_JPEG_LIBRARY) #------------------------------------------------------------------------------- -MACRO (EXTERNAL_SZIP_LIBRARY compress_type encoding) +macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) if (${compress_type} MATCHES "SVN") EXTERNALPROJECT_ADD (SZIP SVN_REPOSITORY ${SZIP_URL} - # [SVN_REVISION rev] + # [SVN_REVISION rev] INSTALL_COMMAND "" CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} @@ -105,11 +105,11 @@ MACRO (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} - ) + ) elseif (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (SZIP GIT_REPOSITORY ${SZIP_URL} - # [SVN_REVISION rev] + # [SVN_REVISION rev] INSTALL_COMMAND "" CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} @@ -122,7 +122,7 @@ MACRO (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} - ) + ) elseif (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (SZIP URL ${SZIP_URL} @@ -139,34 +139,34 @@ MACRO (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} - ) + ) endif (${compress_type} MATCHES "SVN") - externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR) + externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR) -##include (${BINARY_DIR}/${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) +##include (${BINARY_DIR}/${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) # Create imported target szip-static add_library(szip-static STATIC IMPORTED) -# Create imported target szip-shared - add_library(szip-shared SHARED IMPORTED) - if (BUILD_SHARED_LIBS) - HDF_IMPORT_SET_LIB_OPTIONS (szip-shared "szip" SHARED "") - add_dependencies (SZIP szip-shared) - set (SZIP_SHARED_LIBRARY "szip-shared") - set (SZIP_LIBRARIES ${SZIP_shared_LIBRARY}) - endif (BUILD_SHARED_LIBS) HDF_IMPORT_SET_LIB_OPTIONS (szip-static "szip" STATIC "") add_dependencies (SZIP szip-static) set (SZIP_STATIC_LIBRARY "szip-static") set (SZIP_LIBRARIES ${SZIP_static_LIBRARY}) + if (BUILD_SHARED_LIBS) + # Create imported target szip-shared + add_library(szip-shared SHARED IMPORTED) + HDF_IMPORT_SET_LIB_OPTIONS (szip-shared "szip" SHARED "") + add_dependencies (SZIP szip-shared) + set (SZIP_SHARED_LIBRARY "szip-shared") + set (SZIP_LIBRARIES ${SZIP_LIBRARIES} ${SZIP_shared_LIBRARY}) + endif (BUILD_SHARED_LIBS) set (SZIP_INCLUDE_DIR_GEN "${BINARY_DIR}") set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/src") set (SZIP_FOUND 1) set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR}) -ENDMACRO (EXTERNAL_SZIP_LIBRARY) +endmacro (EXTERNAL_SZIP_LIBRARY) #------------------------------------------------------------------------------- -MACRO (PACKAGE_SZIP_LIBRARY compress_type) +macro (PACKAGE_SZIP_LIBRARY compress_type) add_custom_target (SZIP-GenHeader-Copy ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ COMMENT "Copying ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" @@ -175,14 +175,14 @@ MACRO (PACKAGE_SZIP_LIBRARY compress_type) if (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") add_dependencies (SZIP-GenHeader-Copy SZIP) endif (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") -ENDMACRO (PACKAGE_SZIP_LIBRARY) +endmacro (PACKAGE_SZIP_LIBRARY) #------------------------------------------------------------------------------- -MACRO (EXTERNAL_ZLIB_LIBRARY compress_type) +macro (EXTERNAL_ZLIB_LIBRARY compress_type) if (${compress_type} MATCHES "SVN") EXTERNALPROJECT_ADD (ZLIB SVN_REPOSITORY ${ZLIB_URL} - # [SVN_REVISION rev] + # [SVN_REVISION rev] INSTALL_COMMAND "" CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} @@ -194,11 +194,11 @@ MACRO (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} - ) + ) elseif (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (ZLIB GIT_REPOSITORY ${ZLIB_URL} - # [SVN_REVISION rev] + # [SVN_REVISION rev] INSTALL_COMMAND "" CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} @@ -210,7 +210,7 @@ MACRO (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} - ) + ) elseif (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (ZLIB URL ${ZLIB_URL} @@ -226,39 +226,39 @@ MACRO (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} - ) + ) endif (${compress_type} MATCHES "SVN") - externalproject_get_property (ZLIB BINARY_DIR SOURCE_DIR) + externalproject_get_property (ZLIB BINARY_DIR SOURCE_DIR) if (WIN32) set (ZLIB_LIB_NAME "zlib") else (WIN32) set (ZLIB_LIB_NAME "z") endif (WIN32) -##include (${BINARY_DIR}/${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) +##include (${BINARY_DIR}/${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) # Create imported target zlib-static add_library(zlib-static STATIC IMPORTED) -# Create imported target zlib-shared - add_library(zlib-shared SHARED IMPORTED) - if (BUILD_SHARED_LIBS) - HDF_IMPORT_SET_LIB_OPTIONS (zlib-shared ${ZLIB_LIB_NAME} SHARED "") - add_dependencies (ZLIB zlib-shared) - set (ZLIB_SHARED_LIBRARY "zlib-shared") - set (ZLIB_LIBRARIES ${ZLIB_SHARED_LIBRARY}) - endif (BUILD_SHARED_LIBS) HDF_IMPORT_SET_LIB_OPTIONS (zlib-static ${ZLIB_LIB_NAME} STATIC "") add_dependencies (ZLIB zlib-static) set (ZLIB_STATIC_LIBRARY "zlib-static") set (ZLIB_LIBRARIES ${ZLIB_static_LIBRARY}) + if (BUILD_SHARED_LIBS) + # Create imported target zlib-shared + add_library(zlib-shared SHARED IMPORTED) + HDF_IMPORT_SET_LIB_OPTIONS (zlib-shared ${ZLIB_LIB_NAME} SHARED "") + add_dependencies (ZLIB zlib-shared) + set (ZLIB_SHARED_LIBRARY "zlib-shared") + set (ZLIB_LIBRARIES ${ZLIB_LIBRARIES} ${ZLIB_SHARED_LIBRARY}) + endif (BUILD_SHARED_LIBS) set (ZLIB_INCLUDE_DIR_GEN "${BINARY_DIR}") set (ZLIB_INCLUDE_DIR "${SOURCE_DIR}") set (ZLIB_FOUND 1) set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR_GEN} ${ZLIB_INCLUDE_DIR}) -ENDMACRO (EXTERNAL_ZLIB_LIBRARY) +endmacro (EXTERNAL_ZLIB_LIBRARY) #------------------------------------------------------------------------------- -MACRO (PACKAGE_ZLIB_LIBRARY compress_type) +macro (PACKAGE_ZLIB_LIBRARY compress_type) add_custom_target (ZLIB-GenHeader-Copy ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_INCLUDE_DIR_GEN}/zconf.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ COMMENT "Copying ${ZLIB_INCLUDE_DIR_GEN}/zconf.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" @@ -267,4 +267,4 @@ MACRO (PACKAGE_ZLIB_LIBRARY compress_type) if (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") add_dependencies (ZLIB-GenHeader-Copy ZLIB) endif (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") -ENDMACRO (PACKAGE_ZLIB_LIBRARY) +endmacro (PACKAGE_ZLIB_LIBRARY) diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c index 1c23ac3..8478d1b 100644 --- a/config/cmake_ext_mod/HDFTests.c +++ b/config/cmake_ext_mod/HDFTests.c @@ -213,7 +213,7 @@ SIMPLE_TEST(struct stat sb; sb.st_blocks=0); int main(void) { - char *llwidthArgs[] = { "l64", "l", "L", "q", "ll", NULL }; + char *llwidthArgs[] = { "I64", "l64", "l", "L", "q", "ll", NULL }; char *s = malloc(128); char **currentArg = NULL; LL_TYPE x = (LL_TYPE)1048576 * (LL_TYPE)1048576; @@ -454,13 +454,19 @@ SIMPLE_TEST(struct text_info w; w.screenwidth=0); #endif /* HAVE_TM_GMTOFF */ - -#if defined( INLINE_TEST_inline ) || defined( INLINE_TEST___inline__ ) || defined( INLINE_TEST___inline ) +#if defined( HAVE_INLINE ) || defined( HAVE___INLINE__ ) || defined( HAVE___INLINE ) #ifndef __cplusplus +#if defined( HAVE_INLINE ) +# define INLINE_KW inline +#elif defined ( HAVE___INLINE__ ) +# define INLINE_KW __inline__ +#elif defined ( HAVE___INLINE ) +# define INLINE_KW __inline +#endif /* HAVE_INLINE */ typedef int foo_t; -static INLINE_TEST_INLINE foo_t static_foo () { return 0; } -INLINE_TEST_INLINE foo_t foo () {return 0; } -int main() { return 0; } -#endif +static INLINE_KW foo_t static_foo () { return 0; } +INLINE_KW foo_t foo () {return 0; } +int main(void) { return 0; } +#endif /* __cplusplus */ +#endif /* defined( HAVE_INLINE ) || defined( HAVE___INLINE__ ) || defined( HAVE___INLINE ) */ -#endif /* INLINE_TEST */ diff --git a/configure.ac b/configure.ac index 18601f1..0c3514c 100644 --- a/configure.ac +++ b/configure.ac @@ -362,16 +362,16 @@ AC_CHECK_TYPE([ptrdiff_t], [], [AC_DEFINE_UNQUOTED([ptrdiff_t], [long], [Define to `long' if <sys/types.h> does not define.])]) AC_C_BIGENDIAN -AC_CHECK_SIZEOF([char], [1]) -AC_CHECK_SIZEOF([short], [2]) -AC_CHECK_SIZEOF([int], [4]) -AC_CHECK_SIZEOF([unsigned], [4]) -AC_CHECK_SIZEOF([long], [4]) -AC_CHECK_SIZEOF([long long], [8]) -AC_CHECK_SIZEOF([__int64], [8]) -AC_CHECK_SIZEOF([float], [4]) -AC_CHECK_SIZEOF([double], [8]) -AC_CHECK_SIZEOF([long double], [8]) +AC_CHECK_SIZEOF([char]) +AC_CHECK_SIZEOF([short]) +AC_CHECK_SIZEOF([int]) +AC_CHECK_SIZEOF([unsigned]) +AC_CHECK_SIZEOF([long]) +AC_CHECK_SIZEOF([long long]) +AC_CHECK_SIZEOF([__int64]) +AC_CHECK_SIZEOF([float]) +AC_CHECK_SIZEOF([double]) +AC_CHECK_SIZEOF([long double]) ## Check for non-standard extenstion __FLOAT128 HAVE_FLOAT128=0 @@ -947,10 +947,11 @@ AC_HEADER_TIME ## Unix AC_CHECK_HEADERS([sys/resource.h sys/time.h unistd.h sys/ioctl.h sys/stat.h]) -AC_CHECK_HEADERS([sys/socket.h sys/types.h]) +AC_CHECK_HEADERS([sys/socket.h sys/types.h sys/file.h]) AC_CHECK_HEADERS([stddef.h setjmp.h features.h]) AC_CHECK_HEADERS([dirent.h]) AC_CHECK_HEADERS([stdint.h], [C9x=yes]) +AC_CHECK_HEADERS([stdbool.h]) ## Darwin AC_CHECK_HEADERS([mach/mach_time.h]) @@ -1092,43 +1093,54 @@ if test "X$C9x" = "Xyes"; then EOF fi -AC_CHECK_SIZEOF( [int8_t], [1]) -AC_CHECK_SIZEOF( [uint8_t], [1]) -AC_CHECK_SIZEOF( [int_least8_t], [1]) -AC_CHECK_SIZEOF( [uint_least8_t], [1]) -AC_CHECK_SIZEOF( [int_fast8_t], [1]) -AC_CHECK_SIZEOF( [uint_fast8_t], [1]) - -AC_CHECK_SIZEOF( [int16_t], [2]) -AC_CHECK_SIZEOF( [uint16_t], [2]) -AC_CHECK_SIZEOF( [int_least16_t], [2]) -AC_CHECK_SIZEOF([uint_least16_t], [2]) -AC_CHECK_SIZEOF( [int_fast16_t], [2]) -AC_CHECK_SIZEOF( [uint_fast16_t], [2]) - -AC_CHECK_SIZEOF( [int32_t], [4]) -AC_CHECK_SIZEOF( [uint32_t], [4]) -AC_CHECK_SIZEOF( [int_least32_t], [4]) -AC_CHECK_SIZEOF([uint_least32_t], [4]) -AC_CHECK_SIZEOF( [int_fast32_t], [4]) -AC_CHECK_SIZEOF( [uint_fast32_t], [4]) - -AC_CHECK_SIZEOF( [int64_t], [8]) -AC_CHECK_SIZEOF( [uint64_t], [8]) -AC_CHECK_SIZEOF( [int_least64_t], [8]) -AC_CHECK_SIZEOF([uint_least64_t], [8]) -AC_CHECK_SIZEOF( [int_fast64_t], [8]) -AC_CHECK_SIZEOF( [uint_fast64_t], [8]) - -AC_CHECK_SIZEOF([size_t], [4]) -AC_CHECK_SIZEOF([ssize_t], [4]) -AC_CHECK_SIZEOF([ptrdiff_t], [4]) +AC_CHECK_SIZEOF( [int8_t]) +AC_CHECK_SIZEOF( [uint8_t]) +AC_CHECK_SIZEOF( [int_least8_t]) +AC_CHECK_SIZEOF( [uint_least8_t]) +AC_CHECK_SIZEOF( [int_fast8_t]) +AC_CHECK_SIZEOF( [uint_fast8_t]) + +AC_CHECK_SIZEOF( [int16_t]) +AC_CHECK_SIZEOF( [uint16_t]) +AC_CHECK_SIZEOF( [int_least16_t]) +AC_CHECK_SIZEOF([uint_least16_t]) +AC_CHECK_SIZEOF( [int_fast16_t]) +AC_CHECK_SIZEOF( [uint_fast16_t]) + +AC_CHECK_SIZEOF( [int32_t]) +AC_CHECK_SIZEOF( [uint32_t]) +AC_CHECK_SIZEOF( [int_least32_t]) +AC_CHECK_SIZEOF([uint_least32_t]) +AC_CHECK_SIZEOF( [int_fast32_t]) +AC_CHECK_SIZEOF( [uint_fast32_t]) + +AC_CHECK_SIZEOF( [int64_t]) +AC_CHECK_SIZEOF( [uint64_t]) +AC_CHECK_SIZEOF( [int_least64_t]) +AC_CHECK_SIZEOF([uint_least64_t]) +AC_CHECK_SIZEOF( [int_fast64_t]) +AC_CHECK_SIZEOF( [uint_fast64_t]) + +AC_CHECK_SIZEOF([size_t]) +AC_CHECK_SIZEOF([ssize_t]) +AC_CHECK_SIZEOF([ptrdiff_t]) cat >>confdefs.h <<\EOF #include <sys/types.h> /*for off_t definition*/ EOF -AC_CHECK_SIZEOF([off_t], [4]) -AC_CHECK_SIZEOF([off64_t], [8]) +AC_CHECK_SIZEOF([off_t]) +AC_CHECK_SIZEOF([off64_t]) + +if test "X$C9x" = "Xyes"; then + cat >>confdefs.h <<\EOF +#ifdef HAVE_STDBOOL_H +#include <stdbool.h> /* for bool definition */ +#else +#define bool _Bool +#endif +EOF +AC_CHECK_SIZEOF([bool]) +fi ## Checkpoint the cache AC_CACHE_SAVE @@ -1731,8 +1743,8 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ## NOTE: clock_gettime may require linking to the rt or posix4 library ## so we'll search for it before calling AC_CHECK_FUNCS. AC_SEARCH_LIBS([clock_gettime], [rt posix4]) -AC_CHECK_FUNCS([alarm clock_gettime difftime fork frexpf frexpl]) -AC_CHECK_FUNCS([gethostname getpwuid getrusage gettimeofday]) +AC_CHECK_FUNCS([alarm clock_gettime difftime fcntl flock fork frexpf]) +AC_CHECK_FUNCS([frexpl gethostname getpwuid getrusage gettimeofday]) AC_CHECK_FUNCS([lstat rand_r random setsysinfo]) AC_CHECK_FUNCS([signal longjmp setjmp siglongjmp sigsetjmp sigprocmask]) AC_CHECK_FUNCS([snprintf srandom strdup symlink system]) diff --git a/examples/h5_vds-simpleIO.c b/examples/h5_vds-simpleIO.c index b707ae4..6b12dc2 100644 --- a/examples/h5_vds-simpleIO.c +++ b/examples/h5_vds-simpleIO.c @@ -3,7 +3,7 @@ This example illustrates the concept of virtual dataset I/O The program creates 2-dim source dataset and writes data to it. Then it creates 2-dim virtual dataset that has - the same dimesnion sizes and maps the all elements of the + the same dimension sizes and maps the all elements of the virtual dataset to all elements of the source dataset. Then VDS is read back. diff --git a/fortran/src/H5Of.c b/fortran/src/H5Of.c index 4801f7d..9e3ddc4 100644 --- a/fortran/src/H5Of.c +++ b/fortran/src/H5Of.c @@ -901,13 +901,19 @@ h5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size, if((c_bufsize = H5Oget_comment_by_name((hid_t)*loc_id, c_name, c_comment, (size_t)*commentsize,(hid_t)*lapl_id )) < 0) HGOTO_DONE(FAIL); + if(c_name) + HDfree(c_name); + *bufsize = (size_t_f)c_bufsize; /* * Convert C name to FORTRAN and place it in the given buffer */ - if(c_comment) + if(c_comment) { HD5packFstring(c_comment, _fcdtocp(comment), c_commentsize - 1); + HDfree(c_comment); + } + return ret_value; done: diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 9735f48..523ed0b 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -4843,6 +4843,10 @@ h5pset_link_phase_change_c(hid_t_f *gcpl_id, int_f *max_compact, int_f *min_dens * * SOURCE */ +#ifndef H5_HAVE_DIRECT +/* Only gets gcc const attribute when the direct VFD is not built. */ +H5_ATTR_CONST +#endif int_f h5pset_fapl_direct_c(hid_t_f H5_ATTR_UNUSED *fapl_id, size_t_f H5_ATTR_UNUSED *alignment, size_t_f H5_ATTR_UNUSED *block_size, size_t_f H5_ATTR_UNUSED *cbuf_size) /******/ @@ -4886,6 +4890,10 @@ h5pset_fapl_direct_c(hid_t_f H5_ATTR_UNUSED *fapl_id, size_t_f H5_ATTR_UNUSED *a * * SOURCE */ +#ifndef H5_HAVE_DIRECT +/* Only gets gcc const attribute when the direct VFD is not built. */ +H5_ATTR_CONST +#endif int_f h5pget_fapl_direct_c(hid_t_f H5_ATTR_UNUSED *fapl_id, size_t_f H5_ATTR_UNUSED *alignment, size_t_f H5_ATTR_UNUSED *block_size, size_t_f H5_ATTR_UNUSED *cbuf_size) /******/ diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c index b6389258..9928d0a 100644 --- a/fortran/src/H5Tf.c +++ b/fortran/src/H5Tf.c @@ -2421,7 +2421,10 @@ h5tenum_insert_ptr_c(hid_t_f *type_id, _fcd name, int_f* namelen, void *value) if (c_name == NULL) return ret_value; status = H5Tenum_insert( (hid_t)*type_id, c_name, value); + + HDfree(c_name); if ( status < 0 ) return ret_value; + ret_value = 0; return ret_value; } diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index df1962b..472f1ee 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -1,85 +1,16 @@ cmake_minimum_required (VERSION 3.1.0) PROJECT (HDF5_HL_SRC) -if (HDF5_GENERATE_HEADERS) - file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/genLT") - find_package (BISON) - if (BISON_FOUND) - find_package (FLEX) - if (FLEX_FOUND) - BISON_TARGET (H5LT_PARSER H5LTparse.y ${CMAKE_CURRENT_BINARY_DIR}/genLT/H5LTparse.c COMPILE_FLAGS "-d -pH5LTyy") - if (WIN32) - FLEX_TARGET (H5LT_SCANNER H5LTanalyze.l ${CMAKE_CURRENT_BINARY_DIR}/genLT/H5LTanalyze.c COMPILE_FLAGS "--wincompat --nounistd -PH5LTyy") - else (WIN32) - FLEX_TARGET (H5LT_SCANNER H5LTanalyze.l ${CMAKE_CURRENT_BINARY_DIR}/genLT/H5LTanalyze.c COMPILE_FLAGS "--nounistd -PH5LTyy") - endif (WIN32) - ADD_FLEX_BISON_DEPENDENCY(H5LT_SCANNER H5LT_PARSER) - - if (BISON_H5LT_PARSER_DEFINED AND FLEX_H5LT_SCANNER_DEFINED) - include_directories(${CMAKE_CURRENT_BINARY_DIR}) - - add_custom_command ( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.h - PRE_BUILD - COMMAND "${CMAKE_COMMAND}" - -D "GEN_DIR=genLT" - -D "FILE_PARSE=H5LTparse" - -P "${HDF_RESOURCES_DIR}/HDF5_Process_Flex_Files.cmake" - DEPENDS "${BISON_H5LT_PARSER_OUTPUTS}" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - add_custom_command ( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c - PRE_BUILD - COMMAND "${CMAKE_COMMAND}" - -D "GEN_DIR=genLT" - -D "FILE_ANALYZE=H5LTanalyze.c" - -P "${HDF_RESOURCES_DIR}/HDF5_Process_Flex_Files.cmake" - DEPENDS "${FLEX_H5LT_SCANNER_OUTPUTS}" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - add_custom_target (process_gen_H5LT - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - - set (HL_SRCS - ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c - ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c - ) - set (HL_HEADERS - ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.h - ) - else (BISON_H5LT_PARSER_DEFINED AND FLEX_H5LT_SCANNER_DEFINED) - message (STATUS "Error during generate of files") - endif (BISON_H5LT_PARSER_DEFINED AND FLEX_H5LT_SCANNER_DEFINED) - else (FLEX_FOUND) - message (STATUS "Cannot generate files - flex not found") - endif (FLEX_FOUND) - else (BISON_FOUND) - message (STATUS "Cannot generate files - bison not found") - endif (BISON_FOUND) -else (HDF5_GENERATE_HEADERS) - set (HL_SRCS - ${HDF5_HL_SRC_SOURCE_DIR}/H5LTanalyze.c - ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.c - ) - set (HL_HEADERS - ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h - ) -endif (HDF5_GENERATE_HEADERS) - #----------------------------------------------------------------------------- # List Source files #----------------------------------------------------------------------------- set (HL_SRCS - ${HL_SRCS} ${HDF5_HL_SRC_SOURCE_DIR}/H5DO.c ${HDF5_HL_SRC_SOURCE_DIR}/H5DS.c ${HDF5_HL_SRC_SOURCE_DIR}/H5IM.c ${HDF5_HL_SRC_SOURCE_DIR}/H5LT.c - #${HDF5_HL_SRC_SOURCE_DIR}/H5LTanalyze.c - #${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.c + ${HDF5_HL_SRC_SOURCE_DIR}/H5LTanalyze.c + ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.c ${HDF5_HL_SRC_SOURCE_DIR}/H5PT.c ${HDF5_HL_SRC_SOURCE_DIR}/H5TB.c ) @@ -89,7 +20,7 @@ set (HL_HEADERS ${HDF5_HL_SRC_SOURCE_DIR}/H5DOpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5DSpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5IMpublic.h - #${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h + ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h ${HDF5_HL_SRC_SOURCE_DIR}/H5LTpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5PTpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5TBpublic.h @@ -106,11 +37,6 @@ set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") set (install_targets ${HDF5_HL_LIB_TARGET}) -if (HDF5_GENERATE_HEADERS) - add_dependencies(${HDF5_HL_LIB_TARGET} process_gen_H5LT) -else (HDF5_GENERATE_HEADERS) - add_dependencies(${HDF5_HL_LIB_TARGET} "${HDF5_HL_SRC_SOURCE_DIR}/H5LTanalyze.c;${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.c") -endif (HDF5_GENERATE_HEADERS) if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SRCS} ${HL_HEADERS}) @@ -125,11 +51,6 @@ if (BUILD_SHARED_LIBS) ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIBSH_TARGET}") set (install_targets ${install_targets} ${HDF5_HL_LIBSH_TARGET}) - if (HDF5_GENERATE_HEADERS) - add_dependencies(${HDF5_HL_LIBSH_TARGET} process_gen_H5LT) - else (HDF5_GENERATE_HEADERS) - add_dependencies(${HDF5_HL_LIBSH_TARGET} "${HDF5_HL_SRC_SOURCE_DIR}/H5LTanalyze.c;${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.c") - endif (HDF5_GENERATE_HEADERS) endif (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c new file mode 100644 index 0000000..bad963d --- /dev/null +++ b/hl/src/H5LTanalyze.c @@ -0,0 +1,2555 @@ +#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2 +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" +#pragma GCC diagnostic ignored "-Wlarger-than=" +#pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wnested-externs" +#pragma GCC diagnostic ignored "-Wold-style-definition" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +#pragma GCC diagnostic ignored "-Wswitch-default" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-macros" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wredundant-decls" +#elif defined __SUNPRO_CC +#pragma disable_warn +#elif defined _MSC_VER +#pragma warning(push, 1) +#endif +#line 2 "H5LTanalyze.c" + +#line 4 "H5LTanalyze.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define yy_create_buffer H5LTyy_create_buffer +#define yy_delete_buffer H5LTyy_delete_buffer +#define yy_flex_debug H5LTyy_flex_debug +#define yy_init_buffer H5LTyy_init_buffer +#define yy_flush_buffer H5LTyy_flush_buffer +#define yy_load_buffer_state H5LTyy_load_buffer_state +#define yy_switch_to_buffer H5LTyy_switch_to_buffer +#define yyin H5LTyyin +#define yyleng H5LTyyleng +#define yylex H5LTyylex +#define yylineno H5LTyylineno +#define yyout H5LTyyout +#define yyrestart H5LTyyrestart +#define yytext H5LTyytext +#define yywrap H5LTyywrap +#define yyalloc H5LTyyalloc +#define yyrealloc H5LTyyrealloc +#define yyfree H5LTyyfree + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 37 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE H5LTyyrestart(H5LTyyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern yy_size_t H5LTyyleng; + +extern FILE *H5LTyyin, *H5LTyyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up H5LTyytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up H5LTyytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via H5LTyyrestart()), so that the user can continue scanning by + * just pointing H5LTyyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when H5LTyytext is formed. */ +static char yy_hold_char; +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +yy_size_t H5LTyyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow H5LTyywrap()'s to do buffer switches + * instead of setting up a fresh H5LTyyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void H5LTyyrestart (FILE *input_file ); +void H5LTyy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE H5LTyy_create_buffer (FILE *file,int size ); +void H5LTyy_delete_buffer (YY_BUFFER_STATE b ); +void H5LTyy_flush_buffer (YY_BUFFER_STATE b ); +void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void H5LTyypop_buffer_state (void ); + +static void H5LTyyensure_buffer_stack (void ); +static void H5LTyy_load_buffer_state (void ); +static void H5LTyy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER H5LTyy_flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE H5LTyy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE H5LTyy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char *bytes,yy_size_t len ); + +void *H5LTyyalloc (yy_size_t ); +void *H5LTyyrealloc (void *,yy_size_t ); +void H5LTyyfree (void * ); + +#define yy_new_buffer H5LTyy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + H5LTyyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + H5LTyyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +typedef unsigned char YY_CHAR; + +FILE *H5LTyyin = (FILE *) 0, *H5LTyyout = (FILE *) 0; + +typedef int yy_state_type; + +extern int H5LTyylineno; + +int H5LTyylineno = 1; + +extern char *H5LTyytext; +#define yytext_ptr H5LTyytext + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up H5LTyytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + H5LTyyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 66 +#define YY_END_OF_BUFFER 67 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_acclist[437] = + { 0, + 64, 64, 64, 64, 67, 66, 64, 66, 64, 65, + 66, 56, 66, 55, 66, 62, 66, 63, 66, 66, + 66, 66, 66, 60, 66, 61, 66, 58, 66, 59, + 66, 57, 66, 57, 64, 66, 57, 64, 65, 66, + 55, 57, 66, 57, 62, 66, 57, 63, 66, 57, + 66, 57, 66, 57, 66, 57, 66, 57, 60, 66, + 57, 61, 66, 57, 58, 66, 57, 59, 66, 64, + 55, 57, 57, 64, 55, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 38, 38, 57, 57, + 57, 57, 57, 57, 39, 39, 57, 57, 57, 57, + + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 37, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 37, 57, 57, 54, 36, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 54, 57, 36, 57, 45, 49, + 51, 53, 57, 57, 57, 45, 57, 49, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 51, 57, 53, + 57, 50, 50, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 52, 35, 57, 57, + 57, 57, 57, 57, 52, 57, 57, 57, 57, 57, + + 57, 57, 57, 57, 35, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 48, + 1, 2, 9, 10, 47, 48, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 1, 57, 2, 57, 57, + 57, 57, 57, 57, 57, 9, 57, 10, 57, 57, + 57, 47, 57, 44, 3, 4, 5, 6, 7, 8, + 11, 12, 13, 14, 15, 16, 57, 44, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + + 57, 57, 57, 57, 57, 57, 57, 3, 57, 4, + 57, 5, 57, 6, 57, 7, 57, 8, 57, 11, + 57, 12, 57, 13, 57, 14, 57, 15, 57, 16, + 57, 57, 57, 57, 43, 46, 28, 29, 30, 31, + 22, 43, 57, 46, 57, 28, 57, 29, 57, 30, + 57, 31, 57, 57, 57, 57, 22, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 17, 24, 23, 41, 17, 57, 57, 57, 57, + 57, 24, 57, 57, 57, 57, 23, 57, 57, 57, + 57, 41, 57, 57, 57, 32, 26, 18, 20, 19, + + 25, 40, 42, 57, 32, 57, 57, 26, 57, 18, + 57, 20, 57, 19, 57, 57, 25, 57, 57, 40, + 57, 42, 57, 33, 27, 21, 33, 57, 57, 27, + 57, 21, 57, 34, 34, 57 + } ; + +static yyconst flex_int16_t yy_accept[546] = + { 0, + 1, 2, 3, 4, 5, 6, 7, 9, 12, 14, + 16, 18, 20, 21, 22, 23, 24, 26, 28, 30, + 32, 34, 37, 41, 44, 47, 50, 52, 54, 56, + 58, 61, 64, 67, 70, 71, 72, 72, 72, 72, + 72, 72, 73, 75, 77, 78, 79, 80, 81, 82, + 82, 82, 82, 82, 82, 83, 84, 85, 86, 87, + 88, 88, 88, 88, 88, 88, 90, 91, 92, 93, + 94, 95, 96, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 96, 96, 96, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 112, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 147, 149, 149, 149, 149, 150, 151, 151, + 151, 151, 151, 151, 151, 151, 151, 152, 153, 154, + 155, 156, 158, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 170, 172, 173, 173, 173, 173, 173, 173, + + 173, 173, 173, 173, 173, 173, 173, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 187, 187, 187, 187, 187, 187, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 189, 189, 189, 189, 190, + 191, 192, 193, 194, 195, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 207, 208, 209, 210, 210, 210, + 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, + 210, 210, 210, 210, 210, 210, 210, 210, 211, 212, + 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, + 223, 224, 225, 226, 227, 228, 229, 230, 231, 231, + + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 232, 233, 233, + 233, 233, 233, 233, 233, 234, 235, 235, 235, 236, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 258, + 260, 261, 262, 263, 264, 265, 266, 268, 270, 271, + 272, 274, 274, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 287, 287, 287, 288, 290, 291, + + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 310, 312, 314, + 316, 318, 320, 322, 324, 326, 328, 330, 332, 333, + 334, 335, 336, 337, 338, 339, 340, 341, 341, 341, + 341, 342, 342, 342, 342, 342, 342, 342, 342, 342, + 342, 342, 342, 342, 342, 344, 346, 348, 350, 352, + 354, 355, 356, 357, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 370, 371, 372, 373, 373, + 373, 373, 373, 374, 374, 374, 374, 375, 375, 375, + 375, 376, 376, 376, 378, 379, 380, 381, 382, 384, + + 385, 386, 387, 389, 390, 391, 392, 394, 395, 396, + 396, 397, 397, 398, 399, 400, 401, 401, 402, 402, + 403, 404, 405, 407, 408, 410, 412, 414, 416, 417, + 419, 420, 422, 424, 425, 425, 426, 427, 429, 430, + 432, 434, 435, 437, 437 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 4, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 5, 6, 7, + 8, 9, 10, 11, 5, 12, 5, 13, 14, 1, + 1, 1, 1, 1, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 1, 1, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 1, 1, 35, 36, + 37, 1, 38, 1, 39, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 40, 1, 41, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[42] = + { 0, + 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, + 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1 + } ; + +static yyconst flex_int16_t yy_base[547] = + { 0, + 0, 0, 41, 0, 610, 611, 81, 83, 611, 0, + 611, 611, 56, 599, 580, 575, 611, 611, 611, 611, + 0, 87, 89, 88, 0, 0, 70, 596, 577, 572, + 0, 0, 0, 0, 101, 0, 584, 567, 569, 571, + 569, 0, 103, 0, 579, 562, 564, 566, 564, 561, + 564, 552, 551, 79, 557, 560, 548, 547, 80, 611, + 566, 97, 87, 569, 560, 0, 563, 117, 90, 566, + 557, 611, 549, 99, 552, 550, 557, 560, 546, 541, + 118, 549, 556, 552, 533, 0, 538, 108, 541, 539, + 546, 549, 535, 530, 126, 538, 545, 541, 522, 527, + + 531, 536, 523, 520, 522, 532, 518, 534, 95, 518, + 528, 510, 524, 611, 525, 513, 517, 522, 509, 506, + 508, 518, 504, 520, 97, 504, 514, 496, 510, 0, + 511, 514, 500, 495, 520, 500, 492, 504, 499, 492, + 481, 106, 496, 492, 498, 611, 611, 501, 487, 482, + 507, 487, 479, 491, 486, 479, 468, 123, 483, 479, + 485, 0, 0, 468, 475, 462, 611, 611, 470, 460, + 464, 464, 126, 470, 126, 480, 611, 611, 459, 466, + 453, 0, 0, 461, 451, 455, 455, 130, 461, 129, + 471, 0, 0, 611, 452, 139, 469, 463, 463, 462, + + 158, 165, 459, 446, 450, 461, 0, 443, 141, 460, + 454, 454, 453, 172, 179, 450, 437, 441, 452, 441, + 435, 433, 438, 150, 424, 611, 451, 454, 451, 151, + 448, 451, 448, 165, 611, 432, 440, 430, 427, 421, + 419, 424, 157, 410, 0, 437, 440, 437, 170, 434, + 437, 434, 172, 0, 418, 426, 416, 421, 421, 417, + 397, 428, 425, 180, 177, 183, 186, 414, 413, 190, + 192, 193, 412, 411, 405, 411, 408, 408, 408, 404, + 384, 415, 412, 201, 196, 199, 206, 401, 400, 211, + 212, 213, 399, 398, 392, 398, 395, 611, 390, 400, + + 380, 215, 217, 388, 382, 384, 381, 220, 223, 225, + 387, 386, 385, 384, 383, 382, 611, 611, 381, 380, + 379, 378, 377, 376, 611, 611, 218, 375, 611, 0, + 370, 380, 360, 227, 236, 368, 362, 364, 361, 235, + 241, 244, 367, 366, 365, 364, 363, 362, 0, 0, + 361, 360, 359, 358, 357, 356, 0, 0, 237, 355, + 0, 350, 611, 366, 352, 351, 350, 349, 352, 333, + 338, 332, 336, 335, 335, 338, 332, 336, 331, 155, + 334, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 340, 335, 325, 329, 0, 345, 331, + + 330, 329, 328, 331, 312, 317, 311, 315, 314, 314, + 317, 311, 315, 310, 168, 313, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 319, 314, + 304, 611, 611, 611, 611, 611, 611, 301, 314, 314, + 611, 295, 301, 305, 310, 294, 308, 290, 294, 294, + 292, 300, 287, 301, 0, 0, 0, 0, 0, 0, + 285, 298, 298, 0, 279, 285, 289, 294, 278, 292, + 274, 278, 278, 276, 284, 271, 285, 611, 275, 266, + 281, 275, 611, 265, 262, 263, 611, 266, 270, 260, + 611, 264, 270, 0, 263, 254, 269, 263, 0, 253, + + 250, 251, 0, 254, 258, 247, 0, 249, 255, 253, + 611, 247, 611, 611, 611, 611, 249, 611, 234, 611, + 611, 245, 0, 233, 0, 0, 0, 0, 234, 0, + 222, 0, 0, 611, 207, 611, 611, 0, 186, 0, + 0, 611, 0, 611, 106, 275 + } ; + +static yyconst flex_int16_t yy_def[547] = + { 0, + 544, 1, 544, 3, 544, 544, 544, 544, 544, 545, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 544, 545, 544, 544, 544, 544, + 544, 546, 546, 24, 546, 546, 546, 546, 546, 544, + 544, 544, 544, 544, 546, 546, 546, 546, 546, 544, + 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, + 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, + + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, + + 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, + + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, + + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 546, 546, 546, 546, 546, 546, 546, + + 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 544, 544, 544, 544, 546, 546, 546, + 546, 544, 546, 0, 544, 544 + } ; + +static yyconst flex_int16_t yy_nxt[653] = + { 0, + 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, + 10, 10, 11, 12, 6, 6, 13, 6, 6, 6, + 6, 14, 6, 6, 6, 6, 15, 6, 6, 6, + 16, 6, 6, 6, 6, 6, 17, 18, 6, 19, + 20, 21, 22, 23, 9, 24, 24, 24, 24, 24, + 24, 24, 24, 25, 26, 21, 21, 27, 21, 21, + 21, 21, 28, 21, 21, 21, 21, 29, 21, 21, + 21, 30, 21, 21, 21, 21, 21, 31, 32, 21, + 33, 34, 35, 35, 35, 35, 37, 38, 43, 43, + 43, 43, 44, 44, 44, 44, 44, 44, 44, 44, + + 45, 46, 35, 35, 43, 43, 64, 70, 36, 65, + 71, 73, 141, 74, 157, 75, 76, 82, 83, 77, + 96, 97, 78, 79, 142, 101, 158, 80, 174, 102, + 81, 87, 110, 88, 117, 89, 90, 103, 118, 91, + 126, 111, 92, 93, 175, 189, 119, 94, 201, 127, + 95, 204, 214, 221, 217, 240, 205, 262, 202, 218, + 263, 190, 215, 227, 282, 228, 268, 283, 229, 230, + 231, 222, 232, 241, 269, 233, 234, 246, 449, 247, + 273, 450, 248, 249, 250, 288, 251, 293, 274, 252, + 253, 472, 311, 289, 473, 294, 304, 305, 313, 306, + + 312, 315, 307, 308, 543, 319, 314, 321, 323, 316, + 309, 343, 310, 320, 345, 322, 324, 336, 337, 344, + 338, 347, 346, 339, 340, 542, 351, 353, 355, 348, + 365, 341, 367, 342, 352, 354, 356, 373, 366, 376, + 368, 378, 400, 374, 377, 394, 375, 379, 380, 395, + 401, 402, 408, 541, 540, 381, 539, 411, 409, 403, + 413, 410, 412, 538, 429, 537, 414, 415, 430, 536, + 535, 534, 533, 532, 416, 42, 531, 42, 530, 529, + 528, 527, 526, 525, 524, 523, 522, 521, 520, 519, + 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, + + 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, + 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, + 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, + 478, 477, 476, 475, 474, 471, 470, 469, 468, 467, + 466, 465, 464, 463, 462, 461, 460, 459, 458, 457, + 456, 455, 454, 453, 452, 451, 448, 447, 446, 445, + 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, + 434, 433, 432, 431, 428, 427, 426, 425, 424, 423, + 422, 421, 420, 419, 418, 417, 407, 406, 405, 404, + 399, 398, 397, 396, 393, 392, 391, 390, 389, 388, + + 387, 386, 385, 384, 383, 382, 372, 371, 370, 369, + 364, 363, 362, 361, 360, 359, 358, 357, 350, 349, + 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, + 325, 318, 317, 303, 302, 301, 300, 299, 298, 297, + 296, 295, 292, 291, 290, 287, 286, 285, 284, 281, + 280, 279, 278, 277, 276, 275, 272, 271, 270, 267, + 266, 265, 264, 261, 260, 259, 258, 257, 256, 255, + 254, 245, 244, 243, 242, 239, 238, 237, 236, 235, + 226, 225, 224, 223, 220, 219, 216, 213, 212, 211, + 210, 209, 208, 207, 206, 203, 200, 199, 198, 197, + + 196, 195, 194, 193, 192, 191, 188, 187, 186, 185, + 184, 183, 182, 181, 180, 179, 178, 177, 176, 173, + 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, + 162, 161, 160, 159, 156, 155, 154, 153, 152, 151, + 150, 149, 148, 147, 146, 145, 144, 143, 140, 139, + 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, + 128, 125, 124, 123, 122, 121, 120, 116, 115, 114, + 113, 112, 109, 108, 107, 106, 105, 104, 100, 99, + 98, 86, 85, 84, 72, 69, 68, 67, 66, 63, + 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, + + 52, 51, 50, 49, 48, 47, 41, 40, 39, 544, + 5, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544 + } ; + +static yyconst flex_int16_t yy_chk[653] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 7, 7, 8, 8, 13, 13, 22, 22, + 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, + + 27, 27, 35, 35, 43, 43, 54, 59, 545, 54, + 59, 62, 109, 62, 125, 62, 62, 63, 63, 62, + 69, 69, 62, 62, 109, 74, 125, 62, 142, 74, + 62, 68, 81, 68, 88, 68, 68, 74, 88, 68, + 95, 81, 68, 68, 142, 158, 88, 68, 173, 95, + 68, 175, 188, 196, 190, 209, 175, 224, 173, 190, + 224, 158, 188, 201, 243, 201, 230, 243, 201, 201, + 202, 196, 202, 209, 230, 202, 202, 214, 380, 214, + 234, 380, 214, 214, 215, 249, 215, 253, 234, 215, + 215, 415, 265, 249, 415, 253, 264, 264, 266, 264, + + 265, 267, 264, 264, 539, 270, 266, 271, 272, 267, + 264, 285, 264, 270, 286, 271, 272, 284, 284, 285, + 284, 287, 286, 284, 284, 535, 290, 291, 292, 287, + 302, 284, 303, 284, 290, 291, 292, 308, 302, 309, + 303, 310, 334, 308, 309, 327, 308, 310, 310, 327, + 334, 335, 340, 531, 529, 310, 524, 341, 340, 335, + 342, 340, 341, 522, 359, 519, 342, 342, 359, 517, + 512, 510, 509, 508, 342, 546, 506, 546, 505, 504, + 502, 501, 500, 498, 497, 496, 495, 493, 492, 490, + 489, 488, 486, 485, 484, 482, 481, 480, 479, 477, + + 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, + 466, 465, 463, 462, 461, 454, 453, 452, 451, 450, + 449, 448, 447, 446, 445, 444, 443, 442, 440, 439, + 438, 431, 430, 429, 416, 414, 413, 412, 411, 410, + 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, + 399, 397, 396, 395, 394, 381, 379, 378, 377, 376, + 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, + 365, 364, 362, 360, 356, 355, 354, 353, 352, 351, + 348, 347, 346, 345, 344, 343, 339, 338, 337, 336, + 333, 332, 331, 328, 324, 323, 322, 321, 320, 319, + + 316, 315, 314, 313, 312, 311, 307, 306, 305, 304, + 301, 300, 299, 297, 296, 295, 294, 293, 289, 288, + 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, + 273, 269, 268, 263, 262, 261, 260, 259, 258, 257, + 256, 255, 252, 251, 250, 248, 247, 246, 244, 242, + 241, 240, 239, 238, 237, 236, 233, 232, 231, 229, + 228, 227, 225, 223, 222, 221, 220, 219, 218, 217, + 216, 213, 212, 211, 210, 208, 206, 205, 204, 203, + 200, 199, 198, 197, 195, 191, 189, 187, 186, 185, + 184, 181, 180, 179, 176, 174, 172, 171, 170, 169, + + 166, 165, 164, 161, 160, 159, 157, 156, 155, 154, + 153, 152, 151, 150, 149, 148, 145, 144, 143, 141, + 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, + 129, 128, 127, 126, 124, 123, 122, 121, 120, 119, + 118, 117, 116, 115, 113, 112, 111, 110, 108, 107, + 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, + 96, 94, 93, 92, 91, 90, 89, 87, 85, 84, + 83, 82, 80, 79, 78, 77, 76, 75, 73, 71, + 70, 67, 65, 64, 61, 58, 57, 56, 55, 53, + 52, 51, 50, 49, 48, 47, 46, 45, 41, 40, + + 39, 38, 37, 30, 29, 28, 16, 15, 14, 5, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544 + } ; + +extern int H5LTyy_flex_debug; +int H5LTyy_flex_debug = 0; + +static yy_state_type *yy_state_buf=0, *yy_state_ptr=0; +static char *yy_full_match; +static int yy_lp; +#define REJECT \ +{ \ +*yy_cp = (yy_hold_char); /* undo effects of setting up H5LTyytext */ \ +yy_cp = (yy_full_match); /* restore poss. backed-over text */ \ +++(yy_lp); \ +goto find_rule; \ +} + +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *H5LTyytext; +#line 1 "H5LTanalyze.l" +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#line 17 "H5LTanalyze.l" +#include <stdlib.h> +#include <string.h> +#include <hdf5.h> +#include "H5LTparse.h" + +int my_yyinput(char *, int); +#undef YY_INPUT +#define YY_INPUT(b, r, ms) (r=my_yyinput(b, ms)) +#define token(x) (int)x +#define hid(x) (hid_t)x + +#ifdef YY_BUF_SIZE +#undef YY_BUF_SIZE +#endif +#define YY_BUF_SIZE 262144 /*Define read buffer to be 256K*/ + +extern char *myinput; +extern size_t input_len; + +#define STACK_SIZE 16 + +/*variables for compound type*/ +struct cmpd_info { + hid_t id; + hbool_t is_field; + hbool_t first_memb; +}; +extern struct cmpd_info cmpd_stack[STACK_SIZE]; +extern int csindex; + +/*variables for array type*/ +struct arr_info { + hsize_t dims[H5S_MAX_RANK]; + int ndim; + hbool_t is_dim; +}; +extern struct arr_info arr_stack[STACK_SIZE]; +extern int asindex; + +/*variables for enumerate type*/ +extern hbool_t is_enum; +extern hbool_t is_enum_memb; + +/*variables for string type*/ +extern hbool_t is_str_size; + +/*variables for opaque type*/ +extern hbool_t is_opq_size; +extern hbool_t is_opq_tag; + +hbool_t first_quote = 1; + + +#line 917 "H5LTanalyze.c" + +#define INITIAL 0 +#define TAG_STRING 1 + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int H5LTyylex_destroy (void ); + +int H5LTyyget_debug (void ); + +void H5LTyyset_debug (int debug_flag ); + +YY_EXTRA_TYPE H5LTyyget_extra (void ); + +void H5LTyyset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *H5LTyyget_in (void ); + +void H5LTyyset_in (FILE * in_str ); + +FILE *H5LTyyget_out (void ); + +void H5LTyyset_out (FILE * out_str ); + +yy_size_t H5LTyyget_leng (void ); + +char *H5LTyyget_text (void ); + +int H5LTyyget_lineno (void ); + +void H5LTyyset_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int H5LTyywrap (void ); +#else +extern int H5LTyywrap (void ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( H5LTyytext, H5LTyyleng, 1, H5LTyyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( H5LTyyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( H5LTyyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, H5LTyyin))==0 && ferror(H5LTyyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(H5LTyyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int H5LTyylex (void); + +#define YY_DECL int H5LTyylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after H5LTyytext and H5LTyyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 73 "H5LTanalyze.l" + + +#line 1095 "H5LTanalyze.c" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + /* Create the reject buffer large enough to save one state per allowed character. */ + if ( ! (yy_state_buf) ) + (yy_state_buf) = (yy_state_type *)H5LTyyalloc(YY_STATE_BUF_SIZE ); + if ( ! (yy_state_buf) ) + YY_FATAL_ERROR( "out of dynamic memory in H5LTyylex()" ); + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! H5LTyyin ) + H5LTyyin = stdin; + + if ( ! H5LTyyout ) + H5LTyyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + H5LTyyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); + } + + H5LTyy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of H5LTyytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); + + (yy_state_ptr) = (yy_state_buf); + *(yy_state_ptr)++ = yy_current_state; + +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 545 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *(yy_state_ptr)++ = yy_current_state; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 611 ); + +yy_find_action: + yy_current_state = *--(yy_state_ptr); + (yy_lp) = yy_accept[yy_current_state]; +find_rule: /* we branch to this label when backing up */ + for ( ; ; ) /* until we find what rule we matched */ + { + if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] ) + { + yy_act = yy_acclist[(yy_lp)]; + { + (yy_full_match) = yy_cp; + break; + } + } + --yy_cp; + yy_current_state = *--(yy_state_ptr); + (yy_lp) = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ +case 1: +YY_RULE_SETUP +#line 75 "H5LTanalyze.l" +{return hid(H5T_STD_I8BE_TOKEN);} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 76 "H5LTanalyze.l" +{return hid(H5T_STD_I8LE_TOKEN);} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 77 "H5LTanalyze.l" +{return hid(H5T_STD_I16BE_TOKEN);} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 78 "H5LTanalyze.l" +{return hid(H5T_STD_I16LE_TOKEN);} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 79 "H5LTanalyze.l" +{return hid(H5T_STD_I32BE_TOKEN);} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 80 "H5LTanalyze.l" +{return hid(H5T_STD_I32LE_TOKEN);} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 81 "H5LTanalyze.l" +{return hid(H5T_STD_I64BE_TOKEN);} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 82 "H5LTanalyze.l" +{return hid(H5T_STD_I64LE_TOKEN);} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 84 "H5LTanalyze.l" +{return hid(H5T_STD_U8BE_TOKEN);} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 85 "H5LTanalyze.l" +{return hid(H5T_STD_U8LE_TOKEN);} + YY_BREAK +case 11: +YY_RULE_SETUP +#line 86 "H5LTanalyze.l" +{return hid(H5T_STD_U16BE_TOKEN);} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 87 "H5LTanalyze.l" +{return hid(H5T_STD_U16LE_TOKEN);} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 88 "H5LTanalyze.l" +{return hid(H5T_STD_U32BE_TOKEN);} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 89 "H5LTanalyze.l" +{return hid(H5T_STD_U32LE_TOKEN);} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 90 "H5LTanalyze.l" +{return hid(H5T_STD_U64BE_TOKEN);} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 91 "H5LTanalyze.l" +{return hid(H5T_STD_U64LE_TOKEN);} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 93 "H5LTanalyze.l" +{return hid(H5T_NATIVE_CHAR_TOKEN);} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 94 "H5LTanalyze.l" +{return hid(H5T_NATIVE_SCHAR_TOKEN);} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 95 "H5LTanalyze.l" +{return hid(H5T_NATIVE_UCHAR_TOKEN);} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 96 "H5LTanalyze.l" +{return hid(H5T_NATIVE_SHORT_TOKEN);} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 97 "H5LTanalyze.l" +{return hid(H5T_NATIVE_USHORT_TOKEN);} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 98 "H5LTanalyze.l" +{return hid(H5T_NATIVE_INT_TOKEN);} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 99 "H5LTanalyze.l" +{return hid(H5T_NATIVE_UINT_TOKEN);} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 100 "H5LTanalyze.l" +{return hid(H5T_NATIVE_LONG_TOKEN);} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 101 "H5LTanalyze.l" +{return hid(H5T_NATIVE_ULONG_TOKEN);} + YY_BREAK +case 26: +YY_RULE_SETUP +#line 102 "H5LTanalyze.l" +{return hid(H5T_NATIVE_LLONG_TOKEN);} + YY_BREAK +case 27: +YY_RULE_SETUP +#line 103 "H5LTanalyze.l" +{return hid(H5T_NATIVE_ULLONG_TOKEN);} + YY_BREAK +case 28: +YY_RULE_SETUP +#line 105 "H5LTanalyze.l" +{return hid(H5T_IEEE_F32BE_TOKEN);} + YY_BREAK +case 29: +YY_RULE_SETUP +#line 106 "H5LTanalyze.l" +{return hid(H5T_IEEE_F32LE_TOKEN);} + YY_BREAK +case 30: +YY_RULE_SETUP +#line 107 "H5LTanalyze.l" +{return hid(H5T_IEEE_F64BE_TOKEN);} + YY_BREAK +case 31: +YY_RULE_SETUP +#line 108 "H5LTanalyze.l" +{return hid(H5T_IEEE_F64LE_TOKEN);} + YY_BREAK +case 32: +YY_RULE_SETUP +#line 109 "H5LTanalyze.l" +{return hid(H5T_NATIVE_FLOAT_TOKEN);} + YY_BREAK +case 33: +YY_RULE_SETUP +#line 110 "H5LTanalyze.l" +{return hid(H5T_NATIVE_DOUBLE_TOKEN);} + YY_BREAK +case 34: +YY_RULE_SETUP +#line 111 "H5LTanalyze.l" +{return hid(H5T_NATIVE_LDOUBLE_TOKEN);} + YY_BREAK +case 35: +YY_RULE_SETUP +#line 113 "H5LTanalyze.l" +{return token(H5T_STRING_TOKEN);} + YY_BREAK +case 36: +YY_RULE_SETUP +#line 114 "H5LTanalyze.l" +{return token(STRSIZE_TOKEN);} + YY_BREAK +case 37: +YY_RULE_SETUP +#line 115 "H5LTanalyze.l" +{return token(STRPAD_TOKEN);} + YY_BREAK +case 38: +YY_RULE_SETUP +#line 116 "H5LTanalyze.l" +{return token(CSET_TOKEN);} + YY_BREAK +case 39: +YY_RULE_SETUP +#line 117 "H5LTanalyze.l" +{return token(CTYPE_TOKEN);} + YY_BREAK +case 40: +YY_RULE_SETUP +#line 118 "H5LTanalyze.l" +{return token(H5T_STR_NULLTERM_TOKEN);} + YY_BREAK +case 41: +YY_RULE_SETUP +#line 119 "H5LTanalyze.l" +{return token(H5T_STR_NULLPAD_TOKEN);} + YY_BREAK +case 42: +YY_RULE_SETUP +#line 120 "H5LTanalyze.l" +{return token(H5T_STR_SPACEPAD_TOKEN);} + YY_BREAK +case 43: +YY_RULE_SETUP +#line 121 "H5LTanalyze.l" +{return token(H5T_CSET_ASCII_TOKEN);} + YY_BREAK +case 44: +YY_RULE_SETUP +#line 122 "H5LTanalyze.l" +{return token(H5T_CSET_UTF8_TOKEN);} + YY_BREAK +case 45: +YY_RULE_SETUP +#line 123 "H5LTanalyze.l" +{return token(H5T_C_S1_TOKEN);} + YY_BREAK +case 46: +YY_RULE_SETUP +#line 124 "H5LTanalyze.l" +{return token(H5T_FORTRAN_S1_TOKEN);} + YY_BREAK +case 47: +YY_RULE_SETUP +#line 125 "H5LTanalyze.l" +{return token(H5T_VARIABLE_TOKEN);} + YY_BREAK +case 48: +YY_RULE_SETUP +#line 127 "H5LTanalyze.l" +{return token(H5T_COMPOUND_TOKEN);} + YY_BREAK +case 49: +YY_RULE_SETUP +#line 128 "H5LTanalyze.l" +{return token(H5T_ENUM_TOKEN);} + YY_BREAK +case 50: +YY_RULE_SETUP +#line 129 "H5LTanalyze.l" +{return token(H5T_ARRAY_TOKEN);} + YY_BREAK +case 51: +YY_RULE_SETUP +#line 130 "H5LTanalyze.l" +{return token(H5T_VLEN_TOKEN);} + YY_BREAK +case 52: +YY_RULE_SETUP +#line 132 "H5LTanalyze.l" +{return token(H5T_OPAQUE_TOKEN);} + YY_BREAK +case 53: +YY_RULE_SETUP +#line 133 "H5LTanalyze.l" +{return token(OPQ_SIZE_TOKEN);} + YY_BREAK +case 54: +YY_RULE_SETUP +#line 134 "H5LTanalyze.l" +{return token(OPQ_TAG_TOKEN);} + YY_BREAK +case 55: +YY_RULE_SETUP +#line 136 "H5LTanalyze.l" +{ + if( is_str_size || (is_enum && is_enum_memb) || + is_opq_size || (asindex>-1 && arr_stack[asindex].is_dim) || + (csindex>-1 && cmpd_stack[csindex].is_field) ) { + H5LTyylval.ival = atoi(H5LTyytext); + return NUMBER; + } else + REJECT; + } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 146 "H5LTanalyze.l" +{ + /*if it's first quote, and is a compound field name or an enum symbol*/ + if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) + && first_quote) { + first_quote = 0; + BEGIN TAG_STRING; + } else /*if it's second quote*/ + first_quote = 1; + return token('"'); + } + YY_BREAK +case 57: +/* rule 57 can match eol */ +YY_RULE_SETUP +#line 156 "H5LTanalyze.l" +{ +#ifdef H5_HAVE_WIN32_API + H5LTyylval.sval = _strdup(H5LTyytext); +#else /* H5_HAVE_WIN32_API */ + H5LTyylval.sval = strdup(H5LTyytext); +#endif /* H5_HAVE_WIN32_API */ + BEGIN INITIAL; + return STRING; + } + YY_BREAK +case 58: +YY_RULE_SETUP +#line 166 "H5LTanalyze.l" +{return token('{');} + YY_BREAK +case 59: +YY_RULE_SETUP +#line 167 "H5LTanalyze.l" +{return token('}');} + YY_BREAK +case 60: +YY_RULE_SETUP +#line 168 "H5LTanalyze.l" +{return token('[');} + YY_BREAK +case 61: +YY_RULE_SETUP +#line 169 "H5LTanalyze.l" +{return token(']');} + YY_BREAK +case 62: +YY_RULE_SETUP +#line 170 "H5LTanalyze.l" +{return token(':');} + YY_BREAK +case 63: +YY_RULE_SETUP +#line 171 "H5LTanalyze.l" +{return token(';');} + YY_BREAK +case 64: +/* rule 64 can match eol */ +YY_RULE_SETUP +#line 172 "H5LTanalyze.l" +; + YY_BREAK +case 65: +/* rule 65 can match eol */ +YY_RULE_SETUP +#line 173 "H5LTanalyze.l" +{ return 0; } + YY_BREAK +case 66: +YY_RULE_SETUP +#line 175 "H5LTanalyze.l" +ECHO; + YY_BREAK +#line 1545 "H5LTanalyze.c" + case YY_STATE_EOF(INITIAL): + case YY_STATE_EOF(TAG_STRING): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed H5LTyyin at a new source and called + * H5LTyylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = H5LTyyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( H5LTyywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * H5LTyytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of H5LTyylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + yy_size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + H5LTyyrestart(H5LTyyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) H5LTyyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + + (yy_state_ptr) = (yy_state_buf); + *(yy_state_ptr)++ = yy_current_state; + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 545 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *(yy_state_ptr)++ = yy_current_state; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + + register YY_CHAR yy_c = 1; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 545 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 544); + if ( ! yy_is_jam ) + *(yy_state_ptr)++ = yy_current_state; + + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up H5LTyytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register yy_size_t number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + H5LTyyrestart(H5LTyyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( H5LTyywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve H5LTyytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void H5LTyyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + H5LTyyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); + } + + H5LTyy_init_buffer(YY_CURRENT_BUFFER,input_file ); + H5LTyy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void H5LTyy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * H5LTyypop_buffer_state(); + * H5LTyypush_buffer_state(new_buffer); + */ + H5LTyyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + H5LTyy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (H5LTyywrap()) processing, but the only time this flag + * is looked at is after H5LTyywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void H5LTyy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + H5LTyyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE H5LTyy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) H5LTyyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) H5LTyyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + H5LTyy_init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with H5LTyy_create_buffer() + * + */ + void H5LTyy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + H5LTyyfree((void *) b->yy_ch_buf ); + + H5LTyyfree((void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a H5LTyyrestart() or at EOF. + */ + static void H5LTyy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + H5LTyy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then H5LTyy_init_buffer was _probably_ + * called from H5LTyyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void H5LTyy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + H5LTyy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + H5LTyyensure_buffer_stack(); + + /* This block is copied from H5LTyy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from H5LTyy_switch_to_buffer. */ + H5LTyy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void H5LTyypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + H5LTyy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + H5LTyy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void H5LTyyensure_buffer_stack (void) +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)H5LTyyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in H5LTyyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)H5LTyyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in H5LTyyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE H5LTyy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) H5LTyyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + H5LTyy_switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to H5LTyylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * H5LTyy_scan_bytes() instead. + */ +YY_BUFFER_STATE H5LTyy_scan_string (yyconst char * yystr ) +{ + + return H5LTyy_scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to H5LTyylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) H5LTyyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = H5LTyy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in H5LTyy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up H5LTyytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + H5LTyytext[H5LTyyleng] = (yy_hold_char); \ + (yy_c_buf_p) = H5LTyytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + H5LTyyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int H5LTyyget_lineno (void) +{ + + return H5LTyylineno; +} + +/** Get the input stream. + * + */ +FILE *H5LTyyget_in (void) +{ + return H5LTyyin; +} + +/** Get the output stream. + * + */ +FILE *H5LTyyget_out (void) +{ + return H5LTyyout; +} + +/** Get the length of the current token. + * + */ +yy_size_t H5LTyyget_leng (void) +{ + return H5LTyyleng; +} + +/** Get the current token. + * + */ + +char *H5LTyyget_text (void) +{ + return H5LTyytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void H5LTyyset_lineno (int line_number ) +{ + + H5LTyylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see H5LTyy_switch_to_buffer + */ +void H5LTyyset_in (FILE * in_str ) +{ + H5LTyyin = in_str ; +} + +void H5LTyyset_out (FILE * out_str ) +{ + H5LTyyout = out_str ; +} + +int H5LTyyget_debug (void) +{ + return H5LTyy_flex_debug; +} + +void H5LTyyset_debug (int bdebug ) +{ + H5LTyy_flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from H5LTyylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + + (yy_state_buf) = 0; + (yy_state_ptr) = 0; + (yy_full_match) = 0; + (yy_lp) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + H5LTyyin = stdin; + H5LTyyout = stdout; +#else + H5LTyyin = (FILE *) 0; + H5LTyyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * H5LTyylex_init() + */ + return 0; +} + +/* H5LTyylex_destroy is for both reentrant and non-reentrant scanners. */ +int H5LTyylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + H5LTyy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + H5LTyypop_buffer_state(); + } + + /* Destroy the stack itself. */ + H5LTyyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + H5LTyyfree ( (yy_state_buf) ); + (yy_state_buf) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * H5LTyylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *H5LTyyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *H5LTyyrealloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void H5LTyyfree (void * ptr ) +{ + free( (char *) ptr ); /* see H5LTyyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 175 "H5LTanalyze.l" + + +int my_yyinput(char *buf, int max_size) +{ + int ret; + + memcpy(buf, myinput, input_len); + ret = (int)input_len; + return ret; +} + +int H5LTyyerror(const char *msg) +{ + printf("ERROR: %s before \"%s\".\n", msg, H5LTyytext); + return 0; +} + +int H5LTyywrap() +{ + return(1); +} + diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l index 6c883fc..a0c4f42 100644 --- a/hl/src/H5LTanalyze.l +++ b/hl/src/H5LTanalyze.l @@ -13,12 +13,23 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* NOTE! + * + * If you make any changes to H5LTanalyze.l, please run bin/genparser to + * recreate the output files. + */ + %{ #include <stdlib.h> #include <string.h> #include <hdf5.h> #include "H5LTparse.h" +/* Turn off suggest const attribute warning in gcc */ +#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2 +#pragma GCC diagnostic ignored "-Wsuggest-attribute=const" +#endif + int my_yyinput(char *, int); #undef YY_INPUT #define YY_INPUT(b, r, ms) (r=my_yyinput(b, ms)) diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c new file mode 100644 index 0000000..b63cb49 --- /dev/null +++ b/hl/src/H5LTparse.c @@ -0,0 +1,2440 @@ +#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2 +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" +#pragma GCC diagnostic ignored "-Wlarger-than=" +#pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wnested-externs" +#pragma GCC diagnostic ignored "-Wold-style-definition" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +#pragma GCC diagnostic ignored "-Wswitch-default" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-macros" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wredundant-decls" +#elif defined __SUNPRO_CC +#pragma disable_warn +#elif defined _MSC_VER +#pragma warning(push, 1) +#endif +/* A Bison parser, made by GNU Bison 2.7. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.7" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + +/* Substitute the variable and function names. */ +#define yyparse H5LTyyparse +#define yylex H5LTyylex +#define yyerror H5LTyyerror +#define yylval H5LTyylval +#define yychar H5LTyychar +#define yydebug H5LTyydebug +#define yynerrs H5LTyynerrs + +/* Copy the first part of user declarations. */ +/* Line 371 of yacc.c */ +#line 16 "H5LTparse.y" + +#include <stdio.h> +#include <string.h> +#include <hdf5.h> + +extern int yylex(); +extern int yyerror(const char *); + +#define STACK_SIZE 16 + +/*structure for compound type information*/ +struct cmpd_info { + hid_t id; /*type ID*/ + hbool_t is_field; /*flag to lexer for compound member*/ + hbool_t first_memb; /*flag for first compound member*/ +}; + +/*stack for nested compound type*/ +struct cmpd_info cmpd_stack[STACK_SIZE] = { + {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, + {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, + {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, + {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1} }; + +int csindex = -1; /*pointer to the top of compound stack*/ + +/*structure for array type information*/ +struct arr_info { + hsize_t dims[H5S_MAX_RANK]; /*size of each dimension, limited to 32 dimensions*/ + unsigned ndims; /*number of dimensions*/ + hbool_t is_dim; /*flag to lexer for dimension*/ +}; +/*stack for nested array type*/ +struct arr_info arr_stack[STACK_SIZE]; +int asindex = -1; /*pointer to the top of array stack*/ + +hbool_t is_str_size = 0; /*flag to lexer for string size*/ +hbool_t is_str_pad = 0; /*flag to lexer for string padding*/ +H5T_str_t str_pad; /*variable for string padding*/ +H5T_cset_t str_cset; /*variable for string character set*/ +hbool_t is_variable = 0; /*variable for variable-length string*/ +size_t str_size; /*variable for string size*/ + +hid_t enum_id; /*type ID*/ +hbool_t is_enum = 0; /*flag to lexer for enum type*/ +hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/ +char* enum_memb_symbol; /*enum member symbol string*/ + +hbool_t is_opq_size = 0; /*flag to lexer for opaque type size*/ +hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ + + +/* Line 371 of yacc.c */ +#line 128 "H5LTparse.c" + +# ifndef YY_NULL +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULL nullptr +# else +# define YY_NULL 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* In a future release of Bison, this section will be replaced + by #include "H5LTparse.h". */ +#ifndef YY_H5LTYY_H5LTPARSE_H_INCLUDED +# define YY_H5LTYY_H5LTPARSE_H_INCLUDED +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int H5LTyydebug; +#endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + H5T_STD_I8BE_TOKEN = 258, + H5T_STD_I8LE_TOKEN = 259, + H5T_STD_I16BE_TOKEN = 260, + H5T_STD_I16LE_TOKEN = 261, + H5T_STD_I32BE_TOKEN = 262, + H5T_STD_I32LE_TOKEN = 263, + H5T_STD_I64BE_TOKEN = 264, + H5T_STD_I64LE_TOKEN = 265, + H5T_STD_U8BE_TOKEN = 266, + H5T_STD_U8LE_TOKEN = 267, + H5T_STD_U16BE_TOKEN = 268, + H5T_STD_U16LE_TOKEN = 269, + H5T_STD_U32BE_TOKEN = 270, + H5T_STD_U32LE_TOKEN = 271, + H5T_STD_U64BE_TOKEN = 272, + H5T_STD_U64LE_TOKEN = 273, + H5T_NATIVE_CHAR_TOKEN = 274, + H5T_NATIVE_SCHAR_TOKEN = 275, + H5T_NATIVE_UCHAR_TOKEN = 276, + H5T_NATIVE_SHORT_TOKEN = 277, + H5T_NATIVE_USHORT_TOKEN = 278, + H5T_NATIVE_INT_TOKEN = 279, + H5T_NATIVE_UINT_TOKEN = 280, + H5T_NATIVE_LONG_TOKEN = 281, + H5T_NATIVE_ULONG_TOKEN = 282, + H5T_NATIVE_LLONG_TOKEN = 283, + H5T_NATIVE_ULLONG_TOKEN = 284, + H5T_IEEE_F32BE_TOKEN = 285, + H5T_IEEE_F32LE_TOKEN = 286, + H5T_IEEE_F64BE_TOKEN = 287, + H5T_IEEE_F64LE_TOKEN = 288, + H5T_NATIVE_FLOAT_TOKEN = 289, + H5T_NATIVE_DOUBLE_TOKEN = 290, + H5T_NATIVE_LDOUBLE_TOKEN = 291, + H5T_STRING_TOKEN = 292, + STRSIZE_TOKEN = 293, + STRPAD_TOKEN = 294, + CSET_TOKEN = 295, + CTYPE_TOKEN = 296, + H5T_VARIABLE_TOKEN = 297, + H5T_STR_NULLTERM_TOKEN = 298, + H5T_STR_NULLPAD_TOKEN = 299, + H5T_STR_SPACEPAD_TOKEN = 300, + H5T_CSET_ASCII_TOKEN = 301, + H5T_CSET_UTF8_TOKEN = 302, + H5T_C_S1_TOKEN = 303, + H5T_FORTRAN_S1_TOKEN = 304, + H5T_OPAQUE_TOKEN = 305, + OPQ_SIZE_TOKEN = 306, + OPQ_TAG_TOKEN = 307, + H5T_COMPOUND_TOKEN = 308, + H5T_ENUM_TOKEN = 309, + H5T_ARRAY_TOKEN = 310, + H5T_VLEN_TOKEN = 311, + STRING = 312, + NUMBER = 313 + }; +#endif + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ +/* Line 387 of yacc.c */ +#line 68 "H5LTparse.y" + + int ival; /*for integer token*/ + char *sval; /*for name string*/ + hid_t hid; /*for hid_t token*/ + + +/* Line 387 of yacc.c */ +#line 236 "H5LTparse.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + +extern YYSTYPE H5LTyylval; + +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +hid_t H5LTyyparse (void *YYPARSE_PARAM); +#else +hid_t H5LTyyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +hid_t H5LTyyparse (void); +#else +hid_t H5LTyyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + +#endif /* !YY_H5LTYY_H5LTPARSE_H_INCLUDED */ + +/* Copy the second part of user declarations. */ + +/* Line 390 of yacc.c */ +#line 264 "H5LTparse.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(N) (N) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 58 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 203 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 66 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 46 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 95 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 143 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 313 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 63, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 64, 65, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 61, 2, 62, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 59, 2, 60, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint8 yyprhs[] = +{ + 0, 0, 3, 4, 6, 8, 10, 12, 14, 16, + 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, + 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, + 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, + 78, 80, 82, 84, 86, 88, 90, 92, 93, 99, + 100, 103, 104, 112, 114, 115, 118, 120, 121, 128, + 129, 132, 133, 134, 140, 142, 147, 148, 149, 150, + 151, 167, 169, 171, 172, 173, 174, 175, 176, 197, + 199, 201, 203, 205, 207, 209, 211, 213, 215, 216, + 224, 225, 228, 229, 236, 238 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 67, 0, -1, -1, 68, -1, 69, -1, 72, -1, + 80, -1, 87, -1, 70, -1, 71, -1, 95, -1, + 105, -1, 88, -1, 3, -1, 4, -1, 5, -1, + 6, -1, 7, -1, 8, -1, 9, -1, 10, -1, + 11, -1, 12, -1, 13, -1, 14, -1, 15, -1, + 16, -1, 17, -1, 18, -1, 19, -1, 20, -1, + 21, -1, 22, -1, 23, -1, 24, -1, 25, -1, + 26, -1, 27, -1, 28, -1, 29, -1, 30, -1, + 31, -1, 32, -1, 33, -1, 34, -1, 35, -1, + 36, -1, -1, 53, 73, 59, 74, 60, -1, -1, + 74, 75, -1, -1, 68, 76, 63, 77, 63, 78, + 65, -1, 57, -1, -1, 64, 79, -1, 58, -1, + -1, 55, 81, 59, 82, 68, 60, -1, -1, 82, + 83, -1, -1, -1, 61, 84, 86, 85, 62, -1, + 58, -1, 56, 59, 68, 60, -1, -1, -1, -1, + -1, 50, 59, 51, 89, 93, 65, 90, 52, 91, + 63, 94, 63, 65, 92, 60, -1, 58, -1, 57, + -1, -1, -1, -1, -1, -1, 37, 59, 38, 96, + 101, 65, 97, 39, 102, 65, 98, 40, 103, 65, + 99, 41, 104, 65, 100, 60, -1, 42, -1, 58, + -1, 43, -1, 44, -1, 45, -1, 46, -1, 47, + -1, 48, -1, 49, -1, -1, 54, 59, 70, 65, + 106, 107, 60, -1, -1, 107, 108, -1, -1, 63, + 110, 63, 109, 111, 65, -1, 57, -1, 58, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 101, 101, 102, 104, 105, 106, 107, 109, 110, + 111, 112, 113, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 145, 146, 147, 148, 149, 150, 151, 155, 154, 163, + 164, 166, 166, 200, 206, 207, 210, 212, 212, 221, + 222, 224, 225, 224, 232, 235, 241, 242, 247, 248, + 239, 254, 256, 260, 261, 269, 278, 285, 258, 309, + 310, 312, 313, 314, 316, 317, 319, 320, 324, 323, + 328, 329, 331, 331, 383, 385 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 0 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "H5T_STD_I8BE_TOKEN", + "H5T_STD_I8LE_TOKEN", "H5T_STD_I16BE_TOKEN", "H5T_STD_I16LE_TOKEN", + "H5T_STD_I32BE_TOKEN", "H5T_STD_I32LE_TOKEN", "H5T_STD_I64BE_TOKEN", + "H5T_STD_I64LE_TOKEN", "H5T_STD_U8BE_TOKEN", "H5T_STD_U8LE_TOKEN", + "H5T_STD_U16BE_TOKEN", "H5T_STD_U16LE_TOKEN", "H5T_STD_U32BE_TOKEN", + "H5T_STD_U32LE_TOKEN", "H5T_STD_U64BE_TOKEN", "H5T_STD_U64LE_TOKEN", + "H5T_NATIVE_CHAR_TOKEN", "H5T_NATIVE_SCHAR_TOKEN", + "H5T_NATIVE_UCHAR_TOKEN", "H5T_NATIVE_SHORT_TOKEN", + "H5T_NATIVE_USHORT_TOKEN", "H5T_NATIVE_INT_TOKEN", + "H5T_NATIVE_UINT_TOKEN", "H5T_NATIVE_LONG_TOKEN", + "H5T_NATIVE_ULONG_TOKEN", "H5T_NATIVE_LLONG_TOKEN", + "H5T_NATIVE_ULLONG_TOKEN", "H5T_IEEE_F32BE_TOKEN", + "H5T_IEEE_F32LE_TOKEN", "H5T_IEEE_F64BE_TOKEN", "H5T_IEEE_F64LE_TOKEN", + "H5T_NATIVE_FLOAT_TOKEN", "H5T_NATIVE_DOUBLE_TOKEN", + "H5T_NATIVE_LDOUBLE_TOKEN", "H5T_STRING_TOKEN", "STRSIZE_TOKEN", + "STRPAD_TOKEN", "CSET_TOKEN", "CTYPE_TOKEN", "H5T_VARIABLE_TOKEN", + "H5T_STR_NULLTERM_TOKEN", "H5T_STR_NULLPAD_TOKEN", + "H5T_STR_SPACEPAD_TOKEN", "H5T_CSET_ASCII_TOKEN", "H5T_CSET_UTF8_TOKEN", + "H5T_C_S1_TOKEN", "H5T_FORTRAN_S1_TOKEN", "H5T_OPAQUE_TOKEN", + "OPQ_SIZE_TOKEN", "OPQ_TAG_TOKEN", "H5T_COMPOUND_TOKEN", + "H5T_ENUM_TOKEN", "H5T_ARRAY_TOKEN", "H5T_VLEN_TOKEN", "STRING", + "NUMBER", "'{'", "'}'", "'['", "']'", "'\"'", "':'", "';'", "$accept", + "start", "ddl_type", "atomic_type", "integer_type", "fp_type", + "compound_type", "$@1", "memb_list", "memb_def", "$@2", "field_name", + "field_offset", "offset", "array_type", "$@3", "dim_list", "dim", "$@4", + "$@5", "dimsize", "vlen_type", "opaque_type", "$@6", "@7", "$@8", "$@9", + "opaque_size", "opaque_tag", "string_type", "$@10", "$@11", "$@12", + "$@13", "@14", "strsize", "strpad", "cset", "ctype", "enum_type", "$@15", + "enum_list", "enum_def", "$@16", "enum_symbol", "enum_val", YY_NULL +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 123, + 125, 91, 93, 34, 58, 59 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 66, 67, 67, 68, 68, 68, 68, 69, 69, + 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 71, 71, 71, 71, 71, 71, 71, 73, 72, 74, + 74, 76, 75, 77, 78, 78, 79, 81, 80, 82, + 82, 84, 85, 83, 86, 87, 89, 90, 91, 92, + 88, 93, 94, 96, 97, 98, 99, 100, 95, 101, + 101, 102, 102, 102, 103, 103, 104, 104, 106, 105, + 107, 107, 109, 108, 110, 111 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, 5, 0, + 2, 0, 7, 1, 0, 2, 1, 0, 6, 0, + 2, 0, 0, 5, 1, 4, 0, 0, 0, 0, + 15, 1, 1, 0, 0, 0, 0, 0, 20, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 0, 7, + 0, 2, 0, 6, 1, 1 +}; + +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 2, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 0, 0, 47, 0, 57, + 0, 0, 3, 4, 8, 9, 5, 6, 7, 12, + 10, 11, 0, 0, 0, 0, 0, 0, 1, 73, + 66, 49, 0, 59, 0, 0, 0, 0, 88, 0, + 65, 79, 80, 0, 71, 0, 48, 51, 50, 90, + 61, 0, 60, 74, 67, 0, 0, 0, 58, 0, + 0, 0, 89, 0, 91, 64, 62, 0, 68, 53, + 0, 94, 0, 0, 81, 82, 83, 0, 0, 54, + 92, 63, 75, 0, 0, 0, 0, 0, 72, 0, + 56, 55, 52, 95, 0, 0, 0, 93, 84, 85, + 0, 69, 76, 0, 0, 70, 0, 86, 87, 0, + 77, 0, 78 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 41, 42, 43, 44, 45, 46, 54, 67, 78, + 85, 100, 115, 121, 47, 56, 69, 82, 87, 103, + 96, 48, 49, 66, 90, 108, 133, 75, 119, 50, + 65, 89, 117, 134, 141, 73, 107, 130, 139, 51, + 79, 86, 94, 116, 102, 124 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -25 +static const yytype_int16 yypact[] = +{ + 114, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -24, -20, -25, -15, -25, + -14, 49, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, 19, 45, 38, 168, 39, 114, -25, -25, + -25, -25, 34, -25, 40, -4, 43, 56, -25, -3, + -25, -25, -25, 37, -25, 42, -25, -25, -25, -25, + -25, 44, -25, -25, -25, 50, -23, 47, -25, 64, + 62, 51, -25, 58, -25, -25, -25, -2, -25, -25, + 89, -25, 90, 92, -25, -25, -25, 91, 94, 95, + -25, -25, -25, 98, 100, 96, 102, 122, -25, 103, + -25, -25, -25, -25, 133, 9, 134, -25, -25, -25, + 135, -25, -25, 105, 160, -25, 46, -25, -25, 137, + -25, 143, -25 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -25, -25, -21, -25, 108, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -1 +static const yytype_uint8 yytable[] = +{ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 52, 64, 92, 71, 53, + 93, 104, 105, 106, 55, 57, 77, 36, 81, 58, + 37, 38, 39, 40, 72, 128, 129, 59, 80, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 137, 138, 60, 61, 63, 68, + 70, 74, 83, 97, 88, 95, 36, 84, 99, 37, + 38, 39, 40, 91, 98, 101, 76, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 109, 110, 111, 118, 112, 113, 120, 114, + 123, 122, 125, 62, 36, 135, 126, 37, 38, 39, + 40, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 127, 131, + 132, 136, 140, 142 +}; + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-25))) + +#define yytable_value_is_error(Yytable_value) \ + YYID (0) + +static const yytype_uint8 yycheck[] = +{ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 59, 57, 60, 42, 59, + 63, 43, 44, 45, 59, 59, 67, 50, 69, 0, + 53, 54, 55, 56, 58, 46, 47, 38, 61, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 48, 49, 51, 59, 59, 65, + 60, 58, 65, 39, 60, 58, 50, 65, 57, 53, + 54, 55, 56, 63, 52, 57, 60, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 63, 63, 62, 57, 65, 63, 58, 64, + 58, 65, 40, 55, 50, 60, 63, 53, 54, 55, + 56, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 65, 65, + 65, 41, 65, 60 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 50, 53, 54, 55, + 56, 67, 68, 69, 70, 71, 72, 80, 87, 88, + 95, 105, 59, 59, 73, 59, 81, 59, 0, 38, + 51, 59, 70, 59, 68, 96, 89, 74, 65, 82, + 60, 42, 58, 101, 58, 93, 60, 68, 75, 106, + 61, 68, 83, 65, 65, 76, 107, 84, 60, 97, + 90, 63, 60, 63, 108, 58, 86, 39, 52, 57, + 77, 57, 110, 85, 43, 44, 45, 102, 91, 63, + 63, 62, 65, 63, 64, 78, 109, 98, 57, 94, + 58, 79, 65, 58, 111, 40, 63, 65, 46, 47, + 103, 65, 65, 92, 99, 60, 41, 48, 49, 104, + 65, 100, 60 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ + +#define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULL; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - Assume YYFAIL is not used. It's too flawed to consider. See + <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> + for details. YYERROR is fine as it does not invoke this + function. + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + YYUSE (yyvaluep); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + + + + +/* The lookahead symbol. */ +int yychar; + + +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); + +/* Number of syntax errors so far. */ +int yynerrs; + + +/*----------. +| yyparse. | +`----------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +hid_t +yyparse (void *YYPARSE_PARAM) +#else +hid_t +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +hid_t +yyparse (void) +#else +hid_t +yyparse () + +#endif +#endif +{ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +/* Line 1807 of yacc.c */ +#line 101 "H5LTparse.y" + { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } + break; + + case 3: +/* Line 1807 of yacc.c */ +#line 102 "H5LTparse.y" + { return (yyval.hid);} + break; + + case 13: +/* Line 1807 of yacc.c */ +#line 116 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I8BE); } + break; + + case 14: +/* Line 1807 of yacc.c */ +#line 117 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I8LE); } + break; + + case 15: +/* Line 1807 of yacc.c */ +#line 118 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I16BE); } + break; + + case 16: +/* Line 1807 of yacc.c */ +#line 119 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I16LE); } + break; + + case 17: +/* Line 1807 of yacc.c */ +#line 120 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I32BE); } + break; + + case 18: +/* Line 1807 of yacc.c */ +#line 121 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I32LE); } + break; + + case 19: +/* Line 1807 of yacc.c */ +#line 122 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I64BE); } + break; + + case 20: +/* Line 1807 of yacc.c */ +#line 123 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I64LE); } + break; + + case 21: +/* Line 1807 of yacc.c */ +#line 124 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U8BE); } + break; + + case 22: +/* Line 1807 of yacc.c */ +#line 125 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U8LE); } + break; + + case 23: +/* Line 1807 of yacc.c */ +#line 126 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U16BE); } + break; + + case 24: +/* Line 1807 of yacc.c */ +#line 127 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U16LE); } + break; + + case 25: +/* Line 1807 of yacc.c */ +#line 128 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U32BE); } + break; + + case 26: +/* Line 1807 of yacc.c */ +#line 129 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U32LE); } + break; + + case 27: +/* Line 1807 of yacc.c */ +#line 130 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U64BE); } + break; + + case 28: +/* Line 1807 of yacc.c */ +#line 131 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U64LE); } + break; + + case 29: +/* Line 1807 of yacc.c */ +#line 132 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); } + break; + + case 30: +/* Line 1807 of yacc.c */ +#line 133 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); } + break; + + case 31: +/* Line 1807 of yacc.c */ +#line 134 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); } + break; + + case 32: +/* Line 1807 of yacc.c */ +#line 135 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); } + break; + + case 33: +/* Line 1807 of yacc.c */ +#line 136 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); } + break; + + case 34: +/* Line 1807 of yacc.c */ +#line 137 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); } + break; + + case 35: +/* Line 1807 of yacc.c */ +#line 138 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); } + break; + + case 36: +/* Line 1807 of yacc.c */ +#line 139 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); } + break; + + case 37: +/* Line 1807 of yacc.c */ +#line 140 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); } + break; + + case 38: +/* Line 1807 of yacc.c */ +#line 141 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); } + break; + + case 39: +/* Line 1807 of yacc.c */ +#line 142 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); } + break; + + case 40: +/* Line 1807 of yacc.c */ +#line 145 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); } + break; + + case 41: +/* Line 1807 of yacc.c */ +#line 146 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); } + break; + + case 42: +/* Line 1807 of yacc.c */ +#line 147 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); } + break; + + case 43: +/* Line 1807 of yacc.c */ +#line 148 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); } + break; + + case 44: +/* Line 1807 of yacc.c */ +#line 149 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); } + break; + + case 45: +/* Line 1807 of yacc.c */ +#line 150 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); } + break; + + case 46: +/* Line 1807 of yacc.c */ +#line 151 "H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); } + break; + + case 47: +/* Line 1807 of yacc.c */ +#line 155 "H5LTparse.y" + { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ } + break; + + case 48: +/* Line 1807 of yacc.c */ +#line 157 "H5LTparse.y" + { (yyval.hid) = cmpd_stack[csindex].id; + cmpd_stack[csindex].id = 0; + cmpd_stack[csindex].first_memb = 1; + csindex--; + } + break; + + case 51: +/* Line 1807 of yacc.c */ +#line 166 "H5LTparse.y" + { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ } + break; + + case 52: +/* Line 1807 of yacc.c */ +#line 168 "H5LTparse.y" + { + size_t origin_size, new_size; + hid_t dtype_id = cmpd_stack[csindex].id; + + /*Adjust size and insert member, consider both member size and offset.*/ + if(cmpd_stack[csindex].first_memb) { /*reclaim the size 1 temporarily set*/ + new_size = H5Tget_size((yyvsp[(1) - (7)].hid)) + (yyvsp[(6) - (7)].ival); + H5Tset_size(dtype_id, new_size); + /*member name is saved in yylval.sval by lexer*/ + H5Tinsert(dtype_id, (yyvsp[(4) - (7)].sval), (yyvsp[(6) - (7)].ival), (yyvsp[(1) - (7)].hid)); + + cmpd_stack[csindex].first_memb = 0; + } else { + origin_size = H5Tget_size(dtype_id); + + if((yyvsp[(6) - (7)].ival) == 0) { + new_size = origin_size + H5Tget_size((yyvsp[(1) - (7)].hid)); + H5Tset_size(dtype_id, new_size); + H5Tinsert(dtype_id, (yyvsp[(4) - (7)].sval), origin_size, (yyvsp[(1) - (7)].hid)); + } else { + new_size = (yyvsp[(6) - (7)].ival) + H5Tget_size((yyvsp[(1) - (7)].hid)); + H5Tset_size(dtype_id, new_size); + H5Tinsert(dtype_id, (yyvsp[(4) - (7)].sval), (yyvsp[(6) - (7)].ival), (yyvsp[(1) - (7)].hid)); + } + } + + cmpd_stack[csindex].is_field = 0; + H5Tclose((yyvsp[(1) - (7)].hid)); + + new_size = H5Tget_size(dtype_id); + } + break; + + case 53: +/* Line 1807 of yacc.c */ +#line 201 "H5LTparse.y" + { + (yyval.sval) = yylval.sval; + } + break; + + case 54: +/* Line 1807 of yacc.c */ +#line 206 "H5LTparse.y" + { (yyval.ival) = 0; } + break; + + case 55: +/* Line 1807 of yacc.c */ +#line 208 "H5LTparse.y" + { (yyval.ival) = yylval.ival; } + break; + + case 57: +/* Line 1807 of yacc.c */ +#line 212 "H5LTparse.y" + { asindex++; /*pushd onto the stack*/ } + break; + + case 58: +/* Line 1807 of yacc.c */ +#line 214 "H5LTparse.y" + { + (yyval.hid) = H5Tarray_create2((yyvsp[(5) - (6)].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims); + arr_stack[asindex].ndims = 0; + asindex--; + H5Tclose((yyvsp[(5) - (6)].hid)); + } + break; + + case 61: +/* Line 1807 of yacc.c */ +#line 224 "H5LTparse.y" + { arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ } + break; + + case 62: +/* Line 1807 of yacc.c */ +#line 225 "H5LTparse.y" + { unsigned ndims = arr_stack[asindex].ndims; + arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; + arr_stack[asindex].ndims++; + arr_stack[asindex].is_dim = 0; + } + break; + + case 65: +/* Line 1807 of yacc.c */ +#line 236 "H5LTparse.y" + { (yyval.hid) = H5Tvlen_create((yyvsp[(3) - (4)].hid)); H5Tclose((yyvsp[(3) - (4)].hid)); } + break; + + case 66: +/* Line 1807 of yacc.c */ +#line 241 "H5LTparse.y" + { is_opq_size = 1; } + break; + + case 67: +/* Line 1807 of yacc.c */ +#line 242 "H5LTparse.y" + { + size_t size = (size_t)yylval.ival; + (yyval.hid) = H5Tcreate(H5T_OPAQUE, size); + is_opq_size = 0; + } + break; + + case 68: +/* Line 1807 of yacc.c */ +#line 247 "H5LTparse.y" + { is_opq_tag = 1; } + break; + + case 69: +/* Line 1807 of yacc.c */ +#line 248 "H5LTparse.y" + { + H5Tset_tag((yyvsp[(7) - (13)].hid), yylval.sval); + is_opq_tag = 0; + } + break; + + case 70: +/* Line 1807 of yacc.c */ +#line 252 "H5LTparse.y" + { (yyval.hid) = (yyvsp[(7) - (15)].hid); } + break; + + case 73: +/* Line 1807 of yacc.c */ +#line 260 "H5LTparse.y" + { is_str_size = 1; } + break; + + case 74: +/* Line 1807 of yacc.c */ +#line 261 "H5LTparse.y" + { + if((yyvsp[(5) - (6)].ival) == H5T_VARIABLE_TOKEN) + is_variable = 1; + else + str_size = yylval.ival; + is_str_size = 0; + } + break; + + case 75: +/* Line 1807 of yacc.c */ +#line 269 "H5LTparse.y" + { + if((yyvsp[(9) - (10)].ival) == H5T_STR_NULLTERM_TOKEN) + str_pad = H5T_STR_NULLTERM; + else if((yyvsp[(9) - (10)].ival) == H5T_STR_NULLPAD_TOKEN) + str_pad = H5T_STR_NULLPAD; + else if((yyvsp[(9) - (10)].ival) == H5T_STR_SPACEPAD_TOKEN) + str_pad = H5T_STR_SPACEPAD; + } + break; + + case 76: +/* Line 1807 of yacc.c */ +#line 278 "H5LTparse.y" + { + if((yyvsp[(13) - (14)].ival) == H5T_CSET_ASCII_TOKEN) + str_cset = H5T_CSET_ASCII; + else if((yyvsp[(13) - (14)].ival) == H5T_CSET_UTF8_TOKEN) + str_cset = H5T_CSET_UTF8; + } + break; + + case 77: +/* Line 1807 of yacc.c */ +#line 285 "H5LTparse.y" + { + if((yyvsp[(17) - (18)].hid) == H5T_C_S1_TOKEN) + (yyval.hid) = H5Tcopy(H5T_C_S1); + else if((yyvsp[(17) - (18)].hid) == H5T_FORTRAN_S1_TOKEN) + (yyval.hid) = H5Tcopy(H5T_FORTRAN_S1); + } + break; + + case 78: +/* Line 1807 of yacc.c */ +#line 292 "H5LTparse.y" + { + hid_t str_id = (yyvsp[(19) - (20)].hid); + + /*set string size*/ + if(is_variable) { + H5Tset_size(str_id, H5T_VARIABLE); + is_variable = 0; + } else + H5Tset_size(str_id, str_size); + + /*set string padding and character set*/ + H5Tset_strpad(str_id, str_pad); + H5Tset_cset(str_id, str_cset); + + (yyval.hid) = str_id; + } + break; + + case 79: +/* Line 1807 of yacc.c */ +#line 309 "H5LTparse.y" + {(yyval.ival) = H5T_VARIABLE_TOKEN;} + break; + + case 81: +/* Line 1807 of yacc.c */ +#line 312 "H5LTparse.y" + {(yyval.ival) = H5T_STR_NULLTERM_TOKEN;} + break; + + case 82: +/* Line 1807 of yacc.c */ +#line 313 "H5LTparse.y" + {(yyval.ival) = H5T_STR_NULLPAD_TOKEN;} + break; + + case 83: +/* Line 1807 of yacc.c */ +#line 314 "H5LTparse.y" + {(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;} + break; + + case 84: +/* Line 1807 of yacc.c */ +#line 316 "H5LTparse.y" + {(yyval.ival) = H5T_CSET_ASCII_TOKEN;} + break; + + case 85: +/* Line 1807 of yacc.c */ +#line 317 "H5LTparse.y" + {(yyval.ival) = H5T_CSET_UTF8_TOKEN;} + break; + + case 86: +/* Line 1807 of yacc.c */ +#line 319 "H5LTparse.y" + {(yyval.hid) = H5T_C_S1_TOKEN;} + break; + + case 87: +/* Line 1807 of yacc.c */ +#line 320 "H5LTparse.y" + {(yyval.hid) = H5T_FORTRAN_S1_TOKEN;} + break; + + case 88: +/* Line 1807 of yacc.c */ +#line 324 "H5LTparse.y" + { is_enum = 1; enum_id = H5Tenum_create((yyvsp[(3) - (4)].hid)); H5Tclose((yyvsp[(3) - (4)].hid)); } + break; + + case 89: +/* Line 1807 of yacc.c */ +#line 326 "H5LTparse.y" + { is_enum = 0; /*reset*/ (yyval.hid) = enum_id; } + break; + + case 92: +/* Line 1807 of yacc.c */ +#line 331 "H5LTparse.y" + { + is_enum_memb = 1; /*indicate member of enum*/ +#ifdef H5_HAVE_WIN32_API + enum_memb_symbol = _strdup(yylval.sval); +#else /* H5_HAVE_WIN32_API */ + enum_memb_symbol = strdup(yylval.sval); +#endif /* H5_HAVE_WIN32_API */ + } + break; + + case 93: +/* Line 1807 of yacc.c */ +#line 340 "H5LTparse.y" + { + char char_val=(char)yylval.ival; + short short_val=(short)yylval.ival; + int int_val=(int)yylval.ival; + long long_val=(long)yylval.ival; + long long llong_val=(long long)yylval.ival; + hid_t super = H5Tget_super(enum_id); + hid_t native = H5Tget_native_type(super, H5T_DIR_ASCEND); + H5T_order_t super_order = H5Tget_order(super); + H5T_order_t native_order = H5Tget_order(native); + + if(is_enum && is_enum_memb) { /*if it's an enum member*/ + /*To handle machines of different endianness*/ + if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &char_val, NULL, H5P_DEFAULT); + H5Tenum_insert(enum_id, enum_memb_symbol, &char_val); + } else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &short_val, NULL, H5P_DEFAULT); + H5Tenum_insert(enum_id, enum_memb_symbol, &short_val); + } else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &int_val, NULL, H5P_DEFAULT); + H5Tenum_insert(enum_id, enum_memb_symbol, &int_val); + } else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &long_val, NULL, H5P_DEFAULT); + H5Tenum_insert(enum_id, enum_memb_symbol, &long_val); + } else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &llong_val, NULL, H5P_DEFAULT); + H5Tenum_insert(enum_id, enum_memb_symbol, &llong_val); + } + + is_enum_memb = 0; + if(enum_memb_symbol) free(enum_memb_symbol); + } + + H5Tclose(super); + H5Tclose(native); + } + break; + + +/* Line 1807 of yacc.c */ +#line 2191 "H5LTparse.c" + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + diff --git a/hl/src/H5LTparse.h b/hl/src/H5LTparse.h new file mode 100644 index 0000000..621dacd --- /dev/null +++ b/hl/src/H5LTparse.h @@ -0,0 +1,144 @@ +/* A Bison parser, made by GNU Bison 2.7. */ + +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +#ifndef YY_H5LTYY_H5LTPARSE_H_INCLUDED +# define YY_H5LTYY_H5LTPARSE_H_INCLUDED +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int H5LTyydebug; +#endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + H5T_STD_I8BE_TOKEN = 258, + H5T_STD_I8LE_TOKEN = 259, + H5T_STD_I16BE_TOKEN = 260, + H5T_STD_I16LE_TOKEN = 261, + H5T_STD_I32BE_TOKEN = 262, + H5T_STD_I32LE_TOKEN = 263, + H5T_STD_I64BE_TOKEN = 264, + H5T_STD_I64LE_TOKEN = 265, + H5T_STD_U8BE_TOKEN = 266, + H5T_STD_U8LE_TOKEN = 267, + H5T_STD_U16BE_TOKEN = 268, + H5T_STD_U16LE_TOKEN = 269, + H5T_STD_U32BE_TOKEN = 270, + H5T_STD_U32LE_TOKEN = 271, + H5T_STD_U64BE_TOKEN = 272, + H5T_STD_U64LE_TOKEN = 273, + H5T_NATIVE_CHAR_TOKEN = 274, + H5T_NATIVE_SCHAR_TOKEN = 275, + H5T_NATIVE_UCHAR_TOKEN = 276, + H5T_NATIVE_SHORT_TOKEN = 277, + H5T_NATIVE_USHORT_TOKEN = 278, + H5T_NATIVE_INT_TOKEN = 279, + H5T_NATIVE_UINT_TOKEN = 280, + H5T_NATIVE_LONG_TOKEN = 281, + H5T_NATIVE_ULONG_TOKEN = 282, + H5T_NATIVE_LLONG_TOKEN = 283, + H5T_NATIVE_ULLONG_TOKEN = 284, + H5T_IEEE_F32BE_TOKEN = 285, + H5T_IEEE_F32LE_TOKEN = 286, + H5T_IEEE_F64BE_TOKEN = 287, + H5T_IEEE_F64LE_TOKEN = 288, + H5T_NATIVE_FLOAT_TOKEN = 289, + H5T_NATIVE_DOUBLE_TOKEN = 290, + H5T_NATIVE_LDOUBLE_TOKEN = 291, + H5T_STRING_TOKEN = 292, + STRSIZE_TOKEN = 293, + STRPAD_TOKEN = 294, + CSET_TOKEN = 295, + CTYPE_TOKEN = 296, + H5T_VARIABLE_TOKEN = 297, + H5T_STR_NULLTERM_TOKEN = 298, + H5T_STR_NULLPAD_TOKEN = 299, + H5T_STR_SPACEPAD_TOKEN = 300, + H5T_CSET_ASCII_TOKEN = 301, + H5T_CSET_UTF8_TOKEN = 302, + H5T_C_S1_TOKEN = 303, + H5T_FORTRAN_S1_TOKEN = 304, + H5T_OPAQUE_TOKEN = 305, + OPQ_SIZE_TOKEN = 306, + OPQ_TAG_TOKEN = 307, + H5T_COMPOUND_TOKEN = 308, + H5T_ENUM_TOKEN = 309, + H5T_ARRAY_TOKEN = 310, + H5T_VLEN_TOKEN = 311, + STRING = 312, + NUMBER = 313 + }; +#endif + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ +/* Line 2065 of yacc.c */ +#line 68 "H5LTparse.y" + + int ival; /*for integer token*/ + char *sval; /*for name string*/ + hid_t hid; /*for hid_t token*/ + + +/* Line 2065 of yacc.c */ +#line 122 "H5LTparse.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + +extern YYSTYPE H5LTyylval; + +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int H5LTyyparse (void *YYPARSE_PARAM); +#else +int H5LTyyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int H5LTyyparse (void); +#else +int H5LTyyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + +#endif /* !YY_H5LTYY_H5LTPARSE_H_INCLUDED */ diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y index 4c07533..80dcc42 100644 --- a/hl/src/H5LTparse.y +++ b/hl/src/H5LTparse.y @@ -13,6 +13,12 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* NOTE! + * + * If you make any changes to H5LTparse.y, please run bin/genparser to + * recreate the output files. + */ + %{ #include <stdio.h> #include <string.h> @@ -190,7 +196,10 @@ memb_def : ddl_type { cmpd_stack[csindex].is_field = 1; /*notify le H5Tinsert(dtype_id, $<sval>4, $<ival>6, $<hid>1); } } - + if($<sval>4) { + free($<sval>4); + $<sval>4 = NULL; + } cmpd_stack[csindex].is_field = 0; H5Tclose($<hid>1); @@ -199,7 +208,9 @@ memb_def : ddl_type { cmpd_stack[csindex].is_field = 1; /*notify le ; field_name : STRING { - $<sval>$ = yylval.sval; + $<sval>$ = strdup(yylval.sval); + free(yylval.sval); + yylval.sval = NULL; } ; field_offset : /*empty*/ @@ -247,6 +258,8 @@ opaque_type : H5T_OPAQUE_TOKEN OPQ_TAG_TOKEN { is_opq_tag = 1; } '"' opaque_tag '"' ';' { H5Tset_tag($<hid>7, yylval.sval); + free(yylval.sval); + yylval.sval = NULL; is_opq_tag = 0; } '}' { $<hid>$ = $<hid>7; } @@ -335,6 +348,8 @@ enum_def : '"' enum_symbol '"' { #else /* H5_HAVE_WIN32_API */ enum_memb_symbol = strdup(yylval.sval); #endif /* H5_HAVE_WIN32_API */ + free(yylval.sval); + yylval.sval = NULL; } enum_val ';' { diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c index 831fa23..9b18539 100644 --- a/hl/test/test_file_image.c +++ b/hl/test/test_file_image.c @@ -158,7 +158,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) FAIL_PUTS_ERROR("H5Dclose() failed"); /* get size of the file image i */ - if ((buf_size[i] = H5Fget_file_image(file_id[i], NULL, 0)) < 0) + if ((buf_size[i] = H5Fget_file_image(file_id[i], NULL, (size_t)0)) < 0) FAIL_PUTS_ERROR("H5Fget_file_image() failed"); /* allocate buffer for the file image i */ @@ -370,7 +370,9 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) H5Aclose(attr_id); } H5E_END_TRY; #endif - file_id[i] = -1; + if (H5Dclose(dset_id[i]) < 0) + FAIL_PUTS_ERROR("H5Dclose() failed"); + dset_id[i] = -1; } /* end if */ else { /* write dataset without extending it */ @@ -399,7 +401,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) /* read open file images and verify data */ for (i = 0; i < open_images; i++) { /* if opening the file image failed, continue next iteration */ - if ((file_id[i] < 0) || (!(input_flags[i] & H5LT_FILE_IMAGE_OPEN_RW ))) + if ((dset_id[i] < 0) || (file_id[i] < 0) || (!(input_flags[i] & H5LT_FILE_IMAGE_OPEN_RW ))) continue; /* open dataset in file image */ diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 9d625e9..f3258d6 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1282,6 +1282,7 @@ static int test_strings(void) HDfree(dt_str); goto out; } + HDfree(dt_str); /* Length of the character buffer is smaller then needed */ str_len = 21; diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 783c30d..e745084 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -637,18 +637,18 @@ build and test process. VIII. Options for Platform Configuration Files ======================================================================== -Below is the HDF518config.cmake ctest script with extra comments. +Below is the HDF5config.cmake ctest script with extra comments. Execute: - ctest -S HDF518config.cmake,BUILD_GENERATOR=xxx -C Release -V -O hdf518.log + ctest -S HDF5config.cmake,BUILD_GENERATOR=xxx -C Release -V -O hdf5.log The same scripts can be used on Linux, Mac OSX or a Windows machine by adding an option (${CTEST_SCRIPT_ARG}) to the platform configuration script. -########################################################################################## -### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ### -### BUILD_GENERATOR required [Unix, VS2013, VS201364, VS2012, VS201264] ### -### ctest -S HDF518config.cmake,BUILD_GENERATOR=VS201264 -C Release -V -O hdf518.log ### -########################################################################################## +############################################################################################# +### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ### +### BUILD_GENERATOR required [Unix, VS2015, VS201564, VS2013, VS201364, VS2012, VS201264] ### +### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201264 -C Release -V -O hdf519.log ### +############################################################################################# cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) ############################################################################ @@ -657,6 +657,8 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # where valid options for OPTION are: # BUILD_GENERATOR - The cmake build generator: # Unix * Unix Makefiles +# VS2015 * Visual Studio 14 2015 +# VS201564 * Visual Studio 14 2015 Win64 # VS2013 * Visual Studio 12 2013 # VS201364 * Visual Studio 12 2013 Win64 # VS2012 * Visual Studio 11 2012 @@ -665,7 +667,8 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # INSTALLDIR - root folder where hdf5 is installed # CTEST_BUILD_CONFIGURATION - Release, Debug, etc # CTEST_SOURCE_NAME - source folder -# STATICLIBRARIES - Build/use static libraries +# STATIC_LIBRARIES - Build/use static libraries +# FORTRAN_LIBRARIES - Build/use fortran libraries # NO_MAC_FORTRAN - Yes to be SHARED on a Mac ############################################################################## @@ -678,7 +681,8 @@ set(CTEST_SOURCE_VERSEXT "") #INSTALLDIR - HDF5-1.9 root folder #CTEST_BUILD_CONFIGURATION - Release, Debug, RelWithDebInfo #CTEST_SOURCE_NAME - name of source folder; HDF5-1.9 -#STATICLIBRARIES - Default is YES +#STATIC_LIBRARIES - Default is YES +#FORTRAN_LIBRARIES - Default is NO #NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac if(DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form @@ -694,25 +698,29 @@ endif() # build generator must be defined if(NOT DEFINED BUILD_GENERATOR) - message(FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2013, VS201364, VS2012, or VS201264") + message(FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264") else() if(${BUILD_GENERATOR} STREQUAL "Unix") - set(CMAKE_GENERATOR "Unix Makefiles") + set(CTEST_CMAKE_GENERATOR "Unix Makefiles") + elseif(${BUILD_GENERATOR} STREQUAL "VS2015") + set(CTEST_CMAKE_GENERATOR "Visual Studio 14 2015") + elseif(${BUILD_GENERATOR} STREQUAL "VS201564") + set(CTEST_CMAKE_GENERATOR "Visual Studio 14 2015 Win64") elseif(${BUILD_GENERATOR} STREQUAL "VS2013") - set(CMAKE_GENERATOR "Visual Studio 12 2013") + set(CTEST_CMAKE_GENERATOR "Visual Studio 12 2013") elseif(${BUILD_GENERATOR} STREQUAL "VS201364") - set(CMAKE_GENERATOR "Visual Studio 12 2013 Win64") + set(CTEST_CMAKE_GENERATOR "Visual Studio 12 2013 Win64") elseif(${BUILD_GENERATOR} STREQUAL "VS2012") - set(CMAKE_GENERATOR "Visual Studio 11 2012") + set(CTEST_CMAKE_GENERATOR "Visual Studio 11 2012") elseif(${BUILD_GENERATOR} STREQUAL "VS201264") - set(CMAKE_GENERATOR "Visual Studio 11 2012 Win64") + set(CTEST_CMAKE_GENERATOR "Visual Studio 11 2012 Win64") else() - message(FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2013, VS201364, VS2012, or VS201264") + message(FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264") endif() endif() if(NOT DEFINED INSTALLDIR) - if(WIN32) + if(NOT WIN32) set(INSTALLDIR "/usr/local/myhdf5") else() set(INSTALLDIR "C:\\Program\ Files\\myhdf5") @@ -724,10 +732,10 @@ endif() if(NOT DEFINED CTEST_SOURCE_NAME) set(CTEST_SOURCE_NAME "hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") endif() -if(NOT DEFINED STATICLIBRARIES) +if(NOT DEFINED STATIC_LIBRARIES) set(STATICLIBRARIES "YES") endif() -if(NOT DEFINED FORTRANLIBRARIES) +if(NOT DEFINED FORTRAN_LIBRARIES) set(FORTRANLIBRARIES "NO") endif() @@ -794,7 +802,7 @@ set(MODEL "Experimental") #set(LOCAL_UPDATE "TRUE") set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/trunk") #uncomment to use a compressed source file: *.tar on linux or mac *.zip on windows -#set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}") +#set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") ################################################################### ################################################################### @@ -802,12 +810,12 @@ set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/trunk") #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ################################################################### -if(STATICLIBRARIES) +if(${STATICLIBRARIES}) set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") ######### Following describes computer ############ ## following is optional to describe build ## set(SITE_BUILDNAME_SUFFIX "STATIC") -endif(STATICLIBRARIES) +endif() ################################################################### ### uncomment/comment and change the following lines for other configuration options @@ -825,11 +833,11 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") #### fortran #### -if(FORTRANLIBRARIES) - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") - ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=ON") -endif(FORTRANLIBRARIES) +if(${FORTRANLIBRARIES}) + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON") +else() + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") +endif() ### disable test program builds #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") @@ -846,41 +854,41 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTAL if(WIN32) include(${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake) - if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}-win${SITE_OS_BITS}.exe") - file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}-win${SITE_OS_BITS}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.exe") + file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}-win${SITE_OS_BITS}.msi") - file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}-win${SITE_OS_BITS}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.msi") + file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}-win${SITE_OS_BITS}.zip") - file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}-win${SITE_OS_BITS}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.zip") + file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) endif() else() include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) if(APPLE) - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Darwin.dmg") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.dmg") + file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Darwin.tar.gz") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.tar.gz") + file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Darwin.sh") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.sh") + file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) endif() else() if(CYGWIN) - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-CYGWIN.sh") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.sh") + file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-CYGWIN.tar.gz") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.tar.gz") + file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) endif() else() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Linux.sh") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.sh") + file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Linux.tar.gz") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.tar.gz") + file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) endif() endif() endif() diff --git a/release_docs/INSTALL_Windows.txt b/release_docs/INSTALL_Windows.txt index 7873709..7af2571 100644 --- a/release_docs/INSTALL_Windows.txt +++ b/release_docs/INSTALL_Windows.txt @@ -9,8 +9,10 @@ We now recommend that users build, test and install HDF5 using CMake. Instructions for building and testing HDF5 using CMake can be found in the INSTALL_CMake.txt file found in this folder. -For instructions of building and testing an application with HDF5, see +For instructions of building and testing an application with HDF5, see USING_HDF5_CMake.txt file found in this folder. Users who want to build and run an application with HDF5 in Visual Studio -without using CMake should consult the USING_HDF5_VS.txt file. +without using CMake should consult the USING_HDF5_VS.txt file. Building +applications with the dynamic/shared hdf5 libraries requires that the +"H5_BUILT_AS_DYNAMIC_LIB" compile definition be used. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index cc0fe84..1cfe382 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -277,6 +277,10 @@ The following platforms are not supported but have been tested for this release. g++ 4.6.1 20110422 gfortran 4.6.1 20110422 + Mac OS X El Capitan 10.11 Apple clang/clang++ version 7.0.0 from Xcode 7.0.1 + 64-bit gfortran GNU Fortran (GCC) 5.2.0 + (VM) + Debian7.5.0 3.2.0-4-686 #1 SMP Debian 3.2.51-1 i686 GNU/Linux gcc (Debian 4.7.2-5) 4.7.2 GNU Fortran (Debian 4.7.2-5) 4.7.2 diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt index a6854ae..12c499e 100644 --- a/release_docs/USING_CMake_Examples.txt +++ b/release_docs/USING_CMake_Examples.txt @@ -38,7 +38,7 @@ II. Building HDF5 Examples with CMake Files in the HDF5 install directory: HDF5Examples folder - HDF518_Examples.cmake + HDF5_Examples.cmake Default installation process: Create a directory to run the examples, i.e. \test_hdf5. @@ -52,7 +52,7 @@ Default installation process: with the CTEST_BUILD_CONFIGURATION script option. Note that this must be the same as the value used with the -C command line option. The default build configuration is defined to build and use static libraries. - Shared libraries can be used with the STATICLIBRARIES script option set to "NO". + Shared libraries can be used with the STATIC_LIBRARIES script option set to "NO". Other options can be changed by editing the HDF5_Examples.cmake file. If the defaults are okay, execute from this directory: @@ -67,11 +67,9 @@ Default installation process: ======================================================================== -III. Other changes to the HDF518_Examples.cmake file +III. Other changes to the HDF5_Examples.cmake file ======================================================================== -Line 10: uncomment to build and test Fortran examples. - -Line 43-45: uncomment to use a source tarball or zipfile; +Line 45-48: uncomment to use a source tarball or zipfile; Add script option "TAR_SOURCE=MySource.tar". diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt index c48bca5..2cdf798 100644 --- a/release_docs/USING_HDF5_CMake.txt +++ b/release_docs/USING_HDF5_CMake.txt @@ -207,7 +207,7 @@ IV. APPENDIX ======================================================================== Below is an example of a ctest script that can be used to build the examples. -Adjust the values as necessary. Note that the source folder is entered on the +Adjust the values as necessary. Note that the defaults can be entered on the command line and the build folder is created as a sub-folder. Windows should adjust the forward slash to double backslashes, except for the HDF_DIR environment variable. @@ -215,21 +215,24 @@ environment variable. NOTE: this file is available at the HDF web site: http://www.hdfgroup.org/HDF5/release/cmakebuild.html - HDF518_Examples.cmake + HDF5_Examples.cmake ======================================================================== ctest ======================================================================== -cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) -############################################################################ -# Product specific script, HDF518_Examples.cmake. Usage: -# ctest -S HDF518_Examples.cmake,OPTION=VALUE -C Release -VV -O test.log +cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) +############################################################################################################### +# This script will build and run the examples from a folder +# Execute from a command line: +# ctest -S HDF5_Examples.cmake,OPTION=VALUE -C Release -V -O test.log # where valid options for OPTION are: # BUILD_GENERATOR - The cmake build generator: # Unix * Unix Makefiles +# VS2015 * Visual Studio 14 2015 +# VS201564 * Visual Studio 14 2015 Win64 # VS2013 * Visual Studio 12 2013 # VS201364 * Visual Studio 12 2013 Win64 # VS2012 * Visual Studio 11 2012 @@ -238,16 +241,18 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # INSTALLDIR - root folder where hdf5 is installed # CTEST_BUILD_CONFIGURATION - Release, Debug, etc # CTEST_SOURCE_NAME - source folder -# STATICLIBRARIES - Build/use static libraries +# STATIC_LIBRARIES - Build/use static libraries +# FORTRAN_LIBRARIES - Build/use fortran libraries # NO_MAC_FORTRAN - Yes to be SHARED on a Mac -############################################################################################################### +############################################################################## # handle input parameters to script. #BUILD_GENERATOR - which CMake generator to use, required -#INSTALLDIR - HDF5-1.8 root folder +#INSTALLDIR - HDF5 root folder #CTEST_BUILD_CONFIGURATION - Release, Debug, RelWithDebInfo #CTEST_SOURCE_NAME - name of source folder; HDF4Examples -#STATICLIBRARIES - Default is YES -#NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac +#STATIC_LIBRARIES - Default is YES +#FORTRAN_LIBRARIES - Default is NO +##NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac) if(DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form # script.ctest,var1=value1,var2=value2 @@ -262,10 +267,14 @@ endif() # build generator must be defined if(NOT DEFINED BUILD_GENERATOR) - message(FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2013, VS201364, VS2012, or VS201264") + message(FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264") else() if(${BUILD_GENERATOR} STREQUAL "Unix") set(CMAKE_GENERATOR "Unix Makefiles") + elseif(${BUILD_GENERATOR} STREQUAL "VS2015") + set(CTEST_CMAKE_GENERATOR "Visual Studio 14 2015") + elseif(${BUILD_GENERATOR} STREQUAL "VS201564") + set(CTEST_CMAKE_GENERATOR "Visual Studio 14 2015 Win64") elseif(${BUILD_GENERATOR} STREQUAL "VS2013") set(CMAKE_GENERATOR "Visual Studio 12 2013") elseif(${BUILD_GENERATOR} STREQUAL "VS201364") @@ -275,7 +284,7 @@ else() elseif(${BUILD_GENERATOR} STREQUAL "VS201264") set(CMAKE_GENERATOR "Visual Studio 11 2012 Win64") else() - message(FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2013, VS201364, VS2012, or VS201264") + message(FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264") endif() endif() set(CTEST_CMAKE_GENERATOR "${CMAKE_GENERATOR}") @@ -283,9 +292,9 @@ set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) if(NOT DEFINED INSTALLDIR) if(WIN32) - set(INSTALLDIR "/usr/local/myhdf5") - else() set(INSTALLDIR "C:\\Program\ Files\\myhdf5") + else() + set(INSTALLDIR "/usr/local/myhdf5") endif() endif() if(NOT DEFINED CTEST_BUILD_CONFIGURATION) @@ -294,43 +303,45 @@ endif() if(NOT DEFINED CTEST_SOURCE_NAME) set(CTEST_SOURCE_NAME "HDF5Examples") endif() -if(NOT DEFINED STATICLIBRARIES) +if(NOT DEFINED STATIC_LIBRARIES) set(STATICLIBRARIES "YES") endif() -if(NOT DEFINED FORTRANLIBRARIES) +if(NOT DEFINED FORTRAN_LIBRARIES) set(FORTRANLIBRARIES "NO") endif() #TAR_SOURCE - name of tarfile #if(NOT DEFINED TAR_SOURCE) -# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.2.1-Source") +# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.1-Source") #endif() ############################################################################################################### # Adjust the following SET Commands as needed ############################################################################################################### -if(FORTRANLIBRARIES) - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") -endif(FORTRANLIBRARIES) - if(WIN32) - if(STATICLIBRARIES) + if(${STATICLIBRARIES}) set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") - endif(STATICLIBRARIES) + endif() set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake") set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") else(WIN32) - if(STATICLIBRARIES) + if(${STATICLIBRARIES}) set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - endif(STATICLIBRARIES) + endif() set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake") set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") endif(WIN32) +if(${FORTRANLIBRARIES}) + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") +else() + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") +endif() +set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") ############################################################################################################### # For any comments please contact cdashhelp@hdfgroup.org @@ -349,11 +360,11 @@ if(APPLE) if(NOT NO_MAC_FORTRAN) # Shared fortran is not supported, build static set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - else(NOT NO_MAC_FORTRAN) + else() set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") - endif(NOT NO_MAC_FORTRAN) + endif() set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") -endif(APPLE) +endif() #----------------------------------------------------------------------------- set(CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") @@ -373,7 +384,7 @@ if(CTEST_USE_TAR_SOURCE) message(STATUS "extracting... [error-(${rv}) clean up]") file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") message(FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed") - endif(NOT rv EQUAL 0) + endif() endif(CTEST_USE_TAR_SOURCE) #----------------------------------------------------------------------------- @@ -382,9 +393,9 @@ endif(CTEST_USE_TAR_SOURCE) set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) if (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) -else (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") +else () file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") -endif (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") +endif () # Use multiple CPU cores to build include(ProcessorCount) @@ -392,7 +403,7 @@ ProcessorCount(N) if(NOT N EQUAL 0) if(NOT WIN32) set(CTEST_BUILD_FLAGS -j${N}) - endif(NOT WIN32) + endif() set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) endif() set (CTEST_CONFIGURE_COMMAND @@ -414,9 +425,9 @@ ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) if(res GREATER 0) message (FATAL_ERROR "tests FAILED") -endif(res GREATER 0) +endif() #----------------------------------------------------------------------------- -################################################################################# +############################################################################################################## diff --git a/release_docs/USING_HDF5_VS.txt b/release_docs/USING_HDF5_VS.txt index 9063ea6..146782a 100644 --- a/release_docs/USING_HDF5_VS.txt +++ b/release_docs/USING_HDF5_VS.txt @@ -6,29 +6,32 @@ These suggestions are for Visual Studio users. -Instructions for building and testing HDF5 applications using CMake can +Instructions for building and testing HDF5 applications using CMake can be found in the USING_HDF5_CMake.txt file found in this folder. -The following two sections are helpful if you do not use CMake to build +NOTE: Building applications with the dynamic/shared hdf5 libraries requires + that the "H5_BUILT_AS_DYNAMIC_LIB" compile definition be used. + +The following two sections are helpful if you do not use CMake to build your applications. - + ======================================================================== Using Visual Studio 2010 with HDF5 Libraries built with Visual Studio 2010 ======================================================================== 1. Set up path for external libraries and headers - The path settings will need to be in the project property sheets per project. - Go to "Project" and select "Properties", find "Configuration Properties", + The path settings will need to be in the project property sheets per project. + Go to "Project" and select "Properties", find "Configuration Properties", and then "VC++ Directories". - + 1.1 If you are building on 64-bit Windows, find the "Platform" dropdown and select "x64". - + 1.2 Add the header path to the "Include Directories" setting. - + 1.3 Add the library path to the "Library Directories" setting. - + 1.4 Select Linker->Input and beginning with the "Additional Dependencies" line, enter the library names. The external libraries should be listed first, followed by the HDF5 @@ -37,30 +40,30 @@ Using Visual Studio 2010 with HDF5 Libraries built with Visual Studio 2010 szip.lib zlib.lib hdf5.lib hdf5_cpp.lib - + ========================================================================== Using Visual Studio 2008 with HDF5 Libraries built with Visual Studio 2008 ========================================================================== 2. Set up the path for external libraries and headers - Invoke Microsoft Visual Studio and go to "Tools" and select "Options", + Invoke Microsoft Visual Studio and go to "Tools" and select "Options", find "Projects", and then "VC++ Directories". - + 2.1 If you are building on 64-bit Windows, find the "Platform" dropdown and select "x64". - 2.2 Find the box "Show directories for", choose "Include files", add the + 2.2 Find the box "Show directories for", choose "Include files", add the header path (i.e. c:\Program Files\HDF_Group\HDF5\1.8.x\include) to the included directories. 2.3 Find the box "Show directories for", choose "Library files", add the library path (i.e. c:\Program Files\HDF_Group\HDF5\1.8.x\lib) to the library directories. - + 2.4 If using Fortran libraries, you will also need to setup the path for the Intel Fortran compiler. - + 2.5 Select Project->Properties->Linker->Input and beginning with the "Additional Dependencies" line, enter the library names. The external libraries should be listed first, followed by the HDF5 @@ -74,15 +77,15 @@ Using Visual Studio 2008 with HDF5 Libraries built with Visual Studio 2008 ======================================================================== 3.1 FAQ - + Many other common questions and hints are located online and being updated in the HDF5 FAQ. For Windows-specific questions, please see: - + http://www.hdfgroup.org/HDF5/faq/windows.html - + For all other general questions, you can look in the general FAQ: - + http://hdfgroup.org/HDF5-FAQ.html - + ************************************************************************ Please send email to help@hdfgroup.org for further assistance. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ef3e760..2c9ca8a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -165,13 +165,13 @@ IDE_GENERATED_PROPERTIES ("H5EA" "${H5EA_HDRS}" "${H5EA_SRCS}" ) set (H5F_SRCS ${HDF5_SRC_DIR}/H5F.c - ${HDF5_SRC_DIR}/H5Fint.c ${HDF5_SRC_DIR}/H5Faccum.c ${HDF5_SRC_DIR}/H5Fcwfs.c ${HDF5_SRC_DIR}/H5Fdbg.c ${HDF5_SRC_DIR}/H5Fdeprec.c ${HDF5_SRC_DIR}/H5Fefc.c ${HDF5_SRC_DIR}/H5Ffake.c + ${HDF5_SRC_DIR}/H5Fint.c ${HDF5_SRC_DIR}/H5Fio.c ${HDF5_SRC_DIR}/H5Fmount.c ${HDF5_SRC_DIR}/H5Fmpi.c @@ -193,8 +193,8 @@ set (H5FA_SRCS ${HDF5_SRC_DIR}/H5FA.c ${HDF5_SRC_DIR}/H5FAcache.c ${HDF5_SRC_DIR}/H5FAdbg.c - ${HDF5_SRC_DIR}/H5FAdblock.c ${HDF5_SRC_DIR}/H5FAdblkpage.c + ${HDF5_SRC_DIR}/H5FAdblock.c ${HDF5_SRC_DIR}/H5FAhdr.c ${HDF5_SRC_DIR}/H5FAstat.c ${HDF5_SRC_DIR}/H5FAtest.c @@ -338,7 +338,9 @@ set (H5HL_SRCS ${HDF5_SRC_DIR}/H5HL.c ${HDF5_SRC_DIR}/H5HLcache.c ${HDF5_SRC_DIR}/H5HLdbg.c + ${HDF5_SRC_DIR}/H5HLdblk.c ${HDF5_SRC_DIR}/H5HLint.c + ${HDF5_SRC_DIR}/H5HLprfx.c ) set (H5HL_HDRS @@ -501,14 +503,6 @@ set (H5R_HDRS IDE_GENERATED_PROPERTIES ("H5R" "${H5R_HDRS}" "${H5R_SRCS}" ) -set (H5UC_SRCS - ${HDF5_SRC_DIR}/H5UC.c -) -set (H5UC_HDRS -) -IDE_GENERATED_PROPERTIES ("H5UC" "${H5UC_HDRS}" "${H5UC_SRCS}" ) - - set (H5RS_SRCS ${HDF5_SRC_DIR}/H5RS.c ) @@ -607,6 +601,14 @@ set (H5TS_HDRS IDE_GENERATED_PROPERTIES ("H5TS" "${H5TS_HDRS}" "${H5TS_SRCS}" ) +set (H5UC_SRCS + ${HDF5_SRC_DIR}/H5UC.c +) +set (H5UC_HDRS +) +IDE_GENERATED_PROPERTIES ("H5UC" "${H5UC_HDRS}" "${H5UC_SRCS}" ) + + set (H5VM_SRCS ${HDF5_SRC_DIR}/H5VM.c ) @@ -780,38 +782,21 @@ set (H5_GENERATED_HEADERS option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON) mark_as_advanced (HDF5_GENERATE_HEADERS) if (HDF5_GENERATE_HEADERS) + set_source_files_properties(${H5_GENERATED_HEADERS} PROPERTIES GENERATED TRUE) find_package (Perl) if (PERL_FOUND) - add_custom_command ( - OUTPUT ${HDF5_SRC_DIR}/H5Edefin.h ${HDF5_SRC_DIR}/H5Einit.h ${HDF5_SRC_DIR}/H5Epubgen.h ${HDF5_SRC_DIR}/H5Eterm.h - PRE_BUILD - COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SRC_DIR}/H5err.txt - DEPENDS ${HDF5_SRC_DIR}/H5err.txt - COMMENT " Creating err header" + execute_process ( + COMMAND ${PERL_EXECUTABLE} ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SRC_DIR}/H5err.txt OUTPUT_VARIABLE SCRIPT_OUTPUT ) - - add_custom_command ( - OUTPUT ${HDF5_SRC_DIR}/H5version.h - PRE_BUILD - COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_vers ${HDF5_SRC_DIR}/H5vers.txt - DEPENDS ${HDF5_SRC_DIR}/H5vers.txt - COMMENT " Creating API version macro" - ) - - add_custom_command ( - OUTPUT ${HDF5_SRC_DIR}/H5overflow.h - PRE_BUILD - COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_overflow ${HDF5_SRC_DIR}/H5overflow.txt - DEPENDS ${HDF5_SRC_DIR}/H5overflow.txt - COMMENT " Creating Assignment overflow macro" + message(STATUS ${SCRIPT_OUTPUT}) + execute_process ( + COMMAND ${PERL_EXECUTABLE} ${HDF5_SOURCE_DIR}/bin/make_vers ${HDF5_SRC_DIR}/H5vers.txt OUTPUT_VARIABLE SCRIPT_OUTPUT ) - - add_custom_target(run_perl_scripts ALL - DEPENDS ${HDF5_SRC_DIR}/H5Edefin.h ${HDF5_SRC_DIR}/H5Einit.h ${HDF5_SRC_DIR}/H5Epubgen.h ${HDF5_SRC_DIR}/H5Eterm.h ${HDF5_SRC_DIR}/H5version.h ${HDF5_SRC_DIR}/H5overflow.h + message(STATUS ${SCRIPT_OUTPUT}) + execute_process ( + COMMAND ${PERL_EXECUTABLE} ${HDF5_SOURCE_DIR}/bin/make_overflow ${HDF5_SRC_DIR}/H5overflow.txt OUTPUT_VARIABLE SCRIPT_OUTPUT ) + message(STATUS ${SCRIPT_OUTPUT}) else (PERL_FOUND) message (STATUS "Cannot generate headers - perl not found") endif (PERL_FOUND) @@ -826,11 +811,6 @@ TARGET_C_PROPERTIES (H5detect STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5detect "ws2_32.lib") endif (MSVC OR MINGW) -if (HDF5_GENERATE_HEADERS) - add_dependencies(H5detect run_perl_scripts) -else (HDF5_GENERATE_HEADERS) - add_dependencies(H5detect "${H5_GENERATED_HEADERS}") -endif (HDF5_GENERATE_HEADERS) set (CMD $<TARGET_FILE:H5detect>) add_custom_command ( @@ -845,11 +825,6 @@ TARGET_C_PROPERTIES (H5make_libsettings STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5make_libsettings "ws2_32.lib") endif (MSVC OR MINGW) -if (HDF5_GENERATE_HEADERS) - add_dependencies(H5make_libsettings run_perl_scripts) -else (HDF5_GENERATE_HEADERS) - add_dependencies(H5make_libsettings "${H5_GENERATED_HEADERS}") -endif (HDF5_GENERATE_HEADERS) set (CMD $<TARGET_FILE:H5make_libsettings>) add_custom_command ( @@ -863,10 +838,9 @@ add_custom_command ( #----------------------------------------------------------------------------- # Add H5Tinit source to build - generated by H5Detect/CMake at configure time #----------------------------------------------------------------------------- -set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5Tinit.c) -set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5lib_settings.c) +set (gen_SRCS ${HDF5_BINARY_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) -add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) +add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_LIB_TARGET} ${LINK_LIBS}) if (NOT WIN32) @@ -881,11 +855,6 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) -if (HDF5_GENERATE_HEADERS) - add_dependencies(${HDF5_LIB_TARGET} run_perl_scripts) -else (HDF5_GENERATE_HEADERS) - add_dependencies(${HDF5_LIB_TARGET} "${HDF5_SRC_DIR}/H5Edefin.h;${HDF5_SRC_DIR}/H5Einit.h;${HDF5_SRC_DIR}/H5Epubgen.h;${HDF5_SRC_DIR}/H5Eterm.h") -endif (HDF5_GENERATE_HEADERS) option (HDF5_ENABLE_DEBUG_APIS "Turn on debugging in all packages" OFF) if (HDF5_ENABLE_DEBUG_APIS) @@ -897,7 +866,25 @@ endif (HDF5_ENABLE_DEBUG_APIS) set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) - add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) + file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") + set (CMD $<TARGET_FILE:H5detect>) + add_custom_command ( + OUTPUT ${HDF5_BINARY_DIR}/shared/H5Tinit.c + COMMAND ${CMD} + ARGS > ${HDF5_BINARY_DIR}/shared/H5Tinit.c + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_BINARY_DIR}/shared + ) + set (CMD $<TARGET_FILE:H5make_libsettings>) + add_custom_command ( + OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c + COMMAND ${CMD} + ARGS > ${HDF5_BINARY_DIR}/shared/H5lib_settings.c + DEPENDS H5make_libsettings + WORKING_DIRECTORY ${HDF5_BINARY_DIR} + ) + set (shared_gen_SRCS ${HDF5_BINARY_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) + add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_LIBSH_TARGET} ${LINK_SHARED_LIBS}) if (NOT WIN32) @@ -914,16 +901,12 @@ if (BUILD_SHARED_LIBS) INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 ) - if (HDF5_GENERATE_HEADERS) - add_dependencies(${HDF5_LIBSH_TARGET} run_perl_scripts) - else (HDF5_GENERATE_HEADERS) - add_dependencies(${HDF5_LIBSH_TARGET} "${HDF5_SRC_DIR}/H5Edefin.h;${HDF5_SRC_DIR}/H5Einit.h;${HDF5_SRC_DIR}/H5Epubgen.h;${HDF5_SRC_DIR}/H5Eterm.h") - endif (HDF5_GENERATE_HEADERS) if (HDF5_ENABLE_THREADSAFE) set_property (TARGET ${HDF5_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "H5_HAVE_THREADSAFE" ) + target_link_libraries (${HDF5_LIBSH_TARGET} Threads::Threads) endif (HDF5_ENABLE_THREADSAFE) if (HDF5_ENABLE_DEBUG_APIS) @@ -464,6 +464,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "H5C_set_prefix() failed") #endif /* H5_HAVE_PARALLEL */ + /* Set the cache parameters */ if(H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "auto resize configuration failed") @@ -652,7 +653,7 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id) char trace[128] = ""; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -867,7 +868,7 @@ H5AC_mark_entry_dirty(void *thing) char trace[128] = ""; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -935,7 +936,7 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne #ifdef H5_HAVE_PARALLEL H5AC_aux_t *aux_ptr; #endif /* H5_HAVE_PARALLEL */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1020,6 +1021,7 @@ H5AC_pin_protected_entry(void *thing) (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); #endif /* H5AC__TRACE_FILE_ENABLED */ + /* Pin entry */ if(H5C_pin_protected_entry(thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "can't pin entry") @@ -1068,6 +1070,7 @@ H5AC_create_flush_dependency(void * parent_thing, void * child_thing) (unsigned long)(((H5C_cache_entry_t *)child_thing)->addr)); #endif /* H5AC__TRACE_FILE_ENABLED */ + /* Create the flush dependency */ if(H5C_create_flush_dependency(parent_thing, child_thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "H5C_create_flush_dependency() failed.") @@ -1109,12 +1112,12 @@ void * H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *udata, unsigned flags) { - void * thing; /* Pointer to native data structure for entry */ #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; size_t trace_entry_size = 0; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ + void * thing = NULL; /* Pointer to native data structure for entry */ void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1194,7 +1197,7 @@ H5AC_resize_entry(void *thing, size_t new_size) char trace[128] = ""; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1212,6 +1215,7 @@ H5AC_resize_entry(void *thing, size_t new_size) (int)new_size); #endif /* H5AC__TRACE_FILE_ENABLED */ + /* Resize the entry */ if(H5C_resize_entry(thing, new_size) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "can't resize entry") @@ -1274,6 +1278,7 @@ H5AC_unpin_entry(void *thing) (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); #endif /* H5AC__TRACE_FILE_ENABLED */ + /* Unpin the entry */ if(H5C_unpin_entry(thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry") @@ -1321,6 +1326,7 @@ H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing) (unsigned long long)(((H5C_cache_entry_t *)child_thing)->addr)); #endif /* H5AC__TRACE_FILE_ENABLED */ + /* Destroy the flush dependency */ if(H5C_destroy_flush_dependency(parent_thing, child_thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "H5C_destroy_flush_dependency() failed.") @@ -1376,15 +1382,15 @@ herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned flags) { +#if H5AC__TRACE_FILE_ENABLED + char trace[128] = ""; + FILE * trace_file_ptr = NULL; +#endif /* H5AC__TRACE_FILE_ENABLED */ hbool_t dirtied; hbool_t deleted; #ifdef H5_HAVE_PARALLEL H5AC_aux_t * aux_ptr = NULL; #endif /* H5_HAVE_PARALLEL */ -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1718,12 +1724,12 @@ done: herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr) { - H5C_auto_size_ctl_t internal_config; #if H5AC__TRACE_FILE_ENABLED H5AC_cache_config_t trace_config = H5AC__DEFAULT_CACHE_CONFIG; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ - herr_t ret_value = SUCCEED; /* Return value */ + H5C_auto_size_ctl_t internal_config; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2318,8 +2324,8 @@ done: herr_t H5AC_tag(hid_t dxpl_id, haddr_t metadata_tag, haddr_t *prev_tag) { - H5P_genplist_t *dxpl; /* dataset transfer property list */ - herr_t ret_value = SUCCEED; + H5P_genplist_t *dxpl; /* Dataset transfer property list */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h index 050e21c..1051373 100644 --- a/src/H5ACpkg.h +++ b/src/H5ACpkg.h @@ -401,7 +401,6 @@ typedef struct H5AC_aux_t void (* sync_point_done)(int num_writes, haddr_t * written_entries_tbl); - } H5AC_aux_t; /* struct H5AC_aux_t */ /* Package scoped functions */ diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 8ebbb67..bd23fea 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -374,7 +374,6 @@ H5_DLL herr_t H5AC_set_ring(hid_t dxpl_id, H5AC_ring_t ring, H5P_genplist_t **dx H5AC_ring_t *orig_ring); H5_DLL herr_t H5AC_reset_ring(H5P_genplist_t *dxpl, H5AC_ring_t orig_ring); - #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5AC_add_candidate(H5AC_t * cache_ptr, haddr_t addr); #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h index 598197f..4e5502d 100644 --- a/src/H5ACpublic.h +++ b/src/H5ACpublic.h @@ -506,3 +506,4 @@ typedef struct H5AC_cache_config_t } #endif #endif + diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index 28e49a6..972fb0b 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -85,7 +85,8 @@ static herr_t H5A__dense_btree2_corder_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5A__dense_btree2_corder_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); /* v2 B-tree driver callbacks for 'name' index */ static herr_t H5A__dense_btree2_name_store(void *native, const void *udata); @@ -94,7 +95,8 @@ static herr_t H5A__dense_btree2_name_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5A__dense_btree2_name_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); /* Fractal heap function callbacks */ static herr_t H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data); @@ -114,7 +116,9 @@ const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */ H5A__dense_btree2_name_compare, /* Record comparison callback */ H5A__dense_btree2_name_encode, /* Record encoding callback */ H5A__dense_btree2_name_decode, /* Record decoding callback */ - H5A__dense_btree2_name_debug /* Record debugging callback */ + H5A__dense_btree2_name_debug, /* Record debugging callback */ + NULL, /* Create debugging context */ + NULL /* Destroy debugging context */ }}; /* v2 B-tree class for indexing 'creation order' field of attributes */ @@ -128,7 +132,9 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */ H5A__dense_btree2_corder_compare, /* Record comparison callback */ H5A__dense_btree2_corder_encode, /* Record encoding callback */ H5A__dense_btree2_corder_decode, /* Record decoding callback */ - H5A__dense_btree2_corder_debug /* Record debugging callback */ + H5A__dense_btree2_corder_debug, /* Record debugging callback */ + NULL, /* Create debugging context */ + NULL /* Destroy debugging context */ }}; @@ -375,7 +381,8 @@ H5A__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_U *------------------------------------------------------------------------- */ static herr_t -H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5A_dense_bt2_name_rec_t *nrecord = (const H5A_dense_bt2_name_rec_t *)_nrecord; @@ -532,7 +539,8 @@ H5A__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR *------------------------------------------------------------------------- */ static herr_t -H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5A_dense_bt2_corder_rec_t *nrecord = (const H5A_dense_bt2_corder_rec_t *)_nrecord; @@ -531,6 +531,7 @@ H5B__split(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, unsigned idx, } /* end if */ bt_ud->bt->right = split_bt_ud->addr; + HDassert(bt_ud->cache_flags & H5AC__DIRTIED_FLAG); done: if(ret_value < 0) { @@ -647,7 +648,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void /* Unprotect the old root so we can move it. Also force it to be marked * dirty so it is written to the new location. */ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt_ud.addr, bt_ud.bt, H5AC__DIRTIED_FLAG) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release old root") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release old root") bt_ud.bt = NULL; /* Make certain future references will be caught */ /* Move the location of the old root on the disk */ @@ -1060,7 +1061,7 @@ H5B__insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, bt->child[idx] = new_child_bt_ud.addr; bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; } else if(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins) { - hbool_t *tmp_bt_flags_ptr = NULL; + unsigned *tmp_bt_flags_ptr = NULL; H5B_t *tmp_bt; /* diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 421e24b..57f794b 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -517,7 +517,7 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, /* Version */ if(*image++ != H5B2_INT_VERSION) - HGOTO_ERROR(H5E_BTREE, H5E_BADRANGE, NULL, "wrong B-tree internal node version") + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree internal node version") /* B-tree type */ if(*image++ != (uint8_t)udata->hdr->cls->id) diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index f723d10..ad9f970 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -92,6 +92,7 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, const H5B2_class_t *type, haddr_t obj_addr) { H5B2_hdr_t *hdr = NULL; /* B-tree header info */ + void *dbg_ctx = NULL; /* v2 B-tree debugging context */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ @@ -109,13 +110,22 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDassert(indent >= 0); HDassert(fwidth >= 0); HDassert(type); + HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) || + (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx)); + + /* Check for debugging context callback available */ + if(type->crt_dbg_ctx) { + /* Create debugging context */ + if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") + } /* end if */ /* * Load the B-tree header. */ cache_udata.f = f; cache_udata.addr = addr; - cache_udata.ctx_udata = f; + cache_udata.ctx_udata = dbg_ctx; if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") @@ -168,6 +178,8 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, } /* end for */ done: + if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context") if(hdr) { hdr->f = NULL; if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0) @@ -197,6 +209,7 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, { H5B2_hdr_t *hdr = NULL; /* B-tree header */ H5B2_internal_t *internal = NULL; /* B-tree internal node */ + void *dbg_ctx = NULL; /* v2 B-tree debugging context */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ @@ -213,16 +226,25 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDassert(indent >= 0); HDassert(fwidth >= 0); HDassert(type); + HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) || + (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx)); HDassert(H5F_addr_defined(hdr_addr)); HDassert(H5F_addr_defined(obj_addr)); HDassert(nrec > 0); + /* Check for debugging context callback available */ + if(type->crt_dbg_ctx) { + /* Create debugging context */ + if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") + } /* end if */ + /* * Load the B-tree header. */ cache_udata.f = f; cache_udata.addr = hdr_addr; - cache_udata.ctx_udata = f; + cache_udata.ctx_udata = dbg_ctx; if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") @@ -273,8 +295,7 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); HDassert(H5B2_INT_NREC(internal, hdr, u)); - (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), - H5B2_INT_NREC(internal, hdr, u)); + (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_INT_NREC(internal, hdr, u), dbg_ctx); } /* end for */ /* Print final node pointer */ @@ -286,6 +307,8 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, internal->node_ptrs[u].addr); done: + if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context") if(hdr) { hdr->f = NULL; if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) @@ -318,6 +341,7 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent H5B2_hdr_t *hdr = NULL; /* B-tree header */ H5B2_leaf_t *leaf = NULL; /* B-tree leaf node */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ + void *dbg_ctx = NULL; /* v2 B-tree debugging context */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ herr_t ret_value = SUCCEED; /* Return value */ @@ -333,16 +357,25 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent HDassert(indent >= 0); HDassert(fwidth >= 0); HDassert(type); + HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) || + (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx)); HDassert(H5F_addr_defined(hdr_addr)); HDassert(H5F_addr_defined(obj_addr)); HDassert(nrec > 0); + /* Check for debugging context callback available */ + if(type->crt_dbg_ctx) { + /* Create debugging context */ + if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") + } /* end if */ + /* * Load the B-tree header. */ cache_udata.f = f; cache_udata.addr = hdr_addr; - cache_udata.ctx_udata = f; + cache_udata.ctx_udata = dbg_ctx; if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree header") @@ -384,11 +417,12 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); HDassert(H5B2_LEAF_NREC(leaf, hdr, u)); - (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), - H5B2_LEAF_NREC(leaf, hdr, u)); + (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_LEAF_NREC(leaf, hdr, u), dbg_ctx); } /* end for */ done: + if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context") if(hdr) { hdr->f = NULL; if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) diff --git a/src/H5B2int.c b/src/H5B2int.c index f412260..b8c9634 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -76,8 +76,8 @@ static herr_t H5B2__merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx); static herr_t H5B2__swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, - H5B2_internal_t *internal, unsigned *internal_flags_ptr, - unsigned idx, void *swap_loc); + H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx, + void *swap_loc); static herr_t H5B2__create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr, uint16_t depth); #ifdef H5B2_DEBUG @@ -571,6 +571,9 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, uint16_t new_left_nrec = (uint16_t)(*left_nrec + *right_nrec) / 2; /* New number of records for left child */ uint16_t move_nrec = (uint16_t)(*left_nrec - new_left_nrec); /* Number of records to move from left node to right */ + /* Sanity check */ + HDassert(*left_nrec > *right_nrec); + /* Slide records in right node up */ HDmemmove(H5B2_NAT_NREC(right_native, hdr, move_nrec), H5B2_NAT_NREC(right_native, hdr, 0), diff --git a/src/H5B2private.h b/src/H5B2private.h index 45b6737..9e3c2d7 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -93,7 +93,9 @@ struct H5B2_class_t { herr_t (*encode)(uint8_t *raw, const void *record, void *ctx); /* Encode record from native form to disk storage form */ herr_t (*decode)(const uint8_t *raw, void *record, void *ctx); /* Decode record from disk storage form to native form */ herr_t (*debug)(FILE *stream, int indent, int fwidth, /* Print a record for debugging */ - const void *record); + const void *record, const void *ctx); + void *(*crt_dbg_ctx)(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr); /* Create debugging context */ + herr_t (*dst_dbg_ctx)(void *dbg_ctx); /* Destroy debugging context */ }; /* v2 B-tree creation parameters */ diff --git a/src/H5B2test.c b/src/H5B2test.c index 8ed364e..87fddf7 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -67,7 +67,9 @@ static herr_t H5B2__test_store(void *nrecord, const void *udata); static herr_t H5B2__test_compare(const void *rec1, const void *rec2); static herr_t H5B2__test_encode(uint8_t *raw, const void *nrecord, void *ctx); static herr_t H5B2__test_decode(const uint8_t *raw, void *nrecord, void *ctx); -static herr_t H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5B2__test_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); +static void *H5B2__test_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); /*********************/ @@ -84,7 +86,9 @@ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */ H5B2__test_compare, /* Record comparison callback */ H5B2__test_encode, /* Record encoding callback */ H5B2__test_decode, /* Record decoding callback */ - H5B2__test_debug /* Record debugging callback */ + H5B2__test_debug, /* Record debugging callback */ + H5B2__test_crt_dbg_context, /* Create debugging context */ + H5B2__test_dst_context /* Destroy debugging context */ }}; @@ -291,7 +295,8 @@ H5B2__test_decode(const uint8_t *raw, void *nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record) +H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record, + const void H5_ATTR_UNUSED *_udata) { FUNC_ENTER_STATIC_NOERR @@ -305,6 +310,45 @@ H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record) /*------------------------------------------------------------------------- + * Function: H5B2__test_crt_dbg_context + * + * Purpose: Create context for debugging callback + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Quincey Koziol + * Tuesday, December 1, 2009 + * + *------------------------------------------------------------------------- + */ +static void * +H5B2__test_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr) +{ + H5B2_test_ctx_t *ctx; /* Callback context structure */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(f); + + /* Allocate callback context */ + if(NULL == (ctx = H5FL_MALLOC(H5B2_test_ctx_t))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate callback context") + + /* Determine the size of addresses & lengths in the file */ + ctx->sizeof_size = H5F_SIZEOF_SIZE(f); + + /* Set return value */ + ret_value = ctx; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5B2__test_crt_dbg_context() */ + + +/*------------------------------------------------------------------------- * Function: H5B2_get_root_addr_test * * Purpose: Retrieve the root node's address diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index bf2e5a3..33d4abc 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -601,7 +601,7 @@ if ( ( (entry_ptr) == NULL ) || \ #define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \ { \ (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->is_pinned ) \ + if((entry_ptr)->is_pinned) \ (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \ ((entry_ptr)->flushes)++; \ } diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index a6ff106..b7b1d5b 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -149,7 +149,7 @@ #define H5C__MAX_AR_EPOCH_LENGTH 1000000 /* #defines of flags used in the flags parameters in some of the - * cache calls. Note that not all flags are applicable + * following function calls. Note that not all flags are applicable * to all function calls. Flags that don't apply to a particular * function are ignored in that function. * @@ -1980,8 +1980,7 @@ H5_DLL void * H5C_protect(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, haddr_t addr, void *udata, unsigned flags); H5_DLL herr_t H5C_reset_cache_hit_rate_stats(H5C_t *cache_ptr); H5_DLL herr_t H5C_resize_entry(void *thing, size_t new_size); -H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, - H5C_auto_size_ctl_t *config_ptr); +H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr); H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled); H5_DLL herr_t H5C_set_prefix(H5C_t *cache_ptr, char *prefix); H5_DLL herr_t H5C_set_trace_file_ptr(H5C_t *cache_ptr, FILE *trace_file_ptr); @@ -336,10 +336,6 @@ H5Dclose(hid_t dset_id) /* * Decrement the counter on the dataset. It will be freed if the count * reaches zero. - * - * Pass in TRUE for the 3rd parameter to tell the function to remove - * dataset's ID even though the freeing function might fail. Please - * see the comments in H5I_dec_ref for details. (SLU - 2010/9/7) */ if(H5I_dec_app_ref_always_close(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID") diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 762c252..30c3a28 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -153,21 +153,21 @@ static herr_t H5D__btree_idx_dest(const H5D_chk_idx_info_t *idx_info); /* v1 B-tree indexed chunk I/O ops */ const H5D_chunk_ops_t H5D_COPS_BTREE[1] = {{ - H5D__btree_idx_init, - H5D__btree_idx_create, - H5D__btree_idx_is_space_alloc, - H5D__btree_idx_insert, - H5D__btree_idx_get_addr, - NULL, - H5D__btree_idx_iterate, - H5D__btree_idx_remove, - H5D__btree_idx_delete, - H5D__btree_idx_copy_setup, - H5D__btree_idx_copy_shutdown, - H5D__btree_idx_size, - H5D__btree_idx_reset, - H5D__btree_idx_dump, - H5D__btree_idx_dest + H5D__btree_idx_init, /* insert */ + H5D__btree_idx_create, /* create */ + H5D__btree_idx_is_space_alloc, /* is_space_alloc */ + H5D__btree_idx_insert, /* insert */ + H5D__btree_idx_get_addr, /* get_addr */ + NULL, /* resize */ + H5D__btree_idx_iterate, /* iterate */ + H5D__btree_idx_remove, /* remove */ + H5D__btree_idx_delete, /* delete */ + H5D__btree_idx_copy_setup, /* copy_setup */ + H5D__btree_idx_copy_shutdown, /* copy_shutdown */ + H5D__btree_idx_size, /* size */ + H5D__btree_idx_reset, /* reset */ + H5D__btree_idx_dump, /* dump */ + H5D__btree_idx_dest /* destroy */ }}; @@ -649,7 +649,7 @@ H5D__btree_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key /*in,out /* Remove raw data chunk from file */ H5_CHECK_OVERFLOW(lt_key->nbytes, uint32_t, hsize_t); if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes) < 0) - HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk") + HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk") /* Mark keys as unchanged */ *lt_key_changed = FALSE; @@ -969,17 +969,12 @@ done: static hbool_t H5D__btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage) { - hbool_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(storage); - /* Set return value */ - ret_value = (hbool_t)H5F_addr_defined(storage->idx_addr); - - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr)) } /* end H5D__btree_idx_is_space_alloc() */ @@ -1353,9 +1348,8 @@ done: static herr_t H5D__btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) { - H5D_chunk_common_ud_t udata; /* User-data for loading B-tree nodes */ + H5D_chunk_common_ud_t udata; /* User-data for loading B-tree nodes */ H5B_info_t bt_info; /* B-tree info */ - hbool_t shared_init = FALSE; /* Whether shared B-tree info is initialized */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1368,11 +1362,6 @@ H5D__btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) HDassert(idx_info->storage); HDassert(index_size); - /* Initialize the shared info for the B-tree traversal */ - if(H5D__btree_shared_create(idx_info->f, idx_info->storage, idx_info->layout) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") - shared_init = TRUE; - /* Initialize B-tree node user-data */ HDmemset(&udata, 0, sizeof udata); udata.layout = idx_info->layout; @@ -1386,13 +1375,6 @@ H5D__btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) *index_size = bt_info.size; done: - if(shared_init) { - if(NULL == idx_info->storage->u.btree.shared) - HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil") - if(H5UC_DEC(idx_info->storage->u.btree.shared) < 0) - HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") - } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__btree_idx_size() */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 4066733..e935f93 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -61,7 +61,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5MFprivate.h" /* File memory management */ -#include "H5VMprivate.h" /* Vector and array functions */ +#include "H5VMprivate.h" /* Vector and array functions */ /****************/ @@ -2227,7 +2227,7 @@ H5D__chunk_dest(H5D_t *dset, hid_t dxpl_id) FUNC_ENTER_STATIC_TAG(dxpl_id, dset->oloc.addr, FAIL) - /* Sanity check */ + /* Sanity checks */ HDassert(dset); /* Fill the DXPL cache values for later use */ @@ -2651,7 +2651,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_chunk_ud_t udata; /* pass through B-tree */ hbool_t must_alloc = FALSE; /* Whether the chunk must be allocated */ - hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ + hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ /* Set up user data for index callbacks */ udata.common.layout = &dset->shared->layout.u.chunk; @@ -4141,9 +4141,9 @@ done: herr_t H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) { - hsize_t min_mod_chunk_off[H5O_LAYOUT_NDIMS]; /* Scaled offset of first chunk to modify in each dimension */ - hsize_t max_mod_chunk_off[H5O_LAYOUT_NDIMS]; /* Scaled offset of last chunk to modify in each dimension */ - hssize_t max_fill_chunk_off[H5O_LAYOUT_NDIMS]; /* Scaled offset of last chunk that might be filled in each dimension */ + hsize_t min_mod_chunk_sc[H5O_LAYOUT_NDIMS]; /* Scaled offset of first chunk to modify in each dimension */ + hsize_t max_mod_chunk_sc[H5O_LAYOUT_NDIMS]; /* Scaled offset of last chunk to modify in each dimension */ + hssize_t max_fill_chunk_sc[H5O_LAYOUT_NDIMS]; /* Scaled offset of last chunk that might be filled in each dimension */ hbool_t fill_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of edge chunks in this dimension needs to be filled */ H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_io_info_t chk_io_info; /* Chunked I/O info object */ @@ -4247,19 +4247,19 @@ 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 */ - HDmemset(min_mod_chunk_off, 0, sizeof(min_mod_chunk_off)); - HDmemset(max_mod_chunk_off, 0, sizeof(max_mod_chunk_off)); + HDmemset(min_mod_chunk_sc, 0, sizeof(min_mod_chunk_sc)); + HDmemset(max_mod_chunk_sc, 0, sizeof(max_mod_chunk_sc)); for(op_dim = 0; op_dim < (unsigned)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] = (old_dim[op_dim] - 1) / chunk_dim[op_dim]; + max_mod_chunk_sc[op_dim] = (old_dim[op_dim] - 1) / chunk_dim[op_dim]; /* Calculate the largest offset of chunks that might need to be * filled in this dimension */ if(0 == space_dim[op_dim]) - max_fill_chunk_off[op_dim] = -1; + max_fill_chunk_sc[op_dim] = -1; else - max_fill_chunk_off[op_dim] = (hssize_t)(((MIN(space_dim[op_dim], old_dim[op_dim]) - 1) + max_fill_chunk_sc[op_dim] = (hssize_t)(((MIN(space_dim[op_dim], old_dim[op_dim]) - 1) / chunk_dim[op_dim])); if(shrunk_dim[op_dim]) { @@ -4267,10 +4267,10 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) * modified in this dimension. Note that this array contains * garbage for all dimensions which are not shrunk. These locations * must not be read from! */ - min_mod_chunk_off[op_dim] = space_dim[op_dim] / chunk_dim[op_dim]; + min_mod_chunk_sc[op_dim] = space_dim[op_dim] / chunk_dim[op_dim]; /* Determine if we need to fill chunks in this dimension */ - if((hssize_t)min_mod_chunk_off[op_dim] == max_fill_chunk_off[op_dim]) + if((hssize_t)min_mod_chunk_sc[op_dim] == max_fill_chunk_sc[op_dim]) fill_dim[op_dim] = TRUE; else fill_dim[op_dim] = FALSE; @@ -4289,22 +4289,22 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) if(!shrunk_dim[op_dim]) continue; else { - HDassert(max_mod_chunk_off[op_dim] >= min_mod_chunk_off[op_dim]); + HDassert(max_mod_chunk_sc[op_dim] >= min_mod_chunk_sc[op_dim]); /* Reset the chunk offset indices */ HDmemset(scaled, 0, (space_ndims * sizeof(scaled[0]))); - scaled[op_dim] = min_mod_chunk_off[op_dim]; + scaled[op_dim] = min_mod_chunk_sc[op_dim]; /* Initialize "dims_outside_fill" array */ ndims_outside_fill = 0; for(u = 0; u < space_ndims; u++) - if((hssize_t)scaled[u] > max_fill_chunk_off[u]) { + if((hssize_t)scaled[u] > max_fill_chunk_sc[u]) { dims_outside_fill[u] = TRUE; ndims_outside_fill++; } /* end if */ else dims_outside_fill[u] = FALSE; - } /* end if */ + } /* end if */ carry = FALSE; while(!carry) { @@ -4312,7 +4312,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) if(0 == ndims_outside_fill) { HDassert(fill_dim[op_dim]); - HDassert(scaled[op_dim] == min_mod_chunk_off[op_dim]); + HDassert(scaled[op_dim] == min_mod_chunk_sc[op_dim]); /* Fill the unused parts of the chunk */ if(H5D__chunk_prune_fill(&udata) < 0) @@ -4360,11 +4360,11 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) carry = TRUE; for(i = (int)(space_ndims - 1); i >= 0; --i) { scaled[i]++; - if(scaled[i] > max_mod_chunk_off[i]) { + if(scaled[i] > max_mod_chunk_sc[i]) { /* Left maximum dimensions, "wrap around" and check if this * dimension is no longer outside the fill dimension */ if((unsigned)i == op_dim) { - scaled[i] = min_mod_chunk_off[i]; + scaled[i] = min_mod_chunk_sc[i]; if(dims_outside_fill[i] && fill_dim[i]) { dims_outside_fill[i] = FALSE; ndims_outside_fill--; @@ -4372,7 +4372,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) } /* end if */ else { scaled[i] = 0; - if(dims_outside_fill[i] && max_fill_chunk_off[i] >= 0) { + if(dims_outside_fill[i] && max_fill_chunk_sc[i] >= 0) { dims_outside_fill[i] = FALSE; ndims_outside_fill--; } /* end if */ @@ -4380,7 +4380,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) } /* end if */ else { /* Check if we just went outside the fill dimension */ - if(!dims_outside_fill[i] && (hssize_t)scaled[i] > max_fill_chunk_off[i]) { + if(!dims_outside_fill[i] && (hssize_t)scaled[i] > max_fill_chunk_sc[i]) { dims_outside_fill[i] = TRUE; ndims_outside_fill++; } /* end if */ @@ -4392,13 +4392,13 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) } /* end for */ } /* end while(!carry) */ - /* Adjust max_mod_chunk_off so we don't modify the same chunk twice. + /* Adjust max_mod_chunk_sc so we don't modify the same chunk twice. * Also check if this dimension started from 0 (and hence removed all * of the chunks). */ - if(min_mod_chunk_off[op_dim] == 0) + if(min_mod_chunk_sc[op_dim] == 0) break; else - max_mod_chunk_off[op_dim] = min_mod_chunk_off[op_dim] - 1; + max_mod_chunk_sc[op_dim] = min_mod_chunk_sc[op_dim] - 1; } /* end for(op_dim=0...) */ /* Reset any cached chunk info for this dataset */ @@ -4698,7 +4698,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) const H5O_pline_t *pline = udata->pline; /* I/O pipeline for applying filters */ /* needed for commpressed variable length data */ - hbool_t has_filters = FALSE; /* Whether chunk has filters */ + hbool_t must_filter = FALSE; /* Whether chunk must be filtered during copy */ size_t nbytes; /* Size of chunk in file (in bytes) */ H5Z_cb_t cb_struct; /* Filter failure callback struct */ @@ -4720,8 +4720,8 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) } /* end if */ /* Check for filtered chunks */ - if(pline && pline->nused) { - has_filters = TRUE; + if((is_vlen || fix_ref) && pline && pline->nused) { + must_filter = TRUE; cb_struct.func = NULL; /* no callback function when failed */ } /* end if */ @@ -4752,7 +4752,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk") /* Need to uncompress variable-length & reference data elements */ - if(has_filters && (is_vlen || fix_ref)) { + if(must_filter) { unsigned filter_mask = chunk_rec->filter_mask; if(H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &filter_mask, H5Z_NO_EDC, cb_struct, &nbytes, &buf_size, &buf) < 0) @@ -4816,7 +4816,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) udata_dst.filter_mask = chunk_rec->filter_mask; /* Need to compress variable-length & reference data elements before writing to file */ - if(has_filters && (is_vlen || fix_ref)) { + if(must_filter) { if(H5Z_pipeline(pline, 0, &(udata_dst.filter_mask), H5Z_NO_EDC, cb_struct, &nbytes, &buf_size, &buf) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "output pipeline failed") #if H5_SIZEOF_SIZE_T > 4 @@ -5125,32 +5125,67 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D__chunk_bh_info(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, - const H5O_pline_t *pline, hsize_t *index_size) +H5D__chunk_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5O_layout_t *layout, + hsize_t *index_size) { H5D_chk_idx_info_t idx_info; /* Chunked index info */ + H5S_t *space = NULL; /* Dataset's dataspace */ + H5O_pline_t pline; /* I/O pipeline message */ + htri_t exists; /* Flag if header message of interest exists */ + hbool_t idx_info_init = FALSE; /* Whether the chunk index info has been initialized */ + hbool_t pline_read = FALSE; /* Whether the I/O pipeline message was read */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f); + HDassert(loc); + HDassert(loc->file); + HDassert(H5F_addr_defined(loc->addr)); HDassert(layout); - HDassert(pline); HDassert(index_size); + /* Check for I/O pipeline message */ + if((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") + else if(exists) { + if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_PLINE_ID, &pline)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't find I/O pipeline message") + pline_read = TRUE; + } /* end else if */ + else + HDmemset(&pline, 0, sizeof(pline)); + /* Compose chunked index info struct */ - idx_info.f = f; + idx_info.f = loc->file; idx_info.dxpl_id = dxpl_id; - idx_info.pline = pline; + idx_info.pline = &pline; idx_info.layout = &layout->u.chunk; idx_info.storage = &layout->storage.u.chunk; + /* Get the dataspace for the dataset */ + if(NULL == (space = H5S_read(loc, dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header") + + /* Allocate any indexing structures */ + if(layout->storage.u.chunk.ops->init && (layout->storage.u.chunk.ops->init)(&idx_info, space, loc->addr) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information") + idx_info_init = TRUE; + /* Get size of index structure */ - if((layout->storage.u.chunk.ops->size)(&idx_info, index_size) < 0) + if(layout->storage.u.chunk.ops->size && (layout->storage.u.chunk.ops->size)(&idx_info, index_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve chunk index info") done: + /* Free resources, if they've been initialized */ + if(idx_info_init && layout->storage.u.chunk.ops->dest && + (layout->storage.u.chunk.ops->dest)(&idx_info) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") + if(pline_read && H5O_msg_reset(H5O_PLINE_ID, &pline) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset I/O pipeline message") + if(space && H5S_close(space) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_bh_info() */ diff --git a/src/H5Dint.c b/src/H5Dint.c index b0e31a6..b9899c8 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1548,7 +1548,7 @@ herr_t H5D_close(H5D_t *dataset) { hbool_t free_failed = FALSE; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2566,7 +2566,6 @@ done: herr_t H5D__flush_real(H5D_t *dataset, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Pointer to dataset's object header */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, dataset->oloc.addr, FAIL) @@ -2577,38 +2576,6 @@ H5D__flush_real(H5D_t *dataset, hid_t dxpl_id) /* Avoid flushing the dataset (again) if it's closing */ if(!dataset->shared->closing) { - /* Check for metadata changes that will require updating the object's modification time */ - if(dataset->shared->layout_dirty || dataset->shared->space_dirty) { - unsigned update_flags = H5O_UPDATE_TIME; /* Modification time flag */ - - /* Pin the object header */ - if(NULL == (oh = H5O_pin(&dataset->oloc, dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header") - - /* Update the layout on disk, if it's been changed */ - if(dataset->shared->layout_dirty) { - if(H5D__layout_oh_write(dataset, dxpl_id, oh, update_flags) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout/pline/efl info") - dataset->shared->layout_dirty = FALSE; - - /* Reset the "update the modification time" flag, so we only do it once */ - update_flags = 0; - } /* end if */ - - /* Update the dataspace on disk, if it's been changed */ - if(dataset->shared->space_dirty) { - if(H5S_write(dataset->oloc.file, dxpl_id, oh, update_flags, dataset->shared->space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace") - dataset->shared->space_dirty = FALSE; - - /* Reset the "update the modification time" flag, so we only do it once */ - update_flags = 0; - } /* end if */ - - /* _Somebody_ should have update the modification time! */ - HDassert(update_flags == 0); - } /* end if */ - /* Flush cached raw data for each kind of dataset layout */ if(dataset->shared->layout.ops->flush && (dataset->shared->layout.ops->flush)(dataset, dxpl_id) < 0) @@ -2616,11 +2583,6 @@ H5D__flush_real(H5D_t *dataset, hid_t dxpl_id) } /* end if */ done: - /* Release pointer to object header */ - if(oh != NULL) - if(H5O_unpin(oh) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header") - FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D__flush_real() */ @@ -2641,19 +2603,50 @@ done: herr_t H5D__mark(const H5D_t *dataset, hid_t H5_ATTR_UNUSED dxpl_id, unsigned flags) { + H5O_t *oh = NULL; /* Pointer to dataset's object header */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_PACKAGE /* Check args */ HDassert(dataset); HDassert(!(flags & (unsigned)~(H5D_MARK_SPACE | H5D_MARK_LAYOUT))); /* Mark aspects of the dataset as dirty */ - if(flags & H5D_MARK_SPACE) - dataset->shared->space_dirty = TRUE; - if(flags & H5D_MARK_LAYOUT) - dataset->shared->layout_dirty = TRUE; + if(flags) { + unsigned update_flags = H5O_UPDATE_TIME; /* Modification time flag */ + + /* Pin the object header */ + if(NULL == (oh = H5O_pin(&dataset->oloc, dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header") + + /* Update the layout on disk, if it's been changed */ + if(flags & H5D_MARK_LAYOUT) { + if(H5D__layout_oh_write(dataset, dxpl_id, oh, update_flags) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout/pline/efl info") + + /* Reset the "update the modification time" flag, so we only do it once */ + update_flags = 0; + } /* end if */ + + /* Update the dataspace on disk, if it's been changed */ + if(flags & H5D_MARK_SPACE) { + if(H5S_write(dataset->oloc.file, dxpl_id, oh, update_flags, dataset->shared->space) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace") + + /* Reset the "update the modification time" flag, so we only do it once */ + update_flags = 0; + } /* end if */ + + /* _Somebody_ should have update the modification time! */ + HDassert(update_flags == 0); + } /* end if */ + +done: + /* Release pointer to object header */ + if(oh != NULL) + if(H5O_unpin(oh) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__mark() */ @@ -2990,7 +2983,7 @@ hid_t H5D_get_space(H5D_t *dset) { H5S_t *space = NULL; - hid_t ret_value = FAIL; + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index ae478b2..8676d7c 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -153,7 +153,7 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ /* Size of raw data */ ret_value += 2; if(include_compact_data) - ret_value += layout->storage.u.compact.size;/* data for compact dataset */ + ret_value += layout->storage.u.compact.size; /* data for compact dataset */ break; case H5D_CONTIGUOUS: @@ -266,7 +266,7 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect EFL file name heap") /* Insert "empty" name first */ - if((size_t)(-1) == H5HL_insert(file, dxpl_id, heap, (size_t)1, "")) { + if(UFAIL == H5HL_insert(file, dxpl_id, heap, (size_t)1, "")) { H5HL_unprotect(heap); HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap") } /* end if */ @@ -275,7 +275,7 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, size_t offset; /* Offset of file name in heap */ /* Insert file name into heap */ - if((size_t)(-1) == (offset = H5HL_insert(file, dxpl_id, heap, + if(UFAIL == (offset = H5HL_insert(file, dxpl_id, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name))) { H5HL_unprotect(heap); HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap") diff --git a/src/H5Doh.c b/src/H5Doh.c index f8a733d..8b70362 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -53,7 +53,7 @@ static hid_t H5O__dset_open(const H5G_loc_t *obj_loc, hid_t lapl_id, static void *H5O__dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc, hid_t dxpl_id); static H5O_loc_t *H5O__dset_get_oloc(hid_t obj_id); -static herr_t H5O__dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, +static herr_t H5O__dset_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info); static herr_t H5O__dset_flush(H5G_loc_t *obj_loc, hid_t dxpl_id); @@ -359,13 +359,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O__dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) +H5O__dset_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) { H5O_layout_t layout; /* Data storage layout message */ - H5O_pline_t pline; /* I/O pipeline message */ H5O_efl_t efl; /* External File List message */ hbool_t layout_read = FALSE; /* Whether the layout message was read */ - hbool_t pline_read = FALSE; /* Whether the I/O pipeline message was read */ hbool_t efl_read = FALSE; /* Whether the external file list message was read */ htri_t exists; /* Flag if header message of interest exists */ herr_t ret_value = SUCCEED; /* Return value */ @@ -373,29 +371,21 @@ H5O__dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) FUNC_ENTER_STATIC /* Sanity check */ - HDassert(f); + HDassert(loc); + HDassert(loc->file); + HDassert(H5F_addr_defined(loc->addr)); HDassert(oh); HDassert(bh_info); /* Get the layout message from the object header */ - if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_LAYOUT_ID, &layout)) + if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_LAYOUT_ID, &layout)) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find layout message") layout_read = TRUE; /* Check for chunked dataset storage */ if(layout.type == H5D_CHUNKED && H5D__chunk_is_space_alloc(&layout.storage)) { - /* Check for I/O pipeline message */ - if((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") - else if(exists) { - if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_PLINE_ID, &pline)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find I/O pipeline message") - pline_read = TRUE; - } /* end else if */ - else - HDmemset(&pline, 0, sizeof(pline)); - - if(H5D__chunk_bh_info(f, dxpl_id, &layout, &pline, &(bh_info->index_size)) < 0) + /* Get size of chunk index */ + if(H5D__chunk_bh_info(loc, dxpl_id, oh, &layout, &(bh_info->index_size)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine chunked dataset btree info") } /* end if */ else if(layout.type == H5D_VIRTUAL @@ -403,7 +393,7 @@ H5O__dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) size_t virtual_heap_size; /* Get size of global heap object for virtual dataset */ - if(H5HG_get_obj_size(f, dxpl_id, &(layout.storage.u.virt.serial_list_hobjid), &virtual_heap_size) < 0) + if(H5HG_get_obj_size(loc->file, dxpl_id, &(layout.storage.u.virt.serial_list_hobjid), &virtual_heap_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get global heap size for virtual dataset mapping") /* Return heap size */ @@ -419,12 +409,12 @@ H5O__dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) HDmemset(&efl, 0, sizeof(efl)); /* Get External File List message from the object header */ - if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_EFL_ID, &efl)) + if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_EFL_ID, &efl)) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find EFL message") efl_read = TRUE; /* Get size of local heap for EFL message's file list */ - if(H5D__efl_bh_info(f, dxpl_id, &efl, &(bh_info->heap_size)) < 0) + if(H5D__efl_bh_info(loc->file, dxpl_id, &efl, &(bh_info->heap_size)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine EFL heap info") } /* end if */ @@ -432,8 +422,6 @@ done: /* Free messages, if they've been read in */ if(layout_read && H5O_msg_reset(H5O_LAYOUT_ID, &layout) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset data storage layout message") - if(pline_read && H5O_msg_reset(H5O_PLINE_ID, &pline) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset I/O pipeline message") if(efl_read && H5O_msg_reset(H5O_EFL_ID, &efl) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset external file list message") @@ -458,8 +446,8 @@ static herr_t H5O__dset_flush(H5G_loc_t *obj_loc, hid_t dxpl_id) { H5D_t *dset = NULL; /* Dataset opened */ - H5O_type_t obj_type; /* Type of object at location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_type_t obj_type; /* Type of object at location */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -469,7 +457,6 @@ H5O__dset_flush(H5G_loc_t *obj_loc, hid_t dxpl_id) /* Check that the object found is the correct type */ if(H5O_obj_type(obj_loc->oloc, &obj_type, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_DATASET) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 552c61b..f391e8c 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -414,8 +414,6 @@ typedef struct H5D_shared_t { hid_t type_id; /* ID for dataset's datatype */ H5T_t *type; /* Datatype for this dataset */ H5S_t *space; /* Dataspace of this dataset */ - hbool_t space_dirty; /* Whether the dataspace info needs to be flushed to the file */ - hbool_t layout_dirty; /* Whether the layout info needs to be flushed to the file */ hid_t dcpl_id; /* Dataset creation property id */ H5D_dcpl_cache_t dcpl_cache; /* Cached DCPL values */ H5O_layout_t layout; /* Data layout */ @@ -636,8 +634,8 @@ H5_DLL herr_t H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk_t *layout_src, H5F_t *f_dst, H5O_storage_chunk_t *storage_dst, const H5S_extent_t *ds_extent_src, const H5T_t *dt_src, const H5O_pline_t *pline_src, H5O_copy_t *cpy_info, hid_t dxpl_id); -H5_DLL herr_t H5D__chunk_bh_info(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, - const H5O_pline_t *pline, hsize_t *btree_size); +H5_DLL herr_t H5D__chunk_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, + H5O_layout_t *layout, hsize_t *btree_size); H5_DLL herr_t H5D__chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream); H5_DLL herr_t H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *store); diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 316fcf7..7c5186d 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -132,6 +132,7 @@ const H5D_layout_ops_t H5D_LOPS_VIRTUAL[1] = {{ NULL, NULL, H5D__virtual_flush, + NULL, NULL }}; @@ -653,11 +654,10 @@ H5D__virtual_copy(H5F_t H5_ATTR_UNUSED *f_dst, H5O_layout_t *layout_dst, { herr_t ret_value = SUCCEED; +#ifdef NOT_YET FUNC_ENTER_PACKAGE - - /* Copy message in memory */ - if(H5D__virtual_copy_layout(layout_dst) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual layout") +#endif /* NOT_YET */ + FUNC_ENTER_PACKAGE_NOERR #ifdef NOT_YET /* Check for copy to the same file */ @@ -675,7 +675,9 @@ H5D__virtual_copy(H5F_t H5_ATTR_UNUSED *f_dst, H5O_layout_t *layout_dst, layout_dst->storage.u.virt.serial_list_hobjid.idx = (size_t)0; } /* end block/else */ +#ifdef NOT_YET done: +#endif /* NOT_YET */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_copy() */ @@ -1324,7 +1326,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id) new_dims[i] = HSIZE_UNDEF; /* Iterate over mappings */ - for(i = 0; i < storage->list_nalloc; i++) + for(i = 0; i < storage->list_nused; i++) /* Check for unlimited dimension */ if(storage->list[i].unlim_dim_virtual >= 0) { /* Check for "printf" source dataset resolution */ @@ -1566,7 +1568,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id) if(changed || (!storage->init && (storage->view == H5D_VDS_FIRST_MISSING))) { /* Iterate over mappings again to update source selections and virtual * mapping extents */ - for(i = 0; i < storage->list_nalloc; i++) { + for(i = 0; i < storage->list_nused; i++) { /* If there is an unlimited dimension, we are setting extent by the * minimum of mappings, and the virtual extent in the unlimited * dimension has changed since the last time the VDS extent/mapping @@ -1746,7 +1748,7 @@ H5D__virtual_init_all(const H5D_t *dset, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS dimensions") /* Iterate over mappings */ - for(i = 0; i < storage->list_nalloc; i++) + for(i = 0; i < storage->list_nused; i++) /* Check for unlimited dimension */ if(storage->list[i].unlim_dim_virtual >= 0) { /* Check for "printf" source dataset resolution */ @@ -2716,7 +2718,7 @@ H5D__virtual_flush(H5D_t *dset, hid_t dxpl_id) if(storage->list[i].source_dset.dset) /* Flush source dataset */ if(H5D__flush_real(storage->list[i].source_dset.dset, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to write to source dataset") + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to flush source dataset") done: FUNC_LEAVE_NOAPI(ret_value) @@ -15,12 +15,12 @@ /*------------------------------------------------------------------------- * - * Created: H5FA.c - * April 2009 - * Vailin Choi <vchoi@hdfgroup.org> + * Created: H5FA.c + * April 2009 + * Vailin Choi <vchoi@hdfgroup.org> * - * Purpose: Implements a Fixed Array for storing elements - * of datasets with fixed dimensions + * Purpose: Implements a Fixed Array for storing elements + * of datasets with fixed dimensions. * *------------------------------------------------------------------------- */ @@ -96,19 +96,19 @@ const H5FA_class_t *const H5FA_client_class_g[] = { H5FL_DEFINE_STATIC(H5FA_t); /* Declare a PQ free list to manage the element */ -H5FL_BLK_DEFINE(native_elmt); +H5FL_BLK_DEFINE(fa_native_elmt); /*------------------------------------------------------------------------- - * Function: H5FA_create + * Function: H5FA_create * - * Purpose: Creates a new fixed array (header) in the file. + * Purpose: Creates a new fixed array (header) in the file. * - * Return: Pointer to fixed array wrapper on success + * Return: Pointer to fixed array wrapper on success * NULL on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -137,24 +137,24 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Create fixed array header */ if(HADDR_UNDEF == (fa_addr = H5FA__hdr_create(f, dxpl_id, cparam, ctx_udata))) - H5E_THROW(H5E_CANTINIT, "can't create fixed array header") + H5E_THROW(H5E_CANTINIT, "can't create fixed array header") /* Allocate fixed array wrapper */ if(NULL == (fa = H5FL_MALLOC(H5FA_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array info") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array info") /* Lock the array header into memory */ if(NULL == (hdr = H5FA__hdr_protect(f, dxpl_id, fa_addr, ctx_udata, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") + H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") /* Point fixed array wrapper at header and bump it's ref count */ fa->hdr = hdr; if(H5FA__hdr_incr(fa->hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") /* Increment # of files using this array header */ if(H5FA__hdr_fuse_incr(fa->hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header") + H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header") /* Set file pointer for this array open context */ fa->f = f; @@ -165,7 +165,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); CATCH if(hdr && H5FA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") if(!ret_value) if(fa && H5FA_close(fa, dxpl_id) < 0) H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array") @@ -174,14 +174,14 @@ END_FUNC(PRIV) /* end H5FA_create() */ /*------------------------------------------------------------------------- - * Function: H5FA_open + * Function: H5FA_open * - * Purpose: Opens an existing fixed array in the file. + * Purpose: Opens an existing fixed array in the file. * - * Return: Pointer to array wrapper on success + * Return: Pointer to array wrapper on success * NULL on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -242,13 +242,13 @@ END_FUNC(PRIV) /* end H5FA_open() */ /*------------------------------------------------------------------------- - * Function: H5FA_get_nelmts + * Function: H5FA_get_nelmts * - * Purpose: Query the current number of elements in array + * Purpose: Query the current number of elements in array * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -276,13 +276,13 @@ END_FUNC(PRIV) /* end H5FA_get_nelmts() */ /*------------------------------------------------------------------------- - * Function: H5FA_get_addr + * Function: H5FA_get_addr * - * Purpose: Query the address of the array + * Purpose: Query the address of the array * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -311,13 +311,13 @@ END_FUNC(PRIV) /* end H5FA_get_addr() */ /*------------------------------------------------------------------------- - * Function: H5FA_set + * Function: H5FA_set * - * Purpose: Set an element of a fixed array + * Purpose: Set an element of a fixed array * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -363,13 +363,13 @@ HDfprintf(stderr, "%s: fixed array data block address not defined!\n", FUNC, idx /* Protect data block */ if(NULL == (dblock = H5FA__dblock_protect(hdr, dxpl_id, hdr->dblk_addr, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", (unsigned long long)hdr->dblk_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", (unsigned long long)hdr->dblk_addr) /* Check for paging data block */ if(!dblock->npages) { - /* Set element in data block */ - HDmemcpy(((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), elmt, hdr->cparam.cls->nat_elmt_size); - dblock_cache_flags |= H5AC__DIRTIED_FLAG; + /* Set element in data block */ + HDmemcpy(((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), elmt, hdr->cparam.cls->nat_elmt_size); + dblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else { /* paging */ size_t page_idx; /* Index of page within data block */ @@ -382,20 +382,20 @@ HDfprintf(stderr, "%s: fixed array data block address not defined!\n", FUNC, idx elmt_idx = (size_t)(idx % dblock->dblk_page_nelmts); /* Get the address of the data block page */ - dblk_page_addr = dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock) + + dblk_page_addr = dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock) + ((hsize_t)page_idx * dblock->dblk_page_size); /* Check for using last page, to set the number of elements on the page */ - if((page_idx + 1) == dblock->npages) - dblk_page_nelmts = dblock->last_page_nelmts; - else - dblk_page_nelmts = dblock->dblk_page_nelmts; + if((page_idx + 1) == dblock->npages) + dblk_page_nelmts = dblock->last_page_nelmts; + else + dblk_page_nelmts = dblock->dblk_page_nelmts; /* Check if the page has been created yet */ if(!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { - /* Create the data block page */ - if(H5FA__dblk_page_create(hdr, dxpl_id, dblk_page_addr, dblk_page_nelmts) < 0) - H5E_THROW(H5E_CANTCREATE, "unable to create data block page") + /* Create the data block page */ + if(H5FA__dblk_page_create(hdr, dxpl_id, dblk_page_addr, dblk_page_nelmts) < 0) + H5E_THROW(H5E_CANTCREATE, "unable to create data block page") /* Mark data block page as initialized in data block */ H5VM_bit_set(dblock->dblk_page_init, page_idx, TRUE); @@ -407,8 +407,8 @@ HDfprintf(stderr, "%s: fixed array data block address not defined!\n", FUNC, idx H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", (unsigned long long)dblk_page_addr) /* Set the element in the data block page */ - HDmemcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size); - dblk_page_cache_flags |= H5AC__DIRTIED_FLAG; + HDmemcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size); + dblk_page_cache_flags |= H5AC__DIRTIED_FLAG; } /* end else */ CATCH @@ -427,13 +427,13 @@ END_FUNC(PRIV) /* end H5FA_set() */ /*------------------------------------------------------------------------- - * Function: H5FA_get + * Function: H5FA_get * - * Purpose: Get an element of a fixed array + * Purpose: Get an element of a fixed array * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -529,13 +529,13 @@ END_FUNC(PRIV) /* end H5FA_get() */ /*------------------------------------------------------------------------- - * Function: H5FA_close + * Function: H5FA_close * - * Purpose: Close a fixed array + * Purpose: Close a fixed array * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -630,13 +630,13 @@ END_FUNC(PRIV) /* end H5FA_close() */ /*------------------------------------------------------------------------- - * Function: H5FA_delete + * Function: H5FA_delete * - * Purpose: Delete a fixed array + * Purpose: Delete a fixed array * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -684,16 +684,16 @@ END_FUNC(PRIV) /* end H5FA_delete() */ /*------------------------------------------------------------------------- - * Function: H5FA_iterate + * Function: H5FA_iterate * - * Purpose: Iterate over the elements of a fixed array + * Purpose: Iterate over the elements of a fixed array * - * Note: This is not very efficient, we should be iterating directly - * over the fixed array's direct block [pages]. + * Note: This is not very efficient, we should be iterating directly + * over the fixed array's direct block [pages]. * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -703,8 +703,8 @@ herr_t, SUCCEED, FAIL, H5FA_iterate(H5FA_t *fa, hid_t dxpl_id, H5FA_operator_t op, void *udata)) /* Local variables */ - uint8_t *elmt = NULL; - hsize_t u; + uint8_t *elmt = NULL; + hsize_t u; /* * Check arguments. @@ -714,8 +714,8 @@ H5FA_iterate(H5FA_t *fa, hid_t dxpl_id, H5FA_operator_t op, void *udata)) HDassert(udata); /* Allocate space for a native array element */ - if(NULL == (elmt = H5FL_BLK_MALLOC(native_elmt, fa->hdr->cparam.cls->nat_elmt_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array element") + if(NULL == (elmt = H5FL_BLK_MALLOC(fa_native_elmt, fa->hdr->cparam.cls->nat_elmt_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array element") /* Iterate over all elements in array */ for(u = 0; u < fa->hdr->stats.nelmts; u++) { @@ -735,7 +735,7 @@ H5FA_iterate(H5FA_t *fa, hid_t dxpl_id, H5FA_operator_t op, void *udata)) CATCH if(elmt) - elmt = H5FL_BLK_FREE(native_elmt, elmt); + elmt = H5FL_BLK_FREE(fa_native_elmt, elmt); END_FUNC(PRIV) /* end H5FA_iterate() */ diff --git a/src/H5FAcache.c b/src/H5FAcache.c index f3396be..1d4afa4 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -15,11 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5FAcache.c - * Jul 2 2009 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5FAcache.c + * Jul 2 2009 + * Quincey Koziol <koziol@hdfgroup.org> * - * Purpose: Implement fixed array metadata cache methods. + * Purpose: Implement fixed array metadata cache methods. * *------------------------------------------------------------------------- */ @@ -205,7 +205,7 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_get_load_size() */ * * Purpose: Loads a data structure from the disk. * - * Return: Success: Pointer to a new B-tree. + * Return: Success: Pointer to a new Fixed array * Failure: NULL * * Programmer: Quincey Koziol @@ -234,24 +234,24 @@ H5FA__cache_hdr_deserialize(const void *_image, size_t len, /* Allocate space for the fixed array data structure */ if(NULL == (hdr = H5FA__hdr_alloc(udata->f))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array shared header") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array shared header") /* Set the fixed array header's address */ hdr->addr = udata->addr; /* Magic number */ if(HDmemcmp(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - H5E_THROW(H5E_BADVALUE, "wrong fixed array header signature") + H5E_THROW(H5E_BADVALUE, "wrong fixed array header signature") image += H5_SIZEOF_MAGIC; /* Version */ if(*image++ != H5FA_HDR_VERSION) - H5E_THROW(H5E_VERSION, "wrong fixed array header version") + H5E_THROW(H5E_VERSION, "wrong fixed array header version") /* Fixed array class */ id = (H5FA_cls_id_t)*image++; if(id >= H5FA_NUM_CLS_ID) - H5E_THROW(H5E_BADTYPE, "incorrect fixed array class") + H5E_THROW(H5E_BADTYPE, "incorrect fixed array class") hdr->cparam.cls = H5FA_client_class_g[id]; /* General array creation/configuration information */ @@ -418,7 +418,7 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_serialize() */ * Purpose: Destroy/release an "in core representation" of a data * structure * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -529,7 +529,7 @@ H5FA__cache_dblock_deserialize(const void *_image, size_t len, /* Allocate the fixed array data block */ if(NULL == (dblock = H5FA__dblock_alloc(udata->hdr))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") HDassert(((!dblock->npages) && (len == (size_t)H5FA_DBLOCK_SIZE(dblock))) || (len == (size_t)H5FA_DBLOCK_PREFIX_SIZE(dblock))); @@ -539,21 +539,21 @@ H5FA__cache_dblock_deserialize(const void *_image, size_t len, /* Magic number */ if(HDmemcmp(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - H5E_THROW(H5E_BADVALUE, "wrong fixed array data block signature") + H5E_THROW(H5E_BADVALUE, "wrong fixed array data block signature") image += H5_SIZEOF_MAGIC; /* Version */ if(*image++ != H5FA_DBLOCK_VERSION) - H5E_THROW(H5E_VERSION, "wrong fixed array data block version") + H5E_THROW(H5E_VERSION, "wrong fixed array data block version") /* Fixed array type */ if(*image++ != (uint8_t)udata->hdr->cparam.cls->id) - H5E_THROW(H5E_BADTYPE, "incorrect fixed array class") + H5E_THROW(H5E_BADTYPE, "incorrect fixed array class") /* Address of header for array that owns this block (just for file integrity checks) */ H5F_addr_decode(udata->hdr->f, &image, &arr_addr); if(H5F_addr_ne(arr_addr, udata->hdr->addr)) - H5E_THROW(H5E_BADVALUE, "wrong fixed array header address") + H5E_THROW(H5E_BADVALUE, "wrong fixed array header address") /* Page initialization flags */ if(dblock->npages > 0) { @@ -717,7 +717,7 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_serialize() */ * Purpose: Destroy/release an "in core representation" of a data * structure * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -936,7 +936,7 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */ * * Purpose: Flushes a dirty object to disk. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org diff --git a/src/H5FAdbg.c b/src/H5FAdbg.c index 2f8fda2..2dc51c5 100644 --- a/src/H5FAdbg.c +++ b/src/H5FAdbg.c @@ -15,9 +15,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FAdbg.c + * Created: H5FAdbg.c * - * Purpose: Dump debugging information about a fixed array. + * Purpose: Dump debugging information about a fixed array. * *------------------------------------------------------------------------- */ @@ -80,13 +80,13 @@ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_debug + * Function: H5FA__hdr_debug * - * Purpose: Prints debugging info about a fixed array header. + * Purpose: Prints debugging info about a fixed array header. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -97,8 +97,8 @@ H5FA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls, haddr_t obj_addr)) /* Local variables */ - H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */ - void *dbg_ctx = NULL; /* Fixed array debugging context */ + H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */ + void *dbg_ctx = NULL; /* Fixed array debugging context */ /* Check arguments */ HDassert(f); @@ -113,58 +113,58 @@ H5FA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, if(cls->crt_dbg_ctx) { /* Create debugging context */ if(NULL == (dbg_ctx = cls->crt_dbg_ctx(f, dxpl_id, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") + H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") } /* end if */ /* Load the fixed array header */ if(NULL == (hdr = H5FA__hdr_protect(f, dxpl_id, addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") + H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") /* Print opening message */ HDfprintf(stream, "%*sFixed Array Header...\n", indent, ""); /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Array class ID:", hdr->cparam.cls->name); + "Array class ID:", hdr->cparam.cls->name); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Header size:", - hdr->size); + "Header size:", + hdr->size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Raw Element Size:", - (unsigned)hdr->cparam.raw_elmt_size); + "Raw Element Size:", + (unsigned)hdr->cparam.raw_elmt_size); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Native Element Size (on this platform):", - hdr->cparam.cls->nat_elmt_size); + "Native Element Size (on this platform):", + hdr->cparam.cls->nat_elmt_size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Max. # of elements in data block page:", - (unsigned)((size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits)); + "Max. # of elements in data block page:", + (unsigned)((size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits)); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of elements in Fixed Array:", hdr->stats.nelmts); + "Number of elements in Fixed Array:", hdr->stats.nelmts); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Fixed Array Data Block Address:", hdr->dblk_addr); + "Fixed Array Data Block Address:", hdr->dblk_addr); CATCH if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") + H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") if(hdr && H5FA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") END_FUNC(PKG) /* end H5FA__hdr_debug() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblock_debug + * Function: H5FA__dblock_debug * - * Purpose: Prints debugging info about a fixed array data block. + * Purpose: Prints debugging info about a fixed array data block. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -177,7 +177,7 @@ H5FA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde /* Local variables */ H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */ H5FA_dblock_t *dblock = NULL; /* Fixed array data block */ - void *dbg_ctx = NULL; /* Fixed array context */ + void *dbg_ctx = NULL; /* Fixed array context */ size_t u; /* Local index variable */ /* Check arguments */ @@ -194,12 +194,12 @@ H5FA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde if(cls->crt_dbg_ctx) { /* Create debugging context */ if(NULL == (dbg_ctx = cls->crt_dbg_ctx(f, dxpl_id, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") + H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") } /* end if */ /* Load the fixed array header */ if(NULL == (hdr = H5FA__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") + H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") /* Protect data block */ if(NULL == (dblock = H5FA__dblock_protect(hdr, dxpl_id, addr, H5AC__READ_ONLY_FLAG))) @@ -210,26 +210,26 @@ H5FA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Array class ID:", hdr->cparam.cls->name); + "Array class ID:", hdr->cparam.cls->name); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of Data Block:", dblock->addr); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data Block size:", dblock->size); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of elements in Data Block:", hdr->cparam.nelmts); + "Number of elements in Data Block:", hdr->cparam.nelmts); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of pages in Data Block:", dblock->npages); + "Number of pages in Data Block:", dblock->npages); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of elements per Data Block page:", dblock->dblk_page_nelmts); + "Number of elements per Data Block page:", dblock->dblk_page_nelmts); if(dblock->npages) { /* paging */ - size_t dblk_page_nelmts; /* # of elements in a data block page */ + size_t dblk_page_nelmts; /* # of elements in a data block page */ haddr_t dblk_page_addr; /* Address of a data block page */ size_t page_idx; /* Page index within data block */ - HDfprintf(stream, "%*sPaging:\n", indent, ""); + HDfprintf(stream, "%*sPaging:\n", indent, ""); - /* Iterate over the pages */ - dblk_page_addr = dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock); - dblk_page_nelmts = dblock->dblk_page_nelmts; + /* Iterate over the pages */ + dblk_page_addr = dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock); + dblk_page_nelmts = dblock->dblk_page_nelmts; /* Read and print each page's elements in the data block */ for(page_idx = 0; page_idx < dblock->npages; page_idx++) { @@ -237,51 +237,49 @@ H5FA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde HDfprintf(stream, "%*s%-*s %Hu %s\n", indent, "", fwidth, "Page %Zu:", page_idx, "empty"); - } /* end if */ + } /* end if */ else { /* get the page */ H5FA_dblk_page_t *dblk_page; /* Pointer to a data block page */ - hsize_t nelmts_left; /* Remaining elements in the last data block page */ + hsize_t nelmts_left; /* Remaining elements in the last data block page */ /* Check for last page */ - if(((page_idx + 1) == dblock->npages) && (nelmts_left = hdr->cparam.nelmts % dblock->dblk_page_nelmts)) - dblk_page_nelmts = (size_t)nelmts_left; + if(((page_idx + 1) == dblock->npages) && (nelmts_left = hdr->cparam.nelmts % dblock->dblk_page_nelmts)) + dblk_page_nelmts = (size_t)nelmts_left; if(NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dxpl_id, dblk_page_addr, dblk_page_nelmts, H5AC__READ_ONLY_FLAG))) H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", (unsigned long long)dblk_page_addr) - HDfprintf(stream, "%*sElements in page %Zu:\n", indent, "", page_idx); - for(u = 0; u < dblk_page_nelmts; u++) { - /* Call the class's 'debug' callback */ - if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, - ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - H5E_THROW(H5E_CANTGET, "can't get element for debugging") - } /* end for */ - if(H5FA__dblk_page_unprotect(dblk_page, dxpl_id, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page") - - /* Advance to next page address */ - dblk_page_addr += dblock->dblk_page_size; - } /* paging */ - } /* end for npages */ + HDfprintf(stream, "%*sElements in page %Zu:\n", indent, "", page_idx); + for(u = 0; u < dblk_page_nelmts; u++) { + /* Call the class's 'debug' callback */ + if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) + H5E_THROW(H5E_CANTGET, "can't get element for debugging") + } /* end for */ + if(H5FA__dblk_page_unprotect(dblk_page, dxpl_id, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page") + + /* Advance to next page address */ + dblk_page_addr += dblock->dblk_page_size; + } /* paging */ + } /* end for npages */ } /* end if */ else { /* not paging */ - /* Print the elements in the data block */ - HDfprintf(stream, "%*sElements:\n", indent, ""); - for(u = 0; u < hdr->cparam.nelmts; u++) { - /* Call the class's 'debug' callback */ - if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, - ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - H5E_THROW(H5E_CANTGET, "can't get element for debugging") - } /* end for */ + /* Print the elements in the data block */ + HDfprintf(stream, "%*sElements:\n", indent, ""); + for(u = 0; u < hdr->cparam.nelmts; u++) { + /* Call the class's 'debug' callback */ + if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) + H5E_THROW(H5E_CANTGET, "can't get element for debugging") + } /* end for */ } /* end else */ CATCH if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") + H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") if(dblock && H5FA__dblock_unprotect(dblock, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") if(hdr && H5FA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") END_FUNC(PKG) /* end H5FA__dblock_debug() */ diff --git a/src/H5FAdblkpage.c b/src/H5FAdblkpage.c index 00eb398..bba4439 100644 --- a/src/H5FAdblkpage.c +++ b/src/H5FAdblkpage.c @@ -15,9 +15,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FAdblkpage.c + * Created: H5FAdblkpage.c * - * Purpose: Data block page routines for fixed array. + * Purpose: Data block page routines for fixed array. * *------------------------------------------------------------------------- */ @@ -37,10 +37,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FApkg.h" /* Fixed Arrays */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5FLprivate.h" /* Free Lists */ /****************/ @@ -86,13 +86,13 @@ H5FL_BLK_DEFINE(page_elmts); /*------------------------------------------------------------------------- - * Function: H5FA__dblk_page_alloc + * Function: H5FA__dblk_page_alloc * - * Purpose: Allocate fixed array data block page + * Purpose: Allocate fixed array data block page * - * Return: Non-NULL pointer to data block on success/NULL on failure + * Return: Non-NULL pointer to data block on success/NULL on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -109,11 +109,11 @@ H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts)) /* Allocate memory for the data block */ if(NULL == (dblk_page = H5FL_CALLOC(H5FA_dblk_page_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") /* Share common array information */ if(H5FA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") dblk_page->hdr = hdr; /* Set non-zero internal fields */ @@ -136,13 +136,13 @@ END_FUNC(PKG) /* end H5FA__dblk_page_alloc() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblk_page_create + * Function: H5FA__dblk_page_create * - * Purpose: Creates a new fixed array data block page in the file + * Purpose: Creates a new fixed array data block page in the file * - * Return: Valid file address on success/HADDR_UNDEF on failure + * Return: Valid file address on success/HADDR_UNDEF on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -163,7 +163,7 @@ HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr); /* Allocate the data block page */ if(NULL == (dblk_page = H5FA__dblk_page_alloc(hdr, nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") /* Set info about data block page on disk */ dblk_page->addr = addr; @@ -178,7 +178,7 @@ HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", FUNC, dblk_page->size); /* Cache the new fixed array data block page */ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block page to cache") + H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block page to cache") CATCH if(ret_value < 0) @@ -192,14 +192,14 @@ END_FUNC(PKG) /* end H5FA__dblk_page_create() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblk_page_protect + * Function: H5FA__dblk_page_protect * - * Purpose: Convenience wrapper around protecting fixed array data + * Purpose: Convenience wrapper around protecting fixed array data * block page * - * Return: Non-NULL pointer to data block page on success/NULL on failure + * Return: Non-NULL pointer to data block page on success/NULL on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -238,14 +238,14 @@ END_FUNC(PKG) /* end H5FA__dblk_page_protect() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblk_page_unprotect + * Function: H5FA__dblk_page_unprotect * - * Purpose: Convenience wrapper around unprotecting fixed array + * Purpose: Convenience wrapper around unprotecting fixed array * data block page * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -274,13 +274,13 @@ END_FUNC(PKG) /* end H5FA__dblk_page_unprotect() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblk_page_dest + * Function: H5FA__dblk_page_dest * - * Purpose: Destroys a fixed array data block page in memory. + * Purpose: Destroys a fixed array data block page in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -297,7 +297,7 @@ H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page)) /* Check if buffer for data block page elements has been initialized */ if(dblk_page->elmts) { /* Free buffer for data block page elements */ - dblk_page->elmts = H5FL_BLK_FREE(page_elmts, dblk_page->elmts); + dblk_page->elmts = H5FL_BLK_FREE(page_elmts, dblk_page->elmts); } /* end if */ /* Decrement reference count on shared info */ diff --git a/src/H5FAdblock.c b/src/H5FAdblock.c index 71b618c..95419f8 100644 --- a/src/H5FAdblock.c +++ b/src/H5FAdblock.c @@ -15,9 +15,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FAdblock.c + * Created: H5FAdblock.c * - * Purpose: Data block routines for fixed arrays. + * Purpose: Data block routines for fixed arrays. * *------------------------------------------------------------------------- */ @@ -37,11 +37,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FApkg.h" /* Fixed Arrays */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MFprivate.h" /* File memory management */ /****************/ @@ -89,13 +89,13 @@ H5FL_BLK_DEFINE(fa_page_init); /*------------------------------------------------------------------------- - * Function: H5FA__dblock_alloc + * Function: H5FA__dblock_alloc * - * Purpose: Allocate fixed array data block + * Purpose: Allocate fixed array data block * - * Return: Non-NULL pointer to data block on success/NULL on failure + * Return: Non-NULL pointer to data block on success/NULL on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -113,11 +113,11 @@ H5FA__dblock_alloc(H5FA_hdr_t *hdr)) /* Allocate memory for the data block */ if(NULL == (dblock = H5FL_CALLOC(H5FA_dblock_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") /* Share common array information */ if(H5FA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") dblock->hdr = hdr; /* Set non-zero internal fields */ @@ -131,19 +131,19 @@ H5FA__dblock_alloc(H5FA_hdr_t *hdr)) /* Safely assign the number of pages */ H5_CHECKED_ASSIGN(dblock->npages, size_t, npages, hsize_t); - /* Sanity check that we have at least 1 page */ - HDassert(dblock->npages > 0); + /* Sanity check that we have at least 1 page */ + HDassert(dblock->npages > 0); /* Compute size of 'page init' flag array, in bytes */ - dblock->dblk_page_init_size = (dblock->npages + 7) / 8; - HDassert(dblock->dblk_page_init_size > 0); + dblock->dblk_page_init_size = (dblock->npages + 7) / 8; + HDassert(dblock->dblk_page_init_size > 0); - /* Allocate space for 'page init' flags */ - if(NULL == (dblock->dblk_page_init = H5FL_BLK_CALLOC(fa_page_init, dblock->dblk_page_init_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for page init bitmask") + /* Allocate space for 'page init' flags */ + if(NULL == (dblock->dblk_page_init = H5FL_BLK_CALLOC(fa_page_init, dblock->dblk_page_init_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for page init bitmask") - /* Compute data block page size */ - dblock->dblk_page_size = (dblock->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5FA_SIZEOF_CHKSUM; + /* Compute data block page size */ + dblock->dblk_page_size = (dblock->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5FA_SIZEOF_CHKSUM; /* Compute the # of elements on last page */ if(0 == hdr->cparam.nelmts % dblock->dblk_page_nelmts) @@ -156,8 +156,8 @@ H5FA__dblock_alloc(H5FA_hdr_t *hdr)) /* Allocate buffer for elements in data block */ H5_CHECK_OVERFLOW(dblk_size, /* From: */hsize_t, /* To: */size_t); - if(NULL == (dblock->elmts = H5FL_BLK_MALLOC(chunk_elmts, (size_t)dblk_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer") + if(NULL == (dblock->elmts = H5FL_BLK_MALLOC(chunk_elmts, (size_t)dblk_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer") } /* end else */ /* Set the return value */ @@ -173,13 +173,13 @@ END_FUNC(PKG) /* end H5FA__dblock_alloc() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblock_create + * Function: H5FA__dblock_create * - * Purpose: Creates a fixed array data block in the file + * Purpose: Creates a fixed array data block in the file * - * Return: Valid file address on success/HADDR_UNDEF on failure + * Return: Valid file address on success/HADDR_UNDEF on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -202,7 +202,7 @@ HDfprintf(stderr, "%s: Called, hdr->stats.nelmts = %Zu, nelmts = %Zu\n", FUNC, h /* Allocate the data block */ if(NULL == (dblock = H5FA__dblock_alloc(hdr))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") /* Set size of data block on disk */ hdr->stats.dblk_size = dblock->size = H5FA_DBLOCK_SIZE(dblock); @@ -213,7 +213,7 @@ HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size); /* Allocate space for the data block on disk */ if(HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FARRAY_DBLOCK, dxpl_id, (hsize_t)dblock->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for fixed array data block") + H5E_THROW(H5E_CANTALLOC, "file allocation failed for fixed array data block") dblock->addr = dblock_addr; /* Don't initialize elements if paged */ @@ -224,7 +224,7 @@ HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size); /* Cache the new fixed array data block */ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_FARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block to cache") + H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block to cache") /* Mark the header dirty (for updating statistics) */ *hdr_dirty = TRUE; @@ -249,13 +249,13 @@ END_FUNC(PKG) /* end H5FA__dblock_create() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblock_protect + * Function: H5FA__dblock_protect * - * Purpose: Convenience wrapper around protecting fixed array data block + * Purpose: Convenience wrapper around protecting fixed array data block * - * Return: Non-NULL pointer to data block on success/NULL on failure + * Return: Non-NULL pointer to data block on success/NULL on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -293,13 +293,13 @@ END_FUNC(PKG) /* end H5FA__dblock_protect() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblock_unprotect + * Function: H5FA__dblock_unprotect * - * Purpose: Convenience wrapper around unprotecting fixed array data block + * Purpose: Convenience wrapper around unprotecting fixed array data block * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -327,13 +327,13 @@ END_FUNC(PKG) /* end H5FA__dblock_unprotect() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblock_delete + * Function: H5FA__dblock_delete * - * Purpose: Delete a data block + * Purpose: Delete a data block * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -393,13 +393,13 @@ END_FUNC(PKG) /* end H5FA__dblock_delete() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblock_dest + * Function: H5FA__dblock_dest * - * Purpose: Destroys a fixed array data block in memory. + * Purpose: Destroys a fixed array data block in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -417,16 +417,16 @@ H5FA__dblock_dest(H5FA_dblock_t *dblock)) if(dblock->elmts && !dblock->npages) { /* Free buffer for data block elements */ HDassert(dblock->hdr->cparam.nelmts > 0); - dblock->elmts = H5FL_BLK_FREE(chunk_elmts, dblock->elmts); + dblock->elmts = H5FL_BLK_FREE(chunk_elmts, dblock->elmts); } /* end if */ /* Check if data block is paged */ - if(dblock->npages) { - /* Free buffer for 'page init' bitmask, if there is one */ - HDassert(dblock->dblk_page_init_size > 0); - if(dblock->dblk_page_init) - dblock->dblk_page_init = H5FL_BLK_FREE(fa_page_init, dblock->dblk_page_init); - } /* end if */ + if(dblock->npages) { + /* Free buffer for 'page init' bitmask, if there is one */ + HDassert(dblock->dblk_page_init_size > 0); + if(dblock->dblk_page_init) + dblock->dblk_page_init = H5FL_BLK_FREE(fa_page_init, dblock->dblk_page_init); + } /* end if */ /* Decrement reference count on shared info */ if(H5FA__hdr_decr(dblock->hdr) < 0) diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 49d22f3..62b1837 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -15,9 +15,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FAhdr.c + * Created: H5FAhdr.c * - * Purpose: Array header routines for Fixed Array. + * Purpose: Array header routines for Fixed Array. * *------------------------------------------------------------------------- */ @@ -37,10 +37,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FApkg.h" /* Fixed Arrays */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5MFprivate.h" /* File memory management */ /****************/ @@ -82,13 +82,13 @@ H5FL_DEFINE_STATIC(H5FA_hdr_t); /*------------------------------------------------------------------------- - * Function: H5FA__hdr_alloc + * Function: H5FA__hdr_alloc * - * Purpose: Allocate shared Fixed Array header + * Purpose: Allocate shared Fixed Array header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -105,7 +105,7 @@ H5FA__hdr_alloc(H5F_t *f)) /* Allocate space for the shared information */ if(NULL == (hdr = H5FL_CALLOC(H5FA_hdr_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header") /* Set non-zero internal fields */ hdr->addr = HADDR_UNDEF; @@ -127,13 +127,13 @@ END_FUNC(PKG) /* end H5FA__hdr_alloc() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_init + * Function: H5FA__hdr_init * - * Purpose: Initialize shared fixed array header + * Purpose: Initialize shared fixed array header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, November 15, 2009 * *------------------------------------------------------------------------- @@ -165,13 +165,13 @@ END_FUNC(PKG) /* end H5FA__hdr_init() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_create + * Function: H5FA__hdr_create * - * Purpose: Creates a new Fixed Array header in the file + * Purpose: Creates a new Fixed Array header in the file * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -196,17 +196,17 @@ HDfprintf(stderr, "%s: Called\n", FUNC); { /* Check for valid parameters */ if(cparam->raw_elmt_size == 0) - H5E_THROW(H5E_BADVALUE, "element size must be greater than zero") + H5E_THROW(H5E_BADVALUE, "element size must be greater than zero") if(cparam->max_dblk_page_nelmts_bits == 0) - H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero") + H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero") if(cparam->nelmts == 0) - H5E_THROW(H5E_BADVALUE, "# of elements must be greater than zero") + H5E_THROW(H5E_BADVALUE, "# of elements must be greater than zero") } #endif /* NDEBUG */ /* Allocate space for the shared information */ if(NULL == (hdr = H5FA__hdr_alloc(f))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header") hdr->dblk_addr = HADDR_UNDEF; @@ -215,15 +215,15 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Finish initializing fixed array header */ if(H5FA__hdr_init(hdr, ctx_udata) < 0) - H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header") + H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header") /* Allocate space for the header on disk */ if(HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_FARRAY_HDR, dxpl_id, (hsize_t)hdr->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for Fixed Array header") + H5E_THROW(H5E_CANTALLOC, "file allocation failed for Fixed Array header") /* Cache the new Fixed Array header */ if(H5AC_insert_entry(f, dxpl_id, H5AC_FARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add fixed array header to cache") + H5E_THROW(H5E_CANTINSERT, "can't add fixed array header to cache") /* Set address of array header to return */ ret_value = hdr->addr; @@ -244,13 +244,13 @@ END_FUNC(PKG) /* end H5FA__hdr_create() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_incr + * Function: H5FA__hdr_incr * - * Purpose: Increment component reference count on shared array header + * Purpose: Increment component reference count on shared array header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -276,13 +276,13 @@ END_FUNC(PKG) /* end H5FA__hdr_incr() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_decr + * Function: H5FA__hdr_decr * - * Purpose: Decrement component reference count on shared array header + * Purpose: Decrement component reference count on shared array header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -311,13 +311,13 @@ END_FUNC(PKG) /* end H5FA__hdr_decr() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_fuse_incr + * Function: H5FA__hdr_fuse_incr * - * Purpose: Increment file reference count on shared array header + * Purpose: Increment file reference count on shared array header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -336,13 +336,13 @@ END_FUNC(PKG) /* end H5FA__hdr_fuse_incr() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_fuse_decr + * Function: H5FA__hdr_fuse_decr * - * Purpose: Decrement file reference count on shared array header + * Purpose: Decrement file reference count on shared array header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -365,13 +365,13 @@ END_FUNC(PKG) /* end H5FA__hdr_fuse_decr() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_modified + * Function: H5FA__hdr_modified * - * Purpose: Mark a fixed array as modified + * Purpose: Mark a fixed array as modified * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -468,11 +468,11 @@ END_FUNC(PKG) /* end H5EA__hdr_unprotect() */ /*------------------------------------------------------------------------- * Function: H5FA__hdr_delete * - * Purpose: Delete a fixed array, starting with the header + * Purpose: Delete a fixed array, starting with the header * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -526,13 +526,13 @@ END_FUNC(PKG) /* end H5FA__hdr_delete() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_dest + * Function: H5FA__hdr_dest * - * Purpose: Destroys a fixed array header in memory. + * Purpose: Destroys a fixed array header in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- diff --git a/src/H5FApkg.h b/src/H5FApkg.h index ddf3a07..c29322a 100644 --- a/src/H5FApkg.h +++ b/src/H5FApkg.h @@ -16,9 +16,9 @@ /* * Programmer: * - * Purpose: This file contains declarations which are visible only within - * the H5FA package. Source files outside the H5FA package should - * include H5FAprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5FA package. Source files outside the H5FA package should + * include H5FAprivate.h instead. */ #if !(defined(H5FA_FRIEND) | defined(H5FA_MODULE)) #error "Do not include this file outside the H5FA package!" @@ -31,8 +31,8 @@ #include "H5FAprivate.h" /* Other private headers needed by this file */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5FLprivate.h" /* Free Lists */ /**************************/ @@ -52,11 +52,11 @@ #define H5FA_SIZEOF_CHKSUM 4 /* "Standard" size of prefix information for fixed array metadata */ -#define H5FA_METADATA_PREFIX_SIZE(c) ( \ - H5_SIZEOF_MAGIC /* Signature */ \ - + 1 /* Version */ \ - + 1 /* Array type */ \ - + ((c) ? H5FA_SIZEOF_CHKSUM : 0) /* Metadata checksum */ \ +#define H5FA_METADATA_PREFIX_SIZE(c) ( \ + H5_SIZEOF_MAGIC /* Signature */ \ + + 1 /* Version */ \ + + 1 /* Array type */ \ + + ((c) ? H5FA_SIZEOF_CHKSUM : 0) /* Metadata checksum */ \ ) /* Size of the Fixed Array header on disk */ @@ -86,25 +86,25 @@ ) /* Size of the Fixed Array data block prefix on disk */ -#define H5FA_DBLOCK_PREFIX_SIZE(d) ( \ - /* General metadata fields */ \ - H5FA_METADATA_PREFIX_SIZE(TRUE) \ - \ - /* Sanity-checking fields */ \ - + (d)->hdr->sizeof_addr /* File address of Fixed Array header owning the data block */ \ - \ - /* Fixed Array Data Block specific fields */ \ +#define H5FA_DBLOCK_PREFIX_SIZE(d) ( \ + /* General metadata fields */ \ + H5FA_METADATA_PREFIX_SIZE(TRUE) \ + \ + /* Sanity-checking fields */ \ + + (d)->hdr->sizeof_addr /* File address of Fixed Array header owning the data block */ \ + \ + /* Fixed Array Data Block specific fields */ \ + (d)->dblk_page_init_size /* Fixed array data block 'page init' bitmasks (can be 0 if no pages) */ \ ) /* Size of the Fixed Array data block on disk */ -#define H5FA_DBLOCK_SIZE(d) ( \ - /* Data block prefix size */ \ - H5FA_DBLOCK_PREFIX_SIZE(d) \ - \ - /* Fixed Array Elements|Pages of Elements*/ \ - + ((d)->hdr->cparam.nelmts * (size_t)(d)->hdr->cparam.raw_elmt_size) \ - + ((d)->npages * H5FA_SIZEOF_CHKSUM) /* Checksum */ \ +#define H5FA_DBLOCK_SIZE(d) ( \ + /* Data block prefix size */ \ + H5FA_DBLOCK_PREFIX_SIZE(d) \ + \ + /* Fixed Array Elements|Pages of Elements*/ \ + + ((d)->hdr->cparam.nelmts * (size_t)(d)->hdr->cparam.raw_elmt_size) \ + + ((d)->npages * H5FA_SIZEOF_CHKSUM) /* Checksum */ \ ) /* Size of the Fixed Array data block page on disk */ @@ -127,20 +127,20 @@ typedef struct H5FA_hdr_t { H5FA_create_t cparam; /* Creation parameters for Fixed Array */ /* Fixed Array data block information (stored in header) */ - haddr_t dblk_addr; /* Address of Fixed Array Data block */ + haddr_t dblk_addr; /* Address of Fixed Array Data block */ /* Statistics for Fixed Array (stored in header) */ H5FA_stat_t stats; /* Statistcs for Fixed Array */ /* Computed/cached values (not stored in header) */ - size_t rc; /* Reference count of the header */ - haddr_t addr; /* Address of header in file */ - size_t size; /* Size of header in file */ - H5F_t *f; /* Pointer to file for fixed array */ - size_t file_rc; /* Reference count of files using array header */ - hbool_t pending_delete; /* Array is pending deletion */ - size_t sizeof_addr; /* Size of file addresses */ - size_t sizeof_size; /* Size of file sizes */ + size_t rc; /* Reference count of the header */ + haddr_t addr; /* Address of header in file */ + size_t size; /* Size of header in file */ + H5F_t *f; /* Pointer to file for fixed array */ + size_t file_rc; /* Reference count of files using array header */ + hbool_t pending_delete; /* Array is pending deletion */ + size_t sizeof_addr; /* Size of file addresses */ + size_t sizeof_size; /* Size of file sizes */ /* Client information (not stored) */ void *cb_ctx; /* Callback context */ @@ -152,22 +152,22 @@ typedef struct H5FA_dblock_t { H5AC_info_t cache_info; /* Fixed array information (stored) */ - uint8_t *dblk_page_init;/* Bitmap of whether a data block page is initialized */ - void *elmts; /* Buffer for elements stored in data block */ + uint8_t *dblk_page_init;/* Bitmap of whether a data block page is initialized */ + void *elmts; /* Buffer for elements stored in data block */ /* Internal array information (not stored) */ - H5FA_hdr_t *hdr; /* Shared array header info */ + H5FA_hdr_t *hdr; /* Shared array header info */ /* Computed/cached values (not stored) */ - haddr_t addr; /* Address of this data block on disk */ - hsize_t size; /* Size of data block on disk */ - size_t npages; /* Nummber of pages in data block (zero if not paged) */ - size_t last_page_nelmts; /* Nummber of elements in last page, if paged */ + haddr_t addr; /* Address of this data block on disk */ + hsize_t size; /* Size of data block on disk */ + size_t npages; /* Nummber of pages in data block (zero if not paged) */ + size_t last_page_nelmts; /* Nummber of elements in last page, if paged */ /* Fixed Array data block information (not stored) */ - size_t dblk_page_nelmts; /* # of elements per data block page */ - size_t dblk_page_size; /* Size of a data block page */ - size_t dblk_page_init_size; /* Size of 'page init' bitmask */ + size_t dblk_page_nelmts; /* # of elements per data block page */ + size_t dblk_page_size; /* Size of a data block page */ + size_t dblk_page_init_size; /* Size of 'page init' bitmask */ } H5FA_dblock_t; /* The fixed array data block page information */ @@ -179,18 +179,18 @@ typedef struct H5FA_dbk_page_t { void *elmts; /* Buffer for elements stored in data block page */ /* Internal array information (not stored) */ - H5FA_hdr_t *hdr; /* Shared array header info */ + H5FA_hdr_t *hdr; /* Shared array header info */ /* Computed/cached values (not stored) */ - haddr_t addr; /* Address of this data block page on disk */ - size_t size; /* Size of data block page on disk */ - size_t nelmts; /* Number of elements in data block page */ + haddr_t addr; /* Address of this data block page on disk */ + size_t size; /* Size of data block page on disk */ + size_t nelmts; /* Number of elements in data block page */ } H5FA_dblk_page_t; /* Fixed array */ struct H5FA_t { - H5FA_hdr_t *hdr; /* Pointer to internal fixed array header info */ - H5F_t *f; /* Pointer to file for fixed array */ + H5FA_hdr_t *hdr; /* Pointer to internal fixed array header info */ + H5F_t *f; /* Pointer to file for fixed array */ }; @@ -205,14 +205,14 @@ typedef struct H5FA_hdr_cache_ud_t { /* Info needed for loading data block */ typedef struct H5FA_dblock_cache_ud_t { - H5FA_hdr_t *hdr; /* Shared fixed array information */ - haddr_t dblk_addr; /* Address of data block on disk */ + H5FA_hdr_t *hdr; /* Shared fixed array information */ + haddr_t dblk_addr; /* Address of data block on disk */ } H5FA_dblock_cache_ud_t; /* Info needed for loading data block page */ typedef struct H5FA_dblk_page_cache_ud_t { - H5FA_hdr_t *hdr; /* Shared fixed array information */ - size_t nelmts; /* Number of elements in data block page */ + H5FA_hdr_t *hdr; /* Shared fixed array information */ + size_t nelmts; /* Number of elements in data block page */ haddr_t dblk_page_addr; /* Address of data block page on disk */ } H5FA_dblk_page_cache_ud_t; @@ -234,7 +234,7 @@ H5_DLLVAR const H5AC_class_t H5AC_FARRAY_DBLK_PAGE[1]; H5_DLLVAR const H5FA_class_t H5FA_CLS_TEST[1]; /* Array of fixed array client ID -> client class mappings */ -extern const H5FA_class_t *const H5FA_client_class_g[H5FA_NUM_CLS_ID]; +H5_DLLVAR const H5FA_class_t *const H5FA_client_class_g[H5FA_NUM_CLS_ID]; /******************************/ diff --git a/src/H5FAprivate.h b/src/H5FAprivate.h index 71a68c0..aa88003 100644 --- a/src/H5FAprivate.h +++ b/src/H5FAprivate.h @@ -15,9 +15,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FAprivate.h + * Created: H5FAprivate.h * - * Purpose: Private header for library accessible Fixed + * Purpose: Private header for library accessible Fixed * Array routines. * *------------------------------------------------------------------------- @@ -48,8 +48,8 @@ typedef enum H5FA_cls_id_t { /* Start real class IDs at 0 -QAK */ /* (keep these last) */ - H5FA_CLS_TEST_ID, /* Fixed array is for testing (do not use for actual data) */ - H5FA_NUM_CLS_ID /* Number of Fixed Array class IDs (must be last) */ + H5FA_CLS_TEST_ID, /* Fixed array is for testing (do not use for actual data) */ + H5FA_NUM_CLS_ID /* Number of Fixed Array class IDs (must be last) */ } H5FA_cls_id_t; /* @@ -57,9 +57,9 @@ typedef enum H5FA_cls_id_t { * variable of this type that contains class variables and methods. */ typedef struct H5FA_class_t { - H5FA_cls_id_t id; /* ID of Fixed Array class, as found in file */ - const char *name; /* Name of class (for debugging) */ - size_t nat_elmt_size; /* Size of native (memory) element */ + H5FA_cls_id_t id; /* ID of Fixed Array class, as found in file */ + const char *name; /* Name of class (for debugging) */ + size_t nat_elmt_size; /* Size of native (memory) element */ /* Fixed array client callback methods */ void *(*crt_context)(void *udata); /* Create context for other callbacks */ @@ -74,22 +74,23 @@ typedef struct H5FA_class_t { /* Fixed array creation parameters */ typedef struct H5FA_create_t { - const H5FA_class_t *cls; /* Class of Fixed Array to create */ - uint8_t raw_elmt_size; /* Element size in file (in bytes) */ + const H5FA_class_t *cls; /* Class of Fixed Array to create */ + uint8_t raw_elmt_size; /* Element size in file (in bytes) */ uint8_t max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in a data block page) - - i.e. # of bits needed to store max. # of elements - in a data block page */ - hsize_t nelmts; /* # of elements in array */ + * i.e. # of bits needed to store max. # of elements + * in a data block page + */ + hsize_t nelmts; /* # of elements in array */ } H5FA_create_t; /* Fixed array metadata statistics info */ typedef struct H5FA_stat_t { /* Non-stored (i.e. computed) fields */ - hsize_t hdr_size; /* Size of header */ - hsize_t dblk_size; /* Size of data block */ + hsize_t hdr_size; /* Size of header */ + hsize_t dblk_size; /* Size of data block */ /* Stored fields */ - hsize_t nelmts; /* # of elements */ + hsize_t nelmts; /* # of elements */ } H5FA_stat_t; /* Fixed Array info (forward decl - defined in H5FApkg.h) */ @@ -111,14 +112,14 @@ typedef int (*H5FA_operator_t)(hsize_t idx, const void *_elmt, void *_udata); /* General routines */ H5_DLL H5FA_t *H5FA_create(H5F_t *f, hid_t dxpl_id, const H5FA_create_t *cparam, void *ctx_udata); -H5_DLL H5FA_t *H5FA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata); -H5_DLL herr_t H5FA_get_nelmts(const H5FA_t *ea, hsize_t *nelmts); -H5_DLL herr_t H5FA_get_addr(const H5FA_t *ea, haddr_t *addr); -H5_DLL herr_t H5FA_set(const H5FA_t *ea, hid_t dxpl_id, hsize_t idx, const void *elmt); -H5_DLL herr_t H5FA_get(const H5FA_t *ea, hid_t dxpl_id, hsize_t idx, void *elmt); +H5_DLL H5FA_t *H5FA_open(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, void *ctx_udata); +H5_DLL herr_t H5FA_get_nelmts(const H5FA_t *fa, hsize_t *nelmts); +H5_DLL herr_t H5FA_get_addr(const H5FA_t *fa, haddr_t *addr); +H5_DLL herr_t H5FA_set(const H5FA_t *fa, hid_t dxpl_id, hsize_t idx, const void *elmt); +H5_DLL herr_t H5FA_get(const H5FA_t *fa, hid_t dxpl_id, hsize_t idx, void *elmt); H5_DLL herr_t H5FA_iterate(H5FA_t *fa, hid_t dxpl_id, H5FA_operator_t op, void *udata); -H5_DLL herr_t H5FA_close(H5FA_t *ea, hid_t dxpl_id); -H5_DLL herr_t H5FA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata); +H5_DLL herr_t H5FA_close(H5FA_t *fa, hid_t dxpl_id); +H5_DLL herr_t H5FA_delete(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, void *ctx_udata); /* Statistics routines */ H5_DLL herr_t H5FA_get_stats(const H5FA_t *ea, H5FA_stat_t *stats); diff --git a/src/H5FAstat.c b/src/H5FAstat.c index 4ded4c1..72fa0de 100644 --- a/src/H5FAstat.c +++ b/src/H5FAstat.c @@ -15,9 +15,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FAstat.c + * Created: H5FAstat.c * - * Purpose: Fixed array metadata statistics functions. + * Purpose: Fixed array metadata statistics functions. * *------------------------------------------------------------------------- */ @@ -37,9 +37,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FApkg.h" /* Fixed Arrays */ /****************/ @@ -79,13 +79,13 @@ /*------------------------------------------------------------------------- - * Function: H5FA_get_stats + * Function: H5FA_get_stats * - * Purpose: Query the metadata stats of an array + * Purpose: Query the metadata stats of an array * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- diff --git a/src/H5FAtest.c b/src/H5FAtest.c index 528f550..091f284 100644 --- a/src/H5FAtest.c +++ b/src/H5FAtest.c @@ -14,9 +14,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: - * - * Purpose: Fixed array testing functions. + * Purpose: Fixed array testing functions. * */ @@ -119,14 +117,14 @@ H5FL_DEFINE_STATIC(H5FA__test_ctx_t); /*------------------------------------------------------------------------- - * Function: H5FA__test_crt_context + * Function: H5FA__test_crt_context * - * Purpose: Create context for callbacks + * Purpose: Create context for callbacks * - * Return: Success: non-NULL - * Failure: NULL + * Return: Success: non-NULL + * Failure: NULL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -140,7 +138,7 @@ H5FA__test_crt_context(void H5_ATTR_UNUSED *udata)) /* Allocate new context structure */ if(NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t))) - H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context") + H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context") /* Initialize the context */ ctx->bogus = H5FA__TEST_BOGUS_VAL; @@ -154,14 +152,13 @@ END_FUNC(STATIC) /* end H5FA__test_crt_context() */ /*------------------------------------------------------------------------- - * Function: H5FA__test_dst_context + * Function: H5FA__test_dst_context * - * Purpose: Destroy context for callbacks + * Purpose: Destroy context for callbacks * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -183,14 +180,13 @@ END_FUNC(STATIC) /* end H5FA__test_dst_context() */ /*------------------------------------------------------------------------- - * Function: H5FA__test_fill + * Function: H5FA__test_fill * - * Purpose: Fill "missing elements" in block of elements + * Purpose: Fill "missing elements" in block of elements * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -212,14 +208,13 @@ END_FUNC(STATIC) /* end H5FA__test_fill() */ /*------------------------------------------------------------------------- - * Function: H5FA__test_encode + * Function: H5FA__test_encode * - * Purpose: Encode an element from "native" to "raw" form + * Purpose: Encode an element from "native" to "raw" form * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -257,14 +252,13 @@ END_FUNC(STATIC) /* end H5FA__test_encode() */ /*------------------------------------------------------------------------- - * Function: H5FA__test_decode + * Function: H5FA__test_decode * - * Purpose: Decode an element from "raw" to "native" form + * Purpose: Decode an element from "raw" to "native" form * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -303,14 +297,13 @@ END_FUNC(STATIC) /* end H5FA__test_decode() */ /*------------------------------------------------------------------------- - * Function: H5FA__test_debug + * Function: H5FA__test_debug * - * Purpose: Display an element for debugging + * Purpose: Display an element for debugging * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -336,14 +329,14 @@ END_FUNC(STATIC) /* end H5FA__test_debug() */ /*------------------------------------------------------------------------- - * Function: H5FA__test_crt_dbg_context + * Function: H5FA__test_crt_dbg_context * - * Purpose: Create context for debugging callback + * Purpose: Create context for debugging callback * - * Return: Success: non-NULL - * Failure: NULL + * Return: Success: non-NULL + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, December 1, 2009 * *------------------------------------------------------------------------- @@ -357,7 +350,7 @@ H5FA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id /* Allocate new context structure */ if(NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t))) - H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context") + H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context") /* Initialize the context */ ctx->bogus = H5FA__TEST_BOGUS_VAL; @@ -371,14 +364,13 @@ END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */ /*------------------------------------------------------------------------- - * Function: H5FA_get_cparam_test + * Function: H5FA_get_cparam_test * - * Purpose: Retrieve the parameters used to create the fixed array + * Purpose: Retrieve the parameters used to create the fixed array * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -399,14 +391,13 @@ END_FUNC(PRIV) /* end H5FA_get_cparam_test() */ /*------------------------------------------------------------------------- - * Function: H5FA_cmp_cparam_test + * Function: H5FA_cmp_cparam_test * - * Purpose: Compare the parameters used to create the fixed array + * Purpose: Compare the parameters used to create the fixed array * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -1733,6 +1733,131 @@ done: /*------------------------------------------------------------------------- + * Function: H5FDlock + * + * Purpose: Set a file lock + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi; March 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FDlock(H5FD_t *file, hbool_t rw) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "*xb", file, rw); + + /* Check args */ + if(!file || !file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + + /* The real work */ + if(H5FD_lock(file, rw) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file lock request failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5FDlock() */ + + + +/*------------------------------------------------------------------------- + * Function: H5FD_lock + * + * Purpose: Private version of H5FDlock() + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi; May 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FD_lock(H5FD_t *file, hbool_t rw) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(file && file->cls); + + if(file->cls->lock && (file->cls->lock)(file, rw) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver lock request failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_lock() */ + + +/*------------------------------------------------------------------------- + * Function: H5FDunlock + * + * Purpose: Remove a file lock + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi; March 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FDunlock(H5FD_t *file) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "*x", file); + + /* Check args */ + if(!file || !file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + + /* The real work */ + if(H5FD_unlock(file) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file unlock request failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5FDunlock() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_unlock + * + * Purpose: Private version of H5FDunlock() + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi; May 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FD_unlock(H5FD_t *file) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(file && file->cls); + + if(file->cls->unlock && (file->cls->unlock)(file) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver unlock request failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_unlock() */ + + +/*------------------------------------------------------------------------- * Function: H5FD_get_fileno * * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 17ec07c..f4aa240 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -141,6 +141,8 @@ static herr_t H5FD__core_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, ha size_t size, const void *buf); static herr_t H5FD__core_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); static herr_t H5FD__core_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD_core_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD_core_unlock(H5FD_t *_file); static const H5FD_class_t H5FD_core_g = { "core", /* name */ @@ -172,8 +174,8 @@ static const H5FD_class_t H5FD_core_g = { H5FD__core_write, /* write */ H5FD__core_flush, /* flush */ H5FD__core_truncate, /* truncate */ - NULL, /* lock */ - NULL, /* unlock */ + H5FD_core_lock, /* lock */ + H5FD_core_unlock, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -1016,12 +1018,12 @@ H5FD__core_query(const H5FD_t * _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_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */ - *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ - *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ - *flags |= H5FD_FEAT_ALLOW_FILE_IMAGE; /* OK to use file image feature with this VFD */ - *flags |= H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS; /* OK to use file image callbacks with this VFD */ + *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ + *flags |= H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */ + *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ + *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ + *flags |= H5FD_FEAT_ALLOW_FILE_IMAGE; /* OK to use file image feature with this VFD */ + *flags |= H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS; /* OK to use file image callbacks with this VFD */ /* If the backing store is open, a POSIX file handle is available */ if(file && file->fd >= 0 && file->backing_store) @@ -1520,3 +1522,75 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__core_truncate() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_core_lock + * + * Purpose: To place an advisory lock on a file. + * The lock type to apply depends on the parameter "rw": + * TRUE--opens for write: an exclusive lock + * FALSE--opens for read: a shared lock + * + * Return: SUCCEED/FAIL + * + * Programmer: Vailin Choi; May 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_core_lock(H5FD_t *_file, hbool_t rw) +{ + H5FD_core_t *file = (H5FD_core_t*)_file; /* VFD file struct */ + int lock; /* The type of lock */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(file); + if(file->fd >= 0) { + + /* Determine the type of lock */ + lock = rw ? LOCK_EX : LOCK_SH; + + /* Place the lock with non-blocking */ + if(HDflock(file->fd, lock | LOCK_NB) < 0) + HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to flock file") + } + /* Otherwise a noop */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_core_lock() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_core_unlock + * + * Purpose: To remove the existing lock on the file + * + * Return: SUCCEED/FAIL + * + * Programmer: Vailin Choi; May 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_core_unlock(H5FD_t *_file) +{ + H5FD_core_t *file = (H5FD_core_t*)_file; /* VFD file struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(file); + + if(file->fd >= 0) { + + if(HDflock(file->fd, LOCK_UN) < 0) + HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to flock (unlock) file") + } + /* Otherwise a noop */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_core_unlock() */ diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index de64923..f88fb1e 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -93,6 +93,7 @@ typedef struct H5FD_direct_t { DWORD fileindexlo; DWORD fileindexhi; #endif + } H5FD_direct_t; /* @@ -136,6 +137,9 @@ static herr_t H5FD_direct_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, ha static herr_t H5FD_direct_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); static herr_t H5FD_direct_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD_direct_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD_direct_unlock(H5FD_t *_file); + static const H5FD_class_t H5FD_direct_g = { "direct", /*name */ @@ -166,10 +170,10 @@ static const H5FD_class_t H5FD_direct_g = { H5FD_direct_read, /*read */ H5FD_direct_write, /*write */ NULL, /*flush */ - H5FD_direct_truncate, /*truncate */ - NULL, /*lock */ - NULL, /*unlock */ - H5FD_FLMAP_DICHOTOMY /*fl_map */ + H5FD_direct_truncate, /*truncate */ + H5FD_direct_lock, /*lock */ + H5FD_direct_unlock, /*unlock */ + H5FD_FLMAP_DICHOTOMY /*fl_map */ }; /* Declare a free list to manage the H5FD_direct_t struct */ @@ -689,10 +693,10 @@ H5FD_direct_query(const H5FD_t H5_ATTR_UNUSED * _f, 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_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */ - *flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ - *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ + *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ + *flags |= H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */ + *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ + *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ } FUNC_LEAVE_NOAPI(SUCCEED) @@ -1307,5 +1311,72 @@ H5FD_direct_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATT done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_direct_truncate() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_direct_lock + * + * Purpose: To place an advisory lock on a file. + * The lock type to apply depends on the parameter "rw": + * TRUE--opens for write: an exclusive lock + * FALSE--opens for read: a shared lock + * + * Return: SUCCEED/FAIL + * + * Programmer: Vailin Choi; May 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_direct_lock(H5FD_t *_file, hbool_t rw) +{ + H5FD_direct_t *file = (H5FD_direct_t*)_file; /* VFD file struct */ + int lock; /* The type of lock */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(file); + + /* Determine the type of lock */ + int lock = rw ? LOCK_EX : LOCK_SH; + + /* Place the lock with non-blocking */ + if(HDflock(file->fd, lock | LOCK_NB) < 0) + HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to flock file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_direct_lock() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_direct_unlock + * + * Purpose: To remove the existing lock on the file + * + * Return: SUCCEED/FAIL + * + * Programmer: Vailin Choi; May 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_direct_unlock(H5FD_t *_file) +{ + H5FD_direct_t *file = (H5FD_direct_t*)_file; /* VFD file struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(file); + + if(HDflock(file->fd, LOCK_UN) < 0) + HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to flock (unlock) file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_direct_unlock() */ + #endif /* H5_HAVE_DIRECT */ diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 7a35612..310b72f 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -106,6 +106,8 @@ static herr_t H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, h size_t size, const void *_buf); static herr_t H5FD_family_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); static herr_t H5FD_family_truncate(H5FD_t *_file, hid_t dxpl_id, unsigned closing); +static herr_t H5FD_family_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD_family_unlock(H5FD_t *_file); /* The class struct */ static const H5FD_class_t H5FD_family_g = { @@ -138,8 +140,8 @@ static const H5FD_class_t H5FD_family_g = { H5FD_family_write, /*write */ H5FD_family_flush, /*flush */ H5FD_family_truncate, /*truncate */ - NULL, /*lock */ - NULL, /*unlock */ + H5FD_family_lock, /*lock */ + H5FD_family_unlock, /*unlock */ H5FD_FLMAP_DICHOTOMY /*fl_map */ }; @@ -1302,3 +1304,79 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_family_truncate() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_family_lock + * + * Purpose: To place an advisory lock on a file. + * The lock type to apply depends on the parameter "rw": + * TRUE--opens for write: an exclusive lock + * FALSE--opens for read: a shared lock + * + * Return: SUCCEED/FAIL + * + * Programmer: Vailin Choi; May 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_family_lock(H5FD_t *_file, hbool_t rw) +{ + H5FD_family_t *file = (H5FD_family_t *)_file; /* VFD file struct */ + unsigned u, i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Place the lock on all the member files */ + for(u = 0; u < file->nmembs; u++) { + if(file->memb[u]) { + if(H5FD_lock(file->memb[u], rw) < 0) + break; + } /* end if */ + } /* end for */ + + if(u < file->nmembs) { /* Try to unlock the member files done before */ + for(i = 0; i < u; i++) { + if(H5FD_unlock(file->memb[i]) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_IO, H5E_CANTUNLOCK, FAIL, "unable to unlock member files") + } + HGOTO_ERROR(H5E_IO, H5E_CANTLOCK, FAIL, "unable to lock member files") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_family_lock() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_family_unlock + * + * Purpose: To remove the existing lock on the file + * + * Return: SUCCEED/FAIL + * + * Programmer: Vailin Choi; May 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_family_unlock(H5FD_t *_file) +{ + H5FD_family_t *file = (H5FD_family_t *)_file; /* VFD file struct */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Remove the lock on the member files */ + for(u = 0; u < file->nmembs; u++) { + if(file->memb[u]) { + if(H5FD_unlock(file->memb[u]) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTUNLOCK, FAIL, "unable to unlock member files") + } /* end if */ + } /* end for */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_family_unlock() */ diff --git a/src/H5FDlog.c b/src/H5FDlog.c index eb2c0e3..a8228e0 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -179,6 +179,8 @@ static herr_t H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr static herr_t H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); static herr_t H5FD_log_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD_log_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD_log_unlock(H5FD_t *_file); static const H5FD_class_t H5FD_log_g = { "log", /*name */ @@ -210,8 +212,8 @@ static const H5FD_class_t H5FD_log_g = { H5FD_log_write, /*write */ NULL, /*flush */ H5FD_log_truncate, /*truncate */ - NULL, /*lock */ - NULL, /*unlock */ + H5FD_log_lock, /*lock */ + H5FD_log_unlock, /*unlock */ H5FD_FLMAP_DICHOTOMY /*fl_map */ }; @@ -888,11 +890,11 @@ H5FD_log_query(const H5FD_t *_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_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */ - *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ - *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ - *flags |= H5FD_FEAT_POSIX_COMPAT_HANDLE; /* VFD handle is POSIX I/O call compatible */ + *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ + *flags |= H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */ + *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ + *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ + *flags |= H5FD_FEAT_POSIX_COMPAT_HANDLE; /* VFD handle is POSIX I/O call compatible */ /* Check for flags that are set by h5repart */ if(file && file->fam_to_sec2) @@ -1556,3 +1558,68 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_log_truncate() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_log_lock + * + * Purpose: Place a lock on the file + * + * Return: Success: SUCCEED + * Failure: FAIL, file not locked. + * + * Programmer: Vailin Choi; May 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_log_lock(H5FD_t *_file, hbool_t rw) +{ + H5FD_log_t *file = (H5FD_log_t *)_file; + int lock; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity check */ + HDassert(file); + + /* Determine the type of lock */ + lock = rw ? LOCK_EX : LOCK_SH; + + /* Place the lock with non-blocking */ + if(HDflock(file->fd, lock | LOCK_NB) < 0) + HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to flock file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_log_lock() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_log_unlock + * + * Purpose: Remove the existing lock on the file + * + * Return: SUCCEED/FAIL + * + * Programmer: Vailin Choi; May 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_log_unlock(H5FD_t *_file) +{ + H5FD_log_t *file = (H5FD_log_t *)_file; /* VFD file struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(file); + + if(HDflock(file->fd, LOCK_UN) < 0) + HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to flock (unlock) file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_log_unlock() */ + diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index bc61374..181ad39 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -46,14 +46,14 @@ /* Loop through all mapped files */ #define UNIQUE_MEMBERS(MAP,LOOPVAR) { \ H5FD_mem_t _unmapped, LOOPVAR; \ - hbool_t _seen[H5FD_MEM_NTYPES]; \ + unsigned _seen[H5FD_MEM_NTYPES]; \ \ - memset(_seen, 0, sizeof _seen); \ + memset(_seen, 0, sizeof _seen); \ for (_unmapped=H5FD_MEM_SUPER; _unmapped<H5FD_MEM_NTYPES; _unmapped=(H5FD_mem_t)(_unmapped+1)) { \ LOOPVAR = MAP[_unmapped]; \ if (H5FD_MEM_DEFAULT==LOOPVAR) LOOPVAR=_unmapped; \ assert(LOOPVAR>0 && LOOPVAR<H5FD_MEM_NTYPES); \ - if (_seen[LOOPVAR]++) continue; + if (_seen[LOOPVAR]++) continue; \ #define ALL_MEMBERS(LOOPVAR) { \ H5FD_mem_t LOOPVAR; \ @@ -135,6 +135,8 @@ static herr_t H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, ha size_t size, const void *_buf); static herr_t H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); static herr_t H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD_multi_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD_multi_unlock(H5FD_t *_file); /* The class struct */ static const H5FD_class_t H5FD_multi_g = { @@ -167,8 +169,8 @@ static const H5FD_class_t H5FD_multi_g = { H5FD_multi_write, /*write */ H5FD_multi_flush, /*flush */ H5FD_multi_truncate, /*truncate */ - NULL, /*lock */ - NULL, /*unlock */ + H5FD_multi_lock, /*lock */ + H5FD_multi_unlock, /*unlock */ H5FD_FLMAP_DEFAULT /*fl_map */ }; @@ -1786,6 +1788,101 @@ H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) /*------------------------------------------------------------------------- + * Function: H5FD_multi_lock + * + * Purpose: Place a lock on all multi members. + * When there is error in locking a member file, it will not + * proceed further and will try to remove the locks of those + * member files that are locked before error is encountered. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Vailin Choi; March 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_multi_lock(H5FD_t *_file, hbool_t rw) +{ + H5FD_multi_t *file = (H5FD_multi_t*)_file; + int nerrors = 0; + H5FD_mem_t out_mt; + static const char *func="H5FD_multi_unlock"; /* Function Name for error reporting */ + + /* Clear the error stack */ + H5Eclear2(H5E_DEFAULT); + + /* Lock all member files */ + ALL_MEMBERS(mt) { + out_mt = mt; + if(file->memb[mt]) { + H5E_BEGIN_TRY { + if(H5FDlock(file->memb[mt], rw) < 0) { + nerrors++; + break; + } /* end if */ + } H5E_END_TRY; + } /* end if */ + } END_MEMBERS; + + /* Try to unlock the member files that are locked before error is encountered */ + if(nerrors) { + H5FD_mem_t k; + + for(k = H5FD_MEM_DEFAULT; k < out_mt; k = (H5FD_mem_t)(k + 1)) { + H5E_BEGIN_TRY { + if(H5FDunlock(file->memb[k]) < 0) + nerrors++; + } H5E_END_TRY; + } /* end for */ + } /* end if */ + + if(nerrors) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error locking member files", -1) + return 0; + +} /* H5FD_multi_lock() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_multi_unlock + * + * Purpose: Remove the lock on all multi members. + * It will try to unlock all member files but will record error + * encountered. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Vailin Choi; March 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_multi_unlock(H5FD_t *_file) +{ + H5FD_multi_t *file = (H5FD_multi_t*)_file; + int nerrors=0; + static const char *func="H5FD_multi_unlock"; /* Function Name for error reporting */ + + /* Clear the error stack */ + H5Eclear2(H5E_DEFAULT); + + ALL_MEMBERS(mt) { + if(file->memb[mt]) + if(H5FDunlock(file->memb[mt]) < 0) + nerrors++; + } END_MEMBERS; + + if(nerrors) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error unlocking member files", -1) + + return 0; +} /* H5FD_multi_unlock() */ + + +/*------------------------------------------------------------------------- * Function: compute_next * * Purpose: Compute the memb_next[] values of the file based on the diff --git a/src/H5FDpkg.h b/src/H5FDpkg.h index ef33cf1..a0c1b3a 100644 --- a/src/H5FDpkg.h +++ b/src/H5FDpkg.h @@ -57,8 +57,7 @@ H5_DLL haddr_t H5FD_alloc_real(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, H5_DLL herr_t H5FD_free_real(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, hsize_t size); - -/* Testing routines */ +/* Testing functions */ #ifdef H5FD_TESTING #endif /* H5FD_TESTING */ diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 412bbef..0f195ce 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -141,6 +141,8 @@ H5_DLL herr_t H5FD_write(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t ty haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5FD_flush(H5FD_t *file, hid_t dxpl_id, unsigned closing); H5_DLL herr_t H5FD_truncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); +H5_DLL herr_t H5FD_lock(H5FD_t *file, hbool_t rw); +H5_DLL herr_t H5FD_unlock(H5FD_t *file); H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum); H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle); H5_DLL herr_t H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr); diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index 58066cc..4183d14 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -156,13 +156,13 @@ typedef enum H5F_mem_t H5FD_mem_t; /* Define VFL driver features that can be enabled on a per-driver basis */ /* These are returned with the 'query' function pointer in H5FD_class_t */ /* - * Defining the H5FD_FEAT_AGGREGATE_METADATA for a VFL driver means that + * Defining H5FD_FEAT_AGGREGATE_METADATA for a VFL driver means that * the library will attempt to allocate a larger block for metadata and * then sub-allocate each metadata request from that larger block. */ #define H5FD_FEAT_AGGREGATE_METADATA 0x00000001 /* - * Defining the H5FD_FEAT_ACCUMULATE_METADATA for a VFL driver means that + * Defining H5FD_FEAT_ACCUMULATE_METADATA for a VFL driver means that * the library will attempt to cache metadata as it is written to the file * and build up a larger block of metadata to eventually pass to the VFL * 'write' routine. @@ -177,7 +177,7 @@ typedef enum H5F_mem_t H5FD_mem_t; #define H5FD_FEAT_ACCUMULATE_METADATA_READ 0x00000004 #define H5FD_FEAT_ACCUMULATE_METADATA (H5FD_FEAT_ACCUMULATE_METADATA_WRITE|H5FD_FEAT_ACCUMULATE_METADATA_READ) /* - * Defining the H5FD_FEAT_DATA_SIEVE for a VFL driver means that + * Defining H5FD_FEAT_DATA_SIEVE for a VFL driver means that * the library will attempt to cache raw data as it is read from/written to * a file in a "data seive" buffer. See Rajeev Thakur's papers: * http://www.mcs.anl.gov/~thakur/papers/romio-coll.ps.gz @@ -185,13 +185,13 @@ typedef enum H5F_mem_t H5FD_mem_t; */ #define H5FD_FEAT_DATA_SIEVE 0x00000008 /* - * Defining the H5FD_FEAT_AGGREGATE_SMALLDATA for a VFL driver means that + * Defining H5FD_FEAT_AGGREGATE_SMALLDATA for a VFL driver means that * the library will attempt to allocate a larger block for "small" raw data * and then sub-allocate "small" raw data requests from that larger block. */ #define H5FD_FEAT_AGGREGATE_SMALLDATA 0x00000010 /* - * Defining the H5FD_FEAT_IGNORE_DRVRINFO for a VFL driver means that + * Defining H5FD_FEAT_IGNORE_DRVRINFO for a VFL driver means that * the library will ignore the driver info that is encoded in the file * for the VFL driver. (This will cause the driver info to be eliminated * from the file when it is flushed/closed, if the file is opened R/W). @@ -205,13 +205,13 @@ typedef enum H5F_mem_t H5FD_mem_t; */ #define H5FD_FEAT_DIRTY_DRVRINFO_LOAD 0x00000040 /* - * Defining the H5FD_FEAT_POSIX_COMPAT_HANDLE for a VFL driver means that + * Defining H5FD_FEAT_POSIX_COMPAT_HANDLE for a VFL driver means that * the handle for the VFD (returned with the 'get_handle' callback) is * of type 'int' and is compatible with POSIX I/O calls. */ #define H5FD_FEAT_POSIX_COMPAT_HANDLE 0x00000080 /* - * Defining the H5FD_FEAT_HAS_MPI for a VFL driver means that + * Defining H5FD_FEAT_HAS_MPI for a VFL driver means that * the driver makes use of MPI communication and code may retrieve * communicator/rank information from it */ @@ -223,13 +223,13 @@ typedef enum H5F_mem_t H5FD_mem_t; */ #define H5FD_FEAT_ALLOCATE_EARLY 0x00000200 /* - * Defining the H5FD_FEAT_ALLOW_FILE_IMAGE for a VFL driver means that + * Defining H5FD_FEAT_ALLOW_FILE_IMAGE for a VFL driver means that * the driver is able to use a file image in the fapl as the initial * contents of a file. */ #define H5FD_FEAT_ALLOW_FILE_IMAGE 0x00000400 /* - * Defining the H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS for a VFL driver + * Defining H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS for a VFL driver * means that the driver is able to use callbacks to make a copy of the * image to store in memory. */ @@ -274,8 +274,8 @@ typedef struct H5FD_class_t { haddr_t addr, size_t size, const void *buffer); herr_t (*flush)(H5FD_t *file, hid_t dxpl_id, unsigned closing); herr_t (*truncate)(H5FD_t *file, hid_t dxpl_id, hbool_t closing); - herr_t (*lock)(H5FD_t *file, unsigned char *oid, unsigned lock_type, hbool_t last); - herr_t (*unlock)(H5FD_t *file, unsigned char *oid, hbool_t last); + herr_t (*lock)(H5FD_t *file, hbool_t rw); + herr_t (*unlock)(H5FD_t *file); H5FD_mem_t fl_map[H5FD_MEM_NTYPES]; } H5FD_class_t; @@ -355,6 +355,8 @@ H5_DLL herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, unsigned closing); H5_DLL herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); +H5_DLL herr_t H5FDlock(H5FD_t *file, hbool_t rw); +H5_DLL herr_t H5FDunlock(H5FD_t *file); #ifdef __cplusplus } diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 34527df..bb8f004 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -97,6 +97,7 @@ typedef struct H5FD_sec2_t { * a single file. */ hbool_t fam_to_sec2; + } H5FD_sec2_t; /* @@ -137,6 +138,8 @@ static herr_t H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, hadd static herr_t H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); static herr_t H5FD_sec2_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD_sec2_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD_sec2_unlock(H5FD_t *_file); static const H5FD_class_t H5FD_sec2_g = { "sec2", /* name */ @@ -168,8 +171,8 @@ static const H5FD_class_t H5FD_sec2_g = { H5FD_sec2_write, /* write */ NULL, /* flush */ H5FD_sec2_truncate, /* truncate */ - NULL, /* lock */ - NULL, /* unlock */ + H5FD_sec2_lock, /* lock */ + H5FD_sec2_unlock, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -901,3 +904,69 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_sec2_truncate() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_sec2_lock + * + * Purpose: To place an advisory lock on a file. + * The lock type to apply depends on the parameter "rw": + * TRUE--opens for write: an exclusive lock + * FALSE--opens for read: a shared lock + * + * Return: SUCCEED/FAIL + * + * Programmer: Vailin Choi; May 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_sec2_lock(H5FD_t *_file, hbool_t rw) +{ + H5FD_sec2_t *file = (H5FD_sec2_t *)_file; /* VFD file struct */ + int lock; /* The type of lock */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(file); + + /* Determine the type of lock */ + lock = rw ? LOCK_EX : LOCK_SH; + + /* Place the lock with non-blocking */ + if(HDflock(file->fd, lock | LOCK_NB) < 0) + HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to flock file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_sec2_lock() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_sec2_unlock + * + * Purpose: To remove the existing lock on the file + * + * Return: SUCCEED/FAIL + * + * Programmer: Vailin Choi; May 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_sec2_unlock(H5FD_t *_file) +{ + H5FD_sec2_t *file = (H5FD_sec2_t *)_file; /* VFD file struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(file); + + if(HDflock(file->fd, LOCK_UN) < 0) + HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to flock (unlock) file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_sec2_unlock() */ + diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 686e1fc..d5b3d40 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -31,6 +31,11 @@ #include "hdf5.h" +#ifdef H5_HAVE_FLOCK +/* Needed for lock type definitions (e.g., LOCK_EX) */ +#include <sys/file.h> +#endif /* H5_HAVE_FLOCK */ + #ifdef H5_HAVE_UNISTD_H #include <unistd.h> #endif @@ -179,6 +184,8 @@ static herr_t H5FD_stdio_write(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr size_t size, const void *buf); static herr_t H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); static herr_t H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD_stdio_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD_stdio_unlock(H5FD_t *_file); static const H5FD_class_t H5FD_stdio_g = { "stdio", /* name */ @@ -210,8 +217,8 @@ static const H5FD_class_t H5FD_stdio_g = { H5FD_stdio_write, /* write */ H5FD_stdio_flush, /* flush */ H5FD_stdio_truncate, /* truncate */ - NULL, /* lock */ - NULL, /* unlock */ + H5FD_stdio_lock, /* lock */ + H5FD_stdio_unlock, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -439,7 +446,7 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t /*UNUSED*/ fapl_id, file->inode = sb.st_ino; #endif /* H5_HAVE_WIN32_API */ - return (H5FD_t*)file; + return((H5FD_t*)file); } /* end H5FD_stdio_open() */ @@ -704,6 +711,9 @@ H5FD_stdio_get_eof(const H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type) /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); + /* Quiet the compiler */ + type = type; + return(file->eof); } /* end H5FD_stdio_get_eof() */ @@ -1073,6 +1083,87 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, } /* end H5FD_stdio_truncate() */ +/*------------------------------------------------------------------------- + * Function: H5FD_stdio_lock + * + * Purpose: Lock a file via flock + * + * NOTE: This function is a no-op if flock() is not present. + * Errors: + * IO FCNTL flock failed. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; March 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_stdio_lock(H5FD_t *_file, hbool_t rw) +{ +#ifdef H5_HAVE_FLOCK + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + int lock; /* The type of lock */ + static const char *func = "H5FD_stdio_lock"; /* Function Name for error reporting */ + + /* Clear the error stack */ + H5Eclear2(H5E_DEFAULT); + + assert(file); + + /* Determine the type of lock */ + lock = rw ? LOCK_EX : LOCK_SH; + + /* Place the lock with non-blocking */ + if(flock(file->fd, lock | LOCK_NB) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_FCNTL, "flock failed", -1) + if(fflush(file->fp) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1) + +#endif /* H5_HAVE_FLOCK */ + + return 0; +} /* end H5FD_stdio_lock() */ + +/*------------------------------------------------------------------------- + * Function: H5F_stdio_unlock + * + * Purpose: Unlock a file via flock + * + * + * NOTE: This function is a no-op if flock() is not present. + * Errors: + * IO FCNTL flock failed. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; March 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_stdio_unlock(H5FD_t *_file) +{ +#ifdef H5_HAVE_FLOCK + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + static const char *func = "H5FD_stdio_unlock"; /* Function Name for error reporting */ + + /* Clear the error stack */ + H5Eclear2(H5E_DEFAULT); + + assert(file); + + if(fflush(file->fp) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1) + if(flock(file->fd, LOCK_UN) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_FCNTL, "flock (unlock) failed", -1) + +#endif /* H5_HAVE_FLOCK */ + + return 0; +} /* end H5FD_stdio_unlock() */ + + #ifdef _H5private_H /* * This is not related to the functionality of the driver code. @@ -314,8 +314,7 @@ done: * * Purpose: Release an object & put on free list * - * Return: Success: Non-negative - * Failure: Negative + * Return: Always returns NULL * * Programmer: Quincey Koziol * Friday, March 24, 2000 @@ -14,12 +14,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol <koziol@hdfgroup.org> * Tuesday, May 2, 2006 * - * Purpose: Free space tracking functions. + * Purpose: Free space tracking functions. * - * Note: (Used to be in the H5HFflist.c file, prior to the date above) + * Note: (Used to be in the H5HFflist.c file, prior to the date above) * */ @@ -33,11 +33,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* File free space */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* File free space */ +#include "H5MFprivate.h" /* File memory management */ /****************/ @@ -90,21 +90,16 @@ H5FL_DEFINE(H5FS_t); /*------------------------------------------------------------------------- - * Function: H5FS_create + * Function: H5FS_create * - * Purpose: Allocate & initialize file free space info + * Purpose: Allocate & initialize file free space info * - * Return: Success: Pointer to free space structure + * Return: Success: Pointer to free space structure + * Failure: NULL * - * Failure: NULL - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * - * Modifications: - * Vailin Choi, July 29th, 2008 - * Add two more parameters for handling alignment: alignment & threshhold - * *------------------------------------------------------------------------- */ H5FS_t * @@ -129,7 +124,7 @@ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, ncl * Allocate free space structure */ if(NULL == (fspace = H5FS__new(f, nclasses, classes, cls_init_udata))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") /* Initialize creation information for free space manager */ fspace->client = fs_create->client; @@ -177,31 +172,25 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); /*------------------------------------------------------------------------- - * Function: H5FS_open + * Function: H5FS_open * - * Purpose: Open an existing file free space info structure on disk + * Purpose: Open an existing file free space info structure on disk * - * Return: Success: Pointer to free space structure + * Return: Success: Pointer to free space structure + * Failure: NULL * - * Failure: NULL - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 2, 2006 * - * Modfications: - * - * Vailin Choi, July 29th, 2008 - * Add two more parameters for handling alignment: alignment & threshhold - * *------------------------------------------------------------------------- */ H5FS_t * H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold) { - H5FS_t *fspace = NULL; /* New free space structure */ - H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - H5FS_t *ret_value = NULL; /* Return value */ + H5FS_t *fspace = NULL; /* New free space structure */ + H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ + H5FS_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, NULL) #ifdef H5FS_DEBUG @@ -252,15 +241,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_delete + * Function: H5FS_delete * - * Purpose: Delete a free space manager on disk + * Purpose: Delete a free space manager on disk * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 30, 2006 * *------------------------------------------------------------------------- @@ -404,16 +391,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_close + * Function: H5FS_close * - * Purpose: Destroy & deallocate free list structure, serializing sections + * Purpose: Destroy & deallocate free list structure, serializing sections * in the bins * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * *------------------------------------------------------------------------- @@ -467,9 +452,9 @@ HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC); HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ } /* end if */ - else - /* Sanity check that section info has address */ - HDassert(H5F_addr_defined(fspace->sect_addr)); + else + /* Sanity check that section info has address */ + HDassert(H5F_addr_defined(fspace->sect_addr)); /* Cache the free space section info */ if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) @@ -591,12 +576,12 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", FUNC, ret_va /*------------------------------------------------------------------------- * Function: H5FS__new * - * Purpose: Create new free space manager structure + * Purpose: Create new free space manager structure * - * Return: Success: non-NULL, pointer to new free space manager struct - * Failure: NULL + * Return: Success: non-NULL, pointer to new free space manager struct + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 31, 2006 * *------------------------------------------------------------------------- @@ -618,7 +603,7 @@ H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes * Allocate free space structure */ if(NULL == (fspace = H5FL_CALLOC(H5FS_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") /* Set immutable free list parameters */ H5_CHECKED_ASSIGN(fspace->nclasses, unsigned, nclasses, size_t); @@ -673,8 +658,7 @@ done: * * Purpose: Collect meta storage info used by the free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED (Can't fail) * * Programmer: Vailin Choi * June 19, 2007 @@ -705,8 +689,7 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) * * Purpose: Increment reference count on free space header * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * February 7, 2008 @@ -746,8 +729,7 @@ done: * * Purpose: Decrement reference count on free space header * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * February 7, 2008 @@ -790,15 +772,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_dirty + * Function: H5FS_dirty * - * Purpose: Mark free space header as dirty + * Purpose: Mark free space header as dirty * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Feb 14 2008 + * Programmer: Quincey Koziol + * Feb 14 2008 * *------------------------------------------------------------------------- */ @@ -827,20 +808,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_alloc_hdr() + * Function: H5FS_alloc_hdr() * - * Purpose: Allocate space for the free-space manager header + * Purpose: Allocate space for the free-space manager header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; Feb 2009 + * Programmer: Vailin Choi + * Feb 2009 * *------------------------------------------------------------------------- */ herr_t H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr, hid_t dxpl_id) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, FAIL) @@ -849,17 +831,17 @@ H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr, hid_t dxpl_id) HDassert(fspace); if(!H5F_addr_defined(fspace->addr)) { - /* Allocate space for the free space header */ - if(HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, dxpl_id, (hsize_t)H5FS_HEADER_SIZE(f)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for free space header") + /* Allocate space for the free space header */ + if(HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, dxpl_id, (hsize_t)H5FS_HEADER_SIZE(f)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for free space header") - /* Cache the new free space header (pinned) */ - if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space header to cache") + /* Cache the new free space header (pinned) */ + if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space header to cache") } /* end if */ if(fs_addr) - *fs_addr = fspace->addr; + *fs_addr = fspace->addr; done: FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) @@ -867,20 +849,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_alloc_sect() + * Function: H5FS_alloc_sect() * - * Purpose: Allocate space for the free-space manager section info header + * Purpose: Allocate space for the free-space manager section info header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; Feb 2009 + * Programmer: Vailin Choi + * Feb 2009 * *------------------------------------------------------------------------- */ herr_t H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, FAIL) @@ -889,22 +872,22 @@ 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 (or temp. address space) */ + /* 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; + fspace->alloc_sect_size = fspace->sect_size; - /* Mark free-space header as dirty */ - if(H5FS_dirty(fspace) < 0) + /* Mark free-space header as dirty */ + if(H5FS_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") - /* Cache the free-space section info */ - if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache") + /* Cache the free-space section info */ + if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache") - fspace->sinfo = NULL; + fspace->sinfo = NULL; } /* end if */ done: @@ -913,13 +896,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_free() + * Function: H5FS_free() * - * Purpose: Free space for free-space manager header and section info header + * Purpose: Free space for free-space manager header and section info header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; Feb 2009 + * Programmer: Vailin Choi + * Feb 2009 * *------------------------------------------------------------------------- */ @@ -927,7 +911,7 @@ herr_t H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) { haddr_t saved_addr; /* Previous address of item */ - unsigned cache_flags; /* Flags for unprotecting cache entries */ + unsigned cache_flags; /* Flags for unprotecting cache entries */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, FAIL) @@ -942,11 +926,11 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) hsize_t saved_size; /* Size of previous section info */ unsigned sinfo_status = 0; /* Section info cache status */ - /* Check whether free-space manager section info is in cache or not */ - if(H5AC_get_entry_status(f, fspace->sect_addr, &sinfo_status) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to check metadata cache status for free-space section info") + /* Check whether free-space manager section info is in cache or not */ + if(H5AC_get_entry_status(f, fspace->sect_addr, &sinfo_status) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to check metadata cache status for free-space section info") - /* Load free-space manager section info */ + /* Load free-space manager section info */ if(sinfo_status & H5AC_ES__IN_CACHE || !fspace->sinfo) { H5FS_sinfo_cache_ud_t cache_udata; /* User-data for cache callback */ @@ -957,39 +941,39 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) if(NULL == (fspace->sinfo = (H5FS_sinfo_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space section info") - /* Unload and release ownership of the free-space manager section info */ - if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, cache_flags) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") - } /* end if */ + /* Unload and release ownership of the free-space manager section info */ + if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, cache_flags) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") + } /* end if */ - saved_addr = fspace->sect_addr; - saved_size = fspace->alloc_sect_size; + saved_addr = fspace->sect_addr; + saved_size = fspace->alloc_sect_size; - fspace->sect_addr = HADDR_UNDEF; - fspace->alloc_sect_size = 0; + fspace->sect_addr = HADDR_UNDEF; + fspace->alloc_sect_size = 0; - /* Free space for the free-space manager section info */ + /* Free space for the free-space manager section info */ 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) + /* Mark free-space manager header as dirty */ + if(H5FS_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ if(H5F_addr_defined(fspace->addr)) { unsigned hdr_status = 0; /* Header entry status */ - /* Check whether free-space manager header is in cache or not */ - if(H5AC_get_entry_status(f, fspace->addr, &hdr_status) < 0) + /* Check whether free-space manager header is in cache or not */ + if(H5AC_get_entry_status(f, fspace->addr, &hdr_status) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to check metadata cache status for free-space section info") if(hdr_status & H5AC_ES__IN_CACHE) { H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - /* Protect the free-space manager header */ + /* Protect the free-space manager header */ /* (no class information necessary since it's in the cache) */ cache_udata.f = f; cache_udata.nclasses = 0; @@ -998,21 +982,21 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space section info") - /* Unpin the free-space manager header */ - if(H5AC_unpin_entry(fspace) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header") + /* Unpin the free-space manager header */ + if(H5AC_unpin_entry(fspace) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header") - /* Unload and release ownership of the free-space header */ - if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, cache_flags) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") - } /* end if */ + /* Unload and release ownership of the free-space header */ + if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, cache_flags) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") + } /* end if */ - saved_addr = fspace->addr; - fspace->addr = HADDR_UNDEF; + saved_addr = fspace->addr; + fspace->addr = HADDR_UNDEF; - /* Free space for the free-space manager header */ - if(H5MF_xfree(f, H5FD_MEM_FSPACE_HDR, dxpl_id, saved_addr, (hsize_t)H5FS_HEADER_SIZE(f)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space header") + /* Free space for the free-space manager header */ + if(H5MF_xfree(f, H5FD_MEM_FSPACE_HDR, dxpl_id, saved_addr, (hsize_t)H5FS_HEADER_SIZE(f)) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space header") } /* end if */ done: @@ -1021,15 +1005,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS__hdr_dest + * Function: H5FS__hdr_dest * - * Purpose: Destroys a free space header in memory. + * Purpose: Destroys a free space header in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 + * Programmer: Quincey Koziol + * May 2 2006 * *------------------------------------------------------------------------- */ @@ -1067,14 +1050,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_sect_cb + * Function: H5FS_sinfo_free_sect_cb * - * Purpose: Free a size-tracking node for a bin + * Purpose: Free a size-tracking node for a bin * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, March 11, 2006 * *------------------------------------------------------------------------- @@ -1093,20 +1075,18 @@ H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) /* Call the section's class 'free' method on the section */ (*sinfo->fspace->sect_cls[sect->type].free)(sect); - FUNC_LEAVE_NOAPI(0) + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5FS_sinfo_free_sect_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_node_cb - * - * Purpose: Free a size-tracking node for a bin + * Function: H5FS_sinfo_free_node_cb * - * Return: Success: non-negative + * Purpose: Free a size-tracking node for a bin * - * Failure: negative + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, March 11, 2006 * *------------------------------------------------------------------------- @@ -1127,20 +1107,19 @@ H5FS_sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) /* Release free space list node */ fspace_node = H5FL_FREE(H5FS_node_t, fspace_node); - FUNC_LEAVE_NOAPI(0) + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5FS_sinfo_free_node_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_dest + * Function: H5FS_sinfo_dest * - * Purpose: Destroys a free space section info in memory. + * Purpose: Destroys a free space section info in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 + * Programmer: Quincey Koziol + * July 31 2006 * *------------------------------------------------------------------------- */ @@ -1193,15 +1172,14 @@ done: #ifdef H5FS_DEBUG_ASSERT /*------------------------------------------------------------------------- - * Function: H5FS_assert + * Function: H5FS_assert * - * Purpose: Verify that the free space manager is mostly sane + * Purpose: Verify that the free space manager is mostly sane * - * Return: Non-negative on success, negative on failure + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 17 2006 + * Programmer: Quincey Koziol + * Jul 17 2006 * *------------------------------------------------------------------------- */ diff --git a/src/H5FScache.c b/src/H5FScache.c index 25a16e0..2f7dda8 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -15,11 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5FScache.c - * May 2 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Created: H5FScache.c + * May 2 2006 + * Quincey Koziol <koziol@hdfgroup.org> * - * Purpose: Implement file free space metadata cache methods. + * Purpose: Implement file free space metadata cache methods. * *------------------------------------------------------------------------- */ @@ -176,6 +176,8 @@ H5FS__cache_hdr_get_load_size(const void *_udata, size_t *image_len) FUNC_ENTER_STATIC_NOERR /* Check arguments */ + HDassert(udata); + HDassert(udata->f); HDassert(image_len); /* Set the image length size */ @@ -223,24 +225,24 @@ H5FS__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, /* Allocate a new free space manager */ if(NULL == (fspace = H5FS__new(udata->f, udata->nclasses, udata->classes, udata->cls_init_udata))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Set free space manager's internal information */ fspace->addr = udata->addr; /* Magic number */ if(HDmemcmp(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header signature") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header signature") image += H5_SIZEOF_MAGIC; /* Version */ if(*image++ != H5FS_HDR_VERSION) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header version") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header version") /* Client ID */ fspace->client = (H5FS_client_t)*image++; if(fspace->client >= H5FS_NUM_CLIENT_ID) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "unknown client ID in free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "unknown client ID in free space header") /* Total space tracked */ H5F_DECODE_LENGTH(udata->f, image, fspace->tot_space); @@ -258,7 +260,7 @@ H5FS__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, /* (only check if we actually have some classes) */ UINT16DECODE(image, nclasses); if(fspace->nclasses > 0 && fspace->nclasses != nclasses) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "section class count mismatch") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "section class count mismatch") /* Shrink percent */ UINT16DECODE(image, fspace->shrink_percent); @@ -822,7 +824,6 @@ H5FS__cache_sinfo_get_load_size(const void *_udata, size_t *image_len) * it with the data contained in the image, and return a pointer to * the new instance. * - * * Return: Success: Pointer to in core representation * Failure: NULL * @@ -1235,7 +1236,7 @@ done: * Purpose: Skip list iterator callback to serialize free space sections * of a particular size * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, May 8, 2006 @@ -1291,7 +1292,7 @@ done: * Purpose: Skip list iterator callback to serialize free space sections * in a bin * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, May 8, 2006 @@ -1329,4 +1330,3 @@ H5FS__sinfo_serialize_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udat done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FS__sinfo_serialize_node_cb() */ - diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index 7303b73..fbdeb70 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -15,11 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5FSdbg.c - * May 9 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Created: H5FSdbg.c + * May 9 2006 + * Quincey Koziol <koziol@hdfgroup.org> * - * Purpose: Dump debugging information about a free space manager + * Purpose: Dump debugging information about a free space manager * *------------------------------------------------------------------------- */ @@ -36,11 +36,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* File free space */ -#include "H5HFprivate.h" /* Fractal heaps */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* File free space */ +#include "H5HFprivate.h" /* Fractal heaps */ +#include "H5MFprivate.h" /* File memory management */ /****************/ @@ -79,26 +79,21 @@ /*------------------------------------------------------------------------- - * Function: H5FS_debug + * Function: H5FS_debug * - * Purpose: Prints debugging info about a free space manager. + * Purpose: Prints debugging info about a free space manager. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 9 2006 - * - * Modifications: - * Vailin Choi, July 29th, 2008 - * Add H5FS_CLIENT_FILE_ID for File Memory Management + * Programmer: Quincey Koziol + * May 9 2006 * *------------------------------------------------------------------------- */ herr_t H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth) { - H5FS_t *fspace = NULL; /* Free space header info */ + H5FS_t *fspace = NULL; /* Free space header info */ H5FS_hdr_cache_ud_t cache_udata; /* User-data for cache callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -124,7 +119,7 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int * Load the free space header. */ if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") /* Print opening message */ HDfprintf(stream, "%*sFree Space Header...\n", indent, ""); @@ -133,45 +128,45 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int * Print the values. */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Free space client:", - (fspace->client == H5FS_CLIENT_FHEAP_ID ? "Fractal heap" : - (fspace->client == H5FS_CLIENT_FILE_ID ? "File" : "Unknown"))); + "Free space client:", + (fspace->client == H5FS_CLIENT_FHEAP_ID ? "Fractal heap" : + (fspace->client == H5FS_CLIENT_FILE_ID ? "File" : "Unknown"))); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Total free space tracked:", - fspace->tot_space); + "Total free space tracked:", + fspace->tot_space); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Total number of free space sections tracked:", - fspace->tot_sect_count); + "Total number of free space sections tracked:", + fspace->tot_sect_count); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of serializable free space sections tracked:", - fspace->serial_sect_count); + "Number of serializable free space sections tracked:", + fspace->serial_sect_count); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of ghost free space sections tracked:", - fspace->ghost_sect_count); + "Number of ghost free space sections tracked:", + fspace->ghost_sect_count); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Number of free space section classes:", - (unsigned)fspace->nclasses); + "Number of free space section classes:", + (unsigned)fspace->nclasses); HDfprintf(stream, "%*s%-*s %u%%\n", indent, "", fwidth, - "Shrink percent:", - fspace->shrink_percent); + "Shrink percent:", + fspace->shrink_percent); HDfprintf(stream, "%*s%-*s %u%%\n", indent, "", fwidth, - "Expand percent:", - fspace->expand_percent); + "Expand percent:", + fspace->expand_percent); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "# of bits for section address space:", - fspace->max_sect_addr); + "# of bits for section address space:", + fspace->max_sect_addr); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Maximum section size:", - fspace->max_sect_size); + "Maximum section size:", + fspace->max_sect_size); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Serialized sections address:", - fspace->sect_addr); + "Serialized sections address:", + fspace->sect_addr); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Serialized sections size used:", - fspace->sect_size); + "Serialized sections size used:", + fspace->sect_size); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Serialized sections size allocated:", - fspace->alloc_sect_size); + "Serialized sections size allocated:", + fspace->alloc_sect_size); done: if(fspace && H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, addr, fspace, H5AC__NO_FLAGS_SET) < 0) @@ -182,15 +177,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_debug + * Function: H5FS_sect_debug * - * Purpose: Prints debugging info about a free space section. + * Purpose: Prints debugging info about a free space section. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 30 2006 + * Programmer: Quincey Koziol + * May 30 2006 * *------------------------------------------------------------------------- */ @@ -221,15 +215,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sects_debug + * Function: H5FS_sects_debug * - * Purpose: Prints debugging info about the free space sections. + * Purpose: Prints debugging info about the free space sections. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 9 2006 + * Programmer: Quincey Koziol + * May 9 2006 * *------------------------------------------------------------------------- */ @@ -237,7 +230,7 @@ herr_t H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int indent, int fwidth, haddr_t fs_addr, haddr_t client_addr) { - H5FS_t *fspace = NULL; /* Free space header info */ + H5FS_t *fspace = NULL; /* Free space header info */ H5FS_client_t client; /* The client of the free space */ H5FS_hdr_cache_ud_t cache_udata; /* User-data for cache callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -266,7 +259,7 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t H5_ATTR_UNUSED addr, FILE *str * Load the free space header. */ if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") /* Retrieve the client id */ client = fspace->client; @@ -292,8 +285,8 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t H5_ATTR_UNUSED addr, FILE *str break; case H5FS_CLIENT_FILE_ID: - if(H5MF_sects_debug(f, dxpl_id, fs_addr, stream, indent + 3, MAX(0, fwidth - 3)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_SYSTEM, FAIL, "unable to dump file free space sections") + if(H5MF_sects_debug(f, dxpl_id, fs_addr, stream, indent + 3, MAX(0, fwidth - 3)) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_SYSTEM, FAIL, "unable to dump file free space sections") break; case H5FS_NUM_CLIENT_ID: diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index b0df9e6..08c2529 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -14,12 +14,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> - * Tuesday, May 2, 2006 + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Tuesday, May 2, 2006 * - * Purpose: This file contains declarations which are visible only within - * the H5FS package. Source files outside the H5FS package should - * include H5FSprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5FS package. Source files outside the H5FS package should + * include H5FSprivate.h instead. */ #if !(defined H5FS_FRIEND || defined H5FS_MODULE) #error "Do not include this file outside the H5FS package!" @@ -38,11 +38,11 @@ /* #define H5FS_DEBUG_ASSERT */ /* Get package's private header */ -#include "H5FSprivate.h" /* File free space */ +#include "H5FSprivate.h" /* File free space */ /* Other private headers needed by this file */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5SLprivate.h" /* Skip lists */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5SLprivate.h" /* Skip lists */ /**************************/ /* Package Private Macros */ diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index 37bc0ea..c5ad38f 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -15,11 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5FSprivate.h - * May 2 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Created: H5FSprivate.h + * May 2 2006 + * Quincey Koziol <koziol@hdfgroup.org> * - * Purpose: Private header for library accessible file free space routines. + * Purpose: Private header for library accessible file free space routines. * *------------------------------------------------------------------------- */ @@ -127,8 +127,8 @@ struct H5FS_section_info_t { /* Free space client IDs for identifying user of free space */ typedef enum H5FS_client_t { - H5FS_CLIENT_FHEAP_ID = 0, /* Free space is used by fractal heap */ - H5FS_CLIENT_FILE_ID, /* Free space is used by file */ + H5FS_CLIENT_FHEAP_ID = 0, /* Free space is used by fractal heap */ + H5FS_CLIENT_FILE_ID, /* Free space is used by file */ H5FS_NUM_CLIENT_ID /* Number of free space client IDs (must be last) */ } H5FS_client_t; @@ -147,11 +147,11 @@ typedef struct H5FS_stat_t { hsize_t tot_sect_count; /* Total # of sections tracked */ hsize_t serial_sect_count; /* # of serializable sections tracked */ hsize_t ghost_sect_count; /* # of un-serializable sections tracked */ - haddr_t addr; /* Address of free space header on disk */ - hsize_t hdr_size; /* Size of the free-space header on disk */ + haddr_t addr; /* Address of free space header on disk */ + hsize_t hdr_size; /* Size of the free-space header on disk */ haddr_t sect_addr; /* Address of the section info in the file */ hsize_t alloc_sect_size; /* Allocated size of the section info in the file */ - hsize_t sect_size; /* Size of the section info in the file */ + hsize_t sect_size; /* Size of the section info in the file */ } H5FS_stat_t; /* Typedef for iteration operations */ diff --git a/src/H5FSpublic.h b/src/H5FSpublic.h index d1bae94..87debe8 100644 --- a/src/H5FSpublic.h +++ b/src/H5FSpublic.h @@ -17,7 +17,7 @@ * * Created: H5FSpublic.h * May 2 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol <koziol@hdfgroup.org> * * Purpose: Public declarations for the file free space package. * diff --git a/src/H5FSsection.c b/src/H5FSsection.c index d447160..62500e7 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -14,10 +14,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Programmer: Quincey Koziol <koziol@hdfgroup.org> * Monday, July 31, 2006 * - * Purpose: Free space tracking functions. + * Purpose: Free space tracking functions. * */ @@ -111,14 +111,14 @@ H5FL_DEFINE(H5FS_sinfo_t); /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_new + * Function: H5FS_sinfo_new * - * Purpose: Create new section info structure + * Purpose: Create new section info structure * - * Return: Success: non-NULL, pointer to new section info struct - * Failure: NULL + * Return: Success: non-NULL, pointer to new section info struct + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 31, 2006 * *------------------------------------------------------------------------- @@ -140,7 +140,7 @@ HDfprintf(stderr, "%s: fspace->addr = %a\n", FUNC, fspace->addr); /* Allocate the free space header */ if(NULL == (sinfo = H5FL_CALLOC(H5FS_sinfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Set non-zero values */ sinfo->nbins = H5VM_log2_gen(fspace->max_sect_size); @@ -186,19 +186,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_lock + * Function: H5FS_sinfo_lock * - * Purpose: Make certain the section info for the free space manager is + * Purpose: Make certain the section info for the free space manager is * in memory. * * Either uses existing section info owned by the free space * header, loads section info from disk, or creates new section * info * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, February 7, 2008 * *------------------------------------------------------------------------- @@ -304,15 +303,14 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_unlock + * Function: H5FS_sinfo_unlock * - * Purpose: Release the section info, either giving ownership back to + * Purpose: Release the section info, either giving ownership back to * the cache or letting the free space header keep it. * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, February 7, 2008 * *------------------------------------------------------------------------- @@ -468,14 +466,13 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); /*------------------------------------------------------------------------- - * Function: H5FS_sect_serialize_size + * Function: H5FS_sect_serialize_size * - * Purpose: Determine serialized size of all sections in free space manager + * Purpose: Determine serialized size of all sections in free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 8, 2006 * *------------------------------------------------------------------------- @@ -532,15 +529,14 @@ HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_ /*------------------------------------------------------------------------- - * Function: H5FS_sect_increase + * Function: H5FS_sect_increase * - * Purpose: Increase the size of the serialized free space section info + * Purpose: Increase the size of the serialized free space section info * on disk * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 8, 2006 * *------------------------------------------------------------------------- @@ -594,16 +590,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_decrease + * Function: H5FS_sect_decrease * - * Purpose: Decrease the size of the serialized free space section info + * Purpose: Decrease the size of the serialized free space section info * on disk * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 8, 2006 * *------------------------------------------------------------------------- @@ -653,14 +647,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_size_node_decr + * Function: H5FS_size_node_decr * - * Purpose: Decrement the number of sections of a particular size + * Purpose: Decrement the number of sections of a particular size * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -741,15 +734,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_unlink_size + * Function: H5FS_sect_unlink_size * - * Purpose: Remove a section node from size tracking data structures for + * Purpose: Remove a section node from size tracking data structures for * a free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -796,17 +788,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_unlink_rest + * Function: H5FS_sect_unlink_rest * - * Purpose: Finish unlinking a section from the rest of the free space + * Purpose: Finish unlinking a section from the rest of the free space * manager's data structures, after the section has been removed * from the size tracking data structures * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -853,14 +843,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_remove_real + * Function: H5FS_sect_remove_real * - * Purpose: Remove a section from the free space manager + * Purpose: Remove a section from the free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -895,14 +884,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_remove + * Function: H5FS_sect_remove * - * Purpose: Remove a section from the free space manager + * Purpose: Remove a section from the free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -940,14 +928,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_link_size + * Function: H5FS_sect_link_size * - * Purpose: Add a section of free space to the free list bins + * Purpose: Add a section of free space to the free list bins * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, March 20, 2006 * *------------------------------------------------------------------------- @@ -1048,16 +1035,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_link_rest + * Function: H5FS_sect_link_rest * - * Purpose: Link a section into the rest of the non-size tracking + * Purpose: Link a section into the rest of the non-size tracking * free space manager data structures * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -1100,15 +1085,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_link + * Function: H5FS_sect_link * - * Purpose: Link a section into the internal data structures + * Purpose: Link a section into the internal data structures * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -1152,24 +1135,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_merge + * Function: H5FS_sect_merge * - * Purpose: Attempt to merge a returned free space section with existing + * Purpose: Attempt to merge a returned free space section with existing * free space. * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * - * Modifications: Vailin Choi; Sept 25th 2008 - * Changes to the "shrinking" part-- - * 1. Get last section node in merge-list instead of "less-than" - * node for further iteration - * 2. Remove "can-be-shrunk" section from free-space instead of - * "less-than" section - * *------------------------------------------------------------------------- */ static herr_t @@ -1177,7 +1152,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) { H5FS_section_class_t *sect_cls; /* Section's class */ hbool_t modified; /* Flag to indicate merge or shrink occurred */ - hbool_t remove_sect = FALSE; /* Whether a section should be removed before shrinking */ + hbool_t remove_sect = FALSE; /* Whether a section should be removed before shrinking */ htri_t status; /* Status value */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1309,13 +1284,13 @@ HDfprintf(stderr, "%s: Done merging, (*sect) = {%a, %Hu, %u, %s}\n", FUNC, (*sec HDfprintf(stderr, "%s: Can shrink!\n", FUNC); #endif /* QAK */ - /* Remove SECT from free-space manager */ + /* Remove SECT from free-space manager */ /* (only possible to happen on second+ pass through loop) */ - if(remove_sect) { - if(H5FS_sect_remove_real(fspace, *sect) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") - remove_sect = FALSE; - } /* end if */ + if(remove_sect) { + if(H5FS_sect_remove_real(fspace, *sect) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") + remove_sect = FALSE; + } /* end if */ /* Shrink the container */ /* (callback can indicate that it has discarded the section by setting *sect to NULL) */ @@ -1339,7 +1314,7 @@ HDfprintf(stderr, "%s: Can shrink!\n", FUNC); remove_sect = TRUE; } /* end if */ } /* end if */ - } /* end if */ + } /* end if */ /* Indicate successful merge occurred */ modified = TRUE; @@ -1349,7 +1324,7 @@ HDfprintf(stderr, "%s: Can shrink!\n", FUNC); /* Check for section that was shrunk away and next section not shrinking */ if(remove_sect && (*sect != NULL)) - *sect = NULL; + *sect = NULL; #ifdef QAK HDfprintf(stderr, "%s: Done shrinking\n", FUNC); @@ -1368,15 +1343,13 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); /*------------------------------------------------------------------------- - * Function: H5FS_sect_add + * Function: H5FS_sect_add * - * Purpose: Add a section of free space to the free list + * Purpose: Add a section of free space to the free list * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * *------------------------------------------------------------------------- @@ -1458,14 +1431,13 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); /*------------------------------------------------------------------------- - * Function: H5FS_sect_try_extend + * Function: H5FS_sect_try_extend * - * Purpose: Try to extend a block using space from a section on the free list + * Purpose: Try to extend a block using space from a section on the free list * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, January 8, 2008 * *------------------------------------------------------------------------- @@ -1589,15 +1561,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_try_merge + * Function: H5FS_sect_try_merge * - * Purpose: Try to merge/shrink a block + * Purpose: Try to merge/shrink a block * - * Return: TRUE: merged/shrunk - * FALSE: not merged/not shrunk - * Failure: negative + * Return: TRUE: merged/shrunk + * FALSE: not merged/not shrunk + * Failure: negative * - * Programmer: Vailin Choi; June 10, 2009 + * Programmer: Vailin Choi + * June 10, 2009 * *------------------------------------------------------------------------- */ @@ -1607,7 +1580,7 @@ H5FS_sect_try_merge(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_info_t { hbool_t sinfo_valid = FALSE; /* Whether the section info is valid */ hbool_t sinfo_modified = FALSE; /* Whether the section info was modified */ - hsize_t saved_fs_size; /* copy the free-space section size */ + hsize_t saved_fs_size; /* Copy of the free-space section size */ htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1621,18 +1594,18 @@ H5FS_sect_try_merge(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_info_t /* Get a pointer to the section info */ if(H5FS_sinfo_lock(f, dxpl_id, fspace, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; saved_fs_size = sect->size; /* Attempt to merge/shrink section with existing sections */ if(H5FS_sect_merge(fspace, §, op_data) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") /* Check if section is shrunk and/or merged away completely */ if(!sect) { - sinfo_modified = TRUE; - HGOTO_DONE(TRUE) + sinfo_modified = TRUE; + HGOTO_DONE(TRUE) } /* end if */ else { /* Check if section is merged */ @@ -1654,23 +1627,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_find_node + * Function: H5FS_sect_find_node * - * Purpose: Locate a section of free space (in existing free space list + * Purpose: Locate a section of free space (in existing free space list * bins) that is large enough to fulfill request. * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, March 20, 2006 * - * Modifications: - * Vailin Choi, July 29th, 2008 - * Modified to handle alignment by going through each bin to find - * a section that is big enough to fulfill "request+fragment for alignment" - * *------------------------------------------------------------------------- */ static htri_t @@ -1702,34 +1668,34 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); #endif /* QAK */ alignment = fspace->alignment; if(!((alignment > 1) && (request >= fspace->threshold))) - alignment = 0; /* no alignment */ + alignment = 0; /* no alignment */ do { /* Check if there's any sections in this bin */ - if(fspace->sinfo->bins[bin].bin_list) { - - if (!alignment) { /* no alignment */ - /* Find the first free space section that is large enough to fulfill request */ - /* (Since the bins use skip lists to track the sizes of the address-ordered - * lists, this is actually a "best fit" algorithm) - */ - /* Look for large enough free space section in this bin */ - if((fspace_node = (H5FS_node_t *)H5SL_greater(fspace->sinfo->bins[bin].bin_list, &request))) { - /* Take first node off of the list (ie. node w/lowest address) */ - if(NULL == (*node = (H5FS_section_info_t *)H5SL_remove_first(fspace_node->sect_list))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list") - - /* Get section's class */ - cls = &fspace->sect_cls[(*node)->type]; - /* Decrement # of sections in section size node */ - if(H5FS_size_node_decr(fspace->sinfo, bin, fspace_node, cls) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") - if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures") - /* Indicate that we found a node for the request */ - HGOTO_DONE(TRUE) - } /* end if */ - } /* end if */ + if(fspace->sinfo->bins[bin].bin_list) { + + if (!alignment) { /* no alignment */ + /* Find the first free space section that is large enough to fulfill request */ + /* (Since the bins use skip lists to track the sizes of the address-ordered + * lists, this is actually a "best fit" algorithm) + */ + /* Look for large enough free space section in this bin */ + if((fspace_node = (H5FS_node_t *)H5SL_greater(fspace->sinfo->bins[bin].bin_list, &request))) { + /* Take first node off of the list (ie. node w/lowest address) */ + if(NULL == (*node = (H5FS_section_info_t *)H5SL_remove_first(fspace_node->sect_list))) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list") + + /* Get section's class */ + cls = &fspace->sect_cls[(*node)->type]; + /* Decrement # of sections in section size node */ + if(H5FS_size_node_decr(fspace->sinfo, bin, fspace_node, cls) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") + if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures") + /* Indicate that we found a node for the request */ + HGOTO_DONE(TRUE) + } /* end if */ + } /* end if */ else { /* alignment is set */ /* get the first node of a certain size in this bin */ curr_size_node = H5SL_first(fspace->sinfo->bins[bin].bin_list); @@ -1798,9 +1764,9 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); /* Get the next size node in the bin */ curr_size_node = H5SL_next(curr_size_node); } /* end while of curr_size_node */ - } /* else of alignment */ - } /* if bin_list */ - /* Advance to next larger bin */ + } /* else of alignment */ + } /* if bin_list */ + /* Advance to next larger bin */ bin++; } while(bin < fspace->sinfo->nbins); @@ -1810,22 +1776,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_find + * Function: H5FS_sect_find * - * Purpose: Locate a section of free space (in existing free space list) that + * Purpose: Locate a section of free space (in existing free space list) that * is large enough to fulfill request. * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * - * Modifications: - * Vailin Choi, July 29th 2008 - * Move H5FS_sect_unlink_rest() to H5FS_sect_find_node() - * *------------------------------------------------------------------------- */ htri_t @@ -1871,7 +1831,7 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se #ifdef QAK HDfprintf(stderr, "%s: (*node)->size = %Hu, (*node)->addr = %a, (*node)->type = %u\n", FUNC, (*node)->size, (*node)->addr, (*node)->type); #endif /* QAK */ - } + } } /* end if */ done: @@ -1887,16 +1847,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_iterate_sect_cb + * Function: H5FS_iterate_sect_cb * - * Purpose: Skip list iterator callback to iterate over free space sections + * Purpose: Skip list iterator callback to iterate over free space sections * of a particular size * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, May 13, 2006 * *------------------------------------------------------------------------- @@ -1925,16 +1883,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_iterate_node_cb + * Function: H5FS_iterate_node_cb * - * Purpose: Skip list iterator callback to iterate over free space sections + * Purpose: Skip list iterator callback to iterate over free space sections * in a bin * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, May 13, 2006 * *------------------------------------------------------------------------- @@ -1964,15 +1920,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_iterate + * Function: H5FS_sect_iterate * - * Purpose: Iterate over all the sections managed + * Purpose: Iterate over all the sections managed * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, May 13, 2006 * *------------------------------------------------------------------------- @@ -2032,14 +1986,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_stats + * Function: H5FS_sect_stats * - * Purpose: Retrieve info about the sections managed + * Purpose: Retrieve info about the sections managed * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 30, 2006 * *------------------------------------------------------------------------- @@ -2063,16 +2016,14 @@ H5FS_sect_stats(const H5FS_t *fspace, hsize_t *tot_space, hsize_t *nsects) /*------------------------------------------------------------------------- - * Function: H5FS_sect_change_class + * Function: H5FS_sect_change_class * - * Purpose: Make appropriate adjustments to internal data structures when + * Purpose: Make appropriate adjustments to internal data structures when * a section changes class * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 10, 2006 * *------------------------------------------------------------------------- @@ -2235,15 +2186,14 @@ done: #ifdef H5FS_DEBUG_ASSERT /*------------------------------------------------------------------------- - * Function: H5FS_sect_assert + * Function: H5FS_sect_assert * - * Purpose: Verify that the sections managed are mostly sane + * Purpose: Verify that the sections managed are mostly sane * - * Return: Non-negative on success, negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 17 2006 + * Programmer: Quincey Koziol + * Jul 17 2006 * *------------------------------------------------------------------------- */ diff --git a/src/H5FSstat.c b/src/H5FSstat.c index 390eb9f..d2c0177 100644 --- a/src/H5FSstat.c +++ b/src/H5FSstat.c @@ -28,9 +28,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* Free-space manager */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* Free-space manager */ /****************/ @@ -74,12 +74,10 @@ * * Purpose: Retrieve metadata statistics for the free-space manager * - * Return: Success: non-negative - * - * Failure: does not fail + * Return: SUCCEED (Can't fail) * * Programmer: Vailin Choi - * August 25th, 2008 + * August 25th, 2008 * *------------------------------------------------------------------------- */ diff --git a/src/H5FStest.c b/src/H5FStest.c index f96ee75..06f5166 100644 --- a/src/H5FStest.c +++ b/src/H5FStest.c @@ -23,15 +23,15 @@ /****************/ #include "H5FSmodule.h" /* This source code file is part of the H5FS module */ -#define H5FS_TESTING /*suppress warning about H5FS testing funcs */ +#define H5FS_TESTING /* Suppress warning about H5FS testing funcs */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* Free-space manager */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* Free-space manager */ /****************/ @@ -74,13 +74,12 @@ * Function: H5FS_get_cparam_test * * Purpose: Retrieve the parameters used to create the free-space manager + * similar to H5HF_get_cparam_test() * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: similar to H5HF_get_cparam_test() - * Vailin Choi; August 25th, 2008 + * Programmer: Vailin Choi + * August 25th, 2008 * *------------------------------------------------------------------------- */ @@ -106,13 +105,13 @@ H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) /*------------------------------------------------------------------------- * Function: H5FS_cmp_cparam_test * - * Purpose: Compare the parameters used to create the fractal heap + * Purpose: Compare the parameters used to create the free space manager + * similar to H5HF_cmp_cparam_test() * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: similar to H5HF_cmp_cparam_test() - * Vailin Choi; August 25th, 2008 + * Programmer: Vailin Choi + * August 25th, 2008 * *------------------------------------------------------------------------- */ diff --git a/src/H5Fint.c b/src/H5Fint.c index f15b60b..33db083 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -388,8 +388,8 @@ static int H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) { H5F_olist_t *olist = (H5F_olist_t *)key; /* Alias for search info */ - int ret_value = H5_ITER_CONT; /* Return value */ hbool_t add_obj = FALSE; + int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -403,7 +403,7 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) || (!olist->file_info.local && ( !olist->file_info.ptr.shared || (olist->file_info.ptr.shared && ((H5F_t*)obj_ptr)->shared == olist->file_info.ptr.shared) ))) { add_obj = TRUE; - } + } /* end if */ } /* end if */ else { /* either count opened object IDs or put the IDs on the list */ H5O_loc_t *oloc; /* Group entry info for object */ @@ -456,7 +456,7 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) } /* end if */ } /* end else */ - if(TRUE==add_obj) { + if(add_obj) { /* Add the object's ID to the ID list, if appropriate */ if(olist->obj_id_list) { olist->obj_id_list[olist->list_index] = obj_id; @@ -471,9 +471,9 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) * we have filled up the array. Otherwise return H5_ITER_CONT(RET_VALUE is * preset to H5_ITER_CONT) because H5I_iterate needs the return value of * H5_ITER_CONT to continue the iteration. */ - if(olist->max_nobjs>0 && olist->list_index>=olist->max_nobjs) + if(olist->max_nobjs > 0 && olist->list_index >= olist->max_nobjs) HGOTO_DONE(H5_ITER_STOP) /* Indicate that the iterator should stop */ - } + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 50f6b06..c6b1c83 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -934,6 +934,7 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) HDassert(driver_size <= H5F_MAX_DRVINFOBLOCK_SIZE); /* Encode driver-specific data */ + HDmemset(dbuf, 0, sizeof(dbuf)); if(H5FD_sb_encode(f->shared->lf, info.name, dbuf) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information") @@ -525,101 +525,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_get_create_plist - * - * Purpose: Private function for H5Gget_create_plist - * - * Return: Success: ID for a copy of the group creation - * property list. The property list ID should be - * released by calling H5Pclose(). - * - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Tuesday, October 25, 2005 - * - *------------------------------------------------------------------------- - */ -hid_t -H5G_get_create_plist(H5G_t *grp) -{ - H5O_linfo_t linfo; /* Link info message */ - htri_t ginfo_exists; - htri_t linfo_exists; - htri_t pline_exists; - H5P_genplist_t *gcpl_plist; - H5P_genplist_t *new_plist; - hid_t new_gcpl_id = FAIL; - hid_t ret_value = FAIL; - - FUNC_ENTER_NOAPI(FAIL) - - /* Copy the default group creation property list */ - if(NULL == (gcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_GROUP_CREATE_ID_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get default group creation property list") - if((new_gcpl_id = H5P_copy_plist(gcpl_plist, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to copy the creation property list") - if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_gcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - - /* Retrieve any object creation properties */ - if(H5O_get_create_plist(&grp->oloc, H5AC_ind_dxpl_id, new_plist) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object creation info") - - /* Check for the group having a group info message */ - if((ginfo_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") - if(ginfo_exists) { - H5O_ginfo_t ginfo; /* Group info message */ - - /* Read the group info */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, &ginfo, H5AC_ind_dxpl_id)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info") - - /* Set the group info for the property list */ - if(H5P_set(new_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info") - } /* end if */ - - /* Check for the group having a link info message */ - if((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") - if(linfo_exists) { - /* Set the link info for the property list */ - if(H5P_set(new_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set link info") - } /* end if */ - - /* Check for the group having a pipeline message */ - if((pline_exists = H5O_msg_exists(&(grp->oloc), H5O_PLINE_ID, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header") - if(pline_exists) { - H5O_pline_t pline; /* Pipeline message */ - - /* Read the pipeline */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_PLINE_ID, &pline, H5AC_ind_dxpl_id)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link pipeline") - - /* Set the pipeline for the property list */ - if(H5P_set(new_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set link pipeline") - } /* end if */ - - /* Set the return value */ - ret_value = new_gcpl_id; - -done: - if(ret_value < 0) { - if(new_gcpl_id > 0) - if(H5I_dec_app_ref(new_gcpl_id) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't free") - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_get_create_plist() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_info * * Purpose: Retrieve information about a group. diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index 104e6b3..b464930 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -83,7 +83,8 @@ static herr_t H5G_dense_btree2_corder_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5G_dense_btree2_corder_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); /* v2 B-tree driver callbacks for 'name' index */ static herr_t H5G_dense_btree2_name_store(void *native, const void *udata); @@ -92,7 +93,8 @@ static herr_t H5G_dense_btree2_name_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5G_dense_btree2_name_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); /* Fractal heap function callbacks */ static herr_t H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data); @@ -112,7 +114,9 @@ const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */ H5G_dense_btree2_name_compare, /* Record comparison callback */ H5G_dense_btree2_name_encode, /* Record encoding callback */ H5G_dense_btree2_name_decode, /* Record decoding callback */ - H5G_dense_btree2_name_debug /* Record debugging callback */ + H5G_dense_btree2_name_debug, /* Record debugging callback */ + NULL, /* Create debugging context */ + NULL /* Destroy debugging context */ }}; /* v2 B-tree class for indexing 'creation order' field of links */ @@ -126,7 +130,9 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */ H5G_dense_btree2_corder_compare, /* Record comparison callback */ H5G_dense_btree2_corder_encode, /* Record encoding callback */ H5G_dense_btree2_corder_decode, /* Record decoding callback */ - H5G_dense_btree2_corder_debug /* Record debugging callback */ + H5G_dense_btree2_corder_debug, /* Record debugging callback */ + NULL, /* Create debugging context */ + NULL /* Destroy debugging context */ }}; /*****************************/ @@ -356,7 +362,8 @@ H5G_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UN *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord; unsigned u; /* Local index variable */ @@ -520,7 +527,8 @@ H5G_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_ *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5G_dense_bt2_corder_rec_t *nrecord = (const H5G_dense_bt2_corder_rec_t *)_nrecord; unsigned u; /* Local index variable */ diff --git a/src/H5Gdense.c b/src/H5Gdense.c index ab0547b..e8fa237 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -322,8 +322,9 @@ HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len); HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam)); bt2_cparam.cls = H5G_BT2_NAME; bt2_cparam.node_size = (size_t)H5G_NAME_BT2_NODE_SIZE; + H5_CHECK_OVERFLOW(fheap_id_len, /* From: */ hsize_t, /* To: */ uint32_t); bt2_cparam.rrec_size = 4 + /* Name's hash value */ - fheap_id_len; /* Fractal heap ID */ + (uint32_t)fheap_id_len; /* Fractal heap ID */ bt2_cparam.split_percent = H5G_NAME_BT2_SPLIT_PERC; bt2_cparam.merge_percent = H5G_NAME_BT2_MERGE_PERC; if(NULL == (bt2_name = H5B2_create(f, dxpl_id, &bt2_cparam, NULL))) @@ -342,8 +343,9 @@ HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr) HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam)); bt2_cparam.cls = H5G_BT2_CORDER; bt2_cparam.node_size = (size_t)H5G_CORDER_BT2_NODE_SIZE; - bt2_cparam.rrec_size = 8 + /* Creation order value */ - fheap_id_len; /* Fractal heap ID */ + H5_CHECK_OVERFLOW(fheap_id_len, /* From: */ hsize_t, /* To: */ uint32_t); + bt2_cparam.rrec_size = 8 + /* Creation order value */ + (uint32_t)fheap_id_len; /* Fractal heap ID */ bt2_cparam.split_percent = H5G_CORDER_BT2_SPLIT_PERC; bt2_cparam.merge_percent = H5G_CORDER_BT2_MERGE_PERC; if(NULL == (bt2_corder = H5B2_create(f, dxpl_id, &bt2_cparam, NULL))) diff --git a/src/H5Gent.c b/src/H5Gent.c index 8df8414..6020028 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -411,8 +411,8 @@ H5G__ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name, * Add the new name to the heap. */ name_offset = H5HL_insert(f, dxpl_id, heap, HDstrlen(name) + 1, name); - if(0 == name_offset || (size_t)(-1) == name_offset) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap") + if(0 == name_offset || UFAIL == name_offset) + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap") ent->name_off = name_offset; /* Build correct information for symbol table entry based on link type */ @@ -505,7 +505,7 @@ H5G__ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name, size_t lnk_offset; /* Offset to sym-link value */ /* Insert link value into local heap */ - if((size_t)(-1) == (lnk_offset = H5HL_insert(f, dxpl_id, heap, + if(UFAIL == (lnk_offset = H5HL_insert(f, dxpl_id, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap") diff --git a/src/H5Gint.c b/src/H5Gint.c index ea8288c..cba4806 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -1160,3 +1160,97 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_visit() */ + +/*------------------------------------------------------------------------- + * Function: H5G_get_create_plist + * + * Purpose: Private function for H5Gget_create_plist + * + * Return: Success: ID for a copy of the group creation + * property list. The property list ID should be + * released by calling H5Pclose(). + * + * Failure: FAIL + * + * Programmer: Quincey Koziol + * Tuesday, October 25, 2005 + * + *------------------------------------------------------------------------- + */ +hid_t +H5G_get_create_plist(H5G_t *grp) +{ + H5O_linfo_t linfo; /* Link info message */ + htri_t ginfo_exists; + htri_t linfo_exists; + htri_t pline_exists; + H5P_genplist_t *gcpl_plist; + H5P_genplist_t *new_plist; + hid_t new_gcpl_id = FAIL; + hid_t ret_value = FAIL; + + FUNC_ENTER_NOAPI(FAIL) + + /* Copy the default group creation property list */ + if(NULL == (gcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_GROUP_CREATE_ID_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get default group creation property list") + if((new_gcpl_id = H5P_copy_plist(gcpl_plist, TRUE)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to copy the creation property list") + if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_gcpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") + + /* Retrieve any object creation properties */ + if(H5O_get_create_plist(&grp->oloc, H5AC_ind_dxpl_id, new_plist) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object creation info") + + /* Check for the group having a group info message */ + if((ginfo_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID, H5AC_ind_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + if(ginfo_exists) { + H5O_ginfo_t ginfo; /* Group info message */ + + /* Read the group info */ + if(NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, &ginfo, H5AC_ind_dxpl_id)) + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info") + + /* Set the group info for the property list */ + if(H5P_set(new_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info") + } /* end if */ + + /* Check for the group having a link info message */ + if((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_ind_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + if(linfo_exists) { + /* Set the link info for the property list */ + if(H5P_set(new_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set link info") + } /* end if */ + + /* Check for the group having a pipeline message */ + if((pline_exists = H5O_msg_exists(&(grp->oloc), H5O_PLINE_ID, H5AC_ind_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header") + if(pline_exists) { + H5O_pline_t pline; /* Pipeline message */ + + /* Read the pipeline */ + if(NULL == H5O_msg_read(&(grp->oloc), H5O_PLINE_ID, &pline, H5AC_ind_dxpl_id)) + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link pipeline") + + /* Set the pipeline for the property list */ + if(H5P_poke(new_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set link pipeline") + } /* end if */ + + /* Set the return value */ + ret_value = new_gcpl_id; + +done: + if(ret_value < 0) { + if(new_gcpl_id > 0) + if(H5I_dec_app_ref(new_gcpl_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't free") + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_get_create_plist() */ diff --git a/src/H5Gloc.c b/src/H5Gloc.c index eb8cd78..3fcbd09 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -259,7 +259,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__loc_copy + * Function: H5G_loc_copy * * Purpose: Copy over information for a location * @@ -271,11 +271,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G__loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth) +H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(FAIL) /* Check args. */ HDassert(dst); @@ -289,7 +289,7 @@ H5G__loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__loc_copy() */ +} /* end H5G_loc_copy() */ /*------------------------------------------------------------------------- @@ -388,7 +388,7 @@ H5G_loc_find_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, /* (Group traversal callbacks are responsible for either taking ownership * of the group location for the object, or freeing it. - QAK) */ - H5G__loc_copy(udata->loc, obj_loc, H5_COPY_SHALLOW); + H5G_loc_copy(udata->loc, obj_loc, H5_COPY_SHALLOW); *own_loc = H5G_OWN_OBJ_LOC; done: diff --git a/src/H5Gnode.c b/src/H5Gnode.c index e25a17e..4d299dc 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -119,7 +119,7 @@ H5B_class_t H5B_SNODE[1] = {{ H5G_node_remove, /*remove */ H5G_node_decode_key, /*decode */ H5G_node_encode_key, /*encode */ - H5G_node_debug_key, /*debug */ + H5G_node_debug_key /*debug */ }}; /* Declare a free list to manage the H5G_node_t struct */ diff --git a/src/H5Goh.c b/src/H5Goh.c index c516713..bde540c 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -53,7 +53,7 @@ static hid_t H5O_group_open(const H5G_loc_t *obj_loc, hid_t lapl_id, static void *H5O_group_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc, hid_t dxpl_id); static H5O_loc_t *H5O_group_get_oloc(hid_t obj_id); -static herr_t H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, +static herr_t H5O_group_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info); @@ -333,7 +333,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) +H5O_group_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) { htri_t exists; /* Flag if header message of interest exists */ H5HF_t *fheap = NULL; /* Fractal heap handle */ @@ -344,7 +344,9 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, oh->cache_info.addr, FAIL) /* Sanity check */ - HDassert(f); + HDassert(loc); + HDassert(loc->file); + HDassert(H5F_addr_defined(loc->addr)); HDassert(oh); HDassert(bh_info); @@ -355,13 +357,13 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) H5O_linfo_t linfo; /* Link info message */ /* Get "new style" group info */ - if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_LINFO_ID, &linfo)) + if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_LINFO_ID, &linfo)) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't read LINFO message") /* Check if name index available */ if(H5F_addr_defined(linfo.name_bt2_addr)) { /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(f, dxpl_id, linfo.name_bt2_addr, NULL))) + if(NULL == (bt2_name = H5B2_open(loc->file, dxpl_id, linfo.name_bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Get name index B-tree size */ @@ -372,7 +374,7 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) /* Check if creation order index available */ if(H5F_addr_defined(linfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ - if(NULL == (bt2_corder = H5B2_open(f, dxpl_id, linfo.corder_bt2_addr, NULL))) + if(NULL == (bt2_corder = H5B2_open(loc->file, dxpl_id, linfo.corder_bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Get creation order index B-tree size */ @@ -383,7 +385,7 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) /* Get fractal heap size, if available */ if(H5F_addr_defined(linfo.fheap_addr)) { /* Open the fractal heap for links */ - if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo.fheap_addr))) + if(NULL == (fheap = H5HF_open(loc->file, dxpl_id, linfo.fheap_addr))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Get heap storage size */ @@ -395,11 +397,11 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) H5O_stab_t stab; /* Info about symbol table */ /* Must be "old style" group, get symbol table message */ - if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_STAB_ID, &stab)) + if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_STAB_ID, &stab)) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't find LINFO nor STAB messages") /* Get symbol table size info */ - if(H5G__stab_bh_size(f, dxpl_id, &stab, bh_info) < 0) + if(H5G__stab_bh_size(loc->file, dxpl_id, &stab, bh_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve symbol table size info") } /* end else */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 1457e62..4cb6f9b 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -516,7 +516,6 @@ H5_DLL herr_t H5G__name_init(H5G_name_t *name, const char *path); /* * These functions operate on group "locations" */ -H5_DLL herr_t H5G__loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth); H5_DLL herr_t H5G__loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, H5O_type_t obj_type, const void *crt_info, hid_t dxpl_id); diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index baf4209..1ab5522 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -280,6 +280,7 @@ H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char * These functions operate on group "locations" */ H5_DLL herr_t H5G_loc(hid_t loc_id, H5G_loc_t *loc); +H5_DLL herr_t H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth); H5_DLL herr_t H5G_loc_find(const H5G_loc_t *loc, const char *name, H5G_loc_t *obj_loc/*out*/, hid_t lapl_id, hid_t dxpl_id); H5_DLL herr_t H5G_loc_find_by_idx(H5G_loc_t *loc, const char *group_name, diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 7f4b8df..3a7cd9e 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -156,16 +156,16 @@ H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create B-tree") /* Create symbol table private heap */ - if(H5HL_create(f, dxpl_id, size_hint, &(stab->heap_addr)/*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create heap") + if(FAIL == H5HL_create(f, dxpl_id, size_hint, &(stab->heap_addr)/*out*/)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create heap") /* Pin the heap down in memory */ if(NULL == (heap = H5HL_protect(f, dxpl_id, stab->heap_addr, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") /* Insert name into the heap */ - if((size_t)(-1) == (name_offset = H5HL_insert(f, dxpl_id, heap, (size_t)1, ""))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert name into heap") + if(UFAIL == (name_offset = H5HL_insert(f, dxpl_id, heap, (size_t)1, ""))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert name into heap") /* * B-tree's won't work if the first name isn't at the beginning @@ -175,7 +175,7 @@ H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t done: /* Release resources */ - if(heap && H5HL_unprotect(heap) < 0) + if(heap && FAIL == H5HL_unprotect(heap)) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 5121f45..4d84e9f 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -201,7 +201,7 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, grp_loc_copy.path = &grp_path_copy; grp_loc_copy.oloc = &grp_oloc_copy; H5G_loc_reset(&grp_loc_copy); - if(H5G__loc_copy(&grp_loc_copy, grp_loc, H5_COPY_DEEP) < 0) + if(H5G_loc_copy(&grp_loc_copy, grp_loc, H5_COPY_DEEP) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object location") /* Create a group ID to pass to the user-defined callback */ @@ -263,7 +263,7 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, H5G_loc_free(obj_loc); /* Copy new object's location information */ - H5G__loc_copy(obj_loc, &new_loc, H5_COPY_DEEP); + H5G_loc_copy(obj_loc, &new_loc, H5_COPY_DEEP); /* Hold the file open until we free this object header (otherwise the * object location will be invalidated when the file closes). @@ -344,7 +344,7 @@ H5G_traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, /* ("tracking the names properly" means to ignore the effects of the * link traversal on the object's & group's paths - QAK) */ - H5G__loc_copy(&tmp_grp_loc, grp_loc, H5_COPY_DEEP); + H5G_loc_copy(&tmp_grp_loc, grp_loc, H5_COPY_DEEP); tmp_grp_loc_set = TRUE; /* Hold the object's group hier. path to restore later */ @@ -544,7 +544,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, #endif /* H5_USING_MEMCHECKER */ /* Deep copy of the starting location to group location */ - if(H5G__loc_copy(&grp_loc, &loc, H5_COPY_DEEP) < 0) + if(H5G_loc_copy(&grp_loc, &loc, H5_COPY_DEEP) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to copy location") group_copy = TRUE; @@ -761,7 +761,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, /* Transfer "ownership" of the object's information to the group object */ H5G_loc_free(&grp_loc); - H5G__loc_copy(&grp_loc, &obj_loc, H5_COPY_SHALLOW); + H5G_loc_copy(&grp_loc, &obj_loc, H5_COPY_SHALLOW); H5G_loc_reset(&obj_loc); obj_loc_valid = FALSE; diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c index 2f3d0e4..d82de93 100644 --- a/src/H5HFbtree2.c +++ b/src/H5HFbtree2.c @@ -68,40 +68,50 @@ typedef struct H5HF_huge_bt2_ctx_t { /* v2 B-tree driver callbacks */ -static void *H5HF_huge_bt2_crt_context(void *udata); -static herr_t H5HF_huge_bt2_dst_context(void *ctx); - -static herr_t H5HF_huge_bt2_indir_store(void *native, const void *udata); -static herr_t H5HF_huge_bt2_indir_compare(const void *rec1, const void *rec2); -static herr_t H5HF_huge_bt2_indir_encode(uint8_t *raw, const void *native, +/* Common callbacks */ +static void *H5HF__huge_bt2_crt_context(void *udata); +static herr_t H5HF__huge_bt2_dst_context(void *ctx); +static void *H5HF__huge_bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); + +/* Callbacks for indirect objects */ +static herr_t H5HF__huge_bt2_indir_store(void *native, const void *udata); +static herr_t H5HF__huge_bt2_indir_compare(const void *rec1, const void *rec2); +static herr_t H5HF__huge_bt2_indir_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5HF_huge_bt2_indir_decode(const uint8_t *raw, void *native, +static herr_t H5HF__huge_bt2_indir_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5HF_huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5HF__huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); -static herr_t H5HF_huge_bt2_filt_indir_store(void *native, const void *udata); -static herr_t H5HF_huge_bt2_filt_indir_compare(const void *rec1, const void *rec2); -static herr_t H5HF_huge_bt2_filt_indir_encode(uint8_t *raw, const void *native, +/* Callbacks for filtered indirect objects */ +static herr_t H5HF__huge_bt2_filt_indir_store(void *native, const void *udata); +static herr_t H5HF__huge_bt2_filt_indir_compare(const void *rec1, const void *rec2); +static herr_t H5HF__huge_bt2_filt_indir_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5HF_huge_bt2_filt_indir_decode(const uint8_t *raw, void *native, +static herr_t H5HF__huge_bt2_filt_indir_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5HF_huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5HF__huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); -static herr_t H5HF_huge_bt2_dir_store(void *native, const void *udata); -static herr_t H5HF_huge_bt2_dir_compare(const void *rec1, const void *rec2); -static herr_t H5HF_huge_bt2_dir_encode(uint8_t *raw, const void *native, +/* Callbacks for direct objects */ +static herr_t H5HF__huge_bt2_dir_store(void *native, const void *udata); +static herr_t H5HF__huge_bt2_dir_compare(const void *rec1, const void *rec2); +static herr_t H5HF__huge_bt2_dir_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5HF_huge_bt2_dir_decode(const uint8_t *raw, void *native, +static herr_t H5HF__huge_bt2_dir_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5HF_huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5HF__huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); -static herr_t H5HF_huge_bt2_filt_dir_store(void *native, const void *udata); -static herr_t H5HF_huge_bt2_filt_dir_compare(const void *rec1, const void *rec2); -static herr_t H5HF_huge_bt2_filt_dir_encode(uint8_t *raw, const void *native, +/* Callbacks for filtered direct objects */ +static herr_t H5HF__huge_bt2_filt_dir_store(void *native, const void *udata); +static herr_t H5HF__huge_bt2_filt_dir_compare(const void *rec1, const void *rec2); +static herr_t H5HF__huge_bt2_filt_dir_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5HF_huge_bt2_filt_dir_decode(const uint8_t *raw, void *native, +static herr_t H5HF__huge_bt2_filt_dir_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5HF_huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5HF__huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); /*********************/ /* Package Variables */ @@ -111,13 +121,15 @@ const H5B2_class_t H5HF_HUGE_BT2_INDIR[1]={{ /* B-tree class information */ H5B2_FHEAP_HUGE_INDIR_ID, /* Type of B-tree */ "H5B2_FHEAP_HUGE_INDIR_ID", /* Name of B-tree class */ sizeof(H5HF_huge_bt2_indir_rec_t), /* Size of native record */ - H5HF_huge_bt2_crt_context, /* Create client callback context */ - H5HF_huge_bt2_dst_context, /* Destroy client callback context */ - H5HF_huge_bt2_indir_store, /* Record storage callback */ - H5HF_huge_bt2_indir_compare, /* Record comparison callback */ - H5HF_huge_bt2_indir_encode, /* Record encoding callback */ - H5HF_huge_bt2_indir_decode, /* Record decoding callback */ - H5HF_huge_bt2_indir_debug /* Record debugging callback */ + H5HF__huge_bt2_crt_context, /* Create client callback context */ + H5HF__huge_bt2_dst_context, /* Destroy client callback context */ + H5HF__huge_bt2_indir_store, /* Record storage callback */ + H5HF__huge_bt2_indir_compare, /* Record comparison callback */ + H5HF__huge_bt2_indir_encode, /* Record encoding callback */ + H5HF__huge_bt2_indir_decode, /* Record decoding callback */ + H5HF__huge_bt2_indir_debug, /* Record debugging callback */ + H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ + H5HF__huge_bt2_dst_context /* Destroy debugging context */ }}; /* v2 B-tree class for indirectly accessed, filtered 'huge' objects */ @@ -125,13 +137,15 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_INDIR[1]={{ /* B-tree class information */ H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* Type of B-tree */ "H5B2_FHEAP_HUGE_FILT_INDIR_ID", /* Name of B-tree class */ sizeof(H5HF_huge_bt2_filt_indir_rec_t), /* Size of native record */ - H5HF_huge_bt2_crt_context, /* Create client callback context */ - H5HF_huge_bt2_dst_context, /* Destroy client callback context */ - H5HF_huge_bt2_filt_indir_store, /* Record storage callback */ - H5HF_huge_bt2_filt_indir_compare, /* Record comparison callback */ - H5HF_huge_bt2_filt_indir_encode, /* Record encoding callback */ - H5HF_huge_bt2_filt_indir_decode, /* Record decoding callback */ - H5HF_huge_bt2_filt_indir_debug /* Record debugging callback */ + H5HF__huge_bt2_crt_context, /* Create client callback context */ + H5HF__huge_bt2_dst_context, /* Destroy client callback context */ + H5HF__huge_bt2_filt_indir_store, /* Record storage callback */ + H5HF__huge_bt2_filt_indir_compare, /* Record comparison callback */ + H5HF__huge_bt2_filt_indir_encode, /* Record encoding callback */ + H5HF__huge_bt2_filt_indir_decode, /* Record decoding callback */ + H5HF__huge_bt2_filt_indir_debug, /* Record debugging callback */ + H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ + H5HF__huge_bt2_dst_context /* Destroy debugging context */ }}; /* v2 B-tree class for directly accessed 'huge' objects */ @@ -139,13 +153,15 @@ const H5B2_class_t H5HF_HUGE_BT2_DIR[1]={{ /* B-tree class information */ H5B2_FHEAP_HUGE_DIR_ID, /* Type of B-tree */ "H5B2_FHEAP_HUGE_DIR_ID", /* Name of B-tree class */ sizeof(H5HF_huge_bt2_dir_rec_t), /* Size of native record */ - H5HF_huge_bt2_crt_context, /* Create client callback context */ - H5HF_huge_bt2_dst_context, /* Destroy client callback context */ - H5HF_huge_bt2_dir_store, /* Record storage callback */ - H5HF_huge_bt2_dir_compare, /* Record comparison callback */ - H5HF_huge_bt2_dir_encode, /* Record encoding callback */ - H5HF_huge_bt2_dir_decode, /* Record decoding callback */ - H5HF_huge_bt2_dir_debug /* Record debugging callback */ + H5HF__huge_bt2_crt_context, /* Create client callback context */ + H5HF__huge_bt2_dst_context, /* Destroy client callback context */ + H5HF__huge_bt2_dir_store, /* Record storage callback */ + H5HF__huge_bt2_dir_compare, /* Record comparison callback */ + H5HF__huge_bt2_dir_encode, /* Record encoding callback */ + H5HF__huge_bt2_dir_decode, /* Record decoding callback */ + H5HF__huge_bt2_dir_debug, /* Record debugging callback */ + H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ + H5HF__huge_bt2_dst_context /* Destroy debugging context */ }}; /* v2 B-tree class for directly accessed, filtered 'huge' objects */ @@ -153,13 +169,15 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_DIR[1]={{ /* B-tree class information */ H5B2_FHEAP_HUGE_FILT_DIR_ID, /* Type of B-tree */ "H5B2_FHEAP_HUGE_FILT_DIR_ID", /* Name of B-tree class */ sizeof(H5HF_huge_bt2_filt_dir_rec_t), /* Size of native record */ - H5HF_huge_bt2_crt_context, /* Create client callback context */ - H5HF_huge_bt2_dst_context, /* Destroy client callback context */ - H5HF_huge_bt2_filt_dir_store, /* Record storage callback */ - H5HF_huge_bt2_filt_dir_compare, /* Record comparison callback */ - H5HF_huge_bt2_filt_dir_encode, /* Record encoding callback */ - H5HF_huge_bt2_filt_dir_decode, /* Record decoding callback */ - H5HF_huge_bt2_filt_dir_debug /* Record debugging callback */ + H5HF__huge_bt2_crt_context, /* Create client callback context */ + H5HF__huge_bt2_dst_context, /* Destroy client callback context */ + H5HF__huge_bt2_filt_dir_store, /* Record storage callback */ + H5HF__huge_bt2_filt_dir_compare, /* Record comparison callback */ + H5HF__huge_bt2_filt_dir_encode, /* Record encoding callback */ + H5HF__huge_bt2_filt_dir_decode, /* Record decoding callback */ + H5HF__huge_bt2_filt_dir_debug, /* Record debugging callback */ + H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ + H5HF__huge_bt2_dst_context /* Destroy debugging context */ }}; /*****************************/ @@ -177,7 +195,7 @@ H5FL_DEFINE_STATIC(H5HF_huge_bt2_ctx_t); /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_crt_context + * Function: H5HF__huge_bt2_crt_context * * Purpose: Create client callback context * @@ -192,13 +210,13 @@ H5FL_DEFINE_STATIC(H5HF_huge_bt2_ctx_t); *------------------------------------------------------------------------- */ static void * -H5HF_huge_bt2_crt_context(void *_f) +H5HF__huge_bt2_crt_context(void *_f) { H5F_t *f = (H5F_t *)_f; /* User data for building callback context */ H5HF_huge_bt2_ctx_t *ctx; /* Callback context structure */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -216,11 +234,11 @@ H5HF_huge_bt2_crt_context(void *_f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_bt2_crt_context() */ +} /* H5HF__huge_bt2_crt_context() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_dst_context + * Function: H5HF__huge_bt2_dst_context * * Purpose: Destroy client callback context * @@ -235,11 +253,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_dst_context(void *_ctx) +H5HF__huge_bt2_dst_context(void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -248,11 +266,51 @@ H5HF_huge_bt2_dst_context(void *_ctx) ctx = H5FL_FREE(H5HF_huge_bt2_ctx_t, ctx); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_dst_context() */ +} /* H5HF__huge_bt2_dst_context() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF__huge_bt2_crt_dbg_context + * + * Purpose: Create context for debugging callback + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Quincey Koziol + * Tuesday, December 1, 2009 + * + *------------------------------------------------------------------------- + */ +static void * +H5HF__huge_bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr) +{ + H5HF_huge_bt2_ctx_t *ctx; /* Callback context structure */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(f); + + /* Allocate callback context */ + if(NULL == (ctx = H5FL_MALLOC(H5HF_huge_bt2_ctx_t))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context") + + /* Determine the size of addresses & lengths in the file */ + ctx->sizeof_addr = H5F_SIZEOF_ADDR(f); + ctx->sizeof_size = H5F_SIZEOF_SIZE(f); + + /* Set return value */ + ret_value = ctx; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5HF__huge_bt2_crt_dbg_context() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_indir_found + * Function: H5HF__huge_bt2_indir_found * * Purpose: Retrieve record for indirectly accessed 'huge' object, when * it's found in the v2 B-tree @@ -266,24 +324,18 @@ H5HF_huge_bt2_dst_context(void *_ctx) *------------------------------------------------------------------------- */ herr_t -H5HF_huge_bt2_indir_found(const void *nrecord, void *op_data) +H5HF__huge_bt2_indir_found(const void *nrecord, void *op_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#ifdef QAK -HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_indir_found", - ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->addr, - ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->len, - ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->id); -#endif /* QAK */ + FUNC_ENTER_PACKAGE_NOERR + *(H5HF_huge_bt2_indir_rec_t *)op_data = *(const H5HF_huge_bt2_indir_rec_t *)nrecord; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_indir_found() */ +} /* H5HF__huge_bt2_indir_found() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_indir_remove + * Function: H5HF__huge_bt2_indir_remove * * Purpose: Free space for indirectly accessed 'huge' object, as v2 B-tree * is being deleted or v2 B-tree node is removed @@ -297,12 +349,12 @@ HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_indir_found", *------------------------------------------------------------------------- */ herr_t -H5HF_huge_bt2_indir_remove(const void *nrecord, void *_udata) +H5HF__huge_bt2_indir_remove(const void *nrecord, void *_udata) { H5HF_huge_remove_ud_t *udata = (H5HF_huge_remove_ud_t *)_udata; /* User callback data */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Free the space in the file for the object being removed */ if(H5MF_xfree(udata->hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, udata->dxpl_id, ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->addr, ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->len) < 0) @@ -313,11 +365,11 @@ H5HF_huge_bt2_indir_remove(const void *nrecord, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_bt2_indir_remove() */ +} /* H5HF__huge_bt2_indir_remove() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_indir_store + * Function: H5HF__huge_bt2_indir_store * * Purpose: Store native information into record for v2 B-tree * @@ -330,18 +382,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_indir_store(void *nrecord, const void *udata) +H5HF__huge_bt2_indir_store(void *nrecord, const void *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR *(H5HF_huge_bt2_indir_rec_t *)nrecord = *(const H5HF_huge_bt2_indir_rec_t *)udata; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_indir_store() */ +} /* H5HF__huge_bt2_indir_store() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_indir_compare + * Function: H5HF__huge_bt2_indir_compare * * Purpose: Compare two native information records, according to some key * @@ -355,25 +407,16 @@ H5HF_huge_bt2_indir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_indir_compare(const void *_rec1, const void *_rec2) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#ifdef QAK +H5HF__huge_bt2_indir_compare(const void *_rec1, const void *_rec2) { -const H5HF_huge_bt2_indir_rec_t *rec1 = (const H5HF_huge_bt2_indir_rec_t *)_rec1; -const H5HF_huge_bt2_indir_rec_t *rec2 = (const H5HF_huge_bt2_indir_rec_t *)_rec2; + FUNC_ENTER_STATIC_NOERR -HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_indir_compare", rec1->addr, rec1->len, rec1->id); -HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_indir_compare", rec2->addr, rec2->len, rec2->id); -} -#endif /* QAK */ FUNC_LEAVE_NOAPI((herr_t)(((const H5HF_huge_bt2_indir_rec_t *)_rec1)->id - ((const H5HF_huge_bt2_indir_rec_t *)_rec2)->id)) -} /* H5HF_huge_bt2_indir_compare() */ +} /* H5HF__huge_bt2_indir_compare() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_indir_encode + * Function: H5HF__huge_bt2_indir_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -386,12 +429,12 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_indir_compare", *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) +H5HF__huge_bt2_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5HF_huge_bt2_indir_rec_t *nrecord = (const H5HF_huge_bt2_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -402,11 +445,11 @@ H5HF_huge_bt2_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) H5F_ENCODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_indir_encode() */ +} /* H5HF__huge_bt2_indir_encode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_indir_decode + * Function: H5HF__huge_bt2_indir_decode * * Purpose: Decode raw disk form of record into native form * @@ -419,12 +462,12 @@ H5HF_huge_bt2_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) +H5HF__huge_bt2_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ H5HF_huge_bt2_indir_rec_t *nrecord = (H5HF_huge_bt2_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -435,11 +478,11 @@ H5HF_huge_bt2_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) H5F_DECODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_indir_decode() */ +} /* H5HF__huge_bt2_indir_decode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_indir_debug + * Function: H5HF__huge_bt2_indir_debug * * Purpose: Debug native form of record * @@ -452,21 +495,22 @@ H5HF_huge_bt2_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5HF__huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5HF_huge_bt2_indir_rec_t *nrecord = (const H5HF_huge_bt2_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%a, %Hu, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->id); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_indir_debug() */ +} /* H5HF__huge_bt2_indir_debug() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_indir_found + * Function: H5HF__huge_bt2_filt_indir_found * * Purpose: Retrieve record for indirectly accessed, filtered 'huge' object, * when it's found in the v2 B-tree @@ -480,26 +524,18 @@ H5HF_huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, const void *_nre *------------------------------------------------------------------------- */ herr_t -H5HF_huge_bt2_filt_indir_found(const void *nrecord, void *op_data) +H5HF__huge_bt2_filt_indir_found(const void *nrecord, void *op_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#ifdef QAK -HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_bt2_filt_indir_found", - ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->addr, - ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->len, - ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->filter_mask, - ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->obj_size, - ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->id); -#endif /* QAK */ + FUNC_ENTER_PACKAGE_NOERR + *(H5HF_huge_bt2_filt_indir_rec_t *)op_data = *(const H5HF_huge_bt2_filt_indir_rec_t *)nrecord; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_indir_found() */ +} /* H5HF__huge_bt2_filt_indir_found() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_indir_remove + * Function: H5HF__huge_bt2_filt_indir_remove * * Purpose: Free space for indirectly accessed, filtered 'huge' object, as * v2 B-tree is being deleted or v2 B-tree node is removed @@ -513,12 +549,12 @@ HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_bt2_filt *------------------------------------------------------------------------- */ herr_t -H5HF_huge_bt2_filt_indir_remove(const void *nrecord, void *_udata) +H5HF__huge_bt2_filt_indir_remove(const void *nrecord, void *_udata) { H5HF_huge_remove_ud_t *udata = (H5HF_huge_remove_ud_t *)_udata; /* User callback data */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Free the space in the file for the object being removed */ if(H5MF_xfree(udata->hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, udata->dxpl_id, ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->addr, ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->len) < 0) @@ -529,11 +565,11 @@ H5HF_huge_bt2_filt_indir_remove(const void *nrecord, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_bt2_filt_indir_remove() */ +} /* H5HF__huge_bt2_filt_indir_remove() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_indir_store + * Function: H5HF__huge_bt2_filt_indir_store * * Purpose: Store native information into record for v2 B-tree * @@ -546,18 +582,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_indir_store(void *nrecord, const void *udata) +H5HF__huge_bt2_filt_indir_store(void *nrecord, const void *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR *(H5HF_huge_bt2_filt_indir_rec_t *)nrecord = *(const H5HF_huge_bt2_filt_indir_rec_t *)udata; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_indir_store() */ +} /* H5HF__huge_bt2_filt_indir_store() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_indir_compare + * Function: H5HF__huge_bt2_filt_indir_compare * * Purpose: Compare two native information records, according to some key * @@ -571,25 +607,16 @@ H5HF_huge_bt2_filt_indir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_indir_compare(const void *_rec1, const void *_rec2) +H5HF__huge_bt2_filt_indir_compare(const void *_rec1, const void *_rec2) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR -#ifdef QAK -{ -const H5HF_huge_bt2_filt_indir_rec_t *rec1 = (const H5HF_huge_bt2_filt_indir_rec_t *)_rec1; -const H5HF_huge_bt2_filt_indir_rec_t *rec2 = (const H5HF_huge_bt2_filt_indir_rec_t *)_rec2; - -HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_bt2_filt_indir_compare", rec1->addr, rec1->len, rec1->filter_mask, rec1->obj_size, rec1->id); -HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_bt2_filt_indir_compare", rec2->addr, rec2->len, rec2->filter_mask, rec2->obj_size, rec2->id); -} -#endif /* QAK */ FUNC_LEAVE_NOAPI((herr_t)(((const H5HF_huge_bt2_filt_indir_rec_t *)_rec1)->id - ((const H5HF_huge_bt2_filt_indir_rec_t *)_rec2)->id)) -} /* H5HF_huge_bt2_filt_indir_compare() */ +} /* H5HF__huge_bt2_filt_indir_compare() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_indir_encode + * Function: H5HF__huge_bt2_filt_indir_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -602,12 +629,12 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_bt2_filt_in *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) +H5HF__huge_bt2_filt_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5HF_huge_bt2_filt_indir_rec_t *nrecord = (const H5HF_huge_bt2_filt_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -620,11 +647,11 @@ H5HF_huge_bt2_filt_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) H5F_ENCODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_indir_encode() */ +} /* H5HF__huge_bt2_filt_indir_encode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_indir_decode + * Function: H5HF__huge_bt2_filt_indir_decode * * Purpose: Decode raw disk form of record into native form * @@ -637,12 +664,12 @@ H5HF_huge_bt2_filt_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) +H5HF__huge_bt2_filt_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ H5HF_huge_bt2_filt_indir_rec_t *nrecord = (H5HF_huge_bt2_filt_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -655,11 +682,11 @@ H5HF_huge_bt2_filt_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) H5F_DECODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_indir_decode() */ +} /* H5HF__huge_bt2_filt_indir_decode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_indir_debug + * Function: H5HF__huge_bt2_filt_indir_debug * * Purpose: Debug native form of record * @@ -672,21 +699,22 @@ H5HF_huge_bt2_filt_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5HF__huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5HF_huge_bt2_filt_indir_rec_t *nrecord = (const H5HF_huge_bt2_filt_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%a, %Hu, %x, %Hu, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask, nrecord->obj_size, nrecord->id); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_indir_debug() */ +} /* H5HF__huge_bt2_filt_indir_debug() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_dir_remove + * Function: H5HF__huge_bt2_dir_remove * * Purpose: Free space for directly accessed 'huge' object, as v2 B-tree * is being deleted or v2 B-tree node is being removed @@ -700,12 +728,12 @@ H5HF_huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, const void *------------------------------------------------------------------------- */ herr_t -H5HF_huge_bt2_dir_remove(const void *nrecord, void *_udata) +H5HF__huge_bt2_dir_remove(const void *nrecord, void *_udata) { H5HF_huge_remove_ud_t *udata = (H5HF_huge_remove_ud_t *)_udata; /* User callback data */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Free the space in the file for the object being removed */ if(H5MF_xfree(udata->hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, udata->dxpl_id, ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->addr, ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->len) < 0) @@ -716,11 +744,11 @@ H5HF_huge_bt2_dir_remove(const void *nrecord, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_bt2_dir_remove() */ +} /* H5HF__huge_bt2_dir_remove() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_dir_store + * Function: H5HF__huge_bt2_dir_store * * Purpose: Store native information into record for v2 B-tree * @@ -733,18 +761,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_dir_store(void *nrecord, const void *udata) +H5HF__huge_bt2_dir_store(void *nrecord, const void *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR *(H5HF_huge_bt2_dir_rec_t *)nrecord = *(const H5HF_huge_bt2_dir_rec_t *)udata; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_dir_store() */ +} /* H5HF__huge_bt2_dir_store() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_dir_compare + * Function: H5HF__huge_bt2_dir_compare * * Purpose: Compare two native information records, according to some key * @@ -758,18 +786,14 @@ H5HF_huge_bt2_dir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_dir_compare(const void *_rec1, const void *_rec2) +H5HF__huge_bt2_dir_compare(const void *_rec1, const void *_rec2) { const H5HF_huge_bt2_dir_rec_t *rec1 = (const H5HF_huge_bt2_dir_rec_t *)_rec1; const H5HF_huge_bt2_dir_rec_t *rec2 = (const H5HF_huge_bt2_dir_rec_t *)_rec2; herr_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR -#ifdef QAK -HDfprintf(stderr, "%s: rec1 = {%a, %Hu}\n", "H5HF_huge_bt2_dir_compare", rec1->addr, rec1->len); -HDfprintf(stderr, "%s: rec2 = {%a, %Hu}\n", "H5HF_huge_bt2_dir_compare", rec2->addr, rec2->len); -#endif /* QAK */ if(rec1->addr < rec2->addr) ret_value = -1; else if(rec1->addr > rec2->addr) @@ -782,11 +806,11 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu}\n", "H5HF_huge_bt2_dir_compare", rec2->a ret_value = 0; FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_bt2_dir_compare() */ +} /* H5HF__huge_bt2_dir_compare() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_dir_encode + * Function: H5HF__huge_bt2_dir_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -799,12 +823,12 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu}\n", "H5HF_huge_bt2_dir_compare", rec2->a *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) +H5HF__huge_bt2_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5HF_huge_bt2_dir_rec_t *nrecord = (const H5HF_huge_bt2_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -814,11 +838,11 @@ H5HF_huge_bt2_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) H5F_ENCODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_dir_encode() */ +} /* H5HF__huge_bt2_dir_encode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_dir_decode + * Function: H5HF__huge_bt2_dir_decode * * Purpose: Decode raw disk form of record into native form * @@ -831,12 +855,12 @@ H5HF_huge_bt2_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) +H5HF__huge_bt2_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ H5HF_huge_bt2_dir_rec_t *nrecord = (H5HF_huge_bt2_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -846,11 +870,11 @@ H5HF_huge_bt2_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) H5F_DECODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_dir_decode() */ +} /* H5HF__huge_bt2_dir_decode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_dir_debug + * Function: H5HF__huge_bt2_dir_debug * * Purpose: Debug native form of record * @@ -863,21 +887,22 @@ H5HF_huge_bt2_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5HF__huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5HF_huge_bt2_dir_rec_t *nrecord = (const H5HF_huge_bt2_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%a, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_dir_debug() */ +} /* H5HF__huge_bt2_dir_debug() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_dir_found + * Function: H5HF__huge_bt2_filt_dir_found * * Purpose: Retrieve record for directly accessed, filtered 'huge' object, * when it's found in the v2 B-tree @@ -891,25 +916,18 @@ H5HF_huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, const void *_nreco *------------------------------------------------------------------------- */ herr_t -H5HF_huge_bt2_filt_dir_found(const void *nrecord, void *op_data) +H5HF__huge_bt2_filt_dir_found(const void *nrecord, void *op_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#ifdef QAK -HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_found", - ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->addr, - ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->len, - ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->filter_mask, - ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->obj_size); -#endif /* QAK */ + FUNC_ENTER_PACKAGE_NOERR + *(H5HF_huge_bt2_filt_dir_rec_t *)op_data = *(const H5HF_huge_bt2_filt_dir_rec_t *)nrecord; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_dir_found() */ +} /* H5HF__huge_bt2_filt_dir_found() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_dir_remove + * Function: H5HF__huge_bt2_filt_dir_remove * * Purpose: Free space for directly accessed, filtered 'huge' object, as * v2 B-tree is being deleted or v2 B-tree node is removed @@ -923,12 +941,12 @@ HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_ *------------------------------------------------------------------------- */ herr_t -H5HF_huge_bt2_filt_dir_remove(const void *nrecord, void *_udata) +H5HF__huge_bt2_filt_dir_remove(const void *nrecord, void *_udata) { H5HF_huge_remove_ud_t *udata = (H5HF_huge_remove_ud_t *)_udata; /* User callback data */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Free the space in the file for the object being removed */ if(H5MF_xfree(udata->hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, udata->dxpl_id, ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->addr, ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->len) < 0) @@ -939,11 +957,11 @@ H5HF_huge_bt2_filt_dir_remove(const void *nrecord, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_bt2_filt_dir_remove() */ +} /* H5HF__huge_bt2_filt_dir_remove() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_dir_store + * Function: H5HF__huge_bt2_filt_dir_store * * Purpose: Store native information into record for v2 B-tree * @@ -956,18 +974,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_dir_store(void *nrecord, const void *udata) +H5HF__huge_bt2_filt_dir_store(void *nrecord, const void *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR *(H5HF_huge_bt2_filt_dir_rec_t *)nrecord = *(const H5HF_huge_bt2_filt_dir_rec_t *)udata; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_dir_store() */ +} /* H5HF__huge_bt2_filt_dir_store() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_dir_compare + * Function: H5HF__huge_bt2_filt_dir_compare * * Purpose: Compare two native information records, according to some key * @@ -981,18 +999,14 @@ H5HF_huge_bt2_filt_dir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_dir_compare(const void *_rec1, const void *_rec2) +H5HF__huge_bt2_filt_dir_compare(const void *_rec1, const void *_rec2) { const H5HF_huge_bt2_filt_dir_rec_t *rec1 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec1; const H5HF_huge_bt2_filt_dir_rec_t *rec2 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec2; herr_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR -#ifdef QAK -HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_compare", rec1->addr, rec1->len, rec1->filter_mask, rec1->obj_size); -HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_compare", rec2->addr, rec2->len, rec2->filter_mask, rec2->obj_size); -#endif /* QAK */ if(rec1->addr < rec2->addr) ret_value = -1; else if(rec1->addr > rec2->addr) @@ -1005,11 +1019,11 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_com ret_value = 0; FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_bt2_filt_dir_compare() */ +} /* H5HF__huge_bt2_filt_dir_compare() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_dir_encode + * Function: H5HF__huge_bt2_filt_dir_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -1022,12 +1036,12 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_com *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) +H5HF__huge_bt2_filt_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5HF_huge_bt2_filt_dir_rec_t *nrecord = (const H5HF_huge_bt2_filt_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -1039,11 +1053,11 @@ H5HF_huge_bt2_filt_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) H5F_ENCODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_dir_encode() */ +} /* H5HF__huge_bt2_filt_dir_encode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_dir_decode + * Function: H5HF__huge_bt2_filt_dir_decode * * Purpose: Decode raw disk form of record into native form * @@ -1056,12 +1070,12 @@ H5HF_huge_bt2_filt_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) +H5HF__huge_bt2_filt_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ H5HF_huge_bt2_filt_dir_rec_t *nrecord = (H5HF_huge_bt2_filt_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -1073,11 +1087,11 @@ H5HF_huge_bt2_filt_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) H5F_DECODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_dir_decode() */ +} /* H5HF__huge_bt2_filt_dir_decode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_dir_debug + * Function: H5HF__huge_bt2_filt_dir_debug * * Purpose: Debug native form of record * @@ -1090,15 +1104,16 @@ H5HF_huge_bt2_filt_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5HF__huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5HF_huge_bt2_filt_dir_rec_t *nrecord = (const H5HF_huge_bt2_filt_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%a, %Hu, %x, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask, nrecord->obj_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_dir_debug() */ +} /* H5HF__huge_bt2_filt_dir_debug() */ diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 9461fc0..73db840 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -368,7 +368,7 @@ H5HF_man_dblock_new(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t request, } /* end else */ /* Adjust the size of block needed to fulfill request, with overhead */ - if((min_dblock_size - request) < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)) + if(min_dblock_size < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr) + request) min_dblock_size *= 2; /* Check if this is the first block in the heap */ @@ -460,7 +460,7 @@ H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr, HDassert(dblock_size > 0); /* only H5AC__READ_ONLY_FLAG may appear in flags */ - HDassert((flags & (~H5AC__READ_ONLY_FLAG)) == 0); + HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Set up parent info */ udata.par_info.hdr = hdr; @@ -543,7 +543,7 @@ H5HF_man_dblock_locate(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, HDassert(ret_did_protect); /* only H5AC__READ_ONLY_FLAG may appear in flags */ - HDassert((flags & (~H5AC__READ_ONLY_FLAG)) == 0); + HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Look up row & column for object */ if(H5HF_dtable_lookup(&hdr->man_dtable, obj_off, &row, &col) < 0) diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 6560756..19ea14a 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -224,7 +224,7 @@ H5HF_hdr_finish_init_phase1(H5HF_hdr_t *hdr) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize doubling table info") /* Set the size of heap IDs */ - hdr->heap_len_size = MIN(hdr->man_dtable.max_dir_blk_off_size, + hdr->heap_len_size = (uint8_t)MIN(hdr->man_dtable.max_dir_blk_off_size, H5VM_limit_enc_size((uint64_t)hdr->max_man_size)); done: @@ -382,7 +382,7 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "can't allocate space for shared heap info") #ifndef NDEBUG - if(cparam->managed.max_index > (8 * hdr->sizeof_size)) + if(cparam->managed.max_index > (unsigned)(8 * hdr->sizeof_size)) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "max. heap size too large for file") #endif /* NDEBUG */ @@ -433,7 +433,7 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, HADDR_UNDEF, "can't set latest version of I/O filter pipeline") /* Compute the I/O filters' encoded size */ - if(0 == (hdr->filter_len = H5O_msg_raw_size(hdr->f, H5O_PLINE_ID, FALSE, &(hdr->pline)))) + if(0 == (hdr->filter_len = (unsigned)H5O_msg_raw_size(hdr->f, H5O_PLINE_ID, FALSE, &(hdr->pline)))) HGOTO_ERROR(H5E_HEAP, H5E_CANTGETSIZE, HADDR_UNDEF, "can't get I/O filter pipeline size") /* Compute size of header on disk */ @@ -462,13 +462,13 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) case 1: /* Set the length of heap IDs to just enough to hold the information needed to directly access 'huge' objects in the heap */ if(hdr->filter_len > 0) - hdr->id_len = 1 /* ID flags */ + hdr->id_len = (unsigned)1 /* ID flags */ + hdr->sizeof_addr /* Address of filtered object */ + hdr->sizeof_size /* Length of filtered object */ + 4 /* Filter mask for filtered object */ + hdr->sizeof_size; /* Size of de-filtered object in memory */ else - hdr->id_len = 1 /* ID flags */ + hdr->id_len = (unsigned)1 /* ID flags */ + hdr->sizeof_addr /* Address of object */ + hdr->sizeof_size; /* Length of object */ break; @@ -764,7 +764,7 @@ H5HF_hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt) /* Update heap header */ HDassert(amt > 0 || hdr->total_man_free >= (hsize_t)-amt); - hdr->total_man_free += amt; + hdr->total_man_free = (hsize_t)((hssize_t)hdr->total_man_free + amt); /* Mark heap header as modified */ if(H5HF_hdr_dirty(hdr) < 0) @@ -804,7 +804,8 @@ H5HF_hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free) hdr->man_size = new_size; /* Adjust the free space in direct blocks */ - hdr->total_man_free += extra_free; + HDassert(extra_free > 0 || hdr->total_man_free >= (hsize_t)-extra_free); + hdr->total_man_free = (hsize_t)((hssize_t)hdr->total_man_free + extra_free); /* Mark heap header as modified */ if(H5HF_hdr_dirty(hdr) < 0) @@ -1246,7 +1247,7 @@ H5HF_hdr_reverse_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr) /* Walk backwards through entries, until we find one that has a child */ /* (Skip direct block that will be deleted, if we find it) */ - tmp_entry = curr_entry; + tmp_entry = (int)curr_entry; while(tmp_entry >= 0 && (H5F_addr_eq(iblock->ents[tmp_entry].addr, dblock_addr) || !H5F_addr_defined(iblock->ents[tmp_entry].addr))) @@ -1281,7 +1282,7 @@ H5HF_hdr_reverse_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr) else { unsigned row; /* Row for entry */ - curr_entry = tmp_entry; + curr_entry = (unsigned)tmp_entry; /* Check if entry is for a direct block */ row = curr_entry / hdr->man_dtable.cparam.width; diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c index 888af48..ccee89e 100644 --- a/src/H5HFhuge.c +++ b/src/H5HFhuge.c @@ -124,31 +124,31 @@ H5HF_huge_bt2_create(H5HF_hdr_t *hdr, hid_t dxpl_id) */ if(hdr->huge_ids_direct) { if(hdr->filter_len > 0) { - bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of object */ - + hdr->sizeof_size /* Length of object */ - + 4 /* Filter mask for filtered object */ - + hdr->sizeof_size); /* Size of de-filtered object in memory */ + bt2_cparam.rrec_size = (size_t)((unsigned)hdr->sizeof_addr /* Address of object */ + + (unsigned)hdr->sizeof_size /* Length of object */ + + (unsigned)4 /* Filter mask for filtered object */ + + (unsigned)hdr->sizeof_size); /* Size of de-filtered object in memory */ bt2_cparam.cls = H5HF_HUGE_BT2_FILT_DIR; } /* end if */ else { - bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of object */ - + hdr->sizeof_size); /* Length of object */ + bt2_cparam.rrec_size = (size_t)((unsigned)hdr->sizeof_addr /* Address of object */ + + (unsigned)hdr->sizeof_size); /* Length of object */ bt2_cparam.cls = H5HF_HUGE_BT2_DIR; } /* end else */ } /* end if */ else { if(hdr->filter_len > 0) { - bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of filtered object */ - + hdr->sizeof_size /* Length of filtered object */ - + 4 /* Filter mask for filtered object */ - + hdr->sizeof_size /* Size of de-filtered object in memory */ - + hdr->sizeof_size); /* Unique ID for object */ + bt2_cparam.rrec_size = (size_t)((unsigned)hdr->sizeof_addr /* Address of filtered object */ + + (unsigned)hdr->sizeof_size /* Length of filtered object */ + + (unsigned)4 /* Filter mask for filtered object */ + + (unsigned)hdr->sizeof_size /* Size of de-filtered object in memory */ + + (unsigned)hdr->sizeof_size); /* Unique ID for object */ bt2_cparam.cls = H5HF_HUGE_BT2_FILT_INDIR; } /* end if */ else { - bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of object */ - + hdr->sizeof_size /* Length of object */ - + hdr->sizeof_size); /* Unique ID for object */ + bt2_cparam.rrec_size = (size_t)((unsigned)hdr->sizeof_addr /* Address of object */ + + (unsigned)hdr->sizeof_size /* Length of object */ + + (unsigned)hdr->sizeof_size); /* Unique ID for object */ bt2_cparam.cls = H5HF_HUGE_BT2_INDIR; } /* end else */ } /* end else */ @@ -557,7 +557,7 @@ H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE) + if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_filt_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's length */ @@ -571,7 +571,7 @@ H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE) + if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's length */ @@ -641,7 +641,7 @@ H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE) + if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_filt_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's address & length */ @@ -655,7 +655,7 @@ H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE) + if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's address & length */ @@ -735,7 +735,7 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE) + if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_filt_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's address & length */ @@ -751,7 +751,7 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE) + if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's address & length */ @@ -879,7 +879,7 @@ H5HF_huge_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE) + if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's address & length */ @@ -1024,7 +1024,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ - if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_dir_remove, &udata) < 0) + if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_filt_dir_remove, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") } /* end if */ else { @@ -1037,7 +1037,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ - if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_dir_remove, &udata) < 0) + if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_dir_remove, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") } /* end else */ } /* end if */ @@ -1050,7 +1050,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ - if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_remove, &udata) < 0) + if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_filt_indir_remove, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") } /* end if */ else { @@ -1061,7 +1061,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ - if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_remove, &udata) < 0) + if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_indir_remove, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") } /* end else */ } /* end else */ @@ -1180,15 +1180,15 @@ H5HF_huge_delete(H5HF_hdr_t *hdr, hid_t dxpl_id) /* Set the v2 B-tree callback operator */ if(hdr->huge_ids_direct) { if(hdr->filter_len > 0) - op = H5HF_huge_bt2_filt_dir_remove; + op = H5HF__huge_bt2_filt_dir_remove; else - op = H5HF_huge_bt2_dir_remove; + op = H5HF__huge_bt2_dir_remove; } /* end if */ else { if(hdr->filter_len > 0) - op = H5HF_huge_bt2_filt_indir_remove; + op = H5HF__huge_bt2_filt_indir_remove; else - op = H5HF_huge_bt2_indir_remove; + op = H5HF__huge_bt2_indir_remove; } /* end else */ /* Delete the v2 B-tree */ diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 29f4662..f3ec78f 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -214,7 +214,7 @@ H5HF_iblock_unpin(H5HF_indirect_t *iblock) } /* end if */ /* Indicate that the root indirect block is unpinned */ - iblock->hdr->root_iblock_flags &= ~(H5HF_ROOT_IBLOCK_PINNED); + iblock->hdr->root_iblock_flags &= (unsigned)(~(H5HF_ROOT_IBLOCK_PINNED)); } /* end if */ } /* end else */ @@ -649,7 +649,7 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si /* Initialize new direct block entries in rows added */ acc_dblock_free = 0; for(u = (old_nrows * hdr->man_dtable.cparam.width); u < (iblock->nrows * hdr->man_dtable.cparam.width); u++) { - unsigned row = u / hdr->man_dtable.cparam.width; /* Row for current entry */ + unsigned row = (unsigned)(u / hdr->man_dtable.cparam.width); /* Row for current entry */ iblock->ents[u].addr = HADDR_UNDEF; acc_dblock_free += hdr->man_dtable.row_tot_dblock_free[row]; @@ -751,7 +751,7 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id) max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; /* Compute new # of rows in root indirect block */ - new_nrows = 1 << (1 + H5VM_log2_gen((uint64_t)max_child_row)); + new_nrows = (unsigned)1 << (1 + H5VM_log2_gen((uint64_t)max_child_row)); /* Check if the indirect block is NOT currently allocated in temp. file space */ /* (temp. file space does not need to be freed) */ @@ -1323,7 +1323,7 @@ H5HF_man_iblock_unprotect(H5HF_indirect_t *iblock, hid_t dxpl_id, } /* end if */ /* Indicate that the root indirect block is unprotected */ - iblock->hdr->root_iblock_flags &= ~(H5HF_ROOT_IBLOCK_PROTECTED); + iblock->hdr->root_iblock_flags &= (unsigned)(~(H5HF_ROOT_IBLOCK_PROTECTED)); } /* end if */ /* Unprotect the indirect block */ diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 7a6794e..6253160 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -48,19 +48,19 @@ /* "Standard" size of prefix information for fractal heap metadata */ #define H5HF_METADATA_PREFIX_SIZE(c) ( \ H5_SIZEOF_MAGIC /* Signature */ \ - + 1 /* Version */ \ - + ((c) ? H5HF_SIZEOF_CHKSUM : 0) /* Metadata checksum */ \ + + (unsigned)1 /* Version */ \ + + ((c) ? (unsigned)H5HF_SIZEOF_CHKSUM : (unsigned)0) /* Metadata checksum */ \ ) /* Size of doubling-table information */ #define H5HF_DTABLE_INFO_SIZE(h) ( \ - 2 /* Width of table (i.e. # of columns) */ \ - + (h)->sizeof_size /* Starting block size */ \ - + (h)->sizeof_size /* Maximum direct block size */ \ - + 2 /* Max. size of heap (log2 of actual value - i.e. the # of bits) */ \ - + 2 /* Starting # of rows in root indirect block */ \ - + (h)->sizeof_addr /* File address of table managed */ \ - + 2 /* Current # of rows in root indirect block */ \ + (unsigned)2 /* Width of table (i.e. # of columns) */ \ + + (unsigned)(h)->sizeof_size /* Starting block size */ \ + + (unsigned)(h)->sizeof_size /* Maximum direct block size */ \ + + (unsigned)2 /* Max. size of heap (log2 of actual value - i.e. the # of bits) */ \ + + (unsigned)2 /* Starting # of rows in root indirect block */ \ + + (unsigned)(h)->sizeof_addr /* File address of table managed */ \ + + (unsigned)2 /* Current # of rows in root indirect block */ \ ) /* Flags for status byte */ @@ -78,28 +78,28 @@ /* Fractal Heap Header specific fields */ \ \ /* General heap information */ \ - + 2 /* Heap ID len */ \ - + 2 /* I/O filters' encoded len */ \ - + 1 /* Status flags */ \ + + (unsigned)2 /* Heap ID len */ \ + + (unsigned)2 /* I/O filters' encoded len */ \ + + (unsigned)1 /* Status flags */ \ \ /* "Huge" object fields */ \ - + 4 /* Max. size of "managed" object */ \ - + (h)->sizeof_size /* Next ID for "huge" object */ \ - + (h)->sizeof_addr /* File address of "huge" object tracker B-tree */ \ + + (unsigned)4 /* Max. size of "managed" object */ \ + + (unsigned)(h)->sizeof_size /* Next ID for "huge" object */ \ + + (unsigned)(h)->sizeof_addr /* File address of "huge" object tracker B-tree */ \ \ /* "Managed" object free space fields */ \ - + (h)->sizeof_size /* Total man. free space */ \ - + (h)->sizeof_addr /* File address of free section header */ \ + + (unsigned)(h)->sizeof_size /* Total man. free space */ \ + + (unsigned)(h)->sizeof_addr /* File address of free section header */ \ \ /* Statistics fields */ \ - + (h)->sizeof_size /* Size of man. space in heap */ \ - + (h)->sizeof_size /* Size of man. space iterator offset in heap */ \ - + (h)->sizeof_size /* Size of alloacted man. space in heap */ \ - + (h)->sizeof_size /* Number of man. objects in heap */ \ - + (h)->sizeof_size /* Size of huge space in heap */ \ - + (h)->sizeof_size /* Number of huge objects in heap */ \ - + (h)->sizeof_size /* Size of tiny space in heap */ \ - + (h)->sizeof_size /* Number of tiny objects in heap */ \ + + (unsigned)(h)->sizeof_size /* Size of man. space in heap */ \ + + (unsigned)(h)->sizeof_size /* Size of man. space iterator offset in heap */ \ + + (unsigned)(h)->sizeof_size /* Size of alloacted man. space in heap */ \ + + (unsigned)(h)->sizeof_size /* Number of man. objects in heap */ \ + + (unsigned)(h)->sizeof_size /* Size of huge space in heap */ \ + + (unsigned)(h)->sizeof_size /* Number of huge objects in heap */ \ + + (unsigned)(h)->sizeof_size /* Size of tiny space in heap */ \ + + (unsigned)(h)->sizeof_size /* Number of tiny objects in heap */ \ \ /* "Managed" object doubling table info */ \ + H5HF_DTABLE_INFO_SIZE(h) /* Size of managed obj. doubling-table info */ \ @@ -111,15 +111,15 @@ H5HF_METADATA_PREFIX_SIZE(h->checksum_dblocks) \ \ /* Fractal heap managed, absolutely mapped direct block specific fields */ \ - + (h)->sizeof_addr /* File address of heap owning the block */ \ - + (h)->heap_off_size /* Offset of the block in the heap */ \ + + (unsigned)(h)->sizeof_addr /* File address of heap owning the block */ \ + + (unsigned)(h)->heap_off_size /* Offset of the block in the heap */ \ ) /* Size of managed indirect block entry for a child direct block */ #define H5HF_MAN_INDIRECT_CHILD_DIR_ENTRY_SIZE(h) ( \ ((h)->filter_len > 0 ? \ - ((h)->sizeof_addr + (h)->sizeof_size + 4) : /* Size of entries for filtered direct blocks */ \ - (h)->sizeof_addr) /* Size of entries for un-filtered direct blocks */ \ + ((unsigned)(h)->sizeof_addr + (unsigned)(h)->sizeof_size + (unsigned)4) : /* Size of entries for filtered direct blocks */ \ + (unsigned)(h)->sizeof_addr) /* Size of entries for un-filtered direct blocks */ \ ) /* Size of managed indirect block */ @@ -128,8 +128,8 @@ H5HF_METADATA_PREFIX_SIZE(TRUE) \ \ /* Fractal heap managed, absolutely mapped indirect block specific fields */ \ - + (h)->sizeof_addr /* File address of heap owning the block */ \ - + (h)->heap_off_size /* Offset of the block in the heap */ \ + + (unsigned)(h)->sizeof_addr /* File address of heap owning the block */ \ + + (unsigned)(h)->heap_off_size /* Offset of the block in the heap */ \ + (MIN(r, (h)->man_dtable.max_direct_rows) * (h)->man_dtable.cparam.width * H5HF_MAN_INDIRECT_CHILD_DIR_ENTRY_SIZE(h)) /* Size of entries for direct blocks */ \ + (((r > (h)->man_dtable.max_direct_rows) ? (r - (h)->man_dtable.max_direct_rows) : 0) * (h)->man_dtable.cparam.width * (h)->sizeof_addr) /* Size of entries for indirect blocks */ \ ) @@ -731,13 +731,13 @@ H5_DLL herr_t H5HF_huge_term(H5HF_hdr_t *hdr, hid_t dxpl_id); H5_DLL herr_t H5HF_huge_delete(H5HF_hdr_t *hdr, hid_t dxpl_id); /* 'Huge' object v2 B-tree function callbacks */ -H5_DLL herr_t H5HF_huge_bt2_indir_found(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_indir_remove(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_filt_indir_found(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_filt_indir_remove(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_dir_remove(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_filt_dir_found(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_filt_dir_remove(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF__huge_bt2_indir_found(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF__huge_bt2_indir_remove(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF__huge_bt2_filt_indir_found(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF__huge_bt2_filt_indir_remove(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF__huge_bt2_dir_remove(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF__huge_bt2_filt_dir_found(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF__huge_bt2_filt_dir_remove(const void *nrecord, void *op_data); /* 'Tiny' object routines */ H5_DLL herr_t H5HF_tiny_init(H5HF_hdr_t *hdr); diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 070bc3e..8699827 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -14,10 +14,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol <koziol@hdfgroup.org> * Monday, May 1, 2006 * - * Purpose: Free space section routines for fractal heaps. + * Purpose: Free space section routines for fractal heaps * */ @@ -43,10 +43,10 @@ /* Size of serialized indirect section information */ #define H5HF_SECT_INDIRECT_SERIAL_SIZE(h) ( \ - (h)->heap_off_size /* Indirect block's offset in "heap space" */ \ - + 2 /* Row */ \ - + 2 /* Column */ \ - + 2 /* # of entries */ \ + (unsigned)(h)->heap_off_size /* Indirect block's offset in "heap space" */ \ + + (unsigned)2 /* Row */ \ + + (unsigned)2 /* Column */ \ + + (unsigned)2 /* # of entries */ \ ) @@ -587,15 +587,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_single_revive + * Function: H5HF_sect_single_revive * - * Purpose: Update the memory information for a 'single' free section + * Purpose: Update the memory information for a 'single' free section * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 8 2006 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * May 8 2006 * *------------------------------------------------------------------------- */ @@ -636,15 +636,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_single_dblock_info + * Function: H5HF_sect_single_dblock_info * - * Purpose: Retrieve the direct block information for a single section + * Purpose: Retrieve the direct block information for a single section * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * October 24 2006 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * October 24 2006 * *------------------------------------------------------------------------- */ diff --git a/src/H5HFtest.c b/src/H5HFtest.c index 4ec7149..4b97194 100644 --- a/src/H5HFtest.c +++ b/src/H5HFtest.c @@ -97,10 +97,10 @@ H5HF_get_cparam_test(const H5HF_t *fh, H5HF_create_t *cparam) /* Get fractal heap creation parameters */ if(fh->hdr->id_len == (unsigned)(1 + fh->hdr->heap_off_size + fh->hdr->heap_len_size)) cparam->id_len = 0; - else if(fh->hdr->id_len == (1 + fh->hdr->sizeof_size + fh->hdr->sizeof_addr)) + else if(fh->hdr->id_len == (unsigned)(1 + fh->hdr->sizeof_size + fh->hdr->sizeof_addr)) cparam->id_len = 1; else - cparam->id_len = fh->hdr->id_len; + H5_CHECKED_ASSIGN(cparam->id_len, uint16_t, fh->hdr->id_len, unsigned); cparam->max_man_size = fh->hdr->max_man_size; HDmemcpy(&(cparam->managed), &(fh->hdr->man_dtable.cparam), sizeof(H5HF_dtable_cparam_t)); H5O_msg_copy(H5O_PLINE_ID, &(fh->hdr->pline), &(cparam->pline)); diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c index 8c321bc..bdfe30d 100644 --- a/src/H5HFtiny.c +++ b/src/H5HFtiny.c @@ -169,17 +169,17 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); /* Encode object into ID */ if(!hdr->tiny_len_extended) { - *id++ = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_TINY | - (enc_obj_size & H5HF_TINY_MASK_SHORT); + *id++ = (uint8_t)(H5HF_ID_VERS_CURR | H5HF_ID_TYPE_TINY | + (enc_obj_size & H5HF_TINY_MASK_SHORT)); } /* end if */ else { - *id++ = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_TINY | - ((enc_obj_size & H5HF_TINY_MASK_EXT_1) >> 8); + *id++ = (uint8_t)(H5HF_ID_VERS_CURR | H5HF_ID_TYPE_TINY | + ((enc_obj_size & H5HF_TINY_MASK_EXT_1) >> 8)); *id++ = enc_obj_size & H5HF_TINY_MASK_EXT_2; } /* end else */ HDmemcpy(id, obj, obj_size); #ifdef H5_CLEAR_MEMORY -HDmemset(id + obj_size, 0, (hdr->id_len - (1 + hdr->tiny_len_extended + obj_size))); +HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size))); #endif /* H5_CLEAR_MEMORY */ /* Update statistics about heap */ @@ -229,7 +229,7 @@ H5HF_tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) /* (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); + enc_obj_size = (size_t)*(id + 1) | ((size_t)(*id & H5HF_TINY_MASK_EXT_1) << 8); /* Set the object's length */ *obj_len_p = enc_obj_size + 1; @@ -15,12 +15,12 @@ /*------------------------------------------------------------------------- * - * Created: H5HL.c - * Jul 16 1997 - * Robb Matzke <matzke@llnl.gov> + * Created: H5HL.c + * Jul 16 1997 + * Robb Matzke <matzke@llnl.gov> * - * Purpose: Heap functions for the local heaps used by symbol - * tables to store names (among other things). + * Purpose: Heap functions for the local heaps used by symbol + * tables to store names (among other things). * *------------------------------------------------------------------------- */ @@ -35,18 +35,18 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5HLpkg.h" /* Local Heaps */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5HLpkg.h" /* Local Heaps */ +#include "H5MFprivate.h" /* File memory management */ /****************/ /* Local Macros */ /****************/ -#define H5HL_MIN_HEAP 128 /* Minimum size to reduce heap buffer to */ +#define H5HL_MIN_HEAP 128 /* Minimum size to reduce heap buffer to */ /******************/ @@ -63,8 +63,9 @@ /* Local Prototypes */ /********************/ -static H5HL_free_t *H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl); -static herr_t H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap); +static H5HL_free_t *H5HL__remove_free(H5HL_t *heap, H5HL_free_t *fl); +static herr_t H5HL__minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap); +static herr_t H5HL__dirty(H5HL_t *heap); /*********************/ @@ -93,35 +94,29 @@ H5FL_BLK_DEFINE(lheap_chunk); /*------------------------------------------------------------------------- - * Function: H5HL_create + * Function: H5HL_create * - * Purpose: Creates a new heap data structure on disk and caches it - * in memory. SIZE_HINT is a hint for the initial size of the - * data area of the heap. If size hint is invalid then a - * reasonable (but probably not optimal) size will be chosen. - * If the heap ever has to grow, then REALLOC_HINT is the - * minimum amount by which the heap will grow. + * Purpose: Creates a new heap data structure on disk and caches it + * in memory. SIZE_HINT is a hint for the initial size of the + * data area of the heap. If size hint is invalid then a + * reasonable (but probably not optimal) size will be chosen. * - * Return: Success: Non-negative. The file address of new heap is - * returned through the ADDR argument. + * Return: Success: SUCCEED. The file address of new heap is + * returned through the ADDR argument. + * Failure: FAIL. addr_p will be HADDR_UNDEF. * - * Failure: Negative - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 16 1997 + * Programmer: Robb Matzke + * Jul 16 1997 * *------------------------------------------------------------------------- */ -herr_t -H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/) -{ - H5HL_t *heap = NULL; /* Heap created */ - H5HL_prfx_t *prfx = NULL; /* Heap prefix */ - hsize_t total_size = 0; /* Total heap size on disk */ - herr_t ret_value = SUCCEED; /* Return value */ +BEGIN_FUNC(PRIV, ERR, +herr_t, SUCCEED, FAIL, +H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/)) - FUNC_ENTER_NOAPI(FAIL) + H5HL_t *heap = NULL; /* Heap created */ + H5HL_prfx_t *prfx = NULL; /* Heap prefix */ + hsize_t total_size = 0; /* Total heap size on disk */ /* check arguments */ HDassert(f); @@ -129,17 +124,17 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/) /* Adjust size hint as necessary */ if(size_hint && size_hint < H5HL_SIZEOF_FREE(f)) - size_hint = H5HL_SIZEOF_FREE(f); + size_hint = H5HL_SIZEOF_FREE(f); size_hint = H5HL_ALIGN(size_hint); /* Allocate new heap structure */ - if(NULL == (heap = H5HL_new(H5F_SIZEOF_SIZE(f), H5F_SIZEOF_ADDR(f), H5HL_SIZEOF_HDR(f)))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate new heap struct") + if(NULL == (heap = H5HL__new(H5F_SIZEOF_SIZE(f), H5F_SIZEOF_ADDR(f), H5HL_SIZEOF_HDR(f)))) + H5E_THROW(H5E_CANTALLOC, "can't allocate new heap struct"); /* Allocate file space */ total_size = heap->prfx_size + size_hint; if(HADDR_UNDEF == (heap->prfx_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, total_size))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate file memory") + H5E_THROW(H5E_CANTALLOC, "unable to allocate file memory"); /* Initialize info */ heap->single_cache_obj = TRUE; @@ -147,188 +142,72 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/) heap->dblk_size = size_hint; if(size_hint) if(NULL == (heap->dblk_image = H5FL_BLK_CALLOC(lheap_chunk, size_hint))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); /* free list */ if(size_hint) { - if(NULL == (heap->freelist = H5FL_MALLOC(H5HL_free_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") - heap->freelist->offset = 0; - heap->freelist->size = size_hint; - heap->freelist->prev = heap->freelist->next = NULL; + if(NULL == (heap->freelist = H5FL_MALLOC(H5HL_free_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + heap->freelist->offset = 0; + heap->freelist->size = size_hint; + heap->freelist->prev = heap->freelist->next = NULL; heap->free_block = 0; } /* end if */ else { - heap->freelist = NULL; + heap->freelist = NULL; heap->free_block = H5HL_FREE_NULL; } /* end else */ /* Allocate the heap prefix */ - if(NULL == (prfx = H5HL_prfx_new(heap))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") + if(NULL == (prfx = H5HL__prfx_new(heap))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); /* Add to cache */ - if(H5AC_insert_entry(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache local heap prefix") + if(FAIL == H5AC_insert_entry(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET)) + H5E_THROW(H5E_CANTINIT, "unable to cache local heap prefix"); /* Set address to return */ *addr_p = heap->prfx_addr; -done: +CATCH if(ret_value < 0) { + *addr_p = HADDR_UNDEF; if(prfx) { - if(H5HL_prfx_dest(prfx) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap prefix") + if(FAIL == H5HL__prfx_dest(prfx)) + H5E_THROW(H5E_CANTFREE, "unable to destroy local heap prefix"); } /* end if */ else { if(heap) { if(H5F_addr_defined(heap->prfx_addr)) - if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, heap->prfx_addr, total_size) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't release heap data?") - if(H5HL_dest(heap) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap") + if(FAIL == H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, heap->prfx_addr, total_size)) + H5E_THROW(H5E_CANTFREE, "can't release heap data?"); + if(FAIL == H5HL__dest(heap)) + H5E_THROW(H5E_CANTFREE, "unable to destroy local heap"); } /* end if */ } /* end else */ } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5HL_dblk_realloc - * - * Purpose: Reallocate data block for heap - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Oct 12 2008 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5HL_dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size) -{ - H5HL_dblk_t *dblk; /* Local heap data block */ - haddr_t old_addr; /* Old location of heap data block */ - haddr_t new_addr; /* New location of heap data block */ - size_t old_heap_size; /* Old size of heap data block */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* check arguments */ - HDassert(heap); - HDassert(new_heap_size > 0); - - /* Release old space on disk */ - old_addr = heap->dblk_addr; - old_heap_size = heap->dblk_size; - H5_CHECK_OVERFLOW(old_heap_size, size_t, hsize_t); - if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, old_addr, (hsize_t)old_heap_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't release old heap data?") - - /* Allocate new space on disk */ - H5_CHECK_OVERFLOW(new_heap_size, size_t, hsize_t); - if(HADDR_UNDEF == (new_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, (hsize_t)new_heap_size))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate file space for heap") - - /* Update heap info*/ - heap->dblk_addr = new_addr; - heap->dblk_size = new_heap_size; - - /* Check if heap data block actually moved in the file */ - if(H5F_addr_eq(old_addr, new_addr)) { - /* Check if heap data block is contiguous w/prefix */ - if(heap->single_cache_obj) { - /* Sanity check */ - HDassert(H5F_addr_eq(heap->prfx_addr + heap->prfx_size, old_addr)); - HDassert(heap->prfx); - - /* Resize the heap prefix in the cache */ - if(H5AC_resize_entry(heap->prfx, (size_t)(heap->prfx_size + new_heap_size)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap in cache") - } /* end if */ - else { - /* Sanity check */ - HDassert(H5F_addr_ne(heap->prfx_addr + heap->prfx_size, old_addr)); - HDassert(heap->dblk); - - /* Resize the heap data block in the cache */ - if(H5AC_resize_entry(heap->dblk, (size_t)new_heap_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap in cache") - } /* end else */ - } /* end if */ - else { - /* Check if heap data block was contiguous w/prefix previously */ - if(heap->single_cache_obj) { - /* Create new heap data block */ - if(NULL == (dblk = H5HL_dblk_new(heap))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate local heap data block") - - /* Resize current heap prefix */ - heap->prfx_size = H5HL_SIZEOF_HDR(f); - if(H5AC_resize_entry(heap->prfx, (size_t)heap->prfx_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap prefix in cache") - - /* Insert data block into cache (pinned) */ - if(H5AC_insert_entry(f, dxpl_id, H5AC_LHEAP_DBLK, new_addr, dblk, H5AC__PIN_ENTRY_FLAG) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache local heap data block") - dblk = NULL; - - /* Reset 'single cache object' flag */ - heap->single_cache_obj = FALSE; - } /* end if */ - else { - /* Resize the heap data block in the cache */ - /* (ignore [unlikely] case where heap data block ends up - * contiguous w/heap prefix again. - */ - if(H5AC_resize_entry(heap->dblk, (size_t)new_heap_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap data block in cache") - - /* Relocate the heap data block in the cache */ - if(H5AC_move_entry(f, H5AC_LHEAP_DBLK, old_addr, new_addr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move heap data block in cache") - } /* end else */ - } /* end else */ - -done: - if(ret_value < 0) { - /* Restore old heap address & size */ - heap->dblk_addr = old_addr; - heap->dblk_size = old_heap_size; - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_dblk_realloc() */ +END_FUNC(PRIV) /* end H5HL_create() */ /*------------------------------------------------------------------------- - * Function: H5HL_minimize_heap_space + * Function: H5HL__minimize_heap_space * * Purpose: Go through the heap's freelist and determine if we can * eliminate the free blocks at the tail of the buffer. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu * Sept. 16, 2003 * *------------------------------------------------------------------------- */ -static herr_t -H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) -{ - size_t new_heap_size = heap->dblk_size; /* New size of heap */ - herr_t ret_value = SUCCEED; /* Return value */ +BEGIN_FUNC(STATIC, ERR, +herr_t, SUCCEED, FAIL, +H5HL__minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap)) - FUNC_ENTER_NOAPI(FAIL) + size_t new_heap_size = heap->dblk_size; /* New size of heap */ /* check args */ HDassert(f); @@ -393,7 +272,7 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) new_heap_size = last_fl->offset; /* Eliminate the free block from the list */ - last_fl = H5HL_remove_free(heap, last_fl); + last_fl = H5HL__remove_free(heap, last_fl); } /* end else */ } /* end if */ else { @@ -413,20 +292,21 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) * storage. */ if(new_heap_size != heap->dblk_size) { - HDassert(new_heap_size < heap->dblk_size); + HDassert(new_heap_size < heap->dblk_size); /* Resize the memory buffer */ if(NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, new_heap_size))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); /* Reallocate data block in file */ - if(H5HL_dblk_realloc(f, dxpl_id, heap, new_heap_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "reallocating data block failed") + if(FAIL == H5HL__dblk_realloc(f, dxpl_id, heap, new_heap_size)) + H5E_THROW(H5E_CANTRESIZE, "reallocating data block failed"); } /* end if */ -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5HL_minimize_heap_space() */ +CATCH + /* No special processing on errors */ + +END_FUNC(STATIC) /* H5HL__minimize_heap_space() */ /*------------------------------------------------------------------------- @@ -438,23 +318,20 @@ done: * Failure: NULL * * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu * Sept. 17, 2003 * *------------------------------------------------------------------------- */ -H5HL_t * -H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags) -{ - H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ - H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ - H5HL_dblk_t *dblk = NULL; /* Local heap data block */ - H5HL_t *heap = NULL; /* Heap data structure */ - unsigned prfx_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting prefix entry */ - unsigned dblk_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting data block entry */ - H5HL_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) +BEGIN_FUNC(PRIV, ERR, +H5HL_t *, NULL, NULL, +H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags)) + + H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ + H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ + H5HL_dblk_t *dblk = NULL; /* Local heap data block */ + H5HL_t *heap = NULL; /* Heap data structure */ + unsigned prfx_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting prefix entry */ + unsigned dblk_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting data block entry */ /* check arguments */ HDassert(f); @@ -473,7 +350,7 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags) /* Protect the local heap prefix */ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, &prfx_udata, flags))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap prefix") + H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); /* Get the pointer to the heap */ heap = prfx->heap; @@ -495,7 +372,7 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags) /* Protect the local heap data block */ if(NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, &dblk_udata, flags))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap data block") + H5E_THROW(H5E_CANTPROTECT, "unable to load heap data block"); /* Pin the prefix, if the data block was loaded from file */ if(dblk_udata.loaded) @@ -512,49 +389,43 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags) /* Set return value */ ret_value = heap; -done: +CATCH /* Release the prefix from the cache, now pinned */ if(prfx && heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, prfx_cache_flags) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap prefix") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); /* Release the data block from the cache, now pinned */ if(dblk && heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, dblk_cache_flags) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap data block") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap data block"); - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_protect() */ +END_FUNC(PRIV) /* end H5HL_protect() */ /*------------------------------------------------------------------------- * Function: H5HL_offset_into * * Purpose: Called directly after the call to H5HL_protect so that - * a pointer to the object in the heap can be got. + * a pointer to the object in the heap can be obtained. * * Return: Success: Valid pointer. - * Failure: NULL + * Failure: Can't fail * * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu * Sept. 17, 2003 * *------------------------------------------------------------------------- */ -void * -H5HL_offset_into(const H5HL_t *heap, size_t offset) -{ - /* - * We need to have called some other function before this to get a - * valid heap pointer. So, this can remain "FUNC_ENTER_NOAPI_NOINIT" - */ - FUNC_ENTER_NOAPI_NOINIT_NOERR +BEGIN_FUNC(PRIV, NOERR, +void *, NULL, -, +H5HL_offset_into(const H5HL_t *heap, size_t offset)) /* Sanity check */ HDassert(heap); HDassert(offset < heap->dblk_size); - FUNC_LEAVE_NOAPI(heap->dblk_image + offset) -} /* end H5HL_offset_into() */ + ret_value = heap->dblk_image + offset; + +END_FUNC(PRIV) /* end H5HL_offset_into() */ /*------------------------------------------------------------------------- @@ -562,21 +433,16 @@ H5HL_offset_into(const H5HL_t *heap, size_t offset) * * Purpose: Unprotect the data retrieved by the H5HL_protect call. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu * Sept. 17, 2003 * *------------------------------------------------------------------------- */ -herr_t -H5HL_unprotect(H5HL_t *heap) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) +BEGIN_FUNC(PRIV, ERR, +herr_t, SUCCEED, FAIL, +H5HL_unprotect(H5HL_t *heap)) /* check arguments */ HDassert(heap); @@ -589,8 +455,8 @@ H5HL_unprotect(H5HL_t *heap) /* Check for separate heap data block */ if(heap->single_cache_obj) { /* Mark local heap prefix as evictable again */ - if(H5AC_unpin_entry(heap->prfx) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap data block") + if(FAIL == H5AC_unpin_entry(heap->prfx)) + H5E_THROW(H5E_CANTUNPIN, "unable to unpin local heap data block"); } /* end if */ else { /* Sanity check */ @@ -598,34 +464,33 @@ H5HL_unprotect(H5HL_t *heap) /* Mark local heap data block as evictable again */ /* (data block still pins prefix) */ - if(H5AC_unpin_entry(heap->dblk) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap data block") + if(FAIL == H5AC_unpin_entry(heap->dblk)) + H5E_THROW(H5E_CANTUNPIN, "unable to unpin local heap data block"); } /* end else */ } /* end if */ -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_unprotect() */ +CATCH + /* No special processing on errors */ + +END_FUNC(PRIV) /* end H5HL_unprotect() */ /*------------------------------------------------------------------------- - * Function: H5HL_remove_free + * Function: H5HL__remove_free * - * Purpose: Removes free list element FL from the specified heap and - * frees it. + * Purpose: Removes free list element FL from the specified heap and + * frees it. * - * Return: NULL + * Return: NULL * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 17 1997 + * Programmer: Robb Matzke + * Jul 17 1997 * *------------------------------------------------------------------------- */ -static H5HL_free_t * -H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR +BEGIN_FUNC(STATIC, NOERR, +H5HL_free_t *, NULL, -, +H5HL__remove_free(H5HL_t *heap, H5HL_free_t *fl)) if(fl->prev) fl->prev->next = fl->next; @@ -635,30 +500,27 @@ H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl) if(!fl->prev) heap->freelist = fl->next; - FUNC_LEAVE_NOAPI((H5HL_free_t *)H5FL_FREE(H5HL_free_t, fl)) -} /* end H5HL_remove_free() */ + /* H5FL_FREE always returns NULL so we can't check for errors */ + ret_value = (H5HL_free_t *)H5FL_FREE(H5HL_free_t, fl); + +END_FUNC(STATIC) /* end H5HL__remove_free() */ /*------------------------------------------------------------------------- - * Function: H5HL_dirty + * Function: H5HL__dirty * - * Purpose: Mark heap as dirty + * Purpose: Mark heap as dirty * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Oct 12 2008 + * Programmer: Quincey Koziol + * Oct 12 2008 * *------------------------------------------------------------------------- */ -static herr_t -H5HL_dirty(H5HL_t *heap) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT +BEGIN_FUNC(STATIC, ERR, +herr_t, SUCCEED, FAIL, +H5HL__dirty(H5HL_t *heap)) /* check arguments */ HDassert(heap); @@ -669,43 +531,41 @@ H5HL_dirty(H5HL_t *heap) /* Sanity check */ HDassert(heap->dblk); - if(H5AC_mark_entry_dirty(heap->dblk) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap data block as dirty") + if(FAIL == H5AC_mark_entry_dirty(heap->dblk)) + H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap data block as dirty"); } /* end if */ /* Mark heap prefix as dirty */ - if(H5AC_mark_entry_dirty(heap->prfx) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap prefix as dirty") + if(FAIL == H5AC_mark_entry_dirty(heap->prfx)) + H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap prefix as dirty"); -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_dirty() */ +CATCH + /* No special processing on errors */ + +END_FUNC(STATIC) /* end H5HL__dirty() */ /*------------------------------------------------------------------------- - * Function: H5HL_insert + * Function: H5HL_insert * - * Purpose: Inserts a new item into the heap. + * Purpose: Inserts a new item into the heap. * - * Return: Success: Offset of new item within heap. - * Failure: UFAIL + * Return: Success: Offset of new item within heap. + * Failure: UFAIL * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 17 1997 + * Programmer: Robb Matzke + * Jul 17 1997 * *------------------------------------------------------------------------- */ -size_t -H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void *buf) -{ - H5HL_free_t *fl = NULL, *last_fl = NULL; - size_t offset = 0; - size_t need_size; - hbool_t found; - size_t ret_value = 0; /* Return value */ +BEGIN_FUNC(PRIV, ERR, +size_t, UFAIL, UFAIL, +H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void *buf)) - FUNC_ENTER_NOAPI(UFAIL) + H5HL_free_t *fl = NULL, *last_fl = NULL; + size_t offset = 0; + size_t need_size; + hbool_t found; /* check arguments */ HDassert(f); @@ -719,8 +579,8 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * * so we just accept that an extra flush of the heap info could occur * if an error occurs -QAK) */ - if(H5HL_dirty(heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, UFAIL, "unable to mark heap as dirty") + if(FAIL == H5HL__dirty(heap)) + H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty"); /* * In order to keep the free list descriptors aligned on word boundaries, @@ -734,26 +594,25 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * * leave zero or at least H5G_SIZEOF_FREE bytes left over. */ for(fl = heap->freelist, found = FALSE; fl; fl = fl->next) { - if(fl->size > need_size && - fl->size - need_size >= H5HL_SIZEOF_FREE(f)) { - /* a big enough free block was found */ - offset = fl->offset; - fl->offset += need_size; - fl->size -= need_size; - HDassert(fl->offset == H5HL_ALIGN(fl->offset)); - HDassert(fl->size == H5HL_ALIGN(fl->size)); - found = TRUE; - break; - } else if(fl->size == need_size) { - /* free block of exact size found */ - offset = fl->offset; - fl = H5HL_remove_free(heap, fl); - found = TRUE; - break; - } else if(!last_fl || last_fl->offset < fl->offset) { - /* track free space that's closest to end of heap */ - last_fl = fl; - } + if(fl->size > need_size && fl->size - need_size >= H5HL_SIZEOF_FREE(f)) { + /* a big enough free block was found */ + offset = fl->offset; + fl->offset += need_size; + fl->size -= need_size; + HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); + found = TRUE; + break; + } else if(fl->size == need_size) { + /* free block of exact size found */ + offset = fl->offset; + fl = H5HL__remove_free(heap, fl); + found = TRUE; + break; + } else if(!last_fl || last_fl->offset < fl->offset) { + /* track free space that's closest to end of heap */ + last_fl = fl; + } } /* end for */ /* @@ -770,7 +629,7 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * /* At least double the heap's size, making certain there's enough room * for the new object */ - need_more = MAX(need_size, heap->dblk_size); + need_more = MAX(need_size, heap->dblk_size); /* If there is no last free block or it's not at the end of the heap, * and the amount of space to allocate is not big enough to include at @@ -778,106 +637,104 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * * space requested to just the amount of space needed. (Generally * speaking, this only occurs when the heap is small -QAK) */ - if(!(last_fl && last_fl->offset + last_fl->size == heap->dblk_size) + if(!(last_fl && last_fl->offset + last_fl->size == heap->dblk_size) && (need_more < (need_size + H5HL_SIZEOF_FREE(f)))) need_more = need_size; - new_dblk_size = heap->dblk_size + need_more; - HDassert(heap->dblk_size < new_dblk_size); + new_dblk_size = heap->dblk_size + need_more; + HDassert(heap->dblk_size < new_dblk_size); old_dblk_size = heap->dblk_size; - H5_CHECK_OVERFLOW(heap->dblk_size, size_t, hsize_t); - H5_CHECK_OVERFLOW(new_dblk_size, size_t, hsize_t); + H5_CHECK_OVERFLOW(heap->dblk_size, size_t, hsize_t); + H5_CHECK_OVERFLOW(new_dblk_size, size_t, hsize_t); /* Extend current heap if possible */ - was_extended = H5MF_try_extend(f, dxpl_id, H5FD_MEM_LHEAP, heap->dblk_addr, (hsize_t)(heap->dblk_size), (hsize_t)need_more); - if(was_extended < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, UFAIL, "error trying to extend heap") + was_extended = H5MF_try_extend(f, dxpl_id, H5FD_MEM_LHEAP, heap->dblk_addr, (hsize_t)(heap->dblk_size), (hsize_t)need_more); + if(FAIL == was_extended) + H5E_THROW(H5E_CANTEXTEND, "error trying to extend heap"); /* Check if we extended the heap data block in file */ if(was_extended == TRUE) { /* Check for prefix & data block contiguous */ if(heap->single_cache_obj) { /* Resize prefix+data block */ - if(H5AC_resize_entry(heap->prfx, (size_t)(heap->prfx_size + new_dblk_size)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, UFAIL, "unable to resize heap prefix in cache") + if(FAIL == H5AC_resize_entry(heap->prfx, (size_t)(heap->prfx_size + new_dblk_size))) + H5E_THROW(H5E_CANTRESIZE, "unable to resize heap prefix in cache"); } /* end if */ else { /* Resize 'standalone' data block */ - if(H5AC_resize_entry(heap->dblk, (size_t)new_dblk_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, UFAIL, "unable to resize heap data block in cache") + if(FAIL == H5AC_resize_entry(heap->dblk, (size_t)new_dblk_size)) + H5E_THROW(H5E_CANTRESIZE, "unable to resize heap data block in cache"); } /* end else */ /* Note new size */ heap->dblk_size = new_dblk_size; - } /* end if */ + } /* end if */ else { /* ...if we can't, allocate a new chunk & release the old */ /* Reallocate data block in file */ - if(H5HL_dblk_realloc(f, dxpl_id, heap, new_dblk_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, UFAIL, "reallocating data block failed") - } /* end if */ + if(FAIL == H5HL__dblk_realloc(f, dxpl_id, heap, new_dblk_size)) + H5E_THROW(H5E_CANTRESIZE, "reallocating data block failed"); + } /* end if */ /* If the last free list in the heap is at the end of the heap, extend it */ - if(last_fl && last_fl->offset + last_fl->size == old_dblk_size) { - /* - * Increase the size of the last free block. - */ - offset = last_fl->offset; - last_fl->offset += need_size; - last_fl->size += need_more - need_size; - HDassert(last_fl->offset == H5HL_ALIGN(last_fl->offset)); - HDassert(last_fl->size == H5HL_ALIGN(last_fl->size)); - - if (last_fl->size < H5HL_SIZEOF_FREE(f)) { + if(last_fl && last_fl->offset + last_fl->size == old_dblk_size) { + /* + * Increase the size of the last free block. + */ + offset = last_fl->offset; + last_fl->offset += need_size; + last_fl->size += need_more - need_size; + HDassert(last_fl->offset == H5HL_ALIGN(last_fl->offset)); + HDassert(last_fl->size == H5HL_ALIGN(last_fl->size)); + + if (last_fl->size < H5HL_SIZEOF_FREE(f)) { #ifdef H5HL_DEBUG - if (H5DEBUG(HL) && last_fl->size) { - fprintf(H5DEBUG(HL), "H5HL: lost %lu bytes at line %d\n", - (unsigned long)(last_fl->size), __LINE__); - } + if (H5DEBUG(HL) && last_fl->size) { + HDfprintf(H5DEBUG(HL), "H5HL: lost %lu bytes at line %d\n", + (unsigned long)(last_fl->size), __LINE__); + } #endif - last_fl = H5HL_remove_free(heap, last_fl); - } - } /* end if */ + last_fl = H5HL__remove_free(heap, last_fl); + } + } /* end if */ else { - /* - * Create a new free list element large enough that we can - * take some space out of it right away. - */ - offset = old_dblk_size; - if(need_more - need_size >= H5HL_SIZEOF_FREE(f)) { - if(NULL == (fl = H5FL_MALLOC(H5HL_free_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, UFAIL, "memory allocation failed") - fl->offset = old_dblk_size + need_size; - fl->size = need_more - need_size; - HDassert(fl->offset == H5HL_ALIGN(fl->offset)); - HDassert(fl->size == H5HL_ALIGN(fl->size)); - fl->prev = NULL; - fl->next = heap->freelist; - if(heap->freelist) + /* + * Create a new free list element large enough that we can + * take some space out of it right away. + */ + offset = old_dblk_size; + if(need_more - need_size >= H5HL_SIZEOF_FREE(f)) { + if(NULL == (fl = H5FL_MALLOC(H5HL_free_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + fl->offset = old_dblk_size + need_size; + fl->size = need_more - need_size; + HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); + fl->prev = NULL; + fl->next = heap->freelist; + if(heap->freelist) heap->freelist->prev = fl; - heap->freelist = fl; + heap->freelist = fl; #ifdef H5HL_DEBUG - } else if (H5DEBUG(HL) && need_more > need_size) { - fprintf(H5DEBUG(HL), - "H5HL_insert: lost %lu bytes at line %d\n", - (unsigned long)(need_more - need_size), __LINE__); + } else if (H5DEBUG(HL) && need_more > need_size) { + HDfprintf(H5DEBUG(HL), "H5HL_insert: lost %lu bytes at line %d\n", + (unsigned long)(need_more - need_size), __LINE__); #endif - } - } /* end else */ + } + } /* end else */ #ifdef H5HL_DEBUG - if (H5DEBUG(HL)) { - fprintf(H5DEBUG(HL), - "H5HL: resize mem buf from %lu to %lu bytes\n", - (unsigned long)(old_dblk_size), - (unsigned long)(old_dblk_size + need_more)); - } + if (H5DEBUG(HL)) { + HDfprintf(H5DEBUG(HL), "H5HL: resize mem buf from %lu to %lu bytes\n", + (unsigned long)(old_dblk_size), + (unsigned long)(old_dblk_size + need_more)); + } #endif - if(NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, heap->dblk_size))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, UFAIL, "memory allocation failed") + if(NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, heap->dblk_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); - /* Clear new section so junk doesn't appear in the file */ + /* Clear new section so junk doesn't appear in the file */ /* (Avoid clearing section which will be overwritten with newly inserted data) */ - HDmemset(heap->dblk_image + offset + buf_size, 0, (new_dblk_size - (offset + buf_size))); + HDmemset(heap->dblk_image + offset + buf_size, 0, (new_dblk_size - (offset + buf_size))); } /* end if */ /* Copy the data into the heap */ @@ -886,42 +743,40 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * /* Set return value */ ret_value = offset; -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5HL_insert() */ +CATCH + /* No special processing on errors */ + +END_FUNC(PRIV) /* H5HL_insert() */ /*------------------------------------------------------------------------- - * Function: H5HL_remove + * Function: H5HL_remove * - * Purpose: Removes an object or part of an object from the heap at - * address ADDR of file F. The object (or part) to remove - * begins at byte OFFSET from the beginning of the heap and - * continues for SIZE bytes. + * Purpose: Removes an object or part of an object from the heap at + * address ADDR of file F. The object (or part) to remove + * begins at byte OFFSET from the beginning of the heap and + * continues for SIZE bytes. * - * Once part of an object is removed, one must not attempt - * to access that part. Removing the beginning of an object - * results in the object OFFSET increasing by the amount - * truncated. Removing the end of an object results in - * object truncation. Removing the middle of an object results - * in two separate objects, one at the original offset and - * one at the first offset past the removed portion. + * Once part of an object is removed, one must not attempt + * to access that part. Removing the beginning of an object + * results in the object OFFSET increasing by the amount + * truncated. Removing the end of an object results in + * object truncation. Removing the middle of an object results + * in two separate objects, one at the original offset and + * one at the first offset past the removed portion. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 16 1997 + * Programmer: Robb Matzke + * Jul 16 1997 * *------------------------------------------------------------------------- */ -herr_t -H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size) -{ - H5HL_free_t *fl = NULL; - herr_t ret_value = SUCCEED; /* Return value */ +BEGIN_FUNC(PRIV, ERR, +herr_t, SUCCEED, FAIL, +H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size)) - FUNC_ENTER_NOAPI(FAIL) + H5HL_free_t *fl = NULL; /* check arguments */ HDassert(f); @@ -940,8 +795,8 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size) * so we just accept that an extra flush of the heap info could occur * if an error occurs -QAK) */ - if(H5HL_dirty(heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap as dirty") + if(FAIL == H5HL__dirty(heap)) + H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty"); /* * Check if this chunk can be prepended or appended to an already @@ -952,60 +807,60 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size) while(fl) { H5HL_free_t *fl2 = NULL; - if((offset + size) == fl->offset) { - fl->offset = offset; - fl->size += size; - HDassert(fl->offset == H5HL_ALIGN(fl->offset)); - HDassert(fl->size == H5HL_ALIGN(fl->size)); - fl2 = fl->next; - while(fl2) { - if((fl2->offset + fl2->size) == fl->offset) { - fl->offset = fl2->offset; - fl->size += fl2->size; - HDassert(fl->offset == H5HL_ALIGN(fl->offset)); - HDassert(fl->size == H5HL_ALIGN(fl->size)); - fl2 = H5HL_remove_free(heap, fl2); - if(((fl->offset + fl->size) == heap->dblk_size) && + if((offset + size) == fl->offset) { + fl->offset = offset; + fl->size += size; + HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); + fl2 = fl->next; + while(fl2) { + if((fl2->offset + fl2->size) == fl->offset) { + fl->offset = fl2->offset; + fl->size += fl2->size; + HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); + fl2 = H5HL__remove_free(heap, fl2); + if(((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { - if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed") + if(FAIL == H5HL__minimize_heap_space(f, dxpl_id, heap)) + H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); } - HGOTO_DONE(SUCCEED); - } - fl2 = fl2->next; - } - if(((fl->offset + fl->size) == heap->dblk_size) && + H5_LEAVE(SUCCEED); + } + fl2 = fl2->next; + } + if(((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { - if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed") + if(FAIL == H5HL__minimize_heap_space(f, dxpl_id, heap)) + H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); } - HGOTO_DONE(SUCCEED); - } else if(fl->offset + fl->size == offset) { - fl->size += size; - fl2 = fl->next; - HDassert(fl->size == H5HL_ALIGN(fl->size)); - while(fl2) { - if(fl->offset + fl->size == fl2->offset) { - fl->size += fl2->size; - HDassert(fl->size == H5HL_ALIGN(fl->size)); - fl2 = H5HL_remove_free(heap, fl2); - if(((fl->offset + fl->size) == heap->dblk_size) && - ((2 * fl->size) > heap->dblk_size)) { - if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed") + H5_LEAVE(SUCCEED); + } else if(fl->offset + fl->size == offset) { + fl->size += size; + fl2 = fl->next; + HDassert(fl->size == H5HL_ALIGN(fl->size)); + while(fl2) { + if(fl->offset + fl->size == fl2->offset) { + fl->size += fl2->size; + HDassert(fl->size == H5HL_ALIGN(fl->size)); + fl2 = H5HL__remove_free(heap, fl2); + if(((fl->offset + fl->size) == heap->dblk_size) && + ((2 * fl->size) > heap->dblk_size)) { + if(FAIL == H5HL__minimize_heap_space(f, dxpl_id, heap)) + H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); } /* end if */ - HGOTO_DONE(SUCCEED); - } /* end if */ - fl2 = fl2->next; - } /* end while */ - if(((fl->offset + fl->size) == heap->dblk_size) && + H5_LEAVE(SUCCEED); + } /* end if */ + fl2 = fl2->next; + } /* end while */ + if(((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { - if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed") + if(FAIL == H5HL__minimize_heap_space(f, dxpl_id, heap)) + H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); } /* end if */ - HGOTO_DONE(SUCCEED); - } /* end if */ - fl = fl->next; + H5_LEAVE(SUCCEED); + } /* end if */ + fl = fl->next; } /* end while */ /* @@ -1015,19 +870,18 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size) */ if(size < H5HL_SIZEOF_FREE(f)) { #ifdef H5HL_DEBUG - if(H5DEBUG(HL)) { - fprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n", - (unsigned long) size); - } + if(H5DEBUG(HL)) { + HDfprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n", (unsigned long) size); + } #endif - HGOTO_DONE(SUCCEED); + H5_LEAVE(SUCCEED); } /* end if */ /* * Add an entry to the free list. */ if(NULL == (fl = H5FL_MALLOC(H5HL_free_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); fl->offset = offset; fl->size = size; HDassert(fl->offset == H5HL_ALIGN(fl->offset)); @@ -1040,39 +894,37 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size) if(((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { - if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed") + if(FAIL == H5HL__minimize_heap_space(f, dxpl_id, heap)) + H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); } /* end if */ -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_remove() */ +CATCH + /* No special processing on exit */ + +END_FUNC(PRIV) /* end H5HL_remove() */ /*------------------------------------------------------------------------- - * Function: H5HL_delete + * Function: H5HL_delete * - * Purpose: Deletes a local heap from disk, freeing disk space used. + * Purpose: Deletes a local heap from disk, freeing disk space used. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Mar 22 2003 + * Programmer: Quincey Koziol + * Mar 22 2003 * *------------------------------------------------------------------------- */ -herr_t -H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) -{ - H5HL_t *heap = NULL; /* Local heap to delete */ +BEGIN_FUNC(PRIV, ERR, +herr_t, SUCCEED, FAIL, +H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)) + + H5HL_t *heap = NULL; /* Local heap to delete */ H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ H5HL_dblk_t *dblk = NULL; /* Local heap data block */ unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting heap */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) /* check arguments */ HDassert(f); @@ -1088,7 +940,7 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) /* Protect the local heap prefix */ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix") + H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); /* Get the pointer to the heap */ heap = prfx->heap; @@ -1103,53 +955,49 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) /* Protect the local heap data block */ if(NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, &dblk_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap data block") + H5E_THROW(H5E_CANTPROTECT, "unable to load heap data block"); /* Pin the prefix, if the data block was loaded from file */ if(dblk_udata.loaded) { - if(H5AC_pin_protected_entry(prfx) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin local heap prefix") + if(FAIL == H5AC_pin_protected_entry(prfx)) + H5E_THROW(H5E_CANTPIN, "unable to pin local heap prefix"); } /* end if */ } /* end if */ /* Set the flags for releasing the prefix and data block */ cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; -done: +CATCH /* Release the data block from the cache, now deleted */ if(dblk && heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, cache_flags) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap data block") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap data block"); /* Release the prefix from the cache, now deleted */ if(prfx && heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, cache_flags) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_delete() */ +END_FUNC(PRIV) /* end H5HL_delete() */ /*------------------------------------------------------------------------- - * Function: H5HL_get_size + * Function: H5HL_get_size * - * Purpose: Retrieves the current size of a heap + * Purpose: Retrieves the current size of a heap * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Nov 7 2005 + * Programmer: Quincey Koziol + * Nov 7 2005 * *------------------------------------------------------------------------- */ -herr_t -H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size) -{ - H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ - H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ - H5HL_t *heap; /* Heap data structure */ - herr_t ret_value = SUCCEED; /* Return value */ +BEGIN_FUNC(PRIV, ERR, +herr_t, SUCCEED, FAIL, +H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size)) - FUNC_ENTER_NOAPI(FAIL) + H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ + H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ + H5HL_t *heap; /* Heap data structure */ /* check arguments */ HDassert(f); @@ -1166,7 +1014,7 @@ H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size) /* Protect the local heap prefix */ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix") + H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); /* Get the pointer to the heap */ heap = prfx->heap; @@ -1174,12 +1022,11 @@ H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size) /* Set the size to return */ *size = heap->dblk_size; -done: - if(prfx && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix") +CATCH + if(prfx && FAIL == H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET)) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_get_size() */ +END_FUNC(PRIV) /* end H5HL_get_size() */ /*------------------------------------------------------------------------- @@ -1188,22 +1035,20 @@ done: * Purpose: Compute the size in bytes of the specified instance of * H5HL_t via H5HL_size() * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi * June 19 2007 * *------------------------------------------------------------------------- */ -herr_t -H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size) -{ - H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ - H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ - H5HL_t *heap; /* Heap data structure */ - herr_t ret_value = SUCCEED; /* Return value */ +BEGIN_FUNC(PRIV, ERR, +herr_t, SUCCEED, FAIL, +H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size)) - FUNC_ENTER_NOAPI(FAIL) + H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ + H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ + H5HL_t *heap; /* Heap data structure */ /* check arguments */ HDassert(f); @@ -1220,7 +1065,7 @@ H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size) /* Protect the local heap prefix */ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix") + H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); /* Get the pointer to the heap */ heap = prfx->heap; @@ -1228,10 +1073,9 @@ H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size) /* Accumulate the size of the local heap */ *heap_size += (hsize_t)(heap->prfx_size + heap->dblk_size); -done: - if(prfx && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix") +CATCH + if(prfx && FAIL == H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET)) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_heapsize() */ +END_FUNC(PRIV) /* end H5HL_heapsize() */ diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 42fe1c7..faa5ff2 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -15,11 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5HLcache.c - * Feb 5 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5HLcache.c + * Feb 5 2008 + * Quincey Koziol <koziol@hdfgroup.org> * - * Purpose: Implement local heap metadata cache methods. + * Purpose: Implement local heap metadata cache methods. * *------------------------------------------------------------------------- */ @@ -34,24 +34,25 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5HLpkg.h" /* Local Heaps */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5HLpkg.h" /* Local Heaps */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5WBprivate.h" /* Wrapped Buffers */ /****************/ /* Local Macros */ /****************/ -#define H5HL_VERSION 0 /* Local heap collection version */ +#define H5HL_VERSION 0 /* Local heap collection version */ -/* Set the local heap size to speculatively read in */ -/* (needs to be more than the local heap prefix size to work at all and +/* Set the local heap size to speculatively read in + * (needs to be more than the local heap prefix size to work at all and * should be larger than the default local heap size to save the - * extra I/O operations) */ -#define H5HL_SPEC_READ_SIZE 512 + * extra I/O operations) + */ +#define H5HL_SPEC_READ_SIZE 512 /******************/ @@ -69,6 +70,7 @@ /********************/ /* Metadata cache callbacks */ +/* Local heap prefix */ static herr_t H5HL__cache_prefix_get_load_size(const void *udata, size_t *image_len); static void *H5HL__cache_prefix_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); @@ -79,6 +81,7 @@ static herr_t H5HL__cache_prefix_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5HL__cache_prefix_free_icr(void *thing); +/* Local heap data block */ static herr_t H5HL__cache_datablock_get_load_size(const void *udata, size_t *image_len); static void *H5HL__cache_datablock_deserialize(const void *image, size_t len, @@ -90,6 +93,9 @@ static herr_t H5HL__cache_datablock_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5HL__cache_datablock_free_icr(void *thing); +/* Free list de/serialization */ +static herr_t H5HL__fl_deserialize(H5HL_t *heap); +static void H5HL__fl_serialize(const H5HL_t *heap); /*********************/ /* Package Variables */ @@ -141,15 +147,14 @@ const H5AC_class_t H5AC_LHEAP_DBLK[1] = {{ /*------------------------------------------------------------------------- - * Function: H5HL__fl_deserialize + * Function: H5HL__fl_deserialize * - * Purpose: Deserialize the free list for a heap data block + * Purpose: Deserialize the free list for a heap data block * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Oct 12 2008 + * Programmer: Quincey Koziol + * Oct 12 2008 * *------------------------------------------------------------------------- */ @@ -185,7 +190,7 @@ H5HL__fl_deserialize(H5HL_t *heap) /* Decode offset of next free block */ image = heap->dblk_image + free_block; H5F_DECODE_LENGTH_LEN(image, free_block, heap->sizeof_size); - if(free_block == 0) + if(0 == free_block) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "free block size is zero?") /* Decode length of this free block */ @@ -205,6 +210,7 @@ H5HL__fl_deserialize(H5HL_t *heap) done: if(ret_value < 0) if(fl) + /* H5FL_FREE always returns NULL so we can't check for errors */ fl = H5FL_FREE(H5HL_free_t, fl); FUNC_LEAVE_NOAPI(ret_value) @@ -212,23 +218,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5HL__fl_serialize + * Function: H5HL__fl_serialize * - * Purpose: Serialize the free list for a heap data block + * Purpose: Serialize the free list for a heap data block * - * Return: Success: SUCCESS - * Failure: FAIL + * Return: Nothing (void) * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Oct 12 2008 + * Programmer: Quincey Koziol + * Oct 12 2008 * *------------------------------------------------------------------------- */ static void H5HL__fl_serialize(const H5HL_t *heap) { - H5HL_free_t *fl; /* Pointer to heap free list node */ + H5HL_free_t *fl; /* Pointer to heap free list node */ FUNC_ENTER_STATIC_NOERR @@ -251,6 +255,7 @@ H5HL__fl_serialize(const H5HL_t *heap) } /* end for */ FUNC_LEAVE_NOAPI_VOID + } /* end H5HL__fl_serialize() */ @@ -338,12 +343,12 @@ H5HL__cache_prefix_deserialize(const void *_image, size_t len, void *_udata, image += 3; /* Allocate space in memory for the heap */ - if(NULL == (heap = H5HL_new(udata->sizeof_size, udata->sizeof_addr, udata->sizeof_prfx))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap structure") + if(NULL == (heap = H5HL__new(udata->sizeof_size, udata->sizeof_addr, udata->sizeof_prfx))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap structure"); /* Allocate the heap prefix */ - if(NULL == (prfx = H5HL_prfx_new(heap))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap prefix") + if(NULL == (prfx = H5HL__prfx_new(heap))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap prefix"); /* Store the prefix's address & length */ heap->prfx_addr = udata->prfx_addr; @@ -422,12 +427,12 @@ done: /* Release the [possibly partially initialized] local heap on errors */ if(!ret_value) { if(prfx) { - if(H5HL_prfx_dest(prfx) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap prefix") + if(FAIL == H5HL__prfx_dest(prfx)) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap prefix"); } /* end if */ else { - if(heap && H5HL_dest(heap) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap") + if(heap && FAIL == H5HL__dest(heap)) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap"); } /* end else */ } /* end if */ @@ -472,7 +477,6 @@ H5HL__cache_prefix_image_len(const void *_thing, size_t *image_len, if(prfx->heap->single_cache_obj) *image_len += prfx->heap->dblk_size; - FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HL__cache_prefix_image_len() */ @@ -619,7 +623,7 @@ H5HL__cache_prefix_free_icr(void *_thing) HDassert(H5F_addr_eq(prfx->cache_info.addr, prfx->heap->prfx_addr)); /* Destroy local heap prefix */ - if(H5HL_prfx_dest(prfx) < 0) + if(H5HL__prfx_dest(prfx) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't destroy local heap prefix") done: @@ -697,21 +701,21 @@ H5HL__cache_datablock_deserialize(const void *image, size_t len, void *_udata, HDassert(dirty); /* Allocate space in memory for the heap data block */ - if(NULL == (dblk = H5HL_dblk_new(udata->heap))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") + if(NULL == (dblk = H5HL__dblk_new(udata->heap))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed"); /* Check for heap still retaining image */ if(NULL == udata->heap->dblk_image) { /* Allocate space for the heap data image */ if(NULL == (udata->heap->dblk_image = H5FL_BLK_MALLOC(lheap_chunk, udata->heap->dblk_size))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate data block image buffer") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate data block image buffer"); /* copy the datablock from the read buffer */ HDmemcpy(udata->heap->dblk_image, image, len); /* Build free list */ - if(H5HL__fl_deserialize(udata->heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list") + if(FAIL == H5HL__fl_deserialize(udata->heap)) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list"); } /* end if */ /* Set flag to indicate data block from loaded from file */ @@ -723,8 +727,8 @@ H5HL__cache_datablock_deserialize(const void *image, size_t len, void *_udata, done: /* Release the [possibly partially initialized] local heap on errors */ if(!ret_value && dblk) - if(H5HL_dblk_dest(dblk) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap data block") + if(FAIL == H5HL__dblk_dest(dblk)) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap data block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL__cache_datablock_deserialize() */ @@ -851,10 +855,9 @@ H5HL__cache_datablock_free_icr(void *_thing) HDassert(dblk->cache_info.type == H5AC_LHEAP_DBLK); /* Destroy the data block */ - if(H5HL_dblk_dest(dblk) < 0) + if(H5HL__dblk_dest(dblk) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap data block") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL__cache_datablock_free_icr() */ - diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index 3620511..fc8f5d3 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -13,55 +13,49 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> +/* Programmer: Quincey Koziol <koziol@hdfgroup.org> * Wednesday, July 9, 2003 * - * Purpose: Local Heap object debugging functions. + * Purpose: Local Heap object debugging functions. */ +/****************/ +/* Module Setup */ +/****************/ + #include "H5HLmodule.h" /* This source code file is part of the H5HL module */ +/***********/ +/* Headers */ +/***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5HLpkg.h" /* Local heaps */ -#include "H5Iprivate.h" /* ID Functions */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5HLpkg.h" /* Local heaps */ +#include "H5MMprivate.h" /* Memory management */ /*------------------------------------------------------------------------- - * Function: H5HL_debug - * - * Purpose: Prints debugging information about a heap. - * - * Return: Non-negative on success/Negative on failure + * Function: H5HL_debug * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 1 1997 + * Purpose: Prints debugging information about a heap. * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. + * Return: SUCCEED/FAIL * - * John Mainzer, 6/17/05 - * Modified the function to use the new dirtied parameter of - * of H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. + * Programmer: Robb Matzke + * Aug 1 1997 * *------------------------------------------------------------------------- */ -herr_t -H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth) -{ +BEGIN_FUNC(PRIV, ERR, +herr_t, SUCCEED, FAIL, +H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth)) + H5HL_t *h = NULL; int free_block; H5HL_free_t *freelist; uint8_t *marker = NULL; size_t amount_free = 0; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) /* check arguments */ HDassert(f); @@ -71,17 +65,17 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int HDassert(fwidth >= 0); if(NULL == (h = (H5HL_t *)H5HL_protect(f, dxpl_id, addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") + H5E_THROW(H5E_CANTPROTECT, "unable to load/protect local heap"); HDfprintf(stream, "%*sLocal Heap...\n", indent, ""); HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Header size (in bytes):", (unsigned long)h->prfx_size); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Address of heap data:", - h->dblk_addr); + "Address of heap data:", + h->dblk_addr); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Data bytes allocated for heap:", + "Data bytes allocated for heap:", h->dblk_size); /* @@ -89,7 +83,7 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int * the heap and that no two free blocks point to the same region of * the heap. */ if(NULL == (marker = (uint8_t *)H5MM_calloc(h->dblk_size))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); HDfprintf(stream, "%*sFree Blocks (offset, size):\n", indent, ""); for(free_block = 0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) { @@ -127,11 +121,11 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int */ H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size); -done: - if(h && H5HL_unprotect(h) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") - H5MM_xfree(marker); +CATCH + if(h && FAIL == H5HL_unprotect(h)) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release/unprotect local heap"); - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_debug() */ + if(marker && NULL != (marker = (uint8_t *)H5MM_xfree(marker))) + H5E_THROW(H5E_CANTFREE, "can't free marker buffer"); +END_FUNC(PRIV) /* end H5HL_debug() */ diff --git a/src/H5HLdblk.c b/src/H5HLdblk.c new file mode 100644 index 0000000..6a4d8ce --- /dev/null +++ b/src/H5HLdblk.c @@ -0,0 +1,282 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5HLdblk.c + * Summer 2012 + * Dana Robinson <derobins@hdfgroup.org> + * + * Purpose: Data block routines for local heaps. + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5HLmodule.h" /* This source code file is part of the H5HL module */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5HLpkg.h" /* Local Heaps */ +#include "H5MFprivate.h" /* File memory management */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Declare a free list to manage the H5HL_dblk_t struct */ +H5FL_DEFINE_STATIC(H5HL_dblk_t); + + + +/*------------------------------------------------------------------------- + * Function: H5HL__dblk_new + * + * Purpose: Create a new local heap data block object + * + * Return: Success: non-NULL pointer to new local heap data block + * Failure: NULL + * + * Programmer: Quincey Koziol + * Oct 12 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +H5HL_dblk_t *, NULL, NULL, +H5HL__dblk_new(H5HL_t *heap)) + + H5HL_dblk_t *dblk = NULL; /* New local heap data block */ + + /* check arguments */ + HDassert(heap); + + /* Allocate new local heap data block */ + if(NULL == (dblk = H5FL_CALLOC(H5HL_dblk_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for local heap data block") + + /* Increment ref. count on heap data structure */ + if(FAIL == H5HL__inc_rc(heap)) + H5E_THROW(H5E_CANTINC, "can't increment heap ref. count") + + /* Link the heap & the data block */ + dblk->heap = heap; + heap->dblk = dblk; + + /* Set the return value */ + ret_value = dblk; + +CATCH + /* Ensure that the data block memory is deallocated on errors */ + if(!ret_value && dblk != NULL) { + /* H5FL_FREE always returns NULL so we can't check for errors */ + dblk = H5FL_FREE(H5HL_dblk_t, dblk); + } + +END_FUNC(PKG) /* end H5HL__dblk_new() */ + + +/*------------------------------------------------------------------------- + * Function: H5HL__dblk_dest + * + * Purpose: Destroy a local heap data block object + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * Oct 12 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +herr_t, SUCCEED, FAIL, +H5HL__dblk_dest(H5HL_dblk_t *dblk)) + + /* check arguments */ + HDassert(dblk); + + /* Check if data block was initialized */ + if(dblk->heap) { + /* Unlink data block from heap */ + dblk->heap->dblk = NULL; + + /* Unpin the local heap prefix */ + if(FAIL == H5AC_unpin_entry(dblk->heap->prfx)) + H5E_THROW(H5E_CANTUNPIN, "can't unpin local heap prefix") + + /* Decrement ref. count on heap data structure */ + if(FAIL == H5HL__dec_rc(dblk->heap)) + H5E_THROW(H5E_CANTDEC, "can't decrement heap ref. count") + + /* Unlink heap from data block */ + dblk->heap = NULL; + } /* end if */ + +CATCH + /* Free local heap data block */ + /* H5FL_FREE always returns NULL so we can't check for errors */ + dblk = H5FL_FREE(H5HL_dblk_t, dblk); + +END_FUNC(PKG) /* end H5HL__dblk_dest() */ + + +/*------------------------------------------------------------------------- + * Function: H5HL__dblk_realloc + * + * Purpose: Reallocate data block for heap + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * Oct 12 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +herr_t, SUCCEED, FAIL, +H5HL__dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size)) + + H5HL_dblk_t *dblk; /* Local heap data block */ + haddr_t old_addr; /* Old location of heap data block */ + haddr_t new_addr; /* New location of heap data block */ + size_t old_heap_size; /* Old size of heap data block */ + + /* check arguments */ + HDassert(heap); + HDassert(new_heap_size > 0); + + /* Release old space on disk */ + old_addr = heap->dblk_addr; + old_heap_size = heap->dblk_size; + H5_CHECK_OVERFLOW(old_heap_size, size_t, hsize_t); + if(FAIL == H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, old_addr, (hsize_t)old_heap_size)) + H5E_THROW(H5E_CANTFREE, "can't free old local heap data"); + + /* Allocate new space on disk */ + H5_CHECK_OVERFLOW(new_heap_size, size_t, hsize_t); + if(HADDR_UNDEF == (new_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, (hsize_t)new_heap_size))) + H5E_THROW(H5E_CANTALLOC, "unable to allocate file space for local heap"); + + /* Update heap info*/ + heap->dblk_addr = new_addr; + heap->dblk_size = new_heap_size; + + /* Check if heap data block actually moved in the file */ + if(H5F_addr_eq(old_addr, new_addr)) { + /* Check if heap data block is contiguous w/prefix */ + if(heap->single_cache_obj) { + /* Sanity check */ + HDassert(H5F_addr_eq(heap->prfx_addr + heap->prfx_size, old_addr)); + HDassert(heap->prfx); + + /* Resize the heap prefix in the cache */ + if(FAIL == H5AC_resize_entry(heap->prfx, (size_t)(heap->prfx_size + new_heap_size))) + H5E_THROW(H5E_CANTRESIZE, "unable to resize heap in cache"); + + } /* end if */ + else { + /* Sanity check */ + HDassert(H5F_addr_ne(heap->prfx_addr + heap->prfx_size, old_addr)); + HDassert(heap->dblk); + + /* Resize the heap data block in the cache */ + if(H5AC_resize_entry(heap->dblk, (size_t)new_heap_size) < 0) + H5E_THROW(H5E_CANTRESIZE, "unable to resize heap (data block) in cache"); + + } /* end else */ + } /* end if */ + else { + /* Check if heap data block was contiguous w/prefix previously */ + if(heap->single_cache_obj) { + /* Create new heap data block */ + if(NULL == (dblk = H5HL__dblk_new(heap))) + H5E_THROW(H5E_CANTALLOC, "unable to allocate local heap data block"); + + /* Resize current heap prefix */ + heap->prfx_size = H5HL_SIZEOF_HDR(f); + if(FAIL == H5AC_resize_entry(heap->prfx, (size_t)heap->prfx_size)) + H5E_THROW(H5E_CANTRESIZE, "unable to resize heap prefix in cache"); + + /* Insert data block into cache (pinned) */ + if(FAIL == H5AC_insert_entry(f, dxpl_id, H5AC_LHEAP_DBLK, new_addr, dblk, H5AC__PIN_ENTRY_FLAG)) + H5E_THROW(H5E_CANTINIT, "unable to cache local heap data block"); + + dblk = NULL; + + /* Reset 'single cache object' flag */ + heap->single_cache_obj = FALSE; + } /* end if */ + else { + /* Resize the heap data block in the cache */ + /* (ignore [unlikely] case where heap data block ends up + * contiguous w/heap prefix again. + */ + if(FAIL == H5AC_resize_entry(heap->dblk, (size_t)new_heap_size)) + H5E_THROW(H5E_CANTRESIZE, "unable to resize heap data block in cache"); + + /* Relocate the heap data block in the cache */ + if(FAIL == H5AC_move_entry(f, H5AC_LHEAP_DBLK, old_addr, new_addr)) + H5E_THROW(H5E_CANTMOVE, "unable to move heap data block in cache"); + + } /* end else */ + } /* end else */ + +CATCH + /* Restore old heap address & size on errors */ + if(FAIL == ret_value) { + heap->dblk_addr = old_addr; + heap->dblk_size = old_heap_size; + } /* end if */ + +END_FUNC(PKG) /* end H5HL__dblk_realloc() */ diff --git a/src/H5HLint.c b/src/H5HLint.c index bbf579d..5b547cf 100644 --- a/src/H5HLint.c +++ b/src/H5HLint.c @@ -15,11 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5HLint.c - * Oct 12 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5HLint.c + * Oct 12 2008 + * Quincey Koziol <koziol@hdfgroup.org> * - * Purpose: Local heap internal routines. + * Purpose: Local heap internal routines. * *------------------------------------------------------------------------- */ @@ -34,9 +34,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5HLpkg.h" /* Local Heaps */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5HLpkg.h" /* Local Heaps */ /****************/ @@ -76,35 +77,26 @@ /* Declare a free list to manage the H5HL_t struct */ H5FL_DEFINE_STATIC(H5HL_t); -/* Declare a free list to manage the H5HL_dblk_t struct */ -H5FL_DEFINE_STATIC(H5HL_dblk_t); - -/* Declare a free list to manage the H5HL_prfx_t struct */ -H5FL_DEFINE_STATIC(H5HL_prfx_t); - /*------------------------------------------------------------------------- - * Function: H5HL_new + * Function: H5HL__new * - * Purpose: Create a new local heap object + * Purpose: Create a new local heap object * - * Return: Success: non-NULL pointer to new local heap - * Failure: NULL + * Return: Success: non-NULL pointer to new local heap + * Failure: NULL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jan 5 2010 + * Programmer: Quincey Koziol + * Jan 5 2010 * *------------------------------------------------------------------------- */ -H5HL_t * -H5HL_new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size) -{ - H5HL_t *heap = NULL; /* New local heap */ - H5HL_t *ret_value = NULL; /* Return value */ +BEGIN_FUNC(PKG, ERR, +H5HL_t *, NULL, NULL, +H5HL__new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size)) - FUNC_ENTER_NOAPI(NULL) + H5HL_t *heap = NULL; /* New local heap */ /* check arguments */ HDassert(sizeof_size > 0); @@ -113,7 +105,7 @@ H5HL_new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size) /* Allocate new local heap structure */ if(NULL == (heap = H5FL_CALLOC(H5HL_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); /* Initialize non-zero fields */ heap->sizeof_size = sizeof_size; @@ -123,29 +115,29 @@ H5HL_new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size) /* Set the return value */ ret_value = heap; -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_new() */ +CATCH + if(!ret_value && heap != NULL) + if (NULL == (heap = H5FL_FREE(H5HL_t, heap))) + H5E_THROW(H5E_CANTFREE, "can't free heap memory"); + +END_FUNC(PKG) /* end H5HL__new() */ /*------------------------------------------------------------------------- * Function: H5HL__inc_rc * - * Purpose: Increment ref. count on heap + * Purpose: Increment ref. count on heap * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Oct 12 2008 + * Programmer: Quincey Koziol + * Oct 12 2008 * *------------------------------------------------------------------------- */ -static herr_t -H5HL__inc_rc(H5HL_t *heap) -{ - FUNC_ENTER_STATIC_NOERR +BEGIN_FUNC(PKG, NOERR, +herr_t, SUCCEED, -, +H5HL__inc_rc(H5HL_t *heap)) /* check arguments */ HDassert(heap); @@ -153,28 +145,24 @@ H5HL__inc_rc(H5HL_t *heap) /* Increment heap's ref. count */ heap->rc++; - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HL__inc_rc() */ +END_FUNC(PKG) /* end H5HL__inc_rc() */ /*------------------------------------------------------------------------- * Function: H5HL__dec_rc * - * Purpose: Decrement ref. count on heap + * Purpose: Decrement ref. count on heap * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Oct 12 2008 + * Programmer: Quincey Koziol + * Oct 12 2008 * *------------------------------------------------------------------------- */ -static herr_t -H5HL__dec_rc(H5HL_t *heap) -{ - FUNC_ENTER_STATIC_NOERR +BEGIN_FUNC(PKG, ERR, +herr_t, SUCCEED, FAIL, +H5HL__dec_rc(H5HL_t *heap)) /* check arguments */ HDassert(heap); @@ -182,31 +170,29 @@ H5HL__dec_rc(H5HL_t *heap) /* Decrement heap's ref. count */ heap->rc--; +CATCH /* Check if we should destroy the heap */ - if(heap->rc == 0) - H5HL_dest(heap); + if(heap->rc == 0 && FAIL == H5HL__dest(heap)) + H5E_THROW(H5E_CANTFREE, "unable to destroy local heap"); - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HL__dec_rc() */ +END_FUNC(PKG) /* end H5HL__dec_rc() */ /*------------------------------------------------------------------------- - * Function: H5HL_dest + * Function: H5HL__dest * - * Purpose: Destroys a heap in memory. + * Purpose: Destroys a heap in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jan 15 2003 + * Programmer: Quincey Koziol + * Jan 15 2003 * *------------------------------------------------------------------------- */ -herr_t -H5HL_dest(H5HL_t *heap) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR +BEGIN_FUNC(PKG, ERR, +herr_t, SUCCEED, FAIL, +H5HL__dest(H5HL_t *heap)) /* check arguments */ HDassert(heap); @@ -217,201 +203,20 @@ H5HL_dest(H5HL_t *heap) HDassert(heap->prfx == NULL); HDassert(heap->dblk == NULL); +CATCH if(heap->dblk_image) - heap->dblk_image = H5FL_BLK_FREE(lheap_chunk, heap->dblk_image); + if(NULL != (heap->dblk_image = H5FL_BLK_FREE(lheap_chunk, heap->dblk_image))) + H5E_THROW(H5E_CANTFREE, "unable to free local heap data block image"); while(heap->freelist) { H5HL_free_t *fl; fl = heap->freelist; heap->freelist = fl->next; - fl = H5FL_FREE(H5HL_free_t, fl); + if(NULL != (fl = H5FL_FREE(H5HL_free_t, fl))) + H5E_THROW(H5E_CANTFREE, "unable to free local heap free list"); } /* end while */ - heap = H5FL_FREE(H5HL_t, heap); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HL_dest() */ - - -/*------------------------------------------------------------------------- - * Function: H5HL_prfx_new - * - * Purpose: Create a new local heap prefix object - * - * Return: Success: non-NULL pointer to new local heap prefix - * Failure: NULL - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Oct 12 2008 - * - *------------------------------------------------------------------------- - */ -H5HL_prfx_t * -H5HL_prfx_new(H5HL_t *heap) -{ - H5HL_prfx_t *prfx = NULL; /* New local heap prefix */ - H5HL_prfx_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check arguments */ - HDassert(heap); - - /* Allocate new local heap prefix */ - if(NULL == (prfx = H5FL_CALLOC(H5HL_prfx_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") - - /* Increment ref. count on heap data structure */ - if(H5HL__inc_rc(heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count") - - /* Link the heap & the prefix */ - prfx->heap = heap; - heap->prfx = prfx; - - /* Set the return value */ - ret_value = prfx; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_prfx_new() */ - - -/*------------------------------------------------------------------------- - * Function: H5HL_prfx_dest - * - * Purpose: Destroy a local heap prefix object - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Oct 12 2008 - * - *------------------------------------------------------------------------- - */ -herr_t -H5HL_prfx_dest(H5HL_prfx_t *prfx) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* check arguments */ - HDassert(prfx); - - /* Check if prefix was initialized */ - if(prfx->heap) { - /* Unlink prefix from heap */ - prfx->heap->prfx = NULL; - - /* Decrement ref. count on heap data structure */ - if(H5HL__dec_rc(prfx->heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count") - - /* Unlink heap from prefix */ - prfx->heap = NULL; - } /* end if */ - - /* Free local heap prefix */ - prfx = H5FL_FREE(H5HL_prfx_t, prfx); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_prfx_dest() */ - - -/*------------------------------------------------------------------------- - * Function: H5HL_dblk_new - * - * Purpose: Create a new local heap data block object - * - * Return: Success: non-NULL pointer to new local heap data block - * Failure: NULL - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Oct 12 2008 - * - *------------------------------------------------------------------------- - */ -H5HL_dblk_t * -H5HL_dblk_new(H5HL_t *heap) -{ - H5HL_dblk_t *dblk = NULL; /* New local heap data block */ - H5HL_dblk_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check arguments */ - HDassert(heap); - - /* Allocate new local heap data block */ - if(NULL == (dblk = H5FL_CALLOC(H5HL_dblk_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") - - /* Increment ref. count on heap data structure */ - if(H5HL__inc_rc(heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count") - - /* Link the heap & the data block */ - dblk->heap = heap; - heap->dblk = dblk; - - /* Set the return value */ - ret_value = dblk; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_dblk_new() */ - - -/*------------------------------------------------------------------------- - * Function: H5HL_dblk_dest - * - * Purpose: Destroy a local heap data block object - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Oct 12 2008 - * - *------------------------------------------------------------------------- - */ -herr_t -H5HL_dblk_dest(H5HL_dblk_t *dblk) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* check arguments */ - HDassert(dblk); - - /* Check if data block was initialized */ - if(dblk->heap) { - /* Unlink data block from heap */ - dblk->heap->dblk = NULL; - - /* Unpin the local heap prefix */ - if(H5AC_unpin_entry(dblk->heap->prfx) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "can't unpin local heap prefix") - - /* Decrement ref. count on heap data structure */ - if(H5HL__dec_rc(dblk->heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count") - - /* Unlink heap from data block */ - dblk->heap = NULL; - } /* end if */ - - /* Free local heap data block */ - dblk = H5FL_FREE(H5HL_dblk_t, dblk); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_dblk_dest() */ + + if(NULL != (heap = H5FL_FREE(H5HL_t, heap))) + H5E_THROW(H5E_CANTFREE, "unable to free local heap"); +END_FUNC(PKG) /* end H5HL__dest() */ diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h index 6e35add..fb8667b 100644 --- a/src/H5HLpkg.h +++ b/src/H5HLpkg.h @@ -14,7 +14,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol <koziol@hdfgroup.org> * Wednesday, July 9, 2003 * * Purpose: This file contains declarations which are visible @@ -32,7 +32,7 @@ #include "H5HLprivate.h" /* Other private headers needed by this file */ -#include "H5FLprivate.h" /* Free lists */ +#include "H5FLprivate.h" /* Free lists */ /*****************************/ @@ -56,16 +56,26 @@ H5FL_BLK_EXTERN(lheap_chunk); /* Package Private Macros */ /**************************/ -#define H5HL_SIZEOF_HDR(F) \ - H5HL_ALIGN(H5_SIZEOF_MAGIC + /*heap signature */ \ - 1 + /*version */ \ - 3 + /*reserved */ \ - H5F_SIZEOF_SIZE(F) + /*data size */ \ - H5F_SIZEOF_SIZE(F) + /*free list head */ \ - H5F_SIZEOF_ADDR(F)) /*data address */ +/* If this package header is being included in one of the H5HL source files, + * define the proper control macros for the generic FUNC_ENTER/LEAVE and + * error reporting macros. + */ +#ifdef H5HL_PACKAGE +#define H5_MY_PKG H5HL +#define H5_MY_PKG_ERR H5E_HEAP +#define H5_MY_PKG_INIT NO +#endif /* H5HL_PACKAGE */ + +#define H5HL_SIZEOF_HDR(F) \ + H5HL_ALIGN(H5_SIZEOF_MAGIC + /* heap signature */ \ + 1 + /* version */ \ + 3 + /* reserved */ \ + H5F_SIZEOF_SIZE(F) + /* data size */ \ + H5F_SIZEOF_SIZE(F) + /* free list head */ \ + H5F_SIZEOF_ADDR(F)) /* data address */ /* Value indicating end of free list on disk */ -#define H5HL_FREE_NULL 1 +#define H5HL_FREE_NULL 1 /****************************/ @@ -73,10 +83,10 @@ H5FL_BLK_EXTERN(lheap_chunk); /****************************/ typedef struct H5HL_free_t { - size_t offset; /*offset of free block */ - size_t size; /*size of free block */ - struct H5HL_free_t *prev; /*previous entry in free list */ - struct H5HL_free_t *next; /*next entry in free list */ + size_t offset; /* offset of free block */ + size_t size; /* size of free block */ + struct H5HL_free_t *prev; /* previous entry in free list */ + struct H5HL_free_t *next; /* next entry in free list */ } H5HL_free_t; /* Forward declarations */ @@ -85,38 +95,38 @@ typedef struct H5HL_prfx_t H5HL_prfx_t; struct H5HL_t { /* General heap-management fields */ - size_t rc; /* Ref. count for prefix & data block using this struct */ - size_t prots; /* # of times the heap has been protected */ - size_t sizeof_size; /* Size of file sizes */ - size_t sizeof_addr; /* Size of file addresses */ - hbool_t single_cache_obj; /* Indicate if the heap is a single object in the cache */ - H5HL_free_t *freelist; /*the free list */ + size_t rc; /* Ref. count for prefix & data block using this struct */ + size_t prots; /* # of times the heap has been protected */ + size_t sizeof_size; /* Size of file sizes */ + size_t sizeof_addr; /* Size of file addresses */ + hbool_t single_cache_obj; /* Indicate if the heap is a single object in the cache */ + H5HL_free_t *freelist; /* the free list */ /* Prefix-specific fields */ - H5HL_prfx_t *prfx; /* The prefix object for the heap */ - haddr_t prfx_addr; /* address of heap prefix */ - size_t prfx_size; /* size of heap prefix */ - hsize_t free_block; /* Address of first free block */ + H5HL_prfx_t *prfx; /* The prefix object for the heap */ + haddr_t prfx_addr; /* address of heap prefix */ + size_t prfx_size; /* size of heap prefix */ + hsize_t free_block; /* Address of first free block */ /* Data block-specific fields */ - H5HL_dblk_t *dblk; /* The data block object for the heap */ - haddr_t dblk_addr; /* address of data block */ - size_t dblk_size; /* size of heap data block on disk and in mem */ - uint8_t *dblk_image; /* The data block image */ + H5HL_dblk_t *dblk; /* The data block object for the heap */ + haddr_t dblk_addr; /* address of data block */ + size_t dblk_size; /* size of heap data block on disk and in mem */ + uint8_t *dblk_image; /* The data block image */ }; /* Struct for heap data block */ struct H5HL_dblk_t { - H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ - /* first field in structure */ - H5HL_t *heap; /* Pointer to heap for data block */ + H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ + /* first field in structure */ + H5HL_t *heap; /* Pointer to heap for data block */ }; /* Struct for heap prefix */ struct H5HL_prfx_t { - H5AC_info_t cache_info; /* Information for H5AC cache functions, */ - /* _must_ be first field in structure */ - H5HL_t *heap; /* Pointer to heap for prefix */ + H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ + /* first field in structure */ + H5HL_t *heap; /* Pointer to heap for prefix */ }; /* Callback information for loading local heap prefix from disk */ @@ -137,10 +147,10 @@ typedef struct H5HL_cache_prfx_ud_t { /* Callback information for loading local heap data block from disk */ typedef struct H5HL_cache_dblk_ud_t { /* Downwards */ - H5HL_t *heap; /* Local heap */ + H5HL_t *heap; /* Local heap */ /* Upwards */ - hbool_t loaded; /* Whether data block was loaded from file */ + hbool_t loaded; /* Whether data block was loaded from file */ } H5HL_cache_dblk_ud_t; @@ -149,16 +159,18 @@ typedef struct H5HL_cache_dblk_ud_t { /******************************/ /* Heap routines */ -H5_DLL H5HL_t *H5HL_new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size); -H5_DLL herr_t H5HL_dest(H5HL_t *heap); +H5_DLL H5HL_t *H5HL__new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size); +H5_DLL herr_t H5HL__dest(H5HL_t *heap); +H5_DLL herr_t H5HL__inc_rc(H5HL_t *heap); +H5_DLL herr_t H5HL__dec_rc(H5HL_t *heap); /* Heap prefix routines */ -H5_DLL H5HL_prfx_t *H5HL_prfx_new(H5HL_t *heap); -H5_DLL herr_t H5HL_prfx_dest(H5HL_prfx_t *prfx); +H5_DLL H5HL_prfx_t *H5HL__prfx_new(H5HL_t *heap); +H5_DLL herr_t H5HL__prfx_dest(H5HL_prfx_t *prfx); /* Heap data block routines */ -H5_DLL H5HL_dblk_t *H5HL_dblk_new(H5HL_t *heap); -H5_DLL herr_t H5HL_dblk_dest(H5HL_dblk_t *dblk); +H5_DLL H5HL_dblk_t *H5HL__dblk_new(H5HL_t *heap); +H5_DLL herr_t H5HL__dblk_dest(H5HL_dblk_t *dblk); +H5_DLL herr_t H5HL__dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size); #endif /* _H5HLpkg_H */ - diff --git a/src/H5HLprfx.c b/src/H5HLprfx.c new file mode 100644 index 0000000..66c4dad --- /dev/null +++ b/src/H5HLprfx.c @@ -0,0 +1,166 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5HLprfx.c + * Summer 2012 + * Dana Robinson <derobins@hdfgroup.org> + * + * Purpose: Prefix routines for local heaps. + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5HLmodule.h" /* This source code file is part of the H5HL module */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5HLpkg.h" /* Local Heaps */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Declare a free list to manage the H5HL_prfx_t struct */ +H5FL_DEFINE_STATIC(H5HL_prfx_t); + + + +/*------------------------------------------------------------------------- + * Function: H5HL__prfx_new + * + * Purpose: Create a new local heap prefix object + * + * Return: Success: non-NULL pointer to new local heap prefix + * Failure: NULL + * + * Programmer: Quincey Koziol + * Oct 12 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +H5HL_prfx_t *, NULL, NULL, +H5HL__prfx_new(H5HL_t *heap)) + + H5HL_prfx_t *prfx = NULL; /* New local heap prefix */ + + /* check arguments */ + HDassert(heap); + + /* Allocate new local heap prefix */ + if(NULL == (prfx = H5FL_CALLOC(H5HL_prfx_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for local heap prefix") + + /* Increment ref. count on heap data structure */ + if(FAIL == H5HL__inc_rc(heap)) + H5E_THROW(H5E_CANTINC, "can't increment heap ref. count") + + /* Link the heap & the prefix */ + prfx->heap = heap; + heap->prfx = prfx; + + /* Set the return value */ + ret_value = prfx; + +CATCH + /* Ensure that the prefix memory is deallocated on errors */ + if(!ret_value && prfx != NULL) { + /* H5FL_FREE always returns NULL so we can't check for errors */ + prfx = H5FL_FREE(H5HL_prfx_t, prfx); + } + +END_FUNC(PKG) /* end H5HL__prfx_new() */ + + +/*------------------------------------------------------------------------- + * Function: H5HL__prfx_dest + * + * Purpose: Destroy a local heap prefix object + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * Oct 12 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +herr_t, SUCCEED, FAIL, +H5HL__prfx_dest(H5HL_prfx_t *prfx)) + + /* check arguments */ + HDassert(prfx); + + /* Check if prefix was initialized */ + if(prfx->heap) { + /* Unlink prefix from heap */ + prfx->heap->prfx = NULL; + + /* Decrement ref. count on heap data structure */ + if(FAIL == H5HL__dec_rc(prfx->heap)) + H5E_THROW(H5E_CANTDEC, "can't decrement heap ref. count") + + /* Unlink heap from prefix */ + prfx->heap = NULL; + } /* end if */ + +CATCH + /* Free prefix memory */ + /* H5FL_FREE always returns NULL so we can't check for errors */ + prfx = H5FL_FREE(H5HL_prfx_t, prfx); + +END_FUNC(PKG) /* end H5HL__prfx_dest() */ diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index 3035689..e2bf29c 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -15,13 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5HLprivate.h - * Jul 16 1997 - * Robb Matzke <matzke@llnl.gov> + * Created: H5HLprivate.h + * Jul 16 1997 + * Robb Matzke <matzke@llnl.gov> * - * Purpose: - * - * Modifications: + * Purpose: Private declarations for the H5HL (local heap) package. * *------------------------------------------------------------------------- */ @@ -32,23 +30,23 @@ #include "H5HLpublic.h" /* Private headers needed by this file. */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Fprivate.h" /* File access */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Fprivate.h" /* File access */ /* * Feature: Define H5HL_DEBUG on the compiler command line if you want to - * diagnostic messages from this layer. + * enable diagnostic messages from this layer. */ #ifdef NDEBUG # undef H5HL_DEBUG #endif -#define H5HL_ALIGN(X) ((((unsigned)X)+7)&(unsigned)(~0x07)) /*align on 8-byte boundary */ +#define H5HL_ALIGN(X) ((((unsigned)X)+7)&(unsigned)(~0x07)) /* align on 8-byte boundary */ -#define H5HL_SIZEOF_FREE(F) \ - H5HL_ALIGN(H5F_SIZEOF_SIZE (F) + /*ptr to next free block */ \ - H5F_SIZEOF_SIZE (F)) /*size of this free block */ +#define H5HL_SIZEOF_FREE(F) \ + H5HL_ALIGN(H5F_SIZEOF_SIZE (F) + /* ptr to next free block */ \ + H5F_SIZEOF_SIZE (F)) /* size of this free block */ /****************************/ /* Library Private Typedefs */ @@ -58,22 +56,23 @@ typedef struct H5HL_t H5HL_t; /* - * Library prototypes... + * Library prototypes */ H5_DLL herr_t H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr/*out*/); -H5_DLL H5HL_t *H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags); +H5_DLL herr_t H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr); +H5_DLL herr_t H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size); +H5_DLL herr_t H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size); +H5_DLL size_t H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t size, + const void *buf); H5_DLL void *H5HL_offset_into(const H5HL_t *heap, size_t offset); +H5_DLL H5HL_t *H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags); H5_DLL herr_t H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size); H5_DLL herr_t H5HL_unprotect(H5HL_t *heap); -H5_DLL size_t H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t size, - const void *buf); -H5_DLL herr_t H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr); -H5_DLL herr_t H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size); -H5_DLL herr_t H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size); -/* Debugging functions */ +/* Debugging routines for dumping file structures */ H5_DLL herr_t H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, - int fwidth); + int fwidth); + #endif diff --git a/src/H5HLpublic.h b/src/H5HLpublic.h index db00f51..6dc1828 100644 --- a/src/H5HLpublic.h +++ b/src/H5HLpublic.h @@ -21,8 +21,6 @@ * * Purpose: Public declarations for the H5HL (local heap) package. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5HLpublic_H @@ -15,13 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5MM.c - * Jul 10 1997 - * Robb Matzke <matzke@llnl.gov> - * - * Purpose: Memory management functions. + * Created: H5MM.c + * Jul 10 1997 + * Robb Matzke <matzke@llnl.gov> * - * Modifications: + * Purpose: Memory management functions * *------------------------------------------------------------------------- */ @@ -168,7 +166,6 @@ H5MM_realloc(void *mem, size_t size) * NULL is an acceptable value for the input string. * * Return: Success: Pointer to a new string (NULL if s is NULL). - * * Failure: abort() * * Programmer: Robb Matzke @@ -179,7 +176,7 @@ H5MM_realloc(void *mem, size_t size) char * H5MM_xstrdup(const char *s) { - char *ret_value = NULL; + char *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) @@ -204,7 +201,6 @@ done: * an error will be raised. * * Return: Success: Pointer to a new string - * * Failure: abort() * * Programmer: Robb Matzke @@ -231,21 +227,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5MM_xfree + * Function: H5MM_xfree * - * Purpose: Just like free(3) except null pointers are allowed as - * arguments, and the return value (always NULL) can be - * assigned to the pointer whose memory was just freed: + * Purpose: Just like free(3) except null pointers are allowed as + * arguments, and the return value (always NULL) can be + * assigned to the pointer whose memory was just freed: * - * thing = H5MM_xfree (thing); + * thing = H5MM_xfree (thing); * - * Return: Success: NULL + * Return: Success: NULL + * Failure: never fails * - * Failure: never fails - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 10 1997 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jul 10 1997 * *------------------------------------------------------------------------- */ @@ -2879,7 +2879,7 @@ H5O_get_info(const H5O_loc_t *loc, hid_t dxpl_id, hbool_t want_ih_info, /* Check for 'bh_info' callback for this type of object */ if(obj_class->bh_info) { /* Call the object's class 'bh_info' routine */ - if((obj_class->bh_info)(loc->file, dxpl_id, oh, &oinfo->meta_size.obj) < 0) + if((obj_class->bh_info)(loc, dxpl_id, oh, &oinfo->meta_size.obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info") } /* end if */ diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index e641d70..02c72e7 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -337,7 +337,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, size_t null_msgs; /* Number of NULL messages found in each loop */ size_t orig_dst_msgs; /* Original # of messages in dest. object */ H5O_mesg_t *mesg_src; /* Message in source object header */ - H5O_mesg_t *mesg_dst; /* Message in source object header */ + H5O_mesg_t *mesg_dst; /* Message in destination object header */ const H5O_msg_class_t *copy_type; /* Type of message to use for copying */ const H5O_obj_class_t *obj_class = NULL; /* Type of object we are copying */ void *cpy_udata = NULL; /* User data for passing to message callbacks */ @@ -357,12 +357,11 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, HDassert(cpy_info); /* Get pointer to object class for this object */ - if((obj_class = H5O_obj_class(oloc_src, dxpl_id)) == NULL) + if(NULL == (obj_class = H5O_obj_class(oloc_src, dxpl_id))) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type") /* Check if the object at the address is already open in the file */ if(H5FO_opened(oloc_src->file, oloc_src->addr) != NULL) { - H5G_loc_t tmp_loc; /* Location of object */ H5O_loc_t tmp_oloc; /* Location of object */ H5G_name_t tmp_path; /* Object's path */ @@ -377,15 +376,14 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, /* Flush the object of this class */ if(obj_class->flush && obj_class->flush(&tmp_loc, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") - } + } /* end if */ /* Get source object header */ if(NULL == (oh_src = H5O_protect(oloc_src, dxpl_id, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Retrieve user data for particular type of object to copy */ - if(obj_class->get_copy_file_udata && - (NULL == (cpy_udata = (obj_class->get_copy_file_udata)()))) + if(obj_class->get_copy_file_udata && (NULL == (cpy_udata = (obj_class->get_copy_file_udata)()))) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to retrieve copy user data") /* If we are merging committed datatypes, check for a match in the destination @@ -468,7 +466,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, oh_dst->alloc_nchunks = oh_dst->nchunks = 0; /* Allocate memory for the chunk array - always start with 1 chunk */ - if(NULL == (oh_dst->chunk = H5FL_SEQ_MALLOC(H5O_chunk_t, 1))) + if(NULL == (oh_dst->chunk = H5FL_SEQ_MALLOC(H5O_chunk_t, (size_t)1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Update number of allocated chunks. There are still no chunks used. */ diff --git a/src/H5Odtype.c b/src/H5Odtype.c index cee6e1e..e51d319 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -263,7 +263,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p unsigned offset_nbytes; /* Size needed to encode member offsets */ size_t max_memb_pos = 0; /* Maximum member covered, so far */ unsigned max_version = 0; /* Maximum member version */ - hbool_t upgrade_to = 0; /* Version number we can "soft" upgrade to */ + unsigned upgrade_to = 0; /* Version number we can "soft" upgrade to */ unsigned j; /* Compute the # of bytes required to store a member offset */ diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 25ab753..149c8b2 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -476,7 +476,7 @@ H5O_efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_ds HGOTO_ERROR(H5E_EFL, H5E_PROTECT, NULL, "unable to protect EFL file name heap") /* Insert "empty" name first */ - if((size_t)(-1) == (name_offset = H5HL_insert(file_dst, dxpl_id, heap, (size_t)1, ""))) + if(UFAIL == (name_offset = H5HL_insert(file_dst, dxpl_id, heap, (size_t)1, ""))) HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap") HDassert(0 == name_offset); @@ -493,7 +493,7 @@ H5O_efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_ds /* copy the name from the source */ for(idx = 0; idx < efl_src->nused; idx++) { efl_dst->slot[idx].name = H5MM_xstrdup(efl_src->slot[idx].name); - if((size_t)(-1) == (efl_dst->slot[idx].name_offset = H5HL_insert(file_dst, dxpl_id, heap, + if(UFAIL == (efl_dst->slot[idx].name_offset = H5HL_insert(file_dst, dxpl_id, heap, HDstrlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name))) HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap") } /* end for */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index daffe48..0c13498 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -40,19 +40,19 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_layout_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, +static void *H5O__layout_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); -static herr_t H5O_layout_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_layout_copy(const void *_mesg, void *_dest); -static size_t H5O_layout_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); -static herr_t H5O_layout_reset(void *_mesg); -static herr_t H5O_layout_free(void *_mesg); -static herr_t H5O_layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, +static herr_t H5O__layout_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__layout_copy(const void *_mesg, void *_dest); +static size_t H5O__layout_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__layout_reset(void *_mesg); +static herr_t H5O__layout_free(void *_mesg); +static herr_t H5O__layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg); -static void *H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, +static void *H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id); -static herr_t H5O_layout_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, +static herr_t H5O__layout_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); /* This message derives from H5O message class */ @@ -61,22 +61,22 @@ const H5O_msg_class_t H5O_MSG_LAYOUT[1] = {{ "layout", /*message name for debugging */ sizeof(H5O_layout_t), /*native message size */ 0, /* messages are sharable? */ - H5O_layout_decode, /*decode message */ - H5O_layout_encode, /*encode message */ - H5O_layout_copy, /*copy the native value */ - H5O_layout_size, /*size of message on disk */ - H5O_layout_reset, /*reset method */ - H5O_layout_free, /*free the struct */ - H5O_layout_delete, /* file delete method */ + H5O__layout_decode, /*decode message */ + H5O__layout_encode, /*encode message */ + H5O__layout_copy, /*copy the native value */ + H5O__layout_size, /*size of message on disk */ + H5O__layout_reset, /*reset method */ + H5O__layout_free, /*free the struct */ + H5O__layout_delete, /* file delete method */ NULL, /* link method */ NULL, /*set share method */ NULL, /*can share method */ NULL, /* pre copy native value to file */ - H5O_layout_copy_file, /* copy native value to file */ + H5O__layout_copy_file, /* copy native value to file */ NULL, /* post copy native value to file */ NULL, /* get creation index */ NULL, /* set creation index */ - H5O_layout_debug /*debug the message */ + H5O__layout_debug /*debug the message */ }}; @@ -85,7 +85,7 @@ H5FL_DEFINE(H5O_layout_t); /*------------------------------------------------------------------------- - * Function: H5O_layout_decode + * Function: H5O__layout_decode * * Purpose: Decode an data layout message and return a pointer to a * new one created with malloc(). @@ -100,7 +100,7 @@ H5FL_DEFINE(H5O_layout_t); *------------------------------------------------------------------------- */ static void * -H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, +H5O__layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { H5O_layout_t *mesg = NULL; @@ -108,7 +108,7 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * unsigned u; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -117,6 +117,7 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * /* decode */ if(NULL == (mesg = H5FL_CALLOC(H5O_layout_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + mesg->storage.type = H5D_LAYOUT_ERROR; mesg->version = *p++; if(mesg->version < H5O_LAYOUT_VERSION_1 || mesg->version > H5O_LAYOUT_VERSION_4) @@ -134,6 +135,9 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * mesg->type = (H5D_layout_t)*p++; HDassert(H5D_CONTIGUOUS == mesg->type || H5D_CHUNKED == mesg->type || H5D_COMPACT == mesg->type); + /* Set the storage type */ + mesg->storage.type = mesg->type; + /* Reserved bytes */ p += 5; @@ -194,16 +198,21 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * } /* end if */ } /* end if */ else { - /* Layout class */ + /* Layout & storage class */ mesg->type = mesg->storage.type = (H5D_layout_t)*p++; /* Interpret the rest of the message according to the layout class */ switch(mesg->type) { case H5D_COMPACT: + /* Compact data size */ UINT16DECODE(p, mesg->storage.u.compact.size); + if(mesg->storage.u.compact.size > 0) { + /* Allocate space for compact data */ if(NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed for compact data buffer") + + /* Compact data */ HDmemcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size); p += mesg->storage.u.compact.size; } /* end if */ @@ -213,7 +222,10 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * break; case H5D_CONTIGUOUS: + /* Contiguous storage address */ H5F_addr_decode(f, &p, &(mesg->storage.u.contig.addr)); + + /* Contiguous storage size */ H5F_DECODE_LENGTH(f, p, mesg->storage.u.contig.size); /* Set the layout operations */ @@ -409,11 +421,11 @@ done: heap_block = (uint8_t *)H5MM_xfree(heap_block); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_layout_decode() */ +} /* end H5O__layout_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_layout_encode + * Function: H5O__layout_encode * * Purpose: Encodes a message. * @@ -426,24 +438,10 @@ done: * Quincey Koziol, 2004-5-21 * We write out version 3 messages by default now. * - * Modifications: - * Robb Matzke, 1998-07-20 - * Rearranged the message to add a version number at the beginning. - * - * Raymond Lu, 2002-2-26 - * Added version number 2 case depends on if space has been allocated - * at the moment when layout header message is updated. - * - * Quincey Koziol, 2004-5-21 - * Added version number 3 case to straighten out problems with contiguous - * layout's sizes (was encoding them as 4-byte values when they were - * really n-byte values (where n usually is 8)) and additionally clean up - * the information written out. - * *------------------------------------------------------------------------- */ static herr_t -H5O_layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; uint8_t *heap_block = NULL; @@ -451,7 +449,7 @@ H5O_layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c unsigned u; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -482,7 +480,10 @@ H5O_layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c break; case H5D_CONTIGUOUS: + /* Contiguous storage address */ H5F_addr_encode(f, &p, mesg->storage.u.contig.addr); + + /* Contiguous storage size */ H5F_ENCODE_LENGTH(f, p, mesg->storage.u.contig.size); break; @@ -613,11 +614,11 @@ done: str_size = (size_t *)H5MM_xfree(str_size); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_layout_encode() */ +} /* end H5O__layout_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_layout_copy + * Function: H5O__layout_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -632,13 +633,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_layout_copy(const void *_mesg, void *_dest) +H5O__layout_copy(const void *_mesg, void *_dest) { const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; H5O_layout_t *dest = (H5O_layout_t *) _dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(mesg); @@ -665,6 +666,8 @@ H5O_layout_copy(const void *_mesg, void *_dest) /* Copy over the raw data */ HDmemcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size); } /* end if */ + else + HDassert(dest->storage.u.compact.buf == NULL); break; case H5D_CONTIGUOUS: @@ -697,11 +700,11 @@ done: dest = H5FL_FREE(H5O_layout_t, dest); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_layout_copy() */ +} /* end H5O__layout_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_layout_size + * Function: H5O__layout_size * * Purpose: Returns the size of the raw message in bytes. If it's * compact dataset, the data part is also included. @@ -717,12 +720,12 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -733,11 +736,11 @@ H5O_layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const voi ret_value = H5D__layout_meta_size(f, mesg, TRUE); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_layout_size() */ +} /* end H5O__layout_size() */ /*------------------------------------------------------------------------- - * Function: H5O_layout_reset + * Function: H5O__layout_reset * * Purpose: Frees resources within a data type message, but doesn't free * the message itself. @@ -750,12 +753,12 @@ H5O_layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const voi *------------------------------------------------------------------------- */ static herr_t -H5O_layout_reset(void *_mesg) +H5O__layout_reset(void *_mesg) { H5O_layout_t *mesg = (H5O_layout_t *)_mesg; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(mesg) { /* Free the compact storage buffer */ @@ -768,15 +771,16 @@ H5O_layout_reset(void *_mesg) /* Reset the message */ mesg->type = H5D_CONTIGUOUS; + mesg->version = H5O_LAYOUT_VERSION_DEFAULT; } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_layout_reset() */ +} /* end H5O__layout_reset() */ /*------------------------------------------------------------------------- - * Function: H5O_layout_free + * Function: H5O__layout_free * * Purpose: Free's the message * @@ -788,28 +792,25 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_layout_free(void *_mesg) +H5O__layout_free(void *_mesg) { H5O_layout_t *mesg = (H5O_layout_t *) _mesg; - herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC_NOERR HDassert(mesg); /* Free resources within the message */ - if(H5O_layout_reset(mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free message resources") + H5O__layout_reset(mesg); - mesg = H5FL_FREE(H5O_layout_t, mesg); + (void)H5FL_FREE(H5O_layout_t, mesg); -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_layout_free() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5O__layout_free() */ /*------------------------------------------------------------------------- - * Function: H5O_layout_delete + * Function: H5O__layout_delete * * Purpose: Free file space referenced by message * @@ -821,12 +822,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg) +H5O__layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg) { H5O_layout_t *mesg = (H5O_layout_t *) _mesg; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -865,11 +866,11 @@ H5O_layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_layout_delete() */ +} /* end H5O__layout_delete() */ /*------------------------------------------------------------------------- - * Function: H5O_layout_copy_file + * Function: H5O__layout_copy_file * * Purpose: Copies a message from _MESG to _DEST in file * @@ -883,7 +884,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, +H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hbool_t H5_ATTR_UNUSED *recompute_size, unsigned H5_ATTR_UNUSED *mesg_flags, H5O_copy_t *cpy_info, void *_udata, hid_t dxpl_id) { @@ -893,29 +894,26 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hbool_t copied = FALSE; /* Whether the data was copied */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(file_src); HDassert(layout_src); HDassert(file_dst); - /* Allocate space for the destination layout */ - if(NULL == (layout_dst = H5FL_MALLOC(H5O_layout_t))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed") - - /* Copy the "top level" information */ - *layout_dst = *layout_src; + /* Copy the layout information */ + if(NULL == (layout_dst = (H5O_layout_t *)H5O__layout_copy(layout_src, NULL))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy layout") /* Copy the layout type specific information */ switch(layout_src->type) { case H5D_COMPACT: - if(layout_src->storage.u.compact.buf) { + if(layout_src->storage.u.compact.buf) { /* copy compact raw data */ if(H5D__compact_copy(file_src, &layout_src->storage.u.compact, file_dst, &layout_dst->storage.u.compact, udata->src_dtype, cpy_info, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage") copied = TRUE; - } /* end if */ + } /* end if */ break; case H5D_CONTIGUOUS: @@ -970,11 +968,11 @@ done: layout_dst = H5FL_FREE(H5O_layout_t, layout_dst); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_layout_copy_file() */ +} /* end H5O__layout_copy_file() */ /*------------------------------------------------------------------------- - * Function: H5O_layout_debug + * Function: H5O__layout_debug * * Purpose: Prints debugging info for a message. * @@ -986,13 +984,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void *_mesg, +H5O__layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth) { const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; size_t u; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -1079,5 +1077,5 @@ H5O_layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const vo } /* end switch */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_layout_debug() */ +} /* end H5O__layout_debug() */ diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 622d57d..c61fa66 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -42,7 +42,7 @@ static size_t H5O_mtime_size(const H5F_t *f, hbool_t disable_shared, const void static herr_t H5O_mtime_reset(void *_mesg); static herr_t H5O_mtime_free(void *_mesg); static herr_t H5O_mtime_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, - int indent, int fwidth); + int indent, int fwidth); /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_MTIME[1] = {{ @@ -96,9 +96,6 @@ const H5O_msg_class_t H5O_MSG_MTIME_NEW[1] = {{ /* Current version of new mtime information */ #define H5O_MTIME_VERSION 1 -/* Track whether tzset routine was called */ -static hbool_t ntzset = FALSE; - /* Declare a free list to manage the time_t struct */ H5FL_DEFINE(time_t); @@ -148,7 +145,7 @@ H5O_mtime_new_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_ /* The return value */ if (NULL==(mesg = H5FL_MALLOC(time_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); *mesg = (time_t)tmp_time; /* Set return value */ @@ -183,8 +180,8 @@ H5O_mtime_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5 unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { time_t *mesg, the_time; - int i; struct tm tm; + int i; /* Local index variable */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -193,51 +190,22 @@ H5O_mtime_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5 HDassert(f); HDassert(p); - /* Initialize time zone information */ - if(!ntzset) { - HDtzset(); - ntzset = TRUE; - } /* end if */ - /* decode */ for(i = 0; i < 14; i++) if(!HDisdigit(p[i])) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message") - /* - * Convert YYYYMMDDhhmmss UTC to a time_t. This is a little problematic - * because mktime() operates on local times. We convert to local time - * and then figure out the adjustment based on the local time zone and - * daylight savings setting. - */ + /* Convert YYYYMMDDhhmmss UTC to a time_t. */ HDmemset(&tm, 0, sizeof tm); - tm.tm_year = (p[0]-'0')*1000 + (p[1]-'0')*100 + - (p[2]-'0')*10 + (p[3]-'0') - 1900; + tm.tm_year = (p[0]-'0')*1000 + (p[1]-'0')*100 + (p[2]-'0')*10 + (p[3]-'0') - 1900; tm.tm_mon = (p[4]-'0')*10 + (p[5]-'0') - 1; tm.tm_mday = (p[6]-'0')*10 + (p[7]-'0'); tm.tm_hour = (p[8]-'0')*10 + (p[9]-'0'); tm.tm_min = (p[10]-'0')*10 + (p[11]-'0'); tm.tm_sec = (p[12]-'0')*10 + (p[13]-'0'); - tm.tm_isdst = -1; /*figure it out*/ - if((time_t)-1 == (the_time = HDmktime(&tm))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message") - -#if defined(H5_HAVE_TM_GMTOFF) - /* BSD-like systems */ - the_time += tm.tm_gmtoff; -#elif defined(H5_HAVE_TIMEZONE) - /* GNU/Linux systems */ - the_time -= timezone - (tm.tm_isdst ? 3600 : 0); -#else - /* - * The catch-all. If we can't convert a character string universal - * coordinated time to a time_t value reliably then we can't decode the - * modification time message. This really isn't as bad as it sounds -- the - * only way a user can get the modification time is from our internal - * query routines, which can gracefully recover. - */ - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information") -#endif + tm.tm_isdst = -1; /* (figure it out) */ + if((time_t)-1 == (the_time = H5_make_time(&tm))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't construct time info") /* The return value */ if(NULL == (mesg = H5FL_MALLOC(time_t))) @@ -323,8 +291,8 @@ H5O_mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, /* encode */ tm = HDgmtime(mesg); sprintf((char*)p, "%04d%02d%02d%02d%02d%02d", - 1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); + 1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec); FUNC_LEAVE_NOAPI(SUCCEED) } @@ -507,7 +475,7 @@ H5O_mtime_free(void *mesg) */ static herr_t H5O_mtime_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void *_mesg, FILE *stream, - int indent, int fwidth) + int indent, int fwidth) { const time_t *mesg = (const time_t *)_mesg; struct tm *tm; @@ -527,7 +495,7 @@ H5O_mtime_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const voi HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Time:", buf); + "Time:", buf); FUNC_LEAVE_NOAPI(SUCCEED) } diff --git a/src/H5Opkg.h b/src/H5Opkg.h index ddcdb10..642e938 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -324,8 +324,8 @@ typedef struct H5O_obj_class_t { hid_t (*open)(const H5G_loc_t *, hid_t, hid_t, hbool_t ); /*open an object of this class */ void *(*create)(H5F_t *, void *, H5G_loc_t *, hid_t ); /*create an object of this class */ H5O_loc_t *(*get_oloc)(hid_t ); /*get the object header location for an object */ - herr_t (*bh_info)(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info); /*get the index & heap info for an object */ - herr_t (*flush)(H5G_loc_t *loc, hid_t dxpl_id); /*flush an opened object of this class */ + herr_t (*bh_info)(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info); /*get the index & heap info for an object */ + herr_t (*flush)(H5G_loc_t *loc, hid_t dxpl_id); /*flush an opened object of this class */ } H5O_obj_class_t; /* Node in skip list to map addresses from one file to another during object header copy */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 4586adb..0d77a83 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -382,11 +382,13 @@ typedef struct H5O_efl_t { */ #define H5O_LAYOUT_VERSION_4 4 +/* The default version of the format. (Earlier versions had bugs) */ +#define H5O_LAYOUT_VERSION_DEFAULT H5O_LAYOUT_VERSION_3 + /* The latest version of the format. Look through the 'encode' * and 'size' callbacks for places to change when updating this. */ #define H5O_LAYOUT_VERSION_LATEST H5O_LAYOUT_VERSION_4 - /* Forward declaration of structs used below */ struct H5D_layout_ops_t; /* Defined in H5Dpkg.h */ struct H5D_chunk_ops_t; /* Defined in H5Dpkg.h */ @@ -406,7 +408,7 @@ typedef struct H5O_storage_chunk_t { haddr_t idx_addr; /* File address of chunk index */ const struct H5D_chunk_ops_t *ops; /* Pointer to chunked storage operations */ union { - H5O_storage_chunk_btree_t btree; /* Information for v1 B-tree index */ + H5O_storage_chunk_btree_t btree; /* Information for v1 B-tree index */ } u; } H5O_storage_chunk_t; diff --git a/src/H5Otest.c b/src/H5Otest.c index b5f728a..1c149e3 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -253,9 +253,9 @@ herr_t H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) { H5O_t *oh = NULL; /* Object header */ - H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ + H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ H5O_ainfo_t ainfo; /* Attribute information for object */ - H5O_loc_t *loc; /* Pointer to object's location */ + H5O_loc_t *loc; /* Pointer to object's location */ hsize_t obj_nattrs; /* Number of attributes */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 0677517..afef06b 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -769,12 +769,16 @@ H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, HDassert(size == sizeof(H5O_layout_t)); /* Check for different layout type */ - if(layout1->type < layout2->type) HGOTO_DONE(-1) - if(layout1->type > layout2->type) HGOTO_DONE(1) + if(layout1->type < layout2->type) + HGOTO_DONE(-1) + if(layout1->type > layout2->type) + HGOTO_DONE(1) /* Check for different layout version */ - if(layout1->version < layout2->version) HGOTO_DONE(-1) - if(layout1->version > layout2->version) HGOTO_DONE(1) + if(layout1->version < layout2->version) + HGOTO_DONE(-1) + if(layout1->version > layout2->version) + HGOTO_DONE(1) /* Compare non-dataset-specific fields in layout info */ switch(layout1->type) { @@ -787,13 +791,17 @@ H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, unsigned u; /* Local index variable */ /* Check the number of dimensions */ - if(layout1->u.chunk.ndims < layout2->u.chunk.ndims) HGOTO_DONE(-1) - if(layout1->u.chunk.ndims > layout2->u.chunk.ndims) HGOTO_DONE(1) + if(layout1->u.chunk.ndims < layout2->u.chunk.ndims) + HGOTO_DONE(-1) + if(layout1->u.chunk.ndims > layout2->u.chunk.ndims) + HGOTO_DONE(1) /* Compare the chunk dims */ for(u = 0; u < layout1->u.chunk.ndims - 1; u++) { - if(layout1->u.chunk.dim[u] < layout2->u.chunk.dim[u]) HGOTO_DONE(-1) - if(layout1->u.chunk.dim[u] > layout2->u.chunk.dim[u]) HGOTO_DONE(1) + if(layout1->u.chunk.dim[u] < layout2->u.chunk.dim[u]) + HGOTO_DONE(-1) + if(layout1->u.chunk.dim[u] > layout2->u.chunk.dim[u]) + HGOTO_DONE(1) } /* end for */ } /* end case */ break; @@ -2133,7 +2141,6 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, H5O_storage_virtual_ent_t *old_list = NULL; /* List pointer previously on property list */ H5O_storage_virtual_ent_t *ent = NULL; /* Convenience pointer to new VDS entry */ hbool_t retrieved_layout = FALSE; /* Whether the layout has been retrieved */ - hbool_t adding_entry = FALSE; /* Whether we are in the middle of adding an entry */ hbool_t free_list = FALSE; /* Whether to free the list of virtual entries */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2207,7 +2214,6 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, HDmemset(ent, 0, sizeof(H5O_storage_virtual_ent_t)); /* Clear before starting to set up */ if(NULL == (ent->source_dset.virtual_select = H5S_copy(vspace, FALSE, TRUE))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy virtual selection") - adding_entry = TRUE; if(NULL == (ent->source_file_name = HDstrdup(src_file_name))) HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't duplicate source file name") if(NULL == (ent->source_dset_name = HDstrdup(src_dset_name))) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 21bf4c8..7e1e0ee 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -1244,7 +1244,7 @@ H5Pget_family_offset(hid_t fapl_id, hsize_t *offset) /* Get value */ if(offset) { 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") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set offset for family file") } /* end if */ done: @@ -1324,7 +1324,7 @@ H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type) /* Get value */ if(type) { 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") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get type for multi driver") } /* end if */ done: @@ -3030,7 +3030,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) H5_ENCODE_UNSIGNED(*pp, config->close_trace_file); - HDmemcpy(*pp, (const uint8_t *)(config->trace_file_name), H5AC__MAX_TRACE_FILE_NAME_LEN + 1); + HDmemcpy(*pp, (const uint8_t *)(config->trace_file_name), (size_t)(H5AC__MAX_TRACE_FILE_NAME_LEN + 1)); *pp += H5AC__MAX_TRACE_FILE_NAME_LEN + 1; H5_ENCODE_UNSIGNED(*pp, config->evictions_enabled); diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index f84fa7b..f028f7a 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -594,6 +594,7 @@ H5P__gcrt_group_info_dec(const void **_pp, void *_value) FUNC_ENTER_STATIC_NOERR /* Set property to default value */ + HDmemset(ginfo, 0, sizeof(H5O_ginfo_t)); *ginfo = H5G_def_ginfo_g; UINT32DECODE(*pp, ginfo->lheap_size_hint) @@ -692,6 +693,7 @@ H5P__gcrt_link_info_dec(const void **_pp, void *_value) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") /* Set property to default value */ + HDmemset(linfo, 0, sizeof(H5O_linfo_t)); *linfo = H5G_def_linfo_g; H5_DECODE_UNSIGNED(*pp, crt_order_flags) diff --git a/src/H5Pint.c b/src/H5Pint.c index 539fe68..ca56f82 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -584,12 +584,12 @@ H5P_term_package(void) /*-------------------------------------------------------------------------- NAME - H5P_do_prop_cb1 + H5P__do_prop_cb1 PURPOSE Internal routine to call a property list callback routine and update the property list accordingly. USAGE - herr_t H5P_do_prop_cb1(slist,prop,cb) + herr_t H5P__do_prop_cb1(slist,prop,cb) H5SL_t *slist; IN/OUT: Skip list to hold changed properties H5P_genprop_t *prop; IN: Property to call callback for H5P_prp_cb1_t *cb; IN: Callback routine to call @@ -605,13 +605,13 @@ H5P_term_package(void) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P_do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb) +H5P__do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb) { void *tmp_value = NULL; /* Temporary value buffer */ H5P_genprop_t *pcopy = NULL; /* Copy of property to insert into skip list */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(slist); @@ -650,7 +650,7 @@ done: H5P_free_prop(pcopy); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_do_prop_cb1() */ +} /* end H5P__do_prop_cb1() */ /*-------------------------------------------------------------------------- @@ -876,7 +876,7 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Call property copy callback, if it exists */ if(tmp->copy) { /* Call the callback & insert changed value into skip list (if necessary) */ - if(H5P_do_prop_cb1(new_plist->props,tmp,tmp->copy) < 0) + if(H5P__do_prop_cb1(new_plist->props, tmp, tmp->copy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't create property") } /* end if */ @@ -1729,7 +1729,7 @@ H5P_create(H5P_genclass_t *pclass) /* Call property creation callback, if it exists */ if(tmp->create) { /* Call the callback & insert changed value into skip list (if necessary) */ - if(H5P_do_prop_cb1(plist->props,tmp,tmp->create) < 0) + if(H5P__do_prop_cb1(plist->props, tmp, tmp->create) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL,"Can't create property") } /* end if */ diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 7ae5a6e..27044d5 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -1590,6 +1590,7 @@ H5P__ocrt_pipeline_dec(const void **_pp, void *_value) nused = (size_t)enc_value; /* Set property default value */ + HDmemset(pline, 0, sizeof(H5O_pline_t)); *pline = H5O_def_pline_g; for(u = 0; u < nused; u++) { diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index f2f7da0..6a1dbad 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -349,7 +349,6 @@ H5_DLL herr_t H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); H5_DLL herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); - H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size); H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); #ifdef H5_HAVE_PARALLEL diff --git a/src/H5Ptest.c b/src/H5Ptest.c index 30a98a4..8240f6a 100644 --- a/src/H5Ptest.c +++ b/src/H5Ptest.c @@ -165,7 +165,7 @@ H5P_reset_external_file_test(hid_t dcpl_id) /* set external file list */ if(H5P_poke(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file list") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1639,7 +1639,7 @@ H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *e */ for(x = 0; x < list->header->list_max; x++) { if((list->messages[x].location != H5SM_NO_LOC) && - (0 == H5SM_message_compare(key, &(list->messages[x])))) + (0 == H5SM__message_compare(key, &(list->messages[x])))) HGOTO_DONE(x) else if(empty_pos && list->messages[x].location == H5SM_NO_LOC) { /* Note position */ @@ -2672,8 +2672,6 @@ H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr, FILE *stream, "Location:", "in heap"); HDfprintf(stream, "%*s%-*s 0x%Zx\n", indent + 3, "", fwidth, "Heap ID:", list->messages[x].u.heap_loc.fheap_id); -H5HF_id_print(fh, dxpl_id, - &(list->messages[x].u.heap_loc.fheap_id), stream, indent + 6, (fwidth - 3)); HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", fwidth, "Reference count:", list->messages[x].u.heap_loc.ref_count); } /* end if */ diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c index e24dbb7..e533ae8 100644 --- a/src/H5SMbtree2.c +++ b/src/H5SMbtree2.c @@ -45,11 +45,12 @@ /********************/ /* v2 B-tree callbacks */ -static void *H5SM_bt2_crt_context(void *udata); -static herr_t H5SM_bt2_dst_context(void *ctx); -static herr_t H5SM_bt2_store(void *native, const void *udata); -static herr_t H5SM_bt2_debug(FILE *stream, int indent, int fwidth, - const void *record); +static void *H5SM__bt2_crt_context(void *udata); +static herr_t H5SM__bt2_dst_context(void *ctx); +static herr_t H5SM__bt2_store(void *native, const void *udata); +static herr_t H5SM__bt2_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); +static void *H5SM__bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); /*****************************/ @@ -60,13 +61,15 @@ const H5B2_class_t H5SM_INDEX[1]={{ /* B-tree class information */ H5B2_SOHM_INDEX_ID, /* Type of B-tree */ "H5B2_SOHM_INDEX_ID", /* Name of B-tree class */ sizeof(H5SM_sohm_t), /* Size of native record */ - H5SM_bt2_crt_context, /* Create client callback context */ - H5SM_bt2_dst_context, /* Destroy client callback context */ - H5SM_bt2_store, /* Record storage callback */ - H5SM_message_compare, /* Record comparison callback */ - H5SM_message_encode, /* Record encoding callback */ - H5SM_message_decode, /* Record decoding callback */ - H5SM_bt2_debug /* Record debugging callback */ + H5SM__bt2_crt_context, /* Create client callback context */ + H5SM__bt2_dst_context, /* Destroy client callback context */ + H5SM__bt2_store, /* Record storage callback */ + H5SM__message_compare, /* Record comparison callback */ + H5SM__message_encode, /* Record encoding callback */ + H5SM__message_decode, /* Record decoding callback */ + H5SM__bt2_debug, /* Record debugging callback */ + H5SM__bt2_crt_dbg_context, /* Create debugging context */ + H5SM__bt2_dst_context /* Destroy debugging context */ }}; @@ -80,7 +83,7 @@ H5FL_DEFINE_STATIC(H5SM_bt2_ctx_t); /*------------------------------------------------------------------------- - * Function: H5SM_bt2_crt_context + * Function: H5SM__bt2_crt_context * * Purpose: Create client callback context * @@ -93,13 +96,13 @@ H5FL_DEFINE_STATIC(H5SM_bt2_ctx_t); *------------------------------------------------------------------------- */ static void * -H5SM_bt2_crt_context(void *_f) +H5SM__bt2_crt_context(void *_f) { H5F_t *f = (H5F_t *)_f; /* User data for building callback context */ H5SM_bt2_ctx_t *ctx; /* Callback context structure */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -116,11 +119,11 @@ H5SM_bt2_crt_context(void *_f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5SM_bt2_crt_context() */ +} /* H5SM__bt2_crt_context() */ /*------------------------------------------------------------------------- - * Function: H5SM_bt2_dst_context + * Function: H5SM__bt2_dst_context * * Purpose: Destroy client callback context * @@ -133,11 +136,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5SM_bt2_dst_context(void *_ctx) +H5SM__bt2_dst_context(void *_ctx) { H5SM_bt2_ctx_t *ctx = (H5SM_bt2_ctx_t *)_ctx; /* Callback context structure */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -146,11 +149,11 @@ H5SM_bt2_dst_context(void *_ctx) ctx = H5FL_FREE(H5SM_bt2_ctx_t, ctx); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5SM_bt2_dst_context() */ +} /* H5SM__bt2_dst_context() */ /*------------------------------------------------------------------------- - * Function: H5SM_bt2_store + * Function: H5SM__bt2_store * * Purpose: Store a H5SM_sohm_t SOHM message in the B-tree. The message * comes in UDATA as a H5SM_mesg_key_t* and is copied to @@ -165,21 +168,21 @@ H5SM_bt2_dst_context(void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5SM_bt2_store(void *native, const void *udata) +H5SM__bt2_store(void *native, const void *udata) { const H5SM_mesg_key_t *key = (const H5SM_mesg_key_t *)udata; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Copy the source message to the B-tree */ *(H5SM_sohm_t *)native = key->message; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_bt2_store */ +} /* end H5SM__bt2_store */ /*------------------------------------------------------------------------- - * Function: H5SM_bt2_debug + * Function: H5SM__bt2_debug * * Purpose: Print debugging information for a H5SM_sohm_t. * @@ -192,11 +195,12 @@ H5SM_bt2_store(void *native, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5SM_bt2_debug(FILE *stream, int indent, int fwidth, const void *record) +H5SM__bt2_debug(FILE *stream, int indent, int fwidth, + const void *record, const void H5_ATTR_UNUSED *_udata) { const H5SM_sohm_t *sohm = (const H5SM_sohm_t *)record; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(sohm->location == H5SM_IN_HEAP) HDfprintf(stream, "%*s%-*s {%a, %lo, %Hx}\n", indent, "", fwidth, @@ -210,7 +214,46 @@ H5SM_bt2_debug(FILE *stream, int indent, int fwidth, const void *record) } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_bt2_debug */ +} /* end H5SM__bt2_debug */ + + +/*------------------------------------------------------------------------- + * Function: H5SM__bt2_crt_dbg_context + * + * Purpose: Create context for debugging callback + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Quincey Koziol + * Tuesday, December 1, 2009 + * + *------------------------------------------------------------------------- + */ +static void * +H5SM__bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr) +{ + H5SM_bt2_ctx_t *ctx; /* Callback context structure */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(f); + + /* Allocate callback context */ + if(NULL == (ctx = H5FL_MALLOC(H5SM_bt2_ctx_t))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context") + + /* Determine the size of addresses & lengths in the file */ + ctx->sizeof_addr = H5F_SIZEOF_ADDR(f); + + /* Set return value */ + ret_value = ctx; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5SM__bt2_crt_dbg_context() */ /*------------------------------------------------------------------------- diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 1bdd95a..bbd7e87 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -256,7 +256,7 @@ H5SM__cache_table_deserialize(const void *_image, size_t len, void *_udata, /* Address of the index's heap */ H5F_addr_decode(f, &image, &(table->indexes[u].heap_addr)); - /* Compute the size of a list index for this SOHM index */ + /* Compute the size of a list index for this SOHM index */ table->indexes[u].list_size = H5SM_LIST_SIZE(f, table->indexes[u].list_max); } /* end for */ @@ -540,7 +540,7 @@ H5SM__cache_list_deserialize(const void *_image, size_t len, void *_udata, /* Read messages into the list array */ ctx.sizeof_addr = H5F_SIZEOF_ADDR(udata->f); for(u = 0; u < udata->header->num_messages; u++) { - if(H5SM_message_decode(image, &(list->messages[u]), &ctx) < 0) + if(H5SM__message_decode(image, &(list->messages[u]), &ctx) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "can't decode shared message") image += H5SM_SOHM_ENTRY_SIZE(udata->f); @@ -661,7 +661,7 @@ H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t len, ctx.sizeof_addr = H5F_SIZEOF_ADDR(f); for(u = 0; ((u < list->header->list_max) && (mesgs_serialized < list->header->num_messages)); u++) { if(list->messages[u].location != H5SM_NO_LOC) { - if(H5SM_message_encode(image, &(list->messages[u]), &ctx) < 0) + if(H5SM__message_encode(image, &(list->messages[u]), &ctx) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTFLUSH, FAIL, "unable to serialize shared message") image += H5SM_SOHM_ENTRY_SIZE(f); diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c index 5dbe5cf..426ea20 100644 --- a/src/H5SMmessage.c +++ b/src/H5SMmessage.c @@ -74,7 +74,7 @@ static herr_t H5SM_compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequenc /*------------------------------------------------------------------------- * Function: H5SM_compare_cb * - * Purpose: Callback for H5HF_op, used in H5SM_message_compare below. + * Purpose: Callback for H5HF_op, used in H5SM__message_compare below. * Determines whether the search key passed in in _UDATA is * equal to OBJ or not. * @@ -170,7 +170,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5SM_message_compare + * Function: H5SM__message_compare * * Purpose: Determine whether the search key rec1 represents a shared * message that is equal to rec2 or not, and if not, whether @@ -186,13 +186,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5SM_message_compare(const void *rec1, const void *rec2) +H5SM__message_compare(const void *rec1, const void *rec2) { const H5SM_mesg_key_t *key = (const H5SM_mesg_key_t *) rec1; const H5SM_sohm_t *mesg = (const H5SM_sohm_t *) rec2; herr_t ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* If the key has an fheap ID, we're looking for a message that's * already in the index; if the fheap ID matches, we've found the message @@ -269,11 +269,11 @@ H5SM_message_compare(const void *rec1, const void *rec2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5SM_message_compare */ +} /* end H5SM__message_compare */ /*------------------------------------------------------------------------- - * Function: H5SM_message_encode + * Function: H5SM__message_encode * * Purpose: Serialize a H5SM_sohm_t struct into a buffer RAW. * @@ -286,12 +286,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5SM_message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) +H5SM__message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) { H5SM_bt2_ctx_t *ctx = (H5SM_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5SM_sohm_t *message = (const H5SM_sohm_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(ctx); @@ -313,11 +313,11 @@ H5SM_message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_message_encode */ +} /* end H5SM__message_encode */ /*------------------------------------------------------------------------- - * Function: H5SM_message_decode + * Function: H5SM__message_decode * * Purpose: Read an encoded SOHM message from RAW into an H5SM_sohm_t struct. * @@ -330,12 +330,12 @@ H5SM_message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ herr_t -H5SM_message_decode(const uint8_t *raw, void *_nrecord, void *_ctx) +H5SM__message_decode(const uint8_t *raw, void *_nrecord, void *_ctx) { H5SM_bt2_ctx_t *ctx = (H5SM_bt2_ctx_t *)_ctx; /* Callback context structure */ H5SM_sohm_t *message = (H5SM_sohm_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR message->location = (H5SM_storage_loc_t)*raw++; UINT32DECODE(raw, message->hash); @@ -354,5 +354,5 @@ H5SM_message_decode(const uint8_t *raw, void *_nrecord, void *_ctx) } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_message_decode */ +} /* end H5SM__message_decode */ diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h index ac2ba1b..f072741 100644 --- a/src/H5SMpkg.h +++ b/src/H5SMpkg.h @@ -268,9 +268,9 @@ H5_DLLVAR const H5B2_class_t H5SM_INDEX[1]; H5_DLL ssize_t H5SM_get_index(const H5SM_master_table_t *table, unsigned type_id); /* Encode and decode routines, used for B-tree and cache encoding/decoding */ -H5_DLL herr_t H5SM_message_compare(const void *rec1, const void *rec2); -H5_DLL herr_t H5SM_message_encode(uint8_t *raw, const void *native, void *ctx); -H5_DLL herr_t H5SM_message_decode(const uint8_t *raw, void *native, void *ctx); +H5_DLL herr_t H5SM__message_compare(const void *rec1, const void *rec2); +H5_DLL herr_t H5SM__message_encode(uint8_t *raw, const void *native, void *ctx); +H5_DLL herr_t H5SM__message_decode(const uint8_t *raw, void *native, void *ctx); /* H5B2_remove_t callback to add messages to a list index */ H5_DLL herr_t H5SM_bt2_convert_to_list_op(const void * record, void *op_data); diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 28cabf0..fe013a7 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -2038,7 +2038,7 @@ H5S_hyper_serialize_helper(const H5S_hyper_span_info_t *spans, uint8_t *pp = (*p); /* Local pointer for decoding */ hsize_t u; /* Index variable */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ HDassert(spans); @@ -801,7 +801,7 @@ H5T__init_package(void) H5T_INIT_TYPE(OFFSET,H5T_NATIVE_HERR_g,COPY,native_int,SET,sizeof(herr_t)) /* hbool_t */ - H5T_INIT_TYPE(OFFSET,H5T_NATIVE_HBOOL_g,COPY,native_int,SET,sizeof(hbool_t)) + H5T_INIT_TYPE(OFFSET,H5T_NATIVE_HBOOL_g,COPY,native_uint,SET,sizeof(hbool_t)) /*------------------------------------------------------------ * IEEE Types @@ -3597,25 +3597,12 @@ done: * Programmer: Robb Matzke * Monday, December 8, 1997 * - * Modifications: - * Robb Matzke, 1999-04-27 - * This function fails if the datatype state is IMMUTABLE. - * - * Robb Matzke, 1999-05-20 - * Closes opaque types also. - * - * Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002 - * Added "ID to name" support - * - * Quincey Koziol, 2003-01-06 - * Moved "guts" of function to H5T__free() - * *------------------------------------------------------------------------- */ herr_t H5T_close(H5T_t *dt) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3629,7 +3616,8 @@ H5T_close(H5T_t *dt) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype"); dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); - } else { + } /* end if */ + else { /* * If a named type is being closed then close the object header and * remove from the list of open objects in the file. diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h index bf4e3ca..7d3361b 100644 --- a/src/H5VMprivate.h +++ b/src/H5VMprivate.h @@ -403,7 +403,7 @@ static const unsigned MultiplyDeBruijnBitPosition[32] = * *------------------------------------------------------------------------- */ -static H5_INLINE unsigned H5_ATTR_UNUSED +static H5_INLINE H5_ATTR_PURE unsigned H5VM_log2_of2(uint32_t n) { #ifndef NDEBUG @@ -424,7 +424,7 @@ H5VM_log2_of2(uint32_t n) * *------------------------------------------------------------------------- */ -static H5_INLINE hsize_t H5_ATTR_UNUSED +static H5_INLINE H5_ATTR_CONST hsize_t H5VM_power2up(hsize_t n) { hsize_t ret_value = 1; /* Return value */ diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 7de0060..0dc12a3 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -49,7 +49,7 @@ static herr_t H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t spac static size_t H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf); static void H5Z_scaleoffset_convert(void *buf, unsigned d_nelmts, size_t dtype_size); -static unsigned H5Z_scaleoffset_log2(unsigned long long num); +static H5_ATTR_CONST unsigned H5Z_scaleoffset_log2(unsigned long long num); static void H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, unsigned filavail, const unsigned cd_values[], uint32_t *minbits, unsigned long long *minval); diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 42d6ceb..0a9a4da 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -748,6 +748,7 @@ H5Z_parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) case H5Z_XFORM_ERROR: default: + H5Z_xform_destroy_parse_tree(term); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "bad transform type passed to data transform expression") } /* end switch */ } /* end for */ diff --git a/src/H5private.h b/src/H5private.h index 56061bf..c536566 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -119,6 +119,13 @@ #endif /* + * flock() in sys/file.h is used for the implemention of file locking. + */ +#if defined(H5_HAVE_FLOCK) && defined(H5_HAVE_SYS_FILE_H) +# include <sys/file.h> +#endif + +/* * Resource usage is not Posix.1 but HDF5 uses it anyway for some performance * and debugging code if available. */ @@ -291,20 +298,30 @@ * * Note that Solaris Studio supports attribute, but does not support the * attributes we use. + * + * H5_ATTR_CONST is redefined in tools/h5repack/dynlib_rpk.c to quiet + * gcc warnings (it has to use the public API and can't include this + * file). Be sure to update that file if the #ifdefs change here. */ #ifdef __cplusplus # define H5_ATTR_FORMAT(X,Y,Z) /*void*/ -# define H5_ATTR_UNUSED /*void*/ -# define H5_ATTR_NORETURN /*void*/ +# define H5_ATTR_UNUSED /*void*/ +# define H5_ATTR_NORETURN /*void*/ +# define H5_ATTR_CONST /*void*/ +# define H5_ATTR_PURE /*void*/ #else /* __cplusplus */ #if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C) # define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z))) -# define H5_ATTR_UNUSED __attribute__((unused)) -# define H5_ATTR_NORETURN __attribute__((noreturn)) +# define H5_ATTR_UNUSED __attribute__((unused)) +# define H5_ATTR_NORETURN __attribute__((noreturn)) +# define H5_ATTR_CONST __attribute__((const)) +# define H5_ATTR_PURE __attribute__((pure)) #else # define H5_ATTR_FORMAT(X,Y,Z) /*void*/ -# define H5_ATTR_UNUSED /*void*/ -# define H5_ATTR_NORETURN /*void*/ +# define H5_ATTR_UNUSED /*void*/ +# define H5_ATTR_NORETURN /*void*/ +# define H5_ATTR_CONST /*void*/ +# define H5_ATTR_PURE /*void*/ #endif #endif /* __cplusplus */ @@ -364,10 +381,10 @@ * HDF Boolean type. */ #ifndef FALSE -# define FALSE 0 + #define FALSE false #endif #ifndef TRUE -# define TRUE 1 + #define TRUE true #endif /* @@ -495,7 +512,7 @@ #endif /* Double constant wrapper - * + * * Quiets gcc warnings from -Wunsuffixed-float-constants. * * This is a really annoying warning since the standard specifies that @@ -536,6 +553,18 @@ #define H5_TB (1024.0F * 1024.0F * 1024.0F * 1024.0F) #define H5_EB (1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F) +#ifndef H5_HAVE_FLOCK +/* flock() operations. Used in the source so we have to define them when + * the call is not available (e.g.: Windows). These should NOT be used + * with system-provided flock() calls since the values will come from the + * header file. + */ +#define LOCK_SH 0x01 +#define LOCK_EX 0x02 +#define LOCK_NB 0x04 +#define LOCK_UN 0x08 +#endif /* H5_HAVE_FLOCK */ + /* * Data types and functions for timing certain parts of the library. */ @@ -740,7 +769,11 @@ typedef struct { #ifndef HDfclose #define HDfclose(F) fclose(F) #endif /* HDfclose */ -/* fcntl() variable arguments */ +#ifdef H5_HAVE_FCNTL + #ifndef HDfcntl + #define HDfcntl(F,C,...) fcntl(F,C,__VA_ARGS__) + #endif /* HDfcntl */ +#endif /* H5_HAVE_FCNTL */ #ifndef HDfdopen #define HDfdopen(N,S) fdopen(N,S) #endif /* HDfdopen */ @@ -765,6 +798,27 @@ typedef struct { #ifndef HDfileno #define HDfileno(F) fileno(F) #endif /* HDfileno */ +/* Since flock is so prevalent, always build these functions + * when possible to avoid them becoming dead code. + */ +#ifdef H5_HAVE_FCNTL +H5_DLL int Pflock(int fd, int operation); +#endif /* H5_HAVE_FCNTL */ +H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); +#ifndef HDflock + /* NOTE: flock(2) is not present on all POSIX systems. + * If it is not present, we try a flock() equivalent based on + * fcntl(2), then fall back to a function that always fails if + * it is not present at all. + */ + #if defined(H5_HAVE_FLOCK) + #define HDflock(F,L) flock(F,L) + #elif defined(H5_HAVE_FCNTL) + #define HDflock(F,L) Pflock(F,L) + #else + #define HDflock(F,L) Nflock(F,L) + #endif /* H5_HAVE_FLOCK */ +#endif /* HDflock */ #ifndef HDfloor #define HDfloor(X) floor(X) #endif /* HDfloor */ @@ -1157,6 +1211,9 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDrmdir(S) rmdir(S) #endif /* HDrmdir */ /* scanf() variable arguments */ +#ifndef HDselect + #define HDselect(N,RD,WR,ER,T) select(N,RD,WR,ER,T) +#endif /* HDsetbuf */ #ifndef HDsetbuf #define HDsetbuf(F,S) setbuf(F,S) #endif /* HDsetbuf */ @@ -2065,7 +2122,7 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use the following two macros as replacements for the FUNC_ENTER_NOAPI +/* Use the following two macros as replacements for the FUNC_ENTER_NOAPI * and FUNC_ENTER_NOAPI_NOINIT macros when the function needs to set * up a metadata tag. */ #define FUNC_ENTER_NOAPI_TAG(dxpl_id, tag, err) { \ @@ -2340,18 +2397,21 @@ extern hbool_t H5_api_entered_g; /* Has library already been entered through #define FUNC_ENT_PUB(pkg, pkg_init) H5_PUBLIC_ENTER(pkg, pkg_init) /* Macros for substituting a function prefix */ -#define FUNC_PREFIX_STATIC static +#define FUNC_PREFIX_STATIC static #define FUNC_PREFIX_PKGINIT #define FUNC_PREFIX_PKG #define FUNC_PREFIX_PRIV #define FUNC_PREFIX_PUB /* Macros for declaring error variables */ +/* Function can detect errors and has a specific error return value */ #define FUNC_ERR_VAR_ERR(ret_typ, err) \ hbool_t past_catch = FALSE; \ ret_typ fail_value = err; +/* Function can detect errors but cannot return an error value (Cleanup only) */ #define FUNC_ERR_VAR_ERRCATCH(ret_typ, err) \ hbool_t past_catch = FALSE; +/* Function has no need to detect or clean up from errors */ #define FUNC_ERR_VAR_NOERR(ret_typ, err) /* Use this macro when entering all functions */ @@ -2365,6 +2425,16 @@ func \ H5_GLUE(FUNC_ERR_VAR_, use_err)(ret_typ, err) \ H5_GLUE(FUNC_ENT_, scope)(H5_MY_PKG, H5_MY_PKG_INIT) +/* Use this macro when entering functions that have no return value */ +#define BEGIN_FUNC_VOID(scope, use_err, func) \ +H5_GLUE(FUNC_PREFIX_, scope) \ +void \ +func \ +/* Open function */ \ +{ \ + H5_GLUE(FUNC_ERR_VAR_, use_err)(void, -, -) \ + H5_GLUE(FUNC_ENT_, scope) + /* Macros for label when a function initialization can fail */ #define H5_PRIV_YES_FUNC_INIT_FAILED func_init_failed: #define H5_PRIV_NO_FUNC_INIT_FAILED @@ -2440,6 +2510,17 @@ func_init_failed: \ /* Close Function */ \ } +/* Use this macro when leaving void functions */ +#define END_FUNC_VOID(scope) \ + /* Scope-specific function conclusion */ \ + H5_GLUE(FUNC_LEAVE_, scope) \ + \ + /* Leave routine */ \ + return; \ + \ + /* Close Function */ \ +} + /* Macro to begin/end tagging (when FUNC_ENTER_*TAG macros are insufficient). * Make sure to use HGOTO_ERROR_TAG and HGOTO_DONE_TAG between these macros! */ #define H5_BEGIN_TAG(dxpl, tag, err) { \ @@ -2497,6 +2578,9 @@ H5_DLL uint32_t H5_checksum_lookup3(const void *data, size_t len, uint32_t initv H5_DLL uint32_t H5_checksum_metadata(const void *data, size_t len, uint32_t initval); H5_DLL uint32_t H5_hash_string(const char *str); +/* Time related routines */ +H5_DLL time_t H5_make_time(struct tm *tm); + /* Functions for building paths, etc. */ H5_DLL herr_t H5_build_extpath(const char *, char ** /*out*/ ); diff --git a/src/H5public.h b/src/H5public.h index f7f70cf..5b95fb7 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -141,7 +141,20 @@ typedef int herr_t; * printf("error determining whether data type is committed\n"); * } */ -typedef unsigned int hbool_t; +#ifdef H5_HAVE_STDBOOL_H + #include <stdbool.h> +#else /* H5_HAVE_STDBOOL_H */ + #ifndef __cplusplus + #if defined(H5_SIZEOF_BOOL) && (H5_SIZEOF_BOOL != 0) + #define bool _Bool + #else + #define bool unsigned int + #endif + #define true 1 + #define false 0 + #endif /* __cplusplus */ +#endif /* H5_HAVE_STDBOOL_H */ +typedef bool hbool_t; typedef int htri_t; /* Define the ssize_t type if it not is defined */ diff --git a/src/H5system.c b/src/H5system.c index e00e5a5..4baebc5 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -32,11 +32,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Fprivate.h" /* File access */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Eprivate.h" - +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -73,6 +72,9 @@ /* Local Variables */ /*******************/ +/* Track whether tzset routine was called */ +static hbool_t H5_ntzset = FALSE; + /*------------------------------------------------------------------------- * Function: HDfprintf @@ -584,7 +586,154 @@ void HDsrand(unsigned int seed) } #endif /* H5_HAVE_RAND_R */ + + +/*------------------------------------------------------------------------- + * Function: Pflock + * + * Purpose: Wrapper function for POSIX systems where flock(2) is not + * available. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +/* NOTE: Compile this all the time on POSIX systems, even when flock(2) is + * present so that it's less likely to become dead code. + */ +#ifdef H5_HAVE_FCNTL +int +Pflock(int fd, int operation) { + + struct flock flk; + + /* Set the lock type */ + if(operation & LOCK_UN) + flk.l_type = F_UNLCK; + else if(operation & LOCK_SH) + flk.l_type = F_RDLCK; + else + flk.l_type = F_WRLCK; + + /* Set the other flock struct values */ + flk.l_whence = SEEK_SET; + flk.l_start = 0; + flk.l_len = 0; /* to EOF */ + flk.l_pid = 0; /* not used with set */ + + /* Lock or unlock */ + if(HDfcntl(fd, F_SETLK, flk) < 0) + return -1; + return 0; + +} /* end Pflock() */ +#endif /* H5_HAVE_FCNTL */ + + +/*------------------------------------------------------------------------- + * Function: Nflock + * + * Purpose: Wrapper function for systems where no file locking is + * available. + * + * Return: Failure: -1 (always fails) + * + *------------------------------------------------------------------------- + */ +int H5_ATTR_CONST +Nflock(int H5_ATTR_UNUSED fd, int H5_ATTR_UNUSED operation) { + /* just fail */ + return -1; +} /* end Nflock() */ + + +/*------------------------------------------------------------------------- + * Function: H5_make_time + * + * Purpose: Portability routine to abstract converting a 'tm' struct into + * a time_t value. + * + * Note: This is a little problematic because mktime() operates on + * local times. We convert to local time and then figure out the + * adjustment based on the local time zone and daylight savings + * setting. + * + * Return: Success: The value of timezone + * Failure: -1 + * + * Programmer: Quincey Koziol + * November 18, 2015 + * + *------------------------------------------------------------------------- + */ +time_t +H5_make_time(struct tm *tm) +{ + time_t the_time; /* The converted time */ +#if defined(H5_HAVE_VISUAL_STUDIO) && (_MSC_VER >= 1900) /* VS 2015 */ + /* In gcc and in Visual Studio prior to VS 2015 'timezone' is a global + * variable declared in time.h. That variable was deprecated and in + * VS 2015 is removed, with _get_timezone replacing it. + */ + long timezone = 0; +#endif /* defined(H5_HAVE_VISUAL_STUDIO) && (_MSC_VER >= 1900) */ + time_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity check */ + HDassert(tm); + + /* Initialize timezone information */ + if(!H5_ntzset) { + HDtzset(); + H5_ntzset = TRUE; + } /* end if */ + + /* Perform base conversion */ + if((time_t)-1 == (the_time = HDmktime(tm))) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCONVERT, FAIL, "badly formatted modification time message") + + /* Adjust for timezones */ +#if defined(H5_HAVE_TM_GMTOFF) + /* BSD-like systems */ + the_time += tm->tm_gmtoff; +#elif defined(H5_HAVE_TIMEZONE) +#if defined(H5_HAVE_VISUAL_STUDIO) && (_MSC_VER >= 1900) /* VS 2015 */ + /* In gcc and in Visual Studio prior to VS 2015 'timezone' is a global + * variable declared in time.h. That variable was deprecated and in + * VS 2015 is removed, with _get_timezone replacing it. + */ + _get_timezone(&timezone); +#endif /* defined(H5_HAVE_VISUAL_STUDIO) && (_MSC_VER >= 1900) */ + + the_time -= timezone - (tm->tm_isdst ? 3600 : 0); +#else + /* + * The catch-all. If we can't convert a character string universal + * coordinated time to a time_t value reliably then we can't decode the + * modification time message. This really isn't as bad as it sounds -- the + * only way a user can get the modification time is from our internal + * query routines, which can gracefully recover. + */ + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "unable to obtain local timezone information") +#endif + + /* Set return value */ + ret_value = the_time; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5_make_time() */ + +#ifdef H5_HAVE_VISUAL_STUDIO + +/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosecond units */ +#define _W32_FT_OFFSET (116444736000000000ULL) + + /*------------------------------------------------------------------------- * Function: Wgettimeofday * @@ -606,11 +755,6 @@ void HDsrand(unsigned int seed) * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_VISUAL_STUDIO - -/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosecond units */ -#define _W32_FT_OFFSET (116444736000000000ULL) - int Wgettimeofday(struct timeval *tv, struct timezone *tz) { @@ -685,7 +829,55 @@ int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap) return count; } -#endif + +/*------------------------------------------------------------------------- + * Function: Wflock + * + * Purpose: Wrapper function for flock on Windows systems + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +int +Wflock(int H5_ATTR_UNUSED fd, int H5_ATTR_UNUSED operation) { + +/* This is a no-op while we implement a Win32 VFD */ +#if 0 +int +Wflock(int fd, int operation) { + + HANDLE hFile; + DWORD dwFlags = LOCKFILE_FAIL_IMMEDIATELY; + DWORD dwReserved = 0; + /* MAXDWORD for entire file */ + DWORD nNumberOfBytesToLockLow = MAXDWORD; + DWORD nNumberOfBytesToLockHigh = MAXDWORD; + /* Must initialize OVERLAPPED struct */ + OVERLAPPED overlapped = {0}; + + /* Get Windows HANDLE */ + hFile = _get_osfhandle(fd); + + /* Convert to Windows flags */ + if(operation & LOCK_EX) + dwFlags |= LOCKFILE_EXCLUSIVE_LOCK; + + /* Lock or unlock */ + if(operation & LOCK_UN) + if(0 == UnlockFileEx(hFile, dwReserved, nNumberOfBytesToLockLow, + nNumberOfBytesToLockHigh, &overlapped)) + return -1; + else + if(0 == LockFileEx(hFile, dwFlags, dwReserved, nNumberOfBytesToLockLow, + nNumberOfBytesToLockHigh, &overlapped)) + return -1; +#endif /* 0 */ + return 0; +} /* end Wflock() */ + +#endif /* H5_HAVE_VISUAL_STUDIO */ /*------------------------------------------------------------------------- diff --git a/src/H5trace.c b/src/H5trace.c index f212bef..2fd75ac 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -155,8 +155,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end if */ /* Get time for event */ - if(HDfabs(first_time.etime) < 0.0000000001F) - /* That is == 0.0, but direct comparison between floats is bad */ + if(H5_DBL_ABS_EQUAL(first_time.etime, H5_DOUBLE(0.0))) H5_timer_begin(&first_time); if(H5_debug_g.ttimes) H5_timer_begin(&event_time); @@ -269,8 +268,8 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - hbool_t bool_var = va_arg(ap, hbool_t); /*lint !e732 Loss of sign not really occuring */ - + /* Can't pass hbool_t to va_arg() */ + hbool_t bool_var = (hbool_t)va_arg(ap, int); if(TRUE == bool_var) fprintf(out, "TRUE"); else if(!bool_var) diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 185e9b4..e84def9 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -74,6 +74,7 @@ struct timezone { extern "C" { #endif /* __cplusplus */ H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz); + H5_DLL int Wflock(int fd, int operation); H5_DLL char* Wgetlogin(void); H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...); H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap); @@ -81,10 +82,11 @@ struct timezone { } #endif /* __cplusplus */ #define HDgettimeofday(V,Z) Wgettimeofday(V,Z) +#define HDflock(F,L) Wflock(F,L) #define HDgetlogin() Wgetlogin() #define HDsnprintf c99_snprintf /*varargs*/ #define HDvsnprintf c99_vsnprintf - + #endif /* H5_HAVE_VISUAL_STUDIO */ /* Non-POSIX functions */ diff --git a/src/Makefile.am b/src/Makefile.am index 86dad23..d6a5909 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -73,7 +73,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \ H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \ H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c \ - H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c \ + H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c\ H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c \ H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ H5MM.c H5MP.c H5MPtest.c \ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f9832f3..d2dd282 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -209,11 +209,7 @@ set (H5_TESTS ohdr stab gheap - #cache - #cache_api - #cache_tagging pool - #hyperslab istore bittests dt_arith @@ -236,7 +232,6 @@ set (H5_TESTS app_ref enum set_extent - #ttsafe getname vfd ntypes @@ -251,11 +246,8 @@ set (H5_TESTS earray btree2 fheap - #error_test - #err_compat tcheck_version testmeta - #links_env file_image enc_dec_plist enc_dec_plist_cross_platform @@ -73,10 +73,10 @@ /* Define Small, Large, Extra Large, Huge File which * corrspond to less than 2GB, 2GB, 4GB, and tens of GB file size. - * NOFILE stands for "no file" to be tested. + * NO_FILE stands for "no file" to be tested. */ -typedef enum fsizes_t { SFILE, LFILE, XLFILE, HUGEFILE, NOFILE} fsizes_t; -fsizes_t file_size= NOFILE; +typedef enum fsizes_t { SFILE, LFILE, XLFILE, HUGEFILE, NO_FILE} fsizes_t; +fsizes_t file_size= NO_FILE; const char *FILENAME[] = { "big", @@ -210,7 +210,7 @@ static fsizes_t supports_big(void) { int fd = -1; - fsizes_t fsize = NOFILE; + fsizes_t fsize = NO_FILE; if((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) goto error; @@ -377,9 +377,9 @@ writer (char* filename, hid_t fapl, fsizes_t testsize, int wrt_n) size2[0] /= 32; break; - case NOFILE: + case NO_FILE: /* what to do?? */ - HDfprintf(stdout, "Unexpected file size of NOFILE\n"); + HDfprintf(stdout, "Unexpected file size of NO_FILE\n"); goto error; break; @@ -599,7 +599,7 @@ test_sec2(hid_t fapl) fsizes_t testsize; testsize = supports_big(); - if(testsize == NOFILE) { + if(testsize == NO_FILE) { HDfprintf(stdout, "Test for sec2 is skipped because file system does not support big files.\n"); goto quit; } @@ -634,7 +634,7 @@ test_stdio(hid_t fapl) fsizes_t testsize; testsize = supports_big(); - if(testsize == NOFILE) { + if(testsize == NO_FILE) { HDfprintf(stdout, "Test for stdio is skipped because file system does not support big files.\n"); goto quit; } diff --git a/test/btree2.c b/test/btree2.c index caad849..8f84135 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -7625,7 +7625,7 @@ main(void) bt2_test_param_t tparam; /* Test parameters for v2 B-tree */ hid_t fapl = -1; /* File access property list for data files */ unsigned nerrors = 0; /* Cumulative error count */ - hbool_t reopen; /* Whether to reopen B-tree during tests */ + unsigned reopen; /* Whether to reopen B-tree during tests */ int ExpressMode; const char *envval = NULL; diff --git a/test/cache_api.c b/test/cache_api.c index 1697884..bebb828 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -1530,7 +1530,7 @@ mdc_api_call_smoke_check(int express_test) * Note: It is assumed that boolean parameters are only set to TRUE/FALSE. */ -#define NUM_INVALID_CONFIGS 42 +#define NUM_INVALID_CONFIGS 36 H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = { @@ -1605,42 +1605,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 2 -- bad set_initial_size */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t open_trace_file = */ FALSE, - /* hbool_t close_trace_file = */ FALSE, - /* char trace_file_name[] = */ "", - /* hbool_t evictions_enabled = */ TRUE, - /* hbool_t set_initial_size = */ 2, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25f, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9f, - /* double increment = */ 2.0f, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_flash_incr_mode */ - /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999f, - /* double decrement = */ 0.9f, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1f, - /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY - }, - { - /* 3 -- max_size too big */ + /* 2 -- max_size too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -1675,7 +1640,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 4 -- min_size too small */ + /* 3 -- min_size too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -1710,7 +1675,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 5 -- min_size > max_size */ + /* 4 -- min_size > max_size */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -1745,7 +1710,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 6 -- initial size out of range (too big) */ + /* 5 -- initial size out of range (too big) */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -1780,7 +1745,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 7 -- initial_size out of range (too small) */ + /* 6 -- initial_size out of range (too small) */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -1815,7 +1780,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 8 -- min_clean_fraction too big */ + /* 7 -- min_clean_fraction too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -1850,7 +1815,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 9 -- min_clean_fraction too small */ + /* 8 -- min_clean_fraction too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -1885,7 +1850,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 10 -- epoch_length too small */ + /* 9 -- epoch_length too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -1920,7 +1885,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 11 -- epoch_length too big */ + /* 10 -- epoch_length too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -1955,7 +1920,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 12 -- invalid incr_mode */ + /* 11 -- invalid incr_mode */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -1990,7 +1955,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 13 -- lower_hr_threshold too small */ + /* 12 -- lower_hr_threshold too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2025,7 +1990,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 14 -- lower_hr_threshold too big */ + /* 13 -- lower_hr_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2060,7 +2025,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 15 -- increment too small */ + /* 14 -- increment too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2095,7 +2060,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 16 -- invalid flash_incr_mode */ + /* 15 -- invalid flash_incr_mode */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2130,7 +2095,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 17 -- flash_multiple too small */ + /* 16 -- flash_multiple too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2165,7 +2130,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 18 -- flash_multiple too big */ + /* 17 -- flash_multiple too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2200,7 +2165,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 19 -- flash_threshold too small */ + /* 18 -- flash_threshold too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2235,7 +2200,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 20 -- flash_threshold too big */ + /* 19 -- flash_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2270,7 +2235,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 21 -- bad decr_mode */ + /* 20 -- bad decr_mode */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2305,7 +2270,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 22 -- upper_hr_threshold too big */ + /* 21 -- upper_hr_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2340,7 +2305,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 23 -- decrement too small */ + /* 22 -- decrement too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2375,7 +2340,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 24 -- decrement too big */ + /* 23 -- decrement too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2410,7 +2375,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 25 -- epochs_before_eviction too small */ + /* 24 -- epochs_before_eviction too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2445,7 +2410,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 26 -- epochs_before_eviction too big */ + /* 25 -- epochs_before_eviction too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2480,42 +2445,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 27 -- invalid apply_empty_reserve */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t open_trace_file = */ FALSE, - /* hbool_t close_trace_file = */ FALSE, - /* char trace_file_name[] = */ "", - /* hbool_t evictions_enabled = */ TRUE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25f, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9f, - /* double increment = */ 2.0f, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_flash_incr_mode */ - /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999f, - /* double decrement = */ 0.9f, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ 2, - /* double empty_reserve = */ 0.1f, - /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY - }, - { - /* 28 -- empty_reserve too small */ + /* 26 -- empty_reserve too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2550,7 +2480,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 29 -- empty_reserve too big */ + /* 27 -- empty_reserve too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2585,7 +2515,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 30 -- upper_hr_threshold too small */ + /* 28 -- upper_hr_threshold too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2620,7 +2550,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 31 -- upper_hr_threshold too big */ + /* 29 -- upper_hr_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2655,7 +2585,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 32 -- upper_hr_threshold <= lower_hr_threshold */ + /* 30 -- upper_hr_threshold <= lower_hr_threshold */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2690,7 +2620,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 33 -- dirty_bytes_threshold too small */ + /* 31 -- dirty_bytes_threshold too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2725,7 +2655,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 34 -- dirty_bytes_threshold too big */ + /* 32 -- dirty_bytes_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2760,7 +2690,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 35 -- attempt to disable evictions when auto incr enabled */ + /* 33 -- attempt to disable evictions when auto incr enabled */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2795,7 +2725,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 36 -- attempt to disable evictions when auto decr enabled */ + /* 34 -- attempt to disable evictions when auto decr enabled */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2830,7 +2760,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = H5AC__DEFAULT_METADATA_WRITE_STRATEGY }, { - /* 37 -- unknown metadata write strategy */ + /* 35 -- unknown metadata write strategy */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 2d22b5b..80ba2eb 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -2463,6 +2463,9 @@ check_dataset_write_tags(hid_t fcpl, int type) for (i=0; i<10; i++) if ( verify_tag(fid, H5AC_BT_ID, d_tag) < 0 ) TEST_ERROR; + /* Verify object header for dataset */ + if ( verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0 ) TEST_ERROR; + /* verify no other entries present */ if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; diff --git a/test/dsets.c b/test/dsets.c index a233b4e..c0e8702 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -9080,7 +9080,7 @@ main(void) { char filename[FILENAME_BUF_SIZE]; hid_t file, grp, fapl, fapl2; - hbool_t new_format; + unsigned new_format; int mdc_nelmts; size_t rdcc_nelmts; size_t rdcc_nbytes; diff --git a/test/dtypes.c b/test/dtypes.c index 6fe455d..326294f 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -6728,7 +6728,7 @@ test_delete_obj_named(hid_t fapl) hid_t attr = -1; /* Attribute ID */ hid_t dset = -1; /* Dataset ID */ hid_t fapl2 = -1; /* File access property list ID */ - hbool_t new_format; /* Whether to use old or new format */ + unsigned new_format; /* Whether to use old or new format */ char filename[1024], filename2[1024]; TESTING("deleting objects that use named datatypes"); @@ -6823,7 +6823,7 @@ test_delete_obj_named_fileid(hid_t fapl) hid_t attr = -1; /* Attribute ID */ hid_t dset = -1; /* Dataset ID */ hid_t fapl2 = -1; /* File access property list ID */ - hbool_t new_format; /* Whether to use old or new format */ + unsigned new_format; /* Whether to use old or new format */ char filename[1024], filename2[1024]; TESTING("deleting objects that use named datatypes"); diff --git a/test/file_image.c b/test/file_image.c index d9c782a..52d0b28 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -41,6 +41,8 @@ #define FAMILY_SIZE (2 * 1024) +#define USERBLOCK_SIZE 512 + const char *FILENAME[] = { "file_image_core_test", NULL @@ -549,7 +551,7 @@ test_core(void) VERIFY(fapl >= 0, "fapl creation failed"); /* Set up the core VFD */ - ret = H5Pset_fapl_core(fapl, 0, 0); + ret = H5Pset_fapl_core(fapl, (size_t)0, 0); VERIFY(ret >= 0, "setting core driver in fapl failed"); tmp = h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -665,12 +667,17 @@ error: * Programmer: John Mainzer * Tuesday, November 15, 2011 * + * Modifications: + * Vailin Choi; July 2013 + * Add the creation of user block to the file as indicated by the parameter "user". + * ****************************************************************************** */ static int test_get_file_image(const char * test_banner, const int file_name_num, - hid_t fapl) + hid_t fapl, + hbool_t user) { char file_name[1024] = "\0"; void * insertion_ptr = NULL; @@ -694,6 +701,8 @@ test_get_file_image(const char * test_banner, ssize_t image_size; ssize_t file_size; h5_stat_t stat_buf; + hid_t fcpl = -1; + herr_t ret; TESTING(test_banner); @@ -708,8 +717,15 @@ test_get_file_image(const char * test_banner, h5_fixname(FILENAME2[file_name_num], fapl, file_name, sizeof(file_name)); VERIFY(HDstrlen(file_name)>0, "h5_fixname failed"); + fcpl = H5Pcreate(H5P_FILE_CREATE); + VERIFY(fcpl >= 0, "H5Pcreate"); + if(user) { + ret = H5Pset_userblock(fcpl, (hsize_t)USERBLOCK_SIZE); + VERIFY(ret >=0, "H5Pset_userblock"); + } + /* create the file */ - file_id = H5Fcreate(file_name, 0, H5P_DEFAULT, fapl); + file_id = H5Fcreate(file_name, 0, fcpl, fapl); VERIFY(file_id >= 0, "H5Fcreate() failed."); /* Set up data space for new new data set */ @@ -761,11 +777,15 @@ test_get_file_image(const char * test_banner, ssize_t member_size; ssize_t size_remaining; + /* + * Modifications need to be made to accommodate userblock when + * H5Fget_file_image() works for family driver + */ i = 0; file_size = 0; do { - HDsnprintf(member_file_name, 1024, file_name, i); + HDsnprintf(member_file_name, (size_t)1024, file_name, i); /* get the size of the member file */ result = HDstat(member_file_name, &stat_buf); @@ -829,6 +849,10 @@ test_get_file_image(const char * test_banner, * the remainder of the file is all '\0's. */ file_size = (ssize_t)stat_buf.st_size; + if(user) { + VERIFY(file_size > USERBLOCK_SIZE, "file size !> userblock size."); + file_size -= USERBLOCK_SIZE; + } /* with latest mods to truncate call in core file drive, * file size should match image size @@ -843,6 +867,12 @@ test_get_file_image(const char * test_banner, fd = HDopen(file_name, O_RDONLY, 0666); VERIFY(fd >= 0, "HDopen() failed."); + if(user) { + /* Position at userblock */ + ret = HDlseek(fd, (off_t)USERBLOCK_SIZE, SEEK_SET); + VERIFY(ret >= 0, "HDlseek() failed."); + } + /* read the test file from disk into the buffer */ bytes_read = HDread(fd, file_image_ptr, (size_t)file_size); VERIFY(bytes_read == file_size, "HDread() failed."); @@ -930,7 +960,6 @@ test_get_file_image_error_rejection(void) void * image_ptr = NULL; int data[100]; int i; - int result; hid_t fapl_id = -1; hid_t file_id = -1; hid_t dset_id = -1; @@ -1273,13 +1302,18 @@ test_get_file_image_error_rejection(void) error: return 1; -} +} /* test_get_file_image_error_rejection() */ +/* + * Modifications: + * Add testing for file image with or without user block in the file. + */ int main(void) { int errors = 0; hid_t fapl; + unsigned user; h5_reset(); @@ -1289,29 +1323,34 @@ main(void) errors += test_callbacks(); errors += test_core(); - /* test H5Fget_file_image() with sec2 driver */ - fapl = H5Pcreate(H5P_FILE_ACCESS); - if(H5Pset_fapl_sec2(fapl) < 0) - errors++; - else - errors += test_get_file_image("H5Fget_file_image() with sec2 driver", - 0, fapl); - - /* test H5Fget_file_image() with stdio driver */ - fapl = H5Pcreate(H5P_FILE_ACCESS); - if(H5Pset_fapl_stdio(fapl) < 0) - errors++; - else - errors += test_get_file_image("H5Fget_file_image() with stdio driver", - 1, fapl); - - /* test H5Fget_file_image() with core driver */ - fapl = H5Pcreate(H5P_FILE_ACCESS); - if(H5Pset_fapl_core(fapl, (size_t)(64 *1024), TRUE) < 0) - errors++; - else - errors += test_get_file_image("H5Fget_file_image() with core driver", - 2, fapl); + /* Perform tests with/without user block */ + for(user = FALSE; user <= TRUE; user++) { + + /* test H5Fget_file_image() with sec2 driver */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + if(H5Pset_fapl_sec2(fapl) < 0) + errors++; + else + errors += test_get_file_image("H5Fget_file_image() with sec2 driver", + 0, fapl, user); + + /* test H5Fget_file_image() with stdio driver */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + if(H5Pset_fapl_stdio(fapl) < 0) + errors++; + else + errors += test_get_file_image("H5Fget_file_image() with stdio driver", + 1, fapl, user); + + /* test H5Fget_file_image() with core driver */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + if(H5Pset_fapl_core(fapl, (size_t)(64 *1024), TRUE) < 0) + errors++; + else + errors += test_get_file_image("H5Fget_file_image() with core driver", + 2, fapl, user); + + } /* end for */ #if 0 /* at present, H5Fget_file_image() rejects files opened with the diff --git a/test/fillval.c b/test/fillval.c index b7b2ff5..1ea2ae6 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -2368,7 +2368,7 @@ main(int argc, char *argv[]) { int nerrors=0, argno, test_contig=1, test_chunk=1, test_compact=1; hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */ - hbool_t new_format; /* Whether to use the new format or not */ + unsigned new_format; /* Whether to use the new format or not */ if(argc >= 2) { test_contig = test_chunk = test_compact = 0; diff --git a/test/lheap.c b/test/lheap.c index 492316e..60b29f3 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -36,36 +36,34 @@ const char *FILENAME[] = { /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Create a file, create a local heap, write data into the local - * heap, close the file, open the file, read data out of the - * local heap, close the file. + * Purpose: Create a file, create a local heap, write data into the local + * heap, close the file, open the file, read data out of the + * local heap, close the file. * - * Return: Success: zero + * Return: Success: zero * - * Failure: non-zero + * Failure: non-zero * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, November 24, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ int main(void) { - hid_t fapl=H5P_DEFAULT; /*file access properties */ - hid_t file=-1; /*hdf5 file */ - H5F_t *f=NULL; /*hdf5 file pointer */ - char filename[1024]; /*file name */ - haddr_t heap_addr; /*local heap address */ - H5HL_t *heap = NULL; /*local heap */ - size_t obj[NOBJS]; /*offsets within the heap */ - int i, j; /*miscellaneous counters */ - char buf[1024]; /*the value to store */ - const char *s; /*value to read */ + hid_t fapl = H5P_DEFAULT; /* file access properties */ + hid_t file = -1; /* hdf5 file */ + H5F_t *f = NULL; /* hdf5 file pointer */ + char filename[1024]; /* file name */ + haddr_t heap_addr; /* local heap address */ + H5HL_t *heap = NULL; /* local heap */ + size_t obj[NOBJS]; /* offsets within the heap */ + int i, j; /* miscellaneous counters */ + char buf[1024]; /* the value to store */ + const char *s; /* value to read */ /* Reset library */ h5_reset(); @@ -77,22 +75,22 @@ main(void) */ TESTING("local heap write"); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) - goto error; + if(FAIL == (file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))) + goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { - H5_FAILED(); - H5Eprint2(H5E_DEFAULT, stdout); - goto error; + H5_FAILED(); + H5Eprint2(H5E_DEFAULT, stdout); + goto error; } - if (H5AC_ignore_tags(f) < 0) { - H5_FAILED(); - H5Eprint2(H5E_DEFAULT, stdout); - goto error; + if(FAIL == H5AC_ignore_tags(f)) { + H5_FAILED(); + H5Eprint2(H5E_DEFAULT, stdout); + goto error; } - if(H5HL_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)0, &heap_addr/*out*/) < 0) { - H5_FAILED(); - H5Eprint2(H5E_DEFAULT, stdout); - goto error; + if(FAIL == H5HL_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)0, &heap_addr/*out*/)) { + H5_FAILED(); + H5Eprint2(H5E_DEFAULT, stdout); + goto error; } if (NULL == (heap = H5HL_protect(f, H5P_DATASET_XFER_DEFAULT, heap_addr, H5AC__NO_FLAGS_SET))) { H5_FAILED(); @@ -106,18 +104,19 @@ main(void) if(j > 4) buf[j] = '\0'; - if((size_t)(-1) == (obj[i] = H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap, strlen(buf) + 1, buf))) { - H5_FAILED(); - H5Eprint2(H5E_DEFAULT, stdout); - goto error; - } + if(UFAIL == (obj[i] = H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap, strlen(buf) + 1, buf))) { + H5_FAILED(); + H5Eprint2(H5E_DEFAULT, stdout); + goto error; + } } - if(H5HL_unprotect(heap) < 0) { + if(FAIL == H5HL_unprotect(heap)) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; } - if (H5Fclose(file)<0) goto error; + if (FAIL == H5Fclose(file)) + goto error; PASSED(); /* @@ -126,16 +125,17 @@ main(void) TESTING("local heap read"); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) goto error; + if(FAIL == (file = H5Fopen(filename, H5F_ACC_RDONLY, fapl))) + goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; } - if (H5AC_ignore_tags(f) < 0) { - H5_FAILED(); - H5Eprint2(H5E_DEFAULT, stdout); - goto error; + if (FAIL == H5AC_ignore_tags(f)) { + H5_FAILED(); + H5Eprint2(H5E_DEFAULT, stdout); + goto error; } for(i = 0; i < NOBJS; i++) { sprintf(buf, "%03d-", i); @@ -164,14 +164,15 @@ main(void) goto error; } - if(H5HL_unprotect(heap) < 0) { + if(FAIL == H5HL_unprotect(heap)) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; } } - if (H5Fclose(file)<0) goto error; + if (FAIL == H5Fclose(file)) + goto error; PASSED(); /* Check opening existing file non-default sizes of lengths and addresses */ @@ -183,8 +184,10 @@ main(void) if(file >= 0){ if((dset = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(dset) < 0) TEST_ERROR - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Dclose(dset) < 0) + TEST_ERROR + if(H5Fclose(file) < 0) + TEST_ERROR } else { H5_FAILED(); @@ -206,7 +209,7 @@ main(void) error: puts("*** TESTS FAILED ***"); H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } diff --git a/test/links.c b/test/links.c index 577834d..db5922b 100644 --- a/test/links.c +++ b/test/links.c @@ -10695,7 +10695,7 @@ corder_delete(hid_t fapl) unsigned min_dense; /* Minimum # of links to store in group "densely" */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ - hbool_t reopen_file; /* Whether to re-open the file before deleting group */ + unsigned reopen_file; /* Whether to re-open the file before deleting group */ h5_stat_size_t empty_size; /* Size of empty file */ h5_stat_size_t file_size; /* Size of file after operating on it */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -10976,8 +10976,8 @@ link_info_by_idx(hid_t fapl) hid_t file_id = (-1); /* File ID */ hid_t group_id = (-1); /* Group ID */ hid_t gcpl_id = (-1); /* Group creation property list ID */ - hbool_t hard_link; /* Create hard or soft link? */ - hbool_t use_index; /* Use index on creation order values */ + unsigned hard_link; /* Create hard or soft link? */ + unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ H5L_info_t linfo; /* Link info struct */ @@ -11159,7 +11159,7 @@ link_info_by_idx_old(hid_t fapl) { hid_t file_id = (-1); /* File ID */ hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hbool_t hard_link; /* Create hard or soft link? */ + unsigned hard_link; /* Create hard or soft link? */ H5L_info_t linfo; /* Link info struct */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[NAME_BUF_SIZE]; /* Link value name */ @@ -11328,7 +11328,7 @@ delete_by_idx(hid_t fapl) hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ - hbool_t use_index; /* Use index on creation order values */ + unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ H5L_info_t linfo; /* Link info struct */ @@ -12161,7 +12161,7 @@ link_iterate(hid_t fapl) hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ - hbool_t use_index; /* Use index on creation order values */ + unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -12847,7 +12847,7 @@ open_by_idx(hid_t fapl) hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ - hbool_t use_index; /* Use index on creation order values */ + unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ H5O_info_t oi; /* Buffer for querying object's info */ @@ -13283,7 +13283,7 @@ object_info(hid_t fapl) hid_t space_id = (-1); /* Dataspace ID (for attributes) */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ - hbool_t use_index; /* Use index on creation order values */ + unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ H5O_info_t oinfo; /* Buffer for querying object's info */ @@ -13679,7 +13679,7 @@ group_info(hid_t fapl) hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ - hbool_t use_index; /* Use index on creation order values */ + unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ H5G_info_t grp_info; /* Buffer for querying object's info */ @@ -14490,8 +14490,8 @@ main(void) { hid_t fapl, fapl2; /* File access property lists */ int nerrors = 0; - hbool_t new_format; /* Whether to use the new format or not */ - hbool_t efc; /* Whether to use the external file cache */ + unsigned new_format; /* Whether to use the new format or not */ + unsigned efc; /* Whether to use the external file cache */ const char *env_h5_drvr; /* File Driver value from environment */ env_h5_drvr = HDgetenv("HDF5_DRIVER"); @@ -6802,7 +6802,7 @@ test_mf_fs_drivers(hid_t fapl) hid_t fcpl = -1; /* file creation property list */ hid_t fapl_new = -1; /* copy of file access property list */ hid_t fapl2 = -1; /* copy of file access property list */ - hbool_t new_format; /* To use new library format or not */ + unsigned new_format; /* To use new library format or not */ unsigned ret = 0; /* return value */ H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; /* Memory usage map */ @@ -7227,7 +7227,7 @@ test_filespace_drivers(hid_t fapl) { hid_t fapl_new = -1; /* copy of file access property list */ hid_t fapl2 = -1; /* copy of file access property list */ - hbool_t new_format; /* Using library new format or not */ + unsigned new_format; /* Using library new format or not */ unsigned ret = 0; /* return value */ H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; /* Memory usage map */ diff --git a/test/objcopy.c b/test/objcopy.c index ecc3ba5..82be446 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -12312,7 +12312,7 @@ main(void) /* Tests that do not use attributes and do not need to be tested * multiple times for different attribute configurations */ if(configuration < CONFIG_DENSE) { - hbool_t reopen; + unsigned reopen; nerrors += test_copy_named_datatype(fcpl_src, fcpl_dst, src_fapl, dst_fapl); nerrors += test_copy_named_datatype_vl(fcpl_src, fcpl_dst, src_fapl, dst_fapl); diff --git a/test/ohdr.c b/test/ohdr.c index e178729..53aa18f 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -321,7 +321,7 @@ main(void) time_t time_new, ro; int chunkno; /* Chunk index for message */ int i; /* Local index variable */ - hbool_t b; /* Index for "new format" loop */ + unsigned b; /* Index for "new format" loop */ herr_t ret; /* Generic return value */ /* Reset library */ diff --git a/test/plugin.c b/test/plugin.c index e34c691..a3082d2 100644 --- a/test/plugin.c +++ b/test/plugin.c @@ -710,7 +710,7 @@ main(void) { char filename[FILENAME_BUF_SIZE]; hid_t file, fapl, fapl2; - hbool_t new_format; + unsigned new_format; int mdc_nelmts; size_t rdcc_nelmts; size_t rdcc_nbytes; diff --git a/test/set_extent.c b/test/set_extent.c index f6c3766..ae83ba2 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -116,8 +116,8 @@ int main( void ) { hid_t fapl; /* file access property list */ hid_t fapl2; /* file access property list w/latest format set */ - hbool_t new_format; /* Whether to use the latest file format */ - hbool_t chunk_cache; /* Whether to enable chunk caching */ + unsigned new_format; /* Whether to use the latest file format */ + unsigned chunk_cache; /* Whether to enable chunk caching */ int nerrors = 0; /* Initialize random number seed */ diff --git a/test/stab.c b/test/stab.c index 7db1feb..f81bb5f 100644 --- a/test/stab.c +++ b/test/stab.c @@ -1166,7 +1166,7 @@ int main(void) { hid_t fapl, fapl2; /* File access property list IDs */ - hbool_t new_format; /* Whether to use the new format or not */ + unsigned new_format; /* Whether to use the new format or not */ int nerrors = 0; /* Reset library */ diff --git a/test/tattr.c b/test/tattr.c index d96ca59..585246a 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -5338,7 +5338,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) hsize_t nattrs; /* Number of attributes on object */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ - hbool_t reopen_file; /* Whether to re-open the file before deleting group */ + unsigned reopen_file; /* Whether to re-open the file before deleting group */ char attrname[NAME_BUF_SIZE]; /* Name of attribute */ #ifdef LATER h5_stat_size_t empty_size; /* Size of empty file */ @@ -5687,7 +5687,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) hsize_t nattrs; /* Number of attributes on object */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ - hbool_t use_index; /* Use index on creation order values */ + unsigned use_index; /* Use index on creation order values */ char attrname[NAME_BUF_SIZE]; /* Name of attribute */ char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */ unsigned curr_dset; /* Current dataset to work on */ @@ -5899,7 +5899,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) hsize_t corder_count; /* # of records in creation order index */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ - hbool_t use_index; /* Use index on creation order values */ + unsigned use_index; /* Use index on creation order values */ char attrname[NAME_BUF_SIZE]; /* Name of attribute */ char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */ unsigned curr_dset; /* Current dataset to work on */ @@ -6842,7 +6842,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) attr_iter_info_t iter_info; /* Iterator info */ hbool_t *visited = NULL; /* Array of flags for visiting links */ hsize_t idx; /* Start index for iteration */ - hbool_t use_index; /* Use index on creation order values */ + unsigned use_index; /* Use index on creation order values */ const char *dsetname; /* Name of dataset for attributes */ char attrname[NAME_BUF_SIZE]; /* Name of attribute */ unsigned curr_dset; /* Current dataset to work on */ @@ -7203,7 +7203,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) hsize_t corder_count; /* # of records in creation order index */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ - hbool_t use_index; /* Use index on creation order values */ + unsigned use_index; /* Use index on creation order values */ char attrname[NAME_BUF_SIZE]; /* Name of attribute */ unsigned curr_dset; /* Current dataset to work on */ unsigned u; /* Local index variable */ @@ -7549,7 +7549,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) hsize_t nattrs; /* Number of attributes on object */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ - hbool_t use_index; /* Use index on creation order values */ + unsigned use_index; /* Use index on creation order values */ const char *dsetname; /* Name of dataset for attributes */ char attrname[NAME_BUF_SIZE]; /* Name of attribute */ unsigned curr_dset; /* Current dataset to work on */ @@ -7804,7 +7804,7 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) hsize_t nattrs; /* Number of attributes on object */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ - hbool_t use_index; /* Use index on creation order values */ + unsigned use_index; /* Use index on creation order values */ const char *dsetname; /* Name of dataset for attributes */ char attrname[NAME_BUF_SIZE]; /* Name of attribute */ unsigned curr_dset; /* Current dataset to work on */ @@ -10568,8 +10568,8 @@ test_attr(void) { hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */ hid_t fcpl = (-1), fcpl2 = (-1); /* File creation property lists */ - hbool_t new_format; /* Whether to use the new format or not */ - hbool_t use_shared; /* Whether to use shared attributes or not */ + unsigned new_format; /* Whether to use the new format or not */ + unsigned use_shared; /* Whether to use shared attributes or not */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ diff --git a/test/tfile.c b/test/tfile.c index 5fc528e..c36045b 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -3058,7 +3058,7 @@ test_filespace_info(void) char filename[FILENAME_LEN]; /* Filename to use */ H5F_file_space_type_t strategy, fs_type, def_type; /* File space handling strategy */ hsize_t threshold, fs_size, def_size; /* Free space section threshold */ - hbool_t new_format; /* new format or old format */ + unsigned new_format; /* new format or old format */ herr_t ret; /* return value */ /* Output message about test being performed */ @@ -3121,7 +3121,7 @@ test_filespace_info(void) /* Create the file with the specified file space info */ fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl1, my_fapl); - CHECK(ret, FAIL, "H5Fcreate"); + CHECK(fid1, FAIL, "H5Fcreate"); /* Close the file */ ret = H5Fclose(fid1); @@ -3129,7 +3129,7 @@ test_filespace_info(void) /* Re-open the file */ fid2 = H5Fopen(filename, H5F_ACC_RDWR, my_fapl); - CHECK(ret, FAIL, "H5Fopen"); + CHECK(fid2, FAIL, "H5Fopen"); /* Get the file's creation property */ fcpl2 = H5Fget_create_plist(fid2); diff --git a/test/th5o.c b/test/th5o.c index 90f3c9b..3be5d12 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -776,7 +776,7 @@ test_h5o_link(void) hid_t lcpl_id=-1; hsize_t dims[2] = {TEST6_DIM1, TEST6_DIM2}; htri_t committed; /* Whether the named datatype is committed */ - hbool_t new_format; /* Whether to use the new format or not */ + unsigned new_format; /* Whether to use the new format or not */ int wdata[TEST6_DIM1][TEST6_DIM2]; int rdata[TEST6_DIM1][TEST6_DIM2]; int i, n, j; @@ -1335,6 +1335,7 @@ test_h5o_getinfo_same_file(void) } /* test_h5o_getinfo_same_file() */ + /**************************************************************** ** diff --git a/test/titerate.c b/test/titerate.c index 98428ea..20a3940 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -919,7 +919,7 @@ void test_iterate(void) { hid_t fapl, fapl2; /* File access property lists */ - hbool_t new_format; /* Whether to use the new format or not */ + unsigned new_format; /* Whether to use the new format or not */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ diff --git a/test/tmisc.c b/test/tmisc.c index fa0f150..1298f6b 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -5176,7 +5176,7 @@ static void test_misc30(void) { hsize_t file_size[] = {0, 0}; /* Sizes of file created */ - hbool_t get_info; /* Whether to perform the get info call */ + unsigned get_info; /* Whether to perform the get info call */ /* Output message about test being performed */ MESSAGE(5, ("Local heap dropping free block info\n")); diff --git a/test/unlink.c b/test/unlink.c index c091281..7169365 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -2443,7 +2443,7 @@ main(void) hid_t fapl, fapl2, file; int nerrors = 0; char filename[1024]; - hbool_t new_format; + unsigned new_format; /* Metadata cache parameters */ int mdc_nelmts; @@ -37,7 +37,7 @@ const char *FILENAME[] = { "vds_virt_1", "vds_src_0", "vds_src_1", - "vds%_src", + "vds%%_src", NULL }; @@ -1156,7 +1156,7 @@ test_basic_io(unsigned config, hid_t fapl) char vfilename2[FILENAME_BUF_SIZE]; char srcfilenamepct[FILENAME_BUF_SIZE]; char srcfilenamepct_map[FILENAME_BUF_SIZE]; - const char *srcfilenamepct_map_orig = "vds%%_src"; + const char *srcfilenamepct_map_orig = "vds%%%%_src"; hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ hid_t vfile = -1; /* File with virtual dset */ hid_t vfile2 = -1; /* File with copied virtual dset */ @@ -6383,7 +6383,7 @@ test_printf(unsigned config, hid_t fapl) const char *printf_srcfilename_map_orig = "vds_src_%b"; char srcfilenamepct[FILENAME_BUF_SIZE]; char srcfilenamepct_map[FILENAME_BUF_SIZE]; - const char *srcfilenamepct_map_orig = "vds%%_src"; + const char *srcfilenamepct_map_orig = "vds%%%%_src"; hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ hid_t vfile = -1; /* File with virtual dset */ hid_t dcpl = -1; /* Dataset creation property list */ diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index feea137..c234257 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -626,7 +626,7 @@ Test Whether the Displacement of MPI derived datatype and this platform. 1. Details for the test: -1) Create two derived datatypes with MPI_Type_hindexed: +1) Create two derived datatypes with MPI_Type_create_hindexed: datatype1: count = 1, blocklens = 1, offsets = 0, base type = MPI_BYTE(essentially a char) @@ -635,7 +635,7 @@ and this platform. base type = MPI_BYTE 2) Using these two derived datatypes, - Build another derived datatype with MPI_Type_struct: + Build another derived datatype with MPI_Type_create_struct: advtype: derived from datatype1 and datatype2 advtype: count = 2, blocklens[0] = 1, blocklens[1]=1, @@ -716,7 +716,7 @@ static int test_mpio_derived_dtype(char *filename) { blocklens[0] = 1; offsets[0] = 0; - if((mpi_err= MPI_Type_hindexed(count,blocklens,offsets,MPI_BYTE,&filetype)) + if((mpi_err= MPI_Type_create_hindexed(count,blocklens,offsets,MPI_BYTE,&filetype)) != MPI_SUCCESS){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); @@ -732,7 +732,7 @@ static int test_mpio_derived_dtype(char *filename) { count = 1; blocklens[0]=1; offsets[0] = 1; - if((mpi_err= MPI_Type_hindexed(count,blocklens,offsets,MPI_BYTE,&filetypenew)) + if((mpi_err= MPI_Type_create_hindexed(count,blocklens,offsets,MPI_BYTE,&filetypenew)) != MPI_SUCCESS){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); @@ -753,10 +753,10 @@ static int test_mpio_derived_dtype(char *filename) { bas_filetype[0] = filetype; bas_filetype[1] = filetypenew; - if((mpi_err= MPI_Type_struct(outcount,adv_blocklens,adv_disp,bas_filetype,&adv_filetype)) + if((mpi_err= MPI_Type_create_struct(outcount,adv_blocklens,adv_disp,bas_filetype,&adv_filetype)) != MPI_SUCCESS){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_struct failed (%s)\n", mpi_err_str); + printf("MPI_Type_create_struct failed (%s)\n", mpi_err_str); return 1; } if((mpi_err=MPI_Type_commit(&adv_filetype))!=MPI_SUCCESS){ @@ -843,7 +843,7 @@ has no contribution to IO. To properly test this case, at least FOUR processes are needed. 1. Details for the test: -1) Create one derived datatype with MPI_Type_hindexed: +1) Create one derived datatype with MPI_Type_create_hindexed: 2) Choosing at least two processes to contribute none for IO with the buf size inside MPI_Write_at_all to 0. @@ -899,7 +899,7 @@ test_mpio_special_collective(char *filename) offsets[1] = (mpi_size+mpi_rank)*count; if(count !=0) { - if((mpi_err = MPI_Type_hindexed(2, + if((mpi_err = MPI_Type_create_hindexed(2, blocklens, offsets, etype, @@ -915,7 +915,7 @@ test_mpio_special_collective(char *filename) return 1; } /* end if */ - if((mpi_err = MPI_Type_hindexed(2, + if((mpi_err = MPI_Type_create_hindexed(2, blocklens, offsets, etype, diff --git a/tools/h5diff/CMakeTests.cmake b/tools/h5diff/CMakeTests.cmake index 33d0971..0595edd 100644 --- a/tools/h5diff/CMakeTests.cmake +++ b/tools/h5diff/CMakeTests.cmake @@ -280,9 +280,9 @@ # - # Overwrite system dependent files (Windows) + # Overwrite system dependent files (Windows) and not VS2015 # - if (WIN32) + if (WIN32 AND MSVC_VERSION LESS 1900) add_custom_command ( TARGET h5diff POST_BUILD @@ -309,7 +309,7 @@ COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_104w.txt ${PROJECT_BINARY_DIR}/testfiles/h5diff_104.txt ) - endif (WIN32) + endif (WIN32 AND MSVC_VERSION LESS 1900) ############################################################################## ############################################################################## diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c index 776eaeb..4e02e6b 100644 --- a/tools/h5jam/getub.c +++ b/tools/h5jam/getub.c @@ -13,21 +13,14 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include <stdio.h> -#include <fcntl.h> - -#ifdef H5_HAVE_UNISTD_H -#include <unistd.h> -#endif - #include "H5private.h" #include "h5tools.h" #include "h5tools_utils.h" -void parse_command_line (int argc, const char *argv[]); +void parse_command_line(int argc, const char *argv[]); /* Name of tool */ -#define PROGRAMNAME "getub" +#define PROGRAM_NAME "getub" char *nbytes = NULL; static const char *s_opts = "c:"; /* add more later ? */ @@ -42,19 +35,14 @@ static struct long_options l_opts[] = { * Purpose: Print the usage message * * Return: void - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ static void usage (const char *prog) { - fflush (stdout); - fprintf (stdout, "usage: %s -c nb file] \n", prog); - fprintf (stdout, " print first 'nb' byts of file to stdoug.\n"); + HDfflush(stdout); + HDfprintf(stdout, "usage: %s -c nb file] \n", prog); + HDfprintf(stdout, " print first 'nb' byts of file to stdoug.\n"); } /*------------------------------------------------------------------------- @@ -65,112 +53,105 @@ usage (const char *prog) * Return: Success: * * Failure: Exits program with EXIT_FAILURE value. - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ - void -parse_command_line (int argc, const char *argv[]) +parse_command_line(int argc, const char *argv[]) { - int opt; - - /* parse command line options */ - while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) - { - switch ((char) opt) - { - case 'c': - nbytes = HDstrdup (opt_arg); - break; - case '?': - default: - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); - } - } - - if (argc <= opt_ind) - { + int opt; + + /* parse command line options */ + while((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) { + switch((char) opt) { + case 'c': + nbytes = HDstrdup(opt_arg); + break; + case '?': + default: + usage(h5tools_getprogname()); + HDexit(EXIT_FAILURE); + } /* end switch */ + } /* end while */ + + if(argc <= opt_ind) { error_msg("missing file name\n"); - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); - } -} + usage(h5tools_getprogname()); + HDexit(EXIT_FAILURE); + } /* end if */ +} /* end parse_command_line() */ int -main (int argc, const char *argv[]) +main(int argc, const char *argv[]) { - int fd; - unsigned int size; - char *filename; - long res; - char *buf; - - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); - - /* Initialize h5tools lib */ - h5tools_init(); - - parse_command_line (argc, argv); - - if (nbytes == NULL) - { - /* missing arg */ - error_msg("missing size\n"); - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); - } - if (argc <= (opt_ind)) - { - error_msg("missing file name\n"); - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); - } - filename = HDstrdup (argv[opt_ind]); - - size = 0; - res = sscanf (nbytes, "%u", &size); - if (res == EOF) - { + int fd = -1; + unsigned size; + char *filename = NULL; + long res; + char *buf = NULL; + + h5tools_setprogname(PROGRAM_NAME); + h5tools_setstatus(EXIT_SUCCESS); + + /* Initialize h5tools lib */ + h5tools_init(); + + parse_command_line(argc, argv); + + if(NULL == nbytes) { + /* missing arg */ + error_msg("missing size\n"); + usage(h5tools_getprogname()); + goto error; + } /* end if */ + + if(argc <= (opt_ind)) { + error_msg("missing file name\n"); + usage(h5tools_getprogname()); + goto error; + } /* end if */ + + filename = HDstrdup(argv[opt_ind]); + + size = 0; + if(EOF == (res = sscanf(nbytes, "%u", &size))) { /* fail */ error_msg("missing file name\n"); - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); - } - - fd = HDopen (filename, O_RDONLY, 0); - if (fd < 0) - { - error_msg("can't open file %s\n", filename); - exit (EXIT_FAILURE); - } - - buf = (char *)HDmalloc ((unsigned)(size + 1)); - if (buf == NULL) - { - HDclose (fd); - exit (EXIT_FAILURE); - } - - res = HDread (fd, buf, (unsigned)size); - - if (res < (long)size) - { - if (buf) - HDfree (buf); - HDclose (fd); - exit (EXIT_FAILURE); - } - - HDwrite (1, buf, (unsigned)size); - - if (buf) - HDfree (buf); - HDclose (fd); - return (EXIT_SUCCESS); -} + usage(h5tools_getprogname()); + goto error; + } /* end if */ + + if((fd = HDopen(filename, O_RDONLY, 0)) < 0) { + error_msg("can't open file %s\n", filename); + goto error; + } /* end if */ + + if(NULL == (buf = (char *)HDmalloc((unsigned)(size + 1)))) { + error_msg("can't allocate buffer \n"); + goto error; + } /* end if */ + + res = HDread(fd, buf, (unsigned)size); + if(res < (long)size) { + error_msg("Bad read \n"); + goto error; + } /* end if */ + + if(HDwrite(1, buf, (unsigned)size) < 0) { + error_msg("Bad write \n"); + goto error; + } /* end if */ + + /* close things and exit */ + HDfree(buf); + HDclose(fd); + + return EXIT_SUCCESS; + +error: + if(buf) + HDfree(buf); + if(fd > -1) + HDclose(fd); + return EXIT_FAILURE; +} /* end main() */ + diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index ab38f65..4509734 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -21,9 +21,6 @@ /* Name of tool */ #define PROGRAMNAME "h5jam" -#define TRUE 1 -#define FALSE 0 - hsize_t write_pad (int, hsize_t); hsize_t compute_user_block_size (hsize_t); hsize_t copy_some_to_file (int, int, hsize_t, hsize_t, ssize_t); @@ -421,109 +418,88 @@ main (int argc, const char *argv[]) * Return: Success: last byte written in the output. * Failure: Exits program with EXIT_FAILURE value. * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ hsize_t -copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout, +copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout, ssize_t limit) { - char buf[1024]; - h5_stat_t sbuf; - int res; - ssize_t tot = 0; - ssize_t howmuch = 0; - ssize_t nchars = -1; -/* used in assertion check - ssize_t ncw = -1; -*/ - ssize_t to; - ssize_t from; - ssize_t toend; - ssize_t fromend; - - if(startin > startout) { - /* this case is prohibited */ - error_msg("copy_some_to_file: panic: startin > startout?\n"); - exit (EXIT_FAILURE); - } - - if(limit < 0) { - res = HDfstat(infid, &sbuf); - if(res < 0) { - error_msg("Can't stat file \n"); - exit (EXIT_FAILURE); - } - - howmuch = (ssize_t)sbuf.st_size; - } - else - howmuch = limit; - - if(howmuch == 0) - return 0; - - /* assert (howmuch > 0) */ - - toend = (ssize_t) startout + howmuch; - fromend = (ssize_t) startin + howmuch; - - if (howmuch > 512) - { - to = toend - 512; - from = fromend - 512; - } - else - { - to = toend - howmuch; - from = fromend - howmuch; - } - - while (howmuch > 0) - { - HDlseek (outfid, (off_t) to, SEEK_SET); - HDlseek (infid, (off_t) from, SEEK_SET); - - if (howmuch > 512) - { - nchars = HDread (infid, buf, (unsigned) 512); - } - else - { - nchars = HDread (infid, buf, (unsigned)howmuch); - } - - if (nchars <= 0) - { - printf ("huh? \n"); - exit (EXIT_FAILURE); - } - /*ncw = */ HDwrite (outfid, buf, (unsigned) nchars); - - /* assert (ncw == nchars) */ - - tot += nchars; - howmuch -= nchars; - if (howmuch > 512) - { - to -= nchars; - from -= nchars; - } - else - { - to -= howmuch; - from -= howmuch; - } - } + char buf[1024]; + h5_stat_t sbuf; + int res; + ssize_t tot = 0; + ssize_t howmuch = 0; + ssize_t nchars = -1; + ssize_t to; + ssize_t from; + ssize_t toend; + ssize_t fromend; + + if(startin > startout) { + /* this case is prohibited */ + error_msg("copy_some_to_file: panic: startin > startout?\n"); + exit (EXIT_FAILURE); + } /* end if */ + + if(limit < 0) { + res = HDfstat(infid, &sbuf); + if(res < 0) { + error_msg("Can't stat file \n"); + HDexit(EXIT_FAILURE); + } /* end if */ + + howmuch = (ssize_t)sbuf.st_size; + } else { + howmuch = limit; + } /* end if */ + + if(0 == howmuch) + return 0; + + toend = (ssize_t) startout + howmuch; + fromend = (ssize_t) startin + howmuch; + + if (howmuch > 512) { + to = toend - 512; + from = fromend - 512; + } else { + to = toend - howmuch; + from = fromend - howmuch; + } /* end if */ + + while (howmuch > 0) { + HDlseek(outfid, (off_t) to, SEEK_SET); + HDlseek(infid, (off_t) from, SEEK_SET); + + if (howmuch > 512) { + nchars = HDread(infid, buf, (unsigned) 512); + } else { + nchars = HDread(infid, buf, (unsigned)howmuch); + } /* end if */ + + if (nchars <= 0) { + error_msg("Read error \n"); + HDexit(EXIT_FAILURE); + } /* end if */ + + if(HDwrite (outfid, buf, (unsigned) nchars) < 0) { + error_msg("Write error \n"); + HDexit(EXIT_FAILURE); + } - /* assert howmuch == 0 */ - /* assert tot == limit */ + tot += nchars; + howmuch -= nchars; + if(howmuch > 512) { + to -= nchars; + from -= nchars; + } else { + to -= howmuch; + from -= howmuch; + } /* end if */ + } /* end while */ - return ((hsize_t) tot + (hsize_t) startout); -} + return (hsize_t)tot + (hsize_t)startout; +} /* end copy_some_to_file() */ /*------------------------------------------------------------------------- @@ -539,28 +515,21 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout, * * Return: Success: last byte written in the output. * Failure: Exits program with EXIT_FAILURE value. - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ -hsize_t -compute_user_block_size (hsize_t ublock_size) +H5_ATTR_CONST hsize_t +compute_user_block_size(hsize_t ublock_size) { - hsize_t where = 512; + hsize_t where = 512; - if (ublock_size == 0) - return 0; + if(0 == ublock_size) + return 0; - while (where < ublock_size) - { - where *= 2; - } + while(where < ublock_size) + where *= 2; - return (where); -} + return where; +} /* end compute_user_block_size() */ /* * Write zeroes to fill the file from 'where' to 512, 1024, etc. bytes. diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index 40358c6..8e4eac4 100644 --- a/tools/h5jam/h5unjam.c +++ b/tools/h5jam/h5unjam.c @@ -21,8 +21,6 @@ /* Name of tool */ #define PROGRAMNAME "h5unjam" -#define TRUE 1 -#define FALSE 0 #define COPY_BUF_SIZE 1024 hsize_t write_pad( int , hsize_t ); diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake index caad5c1..8aee98f 100644 --- a/tools/h5repack/CMakeTests.cmake +++ b/tools/h5repack/CMakeTests.cmake @@ -167,14 +167,14 @@ ENDMACRO (ADD_HELP_TEST) MACRO (ADD_H5_TEST_OLD testname testtype testfile) - if (${testtype} STREQUAL "SKIP") + if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_OLD-${testname}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" ) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else (${testtype} STREQUAL "SKIP") + else ("${testtype}" STREQUAL "SKIP") add_test ( NAME H5REPACK_OLD-${testname} COMMAND $<TARGET_FILE:h5repack> ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} @@ -187,18 +187,18 @@ COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES DEPENDS H5REPACK_OLD-${testname}) - endif (${testtype} STREQUAL "SKIP") + endif ("${testtype}" STREQUAL "SKIP") ENDMACRO (ADD_H5_TEST_OLD) MACRO (ADD_H5_TEST testname testtype testfile) - if (${testtype} STREQUAL "SKIP") + if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK-${testname}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" ) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else (${testtype} STREQUAL "SKIP") + else ("${testtype}" STREQUAL "SKIP") add_test ( NAME H5REPACK-${testname} COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} @@ -211,18 +211,18 @@ COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname}) - endif (${testtype} STREQUAL "SKIP") + endif ("${testtype}" STREQUAL "SKIP") ENDMACRO (ADD_H5_TEST) MACRO (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile) - if (${testtype} STREQUAL "SKIP") + if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_CMP-${testname}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else (${testtype} STREQUAL "SKIP") + else ("${testtype}" STREQUAL "SKIP") # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -245,18 +245,18 @@ if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test}) endif (NOT "${last_test}" STREQUAL "") - endif (${testtype} STREQUAL "SKIP") + endif ("${testtype}" STREQUAL "SKIP") ENDMACRO (ADD_H5_CMP_TEST) MACRO (ADD_H5_DMP_TEST testname testtype resultcode resultfile) - if (${testtype} STREQUAL "SKIP") + if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_DMP-${testname}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else (${testtype} STREQUAL "SKIP") + else ("${testtype}" STREQUAL "SKIP") # If using memchecker add tests without using scripts add_test ( NAME H5REPACK_DMP-${testname} @@ -278,18 +278,18 @@ ) set_tests_properties (H5REPACK_DMP-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_DMP-${testname}") endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - endif (${testtype} STREQUAL "SKIP") + endif ("${testtype}" STREQUAL "SKIP") ENDMACRO (ADD_H5_DMP_TEST) MACRO (ADD_H5_VERIFY_TEST testname testtype resultcode testfile testdset testfilter) - if (${testtype} STREQUAL "SKIP") + if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else (${testtype} STREQUAL "SKIP") + else ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname} @@ -303,7 +303,7 @@ COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DFF PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}) - if (${resultcode} STREQUAL "0") + if ("${resultcode}" STREQUAL "0") add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" @@ -317,16 +317,16 @@ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF) - else (${resultcode} STREQUAL "0") - if (${testfilter} STREQUAL "CHUNKED") + else ("${resultcode}" STREQUAL "0") + if ("${testfilter}" STREQUAL "CHUNKED") set (nottestfilter "(CONTIGUOUS|COMPACT)") - endif (${testfilter} STREQUAL "CHUNKED") - if (${testfilter} STREQUAL "CONTIGUOUS") + endif ("${testfilter}" STREQUAL "CHUNKED") + if ("${testfilter}" STREQUAL "CONTIGUOUS") set (nottestfilter "(CHUNK|COMPACT)") - endif (${testfilter} STREQUAL "CONTIGUOUS") - if (${testfilter} STREQUAL "COMPACT") + endif ("${testfilter}" STREQUAL "CONTIGUOUS") + if ("${testfilter}" STREQUAL "COMPACT") set (nottestfilter "(CONTIGUOUS|CHUNK)") - endif (${testfilter} STREQUAL "COMPACT") + endif ("${testfilter}" STREQUAL "COMPACT") add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" @@ -340,9 +340,9 @@ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF) - endif (${resultcode} STREQUAL "0") + endif ("${resultcode}" STREQUAL "0") endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - endif (${testtype} STREQUAL "SKIP") + endif ("${testtype}" STREQUAL "SKIP") ENDMACRO (ADD_H5_VERIFY_TEST) MACRO (ADD_H5_TEST_META testname testfile) diff --git a/tools/h5repack/dynlib_rpk.c b/tools/h5repack/dynlib_rpk.c index 1ccc33a..6e8a7b6 100644 --- a/tools/h5repack/dynlib_rpk.c +++ b/tools/h5repack/dynlib_rpk.c @@ -24,6 +24,18 @@ #define H5Z_FILTER_DYNLIB1 257 +/* gcc attribute support from H5private.h */ +#ifdef __cplusplus +# define H5_ATTR_CONST /*void*/ +#else /* __cplusplus */ +#if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C) +# define H5_ATTR_CONST __attribute__((const)) +#else +# define H5_ATTR_CONST /*void*/ +#endif +#endif /* __cplusplus */ + + static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); @@ -38,8 +50,8 @@ const H5Z_class2_t H5Z_DYNLIB1[1] = {{ (H5Z_func_t)H5Z_filter_dynlib1, /* The actual filter function */ }}; -H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} -const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;} +H5_ATTR_CONST H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} +H5_ATTR_CONST const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;} /*------------------------------------------------------------------------- * Function: H5Z_filter_dynlib1 diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index ac6ca23..a331014 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -310,7 +310,7 @@ static void usage(const char *prog) * *------------------------------------------------------------------------- */ -static unsigned +H5_ATTR_CONST static unsigned ceil_log10(unsigned long x) { unsigned long pow10 = 1; @@ -321,7 +321,7 @@ ceil_log10(unsigned long x) ret++; } /* end while */ - return(ret); + return ret; } /* ceil_log10() */ diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 6474082..190343b 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -334,8 +334,8 @@ hsize_t diff_attr(hid_t loc1_id, size_t msize2; /* memory size of memory type */ void *buf1=NULL; /* data buffer */ void *buf2=NULL; /* data buffer */ - int buf1hasdata=0; /* buffer has data */ - int buf2hasdata=0; /* buffer has data */ + hbool_t buf1hasdata=FALSE; /* buffer has data */ + hbool_t buf2hasdata=FALSE; /* buffer has data */ hsize_t nelmts1; /* number of elements in dataset */ int rank1; /* rank of dataset */ int rank2; /* rank of dataset */ @@ -472,12 +472,12 @@ hsize_t diff_attr(hid_t loc1_id, parallel_print("Failed reading attribute1 %s/%s\n", path1, name1); goto error; }else - buf1hasdata = 1; + buf1hasdata = TRUE; if(H5Aread(attr2_id,mtype2_id,buf2) < 0){ parallel_print("Failed reading attribute2 %s/%s\n", path2, name2); goto error; }else - buf2hasdata = 1; + buf2hasdata = TRUE; /* format output string */ HDsnprintf(np1, sizeof(np1), "%s of <%s>", name1, path1); diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c index f58af3a..37d505a 100644 --- a/tools/misc/h5repart.c +++ b/tools/misc/h5repart.c @@ -200,21 +200,21 @@ main (int argc, char *argv[]) int verbose=FALSE; /*display file names? */ - const char *src_gen_name; /*general source name */ - char src_name[NAMELEN]; /*source member name */ + const char *src_gen_name; /*general source name */ + char *src_name=NULL; /*source member name */ int src_is_family; /*is source name a family name? */ int src_membno=0; /*source member number */ - const char *dst_gen_name; /*general destination name */ - char dst_name[NAMELEN]; /*destination member name */ + const char *dst_gen_name; /*general destination name */ + char *dst_name=NULL; /*destination member name */ int dst_is_family; /*is dst name a family name? */ int dst_membno=0; /*destination member number */ off_t left_overs=0; /*amount of zeros left over */ off_t src_offset=0; /*offset in source member */ off_t dst_offset=0; /*offset in destination member */ - off_t src_size; /*source logical member size */ + off_t src_size; /*source logical member size */ off_t src_act_size; /*source actual member size */ off_t dst_size=1 GB; /*destination logical memb size */ hid_t fapl; /*file access property list */ @@ -232,24 +232,30 @@ main (int argc, char *argv[]) * Parse switches. */ while (argno<argc && '-'==argv[argno][0]) { - if (!strcmp (argv[argno], "-v")) { - verbose = TRUE; - argno++; - } else if (!strcmp(argv[argno], "-V")) { - printf("This is %s version %u.%u release %u\n", - prog_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); - exit(EXIT_SUCCESS); + if (!strcmp (argv[argno], "-v")) { + verbose = TRUE; + argno++; + } else if (!strcmp(argv[argno], "-V")) { + printf("This is %s version %u.%u release %u\n", + prog_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); + exit(EXIT_SUCCESS); } else if (!strcmp (argv[argno], "-family_to_sec2")) { - family_to_sec2 = TRUE; - argno++; - } else if ('b'==argv[argno][1]) { - blk_size = get_size (prog_name, &argno, argc, argv); - } else if ('m'==argv[argno][1]) { - dst_size = get_size (prog_name, &argno, argc, argv); - } else { - usage (prog_name); - } - } + family_to_sec2 = TRUE; + argno++; + } else if ('b'==argv[argno][1]) { + blk_size = get_size (prog_name, &argno, argc, argv); + } else if ('m'==argv[argno][1]) { + dst_size = get_size (prog_name, &argno, argc, argv); + } else { + usage (prog_name); + } /* end if */ + } /* end while */ + + /* allocate names */ + if(NULL == (src_name = HDcalloc((size_t)NAMELEN, sizeof(char)))) + exit(EXIT_FAILURE); + if(NULL == (dst_name = HDcalloc((size_t)NAMELEN, sizeof(char)))) + exit(EXIT_FAILURE); /* * Get the name for the source file and open the first member. The size @@ -485,19 +491,22 @@ main (int argc, char *argv[]) H5E_BEGIN_TRY { file=H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl); } H5E_END_TRY; + if(file>=0) { if(H5Fclose(file)<0) { perror ("H5Fclose"); exit (EXIT_FAILURE); - } - } + } /* end if */ + } /* end if */ if(H5Pclose(fapl)<0) { perror ("H5Pclose"); exit (EXIT_FAILURE); - } + } /* end if */ /* Free resources and return */ - HDfree (buf); + HDfree(src_name); + HDfree(dst_name); + HDfree(buf); return EXIT_SUCCESS; -} +} /* end main */ diff --git a/tools/misc/talign.c b/tools/misc/talign.c index 7eb4c50..be373e7 100644 --- a/tools/misc/talign.c +++ b/tools/misc/talign.c @@ -49,7 +49,7 @@ int main(void) char string5[5]; float fok[2] = {1234.0f, 2341.0f}; float fnok[2] = {5678.0f, 6785.0f}; - float *fptr; + float *fptr = NULL; char *data = NULL; @@ -143,8 +143,10 @@ out: if(error < 0) { result = 1; puts("*FAILED - HDF5 library error*"); - } else if(fok[0] != fptr[0] || fok[1] != fptr[1] - || fnok[0] != fptr[2] || fnok[1] != fptr[3]) { + } else if(!(H5_FLT_ABS_EQUAL(fok[0], fptr[0])) + || !(H5_FLT_ABS_EQUAL(fok[1], fptr[1])) + || !(H5_FLT_ABS_EQUAL(fnok[0], fptr[2])) + || !(H5_FLT_ABS_EQUAL(fnok[1], fptr[3]))) { char *mname; result = 1; diff --git a/tools/misc/vds/UC_1.h b/tools/misc/vds/UC_1.h index 29df72b..24299d4 100644 --- a/tools/misc/vds/UC_1.h +++ b/tools/misc/vds/UC_1.h @@ -136,7 +136,7 @@ static char UC_1_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; static char UC_1_VDS_DSET_NAME[NAME_LEN] = "vds_dset"; /* Fill values */ -static hsize_t UC_1_FILL_VALUES[UC_1_N_SOURCES] = { +static int UC_1_FILL_VALUES[UC_1_N_SOURCES] = { -1, -2, -3, diff --git a/tools/misc/vds/UC_1_one_dim_gen.c b/tools/misc/vds/UC_1_one_dim_gen.c index a78268b..ee56622 100644 --- a/tools/misc/vds/UC_1_one_dim_gen.c +++ b/tools/misc/vds/UC_1_one_dim_gen.c @@ -29,7 +29,7 @@ int -main(int argc, char *argv[]) +main(void) { hid_t src_sid = -1; /* source dataset's dataspace ID */ hid_t src_dcplid = -1; /* source dataset property list ID */ diff --git a/tools/misc/vds/UC_2.h b/tools/misc/vds/UC_2.h index 3e4e4fd..8b9f19a 100644 --- a/tools/misc/vds/UC_2.h +++ b/tools/misc/vds/UC_2.h @@ -138,7 +138,7 @@ static char UC_2_FILE_NAMES[UC_2_N_SOURCES][NAME_LEN] = { #define UC_2_VDS_DSET_NAME "vds_dset" /* Fill values */ -static hsize_t UC_2_FILL_VALUES[UC_2_N_SOURCES] = { +static int UC_2_FILL_VALUES[UC_2_N_SOURCES] = { -1, -2, -3, diff --git a/tools/misc/vds/UC_2_two_dims_gen.c b/tools/misc/vds/UC_2_two_dims_gen.c index b5fd319..c3dfa65 100644 --- a/tools/misc/vds/UC_2_two_dims_gen.c +++ b/tools/misc/vds/UC_2_two_dims_gen.c @@ -28,7 +28,7 @@ #include "UC_2.h" int -main(int argc, char *argv[]) +main(void) { hid_t src_sid = -1; /* source dataset's dataspace ID */ hid_t src_dcplid = -1; /* source dataset property list ID */ diff --git a/tools/misc/vds/UC_3_gaps_gen.c b/tools/misc/vds/UC_3_gaps_gen.c index 1f150c1..7cb208b 100644 --- a/tools/misc/vds/UC_3_gaps_gen.c +++ b/tools/misc/vds/UC_3_gaps_gen.c @@ -28,7 +28,7 @@ #include "UC_3.h" /* Create the VDS that uses use case 1 files */ -herr_t +static herr_t create_3_1_vds(void) { hid_t src_sid = -1; /* source dataset's dataspace ID */ @@ -135,7 +135,7 @@ error: } /* end create_3_1_vds() */ /* Create the VDS that uses use case 2 files */ -herr_t +static herr_t create_3_2_vds(void) { hid_t src_sid = -1; /* source dataset's dataspace ID */ @@ -236,7 +236,7 @@ error: } /* end create_3_2_vds() */ int -main(int argc, char *argv[]) +main(void) { if(create_3_1_vds() < 0) diff --git a/tools/misc/vds/UC_4.h b/tools/misc/vds/UC_4.h index ce74e63..bfcafed 100644 --- a/tools/misc/vds/UC_4.h +++ b/tools/misc/vds/UC_4.h @@ -74,7 +74,7 @@ static char UC_4_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; static char UC_4_VDS_DSET_NAME[NAME_LEN] = "vds_dset"; /* Fill values */ -static hsize_t UC_4_FILL_VALUES[UC_4_N_SOURCES] = { +static int UC_4_FILL_VALUES[UC_4_N_SOURCES] = { -1, -2, -3 diff --git a/tools/misc/vds/UC_4_printf_gen.c b/tools/misc/vds/UC_4_printf_gen.c index c8e111a..c0bb6b5 100644 --- a/tools/misc/vds/UC_4_printf_gen.c +++ b/tools/misc/vds/UC_4_printf_gen.c @@ -27,7 +27,7 @@ #include "UC_4.h" int -main(int argc, char *argv[]) +main(void) { hid_t src_sid = -1; /* source dataset's dataspace ID */ hid_t src_dcplid = -1; /* source dataset property list ID */ diff --git a/tools/misc/vds/UC_5.h b/tools/misc/vds/UC_5.h index b22b177..96b2af3 100644 --- a/tools/misc/vds/UC_5.h +++ b/tools/misc/vds/UC_5.h @@ -72,7 +72,7 @@ static char UC_5_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; static char UC_5_VDS_DSET_NAME[NAME_LEN] = "vds_dset"; /* Fill values */ -static hsize_t UC_5_FILL_VALUES[UC_5_N_SOURCES] = { +static int UC_5_FILL_VALUES[UC_5_N_SOURCES] = { -1, -2, -3 diff --git a/tools/misc/vds/UC_5_stride_gen.c b/tools/misc/vds/UC_5_stride_gen.c index 984aadc..9fa4908 100644 --- a/tools/misc/vds/UC_5_stride_gen.c +++ b/tools/misc/vds/UC_5_stride_gen.c @@ -27,7 +27,7 @@ #include "UC_5.h" int -main(int argc, char *argv[]) +main(void) { hid_t src_sid = -1; /* source dataset's dataspace ID */ hid_t src_dcplid = -1; /* source dataset property list ID */ diff --git a/tools/perform/pio_standalone.h b/tools/perform/pio_standalone.h index 584a057..762a564 100644 --- a/tools/perform/pio_standalone.h +++ b/tools/perform/pio_standalone.h @@ -105,10 +105,10 @@ typedef off_t h5_stat_size_t; * HDF Boolean type. */ #ifndef FALSE -# define FALSE 0 +# define FALSE false #endif #ifndef TRUE -# define TRUE 1 +# define TRUE true #endif diff --git a/tools/perform/sio_standalone.h b/tools/perform/sio_standalone.h index 8f52eba..547a9ee 100644 --- a/tools/perform/sio_standalone.h +++ b/tools/perform/sio_standalone.h @@ -471,10 +471,10 @@ extern char *strdup(const char *s); * HDF Boolean type. */ #ifndef FALSE -# define FALSE 0 +# define FALSE false #endif #ifndef TRUE -# define TRUE 1 +# define TRUE true #endif /** From h5test.h **/ diff --git a/tools/testfiles/tldouble.h5 b/tools/testfiles/tldouble.h5 Binary files differindex 56f673f..eb031e7 100644 --- a/tools/testfiles/tldouble.h5 +++ b/tools/testfiles/tldouble.h5 |