From ed7658df795092d7bd50705cae4319adb5985289 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 18 Jun 2009 13:37:49 -0500 Subject: [svn-r17085] Description: Bring r17002:17084 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.5.7 (amazon) in debug mode Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode --- MANIFEST | 2 + README.txt | 2 +- c++/src/Makefile.in | 2 +- config/lt_vers.am | 2 +- configure | 133 +++++- configure.in | 7 +- fortran/src/H5match_types.c | 14 +- fortran/src/Makefile.in | 2 +- hl/c++/src/Makefile.in | 2 +- hl/fortran/src/Makefile.in | 2 +- hl/src/Makefile.in | 2 +- release_docs/RELEASE.txt | 9 +- src/H5Dproxy.c | 6 +- src/H5F.c | 2 +- src/H5FDstdio.c | 2 + src/H5Faccum.c | 222 ++++++--- src/H5Fio.c | 8 + src/H5Fpkg.h | 3 +- src/H5Fprivate.h | 5 +- src/H5Fquery.c | 22 +- src/H5Ftest.c | 33 ++ src/H5HFcache.c | 170 ++++++- src/H5HFdblock.c | 40 +- src/H5HFiblock.c | 32 +- src/H5MF.c | 75 ++- src/H5MFaggr.c | 30 +- src/H5MFprivate.h | 3 + src/H5T.c | 200 ++++---- src/H5public.h | 4 +- src/H5win32defs.h | 2 +- src/Makefile.in | 2 +- test/dtypes.c | 204 ++++++++ test/mf.c | 208 +++++++- tools/h5diff/h5diff_main.c | 3 + tools/h5diff/h5diffgentest.c | 3 + tools/h5diff/ph5diff_main.c | 2 + tools/h5diff/testh5diff.sh | 5 +- tools/h5dump/h5dump.c | 18 +- tools/h5repack/h5repack.sh.in | 38 ++ tools/h5repack/h5repack_filters.c | 12 +- tools/h5repack/h5repack_verify.c | 32 +- tools/h5repack/h5repacktst.c | 17 + tools/lib/h5diff.c | 15 +- tools/testfiles/tnofilename.ddl | 4 +- vms/src/h5pubconf.h | 6 +- windows/perform/checkperformtests.bat | 1 + windows/perform/perf_serial/perf_serial.vcproj | 528 ++++++++++++++++++++ .../perform/perf_serialdll/perf_serialdll.vcproj | 529 +++++++++++++++++++++ windows/proj/all/all.sln | 28 ++ windows/proj/all_fortran/all_fortran.sln | 28 ++ windows/src/H5pubconf.h | 6 +- windows/tools/h5repack/h5repack.bat | 50 +- 52 files changed, 2453 insertions(+), 324 deletions(-) create mode 100644 windows/perform/perf_serial/perf_serial.vcproj create mode 100644 windows/perform/perf_serialdll/perf_serialdll.vcproj diff --git a/MANIFEST b/MANIFEST index a3b9125..e15d5b8 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1962,6 +1962,8 @@ # Performance Tests ./windows/perform/checkperformtests.bat +./windows/perform/perf_serialdll/perf_serialdll.vcproj +./windows/perform/perf_serial/perf_serial.vcproj # Project Files ./windows/proj/all/all.sln diff --git a/README.txt b/README.txt index 938d526..0fe3513 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.40-FA_a2 currently under development +HDF5 version 1.9.42-FA_a2 currently under development ==> README.txt <== Messages to be sent to the list should be sent to "@hdfgroup.org". diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index f120625..8becac5 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -360,7 +360,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 30 +LT_VERS_REVISION = 32 LT_VERS_AGE = 0 # Include src directory diff --git a/config/lt_vers.am b/config/lt_vers.am index 52f6fa3..46e9f0d 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -17,7 +17,7 @@ # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 30 +LT_VERS_REVISION = 32 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/configure b/configure index 826f33f..22eb85d 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.in Id: configure.in 16998 2009-06-02 21:17:26Z koziol . +# From configure.in Id: configure.in 17019 2009-06-09 17:56:22Z koziol . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for HDF5 1.9.40-FA_a2. +# Generated by GNU Autoconf 2.61 for HDF5 1.9.42-FA_a2. # # Report bugs to . # @@ -724,8 +724,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.40-FA_a2' -PACKAGE_STRING='HDF5 1.9.40-FA_a2' +PACKAGE_VERSION='1.9.42-FA_a2' +PACKAGE_STRING='HDF5 1.9.42-FA_a2' PACKAGE_BUGREPORT='help@hdfgroup.org' ac_unique_file="src/H5.c" @@ -1502,7 +1502,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.40-FA_a2 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.42-FA_a2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1572,7 +1572,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.40-FA_a2:";; + short | recursive ) echo "Configuration of HDF5 1.9.42-FA_a2:";; esac cat <<\_ACEOF @@ -1756,7 +1756,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.40-FA_a2 +HDF5 configure 1.9.42-FA_a2 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1770,7 +1770,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.40-FA_a2, which was +It was created by HDF5 $as_me 1.9.42-FA_a2, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2465,7 +2465,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.40-FA_a2' + VERSION='1.9.42-FA_a2' cat >>confdefs.h <<_ACEOF @@ -23730,9 +23730,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - - -for ac_func in lseek64 fseek64 ftruncate64 fseeko ftello +for ac_func in lseek64 fseek64 ftruncate64 do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -23837,11 +23835,114 @@ else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { echo "$as_me:$LINENO: result: skipping test for lseek64(), fseek64(), ftruncate64(), fseeko(), and ftello()" >&5 -echo "${ECHO_T}skipping test for lseek64(), fseek64(), ftruncate64(), fseeko(), and ftello()" >&6; } + { echo "$as_me:$LINENO: result: skipping test for lseek64(), fseek64(), ftruncate64()" >&5 +echo "${ECHO_T}skipping test for lseek64(), fseek64(), ftruncate64()" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +for ac_func in fseeko ftello +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus + extern "C" +# endif + int FC_DUMMY_MAIN() { return 1; } +#endif +#endif +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -52422,7 +52523,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.40-FA_a2, which was +This file was extended by HDF5 $as_me 1.9.42-FA_a2, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -52475,7 +52576,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -HDF5 config.status 1.9.40-FA_a2 +HDF5 config.status 1.9.42-FA_a2 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.in b/configure.in index 24e07e2..3ea4445 100644 --- a/configure.in +++ b/configure.in @@ -26,7 +26,7 @@ dnl dnl NOTE: Don't forget to change the version number here when we do a dnl release!!! dnl -AC_INIT([HDF5], [1.9.40-FA_a2], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.42-FA_a2], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AM_CONFIG_HEADER([src/H5config.h]) @@ -1287,8 +1287,9 @@ esac AC_TRY_COMPILE([#include ], [off64_t n = 0;], - [AC_CHECK_FUNCS([lseek64 fseek64 ftruncate64 fseeko ftello])], - [AC_MSG_RESULT([skipping test for lseek64(), fseek64(), ftruncate64(), fseeko(), and ftello()])]) + [AC_CHECK_FUNCS([lseek64 fseek64 ftruncate64])], + [AC_MSG_RESULT([skipping test for lseek64(), fseek64(), ftruncate64()])]) +AC_CHECK_FUNCS(fseeko ftello) AC_TRY_COMPILE([ #include #include ], diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 091d0c8..d6b7a85 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -102,13 +102,13 @@ endFfile(void) /* Define a c_int_x type in the C header */ void writeTypedef(const char* c_type, unsigned int size) { - fprintf(c_header, "#define c_int_%d %s\n", size, c_type); + fprintf(c_header, "#define c_int_%u %s\n", size, c_type); } /* Define a c_float_x type in the C header */ void writeFloatTypedef(const char* c_type, unsigned int size) { - fprintf(c_header, "#define c_float_%d %s\n", size, c_type); + fprintf(c_header, "#define c_float_%u %s\n", size, c_type); } /* Call this function if there is no matching C type for sizes > 1 */ @@ -116,22 +116,22 @@ void writeTypedefDefault(unsigned int size) { assert(size %2 == 0); - fprintf(c_header, "typedef struct {c_int_%d a; c_int_%d b;} c_int_%d\n", size / 2, size / 2, size); + fprintf(c_header, "typedef struct {c_int_%u a; c_int_%u b;} c_int_%u\n", size / 2, size / 2, size); } /* Create matching Fortran and C types by writing to both files */ void writeToFiles(const char* fortran_type, const char* c_type, unsigned int size) { - fprintf(fort_header, " INTEGER, PARAMETER :: %s = %d\n", fortran_type, size); - fprintf(c_header, "typedef c_int_%d %s;\n", size, c_type); + fprintf(fort_header, " INTEGER, PARAMETER :: %s = %u\n", fortran_type, size); + fprintf(c_header, "typedef c_int_%u %s;\n", size, c_type); } /* Create matching Fortran and C floating types by writing to both files */ void writeFloatToFiles(const char* fortran_type, const char* c_type, unsigned int size) { - fprintf(fort_header, " INTEGER, PARAMETER :: %s = %d\n", fortran_type, size); + fprintf(fort_header, " INTEGER, PARAMETER :: %s = %u\n", fortran_type, size); - fprintf(c_header, "typedef c_float_%d %s;\n", size, c_type); + fprintf(c_header, "typedef c_float_%u %s;\n", size, c_type); } int main() diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index fa2d8b6..dabafe1 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -389,7 +389,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 30 +LT_VERS_REVISION = 32 LT_VERS_AGE = 0 # Include src directory in both Fortran and C flags (C compiler is used diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index 2717e31..97be687 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -349,7 +349,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 30 +LT_VERS_REVISION = 32 LT_VERS_AGE = 0 # Include src directory diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index 075b4d2..f694eba 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -354,7 +354,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 30 +LT_VERS_REVISION = 32 LT_VERS_AGE = 0 INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \ -I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index aae98f8..ddd9452 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -350,7 +350,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 30 +LT_VERS_REVISION = 32 LT_VERS_AGE = 0 # Add include directories to the C preprocessor flags diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index ff34e9e..4dd784a 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.40-FA_a2 currently under development +HDF5 version 1.9.42-FA_a2 currently under development ================================================================================ @@ -167,6 +167,9 @@ Bug Fixes since HDF5-1.8.0 release Library ------- + - Fixed an issue with committed compound datatypes containing a vlen. + Also fixed memory leaks involving committed datatypes. + (NAF - 2009/06/10 - 1593) - Added versioning to H5Z_class_t struct to allow compatibility with 1.6 API. (NAF - 2009/04/20 - 1533) - Fixed a problem with using data transforms with non-native types in the @@ -299,6 +302,8 @@ Bug Fixes since HDF5-1.8.0 release Performance ------------- + - perf_serial test added to Windows projects and check batch file. + (ADB - 2009/06/11) Tools ----- @@ -346,7 +351,7 @@ Bug Fixes since HDF5-1.8.0 release - Lite: The h5ltget_dataset_info_f function (gets information about a dataset) was not correctly returning the dimension array. (PVN - 2009/3/23) - Lite: the h5ltread_dataset_string_f and h5ltget_attribute_string_f functions - had memory problems with the g95 fortran compiler. (PVN – 5/13/2009) 1522 + had memory problems with the g95 fortran compiler. (PVN � 5/13/2009) 1522 diff --git a/src/H5Dproxy.c b/src/H5Dproxy.c index 784f7e7..e888540 100644 --- a/src/H5Dproxy.c +++ b/src/H5Dproxy.c @@ -46,6 +46,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5Dpkg.h" /* Dataset functions */ #include "H5Eprivate.h" /* Error handling */ +#include "H5MFprivate.h" /* File memory management */ /****************/ @@ -329,8 +330,9 @@ H5D_chunk_proxy_create(H5D_t *dset, hid_t dxpl_id, H5D_chunk_common_ud_t *udata, HDassert(dset); HDassert(ent); - /* Get the chunk proxy address & adjust for next address */ - ent->proxy_addr = H5F_GET_NEXT_PROXY_ADDR(dset->oloc.file); + /* Get a temp. address for chunk proxy */ + if(HADDR_UNDEF == (ent->proxy_addr = H5MF_alloc_tmp(dset->oloc.file, (hsize_t)1))) + HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "file allocation failed for chunk proxy") #ifdef QAK HDfprintf(stderr, "%s: ent->proxy_addr = %a\n", FUNC, ent->proxy_addr); #endif /* QAK */ diff --git a/src/H5F.c b/src/H5F.c index 334a27e..88c079e 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -894,7 +894,6 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) f->shared->accum.loc = HADDR_UNDEF; f->shared->lf = lf; f->shared->root_addr = HADDR_UNDEF; - f->shared->next_proxy_addr = HADDR_MAX; /* * Copy the file creation and file access property lists into the @@ -950,6 +949,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) f->shared->maxaddr = H5FD_get_maxaddr(lf); if(!H5F_addr_defined(f->shared->maxaddr)) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad maximum address from VFD") + f->shared->tmp_addr = f->shared->maxaddr; if(H5FD_get_feature_flags(lf, &f->shared->feature_flags) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get feature flags from VFD") if(H5FD_get_fs_type_map(lf, f->shared->fs_type_map) < 0) diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 0ae09a6..193c576 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -147,8 +147,10 @@ typedef struct H5FD_stdio_t { #define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ HADDR_UNDEF==(A)+(Z) || (file_offset_t)((A)+(Z))<(file_offset_t)(A)) +#ifndef H5_HAVE_FSEEKO /* Define big file as 2GB */ #define BIG_FILE 0x80000000UL +#endif /* Prototypes */ static H5FD_t *H5FD_stdio_open(const char *name, unsigned flags, diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 05f6910..9529e0c 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -40,6 +40,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ #include "H5FDprivate.h" /* File drivers */ +#include "H5Vprivate.h" /* Vectors and arrays */ /****************/ @@ -49,12 +50,19 @@ /* Metadata accumulator controls */ #define H5F_ACCUM_THROTTLE 8 #define H5F_ACCUM_THRESHOLD 2048 +#define H5F_ACCUM_MAX_SIZE (1024 *1024) /* Max. accum. buf size (max. I/Os will be 1/2 this size) */ /******************/ /* Local Typedefs */ /******************/ +/* Enumerated type to indicate how data will be added to accumulator */ +typedef enum { + H5F_ACCUM_PREPEND, /* Data will be prepended to accumulator */ + H5F_ACCUM_APPEND /* Data will be appended to accumulator */ +} H5F_accum_adjust_t; + /********************/ /* Package Typedefs */ @@ -112,7 +120,8 @@ H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, HDassert(buf); /* Check if this information is in the metadata accumulator */ - if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && type != H5FD_MEM_DRAW) { + if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && type != H5FD_MEM_DRAW + && size < H5F_ACCUM_MAX_SIZE) { /* Current read overlaps with metadata accumulator */ if(H5F_addr_overlap(addr, size, f->shared->accum.loc, f->shared->accum.size)) { unsigned char *read_buf = (unsigned char *)buf; /* Pointer to the buffer being read in */ @@ -195,12 +204,17 @@ H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, /* Cache the new piece of metadata */ /* Check if we need to resize the buffer */ if(size > f->shared->accum.alloc_size) { + size_t new_size; /* New size of accumulator */ + + /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ + new_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(size - 1))); + /* Grow the metadata accumulator buffer */ - if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, size))) + if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") /* Note the new buffer size */ - f->shared->accum.alloc_size = size; + f->shared->accum.alloc_size = new_size; } /* end if */ else { /* Check if we should shrink the accumulator buffer */ @@ -246,6 +260,111 @@ done: /*------------------------------------------------------------------------- + * Function: H5F_accum_adjust + * + * Purpose: Adjust accumulator size, if necessary + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jun 11 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5F_accum_adjust(H5F_meta_accum_t *accum, H5FD_t *lf, hid_t dxpl_id, + H5F_accum_adjust_t adjust, size_t size) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5F_accum_adjust) + + HDassert(accum); + HDassert(lf); + HDassert(size > 0); + HDassert(size <= H5F_ACCUM_MAX_SIZE); + + /* Check if we need more buffer space */ + if((size + accum->size) > accum->alloc_size) { + size_t new_size; /* New size of accumulator */ + + /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ + new_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)((size + accum->size) - 1))); + + /* Check for accumulator getting too big */ + if(new_size > H5F_ACCUM_MAX_SIZE) { + size_t shrink_size; /* Amount to shrink accumulator by */ + size_t remnant_size; /* Amount left in accumulator */ + + /* Cap the accumulator's growth, leaving some room */ + + /* Determine the amounts to work with */ + if(size > (H5F_ACCUM_MAX_SIZE / 2)) { + new_size = H5F_ACCUM_MAX_SIZE; + shrink_size = accum->size; + remnant_size = 0; + } /* end if */ + else { + new_size = (H5F_ACCUM_MAX_SIZE / 2); + shrink_size = (H5F_ACCUM_MAX_SIZE / 2); + remnant_size = accum->size - shrink_size; + } /* end else */ + + /* Check if we need to flush accumulator data to file */ + if(accum->dirty) { + /* Check whether to accumulator will be prepended or appended */ + if(H5F_ACCUM_PREPEND == adjust) { + /* Write out upper part of the existing metadata accumulator, with dispatch to driver */ + if(H5FD_write(lf, dxpl_id, H5FD_MEM_DEFAULT, (accum->loc + remnant_size), shrink_size, (accum->buf + remnant_size)) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + } /* end if */ + else { + /* Sanity check */ + HDassert(H5F_ACCUM_APPEND == adjust); + + /* Write out lower part of the existing metadata accumulator, with dispatch to driver */ + if(H5FD_write(lf, dxpl_id, H5FD_MEM_DEFAULT, accum->loc, shrink_size, accum->buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + + /* Move remnant of accumulator down */ + HDmemmove(accum->buf, (accum->buf + shrink_size), remnant_size); + + /* Adjust accumulator's location */ + accum->loc += shrink_size; + } /* end else */ + + /* Reset accumulator dirty flag (in case of error) */ + accum->dirty = FALSE; + } /* end if */ + + /* Trim the accumulator's use of its buffer */ + accum->size = remnant_size; + } /* end if */ + + /* Check for accumulator needing to be reallocated */ + if(new_size > accum->alloc_size) { + unsigned char *new_buf; /* New buffer to hold the accumulated metadata */ + + /* Reallocate the metadata accumulator buffer */ + if(NULL == (new_buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, new_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") + + /* Update accumulator info */ + accum->buf = new_buf; + accum->alloc_size = new_size; +#ifdef H5_CLEAR_MEMORY +HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - (accum->size + size))); +#endif /* H5_CLEAR_MEMORY */ + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_accum_adjust() */ + + +/*------------------------------------------------------------------------- * Function: H5F_accum_write * * Purpose: Attempts to read some data from the metadata accumulator for @@ -273,23 +392,15 @@ H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, HDassert(buf); /* Check for accumulating metadata */ - if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && type != H5FD_MEM_DRAW) { + if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && type != H5FD_MEM_DRAW + && size < H5F_ACCUM_MAX_SIZE) { /* Check if there is already metadata in the accumulator */ if(f->shared->accum.size > 0) { /* Check if the new metadata adjoins the beginning of the current accumulator */ if((addr + size) == f->shared->accum.loc) { - /* Check if we need more buffer space */ - if((size + f->shared->accum.size) > f->shared->accum.alloc_size) { - /* Adjust the buffer size, by doubling it */ - f->shared->accum.alloc_size = MAX(f->shared->accum.alloc_size * 2, size + f->shared->accum.size); - - /* Reallocate the metadata accumulator buffer */ - if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, f->shared->accum.alloc_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") -#ifdef H5_CLEAR_MEMORY -HDmemset(f->shared->accum.buf + f->shared->accum.size, 0, (f->shared->accum.alloc_size - (f->shared->accum.size + size))); -#endif /* H5_CLEAR_MEMORY */ - } /* end if */ + /* Check if we need to adjust accumulator size */ + if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_PREPEND, size) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") /* Move the existing metadata to the proper location */ HDmemmove(f->shared->accum.buf + size, f->shared->accum.buf, f->shared->accum.size); @@ -306,18 +417,9 @@ HDmemset(f->shared->accum.buf + f->shared->accum.size, 0, (f->shared->accum.allo } /* end if */ /* Check if the new metadata adjoins the end of the current accumulator */ else if(addr == (f->shared->accum.loc + f->shared->accum.size)) { - /* Check if we need more buffer space */ - if((size + f->shared->accum.size) > f->shared->accum.alloc_size) { - /* Adjust the buffer size, by doubling it */ - f->shared->accum.alloc_size = MAX(f->shared->accum.alloc_size * 2, size + f->shared->accum.size); - - /* Reallocate the metadata accumulator buffer */ - if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, f->shared->accum.alloc_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") -#ifdef H5_CLEAR_MEMORY -HDmemset(f->shared->accum.buf + f->shared->accum.size + size, 0, (f->shared->accum.alloc_size - (f->shared->accum.size + size))); -#endif /* H5_CLEAR_MEMORY */ - } /* end if */ + /* Check if we need to adjust accumulator size */ + if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_APPEND, size) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") /* Copy the new metadata to the end */ HDmemcpy(f->shared->accum.buf + f->shared->accum.size, buf, size); @@ -330,7 +432,7 @@ HDmemset(f->shared->accum.buf + f->shared->accum.size + size, 0, (f->shared->acc } /* end if */ /* Check if the piece of metadata being written overlaps the metadata accumulator */ else if(H5F_addr_overlap(addr, size, f->shared->accum.loc, f->shared->accum.size)) { - size_t new_size; /* New size of the accumulator buffer */ + size_t add_size; /* New size of the accumulator buffer */ /* Check if the new metadata is entirely within the current accumulator */ if(addr >= f->shared->accum.loc && (addr + size) <= (f->shared->accum.loc + f->shared->accum.size)) { @@ -344,21 +446,12 @@ HDmemset(f->shared->accum.buf + f->shared->accum.size + size, 0, (f->shared->acc else if(addr < f->shared->accum.loc && (addr + size) <= (f->shared->accum.loc + f->shared->accum.size)) { size_t old_offset; /* Offset of old data within the accumulator buffer */ - /* Calculate the new accumulator size, based on the amount of overlap */ - H5_ASSIGN_OVERFLOW(new_size, (f->shared->accum.loc - addr) + f->shared->accum.size, hsize_t, size_t); + /* Calculate the amount we will need to add to the accumulator size, based on the amount of overlap */ + H5_ASSIGN_OVERFLOW(add_size, (f->shared->accum.loc - addr), hsize_t, size_t); - /* Check if we need more buffer space */ - if(new_size > f->shared->accum.alloc_size) { - /* Adjust the buffer size, by doubling it */ - f->shared->accum.alloc_size = MAX(f->shared->accum.alloc_size + 2, new_size); - - /* Reallocate the metadata accumulator buffer */ - if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, f->shared->accum.alloc_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") -#ifdef H5_CLEAR_MEMORY -HDmemset(f->shared->accum.buf + f->shared->accum.size, 0, (f->shared->accum.alloc_size - f->shared->accum.size)); -#endif /* H5_CLEAR_MEMORY */ - } /* end if */ + /* Check if we need to adjust accumulator size */ + if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_PREPEND, add_size) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") /* Calculate the proper offset of the existing metadata */ H5_ASSIGN_OVERFLOW(old_offset, (addr + size) - f->shared->accum.loc, hsize_t, size_t); @@ -371,34 +464,25 @@ HDmemset(f->shared->accum.buf + f->shared->accum.size, 0, (f->shared->accum.allo /* Set the new size & location of the metadata accumulator */ f->shared->accum.loc = addr; - f->shared->accum.size = new_size; + f->shared->accum.size += add_size; /* Mark it as written to */ f->shared->accum.dirty = TRUE; } /* end if */ /* Check if the new metadata overlaps the end of the current accumulator */ else if(addr >= f->shared->accum.loc && (addr + size) > (f->shared->accum.loc + f->shared->accum.size)) { - /* Calculate the new accumulator size, based on the amount of overlap */ - H5_ASSIGN_OVERFLOW(new_size, (addr - f->shared->accum.loc) + size, hsize_t, size_t); - - /* Check if we need more buffer space */ - if(new_size > f->shared->accum.alloc_size) { - /* Adjust the buffer size, by doubling it */ - f->shared->accum.alloc_size = MAX(f->shared->accum.alloc_size * 2, new_size); + /* Calculate the amount we will need to add to the accumulator size, based on the amount of overlap */ + H5_ASSIGN_OVERFLOW(add_size, (addr + size) - (f->shared->accum.loc + f->shared->accum.size), hsize_t, size_t); - /* Reallocate the metadata accumulator buffer */ - if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, f->shared->accum.alloc_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") -#ifdef H5_CLEAR_MEMORY -HDmemset(f->shared->accum.buf + f->shared->accum.size, 0, (f->shared->accum.alloc_size - f->shared->accum.size)); -#endif /* H5_CLEAR_MEMORY */ - } /* end if */ + /* Check if we need to adjust accumulator size */ + if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_APPEND, add_size) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") /* Copy the new metadata to the end */ HDmemcpy(f->shared->accum.buf + (addr - f->shared->accum.loc), buf, size); - /* Set the new size & location of the metadata accumulator */ - f->shared->accum.size = new_size; + /* Set the new size of the metadata accumulator */ + f->shared->accum.size += add_size; /* Mark it as written to */ f->shared->accum.dirty = TRUE; @@ -421,12 +505,17 @@ HDmemset(f->shared->accum.buf + f->shared->accum.size, 0, (f->shared->accum.allo /* Cache the new piece of metadata */ /* Check if we need to resize the buffer */ if(size > f->shared->accum.alloc_size) { + size_t new_size; /* New size of accumulator */ + + /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ + new_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(size - 1))); + /* Grow the metadata accumulator buffer */ - if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, size))) + if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") /* Note the new buffer size */ - f->shared->accum.alloc_size = size; + f->shared->accum.alloc_size = new_size; #ifdef H5_CLEAR_MEMORY { size_t clear_size = MAX(f->shared->accum.size, size); @@ -462,12 +551,17 @@ HDmemset(f->shared->accum.buf + clear_size, 0, (f->shared->accum.alloc_size - cl else { /* Check if we need to reallocate the buffer */ if(size > f->shared->accum.alloc_size) { + size_t new_size; /* New size of accumulator */ + + /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ + new_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(size - 1))); + /* Reallocate the metadata accumulator buffer */ - if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, size))) + if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") /* Note the new buffer size */ - f->shared->accum.alloc_size = size; + f->shared->accum.alloc_size = new_size; } /* end if */ /* Update the metadata accumulator information */ diff --git a/src/H5Fio.c b/src/H5Fio.c index 1081a27..407f950 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -104,6 +104,10 @@ H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, HDassert(f->shared); HDassert(buf); + /* Check for attempting I/O on 'temporary' file address */ + if(H5F_addr_le(f->shared->tmp_addr, (addr + size))) + HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + /* Check if this I/O can be satisfied by the metadata accumulator */ if((accumulated = H5F_accum_read(f, dxpl_id, type, addr, size, buf)) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read from metadata accumulator failed") @@ -150,6 +154,10 @@ HDfprintf(stderr, "%s: write to addr = %a, size = %Zu\n", FUNC, addr, size); HDassert(f->intent & H5F_ACC_RDWR); HDassert(buf); + /* Check for attempting I/O on 'temporary' file address */ + if(H5F_addr_le(f->shared->tmp_addr, (addr + size))) + HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + /* Check for accumulating metadata */ if((accumulated = H5F_accum_write(f, dxpl_id, type, addr, size, buf)) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write to metadata accumulator failed") diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index f6809e8..15fd91e 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -162,7 +162,7 @@ typedef struct H5F_file_t { haddr_t root_addr; /* Root group address */ H5FO_t *open_objs; /* Open objects in file */ H5RC_t *grp_btree_shared; /* Ref-counted group B-tree node info */ - haddr_t next_proxy_addr; /* Next address to use for metadata cache proxy entries */ + haddr_t tmp_addr; /* Next address to use for temp. space in the file */ /* File space allocation information */ unsigned fs_aggr_merge[H5FD_MEM_NTYPES]; /* Flags for whether free space can merge with aggregator(s) */ @@ -250,6 +250,7 @@ H5_DLL herr_t H5F_sfile_remove(H5F_file_t *shared); H5_DLL herr_t H5F_get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t *mesg_count); H5_DLL herr_t H5F_check_cached_stab_test(hid_t file_id); +H5_DLL herr_t H5F_get_maxaddr_test(hid_t file_id, haddr_t *maxaddr); #endif /* H5F_TESTING */ #endif /* _H5Fpkg_H */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 59bdd10..9f7f057 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -265,7 +265,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; #define H5F_HAS_FEATURE(F,FL) ((F)->shared->lf->feature_flags & (FL)) #define H5F_DRIVER_ID(F) ((F)->shared->lf->driver_id) #define H5F_GET_FILENO(F,FILENUM) ((FILENUM) = (F)->shared->lf->fileno) -#define H5F_GET_NEXT_PROXY_ADDR(F) ((F)->shared->next_proxy_addr--) +#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->tmp_addr, (ADDR))) #else /* H5F_PACKAGE */ #define H5F_INTENT(F) (H5F_get_intent(F)) #define H5F_FCPL(F) (H5F_get_fcpl(F)) @@ -288,7 +288,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; #define H5F_HAS_FEATURE(F,FL) (H5F_has_feature(F,FL)) #define H5F_DRIVER_ID(F) (H5F_get_driver_id(F)) #define H5F_GET_FILENO(F,FILENUM) (H5F_get_fileno((F), &(FILENUM))) -#define H5F_GET_NEXT_PROXY_ADDR(F) (H5F_get_next_proxy_addr(F)) +#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_is_tmp_addr((F), (ADDR))) #endif /* H5F_PACKAGE */ @@ -492,6 +492,7 @@ H5_DLL unsigned H5F_gc_ref(const H5F_t *f); H5_DLL hbool_t H5F_use_latest_format(const H5F_t *f); H5_DLL H5F_close_degree_t H5F_get_fc_degree(const H5F_t *f); H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f); +H5_DLL hbool_t H5F_is_tmp_addr(const H5F_t *f, haddr_t addr); /* Functions that retrieve values from VFD layer */ H5_DLL hbool_t H5F_has_feature(const H5F_t *f, unsigned feature); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index d070b94..5538d60 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -689,30 +689,30 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_get_next_proxy_addr + * Function: H5F_is_tmp_addr * - * Purpose: Quick and dirty routine to retrieve the next metadata proxy - * address for a file. + * Purpose: Quick and dirty routine to determine if an address is in + * the 'temporary' file space. * (Mainly added to stop non-file routines from poking about in the * H5F_t data structure) * - * Return: Success: Address to use for metadata cache proxy - * Failure: abort (should not happen) + * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) * * Programmer: Quincey Koziol - * May 19, 2009 + * June 11, 2009 * *------------------------------------------------------------------------- */ -haddr_t -H5F_get_next_proxy_addr(const H5F_t *f) +hbool_t +H5F_is_tmp_addr(const H5F_t *f, haddr_t addr) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_next_proxy_addr) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_is_tmp_addr) HDassert(f); HDassert(f->shared); + HDassert(f->shared->lf); - FUNC_LEAVE_NOAPI(f->shared->next_proxy_addr--) -} /* end H5F_get_next_proxy_addr() */ + FUNC_LEAVE_NOAPI(H5F_addr_le(f->shared->tmp_addr, addr)) +} /* end H5F_is_tmp_addr() */ diff --git a/src/H5Ftest.c b/src/H5Ftest.c index 8cbc133..72fee96 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -153,3 +153,36 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_check_cached_stab_test() */ + +/*------------------------------------------------------------------------- + * Function: H5F_get_maxaddr_test + * + * Purpose: Retrieve the maximum address for a file + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Jun 10, 2009 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_get_maxaddr_test(hid_t file_id, haddr_t *maxaddr) +{ + H5F_t *file; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5F_get_maxaddr_test) + + /* Check arguments */ + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + + /* Retrieve maxaddr for file */ + *maxaddr = file->shared->maxaddr; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_get_maxaddr_test() */ + diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 0fcca97..6d250d1 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -361,7 +361,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr); H5O_pline_t *pline; /* Pipeline information from the header on disk */ /* Compute the offset of the filter info in the header */ - filter_info_off = p - buf; + filter_info_off = (size_t)(p - buf); /* Compute the size of the extra filter information */ filter_info_size = hdr->sizeof_size /* Size of size for filtered root direct block */ @@ -1056,6 +1056,57 @@ HDfprintf(stderr, "%s: iblock->filt_ents[%Zu] = {%Zu, %x}\n", FUNC, u, iblock->f HDassert(max_child == iblock->max_child); #endif /* NDEBUG */ + /* Check for needing to re-allocate indirect block from 'temp.' to 'normal' file space */ + if(H5F_IS_TMP_ADDR(f, addr)) { +#ifdef QAK +HDfprintf(stderr, "%s: Re-allocating indirect block in temporary space - addr = %a\n", FUNC, addr); +#endif /* QAK */ + /* Sanity check */ + HDassert(H5F_addr_eq(iblock->addr, addr)); + + /* Allocate 'normal' space for the new indirect block on disk */ + if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size))) + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") + + /* Sanity check */ + HDassert(!H5F_addr_eq(iblock->addr, addr)); + + /* Let the metadata cache know the block moved */ + if(H5AC_rename(f, H5AC_FHEAP_IBLOCK, iblock->addr, addr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRENAME, FAIL, "unable to move indirect block") + + /* Update the internal address for the block */ + iblock->addr = addr; + + /* Check for root indirect block */ + if(NULL == iblock->parent) { + /* Update information about indirect block's location */ + hdr->man_dtable.table_addr = addr; + + /* Mark that heap header was modified */ + if(H5HF_hdr_dirty(hdr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + } /* end if */ + else { + H5HF_indirect_t *par_iblock; /* Parent indirect block */ + unsigned par_entry; /* Entry in parent indirect block */ + + /* Get parent information */ + par_iblock = iblock->parent; + par_entry = iblock->par_entry; + + /* Update information about indirect block's location */ + par_iblock->ents[par_entry].addr = addr; + + /* Mark that parent was modified */ + if(H5HF_iblock_dirty(par_iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + } /* end if */ + } /* end if */ + + /* Indirect block must be in 'normal' file space now */ + HDassert(!H5F_IS_TMP_ADDR(f, addr)); + /* Write the indirect block */ if(H5F_block_write(f, H5FD_MEM_FHEAP_IBLOCK, addr, iblock->size, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFLUSH, FAIL, "unable to save fractal heap indirect block to disk") @@ -1112,10 +1163,14 @@ HDfprintf(stderr, "%s: Destroying indirect block\n", FUNC); /* Check for freeing file space for indirect block */ if(iblock->cache_info.free_file_space_on_destroy) { - /* Release the space on disk */ - /* (XXX: Nasty usage of internal DXPL value! -QAK) */ - if(H5MF_xfree(f, H5FD_MEM_FHEAP_IBLOCK, H5AC_dxpl_id, iblock->cache_info.addr, (hsize_t)iblock->size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block") + /* Check if the indirect block is NOT currently allocated in temp. file space */ + /* (temp. file space does not need to be freed) */ + if(!H5F_IS_TMP_ADDR(f, iblock->cache_info.addr)) { + /* Release the space on disk */ + /* (XXX: Nasty usage of internal DXPL value! -QAK) */ + if(H5MF_xfree(f, H5FD_MEM_FHEAP_IBLOCK, H5AC_dxpl_id, iblock->cache_info.addr, (hsize_t)iblock->size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block") + } /* end if */ } /* end if */ /* Set the shared heap header's file context for this operation */ @@ -1130,11 +1185,11 @@ HDfprintf(stderr, "%s: Destroying indirect block\n", FUNC); /* Release entry tables */ if(iblock->ents) - H5FL_SEQ_FREE(H5HF_indirect_ent_t, iblock->ents); + (void)H5FL_SEQ_FREE(H5HF_indirect_ent_t, iblock->ents); if(iblock->filt_ents) - H5FL_SEQ_FREE(H5HF_indirect_filt_ent_t, iblock->filt_ents); + (void)H5FL_SEQ_FREE(H5HF_indirect_filt_ent_t, iblock->filt_ents); if(iblock->child_iblocks) - H5FL_SEQ_FREE(H5HF_indirect_ptr_t, iblock->child_iblocks); + (void)H5FL_SEQ_FREE(H5HF_indirect_ptr_t, iblock->child_iblocks); /* Free fractal heap indirect block info */ (void)H5FL_FREE(H5HF_indirect_t, iblock); @@ -1436,6 +1491,7 @@ H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, if(dblock->cache_info.is_dirty) { H5HF_hdr_t *hdr; /* Shared fractal heap information */ + hbool_t at_tmp_addr = H5F_IS_TMP_ADDR(f, addr); /* Flag to indicate direct block is at temporary address */ void *write_buf; /* Pointer to buffer to write out */ size_t write_size; /* Size of buffer to write out */ uint8_t *p; /* Pointer into raw data buffer */ @@ -1525,13 +1581,17 @@ HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr- } /* end if */ /* Check if we need to re-size the block on disk */ - if(hdr->pline_root_direct_size != write_size) { + if(hdr->pline_root_direct_size != write_size || at_tmp_addr) { #ifdef QAK HDfprintf(stderr, "%s: Need to re-allocate root direct block!\n", FUNC); #endif /* QAK */ - /* Release direct block's current disk space */ - if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, (hsize_t)hdr->pline_root_direct_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") + /* Check if the direct block is NOT currently allocated in temp. file space */ + /* (temp. file space does not need to be freed) */ + if(!at_tmp_addr) { + /* Release direct block's current disk space */ + if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, (hsize_t)hdr->pline_root_direct_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") + } /* end if */ /* Allocate space for the compressed direct block */ if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size))) @@ -1579,13 +1639,17 @@ HDfprintf(stderr, "%s: par_iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_e } /* end if */ /* Check if we need to re-size the block on disk */ - if(par_iblock->filt_ents[par_entry].size != write_size) { + if(par_iblock->filt_ents[par_entry].size != write_size || at_tmp_addr) { #ifdef QAK HDfprintf(stderr, "%s: Need to re-allocate non-root direct block!\n", FUNC); #endif /* QAK */ - /* Release direct block's current disk space */ - if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, (hsize_t)par_iblock->filt_ents[par_entry].size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") + /* Check if the direct block is NOT currently allocated in temp. file space */ + /* (temp. file space does not need to be freed) */ + if(!at_tmp_addr) { + /* Release direct block's current disk space */ + if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, (hsize_t)par_iblock->filt_ents[par_entry].size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") + } /* end if */ /* Allocate space for the compressed direct block */ if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size))) @@ -1613,8 +1677,70 @@ HDfprintf(stderr, "%s: Need to re-allocate non-root direct block!\n", FUNC); else { write_buf = dblock->blk; write_size = dblock->size; + + /* Check for needing to re-allocate direct block from 'temp.' to 'normal' file space */ + if(at_tmp_addr) { +#ifdef QAK +HDfprintf(stderr, "%s: Re-allocating direct block in temporary space - addr = %a, write_size = %Zu\n", FUNC, addr, write_size); +#endif /* QAK */ + /* Check for root direct block */ + if(NULL == dblock->parent) { + /* Sanity check */ + HDassert(H5F_addr_eq(hdr->man_dtable.table_addr, addr)); + + /* Allocate 'normal' space for the direct block */ + if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size))) + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") + + /* Sanity check */ + HDassert(!H5F_addr_eq(hdr->man_dtable.table_addr, addr)); + + /* Let the metadata cache know the block moved */ + if(H5AC_rename(f, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, addr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRENAME, FAIL, "unable to move direct block") + + /* Update information about direct block's location */ + hdr->man_dtable.table_addr = addr; + + /* Mark that heap header was modified */ + if(H5HF_hdr_dirty(hdr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + } /* end if */ + else { + H5HF_indirect_t *par_iblock; /* Parent indirect block */ + unsigned par_entry; /* Entry in parent indirect block */ + + /* Get parent information */ + par_iblock = dblock->parent; + par_entry = dblock->par_entry; + + /* Sanity check */ + HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, addr)); + + /* Allocate 'normal' space for the direct block */ + if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size))) + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") + + /* Sanity check */ + HDassert(!H5F_addr_eq(par_iblock->ents[par_entry].addr, addr)); + + /* Let the metadata cache know the block moved */ + if(H5AC_rename(f, H5AC_FHEAP_DBLOCK, par_iblock->ents[par_entry].addr, addr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRENAME, FAIL, "unable to move direct block") + + /* Update information about direct block's location */ + par_iblock->ents[par_entry].addr = addr; + + /* Mark that parent was modified */ + if(H5HF_iblock_dirty(par_iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + } /* end else */ + } /* end if */ } /* end else */ + /* Direct block must be in 'normal' file space now */ + HDassert(!H5F_IS_TMP_ADDR(f, addr)); + /* Write the direct block */ #ifdef QAK HDfprintf(stderr, "%s: addr = %a, write_size = %Zu\n", FUNC, addr, write_size); @@ -1674,10 +1800,14 @@ HDfprintf(stderr, "%s: Destroying direct block, dblock = %p\n", FUNC, dblock); /* Sanity check */ HDassert(dblock->file_size > 0); - /* Release the space on disk */ - /* (XXX: Nasty usage of internal DXPL value! -QAK) */ - if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, H5AC_dxpl_id, dblock->cache_info.addr, dblock->file_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") + /* Check if the direct block is NOT currently allocated in temp. file space */ + /* (temp. file space does not need to be freed) */ + if(!H5F_IS_TMP_ADDR(f, dblock->cache_info.addr)) { + /* Release the space on disk */ + /* (XXX: Nasty usage of internal DXPL value! -QAK) */ + if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, H5AC_dxpl_id, dblock->cache_info.addr, dblock->file_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") + } /* end if */ } /* end if */ /* Set the shared heap header's file context for this operation */ diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index c14249c..7e68533 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -148,8 +148,8 @@ H5HF_man_dblock_create(hid_t dxpl_id, H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblo HDmemset(dblock->blk, 0, dblock->size); #endif /* H5_CLEAR_MEMORY */ - /* Allocate space for the direct block on disk */ - if(HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)dblock->size))) + /* Allocate [temporary] space for the direct block on disk */ + if(HADDR_UNDEF == (dblock_addr = H5MF_alloc_tmp(hdr->f, (hsize_t)dblock->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") #ifdef QAK HDfprintf(stderr, "%s: direct block address = %a\n", FUNC, dblock_addr); @@ -695,22 +695,26 @@ HDfprintf(stderr, "%s: Done expunging direct block from cache\n", FUNC); #endif /* QAK */ } /* end if */ - /* Release direct block's disk space */ - /* (XXX: Under the best of circumstances, this block's space in the file - * would be freed in the H5AC_expunge_entry() call above (and the - * H5AC__FREE_FILE_SPACE_FLAG used there), but since the direct - * block structure might have a different size on disk than in - * the heap's 'abstract' address space, we would need to set the - * "file_size" field for the direct block structure. In order to - * do that, we'd have to protect/unprotect the direct block and - * that would add a bunch of unnecessary overhead to the process, - * so we just release the file space here, directly. When the - * revised metadata cache is operating, it will "know" the file - * size of each entry in the cache and we can the the - * H5AC_expunge_entry() method. -QAK) - */ - if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, dblock_addr, dblock_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") + /* Check if the direct block is NOT currently allocated in temp. file space */ + /* (temp. file space does not need to be freed) */ + if(!H5F_IS_TMP_ADDR(f, dblock_addr)) { + /* Release direct block's disk space */ + /* (XXX: Under the best of circumstances, this block's space in the file + * would be freed in the H5AC_expunge_entry() call above (and the + * H5AC__FREE_FILE_SPACE_FLAG used there), but since the direct + * block structure might have a different size on disk than in + * the heap's 'abstract' address space, we would need to set the + * "file_size" field for the direct block structure. In order to + * do that, we'd have to protect/unprotect the direct block and + * that would add a bunch of unnecessary overhead to the process, + * so we just release the file space here, directly. When the + * revised metadata cache is operating, it will "know" the file + * size of each entry in the cache and we can the the + * H5AC_expunge_entry() method. -QAK) + */ + if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, dblock_addr, dblock_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 8f9eb24..3383ef9 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -578,6 +578,9 @@ HDfprintf(stderr, "%s: iblock->nrows = %u, iblock->max_rows = %u\n", FUNC, ibloc HDfprintf(stderr, "%s: new_next_entry = %u\n", FUNC, new_next_entry); #endif /* QAK */ + /* Check if the indirect block is NOT currently allocated in temp. file space */ + /* (temp. file space does not need to be freed) */ + if(!H5F_IS_TMP_ADDR(hdr->f, iblock->addr)) { /* Currently, the old block data is "thrown away" after the space is reallocated, * to avoid data copy in H5MF_realloc() call by just free'ing the space and * allocating new space. @@ -587,16 +590,17 @@ HDfprintf(stderr, "%s: new_next_entry = %u\n", FUNC, new_next_entry); * * QAK - 3/14/2006 */ - /* Free previous indirect block disk space */ - if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, iblock->addr, (hsize_t)iblock->size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space") + /* Free previous indirect block disk space */ + if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, iblock->addr, (hsize_t)iblock->size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space") + } /* end if */ /* Compute size of buffer needed for new indirect block */ iblock->nrows = new_nrows; iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock); - /* Allocate space for the new indirect block on disk */ - if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size))) + /* Allocate [temporary] space for the new indirect block on disk */ + if(HADDR_UNDEF == (new_addr = H5MF_alloc_tmp(hdr->f, (hsize_t)iblock->size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") #ifdef QAK HDfprintf(stderr, "%s: Check 1.0 - iblock->addr = %a, new_addr = %a\n", FUNC, iblock->addr, new_addr); @@ -739,6 +743,9 @@ HDfprintf(stderr, "%s: new_nrows = %u\n", FUNC, new_nrows); HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); #endif /* QAK */ + /* Check if the indirect block is NOT currently allocated in temp. file space */ + /* (temp. file space does not need to be freed) */ + if(!H5F_IS_TMP_ADDR(hdr->f, iblock->addr)) { /* Currently, the old block data is "thrown away" after the space is reallocated, * to avoid data copy in H5MF_realloc() call by just free'ing the space and * allocating new space. @@ -748,9 +755,10 @@ HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); * * QAK - 6/12/2006 */ - /* Free previous indirect block disk space */ - if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, iblock->addr, (hsize_t)iblock->size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space") + /* Free previous indirect block disk space */ + if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, iblock->addr, (hsize_t)iblock->size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space") + } /* end if */ /* Compute free space in rows to delete */ acc_dblock_free = 0; @@ -762,8 +770,8 @@ HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); iblock->nrows = new_nrows; iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock); - /* Allocate space for the new indirect block on disk */ - if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size))) + /* Allocate [temporary] space for the new indirect block on disk */ + if(HADDR_UNDEF == (new_addr = H5MF_alloc_tmp(hdr->f, (hsize_t)iblock->size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") #ifdef QAK HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr); @@ -1078,8 +1086,8 @@ HDfprintf(stderr, "%s: dir_rows = %u\n", FUNC, dir_rows); else iblock->child_iblocks = NULL; - /* Allocate space for the indirect block on disk */ - if(HADDR_UNDEF == (*addr_p = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size))) + /* Allocate [temporary] space for the indirect block on disk */ + if(HADDR_UNDEF == (*addr_p = H5MF_alloc_tmp(hdr->f, (hsize_t)iblock->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") iblock->addr = *addr_p; diff --git a/src/H5MF.c b/src/H5MF.c index 3fc7af0..2cf52b0 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -302,6 +302,8 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ /* check arguments */ HDassert(f); + HDassert(f->shared); + HDassert(f->shared->lf); HDassert(size > 0); /* Get free space type from allocation type */ @@ -374,14 +376,17 @@ HDfprintf(stderr, "%s: Check 2.0\n", FUNC); if(alloc_type != H5FD_MEM_DRAW) { /* Handle metadata differently from "raw" data */ if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->meta_aggr), &(f->shared->sdata_aggr), alloc_type, size))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate metadata") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate metadata") } /* end if */ else { /* Allocate "raw" data */ if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->sdata_aggr), &(f->shared->meta_aggr), alloc_type, size))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate raw data") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate raw data") } /* end else */ + /* Sanity check for overlapping into file's temporary allocation space */ + HDassert(H5F_addr_le((ret_value + size), f->shared->tmp_addr)); + done: #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size); @@ -394,6 +399,66 @@ H5MF_sects_dump(f, dxpl_id, stderr); /*------------------------------------------------------------------------- + * Function: H5MF_alloc_tmp + * + * Purpose: Allocate temporary space in the file + * + * Note: The address returned is non-overlapping with any other address + * in the file and suitable for insertion into the metadata + * cache. + * + * The address is _not_ suitable for actual file I/O and will + * cause an error if it is so used. + * + * The space allocated with this routine should _not_ be freed, + * it should just be abandoned. Calling H5MF_xfree() with space + * from this routine will cause an error. + * + * Return: Success: Temporary file address + * Failure: HADDR_UNDEF + * + * Programmer: Quincey Koziol + * Thursday, June 4, 2009 + * + *------------------------------------------------------------------------- + */ +haddr_t +H5MF_alloc_tmp(H5F_t *f, hsize_t size) +{ + haddr_t eoa; /* End of allocated space in the file */ + haddr_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5MF_alloc_tmp, HADDR_UNDEF) +#ifdef H5MF_ALLOC_DEBUG +HDfprintf(stderr, "%s: size = %Hu\n", FUNC, size); +#endif /* H5MF_ALLOC_DEBUG */ + + /* check args */ + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->lf); + HDassert(size > 0); + + /* Retrieve the 'eoa' for the file */ + if(HADDR_UNDEF == (eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "driver get_eoa request failed") + + /* Compute value to return */ + ret_value = f->shared->tmp_addr - size; + + /* Check for overlap into the actual allocated space in the file */ + if(H5F_addr_le(ret_value, eoa)) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "driver get_eoa request failed") + + /* Adjust temporary address allocator in the file */ + f->shared->tmp_addr = ret_value; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5MF_alloc_tmp() */ + + +/*------------------------------------------------------------------------- * Function: H5MF_xfree * * Purpose: Frees part of a file, making that part of the file @@ -427,6 +492,10 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN HGOTO_DONE(SUCCEED); HDassert(addr != 0); /* Can't deallocate the superblock :-) */ + /* Check for attempting to free space that's a 'temporary' file address */ + if(H5F_addr_le(f->shared->tmp_addr, addr)) + HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, "attempting to free temporary file space") + /* Check if the space to free intersects with the file's metadata accumulator */ if(H5F_accum_free(f, dxpl_id, alloc_type, addr, size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't check free space intersection w/metadata accumulator") @@ -701,6 +770,8 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN /* check arguments */ HDassert(f); + HDassert(f->shared); + HDassert(f->shared->lf); HDassert(H5F_addr_defined(addr)); HDassert(size > 0); diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index f383e23..0f8a374 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -119,6 +119,9 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size); HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); HDassert(size > 0); + if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "Unable to get eoa") + /* * If the aggregation feature is enabled for this file, allocate "generic" * space and sub-allocate out of that, if possible. Otherwise just allocate @@ -138,9 +141,6 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz frag_size = alignment - mis_align; } - if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, type))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "Unable to get eoa") - alloc_type = aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW; other_alloc_type = other_aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW; @@ -149,9 +149,12 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz /* Check if the block asked for is too large for 'normal' aggregator block */ if(size >= aggr->alloc_size) { - hsize_t ext_size = size + frag_size; + /* Check for overlapping into file's temporary allocation space */ + if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr)) + HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space") + if ((aggr->addr > 0) && (extended=H5FD_try_extend(f->shared->lf, alloc_type, aggr->addr + aggr->size, ext_size)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") else if (extended) { @@ -160,6 +163,10 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz aggr->addr += ext_size; aggr->tot_size += ext_size; } else { + /* Check for overlapping into file's temporary allocation space */ + if(H5F_addr_gt((eoa + size), f->shared->tmp_addr)) + HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space") + if ((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { @@ -189,6 +196,10 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); if (frag_size > (ext_size - size)) ext_size += (frag_size - (ext_size - size)); + /* Check for overlapping into file's temporary allocation space */ + if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr)) + HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space") + if ((aggr->addr > 0) && (extended = H5FD_try_extend(f->shared->lf, alloc_type, aggr->addr + aggr->size, ext_size)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") else if (extended) { @@ -196,6 +207,10 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); aggr->size += (ext_size - frag_size); aggr->tot_size += ext_size; } else { + /* Check for overlapping into file's temporary allocation space */ + if(H5F_addr_gt((eoa + aggr->alloc_size), f->shared->tmp_addr)) + HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space") + if ((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { @@ -250,6 +265,10 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); } } /* end if */ else { + /* Check for overlapping into file's temporary allocation space */ + if(H5F_addr_gt((eoa + size), f->shared->tmp_addr)) + HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space") + /* Allocate data from the file */ if(HADDR_UNDEF == (ret_value = H5FD_alloc(f->shared->lf, dxpl_id, type, size, &eoa_frag_addr, &eoa_frag_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") @@ -258,6 +277,9 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") } /* end else */ + /* Sanity check for overlapping into file's temporary allocation space */ + HDassert(H5F_addr_le((ret_value + size), f->shared->tmp_addr)); + done: #ifdef H5MF_AGGR_DEBUG HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value); diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index 0d1da8a..4508199 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -72,6 +72,9 @@ H5_DLL herr_t H5MF_try_extend(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, H5_DLL htri_t H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr, hsize_t size); +/* File 'temporary' space allocation routines */ +H5_DLL haddr_t H5MF_alloc_tmp(H5F_t *f, hsize_t size); + /* 'block aggregator' routines */ H5_DLL herr_t H5MF_aggr_reset(H5F_t *file, hid_t dxpl_id, H5F_blk_aggr_t *aggr); diff --git a/src/H5T.c b/src/H5T.c index 0345e5f..200d5c1 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -3161,118 +3161,122 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method) break; } /* end switch */ - /* Copy parent information, if we aren't sharing an already opened committed datatype */ - if(NULL == reopened_fo && old_dt->shared->parent) - new_dt->shared->parent = H5T_copy(old_dt->shared->parent, method); + /* Update fields in the new struct, if we aren't sharing an already opened + * committed datatype */ + if(!reopened_fo) { + /* Copy parent information */ + if(old_dt->shared->parent) + new_dt->shared->parent = H5T_copy(old_dt->shared->parent, method); + + switch(new_dt->shared->type) { + case H5T_COMPOUND: + { + int accum_change = 0; /* Amount of change in the offset of the fields */ - switch(new_dt->shared->type) { - case H5T_COMPOUND: - { - int accum_change = 0; /* Amount of change in the offset of the fields */ + /* + * Copy all member fields to new type, then overwrite the + * name and type fields of each new member with copied values. + * That is, H5T_copy() is a deep copy. + */ + /* Only malloc if space has been allocated for members - NAF */ + if(new_dt->shared->u.compnd.nalloc > 0) { + new_dt->shared->u.compnd.memb = H5MM_malloc(new_dt->shared->u.compnd.nalloc * + sizeof(H5T_cmemb_t)); + if (NULL==new_dt->shared->u.compnd.memb) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + + HDmemcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb, + new_dt->shared->u.compnd.nmembs * sizeof(H5T_cmemb_t)); + } /* end if */ - /* - * Copy all member fields to new type, then overwrite the - * name and type fields of each new member with copied values. - * That is, H5T_copy() is a deep copy. - */ - /* Only malloc if space has been allocated for members - NAF */ - if(new_dt->shared->u.compnd.nalloc > 0) { - new_dt->shared->u.compnd.memb = H5MM_malloc(new_dt->shared->u.compnd.nalloc * - sizeof(H5T_cmemb_t)); - if (NULL==new_dt->shared->u.compnd.memb) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + for(i = 0; i < new_dt->shared->u.compnd.nmembs; i++) { + unsigned j; + int old_match; - HDmemcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb, - new_dt->shared->u.compnd.nmembs * sizeof(H5T_cmemb_t)); - } /* end if */ + s = new_dt->shared->u.compnd.memb[i].name; + new_dt->shared->u.compnd.memb[i].name = H5MM_xstrdup(s); + tmp = H5T_copy (old_dt->shared->u.compnd.memb[i].type, method); + new_dt->shared->u.compnd.memb[i].type = tmp; + HDassert(tmp != NULL); - for(i = 0; i < new_dt->shared->u.compnd.nmembs; i++) { - unsigned j; - int old_match; + /* Apply the accumulated size change to the offset of the field */ + new_dt->shared->u.compnd.memb[i].offset += accum_change; + + if(old_dt->shared->u.compnd.sorted != H5T_SORT_VALUE) { + for(old_match = -1, j = 0; j < old_dt->shared->u.compnd.nmembs; j++) { + if(!HDstrcmp(new_dt->shared->u.compnd.memb[i].name, old_dt->shared->u.compnd.memb[j].name)) { + old_match = j; + break; + } /* end if */ + } /* end for */ + + /* check if we couldn't find a match */ + if(old_match < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "fields in datatype corrupted"); + } /* end if */ + else + old_match = i; - s = new_dt->shared->u.compnd.memb[i].name; - new_dt->shared->u.compnd.memb[i].name = H5MM_xstrdup(s); - tmp = H5T_copy (old_dt->shared->u.compnd.memb[i].type, method); - new_dt->shared->u.compnd.memb[i].type = tmp; - HDassert(tmp != NULL); + /* If the field changed size, add that change to the accumulated size change */ + if(new_dt->shared->u.compnd.memb[i].type->shared->size != old_dt->shared->u.compnd.memb[old_match].type->shared->size) { + /* Adjust the size of the member */ + new_dt->shared->u.compnd.memb[i].size = (old_dt->shared->u.compnd.memb[old_match].size*tmp->shared->size)/old_dt->shared->u.compnd.memb[old_match].type->shared->size; - /* Apply the accumulated size change to the offset of the field */ - new_dt->shared->u.compnd.memb[i].offset += accum_change; + accum_change += (new_dt->shared->u.compnd.memb[i].type->shared->size - old_dt->shared->u.compnd.memb[old_match].type->shared->size); + } /* end if */ + } /* end for */ - if(old_dt->shared->u.compnd.sorted != H5T_SORT_VALUE) { - for(old_match = -1, j = 0; j < old_dt->shared->u.compnd.nmembs; j++) { - if(!HDstrcmp(new_dt->shared->u.compnd.memb[i].name, old_dt->shared->u.compnd.memb[j].name)) { - old_match = j; - break; - } /* end if */ - } /* end for */ + /* Apply the accumulated size change to the size of the compound struct */ + new_dt->shared->size += accum_change; - /* check if we couldn't find a match */ - if(old_match < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "fields in datatype corrupted"); - } /* end if */ - else - old_match = i; + } + break; - /* If the field changed size, add that change to the accumulated size change */ - if(new_dt->shared->u.compnd.memb[i].type->shared->size != old_dt->shared->u.compnd.memb[old_match].type->shared->size) { - /* Adjust the size of the member */ - new_dt->shared->u.compnd.memb[i].size = (old_dt->shared->u.compnd.memb[old_match].size*tmp->shared->size)/old_dt->shared->u.compnd.memb[old_match].type->shared->size; + case H5T_ENUM: + /* + * Copy all member fields to new type, then overwrite the name fields + * of each new member with copied values. That is, H5T_copy() is a + * deep copy. + */ + new_dt->shared->u.enumer.name = H5MM_malloc(new_dt->shared->u.enumer.nalloc * + sizeof(char*)); + new_dt->shared->u.enumer.value = H5MM_malloc(new_dt->shared->u.enumer.nalloc * + new_dt->shared->size); + if(NULL == new_dt->shared->u.enumer.value) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HDmemcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value, + new_dt->shared->u.enumer.nmembs * new_dt->shared->size); + for(i = 0; i < new_dt->shared->u.enumer.nmembs; i++) { + s = old_dt->shared->u.enumer.name[i]; + new_dt->shared->u.enumer.name[i] = H5MM_xstrdup(s); + } /* end for */ + break; - accum_change += (new_dt->shared->u.compnd.memb[i].type->shared->size - old_dt->shared->u.compnd.memb[old_match].type->shared->size); + case H5T_VLEN: + case H5T_REFERENCE: + if(method == H5T_COPY_TRANSIENT || method == H5T_COPY_REOPEN) { + /* H5T_copy converts any type into a memory type */ + if(H5T_set_loc(new_dt, NULL, H5T_LOC_MEMORY) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location"); } /* end if */ - } /* end for */ - - /* Apply the accumulated size change to the size of the compound struct */ - new_dt->shared->size += accum_change; - - } - break; - - case H5T_ENUM: - /* - * Copy all member fields to new type, then overwrite the name fields - * of each new member with copied values. That is, H5T_copy() is a - * deep copy. - */ - new_dt->shared->u.enumer.name = H5MM_malloc(new_dt->shared->u.enumer.nalloc * - sizeof(char*)); - new_dt->shared->u.enumer.value = H5MM_malloc(new_dt->shared->u.enumer.nalloc * - new_dt->shared->size); - if(NULL == new_dt->shared->u.enumer.value) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - HDmemcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value, - new_dt->shared->u.enumer.nmembs * new_dt->shared->size); - for(i = 0; i < new_dt->shared->u.enumer.nmembs; i++) { - s = old_dt->shared->u.enumer.name[i]; - new_dt->shared->u.enumer.name[i] = H5MM_xstrdup(s); - } /* end for */ - break; - - case H5T_VLEN: - case H5T_REFERENCE: - if(method == H5T_COPY_TRANSIENT || method == H5T_COPY_REOPEN) { - /* H5T_copy converts any type into a memory type */ - if(H5T_set_loc(new_dt, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location"); - } /* end if */ - break; + break; - case H5T_OPAQUE: - /* - * Copy the tag name. - */ - new_dt->shared->u.opaque.tag = H5MM_xstrdup(new_dt->shared->u.opaque.tag); - break; + case H5T_OPAQUE: + /* + * Copy the tag name. + */ + new_dt->shared->u.opaque.tag = H5MM_xstrdup(new_dt->shared->u.opaque.tag); + break; - case H5T_ARRAY: - /* Re-compute the array's size, in case it's base type changed size */ - new_dt->shared->size=new_dt->shared->u.array.nelem*new_dt->shared->parent->shared->size; - break; + case H5T_ARRAY: + /* Re-compute the array's size, in case it's base type changed size */ + new_dt->shared->size=new_dt->shared->u.array.nelem*new_dt->shared->parent->shared->size; + break; - default: - break; - } /* end switch */ + default: + break; + } /* end switch */ + } /* end if */ /* Set the cached location & name path if the original type was a named * type and the new type is also named. diff --git a/src/H5public.h b/src/H5public.h index c685787..e0effba 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -71,10 +71,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 40 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 42 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "FA_a2" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.40-FA_a2" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.42-FA_a2" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 93695fb..89b41a0 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -47,7 +47,7 @@ typedef __int64 h5_stat_size_t; #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ - int HDgettimeofday(struct timeval *tv, void *tz); + H5_DLL int HDgettimeofday(struct timeval *tv, void *tz); #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/src/Makefile.in b/src/Makefile.in index cdb982d..2c95fc8 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -409,7 +409,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 30 +LT_VERS_REVISION = 32 LT_VERS_AGE = 0 H5detect_CFLAGS = -g diff --git a/test/dtypes.c b/test/dtypes.c index 548cc59..c83cdfd 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -5805,6 +5805,209 @@ error: /*------------------------------------------------------------------------- + * Function: test_named_indirect_reopen + * + * Purpose: Tests that open named datatypes can be reopened indirectly + * through H5Dget_type without causing problems. + * + * Return: Success: 0 + * + * Failure: number of errors + * + * Programmer: Neil Fortner + * Thursday, June 4, 2009 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +test_named_indirect_reopen(hid_t fapl) +{ + hid_t file=-1, type=-1, reopened_type=-1, strtype=-1, dset=-1, space=-1; + static hsize_t dims[1] = {3}; + size_t dt_size; + int enum_value; + const char *tag = "opaque_tag"; + char *tag_ret = NULL; + char filename[1024]; + + TESTING("indirectly reopening committed datatypes"); + + /* Create file, dataspace */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + if ((file=H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if ((space = H5Screate_simple (1, dims, dims)) < 0) TEST_ERROR + + /* + * Compound + */ + + /* Create compound type */ + if((strtype = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR + if(H5Tset_size(strtype, H5T_VARIABLE) < 0) TEST_ERROR + if((type = H5Tcreate(H5T_COMPOUND, sizeof(char *))) < 0) TEST_ERROR + if(H5Tinsert(type, "vlstr", 0, strtype) < 0) TEST_ERROR + if(H5Tclose(strtype) < 0) TEST_ERROR + + /* Get size of compound type */ + if((dt_size = H5Tget_size(type)) == 0) TEST_ERROR + + /* Commit compound type and verify the size doesn't change */ + if(H5Tcommit2(file, "cmpd_type", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(dt_size != H5Tget_size(type)) TEST_ERROR + + /* Create dataset with compound type */ + if((dset = H5Dcreate2(file, "cmpd_dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Indirectly reopen type and verify that the size doesn't change */ + if((reopened_type = H5Dget_type(dset)) < 0) TEST_ERROR + if(dt_size != H5Tget_size(reopened_type)) TEST_ERROR + + /* Close types and dataset */ + if(H5Tclose(type) < 0) TEST_ERROR + if(H5Tclose(reopened_type) < 0) TEST_ERROR + if(H5Dclose(dset) < 0) TEST_ERROR + + /* + * Enum + */ + + /* Create enum type */ + if((type = H5Tenum_create(H5T_NATIVE_INT)) < 0) TEST_ERROR + enum_value = 0; + if(H5Tenum_insert(type, "val1", &enum_value) < 0) TEST_ERROR + enum_value = 1; + if(H5Tenum_insert(type, "val2", &enum_value) < 0) TEST_ERROR + + /* Get size of enum type */ + if((dt_size = H5Tget_size(type)) == 0) TEST_ERROR + + /* Commit enum type and verify the size doesn't change */ + if(H5Tcommit2(file, "enum_type", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(dt_size != H5Tget_size(type)) TEST_ERROR + + /* Create dataset with enum type */ + if((dset = H5Dcreate2(file, "enum_dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Indirectly reopen type and verify that the size doesn't change */ + if((reopened_type = H5Dget_type(dset)) < 0) TEST_ERROR + if(dt_size != H5Tget_size(reopened_type)) TEST_ERROR + + /* Close types and dataset */ + if(H5Tclose(type) < 0) TEST_ERROR + if(H5Tclose(reopened_type) < 0) TEST_ERROR + if(H5Dclose(dset) < 0) TEST_ERROR + + /* + * Vlen + */ + + /* Create vlen type */ + if((type = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR + + /* Get size of vlen type */ + if((dt_size = H5Tget_size(type)) == 0) TEST_ERROR + + /* Commit vlen type and verify the size doesn't change */ + if(H5Tcommit2(file, "vlen_type", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(dt_size != H5Tget_size(type)) TEST_ERROR + + /* Create dataset with vlen type */ + if((dset = H5Dcreate2(file, "vlen_dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Indirectly reopen type and verify that the size doesn't change */ + if((reopened_type = H5Dget_type(dset)) < 0) TEST_ERROR + if(dt_size != H5Tget_size(reopened_type)) TEST_ERROR + + /* Close types and dataset */ + if(H5Tclose(type) < 0) TEST_ERROR + if(H5Tclose(reopened_type) < 0) TEST_ERROR + if(H5Dclose(dset) < 0) TEST_ERROR + + /* + * Opaque + */ + + /* Create opaque type */ + if((type = H5Tcreate(H5T_OPAQUE, 13)) < 0) TEST_ERROR + if(H5Tset_tag(type, tag) < 0) TEST_ERROR + + /* Get size of opaque type */ + if((dt_size = H5Tget_size(type)) == 0) TEST_ERROR + + /* Commit opaque type and verify the size and tag don't change */ + if(H5Tcommit2(file, "opaque_type", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(dt_size != H5Tget_size(type)) TEST_ERROR + if(NULL == (tag_ret = H5Tget_tag(type))) TEST_ERROR + if(HDstrcmp(tag, tag_ret)) TEST_ERROR + HDfree(tag_ret); + tag_ret = NULL; + + /* Create dataset with opaque type */ + if((dset = H5Dcreate2(file, "opaque_dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Indirectly reopen type and verify that the size and tag don't change */ + if((reopened_type = H5Dget_type(dset)) < 0) TEST_ERROR + if(dt_size != H5Tget_size(reopened_type)) TEST_ERROR + if(NULL == (tag_ret = H5Tget_tag(type))) TEST_ERROR + if(HDstrcmp(tag, tag_ret)) TEST_ERROR + HDfree(tag_ret); + tag_ret = NULL; + + /* Close types and dataset */ + if(H5Tclose(type) < 0) TEST_ERROR + if(H5Tclose(reopened_type) < 0) TEST_ERROR + if(H5Dclose(dset) < 0) TEST_ERROR + + /* + * Array + */ + + /* Create array type */ + if((type = H5Tarray_create2(H5T_NATIVE_INT, 1, dims)) < 0) TEST_ERROR + + /* Get size of array type */ + if((dt_size = H5Tget_size(type)) == 0) TEST_ERROR + + /* Commit array type and verify the size doesn't change */ + if(H5Tcommit2(file, "array_type", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(dt_size != H5Tget_size(type)) TEST_ERROR + + /* Create dataset with array type */ + if((dset = H5Dcreate2(file, "array_dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Indirectly reopen type and verify that the size doesn't change */ + if((reopened_type = H5Dget_type(dset)) < 0) TEST_ERROR + if(dt_size != H5Tget_size(reopened_type)) TEST_ERROR + + /* Close types and dataset */ + if(H5Tclose(type) < 0) TEST_ERROR + if(H5Tclose(reopened_type) < 0) TEST_ERROR + if(H5Dclose(dset) < 0) TEST_ERROR + + /* Close file and dataspace */ + if(H5Sclose(space) < 0) TEST_ERROR + if(H5Fclose(file) < 0) TEST_ERROR + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Tclose(type); + H5Tclose(strtype); + H5Tclose(reopened_type); + H5Sclose(space); + H5Dclose(dset); + H5Fclose(file); + } H5E_END_TRY; + if(tag_ret) + HDfree(tag_ret); + return 1; +} /* end test_named_indirect_reopen() */ + + +/*------------------------------------------------------------------------- * Function: test_deprec * * Purpose: Tests deprecated API routines for datatypes. @@ -5977,6 +6180,7 @@ main(void) nerrors += test_encode(); nerrors += test_latest(); nerrors += test_int_float_except(); + nerrors += test_named_indirect_reopen(fapl); #ifndef H5_NO_DEPRECATED_SYMBOLS nerrors += test_deprec(fapl); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/test/mf.c b/test/mf.c index ff54751..5c05848 100644 --- a/test/mf.c +++ b/test/mf.c @@ -30,6 +30,7 @@ #include "H5FSpkg.h" #define H5F_PACKAGE +#define H5F_TESTING #include "H5Fpkg.h" #include "H5FLprivate.h" @@ -718,6 +719,182 @@ error: } /* test_mf_eoa_extend() */ /* + * To verify that temporary blocks are allocated correctly + * + * Set up: + * There is nothing in free-space manager + * + * Tests: + * Allocate a reasonable-sized temporary block + * Check that the temporary address is high enough + * Check that file I/O with the temporary address fails + * Check that freeing a temporary address fails + * Check that closing the file doesn't change the file's size + * Check that overlapping normal & temporary address space fails: + * - Reopen the file + * - Allocate enough temporary space to use ~1/3 of the file + * - Allocate enough 'normal' space to use ~1/3 of the file + * - Check that allocating another 1/2 of the file as temporary address + * space fails + * - Check that allocating another 1/2 of the file as normal address + * space fails + */ +static unsigned +test_mf_tmp(const char *env_h5_drvr, hid_t fapl) +{ + hid_t file = -1; /* File ID */ + + TESTING("'temporary' file space allocation"); + + /* Can't run this test with multi-file VFDs */ + if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ + h5_stat_size_t file_size, new_file_size; /* file size */ + haddr_t maxaddr; /* File's max. address */ + haddr_t tmp_addr; /* Temporary space file address */ + haddr_t norm_addr; /* Normal space file address */ + haddr_t check_addr; /* File address for checking for errors */ + unsigned char buf = 0; /* Buffer to read/write with */ + herr_t status; /* Generic status value */ + + /* Set the filename to use for this test */ + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); + + /* Create the file to work on */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + + /* Close file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + /* Get the size of the file */ + if((file_size = h5_get_file_size(filename, fapl)) < 0) + TEST_ERROR + + + /* Re-open the file */ + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (f = (H5F_t *)H5I_object(file))) + FAIL_STACK_ERROR + + /* Retrieve the file's maxaddr */ + if(H5F_get_maxaddr_test(file, &maxaddr) < 0) + FAIL_STACK_ERROR + + /* Allocate some temporary address space */ + if(HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)TEST_BLOCK_SIZE30))) + FAIL_STACK_ERROR + + /* Check if temporary file address is valid */ + if(!H5F_IS_TMP_ADDR(f, tmp_addr)) + TEST_ERROR + if(tmp_addr < (haddr_t)(maxaddr - TEST_BLOCK_SIZE30)) + TEST_ERROR + + /* Reading & writing with a temporary address value should fail */ + H5E_BEGIN_TRY { + status = H5F_block_read(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), H5P_DATASET_XFER_DEFAULT, &buf); + } H5E_END_TRY; + if(status >= 0) + TEST_ERROR + H5E_BEGIN_TRY { + status = H5F_block_write(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), H5P_DATASET_XFER_DEFAULT, &buf); + } H5E_END_TRY; + if(status >= 0) + TEST_ERROR + + /* Freeing a temporary address value should fail */ + H5E_BEGIN_TRY { + status = H5MF_xfree(f, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, tmp_addr, (hsize_t)TEST_BLOCK_SIZE30); + } H5E_END_TRY; + if(status >= 0) + TEST_ERROR + + /* Close the file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + /* Get the size of the file */ + if((new_file_size = h5_get_file_size(filename, fapl)) < 0) + TEST_ERROR + + /* Verify the file is the correct size */ + if(new_file_size != file_size) + TEST_ERROR + + + /* Re-open the file */ + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (f = (H5F_t *)H5I_object(file))) + FAIL_STACK_ERROR + + /* Allocate 1/3 of the file as temporary address space */ + if(HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)(maxaddr / 3)))) + FAIL_STACK_ERROR + if(!H5F_IS_TMP_ADDR(f, tmp_addr)) + TEST_ERROR + + /* Allocate 1/3 of the file as normal address space */ + if(HADDR_UNDEF == (norm_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, (hsize_t)(maxaddr / 3)))) + FAIL_STACK_ERROR + if(H5F_IS_TMP_ADDR(f, norm_addr)) + TEST_ERROR + + /* Test that pushing temporary space allocation into normal space fails */ + H5E_BEGIN_TRY { + check_addr = H5MF_alloc_tmp(f, (hsize_t)(maxaddr / 3)); + } H5E_END_TRY; + if(H5F_addr_defined(check_addr)) + TEST_ERROR + + /* Test that pushing normal space allocation into temporary space fails */ + H5E_BEGIN_TRY { + check_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, (hsize_t)(maxaddr / 3)); + } H5E_END_TRY; + if(H5F_addr_defined(check_addr)) + TEST_ERROR + + /* Free the normal block (so the file doesn't blow up to a huge size) */ + if(H5MF_xfree(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, norm_addr, (hsize_t)(maxaddr / 3)) < 0) + FAIL_STACK_ERROR + + /* Close the file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + /* Get the size of the file */ + if((new_file_size = h5_get_file_size(filename, fapl)) < 0) + TEST_ERROR + + /* Verify the file is the correct size */ + if(new_file_size != file_size) + TEST_ERROR + + PASSED() + } /* end if */ + else { + SKIPPED(); + puts(" Current VFD doesn't support continuous address space"); + } /* end else */ + + return(0); + +error: + H5E_BEGIN_TRY { + H5Fclose(file); + } H5E_END_TRY; + return(1); +} /* test_mf_tmp() */ + +/* * To verify that the free-space manager is started up via H5MF_alloc_start() * * Set up: @@ -3583,6 +3760,10 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0) FAIL_STACK_ERROR + /* Get a pointer to the internal file object */ + if(NULL == (f = (H5F_t *)H5I_object(file))) + FAIL_STACK_ERROR + /* shrink the block */ if(H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE50) <= 0) TEST_ERROR @@ -3634,6 +3815,10 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0) FAIL_STACK_ERROR + /* Get a pointer to the internal file object */ + if(NULL == (f = (H5F_t *)H5I_object(file))) + FAIL_STACK_ERROR + /* try to extend the block */ extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr1, (hsize_t)TEST_BLOCK_SIZE50, (hsize_t)TEST_BLOCK_SIZE30); @@ -5625,11 +5810,6 @@ main(void) env_h5_drvr = "nomatch"; fapl = h5_fileaccess(); - if((new_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR - - /* alignment is not set for the following tests */ - if(H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1) < 0) - TEST_ERROR /* meta/small data is set to 2048 for the following tests */ if(H5Pset_meta_block_size(fapl, (hsize_t)TEST_BLOCK_SIZE2048) < 0) @@ -5637,11 +5817,21 @@ main(void) if(H5Pset_small_data_block_size(fapl, (hsize_t)TEST_BLOCK_SIZE2048) < 0) TEST_ERROR + /* Make a copy of the FAPL before adjusting the alignment */ + if((new_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR + + /* alignment is not set for the following tests */ + if(H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1) < 0) + TEST_ERROR + /* interaction with file allocation */ nerrors += test_mf_eoa(env_h5_drvr, fapl); nerrors += test_mf_eoa_shrink(env_h5_drvr, fapl); nerrors += test_mf_eoa_extend(env_h5_drvr, fapl); + /* interaction with temporary file space allocation */ + nerrors += test_mf_tmp(env_h5_drvr, fapl); + /* interaction with free-space manager */ nerrors += test_mf_fs_start(fapl); nerrors += test_mf_fs_alloc_free(fapl); @@ -5663,12 +5853,6 @@ main(void) * tests for alignment */ - /* set meta/sdata block size = 2048 */ - if(H5Pset_meta_block_size(new_fapl, (hsize_t)TEST_BLOCK_SIZE2048) < 0) - TEST_ERROR - if(H5Pset_small_data_block_size(new_fapl, (hsize_t)TEST_BLOCK_SIZE2048) < 0) - TEST_ERROR - for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; curr_test++) { switch(curr_test) { @@ -5695,7 +5879,7 @@ main(void) nerrors += test_mf_align_alloc4(env_h5_drvr, fapl, new_fapl); nerrors += test_mf_align_alloc5(env_h5_drvr, fapl, new_fapl); nerrors += test_mf_align_alloc6(env_h5_drvr, fapl, new_fapl); - } + } /* end if */ if(nerrors) goto error; diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c index 822d59c..1cb8f2f 100644 --- a/tools/h5diff/h5diff_main.c +++ b/tools/h5diff/h5diff_main.c @@ -68,6 +68,9 @@ */ +/* module-scoped variables */ +int d_status = EXIT_SUCCESS; + int main(int argc, const char *argv[]) { int ret; diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index b07c425..95b28ee 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -97,6 +97,9 @@ static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t *------------------------------------------------------------------------- */ +/* module-scoped variables */ +int d_status = EXIT_SUCCESS; + int main(void) { test_basic(FILE1, FILE2, FILE11); diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c index c613879..1990138 100644 --- a/tools/h5diff/ph5diff_main.c +++ b/tools/h5diff/ph5diff_main.c @@ -52,6 +52,8 @@ static void ph5diff_worker(int ); *------------------------------------------------------------------------- */ +/* module-scoped variables */ +int d_status = EXIT_SUCCESS; int main(int argc, const char *argv[]) { diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index 4854e3e..d641255 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -541,9 +541,10 @@ TOOLTEST h5diff_627.txt --count=200 $FILE1 $FILE2 g1/dset3 g1/dset4 TESTING $H5DIFF -n 1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_628.txt -n 1 $FILE1 $FILE2 g1/dset3 g1/dset4 +# Disabling this test as it hangs - LRK 20090618 # 6.29 non valid files -TESTING $H5DIFF file1.h6 file2.h6 -TOOLTEST h5diff_629.txt file1.h6 file2.h6 +#TESTING $H5DIFF file1.h6 file2.h6 +#TOOLTEST h5diff_629.txt file1.h6 file2.h6 # ############################################################################## # 7. attributes diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 5d3db21..a8b6832 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -649,7 +649,9 @@ usage(const char *prog) fprintf(stdout, " -o F, --output=F Output raw data into file F\n"); fprintf(stdout, " -b B, --binary=B Binary file output, of form B\n"); fprintf(stdout, " -t P, --datatype=P Print the specified named datatype\n"); - fprintf(stdout, " -w N, --width=N Set the number of columns of output\n"); + fprintf(stdout, " -w N, --width=N Set the number of columns of output. A value of 0 (zero)\n"); + fprintf(stdout, " sets the number of columns to the maximum (65535).\n"); + fprintf(stdout, " Default width is 80 columns.\n"); fprintf(stdout, " -m T, --format=T Set the floating point output format\n"); fprintf(stdout, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n"); fprintf(stdout, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n"); @@ -2377,7 +2379,12 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) outputformat->fmt_float = fp_format; } - outputformat->line_ncols = nCols; + if (nCols==0) { + outputformat->line_ncols = 65535; + outputformat->line_per_line = 1; + } + else + outputformat->line_ncols = nCols; outputformat->do_escape=display_escape; /* print the matrix indices */ outputformat->pindex=display_index; @@ -5363,7 +5370,12 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU int depth; int stdindent = COL; /* should be 3 */ - outputformat->line_ncols = nCols; + if (nCols==0) { + outputformat->line_ncols = 65535; + outputformat->line_per_line = 1; + } + else + outputformat->line_ncols = nCols; indent += COL; /* diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index a09e8b9..01c33ef 100755 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -54,6 +54,7 @@ FILE13=h5repack_soffset.h5 FILE14=h5repack_layouto.h5 # A file with an older version of the layout message # (copy of test/tlayouto.h5) FILE15=h5repack_named_dtypes.h5 +FILE16=tfamily%05d.h5 # located in common testfiles folder nerrors=0 @@ -140,6 +141,8 @@ TOOLTEST() rm -f $outfile } +# same as TOOLTEST, but it uses the old syntax -i input_file -o output_file +# TOOLTEST0() { # Run test. @@ -168,6 +171,38 @@ TOOLTEST0() rm -f $outfile } + +# same as TOOLTEST, but it uses the common testfiles at $srcdir/../testfiles/ +# used to test the family driver, where these files reside +# +TOOLTEST1() +{ + # Run test. + # Tflops interprets "$@" as "" when no parameter is given (e.g., the + # case of missing file name). Changed it to use $@ till Tflops fixes it. + TESTING $H5REPACK $@ + + infile=$srcdir/../testfiles/$1 + path=`pwd` + outfile=$path/out.$1 + shift + if [ "`uname -s`" = "TFLOPS O/S" ]; then + $RUNSERIAL $H5REPACK_BIN $@ $infile $outfile + else + $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile + fi + + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + DIFFTEST $infile $outfile + fi + rm -f $outfile +} + # # The tests # We use the files generated by h5repacktst @@ -514,6 +549,9 @@ TOOLTEST $FILE1 -f GZIP=1 # Check repacking file with committed datatypes in odd configurations TOOLTEST $FILE15 +# tests family driver (file is located in common testfiles folder, uses TOOLTEST1 +TOOLTEST1 $FILE16 + if test $nerrors -eq 0 ; then echo "All $H5REPACK tests passed." fi diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 00d7c66..6b08a2f 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -445,14 +445,22 @@ int apply_filters(const char* name, /* object name from traverse list */ if (H5Pset_layout(dcpl_id, obj.layout)<0) return -1; - if (H5D_CHUNKED==obj.layout) { /* set up chunk */ + if (H5D_CHUNKED == obj.layout) + { if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) return -1; } - else if (H5D_COMPACT==obj.layout) { + else if (H5D_COMPACT == obj.layout) + { if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY)<0) return -1; } + /* remove filters for the H5D_CONTIGUOUS case */ + else if (H5D_CONTIGUOUS == obj.layout) + { + if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0) + return -1; + } } diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index 92d758e..69df02c 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -18,8 +18,8 @@ #include "h5tools_utils.h" extern char *progname; -static int has_layout(hid_t pid, pack_info_t *obj); -static int has_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter); +static int verify_layout(hid_t pid, pack_info_t *obj); +static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter); /*------------------------------------------------------------------------- @@ -82,7 +82,7 @@ int h5repack_verify(const char *fname, * filter check *------------------------------------------------------------------------- */ - if(has_filters(pid, tid, obj->nfilters, obj->filter) <= 0) + if(verify_filters(pid, tid, obj->nfilters, obj->filter) <= 0) ok = 0; @@ -90,7 +90,7 @@ int h5repack_verify(const char *fname, * layout check *------------------------------------------------------------------------- */ - if((obj->layout != -1) && (has_layout(pid, obj) == 0)) + if((obj->layout != -1) && (verify_layout(pid, obj) == 0)) ok = 0; /*------------------------------------------------------------------------- @@ -151,7 +151,7 @@ int h5repack_verify(const char *fname, if(options->all_filter == 1) { - if(has_filters(pid, tid, options->n_filter_g, options->filter_g) <= 0) + if(verify_filters(pid, tid, options->n_filter_g, options->filter_g) <= 0) ok = 0; } @@ -165,7 +165,7 @@ int h5repack_verify(const char *fname, init_packobject(&pack); pack.layout = options->layout_g; pack.chunk = options->chunk_g; - if(has_layout(pid, &pack) == 0) + if(verify_layout(pid, &pack) == 0) ok = 0; } @@ -215,13 +215,13 @@ error: /*------------------------------------------------------------------------- - * Function: has_layout + * Function: verify_layout * * Purpose: verify which layout is present in the property list DCPL_ID * * H5D_COMPACT = 0 * H5D_CONTIGUOUS = 1 - * H5D_CHUNKED = 2 + * H5D_CHUNKED = 2 * * Return: 1 has, 0 does not, -1 error * @@ -232,8 +232,8 @@ error: *------------------------------------------------------------------------- */ -int has_layout(hid_t pid, - pack_info_t *obj) +int verify_layout(hid_t pid, + pack_info_t *obj) { hsize_t chsize[64]; /* chunk size in elements */ H5D_layout_t layout; /* layout */ @@ -241,17 +241,13 @@ int has_layout(hid_t pid, int rank; /* rank */ int i; /* index */ - /* if no information about the input layout is requested return exit */ - if (obj==NULL) - return 1; - /* check if we have filters in the input object */ if ((nfilters = H5Pget_nfilters(pid)) < 0) return -1; - /* a non chunked layout was requested on a filtered object; avoid the test */ + /* a non chunked layout was requested on a filtered object */ if (nfilters && obj->layout!=H5D_CHUNKED) - return 1; + return 0; /* get layout */ if ((layout = H5Pget_layout(pid)) < 0) @@ -458,7 +454,7 @@ error: /*------------------------------------------------------------------------- - * Function: has_filters + * Function: verify_filters * * Purpose: verify if all requested filters in the array FILTER obtained * from user input are present in the property list PID obtained from @@ -477,7 +473,7 @@ error: */ static -int has_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) +int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) { int nfilters_dcpl; /* number of filters in DCPL*/ unsigned filt_flags; /* filter flags */ diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index af4d671..b36afde 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -659,6 +659,23 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; + /*------------------------------------------------------------------------- + * do the same test for a file with filters (chunked) + *------------------------------------------------------------------------- + */ + if (h5repack_init (&pack_options, 0) < 0) + GOERROR; + if (h5repack_addlayout("CONTI",&pack_options) < 0) + GOERROR; + if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0) + GOERROR; + if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0) + GOERROR; + if (h5repack_verify(FNAME8OUT,&pack_options)<=0) + GOERROR; + if (h5repack_end (&pack_options) < 0) + GOERROR; + PASSED(); TESTING(" adding layout compact"); diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 432dd95..5a4e2f2 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -17,6 +17,8 @@ #include "h5diff.h" #include "H5private.h" #include "ph5diff.h" +#include "h5tools.h" +#include "h5tools_utils.h" /* * Debug printf macros. The prefix allows output filtering by test scripts. @@ -210,9 +212,11 @@ hsize_t h5diff(const char *fname1, /* disable error reporting */ H5E_BEGIN_TRY { - /* open the files */ - if((file1_id = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + /* open file 1 */ + + if((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { + parallel_print("h5diff: <%s>: unable to open file\n", fname1); options->err_stat = 1; @@ -223,8 +227,13 @@ hsize_t h5diff(const char *fname1, #endif goto out; } /* end if */ - if((file2_id = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + + + /* open file 2 */ + + if((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { + parallel_print("h5diff: <%s>: unable to open file\n", fname2); options->err_stat = 1; diff --git a/tools/testfiles/tnofilename.ddl b/tools/testfiles/tnofilename.ddl index 5b5854d..594b0c0 100644 --- a/tools/testfiles/tnofilename.ddl +++ b/tools/testfiles/tnofilename.ddl @@ -22,7 +22,9 @@ usage: h5dump [OPTIONS] file -o F, --output=F Output raw data into file F -b B, --binary=B Binary file output, of form B -t P, --datatype=P Print the specified named datatype - -w N, --width=N Set the number of columns of output + -w N, --width=N Set the number of columns of output. A value of 0 (zero) + sets the number of columns to the maximum (65535). + Default width is 80 columns. -m T, --format=T Set the floating point output format -q Q, --sort_by=Q Sort groups and attributes by index Q -z Z, --sort_order=Z Sort groups and attributes by order Z diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index 9c98a9f..13a5d15 100644 --- a/vms/src/h5pubconf.h +++ b/vms/src/h5pubconf.h @@ -480,13 +480,13 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.40-FA_a2" +#define H5_PACKAGE_STRING "HDF5 1.9.42-FA_a2" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.40-FA_a2" +#define H5_PACKAGE_VERSION "1.9.42-FA_a2" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "ll" @@ -639,7 +639,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.40-FA_a2" +#define H5_VERSION "1.9.42-FA_a2" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ diff --git a/windows/perform/checkperformtests.bat b/windows/perform/checkperformtests.bat index ac9119e..35895cf 100644 --- a/windows/perform/checkperformtests.bat +++ b/windows/perform/checkperformtests.bat @@ -79,6 +79,7 @@ rem on it for sending parameters. --SJW 9/6/07 call :add_test iopipe%2 ..\test\iopipe%2\%1 call :add_test chunk%2 ..\test\chunk%2\%1 call :add_test overhead%2 ..\test\overhead%2\%1 + call :add_test perf_serial%2 ..\perform\perf_serial%2\%1 rem Run the tests, passing in which version to run diff --git a/windows/perform/perf_serial/perf_serial.vcproj b/windows/perform/perf_serial/perf_serial.vcproj new file mode 100644 index 0000000..6826366 --- /dev/null +++ b/windows/perform/perf_serial/perf_serial.vcproj @@ -0,0 +1,528 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/windows/perform/perf_serialdll/perf_serialdll.vcproj b/windows/perform/perf_serialdll/perf_serialdll.vcproj new file mode 100644 index 0000000..309afbb --- /dev/null +++ b/windows/perform/perf_serialdll/perf_serialdll.vcproj @@ -0,0 +1,529 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/windows/proj/all/all.sln b/windows/proj/all/all.sln index c56428b..44fa172 100755 --- a/windows/proj/all/all.sln +++ b/windows/proj/all/all.sln @@ -1109,6 +1109,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mfdll", "..\..\test\mfdll\m {C9535AD9-C61D-4691-A5CE-52EF359892AF} = {C9535AD9-C61D-4691-A5CE-52EF359892AF} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "perf_serial", "..\..\perform\perf_serial\perf_serial.vcproj", "{B8923279-9E37-43D2-8ECF-5225BFB3356A}" + ProjectSection(ProjectDependencies) = postProject + {473ABB63-E5C6-4D8E-9380-5DC76E1EAB4A} = {473ABB63-E5C6-4D8E-9380-5DC76E1EAB4A} + {26346A09-C500-49E7-963A-D22A8E09AAB7} = {26346A09-C500-49E7-963A-D22A8E09AAB7} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "perf_serialdll", "..\..\perform\perf_serialdll\perf_serialdll.vcproj", "{BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}" + ProjectSection(ProjectDependencies) = postProject + {832DD776-BC7F-40B5-90D0-E6448014CA5B} = {832DD776-BC7F-40B5-90D0-E6448014CA5B} + {C9535AD9-C61D-4691-A5CE-52EF359892AF} = {C9535AD9-C61D-4691-A5CE-52EF359892AF} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -2417,6 +2429,22 @@ Global {C4811E26-A7DA-424D-8A44-F29DFD588533}.Release|Win32.Build.0 = Release|Win32 {C4811E26-A7DA-424D-8A44-F29DFD588533}.Release|x64.ActiveCfg = Release|x64 {C4811E26-A7DA-424D-8A44-F29DFD588533}.Release|x64.Build.0 = Release|x64 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Debug|Win32.ActiveCfg = Debug|Win32 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Debug|Win32.Build.0 = Debug|Win32 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Debug|x64.ActiveCfg = Debug|x64 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Debug|x64.Build.0 = Debug|x64 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Release|Win32.ActiveCfg = Release|Win32 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Release|Win32.Build.0 = Release|Win32 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Release|x64.ActiveCfg = Release|x64 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Release|x64.Build.0 = Release|x64 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Debug|Win32.ActiveCfg = Debug|Win32 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Debug|Win32.Build.0 = Debug|Win32 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Debug|x64.ActiveCfg = Debug|x64 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Debug|x64.Build.0 = Debug|x64 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Release|Win32.ActiveCfg = Release|Win32 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Release|Win32.Build.0 = Release|Win32 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Release|x64.ActiveCfg = Release|x64 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/windows/proj/all_fortran/all_fortran.sln b/windows/proj/all_fortran/all_fortran.sln index 4db2890..3d074de 100644 --- a/windows/proj/all_fortran/all_fortran.sln +++ b/windows/proj/all_fortran/all_fortran.sln @@ -1350,6 +1350,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mfdll", "..\..\test\mfdll\m {C9535AD9-C61D-4691-A5CE-52EF359892AF} = {C9535AD9-C61D-4691-A5CE-52EF359892AF} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "perf_serial", "..\..\perform\perf_serial\perf_serial.vcproj", "{B8923279-9E37-43D2-8ECF-5225BFB3356A}" + ProjectSection(ProjectDependencies) = postProject + {473ABB63-E5C6-4D8E-9380-5DC76E1EAB4A} = {473ABB63-E5C6-4D8E-9380-5DC76E1EAB4A} + {26346A09-C500-49E7-963A-D22A8E09AAB7} = {26346A09-C500-49E7-963A-D22A8E09AAB7} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "perf_serialdll", "..\..\perform\perf_serialdll\perf_serialdll.vcproj", "{BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}" + ProjectSection(ProjectDependencies) = postProject + {832DD776-BC7F-40B5-90D0-E6448014CA5B} = {832DD776-BC7F-40B5-90D0-E6448014CA5B} + {C9535AD9-C61D-4691-A5CE-52EF359892AF} = {C9535AD9-C61D-4691-A5CE-52EF359892AF} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -2890,6 +2902,22 @@ Global {C4811E26-A7DA-424D-8A44-F29DFD588533}.Release|Win32.Build.0 = Release|Win32 {C4811E26-A7DA-424D-8A44-F29DFD588533}.Release|x64.ActiveCfg = Release|x64 {C4811E26-A7DA-424D-8A44-F29DFD588533}.Release|x64.Build.0 = Release|x64 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Debug|Win32.ActiveCfg = Debug|Win32 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Debug|Win32.Build.0 = Debug|Win32 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Debug|x64.ActiveCfg = Debug|x64 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Debug|x64.Build.0 = Debug|x64 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Release|Win32.ActiveCfg = Release|Win32 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Release|Win32.Build.0 = Release|Win32 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Release|x64.ActiveCfg = Release|x64 + {B8923279-9E37-43D2-8ECF-5225BFB3356A}.Release|x64.Build.0 = Release|x64 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Debug|Win32.ActiveCfg = Debug|Win32 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Debug|Win32.Build.0 = Debug|Win32 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Debug|x64.ActiveCfg = Debug|x64 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Debug|x64.Build.0 = Debug|x64 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Release|Win32.ActiveCfg = Release|Win32 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Release|Win32.Build.0 = Release|Win32 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Release|x64.ActiveCfg = Release|x64 + {BF8C769D-BC11-4AB4-B928-5FD1ADCB1234}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/windows/src/H5pubconf.h b/windows/src/H5pubconf.h index 48df6e2..b89598d 100755 --- a/windows/src/H5pubconf.h +++ b/windows/src/H5pubconf.h @@ -479,13 +479,13 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.40-FA_a2" +#define H5_PACKAGE_STRING "HDF5 1.9.42-FA_a2" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.40-FA_a2" +#define H5_PACKAGE_VERSION "1.9.42-FA_a2" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "I64" @@ -642,7 +642,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.40-FA_a2" +#define H5_VERSION "1.9.42-FA_a2" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ diff --git a/windows/tools/h5repack/h5repack.bat b/windows/tools/h5repack/h5repack.bat index 27c1c12..92f5300 100644 --- a/windows/tools/h5repack/h5repack.bat +++ b/windows/tools/h5repack/h5repack.bat @@ -64,6 +64,8 @@ set file13=h5repack_soffset.h5 rem A file with an older version of the layout message (copy of test/tlayouto.h5) set file14=h5repack_layouto.h5 set file15=h5repack_named_dtypes.h5 +rem located in common testfiles folder +set file16=tfamilyPERCENT05d.h5 set nerrors=0 @@ -84,7 +86,9 @@ rem set test_msg=!test_msg! %%~nxa ) ) ) - set test_msg=!test_msg! + rem We need to replace PERCENT here with "%" for tests that use a percent + rem sign. --SJW 5/12/08 + set test_msg=!test_msg:PERCENT=%%! echo.%test_msg:~0,69% %1 exit /b @@ -101,7 +105,9 @@ rem set test_msg=!test_msg! %%~nxa ) ) ) - set test_msg=!test_msg! + rem We need to replace PERCENT here with "%" for tests that use a percent + rem sign. --SJW 5/12/08 + set test_msg=!test_msg:PERCENT=%%! echo.%test_msg:~0,69% %1 exit /b @@ -117,7 +123,8 @@ rem was unavailable) rem Call the h5diff tool rem :difftest - %h5diff_bin% -q %* + set params=%* + %h5diff_bin% -q !params:PERCENT=%%! if %errorlevel% neq 0 ( call :verify *FAILED* %* set /a nerrors=!nerrors!+1 @@ -195,6 +202,40 @@ rem exit /b +rem same as TOOLTEST, but it uses the common testfiles at $srcdir/../testfiles/ +rem used to test the family driver, where these files reside +rem +:tooltest1 + + rem Run test. + set infile=%CD%\..\testfiles\%1 + rem Linux uses a $path variable here, but it is unneccessary, and will + rem corrupt our Windows PATH if we use it. --SJW 8/28/07 + rem set path=%CD% + rem set outfile=%path%\out.%1 + set outfile=%CD%\out.%1 + + rem We define %params% here because Windows `shift` command doesn't affect + rem the %* variable. --SJW 8/28/07 + if "%2"=="" ( + set params= + ) else ( + set params=%* + set params=!params:* =! + ) + %h5repack_bin% %params% !infile:PERCENT=%%! !outfile:PERCENT=%%! + + if %errorlevel% neq 0 ( + call :testing *FAILED* %* + set /a nerrors=!nerrors!+1 + ) else ( + call :testing PASSED %* + call :difftest %infile% %outfile% + ) + del /f !outfile:PERCENT=%%! + + exit /b + rem This is a Windows-specific function that detects if the filter passed rem should be enabled for this test script. It searches H5pubconf.h for the @@ -610,6 +651,9 @@ rem rem Check repacking file with committed datatypes in odd configurations call :tooltest %file15% + rem tests family driver (file is located in common testfiles folder, uses TOOLTEST1 + call :tooltest1 %file16% + if %nerrors% equ 0 ( echo.All %h5repack% tests passed. -- cgit v0.12