From 3360c3af0c100ac4d3a2fe2865f34661da862ec5 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 28 Jan 2010 08:11:38 -0500 Subject: [svn-r18175] Description: Bring r17986:18172 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/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) 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 --- MANIFEST | 38 +- Makefile.in | 4 +- README.txt | 2 +- c++/Makefile.in | 8 +- c++/examples/Makefile.in | 8 +- c++/examples/testh5c++.sh.in | 14 +- c++/src/H5CommonFG.cpp | 5 +- c++/src/H5PropList.cpp | 1 + c++/src/Makefile.in | 10 +- c++/src/h5c++.in | 8 +- c++/test/Makefile.in | 8 +- config/commence.am | 4 +- config/conclude.am | 4 +- config/ibm-aix | 170 + config/lt_vers.am | 2 +- configure | 22 +- configure.in | 2 +- examples/Makefile.in | 8 +- examples/testh5cc.sh.in | 14 +- fortran/Makefile.in | 8 +- fortran/examples/Makefile.in | 8 +- fortran/examples/testh5fc.sh.in | 14 +- fortran/src/H5Af.c | 123 +- fortran/src/H5Ef.c | 189 +- fortran/src/H5Lf.c | 213 +- fortran/src/H5Lff.f90 | 38 +- fortran/src/H5Pf.c | 155 +- fortran/src/H5Sf.c | 334 +- fortran/src/H5f90global.f90 | 16 +- fortran/src/Makefile.in | 10 +- fortran/src/h5fc.in | 8 +- fortran/test/Makefile.in | 8 +- fortran/test/t.c | 37 +- fortran/test/tH5G_1_8.f90 | 28 +- fortran/testpar/Makefile.in | 8 +- hl/Makefile.in | 8 +- hl/c++/Makefile.in | 8 +- hl/c++/examples/Makefile.in | 8 +- hl/c++/src/Makefile.in | 10 +- hl/c++/test/Makefile.in | 8 +- hl/examples/Makefile.in | 8 +- hl/fortran/Makefile.in | 8 +- hl/fortran/examples/Makefile.in | 8 +- hl/fortran/src/H5IMfc.c | 39 +- hl/fortran/src/H5TBfc.c | 639 ++-- hl/fortran/src/Makefile.in | 10 +- hl/fortran/test/Makefile.in | 8 +- hl/src/H5LT.c | 27 +- hl/src/H5PT.c | 11 + hl/src/H5TB.c | 63 +- hl/src/Makefile.in | 10 +- hl/test/Makefile.in | 8 +- hl/test/test_ds.c | 1 + hl/test/test_lite.c | 19 +- hl/tools/Makefile.in | 8 +- hl/tools/gif2h5/Makefile.in | 8 +- hl/tools/gif2h5/decompress.c | 2 +- hl/tools/gif2h5/gif2hdf.c | 12 +- hl/tools/gif2h5/gif2mem.c | 28 +- hl/tools/gif2h5/gifread.c | 4 +- hl/tools/gif2h5/h52gifgentst.c | 12 +- hl/tools/gif2h5/h52giftest.sh | 8 +- hl/tools/gif2h5/hdf2gif.c | 6 +- perform/Makefile.in | 8 +- release_docs/RELEASE.txt | 5 +- src/H5A.c | 8 +- src/H5AC.c | 529 +--- src/H5ACprivate.h | 33 +- src/H5B.c | 810 +++-- src/H5B2cache.c | 32 +- src/H5B2hdr.c | 9 +- src/H5Bcache.c | 65 +- src/H5Bdbg.c | 152 +- src/H5Bpkg.h | 1 + src/H5C.c | 408 +-- src/H5Cpkg.h | 2 +- src/H5Cprivate.h | 46 +- src/H5Dbtree.c | 8 +- src/H5Dchunk.c | 8 +- src/H5Dcompact.c | 12 +- src/H5Dcontig.c | 12 +- src/H5Dearray.c | 4 +- src/H5Dint.c | 15 +- src/H5Dio.c | 15 +- src/H5Dlayout.c | 6 +- src/H5Dpkg.h | 3 +- src/H5Dproxy.c | 6 +- src/H5Dtest.c | 14 +- src/H5E.c | 67 +- src/H5EA.c | 18 +- src/H5EAcache.c | 16 +- src/H5EAhdr.c | 19 +- src/H5EAint.c | 12 +- src/H5EApkg.h | 4 +- src/H5Edeprec.c | 36 +- src/H5Eint.c | 24 +- src/H5Eprivate.h | 2 +- src/H5F.c | 107 +- src/H5FAhdr.c | 20 +- src/H5FD.c | 33 +- src/H5FDcore.c | 2 +- src/H5FDfamily.c | 1 - src/H5FDlog.c | 157 +- src/H5FDstdio.c | 4 +- src/H5FL.c | 55 +- src/H5FO.c | 2 +- src/H5FS.c | 26 +- src/H5FScache.c | 139 +- src/H5FSsection.c | 12 +- src/H5Fdbg.c | 5 +- src/H5Ffake.c | 2 +- src/H5Fprivate.h | 12 +- src/H5Fpublic.h | 2 +- src/H5Fsuper.c | 16 +- src/H5Fsuper_cache.c | 1 + src/H5Gcache.c | 53 +- src/H5Gent.c | 12 +- src/H5Glink.c | 60 +- src/H5Gnode.c | 141 +- src/H5Gobj.c | 4 +- src/H5Gpkg.h | 25 +- src/H5Gprivate.h | 5 +- src/H5Groot.c | 2 +- src/H5Gstab.c | 107 +- src/H5Gtest.c | 2 +- src/H5HF.c | 2 +- src/H5HFcache.c | 124 +- src/H5HFdblock.c | 105 +- src/H5HFhdr.c | 192 +- src/H5HFiblock.c | 122 +- src/H5HFiter.c | 16 - src/H5HFman.c | 82 - src/H5HFsection.c | 367 +-- src/H5HG.c | 167 +- src/H5HGcache.c | 22 +- src/H5HL.c | 736 +++-- src/H5HLcache.c | 821 +++-- src/H5HLdbg.c | 72 +- src/H5HLint.c | 417 +++ src/H5HLpkg.h | 98 +- src/H5HLprivate.h | 4 +- src/H5I.c | 4 +- src/H5L.c | 2 +- src/H5Lexternal.c | 6 +- src/H5O.c | 135 +- src/H5Oainfo.c | 8 +- src/H5Oalloc.c | 56 +- src/H5Oattr.c | 2 +- src/H5Oattribute.c | 51 +- src/H5Ocache.c | 38 +- src/H5Ocopy.c | 21 +- src/H5Odbg.c | 8 +- src/H5Oefl.c | 10 +- src/H5Ofill.c | 4 +- src/H5Olayout.c | 10 +- src/H5Olink.c | 10 +- src/H5Omessage.c | 49 +- src/H5Opkg.h | 6 +- src/H5Oprivate.h | 4 +- src/H5Otest.c | 76 +- src/H5Pdcpl.c | 4 +- src/H5Pfapl.c | 60 +- src/H5S.c | 163 +- src/H5SM.c | 2 +- src/H5SMcache.c | 6 +- src/H5Sall.c | 6 +- src/H5Shyper.c | 209 +- src/H5Snone.c | 2 +- src/H5Spoint.c | 194 +- src/H5Sprivate.h | 2 - src/H5T.c | 364 +-- src/H5Tcommit.c | 4 +- src/H5Tconv.c | 12 +- src/H5Tcset.c | 8 +- src/H5Tdeprec.c | 2 +- src/H5Tnative.c | 190 +- src/H5Toffset.c | 6 +- src/H5Znbit.c | 79 +- src/H5Ztrans.c | 117 +- src/H5detect.c | 3 +- src/H5private.h | 9 +- src/H5public.h | 4 +- src/Makefile.am | 2 +- src/Makefile.in | 29 +- test/Makefile.am | 2 +- test/Makefile.in | 10 +- test/cache.c | 3407 ++++++++++----------- test/cache_api.c | 140 +- test/cache_common.c | 876 ++++-- test/cache_common.h | 90 +- test/dt_arith.c | 231 +- test/dtypes.c | 161 +- test/gen_bad_ohdr.c | 2 + test/gen_bogus.c | 2 + test/gen_deflate.c | 2 +- test/gen_noencoder.c | 2 + test/lheap.c | 29 +- test/ntypes.c | 120 +- test/ohdr.c | 2 + test/pool.c | 209 +- test/stab.c | 3 - test/tarray.c | 7 - test/tattr.c | 1 - test/tconfig.c | 9 +- test/testframe.c | 8 +- test/testhdf5.h | 25 +- test/th5s.c | 15 +- test/trefer.c | 3 - testpar/Makefile.in | 8 +- testpar/t_cache.c | 97 +- testpar/t_pflush1.c | 23 +- tools/Makefile.in | 8 +- tools/h5copy/Makefile.in | 8 +- tools/h5copy/h5copy.c | 4 +- tools/h5copy/testh5copy.sh | 13 +- tools/h5diff/Makefile.in | 8 +- tools/h5diff/h5diff_common.c | 7 +- tools/h5diff/testfiles/h5diff_10.txt | 1 + tools/h5diff/testfiles/h5diff_200.txt | 1 - tools/h5diff/testfiles/h5diff_201.txt | 1 - tools/h5diff/testfiles/h5diff_202.txt | 1 - tools/h5diff/testfiles/h5diff_203.txt | 1 - tools/h5diff/testfiles/h5diff_204.txt | 1 - tools/h5diff/testfiles/h5diff_205.txt | 1 - tools/h5diff/testfiles/h5diff_206.txt | 1 - tools/h5diff/testfiles/h5diff_207.txt | 1 - tools/h5diff/testfiles/h5diff_300.txt | 2 + tools/h5diff/testfiles/h5diff_400.txt | 54 + tools/h5diff/testfiles/h5diff_401.txt | 12 + tools/h5diff/testfiles/h5diff_402.txt | 12 + tools/h5diff/testfiles/h5diff_403.txt | 12 + tools/h5diff/testfiles/h5diff_404.txt | 36 + tools/h5diff/testfiles/h5diff_405.txt | 12 + tools/h5diff/testfiles/h5diff_406.txt | 12 + tools/h5diff/testfiles/h5diff_407.txt | 12 + tools/h5diff/testfiles/h5diff_408.txt | 12 + tools/h5diff/testfiles/h5diff_409.txt | 12 + tools/h5diff/testfiles/h5diff_410.txt | 85 + tools/h5diff/testfiles/h5diff_411.txt | 12 + tools/h5diff/testfiles/h5diff_412.txt | 12 + tools/h5diff/testfiles/h5diff_413.txt | 12 + tools/h5diff/testfiles/h5diff_414.txt | 2 + tools/h5diff/testfiles/h5diff_415.txt | 2 + tools/h5diff/testfiles/h5diff_416.txt | 2 + tools/h5diff/testfiles/h5diff_417.txt | 6 + tools/h5diff/testfiles/h5diff_418.txt | 6 + tools/h5diff/testfiles/h5diff_419.txt | 2 + tools/h5diff/testfiles/h5diff_420.txt | 2 + tools/h5diff/testfiles/h5diff_421.txt | 2 + tools/h5diff/testfiles/h5diff_422.txt | 2 + tools/h5diff/testfiles/h5diff_423.txt | 12 + tools/h5diff/testfiles/h5diff_424.txt | 12 + tools/h5diff/testfiles/h5diff_425.txt | 12 + tools/h5diff/testfiles/h5diff_600.txt | 1 + tools/h5diff/testfiles/h5diff_603.txt | 1 + tools/h5diff/testfiles/h5diff_606.txt | 1 + tools/h5diff/testfiles/h5diff_609.txt | 2 - tools/h5diff/testfiles/h5diff_612.txt | 1 + tools/h5diff/testfiles/h5diff_615.txt | 1 + tools/h5diff/testfiles/h5diff_618.txt | 2 - tools/h5diff/testfiles/h5diff_621.txt | 1 + tools/h5diff/testfiles/h5diff_622.txt | 1 + tools/h5diff/testfiles/h5diff_623.txt | 1 + tools/h5diff/testfiles/h5diff_624.txt | 1 + tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 | Bin 0 -> 1072 bytes tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 | Bin 0 -> 4640 bytes tools/h5diff/testfiles/h5diff_extlink_src.h5 | Bin 0 -> 1256 bytes tools/h5diff/testfiles/h5diff_extlink_trg.h5 | Bin 0 -> 6056 bytes tools/h5diff/testfiles/h5diff_linked_softlink.h5 | Bin 0 -> 8144 bytes tools/h5diff/testfiles/h5diff_links.h5 | Bin 0 -> 2536 bytes tools/h5diff/testfiles/h5diff_softlinks.h5 | Bin 0 -> 5744 bytes tools/h5diff/testh5diff.sh | 284 +- tools/h5diff/testph5diff.sh | 14 +- tools/h5dump/Makefile.in | 8 +- tools/h5dump/h5dump.c | 61 +- tools/h5dump/testh5dump.sh.in | 13 +- tools/h5dump/testh5dumpxml.sh.in | 14 +- tools/h5import/Makefile.in | 8 +- tools/h5import/h5import.c | 2 +- tools/h5import/h5importtestutil.sh | 23 +- tools/h5jam/Makefile.in | 8 +- tools/h5jam/h5jam.c | 2 +- tools/h5jam/testh5jam.sh.in | 12 +- tools/h5ls/Makefile.in | 8 +- tools/h5repack/Makefile.in | 8 +- tools/h5repack/h5repack.sh.in | 12 +- tools/h5stat/Makefile.in | 8 +- tools/h5stat/h5stat.c | 10 +- tools/h5stat/testh5stat.sh.in | 13 +- tools/lib/Makefile.in | 8 +- tools/lib/h5diff.c | 646 +++- tools/lib/h5diff.h | 1 + tools/lib/h5diff_attr.c | 6 +- tools/lib/h5diff_dset.c | 5 - tools/lib/h5tools.c | 75 +- tools/lib/h5tools_error.h | 3 +- tools/lib/h5tools_filters.c | 120 +- tools/misc/Makefile.in | 8 +- tools/misc/h5cc.in | 8 +- tools/misc/h5mkgrp.c | 2 +- tools/misc/h5redeploy.in | 18 +- tools/misc/h5repart.c | 56 +- tools/misc/h5repart_gentest.c | 20 +- tools/misc/testh5mkgrp.sh | 13 +- tools/misc/testh5repart.sh.in | 16 +- vms/c++/test/make.com | 3 +- vms/src/h5pubconf.h | 6 +- windows/hdf5check.BAT | 6 +- windows/proj/hdf5/hdf5.vcproj | 4 + windows/proj/hdf5dll/hdf5dll.vcproj | 4 + windows/src/H5pubconf.h | 6 +- 311 files changed, 9725 insertions(+), 9000 deletions(-) create mode 100644 config/ibm-aix create mode 100644 src/H5HLint.c create mode 100755 tools/h5diff/testfiles/h5diff_300.txt create mode 100644 tools/h5diff/testfiles/h5diff_400.txt create mode 100644 tools/h5diff/testfiles/h5diff_401.txt create mode 100644 tools/h5diff/testfiles/h5diff_402.txt create mode 100644 tools/h5diff/testfiles/h5diff_403.txt create mode 100644 tools/h5diff/testfiles/h5diff_404.txt create mode 100644 tools/h5diff/testfiles/h5diff_405.txt create mode 100644 tools/h5diff/testfiles/h5diff_406.txt create mode 100644 tools/h5diff/testfiles/h5diff_407.txt create mode 100644 tools/h5diff/testfiles/h5diff_408.txt create mode 100644 tools/h5diff/testfiles/h5diff_409.txt create mode 100644 tools/h5diff/testfiles/h5diff_410.txt create mode 100644 tools/h5diff/testfiles/h5diff_411.txt create mode 100644 tools/h5diff/testfiles/h5diff_412.txt create mode 100644 tools/h5diff/testfiles/h5diff_413.txt create mode 100644 tools/h5diff/testfiles/h5diff_414.txt create mode 100644 tools/h5diff/testfiles/h5diff_415.txt create mode 100644 tools/h5diff/testfiles/h5diff_416.txt create mode 100644 tools/h5diff/testfiles/h5diff_417.txt create mode 100644 tools/h5diff/testfiles/h5diff_418.txt create mode 100644 tools/h5diff/testfiles/h5diff_419.txt create mode 100644 tools/h5diff/testfiles/h5diff_420.txt create mode 100644 tools/h5diff/testfiles/h5diff_421.txt create mode 100644 tools/h5diff/testfiles/h5diff_422.txt create mode 100644 tools/h5diff/testfiles/h5diff_423.txt create mode 100644 tools/h5diff/testfiles/h5diff_424.txt create mode 100644 tools/h5diff/testfiles/h5diff_425.txt create mode 100644 tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 create mode 100644 tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 create mode 100644 tools/h5diff/testfiles/h5diff_extlink_src.h5 create mode 100644 tools/h5diff/testfiles/h5diff_extlink_trg.h5 create mode 100644 tools/h5diff/testfiles/h5diff_linked_softlink.h5 create mode 100755 tools/h5diff/testfiles/h5diff_links.h5 create mode 100644 tools/h5diff/testfiles/h5diff_softlinks.h5 diff --git a/MANIFEST b/MANIFEST index bc6c704..6d29929 100644 --- a/MANIFEST +++ b/MANIFEST @@ -88,6 +88,7 @@ ./config/i386-pc-cygwin32 ./config/i686-pc-cygwin ./config/ia64-linux-gnu +./config/ibm-aix ./config/intel-fflags ./config/intel-flags ./config/irix6.x @@ -622,6 +623,7 @@ ./src/H5HL.c ./src/H5HLcache.c ./src/H5HLdbg.c +./src/H5HLint.c ./src/H5HLpkg.h ./src/H5HLprivate.h ./src/H5HLpublic.h @@ -1024,8 +1026,6 @@ ./tools/h5import/testfiles/in64.txt ./tools/h5import/testfiles/test15.h5 - - # h5diff sources ./tools/h5diff/Makefile.am ./tools/h5diff/Makefile.in @@ -1530,6 +1530,33 @@ ./tools/h5diff/testfiles/h5diff_205.txt ./tools/h5diff/testfiles/h5diff_206.txt ./tools/h5diff/testfiles/h5diff_207.txt +./tools/h5diff/testfiles/h5diff_300.txt +./tools/h5diff/testfiles/h5diff_400.txt +./tools/h5diff/testfiles/h5diff_401.txt +./tools/h5diff/testfiles/h5diff_402.txt +./tools/h5diff/testfiles/h5diff_403.txt +./tools/h5diff/testfiles/h5diff_404.txt +./tools/h5diff/testfiles/h5diff_405.txt +./tools/h5diff/testfiles/h5diff_406.txt +./tools/h5diff/testfiles/h5diff_407.txt +./tools/h5diff/testfiles/h5diff_408.txt +./tools/h5diff/testfiles/h5diff_409.txt +./tools/h5diff/testfiles/h5diff_410.txt +./tools/h5diff/testfiles/h5diff_411.txt +./tools/h5diff/testfiles/h5diff_412.txt +./tools/h5diff/testfiles/h5diff_413.txt +./tools/h5diff/testfiles/h5diff_414.txt +./tools/h5diff/testfiles/h5diff_415.txt +./tools/h5diff/testfiles/h5diff_416.txt +./tools/h5diff/testfiles/h5diff_417.txt +./tools/h5diff/testfiles/h5diff_418.txt +./tools/h5diff/testfiles/h5diff_419.txt +./tools/h5diff/testfiles/h5diff_420.txt +./tools/h5diff/testfiles/h5diff_421.txt +./tools/h5diff/testfiles/h5diff_422.txt +./tools/h5diff/testfiles/h5diff_423.txt +./tools/h5diff/testfiles/h5diff_424.txt +./tools/h5diff/testfiles/h5diff_425.txt ./tools/h5diff/testfiles/h5diff_idx.txt @@ -1546,6 +1573,13 @@ ./tools/h5diff/testfiles/h5diff_hyper1.h5 ./tools/h5diff/testfiles/h5diff_hyper2.h5 ./tools/h5diff/testfiles/h5diff_types.h5 +./tools/h5diff/testfiles/h5diff_links.h5 +./tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 +./tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 +./tools/h5diff/testfiles/h5diff_extlink_src.h5 +./tools/h5diff/testfiles/h5diff_extlink_trg.h5 +./tools/h5diff/testfiles/h5diff_linked_softlink.h5 +./tools/h5diff/testfiles/h5diff_softlinks.h5 diff --git a/Makefile.in b/Makefile.in index e0403bf..8587ac7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -356,12 +356,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la diff --git a/README.txt b/README.txt index 023f40c..9e6321b 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.54-FA_a4 currently under development +HDF5 version 1.9.59-FA_a4 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/c++/Makefile.in b/c++/Makefile.in index 599ac02..424aa15 100644 --- a/c++/Makefile.in +++ b/c++/Makefile.in @@ -329,12 +329,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -859,7 +859,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -930,7 +930,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/c++/examples/Makefile.in b/c++/examples/Makefile.in index 43296c6..5acaa12 100644 --- a/c++/examples/Makefile.in +++ b/c++/examples/Makefile.in @@ -295,12 +295,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -729,7 +729,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -800,7 +800,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/c++/examples/testh5c++.sh.in b/c++/examples/testh5c++.sh.in index 2b7bbfe..4281e3c 100755 --- a/c++/examples/testh5c++.sh.in +++ b/c++/examples/testh5c++.sh.in @@ -20,6 +20,10 @@ # # Initializations +TESTNAME=h5c++ +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + # Where the tool is installed. prefix="${prefix:-@prefix@}" AR="@AR@" @@ -30,7 +34,7 @@ H5TOOL_BIN="${prefix}/bin/${H5TOOL}" # The path of the tool binary CMP='cmp -s' DIFF='diff -c' -nerrors=0 +nerrors=$EXIT_SUCCESS verbose=yes # setup my machine information. @@ -271,7 +275,9 @@ if test -z "$HDF5_NOCLEANUP"; then fi if test $nerrors -eq 0 ; then - echo "All $H5TOOL tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index dd4a419..8c1237d 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -249,7 +249,7 @@ DataSet CommonFG::openDataSet( const H5std_string& name ) const //-------------------------------------------------------------------------- void CommonFG::link( H5L_type_t link_type, const char* curr_name, const char* new_name ) const { - herr_t ret_value; + herr_t ret_value = -1; switch(link_type) { case H5L_TYPE_HARD: @@ -265,8 +265,7 @@ void CommonFG::link( H5L_type_t link_type, const char* curr_name, const char* ne break; } /* end switch */ - if( ret_value < 0 ) - { + if( ret_value < 0 ) { throwException("link", "creating link failed"); } } diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 020bf18..579c8ac 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -27,6 +27,7 @@ #include "H5PropList.h" #include "H5private.h" // for HDfree + #ifndef H5_NO_NAMESPACE namespace H5 { #ifndef H5_NO_STD diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 420292b..15d9add 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -351,12 +351,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -390,7 +390,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 = 44 +LT_VERS_REVISION = 49 LT_VERS_AGE = 0 # Include src directory @@ -968,7 +968,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -1039,7 +1039,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/c++/src/h5c++.in b/c++/src/h5c++.in index aac8f40..4e51c94 100755 --- a/c++/src/h5c++.in +++ b/c++/src/h5c++.in @@ -36,6 +36,10 @@ HL="@HL@" ## ## ############################################################################ +# Constants definitions +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + host_os="@host_os@" prog_name="`basename $0`" @@ -91,7 +95,7 @@ usage() { echo " HDF5_CXX - use a different C++ compiler" echo " HDF5_CXXLINKER - use a different linker" echo " " - exit 1 + exit $EXIT_FAILURE } # Show the configuration summary of the library recorded in the @@ -103,7 +107,7 @@ showconfigure() } # Main -status=0 +status=$EXIT_SUCCESS if test "$#" = "0"; then # No parameters specified, issue usage statement and exit. diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in index 6384eec..e6d4f70 100644 --- a/c++/test/Makefile.in +++ b/c++/test/Makefile.in @@ -321,12 +321,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -805,7 +805,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -876,7 +876,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/config/commence.am b/config/commence.am index 667dbb2..7085d8f 100644 --- a/config/commence.am +++ b/config/commence.am @@ -24,12 +24,12 @@ CP=cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS=$(RUNSERIAL) +RUNEXEC=$(RUNSERIAL) # Libraries to link to while building LIBHDF5=$(top_builddir)/src/libhdf5.la diff --git a/config/conclude.am b/config/conclude.am index 446e963..830b60c 100644 --- a/config/conclude.am +++ b/config/conclude.am @@ -134,7 +134,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -205,7 +205,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/config/ibm-aix b/config/ibm-aix new file mode 100644 index 0000000..2336040 --- /dev/null +++ b/config/ibm-aix @@ -0,0 +1,170 @@ +# -*- shell-script -*- +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. + +# Configuration file for building on the IBM AIX platforms. +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. + +# Use AIX supplied C compiler by default, xlc for serial, mpcc_r for parallel. +# Use -D_LARGE_FILES by default to support large file size. +# Make sure this is applied to other API compile options such as C++. +if test "X-" = "X-$CC"; then + if test "X-$enable_parallel" = "X-yes"; then + CC=mpcc_r + CC_BASENAME=mpcc_r + else + CC=xlc + CC_BASENAME=xlc + fi +fi + +# Define RUNPARALLEL if parallel mode is enabled or a parallel compiler used. +if test "X-$enable_parallel" = "X-yes" -o X-$CC_BASENAME = X-mpcc_r; then + RUNPARALLEL=${RUNPARALLEL="env MP_PROCS=\$\${NPROCS:=3} MP_TASKS_PER_NODE=\$\${NPROCS:=3} poe"} +fi + + +#---------------------------------------------------------------------------- +# Compiler flags. The CPPFLAGS values should not include package debug +# flags like `-DH5G_DEBUG' since these are added with the +# `--enable-debug' switch of configure. + +case $CC_BASENAME in + xlc|xlc-*|mpcc_r|mpcc_r-*) + # Turn off shared lib option. It causes some test suite to fail. + enable_shared="${enable_shared:-no}" + # Use -D_LARGE_FILES by default to support large file size. + # Make sure this is applied to other API compile options such as C++. + AM_CFLAGS="-D_LARGE_FILES $AM_CFLAGS" + H5_CFLAGS="-qlanglvl=stdc99 $H5_CFLAGS" + DEBUG_CFLAGS="-g -qfullpath" + DEBUG_CPPFLAGS= + # -O causes test/dtypes to fail badly. Turn it off for now. + PROD_CFLAGS="" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-g -qfullpath -pg" + PROFILE_CPPFLAGS= + ;; + + gcc) + . $srcdir/config/gnu-flags + ;; + + *) + H5_CFLAGS="$H5_CFLAGS -ansi" + DEBUG_CFLAGS="-g" + DEBUG_CPPFLAGS= + PROD_CFLAGS="-O" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" + PROFILE_CPPFLAGS= + ;; +esac + +#---------------------------------------------------------------------------- +# Values for overriding configuration tests when cross compiling. +# This includes compiling on some machines where the serial front end +# compiles for a parallel back end. + +# Set this to `yes' or `no' depending on whether the target is big +# endian or little endian. +hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'} +ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} +ac_cv_header_stdc=${ac_cv_header_stdc='yes'} +ac_cv_header_sys_ioctl_h=${ac_cv_header_sys_ioctl_h=yes} + +# cache the sizeof of "standard C types" so that configure can run faster. +ac_cv_sizeof_char=${ac_cv_sizeof_char=1} +ac_cv_sizeof_short=${ac_cv_sizeof_short=2} +ac_cv_sizeof_int=${ac_cv_sizeof_int=4} +ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8} +ac_cv_sizeof___int64=${ac_cv_sizeof___int64=8} +ac_cv_sizeof_float=${ac_cv_sizeof_float=4} +ac_cv_sizeof_double=${ac_cv_sizeof_double=8} +ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=8} +ac_cv_sizeof_int8_t=${ac_cv_sizeof_int8_t=1} +ac_cv_sizeof_uint8_t=${ac_cv_sizeof_uint8_t=1} +ac_cv_sizeof_int_least8_t=${ac_cv_sizeof_int_least8_t=1} +ac_cv_sizeof_uint_least8_t=${ac_cv_sizeof_uint_least8_t=1} +# Do not cache int_fast8_t since the vendor changes often. +ac_cv_sizeof_int16_t=${ac_cv_sizeof_int16_t=2} +ac_cv_sizeof_uint16_t=${ac_cv_sizeof_uint16_t=2} +ac_cv_sizeof_int_least16_t=${ac_cv_sizeof_int_least16_t=2} +ac_cv_sizeof_uint_least16_t=${ac_cv_sizeof_uint_least16_t=2} +# Do not cache int_fast16_t since the vendor changes often. +ac_cv_sizeof_int32_t=${ac_cv_sizeof_int32_t=4} +ac_cv_sizeof_uint32_t=${ac_cv_sizeof_uint32_t=4} +ac_cv_sizeof_int_least32_t=${ac_cv_sizeof_int_least32_t=4} +ac_cv_sizeof_uint_least32_t=${ac_cv_sizeof_uint_least32_t=4} +ac_cv_sizeof_int_fast32_t=${ac_cv_sizeof_int_fast32_t=4} +ac_cv_sizeof_uint_fast32_t=${ac_cv_sizeof_uint_fast32_t=4} +ac_cv_sizeof_int64_t=${ac_cv_sizeof_int64_t=8} +ac_cv_sizeof_uint64_t=${ac_cv_sizeof_uint64_t=8} +ac_cv_sizeof_int_least64_t=${ac_cv_sizeof_int_least64_t=8} +ac_cv_sizeof_uint_least64_t=${ac_cv_sizeof_uint_least64_t=8} +ac_cv_sizeof_int_fast64_t=${ac_cv_sizeof_int_fast64_t=8} +ac_cv_sizeof_uint_fast64_t=${ac_cv_sizeof_uint_fast64_t=8} + +# Don't cache long since it varies between 32 and 64 bits +#ac_cv_sizeof_long=${ac_cv_sizeof_long=4} + +# Don't cache size_t and off_t because they depend on if -D_LARGE_FILES is used +#ac_cv_sizeof_size_t=${ac_cv_sizeof_size_t=4} +#ac_cv_sizeof_off_t=${ac_cv_sizeof_off_t=8} + +# The default Fortran 90 compiler + +if test "X-" = "X-$FC"; then + if test "X-$enable_parallel" = "X-yes"; then + FC=mpxlf90_r + else + FC=xlf90 + fi +fi + +# While we try to avoid setting FCFLAGS directly for use in compilation, in +# this case we need the -k flag present for some configure checks. As such, +# the configure script saves the user's set FCFLAGS before running, and +# restores them when complete. We must then set up both FCFLAGS and H5_FCFLAGS +# to ensure the flag is present for both configure as well as for the build. +if test "X-" = "X-$f9x_flags_set"; then + F9XSUFFIXFLAG="-qsuffix=f=f90" + FCFLAGS="$FCFLAGS -O ${F9XSUFFIXFLAG}" + H5_FCFLAGS="$H5_FCFLAGS -O ${F9XSUFFIXFLAG}" + FSEARCH_DIRS="-I./ -I../src" + DEBUG_FCFLAGS="-O" + PROD_FCFLAGS="-O" + PROFILE_FCFLAGS="-O" + f9x_flags_set=yes +fi + +# With poe version 3.2.0.19 or lower(using lpp -l all | grep ppe.poe to check the version number, +# IBM MPI-IO implementation has a bug, +#it cannot generate correct MPI derived datatype. Please uncomment the following line: +#hdf5_cv_mpi_complex_derived_datatype_works=${hdf5_cv_mpi_complex_derived_datatype_works='no'} + +# The default C++ compiler + +# Use AIX supplied C++ compiler by default. +CXX=${CXX=xlC} + +# Added -qweaksymbol to suppress linker messages warning of duplicate +# symbols; these warnings are harmless. - BMR +# Use -D_LARGE_FILES by default to support large file size. +H5_CXXFLAGS="$H5_CXXFLAGS -qweaksymbol" +AM_CXXFLAGS="$AM_CXXFLAGS -D_LARGE_FILES" + + diff --git a/config/lt_vers.am b/config/lt_vers.am index ea46130..39a4de8 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 = 44 +LT_VERS_REVISION = 49 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/configure b/configure index 5a54439..f6aa0c0 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.in Id: configure.in 17987 2009-12-10 18:43:14Z koziol . +# From configure.in Id: configure.in 18100 2010-01-10 13:33:23Z hdftest . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.64 for HDF5 1.9.54-FA_a4. +# Generated by GNU Autoconf 2.64 for HDF5 1.9.59-FA_a4. # # Report bugs to . # @@ -699,8 +699,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.54-FA_a4' -PACKAGE_STRING='HDF5 1.9.54-FA_a4' +PACKAGE_VERSION='1.9.59-FA_a4' +PACKAGE_STRING='HDF5 1.9.59-FA_a4' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -1571,7 +1571,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.54-FA_a4 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.59-FA_a4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1641,7 +1641,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.54-FA_a4:";; + short | recursive ) echo "Configuration of HDF5 1.9.59-FA_a4:";; esac cat <<\_ACEOF @@ -1828,7 +1828,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.54-FA_a4 +HDF5 configure 1.9.59-FA_a4 generated by GNU Autoconf 2.64 Copyright (C) 2009 Free Software Foundation, Inc. @@ -2912,7 +2912,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.54-FA_a4, which was +It was created by HDF5 $as_me 1.9.59-FA_a4, which was generated by GNU Autoconf 2.64. Invocation command line was $ $0 $@ @@ -3725,7 +3725,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.54-FA_a4' + VERSION='1.9.59-FA_a4' cat >>confdefs.h <<_ACEOF @@ -28847,7 +28847,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.54-FA_a4, which was +This file was extended by HDF5 $as_me 1.9.59-FA_a4, which was generated by GNU Autoconf 2.64. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -28911,7 +28911,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -HDF5 config.status 1.9.54-FA_a4 +HDF5 config.status 1.9.59-FA_a4 configured by $0, generated by GNU Autoconf 2.64, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.in b/configure.in index 88b545d..afa3fc8 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.54-FA_a4], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.59-FA_a4], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AM_CONFIG_HEADER([src/H5config.h]) diff --git a/examples/Makefile.in b/examples/Makefile.in index 9a6dcec..5eb9d55 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -295,12 +295,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -759,7 +759,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -830,7 +830,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in index 818375b..0e2b851 100755 --- a/examples/testh5cc.sh.in +++ b/examples/testh5cc.sh.in @@ -24,6 +24,10 @@ # # Initializations +TESTNAME=h5cc +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + # Where the tool is installed. prefix="${prefix:-@prefix@}" PARALLEL=@PARALLEL@ # Am I in parallel mode? @@ -39,7 +43,7 @@ H5TOOL_BIN="${prefix}/bin/${H5TOOL}" # The path of the tool binary CMP='cmp -s' DIFF='diff -c' -nerrors=0 +nerrors=$EXIT_SUCCESS verbose=${HDF5_VERBOSE:-1} # 0: none; 1: default; 2: chatty; 3: everything test $verbose -gt 2 && set -x H5_NO_DEPRECATED_SYMBOLS=`grep '#define H5_NO_DEPRECATED_SYMBOLS ' ../src/H5pubconf.h` @@ -343,7 +347,9 @@ if test -z "$HDF5_NOCLEANUP"; then fi if test $nerrors -eq 0 ; then - echo "All $H5TOOL tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors diff --git a/fortran/Makefile.in b/fortran/Makefile.in index 65d8c2f..67fce8c 100644 --- a/fortran/Makefile.in +++ b/fortran/Makefile.in @@ -333,12 +333,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -868,7 +868,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -939,7 +939,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in index 684fd92..151bac5 100644 --- a/fortran/examples/Makefile.in +++ b/fortran/examples/Makefile.in @@ -295,12 +295,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -757,7 +757,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -828,7 +828,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/fortran/examples/testh5fc.sh.in b/fortran/examples/testh5fc.sh.in index a25abbe..234d4e2 100755 --- a/fortran/examples/testh5fc.sh.in +++ b/fortran/examples/testh5fc.sh.in @@ -20,6 +20,10 @@ # # Initializations +TESTNAME=h5fc +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + # Where the tool is installed. prefix="${prefix:-@prefix@}" PARALLEL=@PARALLEL@ # Am I in parallel mode? @@ -35,7 +39,7 @@ H5TOOL_BIN="${prefix}/bin/${H5TOOL}" # The path of the tool binary CMP='cmp -s' DIFF='diff -c' -nerrors=0 +nerrors=$EXIT_SUCCESS verbose=yes # setup my machine information. @@ -217,7 +221,9 @@ if test -z "$HDF5_NOCLEANUP"; then fi if test $nerrors -eq 0 ; then - echo "All $H5TOOL tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors diff --git a/fortran/src/H5Af.c b/fortran/src/H5Af.c index 37718b9..939fd81 100644 --- a/fortran/src/H5Af.c +++ b/fortran/src/H5Af.c @@ -1196,32 +1196,27 @@ nh5adelete_by_idx_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, int_f *idx_type, int_f *order, hsize_t_f *n, hid_t_f *lapl_id) { char *c_obj_name = NULL; /* Buffer to hold C string */ - H5_index_t c_idx_type; - H5_iter_order_t c_order; int_f ret_value = 0; /* Return value */ /* * Convert FORTRAN name to C name */ - if((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL) - HGOTO_DONE(FAIL); - - c_idx_type = (H5_index_t)*idx_type; - c_order = (H5_iter_order_t)*order; + if(NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen))) + HGOTO_DONE(FAIL) /* * Call H5Adelete_by_name function. */ - - if(H5Adelete_by_idx((hid_t)*loc_id, c_obj_name, c_idx_type, c_order, (hsize_t)*n, (hid_t)*lapl_id) < 0) - HGOTO_DONE(FAIL); - + if(H5Adelete_by_idx((hid_t)*loc_id, c_obj_name, (H5_index_t)*idx_type, (H5_iter_order_t)*order, (hsize_t)*n, (hid_t)*lapl_id) < 0) + HGOTO_DONE(FAIL) done: if(c_obj_name) HDfree(c_obj_name); + return ret_value; } + /*---------------------------------------------------------------------------- * Name: h5aget_name_by_idx_c * Purpose: Call h5aget_name_by_idx @@ -1264,45 +1259,43 @@ nh5aget_name_by_idx_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, size_t_f *size, hid_t_f *lapl_id) { char *c_obj_name = NULL; /* Buffer to hold C string */ - H5_index_t c_idx_type; - H5_iter_order_t c_order; - int_f ret_value = -1; /* Return value */ ssize_t c_size; size_t c_buf_size; - char *c_buf =NULL; - /* - * Convert FORTRAN name to C name - */ - if((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL) - HGOTO_DONE(FAIL); + char *c_buf = NULL; + int_f ret_value = 0; /* Return value */ - c_idx_type = (H5_index_t)*idx_type; - c_order = (H5_iter_order_t)*order; + /* + * Convert FORTRAN name to C name + */ + if(NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen))) + HGOTO_DONE(FAIL) /* * Allocate buffer to hold name of an attribute */ c_buf_size = (size_t)*size + 1; - c_buf = (char *)HDmalloc(c_buf_size); - if (c_buf == NULL) return ret_value; + if(NULL == (c_buf = (char *)HDmalloc(c_buf_size))) + HGOTO_DONE(FAIL) + /* * Call H5Aget_name_by_idx function. */ - c_size = H5Aget_name_by_idx((hid_t)*loc_id, c_obj_name, c_idx_type, c_order, (hsize_t)*n, c_buf, c_buf_size,(hid_t)*lapl_id); + c_size = H5Aget_name_by_idx((hid_t)*loc_id, c_obj_name, (H5_index_t)*idx_type, (H5_iter_order_t)*order, (hsize_t)*n, c_buf, c_buf_size,(hid_t)*lapl_id); + if(c_size < 0) + HGOTO_DONE(FAIL) - if (c_size < 0) goto done; /* * Convert C name to FORTRAN and place it in the given buffer */ - HD5packFstring(c_buf, _fcdtocp(name), c_buf_size-1); + HD5packFstring(c_buf, _fcdtocp(name), c_buf_size - 1); *size = (size_t_f)c_size; - ret_value = 0; done: if(c_obj_name) - HDfree(c_obj_name); - HDfree(c_buf); + HDfree(c_obj_name); + if(c_buf) + HDfree(c_buf); return ret_value; } @@ -1339,27 +1332,24 @@ nh5aopen_by_idx_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, int_f *idx_type, int_f *order, hsize_t_f *n, hid_t_f *aapl_id, hid_t_f *lapl_id, hid_t_f *attr_id ) { char *c_obj_name = NULL; /* Buffer to hold C string */ - H5_index_t c_idx_type; - H5_iter_order_t c_order; int_f ret_value = 0; /* Return value */ - /* - * Convert FORTRAN name to C name - */ - if((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL) - HGOTO_DONE(FAIL); - - c_idx_type = (H5_index_t)*idx_type; - c_order = (H5_iter_order_t)*order; + /* + * Convert FORTRAN name to C name + */ + if(NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen))) + HGOTO_DONE(FAIL) /* * Call H5Aopen_by_idx function. */ - if((*attr_id = (hid_t_f)H5Aopen_by_idx((hid_t)*loc_id, c_obj_name, c_idx_type, c_order, (hsize_t)*n, (hid_t)*aapl_id, (hid_t)*lapl_id)) < 0) - HGOTO_DONE(FAIL); + if((*attr_id = (hid_t_f)H5Aopen_by_idx((hid_t)*loc_id, c_obj_name, (H5_index_t)*idx_type, (H5_iter_order_t)*order, (hsize_t)*n, (hid_t)*aapl_id, (hid_t)*lapl_id)) < 0) + HGOTO_DONE(FAIL) + done: if(c_obj_name) HDfree(c_obj_name); + return ret_value; } @@ -1445,36 +1435,34 @@ nh5aget_info_by_idx_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, int_f *cset, hsize_t_f *data_size ) { char *c_obj_name = NULL; /* Buffer to hold C string */ - H5_index_t c_idx_type; - H5_iter_order_t c_order; - int_f ret_value = 0; /* Return value */ H5A_info_t ainfo; + int_f ret_value = 0; /* Return value */ /* * Convert FORTRAN name to C name */ - if((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL) - HGOTO_DONE(FAIL); + if(NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen))) + HGOTO_DONE(FAIL) - c_idx_type = (H5_index_t)*idx_type; - c_order = (H5_iter_order_t)*order; /* * Call H5Ainfo_by_idx function. */ - if(H5Aget_info_by_idx((hid_t)*loc_id, c_obj_name, c_idx_type, c_order, (hsize_t)*n, - &ainfo, (hid_t)*lapl_id) < 0) - HGOTO_DONE(FAIL); + if(H5Aget_info_by_idx((hid_t)*loc_id, c_obj_name, (H5_index_t)*idx_type, (H5_iter_order_t)*order, (hsize_t)*n, + &ainfo, (hid_t)*lapl_id) < 0) + HGOTO_DONE(FAIL) /* Unpack the structure */ - *corder_valid = 0; - if(ainfo.corder_valid > 0) *corder_valid = 1; - + if(ainfo.corder_valid > 0) + *corder_valid = 1; *corder = (int_f)ainfo.corder; *cset = (int_f)ainfo.cset; *data_size = (hsize_t)ainfo.data_size; done: + if(c_obj_name) + HDfree(c_obj_name); + return ret_value; } @@ -1506,34 +1494,37 @@ nh5aget_info_by_name_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, { char *c_obj_name = NULL; /* Buffer to hold C string */ char *c_attr_name = NULL; /* Buffer to hold C string */ - int_f ret_value = 0; /* Return value */ H5A_info_t ainfo; + int_f ret_value = 0; /* Return value */ /* * Convert FORTRAN name to C name */ - if((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL) - HGOTO_DONE(FAIL); - if((c_attr_name = HD5f2cstring(attr_name, (size_t)*attr_namelen)) == NULL) - HGOTO_DONE(FAIL); + if(NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen))) + HGOTO_DONE(FAIL) + if(NULL == (c_attr_name = HD5f2cstring(attr_name, (size_t)*attr_namelen))) + HGOTO_DONE(FAIL) /* * Call H5Ainfo_by_name function. */ - if(H5Aget_info_by_name((hid_t)*loc_id, c_obj_name, c_attr_name, - &ainfo, (hid_t)*lapl_id) < 0) - HGOTO_DONE(FAIL); + if(H5Aget_info_by_name((hid_t)*loc_id, c_obj_name, c_attr_name, &ainfo, (hid_t)*lapl_id) < 0) + HGOTO_DONE(FAIL) /* Unpack the structure */ - *corder_valid = 0; - if(ainfo.corder_valid > 0) *corder_valid = 1; - + if(ainfo.corder_valid > 0) + *corder_valid = 1; *corder = (int_f)ainfo.corder; *cset = (int_f)ainfo.cset; *data_size = (hsize_t)ainfo.data_size; done: + if(c_obj_name) + HDfree(c_obj_name); + if(c_attr_name) + HDfree(c_attr_name); + return ret_value; } diff --git a/fortran/src/H5Ef.c b/fortran/src/H5Ef.c index d3983af..4f9d652 100644 --- a/fortran/src/H5Ef.c +++ b/fortran/src/H5Ef.c @@ -16,7 +16,7 @@ /* This files contains C stubs for H5E Fortran APIs */ #include "H5f90.h" - +#include "H5Eprivate.h" /*---------------------------------------------------------------------------- * Name: h5eclear_c @@ -30,18 +30,18 @@ *---------------------------------------------------------------------------*/ int_f -nh5eclear_c( ) +nh5eclear_c(void) { - int ret_val = -1; - herr_t status; - - /* - * Call H5Eclear function. - */ - status = H5Eclear2(H5E_DEFAULT); - if(status < 0) return ret_val; - ret_val = 0; - return ret_val; + int_f ret_value = 0; + + /* + * Call H5Eclear function. + */ + if(H5Eclear2(H5E_DEFAULT) < 0) + HGOTO_DONE(FAIL) + +done: + return ret_value; } /*---------------------------------------------------------------------------- @@ -59,26 +59,28 @@ nh5eclear_c( ) int_f nh5eprint_c1(_fcd name, int_f* namelen) { - int ret_val = -1; - herr_t status; - FILE * file; - char* c_name; - size_t c_namelen; - c_namelen = *namelen; - c_name = (char*)HD5f2cstring(name, c_namelen); - if(c_name == NULL) return ret_val; - file = fopen(c_name, "a"); - if(!file) goto DONE; - /* - * Call H5Eprint2 function. - */ - status = H5Eprint2(H5E_DEFAULT, file); - if (status >=0 ) ret_val = 0; - fclose(file); - -DONE: - HDfree(c_name); - return ret_val; + FILE *file = NULL; + char *c_name = NULL; + int_f ret_value = 0; + + if(NULL == (c_name = (char*)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) + if(NULL == (file = HDfopen(c_name, "a"))) + HGOTO_DONE(FAIL) + + /* + * Call H5Eprint2 function. + */ + if(H5Eprint2(H5E_DEFAULT, file) < 0) + HGOTO_DONE(FAIL) + +done: + if(file) + HDfclose(file); + if(c_name) + HDfree(c_name); + + return ret_value; } @@ -94,17 +96,18 @@ DONE: * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5eprint_c2() +nh5eprint_c2(void) { - int ret_val = -1; - herr_t status; - - /* - * Call H5Eprint2 function. - */ - status = H5Eprint2(H5E_DEFAULT, NULL); - if(status >= 0) ret_val = 0; - return ret_val; + int_f ret_value = 0; + + /* + * Call H5Eprint2 function. + */ + if(H5Eprint2(H5E_DEFAULT, NULL) < 0) + HGOTO_DONE(FAIL) + +done: + return ret_value; } /*---------------------------------------------------------------------------- @@ -121,24 +124,28 @@ nh5eprint_c2() int_f nh5eget_major_c(int_f* error_no, _fcd name, size_t_f* namelen) { - int ret_val = -1; - char *c_name = NULL; - size_t c_namelen; - hid_t c_error_no; - c_error_no = (hid_t)*error_no; - - c_namelen = (size_t)*namelen; - if(c_namelen) c_name = (char*) HDmalloc(c_namelen + 1); - - /* - * Call H5Eget_major function. - */ - H5Eget_msg(c_error_no, NULL, c_name, c_namelen); - HD5packFstring((char*)c_name, _fcdtocp(name), c_namelen); - - if(!strcmp(c_name, "Invalid major error number")) return ret_val; - ret_val = 0; - return ret_val; + char *c_name = NULL; + size_t c_namelen = (size_t)*namelen; + int_f ret_value = 0; + + if(c_namelen) { + if(NULL == (c_name = (char *)HDmalloc(c_namelen + 1))) + HGOTO_DONE(FAIL) + } /* end if */ + + /* + * Call H5Eget_major function. + */ + H5Eget_msg((hid_t)*error_no, NULL, c_name, c_namelen); + HD5packFstring((char*)c_name, _fcdtocp(name), c_namelen); + if(!HDstrcmp(c_name, "Invalid major error number")) + HGOTO_DONE(FAIL) + +done: + if(c_name) + HDfree(c_name); + + return ret_value; } /*---------------------------------------------------------------------------- @@ -155,24 +162,28 @@ nh5eget_major_c(int_f* error_no, _fcd name, size_t_f* namelen) int_f nh5eget_minor_c(int_f* error_no, _fcd name, size_t_f* namelen) { - int ret_val = -1; - char *c_name = NULL; - size_t c_namelen; - hid_t c_error_no; - c_error_no = (hid_t)*error_no; - - c_namelen = (size_t)*namelen; - if(c_namelen) c_name = (char*) HDmalloc(c_namelen + 1); - - /* - * Call H5Eget_minor function. - */ - H5Eget_msg(c_error_no, NULL, c_name, c_namelen); - HD5packFstring((char*)c_name, _fcdtocp(name), c_namelen); - - if(!strcmp(c_name, "Invalid minor error number")) return ret_val; - ret_val = 0; - return ret_val; + char *c_name = NULL; + size_t c_namelen = (size_t)*namelen; + int_f ret_value = 0; + + if(c_namelen) { + if(NULL == (c_name = (char *)HDmalloc(c_namelen + 1))) + HGOTO_DONE(FAIL) + } /* end if */ + + /* + * Call H5Eget_minor function. + */ + H5Eget_msg((hid_t)*error_no, NULL, c_name, c_namelen); + HD5packFstring((char *)c_name, _fcdtocp(name), c_namelen); + if(!HDstrcmp(c_name, "Invalid minor error number")) + HGOTO_DONE(FAIL) + +done: + if(c_name) + HDfree(c_name); + + return ret_value; } /*---------------------------------------------------------------------------- @@ -188,13 +199,17 @@ nh5eget_minor_c(int_f* error_no, _fcd name, size_t_f* namelen) int_f nh5eset_auto_c(int_f* printflag) { - int ret_val = -1; - herr_t status = -1; - - if (*printflag == 1) - status = H5Eset_auto2(H5E_DEFAULT, H5Eprint2, stderr); - else if (*printflag == 0) - status = H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - if (status >= 0) ret_val = 0; - return ret_val; + herr_t status = -1; + int_f ret_value = 0; + + if(*printflag == 1) + status = H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)H5Eprint2, stderr); + else if(*printflag == 0) + status = H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + if(status < 0) + HGOTO_DONE(FAIL) + +done: + return ret_value; } + diff --git a/fortran/src/H5Lf.c b/fortran/src/H5Lf.c index 2832d44..4d3e31c 100644 --- a/fortran/src/H5Lf.c +++ b/fortran/src/H5Lf.c @@ -44,30 +44,30 @@ nh5lcopy_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_namelen, hid_t_f *d _fcd dest_name, size_t_f *dest_namelen, hid_t_f *lcpl_id, hid_t_f *lapl_id) { - char *c_src_name = NULL; - char *c_dest_name = NULL; - int ret_value = 0; + char *c_src_name = NULL; + char *c_dest_name = NULL; + int_f ret_value = 0; - /* - * Convert FORTRAN name to C name - */ - if((c_src_name = HD5f2cstring(src_name, (size_t)*src_namelen)) == NULL) - HGOTO_DONE(FAIL); - if((c_dest_name = HD5f2cstring(dest_name, (size_t)*dest_namelen)) == NULL) - HGOTO_DONE(FAIL); + /* + * Convert FORTRAN name to C name + */ + if(NULL == (c_src_name = HD5f2cstring(src_name, (size_t)*src_namelen))) + HGOTO_DONE(FAIL) + if(NULL == (c_dest_name = HD5f2cstring(dest_name, (size_t)*dest_namelen))) + HGOTO_DONE(FAIL) - /* - * Call H5Lcopy function. - */ - if( H5Lcopy( (hid_t)*src_loc_id, c_src_name, (hid_t) *dest_loc_id, - c_dest_name, (hid_t)*lcpl_id, (hid_t)*lapl_id ) < 0) - HGOTO_DONE(FAIL); + /* + * Call H5Lcopy function. + */ + if(H5Lcopy((hid_t)*src_loc_id, c_src_name, (hid_t) *dest_loc_id, + c_dest_name, (hid_t)*lcpl_id, (hid_t)*lapl_id ) < 0) + HGOTO_DONE(FAIL) done: - if(c_src_name) - HDfree(c_src_name); - if(c_dest_name) - HDfree(c_dest_name); + if(c_src_name) + HDfree(c_src_name); + if(c_dest_name) + HDfree(c_dest_name); return ret_value; } @@ -99,7 +99,7 @@ nh5lcreate_external_c(_fcd file_name, size_t_f *file_namelen, _fcd obj_name, siz char *c_file_name = NULL; char *c_obj_name = NULL; char *c_link_name = NULL; - int ret_value = 0; + int_f ret_value = 0; /* * Convert FORTRAN name to C name @@ -149,7 +149,7 @@ int_f nh5ldelete_c ( hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id ) { char *c_name = NULL; - int ret_value = 0; + int_f ret_value = 0; /* * Convert FORTRAN name to C name @@ -195,7 +195,7 @@ nh5lcreate_soft_c(_fcd target_path, size_t_f *target_path_len, { char *c_target_path = NULL; char *c_link_name = NULL; - int ret_value = 0; + int_f ret_value = 0; /* * Convert FORTRAN name to C name @@ -247,7 +247,7 @@ nh5lcreate_hard_c(hid_t_f *obj_loc_id, _fcd obj_name, size_t_f *obj_namelen, { char *c_obj_name = NULL; char *c_link_name = NULL; - int ret_value = 0; + int_f ret_value = 0; /* * Convert FORTRAN name to C name @@ -400,8 +400,8 @@ nh5lget_info_c (hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, hid_t_f *lapl_id) { char *c_link_name = NULL; /* Buffer to hold C string */ - int_f ret_value = 0; /* Return value */ H5L_info_t link_buff; + int_f ret_value = 0; /* Return value */ /* * Convert FORTRAN name to C name @@ -456,31 +456,26 @@ nh5lget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, int_f *link_type, int_f *corder_valid, int_f *corder, int_f *cset, haddr_t_f *address, size_t_f *val_size, hid_t_f *lapl_id) { char *c_group_name = NULL; /* Buffer to hold C string */ - H5_index_t c_index_field; - H5_iter_order_t c_order; - int_f ret_value = 0; /* Return value */ H5L_info_t link_buff; + int_f ret_value = 0; /* Return value */ /* * Convert FORTRAN name to C name */ - if((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL) - HGOTO_DONE(FAIL); + if(NULL == (c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen))) + HGOTO_DONE(FAIL) - c_index_field = (H5_index_t)*index_field; - c_order = (H5_iter_order_t)*order; /* * Call H5Linfo_by_idx function. */ - if(H5Lget_info_by_idx((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, + if(H5Lget_info_by_idx((hid_t)*loc_id, c_group_name, (H5_index_t)*index_field, (H5_iter_order_t)*order, (hsize_t)*n, &link_buff, (hid_t)*lapl_id) < 0) - HGOTO_DONE(FAIL); + HGOTO_DONE(FAIL) /* Unpack the structure */ - *corder_valid = 0; - if(link_buff.corder_valid > 0) *corder_valid = 1; - + if(link_buff.corder_valid > 0) + *corder_valid = 1; *corder = (int_f)link_buff.corder; *cset = (int_f)link_buff.cset; *link_type = (int_f)link_buff.type; @@ -488,6 +483,9 @@ nh5lget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, *val_size = (size_t_f)link_buff.u.val_size; done: + if(c_group_name) + HDfree(c_group_name); + return ret_value; } @@ -507,20 +505,14 @@ done: int_f nh5lis_registered_c(int_f *link_cls_id) { - int_f ret_value = 0; /* Return value */ - H5L_type_t c_link_cls_id; /* User-defined link class identifier */ - htri_t registered; /* registration status */ - + int_f ret_value; /* Return value */ - c_link_cls_id = (H5L_type_t)*link_cls_id; - /* - * Call H5Lis_registered - */ - registered = H5Lis_registered(c_link_cls_id); - - ret_value = (int_f)registered; + /* + * Call H5Lis_registered + */ + ret_value = (int_f)H5Lis_registered((H5L_type_t)*link_cls_id); - return ret_value; + return ret_value; } @@ -553,18 +545,24 @@ nh5lmove_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_namelen, hid_t_f *d /* * Convert FORTRAN name to C name */ - if((c_src_name = HD5f2cstring(src_name, (size_t)*src_namelen)) == NULL) - HGOTO_DONE(FAIL); - if((c_dest_name = HD5f2cstring(dest_name, (size_t)*dest_namelen)) == NULL) - HGOTO_DONE(FAIL); + if(NULL == (c_src_name = HD5f2cstring(src_name, (size_t)*src_namelen))) + HGOTO_DONE(FAIL) + if(NULL == (c_dest_name = HD5f2cstring(dest_name, (size_t)*dest_namelen))) + HGOTO_DONE(FAIL) /* * Call H5Lmove function. */ if(H5Lmove((hid_t)*src_loc_id, c_src_name, (hid_t)*dest_loc_id, c_dest_name, (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0) - HGOTO_DONE(FAIL); + HGOTO_DONE(FAIL) + done: + if(c_src_name) + HDfree(c_src_name); + if(c_dest_name) + HDfree(c_dest_name); + return ret_value; } @@ -594,85 +592,43 @@ nh5lget_name_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, { char *c_group_name = NULL; /* Buffer to hold C string */ char *c_name = NULL; /* Buffer to hold C string */ - int_f ret_value = 0; /* Return value */ size_t c_size; + int_f ret_value = 0; /* Return value */ /* * Convert FORTRAN name to C name */ - if((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL) - HGOTO_DONE(FAIL); + if(NULL == (c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen))) + HGOTO_DONE(FAIL) c_size = (size_t)*size + 1; - /* - * Allocate buffer to hold name of an attribute - */ + + /* + * Allocate buffer to hold name of an attribute + */ if ((c_name = HDmalloc(c_size)) == NULL) - HGOTO_DONE(FAIL); + HGOTO_DONE(FAIL) if((*size = (size_t)H5Lget_name_by_idx((hid_t)*loc_id, c_group_name, (H5_index_t)*index_field, - (H5_iter_order_t)*order, (hsize_t)*n,c_name, c_size, (hid_t)*lapl_id)) < 0) - HGOTO_DONE(FAIL); + (H5_iter_order_t)*order, (hsize_t)*n,c_name, c_size, (hid_t)*lapl_id)) < 0) + HGOTO_DONE(FAIL) /* * Convert C name to FORTRAN and place it in the given buffer */ - if(c_name != NULL) - HD5packFstring(c_name, _fcdtocp(name), c_size-1); + if(c_name) + HD5packFstring(c_name, _fcdtocp(name), c_size - 1); + done: - if(c_group_name) HDfree(c_group_name); - if(c_name) HDfree(c_name); + if(c_group_name) + HDfree(c_group_name); + if(c_name) + HDfree(c_name); + return ret_value; } /*---------------------------------------------------------------------------- - * Name: h5lget_val_c - * Purpose: Call H5Lget_val - * Inputs: - * link_loc_id - File or group identifier. - * link_name - Name of the link for which valrmation is being sought - * link_namelen - Name length - * size - Maximum number of characters of link value to be returned. - * lapl_id - Link access property list - * Outputs: - * linkval_buff - The buffer to hold the returned link value. - * - * Returns: 0 on success, -1 on failure - * Programmer: M.S. Breitenfeld - * March 3, 2008 - * Modifications: N/A - *---------------------------------------------------------------------------*/ -/* int_f */ -/* nh5lget_val_c (hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, */ -/* size_t_f *size, _fcd linkval_buff, */ -/* hid_t_f *lapl_id) */ -/* { */ -/* char *c_link_name = NULL; /\* Buffer to hold C string *\/ */ -/* int_f ret_value = 0; /\* Return value *\/ */ -/* void *c_linkval_buff = NULL; */ - -/* /\* */ -/* * Convert FORTRAN name to C name */ -/* *\/ */ -/* if((c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)) == NULL) */ -/* HGOTO_DONE(FAIL); */ -/* /\* */ -/* * Call H5Lval function. */ -/* *\/ */ -/* if(H5Lget_val((hid_t)*link_loc_id, c_link_name, &linkval_buff, (size_t)*size, (hid_t)*lapl_id) < 0) */ -/* HGOTO_DONE(FAIL); */ -/* /\* */ -/* * Convert C name to FORTRAN */ -/* *\/ */ -/* HD5packFstring(c_buf, _fcdtocp(buf), c_bufsize-1); */ - - -/* done: */ -/* return ret_value; */ -/* } */ - - -/*---------------------------------------------------------------------------- * Name: H5Lregistered_c * Purpose: Call H5Lregistered * Inputs: @@ -796,24 +752,25 @@ int_f nh5lget_val_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, size_t_f *size, void *linkval_buff, hid_t_f *lapl_id) { - int_f ret_value = 0; /* Return value */ - char *c_link_name = NULL; /* Buffer to hold C string */ + char *c_link_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ - /* - * Convert FORTRAN name to C name - */ - if((c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)) == NULL) - HGOTO_DONE(FAIL); - - /* - * Call H5Lget_val - */ + /* + * Convert FORTRAN name to C name + */ + if(NULL == (c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen))) + HGOTO_DONE(FAIL) - if(H5Lget_val( (hid_t)*link_loc_id, c_link_name, &linkval_buff, (size_t)*size, (hid_t)*lapl_id )< 0) - HGOTO_DONE(FAIL); + /* + * Call H5Lget_val + */ + if(H5Lget_val((hid_t)*link_loc_id, c_link_name, &linkval_buff, (size_t)*size, (hid_t)*lapl_id )< 0) + HGOTO_DONE(FAIL) done: + if(c_link_name) + HDfree(c_link_name); + return ret_value; } - diff --git a/fortran/src/H5Lff.f90 b/fortran/src/H5Lff.f90 index 2f359e9..e38dade 100644 --- a/fortran/src/H5Lff.f90 +++ b/fortran/src/H5Lff.f90 @@ -576,10 +576,10 @@ CONTAINS ! corder - specifies the link’s creation order position. !f_corder_valid - indicates whether the value in corder is valid. ! link_type - specifies the link class: -! H5L_LINK_HARD_F - Hard link -! H5L_LINK_SOFT_F - Soft link -! H5L_LINK_EXTERNAL_F - External link -! H5L_LINK_ERROR_ F - Error +! H5L_TYPE_HARD_F - Hard link +! H5L_TYPE_SOFT_F - Soft link +! H5L_TYPE_EXTERNAL_F - External link +! H5L_TYPE_ERROR_F - Error ! address - If the link is a hard link, address specifies the file address that the link points to ! val_size - If the link is a symbolic link, val_size will be the length of the link value, e.g., ! the length of the name of the pointed-to object with a null terminator. @@ -592,7 +592,12 @@ CONTAINS ! Programmer: M. S. Breitenfeld ! February 29, 2008 ! -! Modifications: N/A +! Modifications: +! Changed the link_type names to match those in C (bug 1720) from, +! H5L_LINK_HARD_F, H5L_LINK_SOFT_F,H5L_LINK_EXTERNAL_F,H5L_LINK_ERROR_F +! to +! H5L_TYPE_HARD_F, H5L_TYPE_SOFT_F,H5L_TYPE_EXTERNAL_F,H5L_TYPE_ERROR_F +! MSB January 8, 2010. ! !---------------------------------------------------------------------- @@ -609,10 +614,10 @@ CONTAINS INTEGER, INTENT(OUT) :: corder ! Specifies the link’s creation order position. LOGICAL, INTENT(OUT) :: f_corder_valid ! Indicates whether the value in corder is valid. INTEGER, INTENT(OUT) :: link_type ! Specifies the link class: - ! H5L_LINK_HARD_F - Hard link - ! H5L_LINK_SOFT_F - Soft link - ! H5L_LINK_EXTERNAL_F - External link - ! H5L_LINK_ERROR _F - Error + ! H5L_TYPE_HARD_F - Hard link + ! H5L_TYPE_SOFT_F - Soft link + ! H5L_TYPE_EXTERNAL_F - External link + ! H5L_TYPE_ERROR _F - Error INTEGER(HADDR_T), INTENT(OUT) :: address ! If the link is a hard link, address specifies the file address that the link points to INTEGER(SIZE_T), INTENT(OUT) :: val_size ! If the link is a symbolic link, val_size will be the length of the link value, e.g., ! the length of the name of the pointed-to object with a null terminator. @@ -691,7 +696,12 @@ CONTAINS ! Programmer: M.S. Breitenfeld ! February 29, 2008 ! -! Modifications: N/A +! Modifications: +! Changed the link_type names to match those in C (bug 1720) from, +! H5L_LINK_HARD_F, H5L_LINK_SOFT_F,H5L_LINK_EXTERNAL_F,H5L_LINK_ERROR_F +! to +! H5L_TYPE_HARD_F, H5L_TYPE_SOFT_F,H5L_TYPE_EXTERNAL_F,H5L_TYPE_ERROR_F +! MSB January 8, 2010. ! !---------------------------------------------------------------------- SUBROUTINE h5lget_info_by_idx_f(loc_id, group_name, index_field, order, n, & @@ -711,10 +721,10 @@ CONTAINS ! H5_ITER_NATIVE_F - No particular order, whatever is fastest INTEGER(HSIZE_T), INTENT(IN) :: n ! Attribute’s position in index INTEGER, INTENT(OUT) :: link_type ! Specifies the link class: - ! H5L_LINK_HARD_F - Hard link - ! H5L_LINK_SOFT_F - Soft link - ! H5L_LINK_EXTERNAL_F - External link - ! H5L_LINK_ERROR _F - Error + ! H5L_TYPE_HARD_F - Hard link + ! H5L_TYPE_SOFT_F - Soft link + ! H5L_TYPE_EXTERNAL_F - External link + ! H5L_TYPE_ERROR _F - Error LOGICAL, INTENT(OUT) :: f_corder_valid ! Indicates whether the creation order data is valid for this attribute INTEGER, INTENT(OUT) :: corder ! Is a positive integer containing the creation order of the attribute INTEGER, INTENT(OUT) :: cset ! Indicates the character set used for the attribute’s name diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 0929d7a..ee2145d 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -17,6 +17,7 @@ /* This files contains C stubs for H5P Fortran APIs */ #include "H5f90.h" +#include "H5Eprivate.h" /*---------------------------------------------------------------------------- * Name: h5pcreate_c @@ -32,16 +33,17 @@ int_f nh5pcreate_c ( hid_t_f *class, hid_t_f *prp_id ) { - hid_t c_class; - int ret_value = 0; - hid_t c_prp_id; + hid_t c_prp_id; + int_f ret_value = 0; - c_class = (hid_t)*class; - c_prp_id = H5Pcreate(c_class); + c_prp_id = H5Pcreate((hid_t)*class); + if(c_prp_id < 0) + HGOTO_DONE(FAIL) - if ( c_prp_id < 0 ) ret_value = -1; - *prp_id = (hid_t_f)c_prp_id; - return ret_value; + *prp_id = (hid_t_f)c_prp_id; + +done: + return ret_value; } /*---------------------------------------------------------------------------- @@ -57,11 +59,12 @@ nh5pcreate_c ( hid_t_f *class, hid_t_f *prp_id ) int_f nh5pclose_c ( hid_t_f *prp_id ) { - int ret_value = 0; - hid_t c_prp_id=(*prp_id); + int_f ret_value = 0; - if ( H5Pclose(c_prp_id) < 0 ) ret_value = -1; - return ret_value; + if(H5Pclose((hid_t)*prp_id) < 0) + ret_value = -1; + + return ret_value; } @@ -79,15 +82,17 @@ nh5pclose_c ( hid_t_f *prp_id ) int_f nh5pcopy_c ( hid_t_f *prp_id , hid_t_f *new_prp_id) { - int ret_value = 0; - hid_t c_prp_id; - hid_t c_new_prp_id; + hid_t c_new_prp_id; + int_f ret_value = 0; - c_prp_id = *prp_id; - c_new_prp_id = H5Pcopy(c_prp_id); - if ( c_new_prp_id < 0 ) ret_value = -1; - *new_prp_id = (hid_t_f)c_new_prp_id; - return ret_value; + c_new_prp_id = H5Pcopy((hid_t)*prp_id); + if(c_new_prp_id < 0) + HGOTO_DONE(FAIL) + + *new_prp_id = (hid_t_f)c_new_prp_id; + +done: + return ret_value; } /*---------------------------------------------------------------------------- @@ -105,17 +110,17 @@ nh5pcopy_c ( hid_t_f *prp_id , hid_t_f *new_prp_id) int_f nh5pequal_c ( hid_t_f *plist1_id , hid_t_f *plist2_id, int_f * c_flag) { - int ret_value = 0; - hid_t c_plist1_id; - hid_t c_plist2_id; - htri_t c_c_flag; - - c_plist1_id = (hid_t)*plist1_id; - c_plist2_id = (hid_t)*plist2_id; - c_c_flag = H5Pequal(c_plist1_id, c_plist2_id); - if ( c_c_flag < 0 ) ret_value = -1; - *c_flag = (int_f)c_c_flag; - return ret_value; + htri_t c_c_flag; + int_f ret_value = 0; + + c_c_flag = H5Pequal((hid_t)*plist1_id, (hid_t)*plist2_id); + if(c_c_flag < 0) + HGOTO_DONE(FAIL) + + *c_flag = (int_f)c_c_flag; + +done: + return ret_value; } @@ -139,20 +144,19 @@ nh5pequal_c ( hid_t_f *plist1_id , hid_t_f *plist2_id, int_f * c_flag) int_f nh5pget_class_c ( hid_t_f *prp_id , int_f *classtype) { - int ret_value = 0; - hid_t c_prp_id; - hid_t c_classtype; + hid_t c_classtype; + int_f ret_value = 0; - c_prp_id = *prp_id; - c_classtype = H5Pget_class(c_prp_id); - if (c_classtype == H5P_ROOT ) { + c_classtype = H5Pget_class((hid_t)*prp_id); + if(c_classtype == H5P_ROOT) { *classtype = H5P_ROOT; - ret_value = -1; - return ret_value; - } - *classtype = (int_f)c_classtype; + HGOTO_DONE(FAIL) + } - return ret_value; + *classtype = (int_f)c_classtype; + +done: + return ret_value; } /*---------------------------------------------------------------------------- @@ -3962,33 +3966,39 @@ nh5pget_copy_object_c(hid_t_f *ocp_plist_id, int_f *copy_options) int_f nh5pget_data_transform_c(hid_t_f *plist_id, _fcd expression, int_f *expression_len, size_t_f *size) { - int_f ret_value = -1; - char *c_expression = NULL; /* Buffer to hold C string */ - size_t c_expression_len; - ssize_t ret; + char *c_expression = NULL; /* Buffer to hold C string */ + size_t c_expression_len; + ssize_t ret; + int_f ret_value = 0; + c_expression_len = (size_t)*expression_len + 1; - c_expression_len = (size_t)*expression_len + 1; + /* + * Allocate memory to store the expression. + */ + if(c_expression_len) { + c_expression = (char*)HDmalloc(c_expression_len); + if(NULL == c_expression) + HGOTO_DONE(FAIL) + } /* end if */ - /* should expression_len be size_t_f? */ - /* - * Allocate memory to store the expression. - */ - if( c_expression_len) c_expression = (char*) HDmalloc(c_expression_len); - if (c_expression == NULL) return ret_value; + /* + * Call H5Pget_data_transform function. + */ + ret = H5Pget_data_transform((hid_t)*plist_id, c_expression, c_expression_len); + if(ret < 0) + HGOTO_DONE(FAIL) - /* - * Call h5pget_data_transform function. - */ - ret = H5Pget_data_transform((hid_t)*plist_id, c_expression, c_expression_len); - if(ret < 0) return ret_value; - /* or strlen ? */ - HD5packFstring(c_expression, _fcdtocp(expression), c_expression_len-1); + /* or strlen ? */ + HD5packFstring(c_expression, _fcdtocp(expression), c_expression_len - 1); - *size = (size_t_f)ret; + *size = (size_t_f)ret; - ret_value = 0; - return ret_value; +done: + if(c_expression) + HDfree(c_expression); + + return ret_value; } /*---------------------------------------------------------------------------- @@ -4012,23 +4022,24 @@ nh5pget_data_transform_c(hid_t_f *plist_id, _fcd expression, int_f *expression_l int_f nh5pset_data_transform_c(hid_t_f *plist_id, _fcd expression, int_f *expression_len) { - int_f ret_value = -1; /* Return value */ char* c_expression = NULL; /* Buffer to hold C string */ - herr_t ret; + int_f ret_value = 0; /* Return value */ + /* * Convert FORTRAN name to C name */ if(NULL == (c_expression = HD5f2cstring(expression, (size_t)*expression_len))) - return ret_value; + HGOTO_DONE(FAIL) + /* - * Call h5pset_data_transform function. + * Call H5Pset_data_transform function. */ - ret = H5Pset_data_transform((hid_t)*plist_id, c_expression); - if(ret<0) return ret_value; + if(H5Pset_data_transform((hid_t)*plist_id, c_expression) < 0) + HGOTO_DONE(FAIL) - ret_value = 0; - if(c_expression) - HDfree(c_expression); +done: + if(c_expression) + HDfree(c_expression); return ret_value; } diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c index da3db6e..9b0356f 100644 --- a/fortran/src/H5Sf.c +++ b/fortran/src/H5Sf.c @@ -14,6 +14,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "H5f90.h" +#include "H5Eprivate.h" /*---------------------------------------------------------------------------- * Name: h5screate_simple_c @@ -31,37 +32,30 @@ int_f nh5screate_simple_c ( int_f *rank, hsize_t_f *dims, hsize_t_f *maxdims, hid_t_f *space_id ) { - int ret_value = -1; - hsize_t *c_dims; - hsize_t *c_maxdims; - hid_t c_space_id; - int i; - - c_dims = malloc(sizeof(hsize_t) * (*rank )); - if (!c_dims) return ret_value; - c_maxdims = malloc(sizeof(hsize_t) * (*rank )); - if (!c_maxdims) return ret_value; - - /* - * Transpose dimension arrays because of C-FORTRAN storage order - */ - for (i = 0; i < *rank ; i++) { - c_dims[i] = dims[*rank - i - 1]; - c_maxdims[i] = maxdims[*rank - i - 1]; - } - - c_space_id = H5Screate_simple(*rank, c_dims, c_maxdims); - if (c_space_id < 0) return ret_value; - - *space_id = (hid_t_f)c_space_id; - ret_value = 0; - HDfree (c_dims); - HDfree (c_maxdims); - return ret_value; + hsize_t c_dims[H5S_MAX_RANK]; + hsize_t c_maxdims[H5S_MAX_RANK]; + hid_t c_space_id; + int i; + int_f ret_value = 0; + + /* + * Transpose dimension arrays because of C-FORTRAN storage order + */ + for(i = 0; i < *rank ; i++) { + c_dims[i] = dims[*rank - i - 1]; + c_maxdims[i] = maxdims[*rank - i - 1]; + } /* end for */ + + c_space_id = H5Screate_simple(*rank, c_dims, c_maxdims); + if(c_space_id < 0) + HGOTO_DONE(FAIL) + + *space_id = (hid_t_f)c_space_id; + +done: + return ret_value; } - - /*---------------------------------------------------------------------------- * Name: h5sclose_c * Purpose: Call H5Sclose to close the dataspace @@ -282,33 +276,27 @@ nh5sget_select_hyper_blocklist_c( hid_t_f *space_id ,hsize_t_f * startblock, int_f nh5sget_select_bounds_c( hid_t_f *space_id , hsize_t_f * start, hsize_t_f * end) { - int ret_value = -1; - hid_t c_space_id; - hsize_t* c_start, *c_end; - int i, rank; - - c_space_id = *space_id; - rank = H5Sget_simple_extent_ndims(c_space_id); - if (rank < 0 ) return ret_value; - - c_start =(hsize_t*) malloc(sizeof(hsize_t)*rank); - if (!c_start) return ret_value; - - c_end = (hsize_t*)malloc(sizeof(hsize_t)*rank); - if(!c_end) return ret_value; - - ret_value = H5Sget_select_bounds(c_space_id, c_start, c_end); - for(i = 0; i < rank; i++) - { - start[i] = (hsize_t_f)(c_start[rank-i-1]+1); - end[i] = (hsize_t_f)(c_end[rank-i-1]+1); - } - if (ret_value >= 0 ) ret_value = 0; - - HDfree(c_start); - HDfree(c_end); - - return ret_value; + hid_t c_space_id; + hsize_t c_start[H5S_MAX_RANK]; + hsize_t c_end[H5S_MAX_RANK]; + int i, rank; + int_f ret_value = 0; + + c_space_id = *space_id; + rank = H5Sget_simple_extent_ndims(c_space_id); + if(rank < 0 ) + HGOTO_DONE(FAIL) + + if(H5Sget_select_bounds(c_space_id, c_start, c_end) < 0) + HGOTO_DONE(FAIL) + + for(i = 0; i < rank; i++) { + start[i] = (hsize_t_f)(c_start[rank - i - 1] + 1); + end[i] = (hsize_t_f)(c_end[rank - i - 1] + 1); + } /* end for */ + +done: + return ret_value; } /*---------------------------------------------------------------------------- @@ -574,29 +562,28 @@ nh5sget_simple_extent_type_c ( hid_t_f *space_id , int_f *classtype) int_f nh5soffset_simple_c ( hid_t_f *space_id , hssize_t_f *offset) { - int ret_value = -1; - hid_t c_space_id; - int rank; - hssize_t *c_offset; - herr_t status; - int i; - - c_space_id = *space_id; - rank = H5Sget_simple_extent_ndims(c_space_id); - if (rank < 0) return ret_value; - - c_offset = malloc(sizeof(hssize_t)*rank); - if (!c_offset) return ret_value; - - /* - * Reverse dimensions due to C-FORTRAN storage order. - */ - for (i=0; i < rank; i++) c_offset[i] = offset[rank - i - 1]; - - status = H5Soffset_simple(c_space_id, c_offset); - if ( status >= 0 ) ret_value = 0; - HDfree(c_offset); - return ret_value; + hid_t c_space_id; + int rank; + hssize_t c_offset[H5S_MAX_RANK]; + int i; + int_f ret_value = 0; + + c_space_id = *space_id; + rank = H5Sget_simple_extent_ndims(c_space_id); + if(rank < 0) + HGOTO_DONE(FAIL) + + /* + * Reverse dimensions due to C-FORTRAN storage order. + */ + for(i = 0; i < rank; i++) + c_offset[i] = offset[rank - i - 1]; + + if(H5Soffset_simple(c_space_id, c_offset) < 0) + HGOTO_DONE(FAIL) + +done: + return ret_value; } /*---------------------------------------------------------------------------- @@ -616,35 +603,24 @@ nh5soffset_simple_c ( hid_t_f *space_id , hssize_t_f *offset) int_f nh5sset_extent_simple_c ( hid_t_f *space_id , int_f *rank, hsize_t_f *current_size, hsize_t_f *maximum_size) { - int ret_value = -1; - hid_t c_space_id; - int c_rank; - hsize_t *c_current_size; - hsize_t *c_maximum_size; - herr_t status; - int i; - - c_current_size = malloc(sizeof(hsize_t)*(*rank)); - if (!c_current_size) return ret_value; - - c_maximum_size = malloc(sizeof(hsize_t)*(*rank)); - if (!c_maximum_size) return ret_value; - - /* - * Reverse dimensions due to C-FORTRAN storage order. - */ - for (i=0; i < *rank; i++) { - c_current_size[i] = (hsize_t)current_size[*rank - i - 1]; - c_maximum_size[i] = (hsize_t)maximum_size[*rank - i - 1]; - } - - c_space_id = *space_id; - c_rank = *rank; - status = H5Sset_extent_simple(c_space_id, c_rank, c_current_size, c_maximum_size); - if ( status >= 0 ) ret_value = 0; - HDfree(c_current_size); - HDfree(c_maximum_size); - return ret_value; + hsize_t c_current_size[H5S_MAX_RANK]; + hsize_t c_maximum_size[H5S_MAX_RANK]; + int i; + int_f ret_value = 0; + + /* + * Reverse dimensions due to C-FORTRAN storage order. + */ + for(i = 0; i < *rank; i++) { + c_current_size[i] = (hsize_t)current_size[*rank - i - 1]; + c_maximum_size[i] = (hsize_t)maximum_size[*rank - i - 1]; + } /* end for */ + + if(H5Sset_extent_simple((hid_t)*space_id, (int)*rank, c_current_size, c_maximum_size) < 0) + HGOTO_DONE(FAIL) + +done: + return ret_value; } /*---------------------------------------------------------------------------- @@ -663,37 +639,33 @@ nh5sset_extent_simple_c ( hid_t_f *space_id , int_f *rank, hsize_t_f *current_si int_f nh5sget_simple_extent_dims_c ( hid_t_f *space_id , hsize_t_f *dims, hsize_t_f *maxdims) { - int ret_value = -1; - hid_t c_space_id; - hsize_t *c_dims; - hsize_t *c_maxdims; - int status; - int rank; - int i; - - c_space_id = *space_id; - rank = H5Sget_simple_extent_ndims(c_space_id); - if (rank < 0) return ret_value; - - c_dims = malloc(sizeof(hsize_t)*rank); - if (!c_dims) return ret_value; - - c_maxdims = malloc(sizeof(hsize_t)*rank); - if (!c_maxdims) return ret_value; - - status = H5Sget_simple_extent_dims(c_space_id, c_dims, c_maxdims); - /* - * Reverse dimensions due to C-FORTRAN storage order. - */ - for (i=0; i < rank; i++) { - dims[rank - i - 1] = (hsize_t_f)c_dims[i]; - maxdims[rank - i - 1] = (hsize_t_f)c_maxdims[i]; - } - - if ( status >= 0 ) ret_value = rank; - HDfree(c_dims); - HDfree(c_maxdims); - return ret_value; + hid_t c_space_id; + hsize_t c_dims[H5S_MAX_RANK]; + hsize_t c_maxdims[H5S_MAX_RANK]; + int rank; + int i; + int_f ret_value; + + c_space_id = *space_id; + rank = H5Sget_simple_extent_ndims(c_space_id); + if(rank < 0) + HGOTO_DONE(FAIL) + + if(H5Sget_simple_extent_dims(c_space_id, c_dims, c_maxdims) < 0) + HGOTO_DONE(FAIL) + + /* + * Reverse dimensions due to C-FORTRAN storage order. + */ + for(i = 0; i < rank; i++) { + dims[rank - i - 1] = (hsize_t_f)c_dims[i]; + maxdims[rank - i - 1] = (hsize_t_f)c_maxdims[i]; + } /* end for */ + + ret_value = rank; + +done: + return ret_value; } /*---------------------------------------------------------------------------- @@ -792,61 +764,37 @@ nh5sset_extent_none_c ( hid_t_f *space_id ) int_f nh5sselect_hyperslab_c ( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block) { - int ret_value = -1; - hid_t c_space_id; - hsize_t *c_start = NULL; - hsize_t *c_count = NULL; - hsize_t *c_stride = NULL; - hsize_t *c_block = NULL; - - H5S_seloper_t c_op; - herr_t status; - int rank; - int i; - - rank = H5Sget_simple_extent_ndims(*space_id); - if (rank < 0 ) return ret_value; - c_start = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); - if (c_start == NULL) goto DONE; - - c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); - if (c_count == NULL) goto DONE; - - c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); - if (c_stride == NULL) goto DONE; - - c_block = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); - if (c_block == NULL) goto DONE; - - - /* - * Reverse dimensions due to C-FORTRAN storage order. - */ - - for (i=0; i < rank; i++) { - int t= (rank - i) - 1; - c_start[i] = (hsize_t)start[t]; - c_count[i] = (hsize_t)count[t]; - c_stride[i] = (hsize_t)stride[t]; - c_block[i] = (hsize_t)block[t]; - } - - c_op = (H5S_seloper_t)*op; -/* - if (*op == H5S_SELECT_SET_F) c_op = H5S_SELECT_SET; - if (*op == H5S_SELECT_OR_F) c_op = H5S_SELECT_OR; -*/ - - c_space_id = *space_id; - status = H5Sselect_hyperslab(c_space_id, c_op, c_start, c_stride, c_count, c_block); - if ( status >= 0 ) ret_value = 0; -DONE: - if(c_start != NULL) HDfree(c_start); - if(c_count != NULL) HDfree(c_count); - if(c_stride!= NULL) HDfree(c_stride); - if(c_block != NULL) HDfree(c_block); - return ret_value; + hsize_t c_start[H5S_MAX_RANK]; + hsize_t c_count[H5S_MAX_RANK]; + hsize_t c_stride[H5S_MAX_RANK]; + hsize_t c_block[H5S_MAX_RANK]; + int rank; + int i; + int_f ret_value = 0; + + rank = H5Sget_simple_extent_ndims((hid_t)*space_id); + if(rank < 0 ) + HGOTO_DONE(FAIL) + + /* + * Reverse dimensions due to C-FORTRAN storage order. + */ + for(i = 0; i < rank; i++) { + int t = (rank - i) - 1; + + c_start[i] = (hsize_t)start[t]; + c_count[i] = (hsize_t)count[t]; + c_stride[i] = (hsize_t)stride[t]; + c_block[i] = (hsize_t)block[t]; + } /* end for */ + + if(H5Sselect_hyperslab((hid_t)*space_id, (H5S_seloper_t)*op, c_start, c_stride, c_count, c_block) < 0) + HGOTO_DONE(FAIL) + +done: + return ret_value; } + #ifdef NEW_HYPERSLAB_API /*---------------------------------------------------------------------------- * Name: h5scombine_hyperslab_c diff --git a/fortran/src/H5f90global.f90 b/fortran/src/H5f90global.f90 index 28d00f7..da21f6e 100644 --- a/fortran/src/H5f90global.f90 +++ b/fortran/src/H5f90global.f90 @@ -473,10 +473,10 @@ MODULE H5GLOBAL INTEGER, PARAMETER :: H5L_FLAGS_LEN = 6 INTEGER :: H5L_flags(H5L_FLAGS_LEN) - INTEGER :: H5L_LINK_ERROR_F - INTEGER :: H5L_LINK_HARD_F - INTEGER :: H5L_LINK_SOFT_F - INTEGER :: H5L_LINK_EXTERNAL_F + INTEGER :: H5L_TYPE_ERROR_F + INTEGER :: H5L_TYPE_HARD_F + INTEGER :: H5L_TYPE_SOFT_F + INTEGER :: H5L_TYPE_EXTERNAL_F INTEGER :: H5L_SAME_LOC_F INTEGER :: H5L_LINK_CLASS_T_VERS_F @@ -485,10 +485,10 @@ MODULE H5GLOBAL !DEC$endif COMMON /H5L_FLAGS/ H5L_flags - EQUIVALENCE(H5L_flags(1), H5L_LINK_ERROR_F) - EQUIVALENCE(H5L_flags(2), H5L_LINK_HARD_F) - EQUIVALENCE(H5L_flags(3), H5L_LINK_SOFT_F) - EQUIVALENCE(H5L_flags(4), H5L_LINK_EXTERNAL_F) + EQUIVALENCE(H5L_flags(1), H5L_TYPE_ERROR_F) + EQUIVALENCE(H5L_flags(2), H5L_TYPE_HARD_F) + EQUIVALENCE(H5L_flags(3), H5L_TYPE_SOFT_F) + EQUIVALENCE(H5L_flags(4), H5L_TYPE_EXTERNAL_F) EQUIVALENCE(H5L_flags(5), H5L_SAME_LOC_F) EQUIVALENCE(H5L_flags(6), H5L_LINK_CLASS_T_VERS_F) ! diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 7138639..31b08ac 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -385,12 +385,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -424,7 +424,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 = 44 +LT_VERS_REVISION = 49 LT_VERS_AGE = 0 # Include src directory in both Fortran and C flags (C compiler is used @@ -1087,7 +1087,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -1158,7 +1158,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/fortran/src/h5fc.in b/fortran/src/h5fc.in index df52971..db44600 100755 --- a/fortran/src/h5fc.in +++ b/fortran/src/h5fc.in @@ -36,6 +36,10 @@ HL="@HL@" ## ## ############################################################################ +# Constants definitions +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + host_os="@host_os@" prog_name="`basename $0`" @@ -89,7 +93,7 @@ usage() { echo " HDF5_FC - use a different Fortran 90 or 95 compiler" echo " HDF5_FLINKER - use a different linker" echo " " - exit 1 + exit $EXIT_FAILURE } # Show the configuration summary of the library recorded in the @@ -101,7 +105,7 @@ showconfigure() } # Main -status=0 +status=$EXIT_SUCCESS if test "$#" = "0"; then # No parameters specified, issue usage statement and exit. diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index 7d5009a..f586adb 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -366,12 +366,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -960,7 +960,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -1031,7 +1031,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/fortran/test/t.c b/fortran/test/t.c index 861a3e7..f2203d0 100644 --- a/fortran/test/t.c +++ b/fortran/test/t.c @@ -14,6 +14,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "t.h" +#include "H5Eprivate.h" /*---------------------------------------------------------------------------- * Name: h5_fixname_c @@ -31,35 +32,31 @@ int_f nh5_fixname_c(_fcd base_name, size_t_f *base_namelen, hid_t_f* fapl, _fcd full_name, size_t_f *full_namelen) { - int ret_value = -1; - char *c_base_name; - char *c_full_name; - hid_t c_fapl; + char *c_base_name = NULL; + char *c_full_name = NULL; + int_f ret_value = 0; /* - * Define ifile access property list - */ - c_fapl = (hid_t)*fapl; - /* * Convert FORTRAN name to C name */ - c_base_name = (char *)HD5f2cstring(base_name, (size_t)*base_namelen); - if (c_base_name == NULL) goto DONE; - c_full_name = (char *) HDmalloc((size_t)*full_namelen + 1); - if (c_full_name == NULL) goto DONE; + if(NULL == (c_base_name = (char *)HD5f2cstring(base_name, (size_t)*base_namelen))) + HGOTO_DONE(FAIL) + if(NULL == (c_full_name = (char *)HDmalloc((size_t)*full_namelen + 1))) + HGOTO_DONE(FAIL) /* * Call h5_fixname function. */ - if (NULL != h5_fixname(c_base_name, c_fapl, c_full_name, (size_t)*full_namelen + 1)) { - HD5packFstring(c_full_name, _fcdtocp(full_name), (size_t)*full_namelen); - ret_value = 0; - goto DONE; - } + if(NULL == h5_fixname(c_base_name, (hid_t)*fapl, c_full_name, (size_t)*full_namelen + 1)) + HGOTO_DONE(FAIL) + HD5packFstring(c_full_name, _fcdtocp(full_name), (size_t)*full_namelen); + +done: + if(c_base_name) + HDfree(c_base_name); + if(c_full_name) + HDfree(c_full_name); -DONE: - if (NULL != c_base_name) HDfree(c_base_name); - if (NULL != c_full_name) HDfree(c_full_name); return ret_value; } diff --git a/fortran/test/tH5G_1_8.f90 b/fortran/test/tH5G_1_8.f90 index 9c28f75..725e21b 100644 --- a/fortran/test/tH5G_1_8.f90 +++ b/fortran/test/tH5G_1_8.f90 @@ -646,10 +646,10 @@ SUBROUTINE group_info(cleanup, fapl, total_error) INTEGER :: corder ! Specifies the link’s creation order position. LOGICAL :: f_corder_valid ! Indicates whether the value in corder is valid. INTEGER :: link_type ! Specifies the link class: - ! H5L_LINK_HARD_F - Hard link - ! H5L_LINK_SOFT_F - Soft link - ! H5L_LINK_EXTERNAL_F - External link - ! H5L_LINK_ERROR _F - Error + ! H5L_TYPE_HARD_F - Hard link + ! H5L_TYPE_SOFT_F - Soft link + ! H5L_TYPE_EXTERNAL_F - External link + ! H5L_TYPE_ERROR _F - Error INTEGER(HADDR_T) :: address ! If the link is a hard link, address specifies the file address that the link points to INTEGER(SIZE_T) :: val_size ! If the link is a symbolic link, val_size will be the length of the link value @@ -689,7 +689,7 @@ SUBROUTINE group_info(cleanup, fapl, total_error) ! CALL VerifyLogical("H5Lget_info_by_idx_f11", f_corder_valid, .TRUE., total_error) - CALL VERIFY("H5Lget_info_by_idx_f", H5L_LINK_SOFT_F, link_type, total_error) + CALL VERIFY("H5Lget_info_by_idx_f", H5L_TYPE_SOFT_F, link_type, total_error) CALL VERIFY("H5Lget_info_by_idx_f", cset, H5T_CSET_ASCII_F, total_error) ! should be '/d1' + NULL character = 4 CALL VERIFY("H5Lget_info_by_idx_f", INT(val_size), 4, total_error) @@ -753,10 +753,10 @@ SUBROUTINE group_info(cleanup, fapl, total_error) INTEGER :: corder ! Specifies the link’s creation order position. LOGICAL :: f_corder_valid ! Indicates whether the value in corder is valid. INTEGER :: link_type ! Specifies the link class: - ! H5L_LINK_HARD_F - Hard link - ! H5L_LINK_SOFT_F - Soft link - ! H5L_LINK_EXTERNAL_F - External link - ! H5L_LINK_ERROR _F - Error + ! H5L_TYPE_HARD_F - Hard link + ! H5L_TYPE_SOFT_F - Soft link + ! H5L_TYPE_EXTERNAL_F - External link + ! H5L_TYPE_ERROR _F - Error INTEGER(HADDR_T) :: address ! If the link is a hard link, address specifies the file address that the link points to INTEGER(SIZE_T) :: val_size ! If the link is a symbolic link, val_size will be the length of the link value @@ -1318,7 +1318,7 @@ SUBROUTINE delete_by_idx(cleanup, fapl, total_error) CALL VerifyLogical("H5Lget_info_by_idx_f", f_corder_valid, .TRUE., total_error) - CALL VERIFY("H5Lget_info_by_idx_f", H5L_LINK_HARD_F, link_type, total_error) + CALL VERIFY("H5Lget_info_by_idx_f", H5L_TYPE_HARD_F, link_type, total_error) IF(iorder.EQ.H5_ITER_INC_F)THEN CALL VERIFY("H5Lget_info_by_idx_f", corder, u+1, total_error) ELSE @@ -1511,10 +1511,10 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & INTEGER :: corder ! Specifies the link’s creation order position. LOGICAL :: f_corder_valid ! Indicates whether the value in corder is valid. INTEGER :: link_type ! Specifies the link class: - ! H5L_LINK_HARD_F - Hard link - ! H5L_LINK_SOFT_F - Soft link - ! H5L_LINK_EXTERNAL_F - External link - ! H5L_LINK_ERROR _F - Error + ! H5L_TYPE_HARD_F - Hard link + ! H5L_TYPE_SOFT_F - Soft link + ! H5L_TYPE_EXTERNAL_F - External link + ! H5L_TYPE_ERROR _F - Error INTEGER(HADDR_T) :: address ! If the link is a hard link, address specifies the file address that the link points to INTEGER(SIZE_T) :: val_size ! If the link is a symbolic link, val_size will be the length of the link value diff --git a/fortran/testpar/Makefile.in b/fortran/testpar/Makefile.in index edb9a66..6dcf2bd 100644 --- a/fortran/testpar/Makefile.in +++ b/fortran/testpar/Makefile.in @@ -319,12 +319,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -762,7 +762,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -833,7 +833,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/hl/Makefile.in b/hl/Makefile.in index addfd5a..8fd29b4 100755 --- a/hl/Makefile.in +++ b/hl/Makefile.in @@ -333,12 +333,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -867,7 +867,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -938,7 +938,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/hl/c++/Makefile.in b/hl/c++/Makefile.in index 87a582c..d83f520 100644 --- a/hl/c++/Makefile.in +++ b/hl/c++/Makefile.in @@ -329,12 +329,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -859,7 +859,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -930,7 +930,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/hl/c++/examples/Makefile.in b/hl/c++/examples/Makefile.in index 4b11346..9fad167 100644 --- a/hl/c++/examples/Makefile.in +++ b/hl/c++/examples/Makefile.in @@ -295,12 +295,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -715,7 +715,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -786,7 +786,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index cf49155..72f1843 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -341,12 +341,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -380,7 +380,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 = 44 +LT_VERS_REVISION = 49 LT_VERS_AGE = 0 # Include src directory @@ -866,7 +866,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -937,7 +937,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/hl/c++/test/Makefile.in b/hl/c++/test/Makefile.in index 6bb1a99..7266306 100644 --- a/hl/c++/test/Makefile.in +++ b/hl/c++/test/Makefile.in @@ -315,12 +315,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -774,7 +774,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -845,7 +845,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/hl/examples/Makefile.in b/hl/examples/Makefile.in index 0380eaf..44333b5 100644 --- a/hl/examples/Makefile.in +++ b/hl/examples/Makefile.in @@ -295,12 +295,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -748,7 +748,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -819,7 +819,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/hl/fortran/Makefile.in b/hl/fortran/Makefile.in index 79e0ce5..4a91756 100644 --- a/hl/fortran/Makefile.in +++ b/hl/fortran/Makefile.in @@ -333,12 +333,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -863,7 +863,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -934,7 +934,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/hl/fortran/examples/Makefile.in b/hl/fortran/examples/Makefile.in index 698ffbf..ef5d165 100644 --- a/hl/fortran/examples/Makefile.in +++ b/hl/fortran/examples/Makefile.in @@ -295,12 +295,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -717,7 +717,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -788,7 +788,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/hl/fortran/src/H5IMfc.c b/hl/fortran/src/H5IMfc.c index bbf98cf..7a54437 100755 --- a/hl/fortran/src/H5IMfc.c +++ b/hl/fortran/src/H5IMfc.c @@ -17,7 +17,7 @@ #include "H5IMcc.h" #include "H5LTf90proto.h" - +#include "H5Eprivate.h" /*------------------------------------------------------------------------- * Function: h5immake_image_8bit_c @@ -377,49 +377,30 @@ nh5immake_palette_c (hid_t_f *loc_id, hsize_t_f *dims, void *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; char *c_name = NULL; - int c_namelen; - hsize_t *c_dims; + hsize_t c_dims[H5S_MAX_RANK]; int i; int rank=2; + int_f ret_value = 0; /* * convert FORTRAN name to C name */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) - goto done; - - c_dims = malloc(sizeof(hsize_t) * (rank )); - if (c_dims == NULL) - goto done; + if(NULL == (c_name = (char *)HD5f2cstring(name, (int)*namelen))) + HGOTO_DONE(FAIL) - for (i = 0; i < rank ; i++) - { + for(i = 0; i < rank ; i++) c_dims[i] = dims[i]; - } /* * call H5IMmake_palette function. */ - c_loc_id = (hid_t)*loc_id; - - ret = H5IMmake_palettef(c_loc_id,c_name,c_dims,buf); - - if (ret < 0) - goto done; - - ret_value = 0; + if(H5IMmake_palettef((hid_t)*loc_id, c_name, c_dims, buf) < 0) + HGOTO_DONE(FAIL) done: - if(c_name!=NULL) - free(c_name); - if(c_dims!=NULL) - free(c_dims); + if(c_name) + HDfree(c_name); return ret_value; } diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c index 38af99c..a09d73b 100755 --- a/hl/fortran/src/H5TBfc.c +++ b/hl/fortran/src/H5TBfc.c @@ -17,6 +17,7 @@ #include "H5TBprivate.h" #include "H5LTf90proto.h" +#include "H5Eprivate.h" /*------------------------------------------------------------------------- * Function: h5tbmake_table_c @@ -52,134 +53,99 @@ nh5tbmake_table_c(int_f *namelen1, int_f *namelen2, /* field_names lenghts */ _fcd field_names) /* field_names */ { - int ret_value = -1; - herr_t ret; - char *c_name = NULL; - int c_namelen; - char *c_name1 = NULL; - int c_namelen1; + char *c_name = NULL; + char *c_name1 = NULL; hsize_t num_elem; hsize_t i; - int max_len=1; - hid_t c_loc_id = *loc_id; - hsize_t c_nfields = *nfields; - hsize_t c_nrecords = *nrecords; + int max_len = 1; + hid_t c_loc_id = *loc_id; + hsize_t c_nfields = *nfields; + hsize_t c_nrecords = *nrecords; hsize_t c_chunk_size = *chunk_size; - size_t c_type_size = *type_size; - size_t *c_field_offset = NULL; - hid_t *c_field_types = NULL; - char **c_field_names = NULL; - char *tmp = NULL, *tmp_p = NULL; + size_t c_type_size = *type_size; + size_t *c_field_offset = NULL; + hid_t *c_field_types = NULL; + char **c_field_names = NULL; + char *tmp = NULL, *tmp_p; + int_f ret_value = 0; num_elem = *nfields; - - for ( i = 0; i < num_elem; i++) - { - if (namelen2[i] > max_len) max_len = namelen2[i]; + for(i = 0; i < num_elem; i++) { + if(namelen2[i] > max_len) + max_len = namelen2[i]; } /* - * convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) - goto done; - - c_namelen1 = *namelen1; - c_name1 = (char *)HD5f2cstring(name1, c_namelen1); - if (c_name1 == NULL) - goto done; - - c_field_offset = (size_t*)malloc(sizeof(size_t) * (size_t)c_nfields); - if (!c_field_offset) - goto done; - - c_field_types = (hid_t*)malloc(sizeof(hid_t) * (size_t)c_nfields); - if (!c_field_types) - goto done; - - for ( i = 0; i < num_elem; i++) - { + * convert FORTRAN name to C name + */ + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) + if(NULL == (c_name1 = (char *)HD5f2cstring(name1, (size_t)*namelen1))) + HGOTO_DONE(FAIL) + if(NULL == (c_field_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) + HGOTO_DONE(FAIL) + if(NULL == (c_field_types = (hid_t *)HDmalloc(sizeof(hid_t) * (size_t)c_nfields))) + HGOTO_DONE(FAIL) + + for (i = 0; i < num_elem; i++) { c_field_offset[i] = field_offset[i]; - c_field_types[i] = field_types[i]; + c_field_types[i] = field_types[i]; } /* - * allocate array of character pointers - */ - c_field_names = (char **)malloc((size_t)num_elem * sizeof(char *)); - if (c_field_names == NULL) - goto done; + * allocate array of character pointers + */ + if(NULL == (c_field_names = (char **)HDcalloc((size_t)num_elem, sizeof(char *)))) + HGOTO_DONE(FAIL) /* copy data to long C string */ - tmp = (char *)HD5f2cstring(field_names, (int)(max_len*num_elem)); - if (tmp == NULL) - { - goto done; - } + if(NULL == (tmp = (char *)HD5f2cstring(field_names, (size_t)(max_len * num_elem)))) + HGOTO_DONE(FAIL) /* - * move data from temorary buffer - */ + * move data from temorary buffer + */ tmp_p = tmp; - for (i=0; i < num_elem; i++) - { - c_field_names[i] = (char *) malloc((size_t)namelen2[i]+1); - memcpy(c_field_names[i], tmp_p, (size_t)namelen2[i]); + for(i = 0; i < num_elem; i++) { + if(NULL == (c_field_names[i] = (char *)HDmalloc((size_t)namelen2[i] + 1))) + HGOTO_DONE(FAIL) + + HDmemcpy(c_field_names[i], tmp_p, (size_t)namelen2[i]); c_field_names[i][namelen2[i]] = '\0'; tmp_p = tmp_p + max_len; - } + } /* end for */ /* - * call H5TBmake_table function. - */ - - ret = H5TBmake_table(c_name1, - c_loc_id, - c_name, - c_nfields, - c_nrecords, - c_type_size, - c_field_names, - c_field_offset, - c_field_types, - c_chunk_size, - NULL, - *compress, - NULL); - - if (ret < 0) - goto done; - - ret_value = 0; - -done: - if(c_name != NULL) - free(c_name); - if(c_name1 != NULL) - free(c_name1); - - for ( i = 0; i < num_elem; i++) - { - if ( c_field_names[i] ) - free (c_field_names[i]); - } - if ( c_field_names ) - free(c_field_names); - if ( tmp ) - free(tmp); - if ( c_field_offset ) - free(c_field_offset); - if ( c_field_types ) - free(c_field_types); + * call H5TBmake_table function. + */ + if(H5TBmake_table(c_name1, c_loc_id, c_name, c_nfields, c_nrecords, + c_type_size, c_field_names, c_field_offset, c_field_types, + c_chunk_size, NULL, *compress, NULL) < 0) + HGOTO_DONE(FAIL) + +done: + if(c_name) + HDfree(c_name); + if(c_name1) + HDfree(c_name1); + if(c_field_names) { + for(i = 0; i < num_elem; i++) { + if(c_field_names[i]) + HDfree(c_field_names[i]); + } + HDfree(c_field_names); + } /* end if */ + if(tmp) + HDfree(tmp); + if(c_field_offset) + HDfree(c_field_offset); + if(c_field_types) + HDfree(c_field_types); return ret_value; } - - /*------------------------------------------------------------------------- * Function: h5tbwrite_field_name_c * @@ -210,59 +176,34 @@ nh5tbwrite_field_name_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - int ret_value = -1; - herr_t ret; - char *c_name = NULL; - int c_namelen; - char *c_name1 = NULL; - int c_namelen1; + char *c_name = NULL; + char *c_name1 = NULL; hid_t c_loc_id = *loc_id; hsize_t c_start = *start; hsize_t c_nrecords = *nrecords; size_t c_type_size = *type_size; - size_t c_type_sizes[1]; - - c_type_sizes[0] = c_type_size; - + int_f ret_value = 0; /* * convert FORTRAN name to C name */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) - goto done; - - c_namelen1 = *namelen1; - c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); - if (c_name1 == NULL) - goto done; + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) + if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1))) + HGOTO_DONE(FAIL) /* * call H5TBwrite_fields_name function. */ - - ret = H5TBwrite_fields_name(c_loc_id, - c_name, - c_name1, - c_start, - c_nrecords, - c_type_size, - 0, - c_type_sizes, - buf); - - if (ret < 0) - goto done; - - ret_value = 0; - + if(H5TBwrite_fields_name(c_loc_id, c_name, c_name1, c_start, c_nrecords, + c_type_size, 0, &c_type_size, buf) < 0) + HGOTO_DONE(FAIL) done: - if(c_name != NULL) - free(c_name); - if(c_name1 != NULL) - free(c_name1); + if(c_name) + HDfree(c_name); + if(c_name1) + HDfree(c_name1); return ret_value; } @@ -293,6 +234,7 @@ nh5tbwrite_field_name_fl_c(hid_t_f *loc_id, { return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); } + int_f nh5tbwrite_field_name_dl_c(hid_t_f *loc_id, int_f *namelen, @@ -306,6 +248,7 @@ nh5tbwrite_field_name_dl_c(hid_t_f *loc_id, { return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); } + int_f nh5tbwrite_field_name_st_c(hid_t_f *loc_id, int_f *namelen, @@ -319,6 +262,7 @@ nh5tbwrite_field_name_st_c(hid_t_f *loc_id, { return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); } + /*------------------------------------------------------------------------- * Function: h5tbread_field_name_c * @@ -349,57 +293,34 @@ nh5tbread_field_name_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - int ret_value = -1; - herr_t ret; - char *c_name = NULL; - int c_namelen; - char *c_name1 = NULL; - int c_namelen1; + char *c_name = NULL; + char *c_name1 = NULL; hid_t c_loc_id = *loc_id; hsize_t c_start = *start; hsize_t c_nrecords = *nrecords; size_t c_type_size = *type_size; - size_t c_type_sizes[1]; - - c_type_sizes[0] = c_type_size; - + int_f ret_value = 0; /* * convert FORTRAN name to C name */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) - goto done; - - c_namelen1 = *namelen1; - c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); - if (c_name1 == NULL) - goto done; + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) + if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1))) + HGOTO_DONE(FAIL) /* * call H5TBread_fields_name function. */ - - ret = H5TBread_fields_name(c_loc_id, - c_name, - c_name1, - c_start, - c_nrecords, - c_type_size, - 0, - c_type_sizes, - buf); - - if (ret < 0) - goto done; - - ret_value = 0; - + if(H5TBread_fields_name(c_loc_id, c_name, c_name1, c_start, c_nrecords, + c_type_size, 0, &c_type_size, buf) < 0) + HGOTO_DONE(FAIL) done: - if(c_name != NULL) - free(c_name); + if(c_name) + HDfree(c_name); + if(c_name1) + HDfree(c_name1); return ret_value; } @@ -417,6 +338,7 @@ nh5tbread_field_name_int_c(hid_t_f *loc_id, { return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); } + int_f nh5tbread_field_name_fl_c(hid_t_f *loc_id, int_f *namelen, @@ -430,6 +352,7 @@ nh5tbread_field_name_fl_c(hid_t_f *loc_id, { return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); } + int_f nh5tbread_field_name_dl_c(hid_t_f *loc_id, int_f *namelen, @@ -443,6 +366,7 @@ nh5tbread_field_name_dl_c(hid_t_f *loc_id, { return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); } + int_f nh5tbread_field_name_st_c(hid_t_f *loc_id, int_f *namelen, @@ -486,45 +410,31 @@ nh5tbwrite_field_index_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - int ret_value = -1; - herr_t ret; - char *c_name = NULL; - int c_namelen; + char *c_name = NULL; hid_t c_loc_id = *loc_id; hsize_t c_start = *start; hsize_t c_nrecords = *nrecords; size_t c_type_size = *type_size; - size_t c_type_sizes[1]; - int c_field_index[1]; - - c_type_sizes[0] = c_type_size; - c_field_index[0] = *field_index - 1; /* C zero based index */ - + int c_field_index = *field_index - 1; /* C zero based index */ + int_f ret_value = 0; /* * convert FORTRAN name to C name */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) - goto done; + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) /* * call H5TBwrite_fields_name function. */ - - ret = H5TBwrite_fields_index(c_loc_id,c_name,(hsize_t)1,c_field_index,c_start,c_nrecords,c_type_size, - 0,c_type_sizes,buf); - - if (ret < 0) - goto done; - - ret_value = 0; + if(H5TBwrite_fields_index(c_loc_id, c_name, (hsize_t)1, &c_field_index, + c_start, c_nrecords, c_type_size, 0, &c_type_size, buf) < 0) + HGOTO_DONE(FAIL) done: - if(c_name != NULL) - free(c_name); + if(c_name) + HDfree(c_name); return ret_value; } @@ -541,6 +451,7 @@ nh5tbwrite_field_index_int_c(hid_t_f *loc_id, { return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); } + int_f nh5tbwrite_field_index_fl_c(hid_t_f *loc_id, int_f *namelen, @@ -553,6 +464,7 @@ nh5tbwrite_field_index_fl_c(hid_t_f *loc_id, { return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); } + int_f nh5tbwrite_field_index_dl_c(hid_t_f *loc_id, int_f *namelen, @@ -565,6 +477,7 @@ nh5tbwrite_field_index_dl_c(hid_t_f *loc_id, { return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); } + int_f nh5tbwrite_field_index_st_c(hid_t_f *loc_id, int_f *namelen, @@ -607,51 +520,30 @@ nh5tbread_field_index_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - int ret_value = -1; - herr_t ret; - char *c_name = NULL; - int c_namelen; + char *c_name = NULL; hid_t c_loc_id = *loc_id; hsize_t c_start = *start; hsize_t c_nrecords = *nrecords; size_t c_type_size = *type_size; - size_t c_type_sizes[1]; - int c_field_index[1]; - - c_type_sizes[0] = c_type_size; - c_field_index[0] = *field_index - 1; /* C zero based index */ - + int c_field_index = *field_index - 1; /* C zero based index */ + int_f ret_value = 0; /* - * convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) - goto done; + * convert FORTRAN name to C name + */ + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) /* - * call H5TBread_fields_index function. - */ - - ret = H5TBread_fields_index(c_loc_id, - c_name,(hsize_t)1, - c_field_index, - c_start, - c_nrecords, - c_type_size, - 0, - c_type_sizes, - buf); - - if (ret < 0) - goto done; - - ret_value = 0; + * call H5TBread_fields_index function. + */ + if(H5TBread_fields_index(c_loc_id, c_name,(hsize_t)1, &c_field_index, + c_start, c_nrecords, c_type_size, 0, &c_type_size, buf) < 0) + HGOTO_DONE(FAIL) done: - if(c_name != NULL) - free(c_name); + if(c_name) + HDfree(c_name); return ret_value; } @@ -668,6 +560,7 @@ nh5tbread_field_index_int_c(hid_t_f *loc_id, { return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); } + int_f nh5tbread_field_index_fl_c(hid_t_f *loc_id, int_f *namelen, @@ -680,6 +573,7 @@ nh5tbread_field_index_fl_c(hid_t_f *loc_id, { return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); } + int_f nh5tbread_field_index_dl_c(hid_t_f *loc_id, int_f *namelen, @@ -692,6 +586,7 @@ nh5tbread_field_index_dl_c(hid_t_f *loc_id, { return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); } + int_f nh5tbread_field_index_st_c(hid_t_f *loc_id, int_f *namelen, @@ -734,51 +629,34 @@ nh5tbinsert_field_c(hid_t_f *loc_id, int_f *position, void *buf) { - int ret_value = -1; - herr_t ret; - char *c_name = NULL; - int c_namelen; - char *c_name1 = NULL; - int c_namelen1; + char *c_name = NULL; + char *c_name1 = NULL; hid_t c_loc_id = *loc_id; hid_t c_field_type = *field_type; hsize_t c_position = *position; + int_f ret_value = 0; /* * convert FORTRAN name to C name */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) - goto done; - - c_namelen1 = *namelen1; - c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); - if (c_name1 == NULL) - goto done; + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) + if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1))) + HGOTO_DONE(FAIL) /* * call H5TBinsert_field function. */ - ret = H5TBinsert_field(c_loc_id, - c_name, - c_name1, - c_field_type, - c_position, - NULL, - buf); - - if (ret < 0) - goto done; - - ret_value = 0; + if(H5TBinsert_field(c_loc_id, c_name, c_name1, c_field_type, c_position, + NULL, buf) < 0) + HGOTO_DONE(FAIL) done: - if(c_name != NULL) - free(c_name); - if(c_name1 != NULL) - free(c_name1); + if(c_name ) + HDfree(c_name); + if(c_name1) + HDfree(c_name1); return ret_value; } @@ -795,6 +673,7 @@ nh5tbinsert_field_int_c(hid_t_f *loc_id, { return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf); } + int_f nh5tbinsert_field_fl_c(hid_t_f *loc_id, int_f *namelen, @@ -807,6 +686,7 @@ nh5tbinsert_field_fl_c(hid_t_f *loc_id, { return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf); } + int_f nh5tbinsert_field_dl_c(hid_t_f *loc_id, int_f *namelen, @@ -819,6 +699,7 @@ nh5tbinsert_field_dl_c(hid_t_f *loc_id, { return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf); } + int_f nh5tbinsert_field_st_c(hid_t_f *loc_id, int_f *namelen, @@ -858,49 +739,32 @@ nh5tbdelete_field_c(hid_t_f *loc_id, int_f *namelen1, _fcd field_name) { - int ret_value = -1; - herr_t ret; - char *c_name = NULL; - int c_namelen; - char *c_name1 = NULL; - int c_namelen1; + char *c_name = NULL; + char *c_name1 = NULL; hid_t c_loc_id = *loc_id; + int_f ret_value = 0; /* - * convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) - goto done; - - c_namelen1 = *namelen1; - c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); - if (c_name1 == NULL) - goto done; + * convert FORTRAN name to C name + */ + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) + if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1))) + HGOTO_DONE(FAIL) /* - * call H5TBinsert_field function. - */ - - ret = H5TBdelete_field(c_loc_id, - c_name, - c_name1); - - if (ret < 0) - goto done; - - ret_value = 0; + * call H5TBinsert_field function. + */ + if(H5TBdelete_field(c_loc_id, c_name, c_name1) < 0) + HGOTO_DONE(FAIL) done: - if(c_name != NULL) - free(c_name); + if(c_name) + HDfree(c_name); return ret_value; } - - /*------------------------------------------------------------------------- * Function: h5tbget_table_info_c * @@ -927,42 +791,30 @@ nh5tbget_table_info_c(hid_t_f *loc_id, hsize_t_f *nfields, hsize_t_f *nrecords) { - int ret_value = -1; - herr_t ret; - char *c_name = NULL; - int c_namelen; + char *c_name = NULL; hid_t c_loc_id = *loc_id; hsize_t c_nfields; hsize_t c_nrecords; + int_f ret_value = 0; /* - * convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) - goto done; + * convert FORTRAN name to C name + */ + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) /* - * call H5TBread_fields_index function. - */ - - ret = H5TBget_table_info(c_loc_id, - c_name, - &c_nfields, - &c_nrecords); - - if (ret < 0) - goto done; + * call H5TBread_fields_index function. + */ + if(H5TBget_table_info(c_loc_id, c_name, &c_nfields, &c_nrecords) < 0) + HGOTO_DONE(FAIL) *nfields = (hsize_t_f) c_nfields;; *nrecords = (hsize_t_f) c_nrecords; - ret_value = 0; - done: - if(c_name != NULL) - free(c_name); + if(c_name) + HDfree(c_name); return ret_value; } @@ -999,113 +851,88 @@ nh5tbget_field_info_c(hid_t_f *loc_id, _fcd field_names) /* field_names */ { - int ret_value = -1; - herr_t ret; - char *c_name = NULL; - int c_namelen; + char *c_name = NULL; hsize_t num_elem; hsize_t i; - int max_len=1; + int max_len = 1; hid_t c_loc_id = *loc_id; hsize_t c_nfields = *nfields; - size_t *c_field_sizes = NULL; - size_t *c_field_offsets = NULL; + size_t *c_field_sizes = NULL; + size_t *c_field_offsets = NULL; size_t c_type_size; - char **c_field_names = NULL; - char *tmp = NULL, *tmp_p = NULL; - int c_lenmax=HLTB_MAX_FIELD_LEN; - size_t length = 0; + char **c_field_names = NULL; + char *tmp = NULL, *tmp_p; + int c_lenmax = HLTB_MAX_FIELD_LEN; + int_f ret_value = 0; num_elem = c_nfields; - - for (i=0; i < num_elem; i++) - { - if (namelen2[i] > max_len) max_len = namelen2[i]; + for(i = 0; i < num_elem; i++) { + if(namelen2[i] > max_len) + max_len = namelen2[i]; } /* - * convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) - goto done; - - - c_field_offsets = (size_t*)malloc(sizeof(size_t) * (size_t)c_nfields); - if (!c_field_offsets) - goto done; - - c_field_sizes = (size_t*)malloc(sizeof(size_t) * (size_t)c_nfields); - if (!c_field_sizes) - goto done; - - c_field_names = malloc( sizeof(char*) * (size_t)c_nfields ); - if (!c_field_names) return ret_value; - for ( i = 0; i < c_nfields; i++) - { - c_field_names[i] = malloc( sizeof(char) * HLTB_MAX_FIELD_LEN ); - } + * convert FORTRAN name to C name + */ + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) + if(NULL == (c_field_offsets = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) + HGOTO_DONE(FAIL) + if(NULL == (c_field_sizes = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) + HGOTO_DONE(FAIL) + if(NULL == (c_field_names = (char **)HDcalloc((size_t)c_nfields, sizeof(char *)))) + HGOTO_DONE(FAIL) + + for(i = 0; i < c_nfields; i++) + if(NULL == (c_field_names[i] = (char *)HDmalloc(sizeof(char) * HLTB_MAX_FIELD_LEN))) + HGOTO_DONE(FAIL) /* - * call H5TBget_field_info function. - */ - - ret = H5TBget_field_info(c_loc_id, - c_name, - c_field_names, - c_field_sizes, - c_field_offsets, - &c_type_size); + * call H5TBget_field_info function. + */ + if(H5TBget_field_info(c_loc_id, c_name, c_field_names, c_field_sizes, + c_field_offsets, &c_type_size) < 0) + HGOTO_DONE(FAIL) /* return values*/ /* names array */ - tmp = (char *)malloc(c_lenmax* (size_t) c_nfields + 1); + if(NULL == (tmp = (char *)HDmalloc((c_lenmax * (size_t)c_nfields) + 1))) + HGOTO_DONE(FAIL) + tmp_p = tmp; - memset(tmp,' ', c_lenmax* (size_t) c_nfields); - tmp[c_lenmax*c_nfields] = '\0'; - for (i=0; i < c_nfields; i++) - { - memcpy(tmp_p, c_field_names[i], strlen(c_field_names[i])); - namelen2[i] = (int_f)strlen(c_field_names[i]); - length = MAX(length, strlen(c_field_names[i])); - tmp_p = tmp_p + c_lenmax; + HDmemset(tmp, ' ', c_lenmax * (size_t)c_nfields); + tmp[c_lenmax * c_nfields] = '\0'; + for(i = 0; i < c_nfields; i++) { + size_t field_name_len = HDstrlen(c_field_names[i]); + + HDmemcpy(tmp_p, c_field_names[i], field_name_len); + namelen2[i] = (int_f)field_name_len; + tmp_p += c_lenmax; } - HD5packFstring(tmp, _fcdtocp(field_names), (int)(c_lenmax*c_nfields)); - + HD5packFstring(tmp, _fcdtocp(field_names), (int)(c_lenmax * c_nfields)); *type_size = (size_t_f)c_type_size; - for (i=0; i < num_elem; i++) - { + for(i = 0; i < num_elem; i++) { field_sizes[i] = (size_t_f)c_field_sizes[i]; field_offsets[i] = (size_t_f)c_field_offsets[i]; } - - if (ret < 0) - goto done; - - ret_value = 0; - - done: - if(c_name != NULL) - free(c_name); - - for ( i = 0; i < num_elem; i++) - { - if ( c_field_names[i] ) - free (c_field_names[i]); - } - if ( c_field_names ) - free(c_field_names); - if ( tmp ) - free(tmp); - if ( c_field_offsets ) - free(c_field_offsets); - if ( c_field_sizes ) - free(c_field_sizes); + if(c_name) + HDfree(c_name); + if(c_field_names) { + for(i = 0; i < num_elem; i++) + if(c_field_names[i]) + HDfree(c_field_names[i]); + HDfree(c_field_names); + } /* end if */ + if(tmp) + HDfree(tmp); + if(c_field_offsets) + HDfree(c_field_offsets); + if(c_field_sizes) + HDfree(c_field_sizes); return ret_value; } diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index afe8ed4..5359be0 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -350,12 +350,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -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 = 44 +LT_VERS_REVISION = 49 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 @@ -900,7 +900,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -971,7 +971,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/hl/fortran/test/Makefile.in b/hl/fortran/test/Makefile.in index f395240..c6d1c35 100644 --- a/hl/fortran/test/Makefile.in +++ b/hl/fortran/test/Makefile.in @@ -324,12 +324,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -775,7 +775,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -846,7 +846,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index e797d14..d118942 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1668,7 +1668,7 @@ print_enum(hid_t type, char* str, int indt) int nmembs; /*number of members */ char tmp_str[256]; int nchars; /*number of output characters */ - hid_t super; /*enum base integer type */ + hid_t super = -1; /*enum base integer type */ hid_t native = -1; /*native integer data type */ size_t super_size; /*enum base type size */ size_t dst_size; /*destination value type size */ @@ -1742,21 +1742,36 @@ print_enum(hid_t type, char* str, int indt) } /* Release resources */ - for (i = 0; i < nmembs; i++) + for(i = 0; i < nmembs; i++) free(name[i]); free(name); free(value); H5Tclose(super); - if (0 == nmembs) { + return ret; + +out: + + if(0 == nmembs) { sprintf(tmp_str, "\n%*s ", indt + 4, ""); strcat(str, tmp_str); - } + } /* end if */ + + /* Release resources */ + if(name) { + for(i = 0; i < nmembs; i++) + if(name[i]) + free(name[i]); + free(name); + } /* end if */ - return ret; + if(value) + free(value); + + if(super >= 0) + H5Tclose(super); -out: return FAIL; } diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index 10d2637..3d16db5 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -214,6 +214,11 @@ out: * * Modifications: * + * John Mainzer -- 4/23/08 + * Added error check on malloc of table, initialized fields + * in table to keep lower level code from choking on bogus + * data in error cases. + * *------------------------------------------------------------------------- */ hid_t H5PTopen( hid_t loc_id, @@ -232,6 +237,12 @@ hid_t H5PTopen( hid_t loc_id, table = (htbl_t *)malloc(sizeof(htbl_t)); + if ( table == NULL ) { + goto out; + } + table->dset_id = H5I_BADID; + table->type_id = H5I_BADID; + /* Open the dataset */ if((table->dset_id = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index a035319..b9cb73c 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -3213,16 +3213,12 @@ herr_t H5TBget_field_info( hid_t loc_id, size_t *field_offsets, size_t *type_size ) { - hid_t did; /* dataset ID */ - hid_t tid; /* file type ID */ - hid_t n_tid; /* native type ID */ - hid_t m_tid; /* member type ID */ - hid_t nm_tid; /* native member ID */ + hid_t did = -1; /* dataset ID */ + hid_t tid = -1; /* file type ID */ + hid_t n_tid = -1; /* native type ID */ + hid_t m_tid = -1; /* member type ID */ + hid_t nm_tid = -1; /* native member ID */ hssize_t nfields; - char *member_name; - size_t member_size; - size_t member_offset; - size_t size; hssize_t i; /* open the dataset. */ @@ -3233,62 +3229,47 @@ herr_t H5TBget_field_info( hid_t loc_id, if (( tid = H5Dget_type( did )) < 0) goto out; - if ((n_tid = H5Tget_native_type(tid,H5T_DIR_DEFAULT)) < 0) + if ((n_tid = H5Tget_native_type(tid, H5T_DIR_DEFAULT)) < 0) goto out; /* get the type size */ - size = H5Tget_size( n_tid ); - - if ( type_size ) - { - *type_size = size; - } + if(type_size) + *type_size = H5Tget_size(n_tid); /* get the number of members */ if (( nfields = H5Tget_nmembers( tid )) < 0) goto out; /* iterate tru the members */ - for ( i = 0; i < nfields; i++) - { + for ( i = 0; i < nfields; i++) { /* get the member name */ - member_name = H5Tget_member_name( tid, (unsigned)i ); + if(field_names) { + char *member_name; - if (field_names ) - { - strcpy( field_names[i], member_name ); - } + member_name = H5Tget_member_name(tid, (unsigned)i); + strcpy(field_names[i], member_name); + free(member_name); + } /* end if */ /* get the member type */ - if (( m_tid = H5Tget_member_type( tid,(unsigned) i )) < 0) + if(( m_tid = H5Tget_member_type( tid,(unsigned) i )) < 0) goto out; - if ((nm_tid = H5Tget_native_type(m_tid,H5T_DIR_DEFAULT)) < 0) + if((nm_tid = H5Tget_native_type(m_tid,H5T_DIR_DEFAULT)) < 0) goto out; /* get the member size */ - member_size = H5Tget_size( nm_tid ); - - if(field_sizes ) - { - field_sizes[i] = member_size; - } + if(field_sizes) + field_sizes[i] = H5Tget_size(nm_tid); /* get the member offset */ - member_offset = H5Tget_member_offset( n_tid,(unsigned) i ); - - if(field_offsets ) - { - field_offsets[i] = member_offset; - } + if(field_offsets) + field_offsets[i] = H5Tget_member_offset(n_tid, (unsigned) i); /* close the member types */ if (H5Tclose( m_tid ) < 0) goto out; if (H5Tclose( nm_tid ) < 0) goto out; - - free( member_name ); - } /* i */ /* close */ @@ -3308,6 +3289,8 @@ out: H5Dclose(did); H5Tclose(tid); H5Tclose(n_tid); + H5Tclose(m_tid); + H5Tclose(nm_tid); } H5E_END_TRY; return -1; diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index 0e3bd46..36ebcf9 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -341,12 +341,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -380,7 +380,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 = 44 +LT_VERS_REVISION = 49 LT_VERS_AGE = 0 # This library is our main target. @@ -866,7 +866,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -937,7 +937,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/hl/test/Makefile.in b/hl/test/Makefile.in index 4a5aa5b..a364c75 100644 --- a/hl/test/Makefile.in +++ b/hl/test/Makefile.in @@ -345,12 +345,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -837,7 +837,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -908,7 +908,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 7e0f20e..32622ed 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -4889,6 +4889,7 @@ static int read_data( const char* fname, if ( *buf == NULL ) { printf( "memory allocation failed\n" ); + fclose(f); return -1; } diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 21afc54..95869af 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1534,17 +1534,16 @@ static int test_complicated_compound(void) hid_t dtype; int nmembs; H5T_class_t type_class; - char* line=NULL; - FILE *fp; + char *line = NULL; + FILE *fp = NULL; size_t size = 1024; - char *srcdir = getenv("srcdir"); /* the source directory */ + char *srcdir = getenv("srcdir"); /* the source directory */ char filename[1024]=""; TESTING3(" text for complicated compound types"); /* compose the name of the file to open, using the srcdir, if appropriate */ - if(srcdir) - { + if(srcdir) { strcpy(filename, srcdir); strcat(filename, "/"); } @@ -1552,8 +1551,7 @@ static int test_complicated_compound(void) /* Open input file */ fp = fopen(filename, "r"); - if(fp == NULL) - { + if(fp == NULL) { printf( "Could not find file %s. Try set $srcdir \n", filename); goto out; } @@ -1579,6 +1577,7 @@ static int test_complicated_compound(void) } fclose(fp); + fp = NULL; if((dtype = H5LTtext_to_dtype(line, H5LT_DDL))<0) goto out; @@ -1601,6 +1600,12 @@ static int test_complicated_compound(void) return 0; out: + + if(line) + free(line); + if(fp) + fclose(fp); + H5_FAILED(); return -1; } diff --git a/hl/tools/Makefile.in b/hl/tools/Makefile.in index 2738d84..cb80338 100644 --- a/hl/tools/Makefile.in +++ b/hl/tools/Makefile.in @@ -330,12 +330,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -844,7 +844,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -915,7 +915,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/hl/tools/gif2h5/Makefile.in b/hl/tools/gif2h5/Makefile.in index e43dd07..b4cf901 100644 --- a/hl/tools/gif2h5/Makefile.in +++ b/hl/tools/gif2h5/Makefile.in @@ -330,12 +330,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -853,7 +853,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -924,7 +924,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index 435e272..2e44f1c 100644 --- a/hl/tools/gif2h5/decompress.c +++ b/hl/tools/gif2h5/decompress.c @@ -222,7 +222,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) if (!(Image = (BYTE *)malloc((size_t)IWidth*(size_t)IHeight))) { printf("Out of memory"); - exit(-1); + exit(EXIT_FAILURE); } BytesPerScanline = IWidth; diff --git a/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c index c7e4ab6..39c71cf 100644 --- a/hl/tools/gif2h5/gif2hdf.c +++ b/hl/tools/gif2h5/gif2hdf.c @@ -60,7 +60,7 @@ main(int argv , char *argc[]) printf("Usage: gif2h5 \n"); fprintf(stdout, " gif2h5 -V \n"); fprintf(stdout, " Print HDF5 library version and exit\n"); - return(-1); + exit(EXIT_FAILURE); } GIFFileName = argc[1]; @@ -68,7 +68,7 @@ main(int argv , char *argc[]) if (!(fpGif = fopen(GIFFileName,"rb"))) { printf("Unable to open GIF file for reading.\n"); - exit(-1); + exit(EXIT_FAILURE); } /* Get the whole file into memory. Mem's much faster than I/O */ @@ -81,12 +81,12 @@ main(int argv , char *argc[]) if (!(MemGif = StartPos = (BYTE *)malloc((size_t)filesize))) { printf("Out of memory"); - exit (-1); + exit(EXIT_FAILURE); } if (fread(MemGif,(size_t)filesize,1,fpGif) != 1) { printf("Corrupted Input File"); - exit(-1); + exit(EXIT_FAILURE); } fseek(fpGif,0L,0); @@ -99,7 +99,7 @@ main(int argv , char *argc[]) if (ferror(fpGif)) { printf("File Stream Error\n\n"); - exit(-1); + exit(EXIT_FAILURE); } fclose(fpGif); @@ -157,5 +157,5 @@ main(int argv , char *argc[]) } - return 0; + return EXIT_SUCCESS; } diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c index 6274b9a..907fb80 100644 --- a/hl/tools/gif2h5/gif2mem.c +++ b/hl/tools/gif2h5/gif2mem.c @@ -77,7 +77,7 @@ Gif2Mem(BYTE *MemGif) /****************************************************/ if (!(gifHead = (GIFHEAD *)malloc(sizeof(GIFHEAD)))) { printf("Could not allocate memory for gifHead\n"); - exit(-1); + exit(EXIT_FAILURE); } /* @@ -107,7 +107,7 @@ Gif2Mem(BYTE *MemGif) if (ferror(fpGif)) { fputs("GIFHEAD: Error reading header information!\n", stderr); - exit(-3); + exit(EXIT_FAILURE); } #endif /* 0 */ @@ -161,14 +161,14 @@ Gif2Mem(BYTE *MemGif) if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc, sizeof(GIFIMAGEDESC *) * ImageArray))) { printf("Out of memory!"); - exit(-1); + exit(EXIT_FAILURE); } if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc( gifGraphicControl, sizeof(GIFGRAPHICCONTROL *) * ImageArray))) { printf("Out of memory!"); - exit(-1); + exit(EXIT_FAILURE); } for (j = aTemp ; j < ImageArray ; j++) { @@ -179,7 +179,7 @@ Gif2Mem(BYTE *MemGif) if(!(gifImageDesc[ImageCount-1] = (GIFIMAGEDESC*)malloc(sizeof(GIFIMAGEDESC)))) { printf("Out of memory!"); - exit(-1); + exit(EXIT_FAILURE); } @@ -228,12 +228,12 @@ Gif2Mem(BYTE *MemGif) if (!(gifPlainText = (GIFPLAINTEXT **)realloc(gifPlainText , sizeof(GIFPLAINTEXT *) * PlainTextArray))) { printf("Out of memory!"); - exit(-1); + exit(EXIT_FAILURE); } if(!(gifPlainText[PlainTextCount - 1] = (GIFPLAINTEXT*)malloc(sizeof(GIFPLAINTEXT)))) { printf("Out of memory!"); - exit(-1); + exit(EXIT_FAILURE); } if (ReadGifPlainText(gifPlainText[PlainTextCount - 1], &MemGif)) @@ -250,12 +250,12 @@ Gif2Mem(BYTE *MemGif) if (!(gifComment = (GIFCOMMENT **)realloc(gifComment , sizeof(GIFCOMMENT *) * CommentArray))) { printf("Out of memory!"); - exit(-1); + exit(EXIT_FAILURE); } if(!(gifComment[CommentCount - 1] = (GIFCOMMENT *)malloc(sizeof(GIFCOMMENT)))) { printf("Out of memory!"); - exit(-1); + exit(EXIT_FAILURE); } @@ -277,12 +277,12 @@ Gif2Mem(BYTE *MemGif) if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc(gifGraphicControl , sizeof(GIFGRAPHICCONTROL *) * ImageArray))) { printf("Out of memory!"); - exit(-1); + exit(EXIT_FAILURE); } if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc , sizeof(GIFIMAGEDESC *) * ImageArray))) { printf("Out of memory!"); - exit(-1); + exit(EXIT_FAILURE); } for (j = aTemp ; j < ImageArray ; j++) { @@ -293,7 +293,7 @@ Gif2Mem(BYTE *MemGif) if(!(gifGraphicControl[ImageCount-1] = (GIFGRAPHICCONTROL*)malloc(sizeof(GIFGRAPHICCONTROL)))) { printf("Out of memory!"); - exit(-1); + exit(EXIT_FAILURE); } @@ -315,12 +315,12 @@ Gif2Mem(BYTE *MemGif) if (!(gifApplication = (GIFAPPLICATION **)realloc(gifApplication , sizeof(GIFAPPLICATION *) * ApplicationArray))) { printf("Out of memory!"); - exit(-1); + exit(EXIT_FAILURE); } if(!(gifApplication[ApplicationCount - 1] = (GIFAPPLICATION *)malloc(sizeof(GIFAPPLICATION)))) { printf("Out of memory!"); - exit(-1); + exit(EXIT_FAILURE); } diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c index a08564a..2b4c129 100644 --- a/hl/tools/gif2h5/gifread.c +++ b/hl/tools/gif2h5/gifread.c @@ -68,7 +68,7 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */ if (strncmp((const char *)GifHead->HeaderDump , "GIF" , (size_t)3)) { printf("The file does not appear to be a valid GIF file.\n"); - exit(-1); + exit(EXIT_FAILURE); } for (i = 0 ; i < 7 ; i++) { @@ -192,7 +192,7 @@ ReadGifImageDesc( /*GifImageDesc->GIFImage = ReadDataSubBlocks(FpGif);*/ if (!(GifImageDesc->GIFImage = (BYTE *)malloc((GifImageDesc->ImageWidth) * (GifImageDesc->ImageHeight)))) { printf("Out of memory"); - exit(-1); + exit(EXIT_FAILURE); } diff --git a/hl/tools/gif2h5/h52gifgentst.c b/hl/tools/gif2h5/h52gifgentst.c index eb83335..ef38c3b 100644 --- a/hl/tools/gif2h5/h52gifgentst.c +++ b/hl/tools/gif2h5/h52gifgentst.c @@ -58,7 +58,7 @@ int main(void) /* create a file */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) - return 1; + return EXIT_FAILURE; /* create an image */ space = WIDTH*HEIGHT / PAL_ENTRIES; @@ -75,7 +75,7 @@ int main(void) /* make the image */ if (H5IMmake_image_8bit( fid, IMAGE1_NAME, width, height, buf )<0) - return 1; + return EXIT_FAILURE; /*------------------------------------------------------------------------- * define a palette, blue to red tones @@ -90,15 +90,15 @@ int main(void) /* make a palette */ if (H5IMmake_palette( fid, PAL_NAME, pal_dims, pal )<0) - return 1; + return EXIT_FAILURE; /* attach the palette to the image */ if (H5IMlink_palette( fid, IMAGE1_NAME, PAL_NAME )<0) - return 1; + return EXIT_FAILURE; if(H5Fclose(fid)<0) - return 1; + return EXIT_FAILURE; - return 0; + return EXIT_SUCCESS; } diff --git a/hl/tools/gif2h5/h52giftest.sh b/hl/tools/gif2h5/h52giftest.sh index 7874bca..186b369 100644 --- a/hl/tools/gif2h5/h52giftest.sh +++ b/hl/tools/gif2h5/h52giftest.sh @@ -64,4 +64,10 @@ TESTING "./gif2h5 image1.gif image1.h5" TOOLTEST2 $TESTFILE2 image1.h5 -exit $errors +if test $errors -eq 0 ; then + echo "All h52gif tests passed." + exit 0 +else + echo "h52gif tests failed with $errors errors." + exit 1 +fi diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c index 9c252e1..cc8e864 100644 --- a/hl/tools/gif2h5/hdf2gif.c +++ b/hl/tools/gif2h5/hdf2gif.c @@ -82,7 +82,7 @@ int main(int argc , char **argv) { /* they didn't supply at least one image -- bail */ usage(); - return 1; + return EXIT_FAILURE; } HDFName = argv[1]; @@ -313,7 +313,7 @@ int main(int argc , char **argv) if (image_name != NULL) free(image_name); - return 0; + return EXIT_SUCCESS; out: @@ -323,5 +323,5 @@ out: if (image_name != NULL) free(image_name); - return 1; + return EXIT_FAILURE; } diff --git a/perform/Makefile.in b/perform/Makefile.in index da941e3..a5a28f5 100644 --- a/perform/Makefile.in +++ b/perform/Makefile.in @@ -366,12 +366,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -931,7 +931,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -1002,7 +1002,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 6a75c48..b9f7675 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.52-FA_a4 currently under development +HDF5 version 1.9.59-FA_a4 currently under development ================================================================================ @@ -142,6 +142,9 @@ New Features Tools: ------ + - h5diff: Add new flag -l (--link-follow),for comparing through links + (soft and external links along with hard link). + (JKM - 2010/01/25) - h5diff: fix for displaying garbage value on LE machine for BE data. (JKM - 2009/11/20) - h5dump subsetting now allows default for count. Also trailing ; in short form diff --git a/src/H5A.c b/src/H5A.c index d359130..c958bbd 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -1034,9 +1034,9 @@ done: if(dst_id >= 0) (void)H5I_dec_ref(dst_id, FALSE); if(tconv_buf && !tconv_owned) - (void)H5FL_BLK_FREE(attr_buf, tconv_buf); + tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); if(bkg_buf) - (void)H5FL_BLK_FREE(attr_buf, bkg_buf); + bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); FUNC_LEAVE_NOAPI(ret_value) } /* H5A_write() */ @@ -1180,9 +1180,9 @@ done: if(dst_id >= 0) (void)H5I_dec_ref(dst_id, FALSE); if(tconv_buf) - (void)H5FL_BLK_FREE(attr_buf, tconv_buf); + tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); if(bkg_buf) - (void)H5FL_BLK_FREE(attr_buf, bkg_buf); + bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); FUNC_LEAVE_NOAPI(ret_value) } /* H5A_read() */ diff --git a/src/H5AC.c b/src/H5AC.c index 8e2ced6..659c4e6 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -154,8 +154,7 @@ static herr_t H5AC_log_deleted_entry(H5AC_t * cache_ptr, haddr_t addr, unsigned int flags); -static herr_t H5AC_log_dirtied_entry(H5AC_t * cache_ptr, - H5C_cache_entry_t * entry_ptr, +static herr_t H5AC_log_dirtied_entry(const H5C_cache_entry_t *entry_ptr, haddr_t addr, hbool_t size_changed, size_t new_size); @@ -190,7 +189,7 @@ static herr_t H5AC_receive_and_apply_clean_list(H5F_t * f, hid_t secondary_dxpl_id, H5AC_t * cache_ptr); -static herr_t H5AC_log_renamed_entry(H5AC_t * cache_ptr, +static herr_t H5AC_log_renamed_entry(const H5F_t * f, haddr_t old_addr, haddr_t new_addr); @@ -480,7 +479,8 @@ static const char * H5AC_entry_type_names[H5AC_NTYPES] = { "B-tree nodes", "symbol table nodes", - "local heaps", + "local heap prefixes", + "local heap data blocks", "global heaps", "object headers", "v2 B-tree headers", @@ -522,11 +522,11 @@ H5AC_create(const H5F_t *f, FUNC_ENTER_NOAPI(H5AC_create, FAIL) - HDassert ( f ); - HDassert ( NULL == f->shared->cache ); - HDassert ( config_ptr != NULL ) ; - HDassert ( NELMTS(H5AC_entry_type_names) == H5AC_NTYPES); - HDassert ( H5C__MAX_NUM_TYPE_IDS == H5AC_NTYPES); + HDassert(f); + HDassert(NULL == f->shared->cache); + HDassert(config_ptr != NULL) ; + HDcompile_assert(NELMTS(H5AC_entry_type_names) == H5AC_NTYPES); + HDcompile_assert(H5C__MAX_NUM_TYPE_IDS == H5AC_NTYPES); result = H5AC_validate_config(config_ptr); @@ -744,25 +744,6 @@ done: * matzke@llnl.gov * Jul 9 1997 * - * Modifications: - * - * Complete re-design and re-write to support the re-designed - * metadata cache. - * JRM - 5/12/04 - * - * Abstracted the guts of the function to H5C_dest() in H5C.c, - * and then re-wrote the function as a wrapper for H5C_dest(). - * - * JRM - 6/7/04 - * - * Added code to free the auxiliary structure and its - * associated slist if present. - * JRM - 6/28/05 - * - * Added code to close the trace file if it is present. - * - * JRM - 6/8/06 - * *------------------------------------------------------------------------- */ herr_t @@ -796,7 +777,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) #endif /* H5_HAVE_PARALLEL */ /* Destroy the cache */ - if(H5C_dest(f, dxpl_id, H5AC_noblock_dxpl_id, f->shared->cache) < 0) + if(H5C_dest(f, dxpl_id, H5AC_noblock_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't destroy cache") f->shared->cache = NULL; @@ -845,7 +826,6 @@ H5AC_expunge_entry(H5F_t *f, unsigned flags) { herr_t result; - H5AC_t * cache_ptr = NULL; #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; FILE * trace_file_ptr = NULL; @@ -862,11 +842,13 @@ H5AC_expunge_entry(H5F_t *f, HDassert(type->dest); HDassert(H5F_addr_defined(addr)); - cache_ptr = f->shared->cache; - #if H5AC__TRACE_FILE_ENABLED - /* For the expunge entry call, only the addr, and type id are really - * necessary in the trace file. Write the return value to catch occult +{ + H5AC_t * cache_ptr = f->shared->cache; + + + /* For the expunge entry call, only the addr, and type id are really + * necessary in the trace file. Write the return value to catch occult * errors. */ if ( ( cache_ptr != NULL ) && @@ -877,12 +859,12 @@ H5AC_expunge_entry(H5F_t *f, (unsigned long)addr, (int)(type->id)); } +} #endif /* H5AC__TRACE_FILE_ENABLED */ result = H5C_expunge_entry(f, dxpl_id, H5AC_noblock_dxpl_id, - cache_ptr, type, addr, flags); @@ -960,7 +942,7 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id) #endif /* H5_HAVE_PARALLEL */ /* Flush the cache */ - if(H5C_flush_cache(f, dxpl_id, H5AC_noblock_dxpl_id, f->shared->cache, H5AC__NO_FLAGS_SET) < 0) + if(H5C_flush_cache(f, dxpl_id, H5AC_noblock_dxpl_id, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache.") done: @@ -998,14 +980,12 @@ done: * *------------------------------------------------------------------------- */ - herr_t -H5AC_get_entry_status(H5F_t * f, +H5AC_get_entry_status(const H5F_t *f, haddr_t addr, unsigned * status_ptr) { H5C_t *cache_ptr = f->shared->cache; - herr_t ret_value = SUCCEED; /* Return value */ herr_t result; hbool_t in_cache; hbool_t is_dirty; @@ -1015,6 +995,7 @@ H5AC_get_entry_status(H5F_t * f, hbool_t is_flush_dep_parent; size_t entry_size; unsigned status = 0; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_get_entry_status, FAIL) @@ -1026,7 +1007,7 @@ H5AC_get_entry_status(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry.") } - result = H5C_get_entry_status(cache_ptr, addr, &entry_size, &in_cache, + result = H5C_get_entry_status(f, addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, &is_flush_dep_parent, &is_flush_dep_child); @@ -1135,7 +1116,6 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, { herr_t result; H5AC_info_t *info; - H5AC_t *cache; #ifdef H5_HAVE_PARALLEL H5AC_aux_t * aux_ptr = NULL; #endif /* H5_HAVE_PARALLEL */ @@ -1182,7 +1162,6 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, #endif /* H5AC__TRACE_FILE_ENABLED */ /* Get local copy of this information */ - cache = f->shared->cache; info = (H5AC_info_t *)thing; info->addr = addr; @@ -1209,7 +1188,6 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, result = H5C_insert_entry(f, dxpl_id, H5AC_noblock_dxpl_id, - cache, type, addr, thing, @@ -1274,109 +1252,66 @@ done: * Programmer: John Mainzer * 4/11/06 * - * Modifications: - * - * Added trace file support. JRM -- 6/6/06 - * *------------------------------------------------------------------------- */ herr_t -H5AC_mark_pinned_entry_dirty(H5F_t * f, - void * thing, - hbool_t size_changed, - size_t new_size) +H5AC_mark_pinned_entry_dirty(void *thing, hbool_t size_changed, size_t new_size) { - H5C_t *cache_ptr = f->shared->cache; - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_mark_pinned_entry_dirty, FAIL) + /* Sanity check */ + HDassert(thing); + #if H5AC__TRACE_FILE_ENABLED /* For the mark pinned entry dirty call, only the addr, size_changed, * and new_size are really necessary in the trace file. Write the result * to catch occult errors. */ - if ( ( f != NULL ) && - ( f->shared != NULL ) && - ( f->shared->cache != NULL ) && - ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) && - ( trace_file_ptr != NULL ) ) { - - sprintf(trace, "H5AC_mark_pinned_entry_dirty 0x%lx %d %d", + if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + (NULL != trace_file_ptr)) + sprintf(trace, "%s 0x%lx %d %d", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr), (int)size_changed, (int)new_size); - } #endif /* H5AC__TRACE_FILE_ENABLED */ #ifdef H5_HAVE_PARALLEL +{ + H5AC_info_t *entry_ptr = (H5AC_info_t *)thing; + H5C_t *cache_ptr = entry_ptr->cache_ptr; - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - - if ( ( ((H5AC_info_t *)thing)->is_dirty == FALSE ) && - ( NULL != cache_ptr->aux_ptr) ) { - - H5AC_info_t * entry_ptr; - - HDassert( ( size_changed == TRUE ) || ( size_changed == FALSE ) ); - - entry_ptr = (H5AC_info_t *)thing; - - if ( ! ( entry_ptr->is_pinned ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "Entry isn't pinned??") - } - - if ( entry_ptr->is_protected ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "Entry is protected??") - } + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - result = H5AC_log_dirtied_entry(cache_ptr, - entry_ptr, - entry_ptr->addr, - size_changed, - new_size); + if((!entry_ptr->is_dirty) && (NULL != cache_ptr->aux_ptr)) { + /* Check for usage errors */ + if(!entry_ptr->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry isn't pinned??") + if(entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry is protected??") - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "H5AC_log_dirtied_entry() failed.") - } - } + if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr, size_changed, new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry") + } /* end if */ +} #endif /* H5_HAVE_PARALLEL */ - result = H5C_mark_pinned_entry_dirty(cache_ptr, - thing, - size_changed, - new_size); - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "H5C_mark_pinned_entry_dirty() failed.") - - } + if(H5C_mark_pinned_entry_dirty(thing, size_changed, new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned entry dirty") done: - #if H5AC__TRACE_FILE_ENABLED - if ( trace_file_ptr != NULL ) { - + if(trace_file_ptr) HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); - } #endif /* H5AC__TRACE_FILE_ENABLED */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_mark_pinned_entry_dirty() */ @@ -1394,92 +1329,59 @@ done: * Programmer: John Mainzer * 5/16/06 * - * Modifications: - * - * Added trace file support. JRM -- 6/6/06 - * *------------------------------------------------------------------------- */ herr_t -H5AC_mark_pinned_or_protected_entry_dirty(H5F_t * f, - void * thing) +H5AC_mark_pinned_or_protected_entry_dirty(void *thing) { - H5C_t * cache_ptr = f->shared->cache; -#ifdef H5_HAVE_PARALLEL - H5AC_info_t * info_ptr; -#endif /* H5_HAVE_PARALLEL */ - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_mark_pinned_or_protected_entry_dirty, FAIL) + /* Sanity check */ + HDassert(thing); + #if H5AC__TRACE_FILE_ENABLED /* For the mark pinned or protected entry dirty call, only the addr * is really necessary in the trace file. Write the result to catch * occult errors. */ - if ( ( f != NULL ) && - ( f->shared != NULL ) && - ( f->shared->cache != NULL ) && - ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) && - ( trace_file_ptr != NULL ) ) { - - sprintf(trace, "H5AC_mark_pinned_or_protected_entry_dirty %lx", + if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + (NULL != trace_file_ptr)) + sprintf(trace, "%s %lx", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); - } #endif /* H5AC__TRACE_FILE_ENABLED */ #ifdef H5_HAVE_PARALLEL +{ + H5AC_info_t *entry_ptr = (H5AC_info_t *)thing; + H5C_t *cache_ptr = entry_ptr->cache_ptr; - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - - info_ptr = (H5AC_info_t *)thing; - - if ( ( info_ptr->is_dirty == FALSE ) && - ( ! ( info_ptr->is_protected ) ) && - ( info_ptr->is_pinned ) && - ( NULL != cache_ptr->aux_ptr) ) { - - result = H5AC_log_dirtied_entry(cache_ptr, - info_ptr, - info_ptr->addr, - FALSE, - 0); - - if ( result < 0 ) { + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "H5AC_log_dirtied_entry() failed.") - } - } + if((!entry_ptr->is_dirty) && (!entry_ptr->is_protected) && + (entry_ptr->is_pinned) && (NULL != cache_ptr->aux_ptr)) { + if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr, FALSE, 0) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry") + } /* end if */ +} #endif /* H5_HAVE_PARALLEL */ - result = H5C_mark_pinned_or_protected_entry_dirty(cache_ptr, thing); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "H5C_mark_pinned_entry_dirty() failed.") - - } + if(H5C_mark_pinned_or_protected_entry_dirty(thing) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned or protected entry dirty") done: - #if H5AC__TRACE_FILE_ENABLED - if ( trace_file_ptr != NULL ) { - + if(trace_file_ptr) HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); - } #endif /* H5AC__TRACE_FILE_ENABLED */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_mark_pinned_or_protected_entry_dirty() */ @@ -1570,16 +1472,8 @@ H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_ad #ifdef H5_HAVE_PARALLEL if ( NULL != (aux_ptr = f->shared->cache->aux_ptr) ) { - - result = H5AC_log_renamed_entry(f->shared->cache, - old_addr, - new_addr); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ - "H5AC_log_renamed_entry() failed.") - } + if(H5AC_log_renamed_entry(f, old_addr, new_addr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log renamed entry") } #endif /* H5_HAVE_PARALLEL */ @@ -1635,60 +1529,42 @@ done: * Programmer: John Mainzer * 4/27/06 * - * Modifications: - * - * Added trace file support. 6/6/06 - * *------------------------------------------------------------------------- */ herr_t -H5AC_pin_protected_entry(H5F_t * f, - void * thing) +H5AC_pin_protected_entry(void *thing) { - H5C_t *cache_ptr = f->shared->cache; - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_pin_protected_entry, FAIL) + /* Sanity check */ + HDassert(thing); + #if H5AC__TRACE_FILE_ENABLED /* For the pin protected entry call, only the addr is really necessary * in the trace file. Also write the result to catch occult errors. */ - if ( ( f != NULL ) && - ( f->shared != NULL ) && - ( f->shared->cache != NULL ) && - ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) && - ( trace_file_ptr != NULL ) ) { - - sprintf(trace, "H5AC_pin_protected_entry %lx", + if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + (NULL != trace_file_ptr)) + sprintf(trace, "%s %lx", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); - } #endif /* H5AC__TRACE_FILE_ENABLED */ - result = H5C_pin_protected_entry(cache_ptr, thing); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, \ - "H5C_pin_protected_entry() failed.") - } + if(H5C_pin_protected_entry(thing) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "can't pin entry") done: - #if H5AC__TRACE_FILE_ENABLED - if ( trace_file_ptr != NULL ) { - + if(trace_file_ptr) HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); - } #endif /* H5AC__TRACE_FILE_ENABLED */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_pin_protected_entry() */ @@ -1706,9 +1582,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_create_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing) +H5AC_create_flush_dependency(void * parent_thing, void * child_thing) { - H5C_t *cache_ptr = f->shared->cache; #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; FILE * trace_file_ptr = NULL; @@ -1718,13 +1593,12 @@ H5AC_create_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing) FUNC_ENTER_NOAPI(H5AC_create_flush_dependency, FAIL) /* Sanity check */ - HDassert(cache_ptr); HDassert(parent_thing); HDassert(child_thing); #if H5AC__TRACE_FILE_ENABLED - if ( ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) && - ( trace_file_ptr != NULL ) ) { + if((H5C_get_trace_file_ptr_from_entry(parent_thing, &trace_file_ptr) >= 0) && + (NULL != trace_file_ptr)) sprintf(trace, "%s %lx %lx", FUNC, (unsigned long)(((H5C_cache_entry_t *)parent_thing)->addr), @@ -1732,7 +1606,7 @@ H5AC_create_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing) } /* end if */ #endif /* H5AC__TRACE_FILE_ENABLED */ - if(H5C_create_flush_dependency(cache_ptr, parent_thing, child_thing) < 0) + if(H5C_create_flush_dependency(parent_thing, child_thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "H5C_create_flush_dependency() failed.") done: @@ -1891,7 +1765,6 @@ H5AC_protect(H5F_t *f, thing = H5C_protect(f, dxpl_id, H5AC_noblock_dxpl_id, - f->shared->cache, type, addr, udata1, @@ -1941,104 +1814,65 @@ done: * Programmer: John Mainzer * 7/5/06 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t -H5AC_resize_pinned_entry(H5F_t * f, - void * thing, - size_t new_size) +H5AC_resize_pinned_entry(void *thing, size_t new_size) { - H5C_t *cache_ptr = f->shared->cache; - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_resize_pinned_entry, FAIL) + /* Sanity check */ + HDassert(thing); + #if H5AC__TRACE_FILE_ENABLED /* For the resize pinned entry call, only the addr, and new_size are * really necessary in the trace file. Write the result to catch * occult errors. */ - if ( ( f != NULL ) && - ( f->shared != NULL ) && - ( f->shared->cache != NULL ) && - ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) && - ( trace_file_ptr != NULL ) ) { - - sprintf(trace, "H5AC_resize_pinned_entry 0x%lx %d", + if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + (NULL != trace_file_ptr)) + sprintf(trace, "%s 0x%lx %d", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr), (int)new_size); - } #endif /* H5AC__TRACE_FILE_ENABLED */ #ifdef H5_HAVE_PARALLEL +{ + H5AC_info_t * entry_ptr = (H5AC_info_t *)thing; + H5C_t *cache_ptr = entry_ptr->cache_ptr; - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - - if ( ( ((H5AC_info_t *)thing)->is_dirty == FALSE ) && - ( NULL != cache_ptr->aux_ptr) ) { - - H5AC_info_t * entry_ptr; - - entry_ptr = (H5AC_info_t *)thing; - - if ( ! ( entry_ptr->is_pinned ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \ - "Entry isn't pinned??") - } - - if ( entry_ptr->is_protected ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \ - "Entry is protected??") - } - - result = H5AC_log_dirtied_entry(cache_ptr, - entry_ptr, - entry_ptr->addr, - TRUE, - new_size); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - if ( result < 0 ) { + if((!entry_ptr->is_dirty) && (NULL != cache_ptr->aux_ptr)) { + /* Check for usage errors */ + if(!entry_ptr->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry isn't pinned??") + if(entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry is protected??") - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "H5AC_log_dirtied_entry() failed.") - } - } + if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr, TRUE, new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry") + } /* end if */ +} #endif /* H5_HAVE_PARALLEL */ - result = H5C_resize_pinned_entry(cache_ptr, - thing, - new_size); - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \ - "H5C_resize_pinned_entry() failed.") - - } + if(H5C_resize_pinned_entry(thing, new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "can't resize entry") done: - #if H5AC__TRACE_FILE_ENABLED - if ( trace_file_ptr != NULL ) { - + if(trace_file_ptr) HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); - } #endif /* H5AC__TRACE_FILE_ENABLED */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_resize_pinned_entry() */ @@ -2053,59 +1887,42 @@ done: * Programmer: John Mainzer * 4/11/06 * - * Modifications: - * - * Added code supporting the trace file. JRM -- 6/7/06 - * *------------------------------------------------------------------------- */ herr_t -H5AC_unpin_entry(H5F_t * f, - void * thing) +H5AC_unpin_entry(void * thing) { - H5C_t *cache_ptr = f->shared->cache; - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_unpin_entry, FAIL) + /* Sanity check */ + HDassert(thing); + #if H5AC__TRACE_FILE_ENABLED /* For the unpin entry call, only the addr is really necessary * in the trace file. Also write the result to catch occult errors. */ - if ( ( f != NULL ) && - ( f->shared != NULL ) && - ( f->shared->cache != NULL ) && - ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) && - ( trace_file_ptr != NULL ) ) { - - sprintf(trace, "H5AC_unpin_entry %lx", + if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + (NULL != trace_file_ptr)) + sprintf(trace, "%s %lx", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); - } #endif /* H5AC__TRACE_FILE_ENABLED */ - result = H5C_unpin_entry(cache_ptr, thing); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "H5C_unpin_entry() failed.") - } + if(H5C_unpin_entry(thing) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry") done: - #if H5AC__TRACE_FILE_ENABLED - if ( trace_file_ptr != NULL ) { - + if(trace_file_ptr) HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); - } #endif /* H5AC__TRACE_FILE_ENABLED */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_unpin_entry() */ @@ -2122,9 +1939,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_destroy_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing) +H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing) { - H5C_t *cache_ptr = f->shared->cache; #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; FILE * trace_file_ptr = NULL; @@ -2134,13 +1950,12 @@ H5AC_destroy_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing FUNC_ENTER_NOAPI(H5AC_destroy_flush_dependency, FAIL) /* Sanity check */ - HDassert(cache_ptr); HDassert(parent_thing); HDassert(child_thing); #if H5AC__TRACE_FILE_ENABLED - if ( ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) && - ( trace_file_ptr != NULL ) ) { + if((H5C_get_trace_file_ptr_from_entry(parent_thing, &trace_file_ptr) >= 0) && + (NULL != trace_file_ptr)) sprintf(trace, "%s %lx", FUNC, (unsigned long)(((H5C_cache_entry_t *)parent_thing)->addr), @@ -2148,7 +1963,7 @@ H5AC_destroy_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing } /* end if */ #endif /* H5AC__TRACE_FILE_ENABLED */ - if(H5C_destroy_flush_dependency(cache_ptr, parent_thing, child_thing) < 0) + if(H5C_destroy_flush_dependency(parent_thing, child_thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "H5C_destroy_flush_dependency() failed.") done: @@ -2331,18 +2146,8 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, #ifdef H5_HAVE_PARALLEL if ( ( dirtied ) && ( ((H5AC_info_t *)thing)->is_dirty == FALSE ) && ( NULL != (aux_ptr = f->shared->cache->aux_ptr) ) ) { - - result = H5AC_log_dirtied_entry(f->shared->cache, - (H5AC_info_t *)thing, - addr, - size_changed, - new_size); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ - "H5AC_log_dirtied_entry() failed.") - } + if(H5AC_log_dirtied_entry((H5AC_info_t *)thing, addr, size_changed, new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log dirtied entry") } if ( ( (flags & H5C__DELETED_FLAG) != 0 ) && @@ -2365,7 +2170,6 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, result = H5C_unprotect(f, dxpl_id, H5AC_noblock_dxpl_id, - f->shared->cache, type, addr, thing, @@ -2541,7 +2345,7 @@ done: */ herr_t -H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr, +H5AC_get_cache_auto_resize_config(const H5AC_t * cache_ptr, H5AC_cache_config_t *config_ptr) { herr_t result; @@ -2573,7 +2377,7 @@ H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr, } - result = H5C_get_cache_auto_resize_config((H5C_t *)cache_ptr, + result = H5C_get_cache_auto_resize_config((const H5C_t *)cache_ptr, &internal_config); if ( result < 0 ) { @@ -2582,7 +2386,7 @@ H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr, "H5C_get_cache_auto_resize_config() failed.") } - result = H5C_get_evictions_enabled((H5C_t *)cache_ptr, &evictions_enabled); + result = H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled); if ( result < 0 ) { @@ -2818,10 +2622,9 @@ done: */ herr_t -H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr, +H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr) { - /* const char * fcn_name = "H5AC_set_cache_auto_resize_config"; */ herr_t result; herr_t ret_value = SUCCEED; /* Return value */ H5C_auto_size_ctl_t internal_config; @@ -2832,6 +2635,8 @@ H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr, FUNC_ENTER_NOAPI(H5AC_set_cache_auto_resize_config, FAIL) + HDassert( cache_ptr ); + #if H5AC__TRACE_FILE_ENABLED /* Make note of the new configuration. Don't look up the trace file * pointer, as that may change before we use it. @@ -2922,30 +2727,14 @@ H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr, } } - if ( H5AC_ext_config_2_int_config(config_ptr, &internal_config) != - SUCCEED ) { + if(H5AC_ext_config_2_int_config(config_ptr, &internal_config) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_ext_config_2_int_config() failed.") - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5AC_ext_config_2_int_config() failed.") - } + if(H5C_set_cache_auto_resize_config(cache_ptr, &internal_config) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_cache_auto_resize_config() failed.") - result = H5C_set_cache_auto_resize_config((H5C_t *)cache_ptr, - &internal_config); - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5C_set_cache_auto_resize_config() failed.") - } - - - result = H5C_set_evictions_enabled((H5C_t *)cache_ptr, - config_ptr->evictions_enabled); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5C_set_evictions_enabled() failed.") - } + if(H5C_set_evictions_enabled(cache_ptr, config_ptr->evictions_enabled) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_evictions_enabled() failed.") #ifdef H5_HAVE_PARALLEL if ( cache_ptr->aux_ptr != NULL ) { @@ -3817,26 +3606,28 @@ done: * * Programmer: John Mainzer, 6/29/05 * - * Modifications: - * *------------------------------------------------------------------------- */ - #ifdef H5_HAVE_PARALLEL static herr_t -H5AC_log_dirtied_entry(H5AC_t * cache_ptr, - H5AC_info_t * entry_ptr, +H5AC_log_dirtied_entry(const H5AC_info_t * entry_ptr, haddr_t addr, hbool_t size_changed, size_t new_size) { - herr_t ret_value = SUCCEED; /* Return value */ size_t entry_size; - H5AC_aux_t * aux_ptr = NULL; - H5AC_slist_entry_t * slist_entry_ptr = NULL; + H5AC_t * cache_ptr; + H5AC_aux_t * aux_ptr; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_log_dirtied_entry, FAIL) + HDassert( entry_ptr != NULL ); + HDassert( entry_ptr->addr == addr ); + HDassert( entry_ptr->is_dirty == FALSE ); + + cache_ptr = entry_ptr->cache_ptr; + HDassert( cache_ptr != NULL ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -3845,10 +3636,6 @@ H5AC_log_dirtied_entry(H5AC_t * cache_ptr, HDassert( aux_ptr != NULL ); HDassert( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC ); - HDassert( entry_ptr != NULL ); - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->is_dirty == FALSE ); - if ( size_changed ) { entry_size = new_size; @@ -3859,6 +3646,7 @@ H5AC_log_dirtied_entry(H5AC_t * cache_ptr, } if ( aux_ptr->mpi_rank == 0 ) { + H5AC_slist_entry_t * slist_entry_ptr; HDassert( aux_ptr->d_slist_ptr != NULL ); HDassert( aux_ptr->c_slist_ptr != NULL ); @@ -4266,10 +4054,11 @@ done: #ifdef H5_HAVE_PARALLEL static herr_t -H5AC_log_renamed_entry(H5AC_t * cache_ptr, +H5AC_log_renamed_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) { + H5AC_t * cache_ptr; herr_t ret_value = SUCCEED; /* Return value */ hbool_t entry_in_cache; hbool_t entry_dirty; @@ -4279,7 +4068,12 @@ H5AC_log_renamed_entry(H5AC_t * cache_ptr, FUNC_ENTER_NOAPI(H5AC_log_renamed_entry, FAIL) - HDassert( cache_ptr != NULL ); + HDassert( f ); + HDassert( f->shared ); + + cache_ptr = (H5AC_t *)f->shared->cache; + + HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); aux_ptr = cache_ptr->aux_ptr; @@ -4288,7 +4082,7 @@ H5AC_log_renamed_entry(H5AC_t * cache_ptr, HDassert( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC ); /* get entry status, size, etc here */ - if ( H5C_get_entry_status(cache_ptr, old_addr, &entry_size, &entry_in_cache, + if ( H5C_get_entry_status(f, old_addr, &entry_size, &entry_in_cache, &entry_dirty, NULL, NULL, NULL, NULL) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get entry status.") @@ -4800,7 +4594,6 @@ H5AC_flush_entries(H5F_t *f) status = H5C_flush_cache(f, H5AC_noblock_dxpl_id, H5AC_noblock_dxpl_id, - f->shared->cache, H5AC__NO_FLAGS_SET); aux_ptr->write_permitted = FALSE; diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 208dde1..f049a3b 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -49,7 +49,8 @@ typedef enum { H5AC_BT_ID = 0, /*B-tree nodes */ H5AC_SNODE_ID, /*symbol table nodes */ - H5AC_LHEAP_ID, /*local heap */ + H5AC_LHEAP_PRFX_ID, /*local heap prefix */ + H5AC_LHEAP_DBLK_ID, /*local heap data block */ H5AC_GHEAP_ID, /*global heap */ H5AC_OHDR_ID, /*object header */ H5AC_BT2_HDR_ID, /*v2 B-tree header */ @@ -324,33 +325,25 @@ extern hid_t H5AC_ind_dxpl_id; H5_DLL herr_t H5AC_init(void); H5_DLL herr_t H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr); -H5_DLL herr_t H5AC_get_entry_status(H5F_t * f, haddr_t addr, +H5_DLL herr_t H5AC_get_entry_status(const H5F_t * f, haddr_t addr, unsigned * status_ptr); H5_DLL herr_t H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned int flags); -H5_DLL herr_t H5AC_pin_protected_entry(H5F_t * f, void * thing); -H5_DLL herr_t H5AC_create_flush_dependency(H5F_t *f, void *parent_thing, - void *child_thing); +H5_DLL herr_t H5AC_pin_protected_entry(void *thing); +H5_DLL herr_t H5AC_create_flush_dependency(void *parent_thing, void *child_thing); H5_DLL void * H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, const void *udata1, void *udata2, H5AC_protect_t rw); -H5_DLL herr_t H5AC_resize_pinned_entry(H5F_t * f, - void * thing, - size_t new_size); -H5_DLL herr_t H5AC_unpin_entry(H5F_t * f, - void * thing); -H5_DLL herr_t H5AC_destroy_flush_dependency(H5F_t *f, void *parent_thing, - void *child_thing); +H5_DLL herr_t H5AC_resize_pinned_entry(void *thing, size_t new_size); +H5_DLL herr_t H5AC_unpin_entry(void *thing); +H5_DLL herr_t H5AC_destroy_flush_dependency(void *parent_thing, void *child_thing); H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned flags); H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id); -H5_DLL herr_t H5AC_mark_pinned_entry_dirty(H5F_t * f, - void * thing, - hbool_t size_changed, - size_t new_size); -H5_DLL herr_t H5AC_mark_pinned_or_protected_entry_dirty(H5F_t * f, - void * thing); +H5_DLL herr_t H5AC_mark_pinned_entry_dirty(void *thing, hbool_t size_changed, + size_t new_size); +H5_DLL herr_t H5AC_mark_pinned_or_protected_entry_dirty(void *thing); H5_DLL herr_t H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr); @@ -364,7 +357,7 @@ H5_DLL herr_t H5AC_set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void)); H5_DLL herr_t H5AC_stats(const H5F_t *f); -H5_DLL herr_t H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr, +H5_DLL herr_t H5AC_get_cache_auto_resize_config(const H5AC_t * cache_ptr, H5AC_cache_config_t *config_ptr); H5_DLL herr_t H5AC_get_cache_size(H5AC_t * cache_ptr, @@ -378,7 +371,7 @@ H5_DLL herr_t H5AC_get_cache_hit_rate(H5AC_t * cache_ptr, H5_DLL herr_t H5AC_reset_cache_hit_rate_stats(H5AC_t * cache_ptr); -H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr, +H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr); H5_DLL herr_t H5AC_validate_config(H5AC_cache_config_t * config_ptr); diff --git a/src/H5B.c b/src/H5B.c index d915b01..591b974 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -202,19 +202,6 @@ H5FL_SEQ_DEFINE_STATIC(size_t); * matzke@llnl.gov * Jun 23 1997 * - * Modifications: - * Robb Matzke, 1999-07-28 - * Changed the name of the ADDR argument to ADDR_P to make it - * obvious that the address is passed by reference unlike most - * other functions that take addresses. - * - * John Mainzer 6/9/05 - * Removed code setting the is_dirty field of the cache info. - * This is no longer pemitted, as the cache code is now - * manageing this field. Since this function uses a call to - * H5AC_set() (which marks the entry dirty automaticly), no - * other change is required. - * *------------------------------------------------------------------------- */ herr_t @@ -230,29 +217,29 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata, /* * Check arguments. */ - assert(f); - assert(type); - assert(addr_p); + HDassert(f); + HDassert(type); + HDassert(addr_p); /* * Allocate file and memory data structures. */ - if (NULL==(bt = H5FL_MALLOC(H5B_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree root node") - HDmemset(&bt->cache_info,0,sizeof(H5AC_info_t)); + if(NULL == (bt = H5FL_MALLOC(H5B_t))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node") + HDmemset(&bt->cache_info, 0, sizeof(H5AC_info_t)); bt->level = 0; bt->left = HADDR_UNDEF; bt->right = HADDR_UNDEF; bt->nchildren = 0; - if((bt->rc_shared=(type->get_shared)(f, udata))==NULL) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't retrieve B-tree node buffer") + if(NULL == (bt->rc_shared = (type->get_shared)(f, udata))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree node buffer") shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); - if (NULL==(bt->native=H5FL_BLK_MALLOC(native_block,shared->sizeof_keys)) || - NULL==(bt->child=H5FL_SEQ_MALLOC(haddr_t,(size_t)shared->two_k))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree root node") - if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->sizeof_rnode))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree root node") + if(NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) || + NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node") + if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->sizeof_rnode))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "file allocation failed for B-tree root node") /* * Cache the new B-tree node. @@ -264,14 +251,14 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata, #endif done: - if (ret_value<0) { + if(ret_value < 0) { if(shared && shared->sizeof_rnode>0) { H5_CHECK_OVERFLOW(shared->sizeof_rnode,size_t,hsize_t); (void)H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, *addr_p, (hsize_t)shared->sizeof_rnode); } /* end if */ - if (bt) - (void)H5B_dest(f,bt); - } + if(bt) + (void)H5B_dest(f, bt); + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_create() */ /*lint !e818 Can't make udata a pointer to const */ @@ -298,9 +285,6 @@ done: * matzke@llnl.gov * Jun 23 1997 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ htri_t @@ -329,7 +313,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u * the thing for which we're searching. */ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); @@ -349,7 +333,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u /* * Follow the link to the subtree or to the data node. */ - assert(idx < bt->nchildren); + HDassert(idx < bt->nchildren); if(bt->level > 0) { if((ret_value = H5B_find(f, dxpl_id, type, bt->child[idx], udata)) < 0) @@ -362,7 +346,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u done: if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release node") FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_find() */ @@ -388,20 +372,6 @@ done: * matzke@llnl.gov * Jul 3 1997 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The OLD_ADDR argument is passed by value. The NEW_ADDR - * argument has been renamed to NEW_ADDR_P - * - * John Mainzer, 6/9/05 - * Modified the function to use the new dirtied parameter of - * of H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. - * - * In this case, that required adding the new - * old_bt_dirtied_ptr parameter to the function's argument - * list. - * *------------------------------------------------------------------------- */ static herr_t @@ -421,39 +391,38 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags, /* * Check arguments. */ - assert(f); - assert(old_bt); - assert(old_bt_flags); - assert(H5F_addr_defined(old_addr)); + HDassert(f); + HDassert(old_bt); + HDassert(old_bt_flags); + HDassert(H5F_addr_defined(old_addr)); /* * Initialize variables. */ - shared=(H5B_shared_t *)H5RC_GET_OBJ(old_bt->rc_shared); + shared = (H5B_shared_t *)H5RC_GET_OBJ(old_bt->rc_shared); HDassert(shared); - assert(old_bt->nchildren == shared->two_k); + HDassert(old_bt->nchildren == shared->two_k); /* Get the dataset transfer property list */ - if (NULL == (dx_plist = (H5P_genplist_t *)H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") + if(NULL == (dx_plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, FAIL, "not a dataset transfer property list") /* Get B-tree split ratios */ - if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &split_ratios[0])<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios") + if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &split_ratios[0]) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree split ratios") #ifdef H5B_DEBUG - if (H5DEBUG(B)) { + if(H5DEBUG(B)) { const char *side; - if (!H5F_addr_defined(old_bt->left) && - !H5F_addr_defined(old_bt->right)) { + + if(!H5F_addr_defined(old_bt->left) && !H5F_addr_defined(old_bt->right)) side = "ONLY"; - } else if (!H5F_addr_defined(old_bt->right)) { + else if(!H5F_addr_defined(old_bt->right)) side = "RIGHT"; - } else if (!H5F_addr_defined(old_bt->left)) { + else if(!H5F_addr_defined(old_bt->left)) side = "LEFT"; - } else { + else side = "MIDDLE"; - } fprintf(H5DEBUG(B), "H5B_split: %3u {%5.3f,%5.3f,%5.3f} %6s", shared->two_k, split_ratios[0], split_ratios[1], split_ratios[2], side); } @@ -463,37 +432,35 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags, * Decide how to split the children of the old node among the old node * and the new node. */ - if (!H5F_addr_defined(old_bt->right)) { + if(!H5F_addr_defined(old_bt->right)) nleft = (unsigned)((double)shared->two_k * split_ratios[2]); /*right*/ - } else if (!H5F_addr_defined(old_bt->left)) { + else if(!H5F_addr_defined(old_bt->left)) nleft = (unsigned)((double)shared->two_k * split_ratios[0]); /*left*/ - } else { + else nleft = (unsigned)((double)shared->two_k * split_ratios[1]); /*middle*/ - } /* * Keep the new child in the same node as the child that split. This can * result in nodes that have an unused child when data is written * sequentially, but it simplifies stuff below. */ - if (idxtwo_k) { + if(idx < nleft && nleft == shared->two_k) --nleft; - } else if (idx>=nleft && 0==nleft) { + else if(idx >= nleft && 0 == nleft) nleft++; - } nright = shared->two_k - nleft; #ifdef H5B_DEBUG - if (H5DEBUG(B)) + if(H5DEBUG(B)) fprintf(H5DEBUG(B), " split %3d/%-3d\n", nleft, nright); #endif /* * Create the new B-tree node. */ - if (H5B_create(f, dxpl_id, shared->type, udata, new_addr_p/*out*/) < 0) + if(H5B_create(f, dxpl_id, shared->type, udata, new_addr_p/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree") - if (NULL==(new_bt=(H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_addr_p, shared->type, udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to protect B-tree") + if(NULL == (new_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_addr_p, shared->type, udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree") new_bt->level = old_bt->level; /* @@ -510,10 +477,10 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags, new_bt_flags |= H5AC__DIRTIED_FLAG; HDmemcpy(new_bt->native, old_bt->native + nleft * shared->type->sizeof_nkey, - (nright+1) * shared->type->sizeof_nkey); + (nright + 1) * shared->type->sizeof_nkey); HDmemcpy(new_bt->child, &old_bt->child[nleft], - nright*sizeof(haddr_t)); + nright * sizeof(haddr_t)); new_bt->nchildren = nright; @@ -529,25 +496,23 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags, new_bt->left = old_addr; new_bt->right = old_bt->right; - if (H5F_addr_defined(old_bt->right)) { + if(H5F_addr_defined(old_bt->right)) { H5B_t *tmp_bt; - if (NULL == (tmp_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, old_bt->right, shared->type, udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load right sibling") + if(NULL == (tmp_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, old_bt->right, shared->type, udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load right sibling") tmp_bt->left = *new_addr_p; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, old_bt->right, tmp_bt, - H5AC__DIRTIED_FLAG) != SUCCEED) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") - } + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, old_bt->right, tmp_bt, H5AC__DIRTIED_FLAG) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + } /* end if */ old_bt->right = *new_addr_p; done: - if (new_bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_addr_p, new_bt, - new_bt_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") + if(new_bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_addr_p, new_bt, new_bt_flags) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_split() */ @@ -565,25 +530,6 @@ done: * matzke@llnl.gov * Jun 23 1997 * - * Modifications: - * Robb Matzke, 28 Sep 1998 - * The optional SPLIT_RATIOS[] indicates what percent of the child - * pointers should go in the left node when a node splits. There are - * three possibilities and a separate split ratio can be specified for - * each: [0] The node that split is the left-most node at its level of - * the tree, [1] the node that split has left and right siblings, [2] - * the node that split is the right-most node at its level of the tree. - * When a node is an only node at its level then we use the right-most - * rule. If SPLIT_RATIOS is null then default values are used. - * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * John Mainzer, 6/9/05 - * Modified the function to use the new dirtied parameter of - * of H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. - * *------------------------------------------------------------------------- */ herr_t @@ -610,42 +556,42 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, FUNC_ENTER_NOAPI(H5B_insert, FAIL) /* Check arguments. */ - assert(f); - assert(type); - assert(type->sizeof_nkey <= sizeof _lt_key); - assert(H5F_addr_defined(addr)); + HDassert(f); + HDassert(type); + HDassert(type->sizeof_nkey <= sizeof _lt_key); + HDassert(H5F_addr_defined(addr)); - if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, addr, type, lt_key, - <_key_changed, md_key, udata, rt_key, &rt_key_changed, &child/*out*/))<0) + if((int)(my_ins = H5B_insert_helper(f, dxpl_id, addr, type, lt_key, + <_key_changed, md_key, udata, rt_key, &rt_key_changed, &child/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key") - if (H5B_INS_NOOP == my_ins) + if(H5B_INS_NOOP == my_ins) HGOTO_DONE(SUCCEED) - assert(H5B_INS_RIGHT == my_ins); + HDassert(H5B_INS_RIGHT == my_ins); /* the current root */ - if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to locate root of B-tree") + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to locate root of B-tree") shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); level = bt->level; - if (!lt_key_changed) + if(!lt_key_changed) HDmemcpy(lt_key, H5B_NKEY(bt,shared,0), type->sizeof_nkey); - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) != SUCCEED) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release new child") bt = NULL; /* the new node */ - if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new node") + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_READ))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load new node") - if (!rt_key_changed) + if(!rt_key_changed) HDmemcpy(rt_key, H5B_NKEY(bt,shared,bt->nchildren), type->sizeof_nkey); - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__NO_FLAGS_SET) != SUCCEED) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release new child") bt = NULL; /* @@ -654,46 +600,46 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, * from "moving". */ H5_CHECK_OVERFLOW(shared->sizeof_rnode,size_t,hsize_t); - if (HADDR_UNDEF==(old_root=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->sizeof_rnode))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file space to move root") + if(HADDR_UNDEF == (old_root = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->sizeof_rnode))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move root") /* update the new child's left pointer */ - if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new child") + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load new child") bt->left = old_root; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__DIRTIED_FLAG) != SUCCEED) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") - bt=NULL; /* Make certain future references will be caught */ + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__DIRTIED_FLAG) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release new child") + bt = NULL; /* Make certain future references will be caught */ /* * Move the node to the new location by checking it out & checking it in * at the new location -QAK */ /* Bring the old root into the cache if it's not already */ - if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new child") + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load new child") /* Make certain the old root info is marked as dirty before moving it, */ /* so it is certain to be written out at the new location */ /* Make a copy of the old root information */ - if (NULL == (new_bt = H5B_copy(bt))) { - HCOMMON_ERROR(H5E_BTREE, H5E_CANTLOAD, "unable to copy old root"); + if(NULL == (new_bt = H5B_copy(bt))) { + HCOMMON_ERROR(H5E_BTREE, H5E_CANTCOPY, "unable to copy old root"); - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) != SUCCEED) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release new child") HGOTO_DONE(FAIL) - } + } /* end if */ - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) != SUCCEED) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") - bt=NULL; /* Make certain future references will be caught */ + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release new child") + bt = NULL; /* Make certain future references will be caught */ /* Move the location of the old root on the disk */ - if (H5AC_rename(f, H5AC_BT, addr, old_root) < 0) + if(H5AC_rename(f, H5AC_BT, addr, old_root) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node") /* clear the old root info at the old address (we already copied it) */ @@ -738,18 +684,6 @@ done: * matzke@llnl.gov * Jul 8 1997 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The CHILD argument is passed by value. - * - * John Mainzer, 6/9/05 - * Modified the function to use the new dirtied parameter of - * of H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. - * - * In this case, that required adding the new dirtied_ptr - * parameter to the function's argument list. - * *------------------------------------------------------------------------- */ static herr_t @@ -761,28 +695,28 @@ H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B_insert_child) - assert(bt); - assert(bt_flags); - shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); + HDassert(bt); + HDassert(bt_flags); + shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); - assert(bt->nchildrentwo_k); + HDassert(bt->nchildren < shared->two_k); /* Check for inserting right-most key into node (common when just appending * records to an unlimited dimension chunked dataset) */ - base=H5B_NKEY(bt,shared,(idx+1)); - if((idx+1)==bt->nchildren) { + base = H5B_NKEY(bt, shared, (idx + 1)); + if((idx + 1) == bt->nchildren) { /* Make room for the new key */ HDmemcpy(base + shared->type->sizeof_nkey, base, shared->type->sizeof_nkey); /* No overlap possible - memcpy() OK */ HDmemcpy(base, md_key, shared->type->sizeof_nkey); /* The MD_KEY is the left key of the new node */ - if (H5B_INS_RIGHT == anchor) + if(H5B_INS_RIGHT == anchor) idx++; /* Don't have to memmove() child addresses down, just add new child */ else /* Make room for the new child address */ - bt->child[idx+1] = bt->child[idx]; + bt->child[idx + 1] = bt->child[idx]; } /* end if */ else { /* Make room for the new key */ @@ -791,7 +725,7 @@ H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, HDmemcpy(base, md_key, shared->type->sizeof_nkey); /* The MD_KEY is the left key of the new node */ - if (H5B_INS_RIGHT == anchor) + if(H5B_INS_RIGHT == anchor) idx++; /* Make room for the new child address */ @@ -838,27 +772,6 @@ H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, * matzke@llnl.gov * Jul 9 1997 * - * Modifications: - * - * Robb Matzke, 28 Sep 1998 - * The optional SPLIT_RATIOS[] indicates what percent of the child - * pointers should go in the left node when a node splits. There are - * three possibilities and a separate split ratio can be specified for - * each: [0] The node that split is the left-most node at its level of - * the tree, [1] the node that split has left and right siblings, [2] - * the node that split is the right-most node at its level of the tree. - * When a node is an only node at its level then we use the right-most - * rule. If SPLIT_RATIOS is null then default values are used. - * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. The NEW_NODE argument is - * renamed NEW_NODE_P - * - * John Mainzer, 6/9/05 - * Modified the function to use the new dirtied parameter of - * of H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. - * *------------------------------------------------------------------------- */ static H5B_ins_t @@ -882,17 +795,17 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type /* * Check arguments */ - assert(f); - assert(H5F_addr_defined(addr)); - assert(type); - assert(type->decode); - assert(type->cmp3); - assert(type->new_node); - assert(lt_key); - assert(lt_key_changed); - assert(rt_key); - assert(rt_key_changed); - assert(new_node_p); + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(type); + HDassert(type->decode); + HDassert(type->cmp3); + HDassert(type->new_node); + HDassert(lt_key); + HDassert(lt_key_changed); + HDassert(rt_key); + HDassert(rt_key_changed); + HDassert(new_node_p); *lt_key_changed = FALSE; *rt_key_changed = FALSE; @@ -902,65 +815,62 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * data. When the search completes IDX points to the child that * should get the new data. */ - if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node") + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node") shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); rt = bt->nchildren; - while (lt < rt && cmp) { + while(lt < rt && cmp) { idx = (lt + rt) / 2; - if ((cmp = (type->cmp3) (f, dxpl_id, H5B_NKEY(bt,shared,idx), udata, - H5B_NKEY(bt,shared,idx+1))) < 0) { + if((cmp = (type->cmp3)(f, dxpl_id, H5B_NKEY(bt, shared, idx), udata, H5B_NKEY(bt, shared, idx + 1))) < 0) rt = idx; - } else { + else lt = idx + 1; - } - } + } /* end while */ - if (0 == bt->nchildren) { + if(0 == bt->nchildren) { /* * The value being inserted will be the only value in this tree. We * must necessarily be at level zero. */ - assert(0 == bt->level); - if ((type->new_node)(f, dxpl_id, H5B_INS_FIRST, H5B_NKEY(bt,shared,0), udata, - H5B_NKEY(bt,shared,1), bt->child + 0/*out*/) < 0) + HDassert(0 == bt->level); + if((type->new_node)(f, dxpl_id, H5B_INS_FIRST, H5B_NKEY(bt, shared, 0), udata, + H5B_NKEY(bt, shared, 1), bt->child + 0/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, H5B_INS_ERROR, "unable to create leaf node") bt->nchildren = 1; bt_flags |= H5AC__DIRTIED_FLAG; idx = 0; - if (type->follow_min) { - if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), - lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1), + if(type->follow_min) { + if((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt, shared, idx), + lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert first leaf node") - } else { + } /* end if */ + else my_ins = H5B_INS_NOOP; - } - - } else if (cmp < 0 && idx == 0 && bt->level > 0) { + } else if(cmp < 0 && idx == 0 && bt->level > 0) { /* * The value being inserted is less than any value in this tree. * Follow the minimum branch out of this node to a subtree. */ - if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, + if((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, - udata, H5B_NKEY(bt,shared,idx+1), rt_key_changed, - &child_addr/*out*/))<0) + udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, + &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum subtree") - } else if (cmp < 0 && idx == 0 && type->follow_min) { + } else if(cmp < 0 && idx == 0 && type->follow_min) { /* * The value being inserted is less than any leaf node out of this * current node. Follow the minimum branch to a leaf node and let the * subclass handle the problem. */ - if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), - lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1), + if((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt, shared, idx), + lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node") - } else if (cmp < 0 && idx == 0) { + } else if(cmp < 0 && idx == 0) { /* * The value being inserted is less than any leaf node out of the * current node. Create a new minimum leaf node out of this B-tree @@ -968,33 +878,32 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type */ my_ins = H5B_INS_LEFT; HDmemcpy(md_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey); - if ((type->new_node)(f, dxpl_id, H5B_INS_LEFT, H5B_NKEY(bt,shared,idx), udata, - md_key, &child_addr/*out*/) < 0) + if((type->new_node)(f, dxpl_id, H5B_INS_LEFT, H5B_NKEY(bt, shared, idx), udata, + md_key, &child_addr/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node") *lt_key_changed = TRUE; - - } else if (cmp > 0 && idx + 1 >= bt->nchildren && bt->level > 0) { + } else if(cmp > 0 && idx + 1 >= bt->nchildren && bt->level > 0) { /* * The value being inserted is larger than any value in this tree. * Follow the maximum branch out of this node to a subtree. */ idx = bt->nchildren - 1; - if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, - H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, udata, - H5B_NKEY(bt,shared,idx+1), rt_key_changed, &child_addr/*out*/)) < 0) + if((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, + H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, + H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum subtree") - } else if (cmp > 0 && idx + 1 >= bt->nchildren && type->follow_max) { + } else if(cmp > 0 && idx + 1 >= bt->nchildren && type->follow_max) { /* * The value being inserted is larger than any leaf node out of the * current node. Follow the maximum branch to a leaf node and let the * subclass handle the problem. */ idx = bt->nchildren - 1; - if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), - lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1), + if((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt, shared, idx), + lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node") - } else if (cmp > 0 && idx + 1 >= bt->nchildren) { + } else if(cmp > 0 && idx + 1 >= bt->nchildren) { /* * The value being inserted is larger than any leaf node out of the * current node. Create a new maximum leaf node out of this B-tree @@ -1002,80 +911,78 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type */ idx = bt->nchildren - 1; my_ins = H5B_INS_RIGHT; - HDmemcpy(md_key, H5B_NKEY(bt,shared,idx+1), type->sizeof_nkey); - if ((type->new_node)(f, dxpl_id, H5B_INS_RIGHT, md_key, udata, - H5B_NKEY(bt,shared,idx+1), &child_addr/*out*/) < 0) + HDmemcpy(md_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey); + if((type->new_node)(f, dxpl_id, H5B_INS_RIGHT, md_key, udata, + H5B_NKEY(bt, shared, idx + 1), &child_addr/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node") *rt_key_changed = TRUE; - - } else if (cmp) { + } else if(cmp) { /* * We couldn't figure out which branch to follow out of this node. THIS * IS A MAJOR PROBLEM THAT NEEDS TO BE FIXED --rpm. */ - assert("INTERNAL HDF5 ERROR (contact rpm)" && 0); + HDassert("INTERNAL HDF5 ERROR (contact rpm)" && 0); #ifdef NDEBUG HDabort(); #endif /* NDEBUG */ - } else if (bt->level > 0) { + } else if(bt->level > 0) { /* * Follow a branch out of this node to another subtree. */ - assert(idx < bt->nchildren); - if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, - H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, udata, - H5B_NKEY(bt,shared,idx+1), rt_key_changed, &child_addr/*out*/)) < 0) + HDassert(idx < bt->nchildren); + if((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, + H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, + H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert subtree") } else { /* * Follow a branch out of this node to a leaf node of some other type. */ - assert(idx < bt->nchildren); - if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), - lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1), + HDassert(idx < bt->nchildren); + if((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt, shared, idx), + lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert leaf node") } - assert((int)my_ins >= 0); + HDassert((int)my_ins >= 0); /* * Update the left and right keys of the current node. */ - if (*lt_key_changed) { + if(*lt_key_changed) { bt_flags |= H5AC__DIRTIED_FLAG; - if (idx > 0) + if(idx > 0) *lt_key_changed = FALSE; else - HDmemcpy(lt_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey); - } - if (*rt_key_changed) { + HDmemcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey); + } /* end if */ + if(*rt_key_changed) { bt_flags |= H5AC__DIRTIED_FLAG; - if (idx+1 < bt->nchildren) + if(idx + 1 < bt->nchildren) *rt_key_changed = FALSE; else - HDmemcpy(rt_key, H5B_NKEY(bt,shared,idx+1), type->sizeof_nkey); - } - if (H5B_INS_CHANGE == my_ins) { + HDmemcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey); + } /* end if */ + if(H5B_INS_CHANGE == my_ins) { /* * The insertion simply changed the address for the child. */ bt->child[idx] = child_addr; bt_flags |= H5AC__DIRTIED_FLAG; ret_value = H5B_INS_NOOP; - - } else if (H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins) { + } else if(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins) { hbool_t *tmp_bt_flags_ptr = NULL; H5B_t *tmp_bt; /* * If this node is full then split it before inserting the new child. */ - if (bt->nchildren == shared->two_k) { - if (H5B_split(f, dxpl_id, bt, &bt_flags, addr, idx, udata, new_node_p/*out*/)<0) + if(bt->nchildren == shared->two_k) { + if(H5B_split(f, dxpl_id, bt, &bt_flags, addr, idx, udata, new_node_p/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, "unable to split node") - if (NULL == (twin = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_node_p, type, udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node") - if (idxnchildren) { + if(NULL == (twin = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_node_p, type, udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node") + if(idx < bt->nchildren) { tmp_bt = bt; tmp_bt_flags_ptr = &bt_flags; } else { @@ -1083,13 +990,14 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type tmp_bt = twin; tmp_bt_flags_ptr = &twin_flags; } - } else { + } /* end if */ + else { tmp_bt = bt; tmp_bt_flags_ptr = &bt_flags; - } + } /* end else */ /* Insert the child */ - if (H5B_insert_child(tmp_bt, tmp_bt_flags_ptr, idx, child_addr, my_ins, md_key) < 0) + if(H5B_insert_child(tmp_bt, tmp_bt_flags_ptr, idx, child_addr, my_ins, md_key) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert child") } @@ -1097,30 +1005,28 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * If this node split, return the mid key (the one that is shared * by the left and right node). */ - if (twin) { - HDmemcpy(md_key, H5B_NKEY(twin,shared,0), type->sizeof_nkey); + if(twin) { + HDmemcpy(md_key, H5B_NKEY(twin, shared, 0), type->sizeof_nkey); ret_value = H5B_INS_RIGHT; #ifdef H5B_DEBUG /* * The max key in the original left node must be equal to the min key * in the new node. */ - cmp = (type->cmp2) (f, dxpl_id, H5B_NKEY(bt,shared,bt->nchildren), udata, - H5B_NKEY(twin,shared,0)); - assert(0 == cmp); + cmp = (type->cmp2)(f, dxpl_id, H5B_NKEY(bt, shared, bt->nchildren), udata, + H5B_NKEY(twin, shared, 0)); + HDassert(0 == cmp); #endif - } else { + } /* end if */ + else ret_value = H5B_INS_NOOP; - } done: { - herr_t e1 = (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, - bt_flags) < 0); - herr_t e2 = (twin && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_node_p, - twin, twin_flags)<0); - if (e1 || e2) /*use vars to prevent short-circuit of side effects */ - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node(s)") + herr_t e1 = (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags) < 0); + herr_t e2 = (twin && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_node_p, twin, twin_flags) < 0); + if(e1 || e2) /*use vars to prevent short-circuit of side effects */ + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node(s)") } FUNC_LEAVE_NOAPI(ret_value) @@ -1163,14 +1069,14 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add /* Protect the initial/current node */ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load B-tree node") if(bt->level > 0) { haddr_t left_child = bt->child[0]; /* Address of left-most child in node */ /* Release current node */ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5_ITER_ERROR, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release B-tree node") bt = NULL; /* Keep following the left-most child until we reach a leaf node. */ @@ -1188,9 +1094,9 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add /* Allocate space for a copy of the native records & child pointers */ if(NULL == (native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys))) - HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for shared B-tree native records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, H5_ITER_ERROR, "memory allocation failed for shared B-tree native records") if(NULL == (child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) - HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for shared B-tree child addresses") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, H5_ITER_ERROR, "memory allocation failed for shared B-tree child addresses") /* Cache information from this node */ nchildren = bt->nchildren; @@ -1202,7 +1108,7 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add /* Release current node */ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5_ITER_ERROR, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release B-tree node") bt = NULL; /* @@ -1232,7 +1138,7 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add /* Protect the next node to the right */ addr = next_addr; if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5_ITER_ERROR, "B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5_ITER_ERROR, "B-tree node") /* Cache information from this node */ nchildren = bt->nchildren; @@ -1244,7 +1150,7 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add /* Unprotect node */ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5_ITER_ERROR, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release B-tree node") bt = NULL; } /* end if */ else @@ -1256,7 +1162,7 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add done: if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, H5_ITER_ERROR, "unable to release B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release B-tree node") if(native) (void)H5FL_BLK_FREE(native_block, native); if(child) @@ -1327,15 +1233,6 @@ H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, * Programmer: Robb Matzke * Wednesday, September 16, 1998 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * John Mainzer, 6/10/05 - * Modified the function to use the new dirtied parameter of - * of H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. - * *------------------------------------------------------------------------- */ static H5B_ins_t @@ -1346,65 +1243,63 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type { H5B_t *bt = NULL, *sibling = NULL; unsigned bt_flags = H5AC__NO_FLAGS_SET; - H5B_shared_t *shared; /* Pointer to shared B-tree info */ - unsigned idx=0, lt=0, rt; /* Final, left & right indices */ - int cmp=1; /* Key comparison value */ + H5B_shared_t *shared; /* Pointer to shared B-tree info */ + unsigned idx = 0, lt = 0, rt; /* Final, left & right indices */ + int cmp = 1; /* Key comparison value */ H5B_ins_t ret_value = H5B_INS_ERROR; FUNC_ENTER_NOAPI(H5B_remove_helper, H5B_INS_ERROR) - assert(f); - assert(H5F_addr_defined(addr)); - assert(type); - assert(type->decode); - assert(type->cmp3); - assert(lt_key && lt_key_changed); - assert(udata); - assert(rt_key && rt_key_changed); + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(type); + HDassert(type->decode); + HDassert(type->cmp3); + HDassert(lt_key && lt_key_changed); + HDassert(udata); + HDassert(rt_key && rt_key_changed); /* * Perform a binary search to locate the child which contains the thing * for which we're searching. */ - if (NULL==(bt=(H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load B-tree node") + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load B-tree node") shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); rt = bt->nchildren; - while (ltcmp3)(f, dxpl_id, H5B_NKEY(bt,shared,idx), udata, - H5B_NKEY(bt,shared,idx+1)))<0) { + while(lt < rt && cmp) { + idx = (lt + rt) / 2; + if((cmp = (type->cmp3)(f, dxpl_id, H5B_NKEY(bt, shared, idx), udata, H5B_NKEY(bt, shared, idx + 1))) < 0) rt = idx; - } else { - lt = idx+1; - } - } - if (cmp) + else + lt = idx + 1; + } /* end while */ + if(cmp) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "B-tree key not found") /* * Follow the link to the subtree or to the data node. The return value * will be one of H5B_INS_ERROR, H5B_INS_NOOP, or H5B_INS_REMOVE. */ - assert(idxnchildren); - if (bt->level>0) { + HDassert(idx < bt->nchildren); + if(bt->level > 0) { /* We're at an internal node -- call recursively */ - if ((int)(ret_value=H5B_remove_helper(f, dxpl_id, - bt->child[idx], type, level+1, H5B_NKEY(bt,shared,idx)/*out*/, - lt_key_changed/*out*/, udata, H5B_NKEY(bt,shared,idx+1)/*out*/, - rt_key_changed/*out*/))<0) + if((int)(ret_value = H5B_remove_helper(f, dxpl_id, + bt->child[idx], type, level + 1, H5B_NKEY(bt, shared, idx)/*out*/, + lt_key_changed/*out*/, udata, H5B_NKEY(bt, shared, idx + 1)/*out*/, + rt_key_changed/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in subtree") - } else if (type->remove) { + } else if(type->remove) { /* * We're at a leaf node but the leaf node points to an object that * has a removal method. Pass the removal request to the pointed-to * object and let it decide how to progress. */ - if ((int)(ret_value=(type->remove)(f, dxpl_id, - bt->child[idx], H5B_NKEY(bt,shared,idx), lt_key_changed, udata, - H5B_NKEY(bt,shared,idx+1), rt_key_changed))<0) + if((int)(ret_value = (type->remove)(f, dxpl_id, + bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed, udata, + H5B_NKEY(bt, shared, idx + 1), rt_key_changed)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in leaf node") } else { /* @@ -1425,49 +1320,49 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * key changed and it's the right most key of this node we must update * our right key and indicate that it changed. */ - if (*lt_key_changed) { + if(*lt_key_changed) { bt_flags |= H5AC__DIRTIED_FLAG; - if (idx>0) + if(idx > 0) /* Don't propagate change out of this B-tree node */ *lt_key_changed = FALSE; else - HDmemcpy(lt_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey); - } - if (*rt_key_changed) { + HDmemcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey); + } /* end if */ + if(*rt_key_changed) { bt_flags |= H5AC__DIRTIED_FLAG; - if (idx+1nchildren) { + if(idx + 1 < bt->nchildren) { /* Don't propagate change out of this B-tree node */ *rt_key_changed = FALSE; - } else { - HDmemcpy(rt_key, H5B_NKEY(bt,shared,idx+1), type->sizeof_nkey); + } /* end if */ + else { + HDmemcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey); /* Since our right key was changed, we must check for a right * sibling and change it's left-most key as well. * (Handle the ret_value==H5B_INS_REMOVE case below) */ - if (ret_value!=H5B_INS_REMOVE && level>0) { - if (H5F_addr_defined(bt->right)) { - if (NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to unlink node from tree") + if(ret_value != H5B_INS_REMOVE && level > 0) { + if(H5F_addr_defined(bt->right)) { + if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to unlink node from tree") /* Make certain the native key for the right sibling is set up */ - HDmemcpy(H5B_NKEY(sibling,shared,0), H5B_NKEY(bt,shared,idx+1), type->sizeof_nkey); - - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, - H5AC__DIRTIED_FLAG) != SUCCEED) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") - sibling=NULL; /* Make certain future references will be caught */ - } - } - } - } + HDmemcpy(H5B_NKEY(sibling, shared, 0), H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey); + + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree") + sibling = NULL; /* Make certain future references will be caught */ + } /* end if */ + } /* end if */ + } /* end else */ + } /* end if */ /* * If the subtree returned H5B_INS_REMOVE then we should remove the * subtree entry from the current node. There are four cases: */ - if (H5B_INS_REMOVE==ret_value && 1==bt->nchildren) { + if(H5B_INS_REMOVE == ret_value && 1 == bt->nchildren) { /* * The subtree is the only child of this node. Discard both * keys and the subtree pointer. Free this node (unless it's the @@ -1475,44 +1370,42 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type */ bt_flags |= H5AC__DIRTIED_FLAG; bt->nchildren = 0; - if (level>0) { - if (H5F_addr_defined(bt->left)) { - if (NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->left, type, udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node from tree") + if(level > 0) { + if(H5F_addr_defined(bt->left)) { + if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->left, type, udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node from tree") sibling->right = bt->right; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->left, sibling, - H5AC__DIRTIED_FLAG) != SUCCEED) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") - sibling=NULL; /* Make certain future references will be caught */ - } - if (H5F_addr_defined(bt->right)) { - if (NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to unlink node from tree") + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->left, sibling, H5AC__DIRTIED_FLAG) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree") + sibling = NULL; /* Make certain future references will be caught */ + } /* end if */ + if(H5F_addr_defined(bt->right)) { + if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to unlink node from tree") /* Copy left-most key from deleted node to left-most key in it's right neighbor */ - HDmemcpy(H5B_NKEY(sibling,shared,0), H5B_NKEY(bt,shared,0), type->sizeof_nkey); + HDmemcpy(H5B_NKEY(sibling, shared, 0), H5B_NKEY(bt, shared, 0), type->sizeof_nkey); sibling->left = bt->left; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, - H5AC__DIRTIED_FLAG) != SUCCEED) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") - sibling=NULL; /* Make certain future references will be caught */ - } + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree") + sibling = NULL; /* Make certain future references will be caught */ + } /* end if */ bt->left = HADDR_UNDEF; bt->right = HADDR_UNDEF; - H5_CHECK_OVERFLOW(shared->sizeof_rnode,size_t,hsize_t); + H5_CHECK_OVERFLOW(shared->sizeof_rnode, size_t, hsize_t); if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) { bt = NULL; bt_flags = H5AC__NO_FLAGS_SET; - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to free B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to free B-tree node") } /* end if */ bt = NULL; bt_flags = H5AC__NO_FLAGS_SET; } /* end if */ - } else if (H5B_INS_REMOVE==ret_value && 0==idx) { + } else if(H5B_INS_REMOVE == ret_value && 0 == idx) { /* * The subtree is the left-most child of this node. We discard the * left-most key and the left-most child (the child has already been @@ -1525,15 +1418,14 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type HDmemmove(bt->native, bt->native + type->sizeof_nkey, - (bt->nchildren+1) * type->sizeof_nkey); + (bt->nchildren + 1) * type->sizeof_nkey); HDmemmove(bt->child, - bt->child+1, + bt->child + 1, bt->nchildren * sizeof(haddr_t)); - HDmemcpy(lt_key, H5B_NKEY(bt,shared,0), type->sizeof_nkey); + HDmemcpy(lt_key, H5B_NKEY(bt, shared, 0), type->sizeof_nkey); *lt_key_changed = TRUE; ret_value = H5B_INS_NOOP; - - } else if (H5B_INS_REMOVE==ret_value && idx+1==bt->nchildren) { + } else if(H5B_INS_REMOVE == ret_value && idx + 1 == bt->nchildren) { /* * The subtree is the right-most child of this node. We discard the * right-most key and the right-most child (the child has already been @@ -1542,30 +1434,28 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type */ bt_flags |= H5AC__DIRTIED_FLAG; bt->nchildren -= 1; - HDmemcpy(rt_key, H5B_NKEY(bt,shared,bt->nchildren), type->sizeof_nkey); + HDmemcpy(rt_key, H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey); *rt_key_changed = TRUE; /* Since our right key was changed, we must check for a right * sibling and change it's left-most key as well. * (Handle the ret_value==H5B_INS_REMOVE case below) */ - if (level>0) { - if (H5F_addr_defined(bt->right)) { - if (NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to unlink node from tree") + if(level > 0) { + if(H5F_addr_defined(bt->right)) { + if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to unlink node from tree") - HDmemcpy(H5B_NKEY(sibling,shared,0), H5B_NKEY(bt,shared,bt->nchildren), type->sizeof_nkey); + HDmemcpy(H5B_NKEY(sibling, shared, 0), H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey); - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, - H5AC__DIRTIED_FLAG) != SUCCEED) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") - sibling=NULL; /* Make certain future references will be caught */ - } - } + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree") + sibling = NULL; /* Make certain future references will be caught */ + } /* end if */ + } /* end if */ ret_value = H5B_INS_NOOP; - - } else if (H5B_INS_REMOVE==ret_value) { + } else if(H5B_INS_REMOVE == ret_value) { /* * There are subtrees out of this node to both the left and right of * the subtree being removed. The key to the left of the subtree and @@ -1577,20 +1467,18 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type bt->nchildren -= 1; HDmemmove(bt->native + idx * type->sizeof_nkey, - bt->native + (idx+1) * type->sizeof_nkey, - (bt->nchildren+1-idx) * type->sizeof_nkey); - HDmemmove(bt->child+idx, - bt->child+idx+1, - (bt->nchildren-idx) * sizeof(haddr_t)); + bt->native + (idx + 1) * type->sizeof_nkey, + (bt->nchildren + 1 - idx) * type->sizeof_nkey); + HDmemmove(bt->child + idx, + bt->child + idx + 1, + (bt->nchildren - idx) * sizeof(haddr_t)); ret_value = H5B_INS_NOOP; - - } else { + } else ret_value = H5B_INS_NOOP; - } done: - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags)<0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node") + if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node") FUNC_LEAVE_NOAPI(ret_value) } @@ -1610,15 +1498,6 @@ done: * Programmer: Robb Matzke * Wednesday, September 16, 1998 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * John Mainzer, 6/8/05 - * Modified the function to use the new dirtied parameter of - * of H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. - * *------------------------------------------------------------------------- */ herr_t @@ -1637,31 +1516,31 @@ H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void FUNC_ENTER_NOAPI(H5B_remove, FAIL) /* Check args */ - assert(f); - assert(type); - assert(type->sizeof_nkey <= sizeof _lt_key); - assert(H5F_addr_defined(addr)); + HDassert(f); + HDassert(type); + HDassert(type->sizeof_nkey <= sizeof _lt_key); + HDassert(H5F_addr_defined(addr)); /* The actual removal */ - if (H5B_remove_helper(f, dxpl_id, addr, type, 0, lt_key, <_key_changed, - udata, rt_key, &rt_key_changed)==H5B_INS_ERROR) + if(H5B_remove_helper(f, dxpl_id, addr, type, 0, lt_key, <_key_changed, + udata, rt_key, &rt_key_changed) == H5B_INS_ERROR) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to remove entry from B-tree") /* * If the B-tree is now empty then make sure we mark the root node as * being at level zero */ - if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree root node") + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree root node") - if (0==bt->nchildren && 0!=bt->level) { + if(0 == bt->nchildren && 0 != bt->level) { bt->level = 0; bt_flags |= H5AC__DIRTIED_FLAG; - } + } /* end if */ - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags) != SUCCEED) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release node") - bt=NULL; /* Make certain future references will be caught */ + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release node") + bt = NULL; /* Make certain future references will be caught */ #ifdef H5B_DEBUG H5B_assert(f, dxpl_id, addr, type, udata); @@ -1682,62 +1561,56 @@ done: * Programmer: Quincey Koziol * Thursday, March 20, 2003 * - * Modifications: - * - * John Mainzer, 6/10/05 - * Modified the function to use the new dirtied parameter of - * of H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. - * *------------------------------------------------------------------------- */ herr_t H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *udata) { - H5B_t *bt; /* B-tree node being operated on */ - H5B_shared_t *shared; /* Pointer to shared B-tree info */ + H5B_t *bt = NULL; /* B-tree node being operated on */ + H5B_shared_t *shared; /* Pointer to shared B-tree info */ unsigned u; /* Local index variable */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5B_delete, FAIL) /* Check args */ - assert(f); - assert(type); - assert(H5F_addr_defined(addr)); + HDassert(f); + HDassert(type); + HDassert(H5F_addr_defined(addr)); /* Lock this B-tree node into memory for now */ - if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node") + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); /* Iterate over all children in tree, deleting them */ - if (bt->level > 0) { + if(bt->level > 0) { /* Iterate over all children in node, deleting them */ - for (u=0; unchildren; u++) - if (H5B_delete(f, dxpl_id, type, bt->child[u], udata)<0) + for(u = 0; u < bt->nchildren; u++) + if(H5B_delete(f, dxpl_id, type, bt->child[u], udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "unable to delete B-tree node") - } else { + } /* end if */ + else { hbool_t lt_key_changed, rt_key_changed; /* Whether key changed (unused here, just for callback) */ /* Check for removal callback */ if(type->remove) { /* Iterate over all entries in node, calling callback */ - for (u=0; unchildren; u++) { + for(u = 0; u < bt->nchildren; u++) { /* Call user's callback for each entry */ - if ((type->remove)(f, dxpl_id, - bt->child[u], H5B_NKEY(bt,shared,u), <_key_changed, udata, - H5B_NKEY(bt,shared,u+1), &rt_key_changed)remove)(f, dxpl_id, + bt->child[u], H5B_NKEY(bt, shared, u), <_key_changed, udata, + H5B_NKEY(bt, shared, u + 1), &rt_key_changed) < H5B_INS_NOOP) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't remove B-tree node") } /* end for */ } /* end if */ } /* end else */ done: - if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG)<0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node in cache") + if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node in cache") FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_delete() */ @@ -1861,8 +1734,6 @@ H5B_shared_free(void *_shared) * koziol@ncsa.uiuc.edu * Apr 18 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5B_t * @@ -1883,14 +1754,17 @@ H5B_copy(const H5B_t *old_bt) /* Allocate memory for the new H5B_t object */ if(NULL == (new_node = H5FL_MALLOC(H5B_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree root node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node") /* Copy the main structure */ HDmemcpy(new_node, old_bt, sizeof(H5B_t)); + /* Reset cache info */ + HDmemset(&new_node->cache_info, 0, sizeof(H5AC_info_t)); + if(NULL == (new_node->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) || NULL == (new_node->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree root node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node") /* Copy the other structures */ HDmemcpy(new_node->native, old_bt->native, shared->sizeof_keys); @@ -1905,9 +1779,9 @@ H5B_copy(const H5B_t *old_bt) done: if(NULL == ret_value) { if(new_node) { - (void)H5FL_BLK_FREE(native_block, new_node->native); + new_node->native = H5FL_BLK_FREE(native_block, new_node->native); new_node->child = H5FL_SEQ_FREE(haddr_t, new_node->child); - (void)H5FL_FREE(H5B_t, new_node); + new_node = H5FL_FREE(H5B_t, new_node); } /* end if */ } /* end if */ @@ -1954,7 +1828,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad /* Protect the initial/current node */ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, info_udata->udata, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") /* Get the shared B-tree information */ shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); @@ -1974,7 +1848,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad /* Release current node */ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") bt = NULL; /* @@ -1985,7 +1859,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad /* Protect the next node to the right */ addr = next_addr; if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, info_udata->udata, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "B-tree node") /* Cache information from this node */ next_addr = bt->right; @@ -1996,7 +1870,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad /* Unprotect node */ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") bt = NULL; } /* end while */ @@ -2009,7 +1883,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad done: if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_get_info_helper() */ @@ -2082,7 +1956,7 @@ done: htri_t H5B_valid(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr) { - H5B_t *bt; /* The btree */ + H5B_t *bt = NULL; /* The btree */ htri_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5B_valid, FAIL) @@ -2094,17 +1968,17 @@ H5B_valid(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr) HDassert(type); if(!H5F_addr_defined(addr)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "address is undefined") + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "address is undefined") /* Protect the node */ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") +done: /* Release the node */ - if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") + if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_valid() */ diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 15dcb26..1d795ec 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -160,10 +160,10 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud H5WB_t *wb = NULL; /* Wrapped buffer for header data */ uint8_t hdr_buf[H5B2_HDR_BUF_SIZE]; /* Buffer for header */ uint8_t *buf; /* Pointer to header buffer */ - uint8_t *p; /* Pointer into raw data buffer */ + const uint8_t *p; /* Pointer into raw data buffer */ H5B2_hdr_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5B2_cache_hdr_load, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_hdr_load) /* Check arguments */ HDassert(f); @@ -227,7 +227,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud UINT32DECODE(p, stored_chksum); /* Sanity check */ - HDassert((size_t)(p - buf) == size); + HDassert((size_t)(p - (const uint8_t *)buf) == size); /* Compute checksum on entire header */ computed_chksum = H5_checksum_metadata(buf, (size - H5B2_SIZEOF_CHKSUM), 0); @@ -280,7 +280,7 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, uint8_t hdr_buf[H5B2_HDR_BUF_SIZE]; /* Buffer for header */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5B2_cache_hdr_flush, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_hdr_flush) /* check arguments */ HDassert(f); @@ -487,7 +487,7 @@ H5B2_cache_hdr_size(const H5F_t UNUSED *f, const H5B2_hdr_t *hdr, size_t *size_p * Purpose: Loads a B-tree internal node from the disk. * * Return: Success: Pointer to a new B-tree internal node. - * Failure: NULL + * Failure: NULL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -500,7 +500,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda { const H5B2_int_load_ud1_t *udata = (const H5B2_int_load_ud1_t *)_udata; /* Pointer to user data */ H5B2_internal_t *internal = NULL; /* Internal node read */ - uint8_t *p; /* Pointer into raw data buffer */ + const uint8_t *p; /* Pointer into raw data buffer */ uint8_t *native; /* Pointer to native record info */ H5B2_node_ptr_t *int_node_ptr; /* Pointer to node pointer info */ uint32_t stored_chksum; /* Stored metadata checksum value */ @@ -508,7 +508,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda unsigned u; /* Local index variable */ H5B2_internal_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5B2_cache_internal_load, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_internal_load) /* Check arguments */ HDassert(f); @@ -589,13 +589,13 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda } /* end for */ /* Compute checksum on internal node */ - computed_chksum = H5_checksum_metadata(udata->hdr->page, (size_t)(p - udata->hdr->page), 0); + computed_chksum = H5_checksum_metadata(udata->hdr->page, (size_t)(p - (const uint8_t *)udata->hdr->page), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); /* Sanity check parsing */ - HDassert((size_t)(p - udata->hdr->page) <= udata->hdr->node_size); + HDassert((size_t)(p - (const uint8_t *)udata->hdr->page) <= udata->hdr->node_size); /* Verify checksum */ if(stored_chksum != computed_chksum) @@ -607,6 +607,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda done: if(!ret_value && internal) (void)H5B2_cache_internal_dest(f, internal); + FUNC_LEAVE_NOAPI(ret_value) } /* H5B2_cache_internal_load() */ /*lint !e818 Can't make udata a pointer to const */ @@ -629,7 +630,7 @@ H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5B2_cache_internal_flush, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_internal_flush) /* check arguments */ HDassert(f); @@ -858,14 +859,14 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v const uint16_t *nrec = (const uint16_t *)_nrec; H5B2_hdr_t *hdr = (H5B2_hdr_t *)_hdr; /* B-tree header information */ H5B2_leaf_t *leaf = NULL; /* Pointer to lead node loaded */ - uint8_t *p; /* Pointer into raw data buffer */ + const uint8_t *p; /* Pointer into raw data buffer */ uint8_t *native; /* Pointer to native keys */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ unsigned u; /* Local index variable */ H5B2_leaf_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5B2_cache_leaf_load, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_leaf_load) /* Check arguments */ HDassert(f); @@ -926,13 +927,13 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v } /* end for */ /* Compute checksum on internal node */ - computed_chksum = H5_checksum_metadata(hdr->page, (size_t)(p - hdr->page), 0); + computed_chksum = H5_checksum_metadata(hdr->page, (size_t)(p - (const uint8_t *)hdr->page), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); /* Sanity check parsing */ - HDassert((size_t)(p - hdr->page) <= hdr->node_size); + HDassert((size_t)(p - (const uint8_t *)hdr->page) <= hdr->node_size); /* Verify checksum */ if(stored_chksum != computed_chksum) @@ -944,6 +945,7 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v done: if(!ret_value && leaf) (void)H5B2_cache_leaf_dest(f, leaf); + FUNC_LEAVE_NOAPI(ret_value) } /* H5B2_cache_leaf_load() */ /*lint !e818 Can't make udata a pointer to const */ @@ -966,7 +968,7 @@ H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5 { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5B2_cache_leaf_flush, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_leaf_flush) /* check arguments */ HDassert(f); diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index f1d5d84..696eb89 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -350,11 +350,10 @@ H5B2_hdr_incr(H5B2_hdr_t *hdr) /* Sanity checks */ HDassert(hdr); - HDassert(hdr->f); /* Mark header as un-evictable when a B-tree node is depending on it */ if(hdr->rc == 0) - if(H5AC_pin_protected_entry(hdr->f, hdr) < 0) + if(H5AC_pin_protected_entry(hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTPIN, FAIL, "unable to pin v2 B-tree header") /* Increment reference count on B-tree header */ @@ -387,7 +386,6 @@ H5B2_hdr_decr(H5B2_hdr_t *hdr) /* Sanity check */ HDassert(hdr); - HDassert(hdr->f); HDassert(hdr->rc > 0); /* Decrement reference count on B-tree header */ @@ -395,7 +393,7 @@ H5B2_hdr_decr(H5B2_hdr_t *hdr) /* Mark header as evictable again when no nodes depend on it */ if(hdr->rc == 0) - if(H5AC_unpin_entry(hdr->f, hdr) < 0) + if(H5AC_unpin_entry(hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin v2 B-tree header") done: @@ -482,10 +480,9 @@ H5B2_hdr_dirty(H5B2_hdr_t *hdr) /* Sanity check */ HDassert(hdr); - HDassert(hdr->f); /* Mark B-tree header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(hdr->f, hdr) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark v2 B-tree header as dirty") done: diff --git a/src/H5Bcache.c b/src/H5Bcache.c index 0424134..cc5bbbf 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -39,14 +39,17 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5MFprivate.h" /* File memory management */ + /****************/ /* Local Macros */ /****************/ + /******************/ /* Local Typedefs */ /******************/ + /********************/ /* Local Prototypes */ /********************/ @@ -60,6 +63,7 @@ static herr_t H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, static herr_t H5B_clear(H5F_t *f, H5B_t *b, hbool_t destroy); static herr_t H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr); + /*********************/ /* Package Variables */ /*********************/ @@ -79,14 +83,14 @@ const H5AC_class_t H5AC_BT[1] = {{ /* Local Variables */ /*******************/ + /*------------------------------------------------------------------------- * Function: H5B_serialize * * Purpose: Serialize the data structure for writing to disk. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Bill Wendling * wendling@ncsa.uiuc.edu @@ -159,7 +163,6 @@ done: * Purpose: Loads a B-tree node from the disk. * * Return: Success: Pointer to a new B-tree node. - * * Failure: NULL * * Programmer: Robb Matzke @@ -173,13 +176,13 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) { const H5B_class_t *type = (const H5B_class_t *) _type; H5B_t *bt = NULL; - H5B_shared_t *shared; /* Pointer to shared B-tree info */ - uint8_t *p; /* Pointer into raw data buffer */ - uint8_t *native; /* Pointer to native keys */ - unsigned u; /* Local index variable */ - H5B_t *ret_value; + H5B_shared_t *shared; /* Pointer to shared B-tree info */ + const uint8_t *p; /* Pointer into raw data buffer */ + uint8_t *native; /* Pointer to native keys */ + unsigned u; /* Local index variable */ + H5B_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5B_load, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5B_load) /* Check arguments */ HDassert(f); @@ -188,19 +191,24 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) HDassert(type->get_shared); if(NULL == (bt = H5FL_MALLOC(H5B_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemset(&bt->cache_info,0,sizeof(H5AC_info_t)); - if(NULL == (bt->rc_shared=(type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't retrieve B-tree node buffer") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate B-tree struct") + HDmemset(&bt->cache_info, 0, sizeof(H5AC_info_t)); + + if(NULL == (bt->rc_shared = (type->get_shared)(f, udata))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't retrieve B-tree node buffer") shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); - if(NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) || - NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - if(H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page)<0) + /* Allocate space for the native keys and child addresses */ + if(NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for native keys") + if(NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for child addresses") + + if(H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page) < 0) HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree node") + /* Set the pointer into the raw data buffer */ p = shared->page; /* magic number */ @@ -217,8 +225,8 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) UINT16DECODE(p, bt->nchildren); /* sibling pointers */ - H5F_addr_decode(f, (const uint8_t **) &p, &(bt->left)); - H5F_addr_decode(f, (const uint8_t **) &p, &(bt->right)); + H5F_addr_decode(f, (const uint8_t **)&p, &(bt->left)); + H5F_addr_decode(f, (const uint8_t **)&p, &(bt->right)); /* the child/key pairs */ native = bt->native; @@ -230,7 +238,7 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) native += type->sizeof_nkey; /* Decode address value */ - H5F_addr_decode(f, (const uint8_t **) &p, bt->child + u); + H5F_addr_decode(f, (const uint8_t **)&p, bt->child + u); } /* end for */ /* Decode final key */ @@ -246,6 +254,7 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) done: if(!ret_value && bt) (void)H5B_dest(f, bt); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_load() */ /*lint !e818 Can't make udata a pointer to const */ @@ -255,33 +264,27 @@ done: * * Purpose: Flushes a dirty B-tree node to disk. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * matzke@llnl.gov * Jun 23 1997 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * *------------------------------------------------------------------------- */ static herr_t H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt, unsigned UNUSED * flags_ptr) { - H5B_shared_t *shared; /* Pointer to shared B-tree info */ + H5B_shared_t *shared; /* Pointer to shared B-tree info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5B_flush, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5B_flush) /* check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(bt); - shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); + shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); HDassert(shared->type); HDassert(shared->type->encode); @@ -302,7 +305,7 @@ H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt, uns } /* end if */ if(destroy) - if(H5B_dest(f,bt) < 0) + if(H5B_dest(f, bt) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node") done: diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index c31b4c3..aafb999 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -30,6 +30,7 @@ #define H5B_PACKAGE /*suppress error about including H5Bpkg */ + /***********/ /* Headers */ /***********/ @@ -38,6 +39,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5MMprivate.h" /* Memory management */ + /*------------------------------------------------------------------------- * Function: H5B_debug @@ -50,9 +52,6 @@ * matzke@llnl.gov * Aug 4 1997 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ herr_t @@ -60,28 +59,28 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f const H5B_class_t *type, void *udata) { H5B_t *bt = NULL; - H5B_shared_t *shared; /* Pointer to shared B-tree info */ + H5B_shared_t *shared; /* Pointer to shared B-tree info */ unsigned u; /* Local index variable */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5B_debug, FAIL) /* * Check arguments. */ - assert(f); - assert(H5F_addr_defined(addr)); - assert(stream); - assert(indent >= 0); - assert(fwidth >= 0); - assert(type); + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(stream); + HDassert(indent >= 0); + HDassert(fwidth >= 0); + HDassert(type); /* * Load the tree node. */ - if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node") - shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") + shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); /* @@ -89,8 +88,8 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Tree type ID:", - ((shared->type->id)==H5B_SNODE_ID ? "H5B_SNODE_ID" : - ((shared->type->id)==H5B_CHUNK_ID ? "H5B_CHUNK_ID" : "Unknown!"))); + ((shared->type->id) == H5B_SNODE_ID ? "H5B_SNODE_ID" : + ((shared->type->id) == H5B_CHUNK_ID ? "H5B_CHUNK_ID" : "Unknown!"))); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of node:", shared->sizeof_rnode); @@ -103,15 +102,12 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Level:", bt->level); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of left sibling:", bt->left); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of right sibling:", bt->right); - HDfprintf(stream, "%*s%-*s %u (%u)\n", indent, "", fwidth, "Number of children (max):", bt->nchildren, shared->two_k); @@ -119,35 +115,35 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f /* * Print the child addresses */ - for (u = 0; u < bt->nchildren; u++) { + for(u = 0; u < bt->nchildren; u++) { HDfprintf(stream, "%*sChild %d...\n", indent, "", u); HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), "Address:", bt->child[u]); /* If there is a key debugging routine, use it to display the left & right keys */ - if (type->debug_key) { + if(type->debug_key) { /* Decode the 'left' key & print it */ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), "Left Key:"); - assert(H5B_NKEY(bt,shared,u)); - (void)(type->debug_key)(stream, f, dxpl_id, indent+6, MAX (0, fwidth-6), - H5B_NKEY(bt,shared,u), udata); + HDassert(H5B_NKEY(bt,shared,u)); + (void)(type->debug_key)(stream, f, dxpl_id, indent + 6, MAX(0, fwidth - 6), + H5B_NKEY(bt, shared, u), udata); /* Decode the 'right' key & print it */ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), "Right Key:"); - assert(H5B_NKEY(bt,shared,u+1)); - (void)(type->debug_key)(stream, f, dxpl_id, indent+6, MAX (0, fwidth-6), - H5B_NKEY(bt,shared,u+1), udata); - } - } + HDassert(H5B_NKEY(bt, shared, u + 1)); + (void)(type->debug_key)(stream, f, dxpl_id, indent + 6, MAX (0, fwidth - 6), + H5B_NKEY(bt, shared, u + 1), udata); + } /* end if */ + } /* end for */ done: - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") + if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5B_debug() */ /*------------------------------------------------------------------------- @@ -162,15 +158,6 @@ done: * Programmer: Robb Matzke * Tuesday, November 4, 1997 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * John Mainzer, 6/8/05 - * Modified the function to use the new dirtied parameter of - * of H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. - * *------------------------------------------------------------------------- */ #ifdef H5B_DEBUG @@ -178,11 +165,11 @@ herr_t H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void *udata) { H5B_t *bt = NULL; - H5B_shared_t *shared; /* Pointer to shared B-tree info */ + H5B_shared_t *shared; /* Pointer to shared B-tree info */ int i, ncell, cmp; static int ncalls = 0; herr_t status; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ /* A queue of child data */ struct child_t { @@ -193,25 +180,25 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void FUNC_ENTER_NOAPI_NOFUNC(H5B_assert) - if (0==ncalls++) { - if (H5DEBUG(B)) { + if(0 == ncalls++) { + if(H5DEBUG(B)) fprintf(H5DEBUG(B), "H5B: debugging B-trees (expensive)\n"); - } - } + } /* end if */ + /* Initialize the queue */ bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ); - assert(bt); - shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); + HDassert(bt); + shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); cur = H5MM_calloc(sizeof(struct child_t)); - assert (cur); + HDassert(cur); cur->addr = addr; cur->level = bt->level; head = tail = cur; status = H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET); - assert(status >= 0); - bt=NULL; /* Make certain future references will be caught */ + HDassert(status >= 0); + bt = NULL; /* Make certain future references will be caught */ /* * Do a breadth-first search of the tree. New nodes are added to the end @@ -219,66 +206,63 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void * remove any nodes from the queue because we need them in the uniqueness * test. */ - for (ncell = 0; cur; ncell++) { + for(ncell = 0; cur; ncell++) { bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, cur->addr, type, udata, H5AC_READ); - assert(bt); + HDassert(bt); /* Check node header */ - assert(bt->level == cur->level); - if (cur->next && cur->next->level == bt->level) { - assert(H5F_addr_eq(bt->right, cur->next->addr)); - } else { - assert(!H5F_addr_defined(bt->right)); - } - if (prev && prev->level == bt->level) { - assert(H5F_addr_eq(bt->left, prev->addr)); - } else { - assert(!H5F_addr_defined(bt->left)); - } - - if (cur->level > 0) { - for (i = 0; i < bt->nchildren; i++) { - + HDassert(bt->level == cur->level); + if(cur->next && cur->next->level == bt->level) + HDassert(H5F_addr_eq(bt->right, cur->next->addr)); + else + HDassert(!H5F_addr_defined(bt->right)); + if(prev && prev->level == bt->level) + HDassert(H5F_addr_eq(bt->left, prev->addr)); + else + HDassert(!H5F_addr_defined(bt->left)); + + if(cur->level > 0) { + for(i = 0; i < bt->nchildren; i++) { /* * Check that child nodes haven't already been seen. If they * have then the tree has a cycle. */ - for (tmp = head; tmp; tmp = tmp->next) { - assert(H5F_addr_ne(tmp->addr, bt->child[i])); - } + for(tmp = head; tmp; tmp = tmp->next) + HDassert(H5F_addr_ne(tmp->addr, bt->child[i])); /* Add the child node to the end of the queue */ tmp = H5MM_calloc(sizeof(struct child_t)); - assert (tmp); + HDassert(tmp); tmp->addr = bt->child[i]; tmp->level = bt->level - 1; tail->next = tmp; tail = tmp; /* Check that the keys are monotonically increasing */ - cmp = (type->cmp2) (f, dxpl_id, H5B_NKEY(bt,shared,i), udata, - H5B_NKEY(bt,shared,i+1)); - assert(cmp < 0); - } - } + cmp = (type->cmp2)(f, dxpl_id, H5B_NKEY(bt, shared, i), udata, + H5B_NKEY(bt, shared, i + 1)); + HDassert(cmp < 0); + } /* end for */ + } /* end if */ + /* Release node */ status = H5AC_unprotect(f, dxpl_id, H5AC_BT, cur->addr, bt, H5AC__NO_FLAGS_SET); - assert(status >= 0); - bt=NULL; /* Make certain future references will be caught */ + HDassert(status >= 0); + bt = NULL; /* Make certain future references will be caught */ /* Advance current location in queue */ prev = cur; cur = cur->next; - } + } /* end for */ /* Free all entries from queue */ - while (head) { + while(head) { tmp = head->next; H5MM_xfree(head); head = tmp; - } + } /* end while */ FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5B_assert() */ #endif /* H5B_DEBUG */ diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h index ddabf52..7aedd00 100644 --- a/src/H5Bpkg.h +++ b/src/H5Bpkg.h @@ -33,6 +33,7 @@ /* Other private headers needed by this file */ + /**************************/ /* Package Private Macros */ /**************************/ diff --git a/src/H5C.c b/src/H5C.c index ef58012..d8688b2 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -3439,9 +3439,9 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, herr_t H5C_dest(H5F_t * f, hid_t primary_dxpl_id, - hid_t secondary_dxpl_id, - H5C_t * cache_ptr) + hid_t secondary_dxpl_id) { + H5C_t * cache_ptr = f->shared->cache; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_dest, FAIL) @@ -3463,7 +3463,7 @@ H5C_dest(H5F_t * f, cache_ptr->magic = 0; - (void)H5FL_FREE(H5C_t, cache_ptr); + cache_ptr = H5FL_FREE(H5C_t, cache_ptr); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3489,32 +3489,33 @@ done: * *------------------------------------------------------------------------- */ - herr_t H5C_expunge_entry(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, - H5C_t * cache_ptr, const H5C_class_t * type, haddr_t addr, unsigned flags) { + H5C_t * cache_ptr; herr_t result; hbool_t first_flush = TRUE; - hbool_t free_file_space; H5C_cache_entry_t * entry_ptr = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_expunge_entry, FAIL) - free_file_space = ( (flags & H5C__FREE_FILE_SPACE_FLAG) != 0 ); + HDassert( f ); + HDassert( f->shared ); + + cache_ptr = f->shared->cache; - HDassert( H5F_addr_defined(addr) ); HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); HDassert( type ); HDassert( type->clear ); HDassert( type->dest ); + HDassert( H5F_addr_defined(addr) ); #if H5C_DO_EXTREME_SANITY_CHECKS if ( H5C_validate_lru_list(cache_ptr) < 0 ) { @@ -3548,15 +3549,12 @@ H5C_expunge_entry(H5F_t * f, } /* Pass along 'free file space' flag to cache client */ - - entry_ptr->free_file_space_on_destroy = free_file_space; - + entry_ptr->free_file_space_on_destroy = ( (flags & H5C__FREE_FILE_SPACE_FLAG) != 0 ); /* If we get this far, call H5C_flush_single_entry() with the * H5C__FLUSH_INVALIDATE_FLAG and the H5C__FLUSH_CLEAR_ONLY_FLAG. * This will clear the entry, and then delete it from the cache. */ - result = H5C_flush_single_entry(f, primary_dxpl_id, secondary_dxpl_id, @@ -3690,9 +3688,9 @@ herr_t H5C_flush_cache(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, - H5C_t * cache_ptr, unsigned flags) { + H5C_t * cache_ptr = f->shared->cache; herr_t status; herr_t ret_value = SUCCEED; hbool_t destroy; @@ -4244,8 +4242,7 @@ H5C_flush_to_min_clean(H5F_t * f, /* Flush the marked entries */ result = H5C_flush_cache(f, primary_dxpl_id, secondary_dxpl_id, - cache_ptr, H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_IGNORE_PROTECTED_FLAG); + H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG); if ( result < 0 ) { @@ -4301,7 +4298,7 @@ done: */ herr_t -H5C_get_cache_auto_resize_config(H5C_t * cache_ptr, +H5C_get_cache_auto_resize_config(const H5C_t * cache_ptr, H5C_auto_size_ctl_t *config_ptr) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4483,7 +4480,7 @@ done: */ herr_t -H5C_get_entry_status(H5C_t * cache_ptr, +H5C_get_entry_status(const H5F_t *f, haddr_t addr, size_t * size_ptr, hbool_t * in_cache_ptr, @@ -4493,11 +4490,17 @@ H5C_get_entry_status(H5C_t * cache_ptr, hbool_t * is_flush_dep_parent_ptr, hbool_t * is_flush_dep_child_ptr) { + H5C_t * cache_ptr; H5C_cache_entry_t * entry_ptr = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_get_entry_status, FAIL) + HDassert( f ); + HDassert( f->shared ); + + cache_ptr = f->shared->cache; + HDassert( cache_ptr != NULL ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); HDassert( H5F_addr_defined(addr) ); @@ -4581,7 +4584,7 @@ done: */ herr_t -H5C_get_evictions_enabled(H5C_t * cache_ptr, +H5C_get_evictions_enabled(const H5C_t * cache_ptr, hbool_t * evictions_enabled_ptr) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4622,38 +4625,55 @@ done: * Programmer: John Mainzer * 1/20/06 * - * Modifications: - * *------------------------------------------------------------------------- */ - herr_t -H5C_get_trace_file_ptr(H5C_t * cache_ptr, - FILE ** trace_file_ptr_ptr) +H5C_get_trace_file_ptr(const H5C_t *cache_ptr, FILE **trace_file_ptr_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_NOAPI_NOFUNC(H5C_get_trace_file_ptr) - FUNC_ENTER_NOAPI(H5C_get_trace_file_ptr, FAIL) - - /* This would normally be an assert, but we need to use an HGOTO_ERROR - * call to shut up the compiler. - */ - if ( ( ! cache_ptr ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) { + /* Sanity checks */ + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(trace_file_ptr_ptr); - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr") - } + *trace_file_ptr_ptr = cache_ptr->trace_file_ptr; - if ( trace_file_ptr_ptr == NULL ) { + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5C_get_trace_file_ptr() */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL trace_file_ptr_ptr") - } + +/*------------------------------------------------------------------------- + * Function: H5C_get_trace_file_ptr_from_entry + * + * Purpose: Get the trace_file_ptr field from the cache, via an entry. + * + * This field will either be NULL (which indicates that trace + * file logging is turned off), or contain a pointer to the + * open file to which trace file data is to be written. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * 6/9/08 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr, + FILE **trace_file_ptr_ptr) +{ + FUNC_ENTER_NOAPI_NOFUNC(H5C_get_trace_file_ptr_from_entry) - *trace_file_ptr_ptr = cache_ptr->trace_file_ptr; + /* Sanity checks */ + HDassert(entry_ptr); + HDassert(entry_ptr->cache_ptr); -done: - FUNC_LEAVE_NOAPI(ret_value) + /* Go get the trace file pointer for the cache */ + H5C_get_trace_file_ptr(entry_ptr->cache_ptr, trace_file_ptr_ptr); -} /* H5C_get_trace_file_ptr() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5C_get_trace_file_ptr_from_entry() */ /*------------------------------------------------------------------------- @@ -4768,12 +4788,12 @@ herr_t H5C_insert_entry(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, - H5C_t * cache_ptr, const H5C_class_t * type, haddr_t addr, void * thing, unsigned int flags) { + H5C_t * cache_ptr; herr_t result; hbool_t first_flush = TRUE; hbool_t insert_pinned; @@ -4787,6 +4807,11 @@ H5C_insert_entry(H5F_t * f, FUNC_ENTER_NOAPI(H5C_insert_entry, FAIL) + HDassert( f ); + HDassert( f->shared ); + + cache_ptr = f->shared->cache; + HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); HDassert( cache_ptr->skip_file_checks || f ); @@ -4839,6 +4864,7 @@ H5C_insert_entry(H5F_t * f, #ifndef NDEBUG entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; #endif /* NDEBUG */ + entry_ptr->cache_ptr = cache_ptr; entry_ptr->addr = addr; entry_ptr->type = type; @@ -5372,59 +5398,31 @@ done: * Programmer: John Mainzer * 3/22/06 * - * Modifications: - * - * Added code to do a flash cache size increase if - * appropriate. - * JRM -- 1/11/08 - * - * - * Added code to update the clean_index_size and - * dirty_index_size fields of H5C_t in cases where the - * the entry was clean on protect, was marked dirty in - * this call, and did not change its size. Do this via - * a call to H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(). - * - * If the size changed, this case is already dealt with by - * by the pre-existing call to - * H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(). - * - * JRM -- 11/5/08 - * *------------------------------------------------------------------------- */ herr_t -H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr, - void * thing, - hbool_t size_changed, - size_t new_size) +H5C_mark_pinned_entry_dirty(void *thing, hbool_t size_changed, size_t new_size) { - herr_t ret_value = SUCCEED; /* Return value */ - herr_t result; + H5C_t * cache_ptr; + H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; hbool_t was_clean; size_t size_increase; - H5C_cache_entry_t * entry_ptr; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_mark_pinned_entry_dirty, FAIL) - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - HDassert( ( size_changed == TRUE ) || ( size_changed == FALSE ) ); - - entry_ptr = (H5C_cache_entry_t *)thing; - - if ( ! ( entry_ptr->is_pinned ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "Entry isn't pinned??") - } - - if ( entry_ptr->is_protected ) { + /* Sanity checks */ + HDassert(entry_ptr); + HDassert(H5F_addr_defined(entry_ptr->addr)); + cache_ptr = entry_ptr->cache_ptr; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "Entry is protected??") - } + /* Check for usage errors */ + if(!entry_ptr->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry isn't pinned??") + if(entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry is protected??") /* make note of whether the entry was dirty to begin with */ was_clean = ! ( entry_ptr->is_dirty ); @@ -5443,17 +5441,9 @@ H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr, size_increase = new_size - entry_ptr->size; if ( size_increase >= - cache_ptr->flash_size_increase_threshold ) { - - result = H5C__flash_increase_cache_size(cache_ptr, - entry_ptr->size, - new_size); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ - "H5C__flash_increase_cache_size failed.") - } + cache_ptr->flash_size_increase_threshold ) { + if(H5C__flash_increase_cache_size(cache_ptr, entry_ptr->size, new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "flash cache increase failed") } } } @@ -5494,9 +5484,7 @@ H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr, H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_mark_pinned_entry_dirty() */ @@ -5521,16 +5509,6 @@ done: * Programmer: John Mainzer * 5/15/06 * - * Modifications: - * - * JRM -- 3/29/07 - * Added sanity check to verify that the pinned entry - * is not protected read only. - * - * This sanity check is commented out for now -- uncomment - * it once we deal with the problem of entries being protected - * read only, and then dirtied. - * * JRM -- 11/5/08 * Added call to H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY() to * update the new clean_index_size and dirty_index_size @@ -5540,20 +5518,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, - void * thing) +H5C_mark_pinned_or_protected_entry_dirty(void *thing) { + H5C_t * cache_ptr; + H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; herr_t ret_value = SUCCEED; /* Return value */ - hbool_t was_pinned_unprotected_and_clean; - H5C_cache_entry_t * entry_ptr; FUNC_ENTER_NOAPI(H5C_mark_pinned_or_protected_entry_dirty, FAIL) - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - - entry_ptr = (H5C_cache_entry_t *)thing; + /* Sanity checks */ + HDassert(entry_ptr); + HDassert(H5F_addr_defined(entry_ptr->addr)); + cache_ptr = entry_ptr->cache_ptr; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); if ( entry_ptr->is_protected ) { #if 0 /* JRM - uncomment this when possible */ @@ -5563,6 +5541,7 @@ H5C_mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, entry_ptr->dirtied = TRUE; } else if ( entry_ptr->is_pinned ) { + hbool_t was_pinned_unprotected_and_clean; was_pinned_unprotected_and_clean = ! ( entry_ptr->is_dirty ); @@ -5588,9 +5567,7 @@ H5C_mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, } done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_mark_pinned_or_protected_entry_dirty() */ @@ -5810,64 +5787,33 @@ done: * Programmer: John Mainzer * 7/5/06 * - * Modifications: - * - * Added code to apply a flash cache size increment if - * appropriate. - * JRM -- 1/11/08 - * - * Added code to update the clean_index_size and - * dirty_index_size fields of H5C_t in cases where the - * the entry was clean prior to this call, was marked dirty, - * and did not change its size. Do this via a call to - * H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(). - * - * If the size changed, this case is already dealt with by - * by the pre-existing call to - * H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(). - * - * JRM -- 11/5/08 - * - * *------------------------------------------------------------------------- */ herr_t -H5C_resize_pinned_entry(H5C_t * cache_ptr, - void * thing, - size_t new_size) +H5C_resize_pinned_entry(void *thing, size_t new_size) { - /* const char * fcn_name = "H5C_resize_pinned_entry()"; */ - herr_t ret_value = SUCCEED; /* Return value */ - herr_t result; - hbool_t was_clean; - H5C_cache_entry_t * entry_ptr; + H5C_t * cache_ptr; + H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; size_t size_increase; + hbool_t was_clean; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_resize_pinned_entry, FAIL) - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - - entry_ptr = (H5C_cache_entry_t *)thing; - - if ( new_size <= 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \ - "New size is non-positive.") - } - - if ( ! ( entry_ptr->is_pinned ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \ - "Entry isn't pinned??") - } - - if ( entry_ptr->is_protected ) { + /* Sanity checks */ + HDassert(entry_ptr); + HDassert(H5F_addr_defined(entry_ptr->addr)); + cache_ptr = entry_ptr->cache_ptr; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \ - "Entry is protected??") - } + /* Check for usage errors */ + if(new_size <= 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "New size is non-positive.") + if(!entry_ptr->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry isn't pinned??") + if(entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry is protected??") /* make note of whether the entry was clean to begin with */ was_clean = ! ( entry_ptr->is_dirty ); @@ -5890,15 +5836,11 @@ H5C_resize_pinned_entry(H5C_t * cache_ptr, if ( size_increase >= cache_ptr->flash_size_increase_threshold ) { - result = H5C__flash_increase_cache_size(cache_ptr, - entry_ptr->size, - new_size); - - if ( result < 0 ) { - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ - "H5C__flash_increase_cache_size failed.") - } + if(H5C__flash_increase_cache_size(cache_ptr, + entry_ptr->size, + new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "flash cache increase failed") } } } @@ -5940,9 +5882,7 @@ H5C_resize_pinned_entry(H5C_t * cache_ptr, H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_resize_pinned_entry() */ @@ -6007,38 +5947,23 @@ done: * Programmer: John Mainzer * 4/26/06 * - * Modifications: - * - * JRM -- 4/26/06 - * Modified routine to allow it to operate on protected - * entries. - * - * JRM -- 2/16/07 - * Added conditional compile to avoid unused parameter - * warning in production compile. - * - * JRM -- 4/4/07 - * Fixed typo -- canged macro call to - * H5C__UPDATE_STATS_FOR_UNPIN to call to - * H5C__UPDATE_STATS_FOR_PIN. - * *------------------------------------------------------------------------- */ herr_t -H5C_pin_protected_entry(H5C_t * cache_ptr, - void * thing) +H5C_pin_protected_entry(void *thing) { - H5C_cache_entry_t * entry_ptr; /* Pointer to entry to pin */ + H5C_t * cache_ptr; + H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; /* Pointer to entry to pin */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_pin_protected_entry, FAIL) - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - entry_ptr = (H5C_cache_entry_t *)thing; - HDassert( entry_ptr ); - HDassert( H5F_addr_defined(entry_ptr->addr) ); + /* Sanity checks */ + HDassert(entry_ptr); + HDassert(H5F_addr_defined(entry_ptr->addr)); + cache_ptr = entry_ptr->cache_ptr; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); /* Only protected entries can be pinned */ if(!entry_ptr->is_protected) @@ -6160,7 +6085,6 @@ void * H5C_protect(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, - H5C_t * cache_ptr, const H5C_class_t * type, haddr_t addr, const void * udata1, @@ -6168,6 +6092,7 @@ H5C_protect(H5F_t * f, unsigned flags) { /* const char * fcn_name = "H5C_protect()"; */ + H5C_t * cache_ptr; hbool_t hit; hbool_t first_flush; hbool_t have_write_permitted = FALSE; @@ -6182,6 +6107,9 @@ H5C_protect(H5F_t * f, FUNC_ENTER_NOAPI(H5C_protect, NULL) /* check args */ + HDassert( f ); + HDassert( f->shared ); + cache_ptr = f->shared->cache; HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); HDassert( cache_ptr->skip_file_checks || f ); @@ -6609,14 +6537,13 @@ done: */ herr_t -H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, +H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr) { - /* const char *fcn_name = "H5C_set_cache_auto_resize_config()"; */ - herr_t ret_value = SUCCEED; /* Return value */ herr_t result; size_t new_max_cache_size; size_t new_min_clean_size; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_set_cache_auto_resize_config, FAIL) @@ -6892,7 +6819,7 @@ done: */ herr_t -H5C_set_evictions_enabled(H5C_t * cache_ptr, +H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled) { herr_t ret_value = SUCCEED; /* Return value */ @@ -7756,20 +7683,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_unpin_entry(H5C_t * cache_ptr, - void * thing) +H5C_unpin_entry(void *thing) { - H5C_cache_entry_t * entry_ptr; /* Pointer to entry to unpin */ + H5C_t * cache_ptr; + H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; /* Pointer to entry to unpin */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_unpin_entry, FAIL) - /* Sanity checking */ - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - entry_ptr = (H5C_cache_entry_t *)thing; - HDassert( entry_ptr ); + /* Sanity check */ + HDassert(entry_ptr); + cache_ptr = entry_ptr->cache_ptr; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); /* Unpin the entry */ if(H5C_unpin_entry_from_client(cache_ptr, entry_ptr, TRUE) < 0) @@ -7900,13 +7826,13 @@ herr_t H5C_unprotect(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, - H5C_t * cache_ptr, const H5C_class_t * type, haddr_t addr, void * thing, unsigned int flags, size_t new_size) { + H5C_t * cache_ptr; hbool_t deleted; hbool_t dirtied; hbool_t set_flush_marker; @@ -7942,6 +7868,11 @@ H5C_unprotect(H5F_t * f, dirtied |= size_changed; + HDassert( f ); + HDassert( f->shared ); + + cache_ptr = f->shared->cache; + HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); HDassert( cache_ptr->skip_file_checks || f ); @@ -8665,16 +8596,10 @@ H5C_adjust_flush_dependency_rc(H5C_cache_entry_t * cache_entry, * *------------------------------------------------------------------------- */ -#ifndef NDEBUG -herr_t -H5C_create_flush_dependency(H5C_t * cache_ptr, void * parent_thing, - void * child_thing) -#else herr_t -H5C_create_flush_dependency(H5C_t UNUSED * cache_ptr, void * parent_thing, - void * child_thing) -#endif +H5C_create_flush_dependency(void * parent_thing, void * child_thing) { + H5C_t * cache_ptr; H5C_cache_entry_t * parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent thing's entry */ H5C_cache_entry_t * child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child thing's entry */ #ifndef NDEBUG @@ -8685,8 +8610,6 @@ H5C_create_flush_dependency(H5C_t UNUSED * cache_ptr, void * parent_thing, FUNC_ENTER_NOAPI(H5C_create_flush_dependency, FAIL) /* Sanity checks */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(parent_entry); HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(parent_entry->flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS); @@ -8695,6 +8618,10 @@ H5C_create_flush_dependency(H5C_t UNUSED * cache_ptr, void * parent_thing, HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(H5F_addr_defined(child_entry->addr)); HDassert(child_entry->flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS); + cache_ptr = parent_entry->cache_ptr; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr == child_entry->cache_ptr); /* More sanity checks */ if(child_entry == parent_entry) @@ -8783,9 +8710,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_destroy_flush_dependency(H5C_t * cache_ptr, void *parent_thing, - void * child_thing) +H5C_destroy_flush_dependency(void *parent_thing, void * child_thing) { + H5C_t * cache_ptr; H5C_cache_entry_t * parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent entry */ H5C_cache_entry_t * child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child entry */ #ifndef NDEBUG @@ -8796,8 +8723,6 @@ H5C_destroy_flush_dependency(H5C_t * cache_ptr, void *parent_thing, FUNC_ENTER_NOAPI(H5C_destroy_flush_dependency, FAIL) /* Sanity checks */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(parent_entry); HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(H5F_addr_defined(parent_entry->addr)); @@ -8806,6 +8731,10 @@ H5C_destroy_flush_dependency(H5C_t * cache_ptr, void *parent_thing, HDassert(child_entry->flush_dep_parent != child_entry); HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(H5F_addr_defined(child_entry->addr)); + cache_ptr = parent_entry->cache_ptr; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr == child_entry->cache_ptr); /* Usage checks */ if(!parent_entry->is_pinned) @@ -11170,17 +11099,18 @@ H5C_flush_single_entry(H5F_t * f, /* Clear the dirty flag only, if requested */ if ( clear_only ) { -#ifndef NDEBUG if ( destroy ) { - /* we are about to call the clear callback with the +#ifndef NDEBUG + /* we are about to call the clear callback with the * destroy flag set -- this will result in *entry_ptr * being freed. Set the magic field to bad magic * so we can detect a freed cache entry if we see * one. */ entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; - } #endif /* NDEBUG */ + entry_ptr->cache_ptr = NULL; + } /* Call the callback routine to clear all dirty flags for object */ if ( (entry_ptr->type->clear)(f, entry_ptr, destroy_entry) < 0 ) { @@ -11198,17 +11128,18 @@ H5C_flush_single_entry(H5F_t * f, } #endif /* H5C_DO_SANITY_CHECKS */ -#ifndef NDEBUG if ( destroy ) { - /* we are about to call the flush callback with the +#ifndef NDEBUG + /* we are about to call the flush callback with the * destroy flag set -- this will result in *entry_ptr * being freed. Set the magic field to bad magic * so we can detect a freed cache entry if we see * one. */ entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; - } #endif /* NDEBUG */ + entry_ptr->cache_ptr = NULL; + } /* Only block for all the processes on the first piece of metadata */ @@ -11477,9 +11408,9 @@ H5C_load_entry(H5F_t * f, * * with: * - * HDassert( ( entry_ptr->is_dirty == FALSE ) || ( type->id == 4 ) ); + * HDassert( ( entry_ptr->is_dirty == FALSE ) || ( type->id == 5 ) ); * - * Note that type id 4 is associated with object headers in the metadata + * Note that type id 5 is associated with object headers in the metadata * cache. * * When we get to using H5C for other purposes, we may wish to @@ -11487,10 +11418,11 @@ H5C_load_entry(H5F_t * f, * metadata cache. */ - HDassert( ( entry_ptr->is_dirty == FALSE ) || ( type->id == 4 ) ); + HDassert( ( entry_ptr->is_dirty == FALSE ) || ( type->id == 5 ) ); #ifndef NDEBUG entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; #endif /* NDEBUG */ + entry_ptr->cache_ptr = f->shared->cache; entry_ptr->addr = addr; entry_ptr->type = type; entry_ptr->is_protected = FALSE; diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 719dec9..b7a348b 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -857,7 +857,7 @@ ****************************************************************************/ #define H5C__H5C_T_MAGIC 0x005CAC0E -#define H5C__MAX_NUM_TYPE_IDS 26 +#define H5C__MAX_NUM_TYPE_IDS 27 #define H5C__PREFIX_LEN 32 struct H5C_t diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 5c7fe9f..dc8d7b1 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -535,6 +535,7 @@ typedef struct H5C_cache_entry_t #ifndef NDEBUG uint32_t magic; #endif /* NDEBUG */ + H5C_t * cache_ptr; haddr_t addr; size_t size; const H5C_class_t * type; @@ -1023,13 +1024,11 @@ H5_DLL void H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, H5_DLL herr_t H5C_dest(H5F_t * f, hid_t primary_dxpl_id, - hid_t secondary_dxpl_id, - H5C_t * cache_ptr); + hid_t secondary_dxpl_id); H5_DLL herr_t H5C_expunge_entry(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, - H5C_t * cache_ptr, const H5C_class_t * type, haddr_t addr, unsigned flags); @@ -1037,7 +1036,6 @@ H5_DLL herr_t H5C_expunge_entry(H5F_t * f, H5_DLL herr_t H5C_flush_cache(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, - H5C_t * cache_ptr, unsigned flags); H5_DLL herr_t H5C_flush_to_min_clean(H5F_t * f, @@ -1045,7 +1043,7 @@ H5_DLL herr_t H5C_flush_to_min_clean(H5F_t * f, hid_t secondary_dxpl_id, H5C_t * cache_ptr); -H5_DLL herr_t H5C_get_cache_auto_resize_config(H5C_t * cache_ptr, +H5_DLL herr_t H5C_get_cache_auto_resize_config(const H5C_t * cache_ptr, H5C_auto_size_ctl_t *config_ptr); H5_DLL herr_t H5C_get_cache_size(H5C_t * cache_ptr, @@ -1057,7 +1055,7 @@ H5_DLL herr_t H5C_get_cache_size(H5C_t * cache_ptr, H5_DLL herr_t H5C_get_cache_hit_rate(H5C_t * cache_ptr, double * hit_rate_ptr); -H5_DLL herr_t H5C_get_entry_status(H5C_t * cache_ptr, +H5_DLL herr_t H5C_get_entry_status(const H5F_t *f, haddr_t addr, size_t * size_ptr, hbool_t * in_cache_ptr, @@ -1067,16 +1065,17 @@ H5_DLL herr_t H5C_get_entry_status(H5C_t * cache_ptr, hbool_t * is_flush_dep_parent_ptr, hbool_t * is_flush_dep_child_ptr); -H5_DLL herr_t H5C_get_evictions_enabled(H5C_t * cache_ptr, +H5_DLL herr_t H5C_get_evictions_enabled(const H5C_t * cache_ptr, hbool_t * evictions_enabled_ptr); -H5_DLL herr_t H5C_get_trace_file_ptr(H5C_t * cache_ptr, - FILE ** trace_file_ptr_ptr); +H5_DLL herr_t H5C_get_trace_file_ptr(const H5C_t *cache_ptr, + FILE **trace_file_ptr_ptr); +H5_DLL herr_t H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr, + FILE **trace_file_ptr_ptr); H5_DLL herr_t H5C_insert_entry(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, - H5C_t * cache_ptr, const H5C_class_t * type, haddr_t addr, void * thing, @@ -1089,29 +1088,24 @@ H5_DLL herr_t H5C_mark_entries_as_clean(H5F_t * f, int32_t ce_array_len, haddr_t * ce_array_ptr); -H5_DLL herr_t H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr, - void * thing, +H5_DLL herr_t H5C_mark_pinned_entry_dirty(void * thing, hbool_t size_changed, size_t new_size); -H5_DLL herr_t H5C_mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, - void * thing); +H5_DLL herr_t H5C_mark_pinned_or_protected_entry_dirty(void *thing); H5_DLL herr_t H5C_rename_entry(H5C_t * cache_ptr, const H5C_class_t * type, haddr_t old_addr, haddr_t new_addr); -H5_DLL herr_t H5C_pin_protected_entry(H5C_t * cache_ptr, - void * thing); +H5_DLL herr_t H5C_pin_protected_entry(void *thing); -H5_DLL herr_t H5C_create_flush_dependency(H5C_t *cache_ptr, void *parent_thing, - void *child_thing); +H5_DLL herr_t H5C_create_flush_dependency(void *parent_thing, void *child_thing); H5_DLL void * H5C_protect(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, - H5C_t * cache_ptr, const H5C_class_t * type, haddr_t addr, const void * udata1, @@ -1120,14 +1114,12 @@ H5_DLL void * H5C_protect(H5F_t * f, H5_DLL herr_t H5C_reset_cache_hit_rate_stats(H5C_t * cache_ptr); -H5_DLL herr_t H5C_resize_pinned_entry(H5C_t * cache_ptr, - void * thing, - size_t new_size); +H5_DLL herr_t H5C_resize_pinned_entry(void *thing, size_t new_size); -H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, +H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr); -H5_DLL herr_t H5C_set_evictions_enabled(H5C_t * cache_ptr, +H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled); H5_DLL herr_t H5C_set_prefix(H5C_t * cache_ptr, char * prefix); @@ -1145,15 +1137,13 @@ H5_DLL herr_t H5C_stats(H5C_t * cache_ptr, H5_DLL void H5C_stats__reset(H5C_t * cache_ptr); -H5_DLL herr_t H5C_unpin_entry(H5C_t * cache_ptr, void * thing); +H5_DLL herr_t H5C_unpin_entry(void *thing); -H5_DLL herr_t H5C_destroy_flush_dependency(H5C_t *cache_ptr, void *parent_thing, - void *child_thing); +H5_DLL herr_t H5C_destroy_flush_dependency(void *parent_thing, void *child_thing); H5_DLL herr_t H5C_unprotect(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, - H5C_t * cache_ptr, const H5C_class_t * type, haddr_t addr, void * thing, diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index d9cde4b..5eec112 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -337,7 +337,7 @@ done: /* ARGSUSED */ static int H5D_btree_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata, - void *_rt_key) + void *_rt_key) { H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key; H5D_btree_key_t *rt_key = (H5D_btree_key_t *) _rt_key; @@ -388,7 +388,7 @@ H5D_btree_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udat /* ARGSUSED */ static int H5D_btree_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata, - void *_rt_key) + void *_rt_key) { H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key; H5D_btree_key_t *rt_key = (H5D_btree_key_t *) _rt_key; @@ -761,8 +761,8 @@ H5D_btree_encode_key(const H5F_t UNUSED *f, const H5B_t *bt, uint8_t *raw, void */ /* ARGSUSED */ static herr_t -H5D_btree_debug_key(FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth, - const void *_key, const void *_udata) +H5D_btree_debug_key(FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, + int fwidth, const void *_key, const void *_udata) { const H5D_btree_key_t *key = (const H5D_btree_key_t *)_key; const unsigned *ndims = (const unsigned *)_udata; diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 95334af..296d79a 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2460,7 +2460,7 @@ H5D_chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * /* Check for SWMR writes to the file */ if(dset->shared->layout.storage.u.chunk.ops->can_swim && H5F_INTENT(dset->oloc.file) & H5F_ACC_SWMR_WRITE) { /* Mark the proxy entry in the cache as clean */ - if(H5D_chunk_proxy_mark(dset, ent, FALSE) < 0) + if(H5D_chunk_proxy_mark(ent, FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTMARKDIRTY, FAIL, "can't mark proxy for chunk from metadata cache as clean") } /* end if */ @@ -2480,7 +2480,6 @@ H5D_chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * done: /* Free the temp buffer only if it's different than the entry chunk */ if(buf != ent->chunk) - /* coverity["double_free"] */ H5MM_xfree(buf); /* @@ -2989,7 +2988,6 @@ H5D_chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, { const H5O_layout_t *layout = &(io_info->dset->shared->layout); /* Dataset layout */ const H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk); - H5D_rdcc_ent_t *ent = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_unlock) @@ -3023,6 +3021,8 @@ H5D_chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, } /* end else */ } /* end if */ else { + H5D_rdcc_ent_t *ent; /* Chunk's entry in the cache */ + /* Sanity check */ HDassert(idx_hint < rdcc->nslots); HDassert(rdcc->slot[idx_hint]); @@ -3041,7 +3041,7 @@ H5D_chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, if(io_info->dset->shared->layout.storage.u.chunk.ops->can_swim && H5F_INTENT(io_info->dset->oloc.file) & H5F_ACC_SWMR_WRITE) { /* Mark the proxy entry in the cache as dirty */ - if(H5D_chunk_proxy_mark(io_info->dset, ent, TRUE) < 0) + if(H5D_chunk_proxy_mark(ent, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTMARKDIRTY, FAIL, "can't mark proxy for chunk from metadata cache as dirty") } /* end if */ } /* end if */ diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index 22f29e8..c87d94a 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -437,16 +437,22 @@ H5D_compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src, H5F_t *f_dst, /* create a memory copy of the variable-length datatype */ if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy") - if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) + if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) { + H5T_close(dt_mem); HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype") + } /* end if */ /* create variable-length datatype at the destinaton file */ if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy") - if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0) + if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0) { + H5T_close(dt_dst); HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk") - if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) + } /* end if */ + if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) { + H5T_close(dt_dst); HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype") + } /* end if */ /* Set up the conversion functions */ if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem, NULL, NULL, dxpl_id, FALSE))) diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 282cecb..e2fe420 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -1279,16 +1279,22 @@ H5D_contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, /* create a memory copy of the variable-length datatype */ if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy") - if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) + if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) { + H5T_close(dt_mem); HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register memory datatype") + } /* end if */ /* create variable-length datatype at the destinaton file */ if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy") - if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0) + if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0) { + H5T_close(dt_dst); HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "cannot mark datatype on disk") - if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) + } /* end if */ + if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) { + H5T_close(dt_dst); HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype") + } /* end if */ /* Set up the conversion functions */ if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem, NULL, NULL, dxpl_id, FALSE))) diff --git a/src/H5Dearray.c b/src/H5Dearray.c index 2215951..0440416 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -642,7 +642,7 @@ H5D_earray_idx_depend(const H5D_chk_idx_info_t *idx_info) done: /* Unpin the dataset's object header */ - if(oh && H5O_unpin(&oloc, oh) < 0) + if(oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header") FUNC_LEAVE_NOAPI(ret_value) @@ -699,7 +699,7 @@ H5D_earray_idx_undepend(const H5D_chk_idx_info_t *idx_info) done: /* Unpin the dataset's object header */ - if(oh && H5O_unpin(&oloc, oh) < 0) + if(oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dint.c b/src/H5Dint.c index f9329b6..da73890 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -58,7 +58,8 @@ typedef struct { /* General stuff */ static herr_t H5D_init_storage(H5D_t *dataset, hbool_t full_overwrite, hid_t dxpl_id); static herr_t H5D_get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache); -static H5D_shared_t *H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type); +static H5D_shared_t *H5D_new(hid_t dcpl_id, hbool_t creating, + hbool_t vl_type); static herr_t H5D_init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type); static herr_t H5D_init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); @@ -522,8 +523,8 @@ done: static H5D_shared_t * H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type) { - H5P_genplist_t *plist; /* Property list created */ H5D_shared_t *new_dset = NULL; /* New dataset object */ + H5P_genplist_t *plist; /* Property list created */ H5D_shared_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_new) @@ -540,7 +541,7 @@ H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type) */ if(!vl_type && creating && dcpl_id == H5P_DATASET_CREATE_DEFAULT) { if(H5I_inc_ref(dcpl_id, FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "Can't increment default DCPL ID") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment default DCPL ID") new_dset->dcpl_id = dcpl_id; } /* end if */ else { @@ -861,8 +862,8 @@ H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) done: /* Release pointer to object header itself */ - if(oloc != NULL && oh != NULL) - if(H5O_unpin(oloc, oh) < 0) + if(oh != NULL) + if(H5O_unpin(oh) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header") /* Error cleanup */ @@ -2236,7 +2237,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5D_flush_real(H5D_t *dataset, hid_t dxpl_id) { H5O_t *oh = NULL; /* Pointer to dataset's object header */ @@ -2287,7 +2288,7 @@ H5D_flush_real(H5D_t *dataset, hid_t dxpl_id) done: /* Release pointer to object header */ if(oh != NULL) - if(H5O_unpin(&(dataset->oloc), oh) < 0) + if(H5O_unpin(oh) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dio.c b/src/H5Dio.c index 406b5ce..5723847 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -211,7 +211,7 @@ done: */ herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf) + hid_t file_space_id, hid_t dxpl_id, const void *buf) { H5D_t *dset = NULL; const H5S_t *mem_space = NULL; @@ -221,7 +221,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, FUNC_ENTER_API(H5Dwrite, FAIL) H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id, - plist_id, buf); + dxpl_id, buf); /* check arguments */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) @@ -246,10 +246,10 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, } /* end if */ /* Get the default dataset transfer property list if the user didn't provide one */ - if(H5P_DEFAULT == plist_id) - plist_id= H5P_DATASET_XFER_DEFAULT; + if(H5P_DEFAULT == dxpl_id) + dxpl_id= H5P_DATASET_XFER_DEFAULT; else - if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) + if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") if(!buf && (NULL == file_space || H5S_GET_SELECT_NPOINTS(file_space) != 0)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer") @@ -262,7 +262,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, buf = &fake_char; /* write raw data */ - if(H5D_write(dset, mem_type_id, mem_space, file_space, plist_id, buf) < 0) + if(H5D_write(dset, mem_type_id, mem_space, file_space, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") done: @@ -583,6 +583,9 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, * independent access, causing the metadata cache to get corrupted. Its been * disabled for all types of access (serial as well as parallel) to make the * modification time consistent for all programs. -QAK + * + * We should set a value in the dataset's shared information instead and flush + * it to the file when the dataset is being closed. -QAK */ /* * Update modification time. We have to do this explicitly because diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index c0a4aa3..c76bfc8 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -414,7 +414,7 @@ H5D_layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, /* Insert "empty" name first */ if((size_t)(-1) == H5HL_insert(file, dxpl_id, heap, (size_t)1, "")) { - H5HL_unprotect(file, dxpl_id, heap, efl->heap_addr); + H5HL_unprotect(heap); HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap") } /* end if */ @@ -424,7 +424,7 @@ H5D_layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, /* Insert file name into heap */ if((size_t)(-1) == (offset = H5HL_insert(file, dxpl_id, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name))) { - H5HL_unprotect(file, dxpl_id, heap, efl->heap_addr); + H5HL_unprotect(heap); HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap") } /* end if */ @@ -434,7 +434,7 @@ H5D_layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, } /* end for */ /* Release the heap */ - if(H5HL_unprotect(file, dxpl_id, heap, efl->heap_addr) < 0) + if(H5HL_unprotect(heap) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to unprotect EFL file name heap") heap = NULL; diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 4596b05..3e03ffd 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -692,8 +692,7 @@ H5_DLL herr_t H5D_chunk_proxy_create(H5D_t *dset, hid_t dxpl_id, H5D_chunk_common_ud_t *udata, H5D_rdcc_ent_t *ent); H5_DLL herr_t H5D_chunk_proxy_remove(const H5D_t *dset, hid_t dxpl_it, H5D_rdcc_ent_t *ent); -H5_DLL herr_t H5D_chunk_proxy_mark(const H5D_t *dset, const H5D_rdcc_ent_t *ent, - hbool_t dirty); +H5_DLL herr_t H5D_chunk_proxy_mark(const H5D_rdcc_ent_t *ent, hbool_t dirty); #ifdef H5_HAVE_PARALLEL diff --git a/src/H5Dproxy.c b/src/H5Dproxy.c index 429500e..592bdaf 100644 --- a/src/H5Dproxy.c +++ b/src/H5Dproxy.c @@ -472,14 +472,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D_chunk_proxy_mark(const H5D_t *dset, const H5D_rdcc_ent_t *ent, - hbool_t dirty) +H5D_chunk_proxy_mark(const H5D_rdcc_ent_t *ent, hbool_t dirty) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_proxy_mark) - HDassert(dset); HDassert(ent); #ifdef QAK HDfprintf(stderr, "%s: ent->proxy_addr = %a, dirty = %t\n", FUNC, ent->proxy_addr, dirty); @@ -487,7 +485,7 @@ HDfprintf(stderr, "%s: ent->proxy_addr = %a, dirty = %t\n", FUNC, ent->proxy_add /* Check whether to mark the proxy as dirty */ if(dirty) { - if(H5AC_mark_pinned_or_protected_entry_dirty(dset->oloc.file, ent->proxy) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(ent->proxy) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTMARKDIRTY, FAIL, "can't mark chunk proxy entry in metadata cache as dirty") } /* end if */ diff --git a/src/H5Dtest.c b/src/H5Dtest.c index 485f98f..49b0986 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -35,26 +35,32 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ + /****************/ /* Local Macros */ /****************/ + /******************/ /* Local Typedefs */ /******************/ + /********************/ /* Local Prototypes */ /********************/ + /*********************/ /* Package Variables */ /*********************/ + /*******************/ /* Local Variables */ /*******************/ + /*-------------------------------------------------------------------------- NAME @@ -79,13 +85,13 @@ herr_t H5D_layout_version_test(hid_t did, unsigned *version) { H5D_t *dset; /* Pointer to dataset to query */ - herr_t ret_value = SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI(H5D_layout_version_test, FAIL) /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") if(version) *version = dset->shared->layout.version; @@ -118,13 +124,13 @@ herr_t H5D_layout_contig_size_test(hid_t did, hsize_t *size) { H5D_t *dset; /* Pointer to dataset to query */ - herr_t ret_value = SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI(H5D_layout_contig_size_test, FAIL) /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") if(size) { HDassert(dset->shared->layout.type == H5D_CONTIGUOUS); diff --git a/src/H5E.c b/src/H5E.c index 5a80787..4591223 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -361,6 +361,36 @@ H5E_get_stack(void) /*------------------------------------------------------------------------- + * Function: H5E_free_class + * + * Purpose: Private function to free an error class. + * + * Return: Non-negative value on success/Negative on failure + * + * Programmer: Quincey Koziol + * Friday, January 22, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5E_free_class(H5E_cls_t *cls) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_free_class) + + /* Check arguments */ + HDassert(cls); + + /* Free error class structure */ + cls->cls_name = (char *)H5MM_xfree((void*)cls->cls_name); + cls->lib_name = (char *)H5MM_xfree((void*)cls->lib_name); + cls->lib_vers = (char *)H5MM_xfree((void*)cls->lib_vers); + cls = H5FL_FREE(H5E_cls_t, cls); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5E_free_class() */ + + +/*------------------------------------------------------------------------- * Function: H5Eregister_class * * Purpose: Registers an error class. @@ -413,7 +443,7 @@ done: static H5E_cls_t * H5E_register_class(const char *cls_name, const char *lib_name, const char *version) { - H5E_cls_t *cls; /* Pointer to error class */ + H5E_cls_t *cls = NULL; /* Pointer to error class */ H5E_cls_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5E_register_class) @@ -424,7 +454,7 @@ H5E_register_class(const char *cls_name, const char *lib_name, const char *versi HDassert(version); /* Allocate space for new error class */ - if(NULL == (cls = H5FL_MALLOC(H5E_cls_t))) + if(NULL == (cls = H5FL_CALLOC(H5E_cls_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Duplicate string information */ @@ -439,6 +469,10 @@ H5E_register_class(const char *cls_name, const char *lib_name, const char *versi ret_value = cls; done: + if(!ret_value) + if(cls && H5E_free_class(cls) < 0) + HDONE_ERROR(H5E_ERROR, H5E_CANTRELEASE, NULL, "unable to free error class") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_register_class() */ @@ -494,7 +528,9 @@ done: static herr_t H5E_unregister_class(H5E_cls_t *cls) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_unregister_class) + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5E_unregister_class) /* Check arguments */ HDassert(cls); @@ -504,15 +540,11 @@ H5E_unregister_class(H5E_cls_t *cls) (void)H5I_search(H5I_ERROR_MSG, H5E_close_msg_cb, cls, FALSE); /* Free error class structure */ - if(cls->cls_name) - H5MM_xfree((void*)cls->cls_name); - if(cls->lib_name) - H5MM_xfree((void*)cls->lib_name); - if(cls->lib_vers) - H5MM_xfree((void*)cls->lib_vers); - (void)H5FL_FREE(H5E_cls_t, cls); + if(H5E_free_class(cls) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "unable to free error class") - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_unregister_class() */ @@ -680,11 +712,10 @@ H5E_close_msg(H5E_msg_t *err) /* Check arguments */ HDassert(err); - if(err->msg) - H5MM_xfree((void*)err->msg); + /* Release message */ + err->msg = (char *)H5MM_xfree((void *)err->msg); /* Don't free err->cls here */ - - (void)H5FL_FREE(H5E_msg_t, err); + err = H5FL_FREE(H5E_msg_t, err); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5E_close_msg() */ @@ -749,7 +780,7 @@ done: static H5E_msg_t * H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) { - H5E_msg_t *msg; /* Pointer to new error message */ + H5E_msg_t *msg = NULL; /* Pointer to new error message */ H5E_msg_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5E_create_msg) @@ -773,6 +804,10 @@ H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) ret_value = msg; done: + if(!ret_value) + if(msg && H5E_close_msg(msg) < 0) + HDONE_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, NULL, "unable to close error message") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_create_msg() */ diff --git a/src/H5EA.c b/src/H5EA.c index 1850b0e..2af407d 100644 --- a/src/H5EA.c +++ b/src/H5EA.c @@ -825,7 +825,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); hdr->f = ea->f; /* Set up flush dependency between child_entry and metadata array 'thing' */ - if(H5EA__create_flush_depend(hdr, parent_entry, (H5AC_info_t *)hdr) < 0) + if(H5EA__create_flush_depend(parent_entry, (H5AC_info_t *)hdr) < 0) H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency on file metadata") CATCH @@ -868,7 +868,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); hdr->f = ea->f; /* Remove flush dependency between child_entry and metadata array 'thing' */ - if(H5EA__destroy_flush_depend(hdr, parent_entry, (H5AC_info_t *)hdr) < 0) + if(H5EA__destroy_flush_depend(parent_entry, (H5AC_info_t *)hdr) < 0) H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency on file metadata") CATCH @@ -895,7 +895,6 @@ herr_t, SUCCEED, FAIL, H5EA_support(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, H5AC_info_t *child_entry)) /* Local variables */ - H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */ uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */ hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */ @@ -910,10 +909,6 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); * Check arguments. */ HDassert(ea); - HDassert(hdr); - - /* Set the shared array header's file context for this operation */ - hdr->f = ea->f; /* Look up the array metadata containing the element we want to set */ if(H5EA__lookup_elmt(ea, dxpl_id, idx, H5AC_WRITE, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0) @@ -925,7 +920,7 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); HDassert(thing_unprot_func); /* Set up flush dependency between child_entry and metadata array 'thing' */ - if(H5EA__create_flush_depend(hdr, (H5AC_info_t *)thing, child_entry) < 0) + if(H5EA__create_flush_depend((H5AC_info_t *)thing, child_entry) < 0) H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency on array metadata") CATCH @@ -955,7 +950,6 @@ herr_t, SUCCEED, FAIL, H5EA_unsupport(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, H5AC_info_t *child_entry)) /* Local variables */ - H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */ uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */ hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */ @@ -970,10 +964,6 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); * Check arguments. */ HDassert(ea); - HDassert(hdr); - - /* Set the shared array header's file context for this operation */ - hdr->f = ea->f; /* Look up the array metadata containing the element we want to set */ if(H5EA__lookup_elmt(ea, dxpl_id, idx, H5AC_READ, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0) @@ -985,7 +975,7 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); HDassert(thing_unprot_func); /* Remove flush dependency between child_entry and metadata array 'thing' */ - if(H5EA__destroy_flush_depend(hdr, (H5AC_info_t *)thing, child_entry) < 0) + if(H5EA__destroy_flush_depend((H5AC_info_t *)thing, child_entry) < 0) H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency on array metadata") CATCH diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 2e1c632..69a311f 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -865,13 +865,13 @@ H5EA__cache_iblock_notify(H5AC_notify_action_t action, H5EA_iblock_t *iblock)) switch(action) { case H5AC_NOTIFY_ACTION_AFTER_INSERT: /* Create flush dependency on extensible array header */ - if(H5EA__create_flush_depend(iblock->hdr, (H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0) + if(H5EA__create_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0) H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between index block and header, address = %llu", (unsigned long long)iblock->addr) break; case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on extensible array header */ - if(H5EA__destroy_flush_depend(iblock->hdr, (H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0) + if(H5EA__destroy_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0) H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between index block and header, address = %llu", (unsigned long long)iblock->addr) break; @@ -1299,13 +1299,13 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, H5EA_sblock_t *sblock)) switch(action) { case H5AC_NOTIFY_ACTION_AFTER_INSERT: /* Create flush dependency on index block */ - if(H5EA__create_flush_depend(sblock->hdr, (H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0) + if(H5EA__create_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0) H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between super block and index block, address = %llu", (unsigned long long)sblock->addr) break; case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on index block */ - if(H5EA__destroy_flush_depend(sblock->hdr, (H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0) + if(H5EA__destroy_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0) H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and index block, address = %llu", (unsigned long long)sblock->addr) break; @@ -1667,13 +1667,13 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, H5EA_dblock_t *dblock)) switch(action) { case H5AC_NOTIFY_ACTION_AFTER_INSERT: /* Create flush dependency on parent */ - if(H5EA__create_flush_depend(dblock->hdr, (H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) + if(H5EA__create_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block and parent, address = %llu", (unsigned long long)dblock->addr) break; case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on parent */ - if(H5EA__destroy_flush_depend(dblock->hdr, (H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) + if(H5EA__destroy_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block and parent, address = %llu", (unsigned long long)dblock->addr) break; @@ -2024,13 +2024,13 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, H5EA_dblk_page_t *dblk switch(action) { case H5AC_NOTIFY_ACTION_AFTER_INSERT: /* Create flush dependency on parent */ - if(H5EA__create_flush_depend(dblk_page->hdr, (H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0) + if(H5EA__create_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0) H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr) break; case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on parent */ - if(H5EA__destroy_flush_depend(dblk_page->hdr, (H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0) + if(H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0) H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr) break; diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index 4280767..6967413 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -479,7 +479,7 @@ H5EA__hdr_incr(H5EA_hdr_t *hdr)) /* Mark header as un-evictable when something is depending on it */ if(hdr->rc == 0) - if(H5AC_pin_protected_entry(hdr->f, hdr) < 0) + if(H5AC_pin_protected_entry(hdr) < 0) H5E_THROW(H5E_CANTPIN, "unable to pin extensible array header") /* Increment reference count on shared header */ @@ -517,7 +517,7 @@ H5EA__hdr_decr(H5EA_hdr_t *hdr)) /* Mark header as evictable again when nothing depend on it */ if(hdr->rc == 0) { HDassert(hdr->file_rc == 0); - if(H5AC_unpin_entry(hdr->f, hdr) < 0) + if(H5AC_unpin_entry(hdr) < 0) H5E_THROW(H5E_CANTUNPIN, "unable to unpin extensible array header") } /* end if */ @@ -604,7 +604,7 @@ H5EA__hdr_modified(H5EA_hdr_t *hdr)) HDassert(hdr->f); /* Mark header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(hdr->f, hdr) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(hdr) < 0) H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as dirty") CATCH @@ -629,6 +629,9 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_delete(H5EA_hdr_t *hdr, hid_t dxpl_id)) + /* Local variables */ + unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */ + /* Sanity check */ HDassert(hdr); HDassert(!hdr->file_rc); @@ -657,15 +660,13 @@ HDfprintf(stderr, "%s: hdr->idx_blk_addr = %a\n", FUNC, hdr->idx_blk_addr); H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array index block") } /* end if */ - /* Finished deleting header */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") - hdr = NULL; + /* Set flags to finish deleting header on unprotect */ + cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; CATCH - /* Unprotect the header, if an error occurred */ - if(hdr && H5AC_unprotect(hdr->f, dxpl_id, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) + /* Unprotect the header, deleting it if an error hasn't occurred */ + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_EARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PKG) /* end H5EA__hdr_delete() */ diff --git a/src/H5EAint.c b/src/H5EAint.c index 28681e8..12a9cda 100644 --- a/src/H5EAint.c +++ b/src/H5EAint.c @@ -95,16 +95,14 @@ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, -H5EA__create_flush_depend(H5EA_hdr_t *hdr, H5AC_info_t *parent_entry, - H5AC_info_t *child_entry)) +H5EA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)) /* Sanity check */ - HDassert(hdr); HDassert(parent_entry); HDassert(child_entry); /* Create a flush dependency between parent and child entry */ - if(H5AC_create_flush_dependency(hdr->f, parent_entry, child_entry) < 0) + if(H5AC_create_flush_dependency(parent_entry, child_entry) < 0) H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency") CATCH @@ -127,16 +125,14 @@ END_FUNC(PKG) /* end H5EA__create_flush_depend() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, -H5EA__destroy_flush_depend(H5EA_hdr_t *hdr, H5AC_info_t *parent_entry, - H5AC_info_t *child_entry)) +H5EA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)) /* Sanity check */ - HDassert(hdr); HDassert(parent_entry); HDassert(child_entry); /* Destroy a flush dependency between parent and child entry */ - if(H5AC_destroy_flush_dependency(hdr->f, parent_entry, child_entry) < 0) + if(H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0) H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency") CATCH diff --git a/src/H5EApkg.h b/src/H5EApkg.h index f729b69..39e6546 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -363,9 +363,9 @@ extern const H5EA_class_t *const H5EA_client_class_g[]; /******************************/ /* Generic routines */ -H5_DLL herr_t H5EA__create_flush_depend(H5EA_hdr_t *hdr, H5AC_info_t *parent_entry, +H5_DLL herr_t H5EA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry); -H5_DLL herr_t H5EA__destroy_flush_depend(H5EA_hdr_t *hdr, H5AC_info_t *parent_entry, +H5_DLL herr_t H5EA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry); /* Header routines */ diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index 0997f3c..30f3ae9 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -122,10 +122,10 @@ char * H5Eget_major(H5E_major_t maj) { H5E_msg_t *msg; /* Pointer to error message */ - ssize_t size = 0; /* Return value */ + ssize_t size; H5E_type_t type; - char *msg_str; - char *ret_value = NULL; + char *msg_str = NULL; + char *ret_value; /* Return value */ FUNC_ENTER_API_NOCLEAR(H5Eget_major, NULL) @@ -133,22 +133,26 @@ H5Eget_major(H5E_major_t maj) if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(maj, H5I_ERROR_MSG))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID") - /* Get the message's text */ + /* Get the size & type of the message's text */ if((size = H5E_get_msg(msg, &type, NULL, (size_t)0)) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") - if(type != H5E_MAJOR) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a major one") - /* Don't know who is going to free it */ - msg_str = (char *)H5MM_malloc((size_t)(++size) * sizeof(char)); + /* Application will free this */ + size++; + msg_str = (char *)H5MM_malloc((size_t)size); + /* Get the text for the message */ if(H5E_get_msg(msg, NULL, msg_str, (size_t)size) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") ret_value = msg_str; done: + if(!ret_value) + msg_str = (char *)H5MM_xfree(msg_str); + FUNC_LEAVE_API(ret_value) } /* end H5Eget_major() */ @@ -170,10 +174,10 @@ char * H5Eget_minor(H5E_minor_t min) { H5E_msg_t *msg; /* Pointer to error message */ - ssize_t size = 0; /* Return value */ + ssize_t size; H5E_type_t type; - char *msg_str; - char *ret_value = NULL; + char *msg_str = NULL; + char *ret_value; /* Return value */ FUNC_ENTER_API_NOCLEAR(H5Eget_minor, NULL) @@ -181,22 +185,26 @@ H5Eget_minor(H5E_minor_t min) if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(min, H5I_ERROR_MSG))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID") - /* Get the message's text */ + /* Get the size & type of the message's text */ if((size = H5E_get_msg(msg, &type, NULL, (size_t)0)) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") - if(type != H5E_MINOR) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a minor one") - /* Don't know who is going to free it */ - msg_str = (char *)H5MM_malloc((size_t)(++size) * sizeof(char)); + /* Application will free this */ + size++; + msg_str = (char *)H5MM_malloc((size_t)size); + /* Get the text for the message */ if(H5E_get_msg(msg, NULL, msg_str, (size_t)size) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") ret_value = msg_str; done: + if(!ret_value) + msg_str = (char *)H5MM_xfree(msg_str); + FUNC_LEAVE_API(ret_value) } /* end H5Eget_minor() */ diff --git a/src/H5Eint.c b/src/H5Eint.c index 831d51b..d64fcbd 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -225,8 +225,9 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) const char *maj_str = "No major description"; /* Major error description */ const char *min_str = "No minor description"; /* Minor error description */ unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */ + herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_walk1_cb) + FUNC_ENTER_NOAPI_NOINIT(H5E_walk1_cb) /* Check arguments */ HDassert(err_desc); @@ -240,7 +241,11 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) /* Get descriptions for the major and minor error numbers */ maj_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->maj_num, H5I_ERROR_MSG); min_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->min_num, H5I_ERROR_MSG); - HDassert(maj_ptr && min_ptr); + + /* Check for bad pointer(s), but can't issue error, just leave */ + if(!maj_ptr || !min_ptr) + HGOTO_DONE(FAIL) + if(maj_ptr->msg) maj_str = maj_ptr->msg; if(min_ptr->msg) @@ -294,7 +299,8 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_walk1_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -341,8 +347,9 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) const char *maj_str = "No major description"; /* Major error description */ const char *min_str = "No minor description"; /* Minor error description */ unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */ + herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_walk2_cb) + FUNC_ENTER_NOAPI_NOINIT(H5E_walk2_cb) /* Check arguments */ HDassert(err_desc); @@ -356,7 +363,11 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) /* Get descriptions for the major and minor error numbers */ maj_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->maj_num, H5I_ERROR_MSG); min_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->min_num, H5I_ERROR_MSG); - HDassert(maj_ptr && min_ptr); + + /* Check for bad pointer(s), but can't issue error, just leave */ + if(!maj_ptr || !min_ptr) + HGOTO_DONE(FAIL) + if(maj_ptr->msg) maj_str = maj_ptr->msg; if(min_ptr->msg) @@ -411,7 +422,8 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_walk2_cb() */ diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 4c226d0..1e5ada1 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -156,7 +156,7 @@ extern int H5E_mpi_error_str_len; /* Macro for "catching" flow of control when an error occurs. Note that the * H5_LEAVE macro won't jump back here once it's past this point. */ -#define CATCH past_catch = TRUE; catch_except:; +#define CATCH catch_except:; past_catch = TRUE; /* Library-private functions defined in H5E package */ diff --git a/src/H5F.c b/src/H5F.c index a4eedd5..efa4091 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -1003,7 +1003,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) } /* end if */ /* Unpin the superblock, since we're about to destroy the cache */ - if(H5AC_unpin_entry(f, f->shared->sblock) < 0) + if(H5AC_unpin_entry(f->shared->sblock) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin superblock") f->shared->sblock = NULL; @@ -2537,21 +2537,13 @@ done: * Programmer: John Mainzer * 3/24/05 * - * Modifications: - * - * Reworked for the addition of the config_ptr parameter. - * JRM -- 4/7/05 - * *------------------------------------------------------------------------- */ - herr_t -H5Fget_mdc_config(hid_t file_id, - H5AC_cache_config_t *config_ptr) +H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) { H5F_t *file; /* File object for file ID */ - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fget_mdc_config, FAIL) H5TRACE2("e", "i*x", file_id, config_ptr); @@ -2563,18 +2555,11 @@ H5Fget_mdc_config(hid_t file_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr") /* Go get the resize configuration */ - result = H5AC_get_cache_auto_resize_config(file->shared->cache, config_ptr); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5AC_get_cache_auto_resize_config() failed."); - } + if(H5AC_get_cache_auto_resize_config(file->shared->cache, config_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.") done: - FUNC_LEAVE_API(ret_value) - } /* H5Fget_mdc_config() */ @@ -2591,20 +2576,13 @@ done: * Programmer: John Mainzer * 3/24/05 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - herr_t -H5Fset_mdc_config(hid_t file_id, - H5AC_cache_config_t *config_ptr) +H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) { H5F_t *file; /* File object for file ID */ - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fset_mdc_config, FAIL) H5TRACE2("e", "i*x", file_id, config_ptr); @@ -2614,18 +2592,11 @@ H5Fset_mdc_config(hid_t file_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* set the resize configuration */ - result = H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "H5AC_set_cache_auto_resize_config() failed."); - } + if(H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed.") done: - FUNC_LEAVE_API(ret_value) - } /* H5Fset_mdc_config() */ @@ -2643,20 +2614,13 @@ done: * Programmer: John Mainzer * 3/24/05 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - herr_t -H5Fget_mdc_hit_rate(hid_t file_id, - double *hit_rate_ptr) +H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) { H5F_t *file; /* File object for file ID */ - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fget_mdc_hit_rate, FAIL) H5TRACE2("e", "i*d", file_id, hit_rate_ptr); @@ -2669,18 +2633,11 @@ H5Fget_mdc_hit_rate(hid_t file_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer") /* Go get the current hit rate */ - result = H5AC_get_cache_hit_rate(file->shared->cache, hit_rate_ptr); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5AC_get_cache_hit_rate() failed."); - } + if(H5AC_get_cache_hit_rate(file->shared->cache, hit_rate_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.") done: - FUNC_LEAVE_API(ret_value) - } /* H5Fget_mdc_hit_rate() */ @@ -2699,24 +2656,15 @@ done: * Programmer: John Mainzer * 3/24/05 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - herr_t -H5Fget_mdc_size(hid_t file_id, - size_t *max_size_ptr, - size_t *min_clean_size_ptr, - size_t *cur_size_ptr, - int *cur_num_entries_ptr) +H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, + size_t *cur_size_ptr, int *cur_num_entries_ptr) { H5F_t *file; /* File object for file ID */ int32_t cur_num_entries; - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fget_mdc_size, FAIL) H5TRACE5("e", "i*z*z*z*Is", file_id, max_size_ptr, min_clean_size_ptr, @@ -2727,26 +2675,15 @@ H5Fget_mdc_size(hid_t file_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Go get the size data */ - result = H5AC_get_cache_size(file->shared->cache, - max_size_ptr, - min_clean_size_ptr, - cur_size_ptr, - &cur_num_entries); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5AC_get_cache_size() failed."); - - } else if ( cur_num_entries_ptr != NULL ) { + if(H5AC_get_cache_size(file->shared->cache, max_size_ptr, + min_clean_size_ptr, cur_size_ptr, &cur_num_entries) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.") + if(cur_num_entries_ptr != NULL) *cur_num_entries_ptr = (int)cur_num_entries; - } done: - FUNC_LEAVE_API(ret_value) - } /* H5Fget_mdc_size() */ @@ -2768,10 +2705,6 @@ done: * Programmer: John Mainzer * 3/24/05 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 94fb7b2..372caf8 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -264,7 +264,7 @@ H5FA__hdr_incr(H5FA_hdr_t *hdr)) /* Mark header as un-evictable when something is depending on it */ if(hdr->rc == 0) - if(H5AC_pin_protected_entry(hdr->f, hdr) < 0) + if(H5AC_pin_protected_entry(hdr) < 0) H5E_THROW(H5E_CANTPIN, "unable to pin fixed array header") /* Increment reference count on shared header */ @@ -301,7 +301,7 @@ H5FA__hdr_decr(H5FA_hdr_t *hdr)) /* Mark header as evictable again when nothing depend on it */ if(hdr->rc == 0) { HDassert(hdr->file_rc == 0); - if(H5AC_unpin_entry(hdr->f, hdr) < 0) + if(H5AC_unpin_entry(hdr) < 0) H5E_THROW(H5E_CANTUNPIN, "unable to unpin fixed array header") } /* end if */ @@ -382,10 +382,9 @@ H5FA__hdr_modified(H5FA_hdr_t *hdr)) /* Sanity check */ HDassert(hdr); - HDassert(hdr->f); /* Mark header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(hdr->f, hdr) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(hdr) < 0) H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark fixed array header as dirty") CATCH @@ -409,6 +408,9 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_delete(H5FA_hdr_t *hdr, hid_t dxpl_id)) + /* Local variables */ + unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */ + /* Sanity check */ HDassert(hdr); HDassert(!hdr->file_rc); @@ -438,15 +440,13 @@ HDfprintf(stderr, "%s: hdr->dblk_addr = %a\n", FUNC, hdr->dblk_addr); H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array data block") } /* end if */ - /* Finished deleting header */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FARRAY_HDR, hdr->addr, hdr, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") - hdr = NULL; + /* Set flags to finish deleting header on unprotect */ + cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; CATCH - /* Unprotect the header, if an error occurred */ - if(hdr && H5AC_unprotect(hdr->f, dxpl_id, H5AC_FARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) + /* Unprotect the header, deleting it if an error hasn't occurred */ + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") END_FUNC(PKG) /* end H5FA__hdr_delete() */ diff --git a/src/H5FD.c b/src/H5FD.c index 4c0da40..99f2e3c 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -730,8 +730,8 @@ done: herr_t H5FD_fapl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info) { - void *copied_driver_info; /* Temporary VFL driver info */ - herr_t ret_value=SUCCEED; /* Return value */ + void *copied_driver_info = NULL; /* Temporary VFL driver info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_fapl_open, FAIL) @@ -739,15 +739,20 @@ H5FD_fapl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info) if(H5I_inc_ref(driver_id, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver") if(H5FD_fapl_copy(driver_id, driver_info, &copied_driver_info) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VFL driver info") + HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "can't copy VFL driver info") /* Set the driver properties for the list */ if(H5P_set(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver ID") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set driver ID") if(H5P_set(plist, H5F_ACS_FILE_DRV_INFO_NAME, &copied_driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set driver info") + copied_driver_info = NULL; done: + if(ret_value < 0) + if(copied_driver_info && H5FD_fapl_close(driver_id, copied_driver_info) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close copy of driver info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_fapl_open() */ @@ -847,24 +852,28 @@ done: herr_t H5FD_dxpl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info) { - void *copied_driver_info; /* Temporary VFL driver info */ - herr_t ret_value=SUCCEED; /* Return value */ + void *copied_driver_info = NULL; /* Temporary VFL driver info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_dxpl_open, FAIL) /* Increment the reference count on the driver and copy the driver info */ if(H5I_inc_ref(driver_id, FALSE) < 0) - HGOTO_ERROR (H5E_DATASET, H5E_CANTINC, FAIL, "can't increment VFL driver ID") + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "can't increment VFL driver ID") if(H5FD_dxpl_copy(driver_id, driver_info, &copied_driver_info) < 0) - HGOTO_ERROR (H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy VFL driver") + HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "can't copy VFL driver") /* Set the driver information for the new property list */ if(H5P_set(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "can't set VFL driver ID") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VFL driver ID") if(H5P_set(plist, H5D_XFER_VFL_INFO_NAME, &copied_driver_info) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "can't set VFL driver info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VFL driver info") done: + if(ret_value < 0) + if(copied_driver_info && H5FD_dxpl_close(driver_id, copied_driver_info) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close copy of driver info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_dxpl_open() */ @@ -1060,7 +1069,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Get file access property list */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") /* Get the VFD to open the file with */ if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 15f4094..7324afb 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -762,7 +762,7 @@ H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) /* Get property */ if(H5P_get(plist, H5F_ACS_WANT_POSIX_FD_NAME, &want_posix_fd) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of retrieving file descriptor") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get property of retrieving file descriptor") /* If property is set, pass back the file descriptor instead of the memory address */ if(want_posix_fd) diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 87e5e84..3c25426 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -821,7 +821,6 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, H5FD_t **x; HDassert(n > 0); - /* coverity["freed_arg"] */ if(NULL == (x = (H5FD_t **)H5MM_realloc(file->memb, n * sizeof(H5FD_t *)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to reallocate members") file->amembs = n; diff --git a/src/H5FDlog.c b/src/H5FDlog.c index fe15005..373f064 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -412,39 +412,47 @@ done: * Purpose: Copies the log-specific file access properties. * * Return: Success: Ptr to a new property list - * * Failure: NULL * * Programmer: Quincey Koziol * Thursday, April 20, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * H5FD_log_fapl_copy(const void *_old_fa) { const H5FD_log_fapl_t *old_fa = (const H5FD_log_fapl_t*)_old_fa; - H5FD_log_fapl_t *new_fa = (H5FD_log_fapl_t *)H5MM_malloc(sizeof(H5FD_log_fapl_t)); + H5FD_log_fapl_t *new_fa = NULL; /* New FAPL info */ void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_log_fapl_copy, NULL) - HDassert(new_fa); + HDassert(old_fa); + + /* Allocate the new FAPL info */ + if(NULL == (new_fa = (H5FD_log_fapl_t *)H5MM_calloc(sizeof(H5FD_log_fapl_t)))) + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL") /* Copy the general information */ HDmemcpy(new_fa, old_fa, sizeof(H5FD_log_fapl_t)); /* Deep copy the log file name */ - if(old_fa->logfile!=NULL) - if (NULL==(new_fa->logfile=H5MM_xstrdup(old_fa->logfile))) + if(old_fa->logfile != NULL) + if(NULL == (new_fa->logfile = H5MM_xstrdup(old_fa->logfile))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate log file name") /* Set return value */ - ret_value=new_fa; + ret_value = new_fa; done: + if(NULL == ret_value) + if(new_fa) { + if(new_fa->logfile) + H5MM_free(new_fa->logfile); + H5MM_free(new_fa); + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_log_fapl_copy() */ @@ -455,31 +463,26 @@ done: * Purpose: Frees the log-specific file access properties. * * Return: Success: 0 - * * Failure: -1 * * Programmer: Quincey Koziol * Thursday, April 20, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t H5FD_log_fapl_free(void *_fa) { H5FD_log_fapl_t *fa = (H5FD_log_fapl_t*)_fa; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_log_fapl_free, FAIL) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_log_fapl_free) /* Free the fapl information */ if(fa->logfile) H5MM_xfree(fa->logfile); H5MM_xfree(fa); -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_log_fapl_free() */ @@ -491,52 +494,52 @@ done: * Return: Success: A pointer to a new file data structure. The * public fields will be initialized by the * caller, which is always H5FD_open(). - * * Failure: NULL * * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5FD_t * H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - int o_flags; - int fd=(-1); - H5FD_log_t *file=NULL; + int o_flags; + int fd = (-1); + H5FD_log_t *file = NULL; H5FD_log_fapl_t *fa; /* File access property list information */ #ifdef _WIN32 HFILE filehandle; struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif - h5_stat_t sb; + h5_stat_t sb; H5P_genplist_t *plist; /* Property list */ H5FD_t *ret_value; FUNC_ENTER_NOAPI(H5FD_log_open, NULL) /* Check arguments */ - if (!name || !*name) + if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") - if (0==maxaddr || HADDR_UNDEF==maxaddr) + if(0 == maxaddr || HADDR_UNDEF == maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") - if (ADDR_OVERFLOW(maxaddr)) + if(ADDR_OVERFLOW(maxaddr)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") /* Build the open flags */ o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY; - if (H5F_ACC_TRUNC & flags) o_flags |= O_TRUNC; - if (H5F_ACC_CREAT & flags) o_flags |= O_CREAT; - if (H5F_ACC_EXCL & flags) o_flags |= O_EXCL; + if(H5F_ACC_TRUNC & flags) + o_flags |= O_TRUNC; + if(H5F_ACC_CREAT & flags) + o_flags |= O_CREAT; + if(H5F_ACC_EXCL & flags) + o_flags |= O_EXCL; /* Open the file */ - if ((fd=HDopen(name, o_flags, 0666))<0) + if((fd = HDopen(name, o_flags, 0666)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") - if (HDfstat(fd, &sb)<0) + if(HDfstat(fd, &sb) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file") /* Create the new file struct */ @@ -544,7 +547,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") /* Get the driver specific information */ - if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) + if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") fa = (H5FD_log_fapl_t *)H5P_get_driver_info(plist); HDassert(fa); @@ -564,7 +567,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, #endif /* Get the flags for logging */ - file->fa.flags=fa->flags; + file->fa.flags = fa->flags; /* Check if we are doing any logging at all */ if(file->fa.flags != 0) { @@ -598,6 +601,7 @@ done: if(NULL == ret_value) { if(fd >= 0) HDclose(fd); + file = (H5FD_log_t *)H5MM_xfree(file); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -610,14 +614,11 @@ done: * Purpose: Closes a Unix file. * * Return: Success: 0 - * * Failure: -1, file not closed. * * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -628,7 +629,7 @@ H5FD_log_close(H5FD_t *_file) struct timeval timeval_start,timeval_stop; struct timeval timeval_diff; #endif /* H5_HAVE_GETTIMEOFDAY */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_log_close, FAIL) @@ -636,7 +637,7 @@ H5FD_log_close(H5FD_t *_file) if(file->fa.flags&H5FD_LOG_TIME_CLOSE) HDgettimeofday(&timeval_start,NULL); #endif /* H5_HAVE_GETTIMEOFDAY */ - if (HDclose(file->fd)<0) + if(HDclose(file->fd) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") #ifdef H5_HAVE_GETTIMEOFDAY if(file->fa.flags&H5FD_LOG_TIME_CLOSE) @@ -644,73 +645,73 @@ H5FD_log_close(H5FD_t *_file) #endif /* H5_HAVE_GETTIMEOFDAY */ /* Dump I/O information */ - if(file->fa.flags!=0) { + if(file->fa.flags != 0) { haddr_t addr; haddr_t last_addr; unsigned char last_val; #ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags&H5FD_LOG_TIME_CLOSE) { + if(file->fa.flags & H5FD_LOG_TIME_CLOSE) { /* Calculate the elapsed gettimeofday time */ - timeval_diff.tv_usec=timeval_stop.tv_usec-timeval_start.tv_usec; - timeval_diff.tv_sec=timeval_stop.tv_sec-timeval_start.tv_sec; - if(timeval_diff.tv_usec<0) { - timeval_diff.tv_usec+=1000000; + timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; + timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; + if(timeval_diff.tv_usec < 0) { + timeval_diff.tv_usec += 1000000; timeval_diff.tv_sec--; } /* end if */ - HDfprintf(file->logfp,"Close took: (%f s)\n",(double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0)); + HDfprintf(file->logfp, "Close took: (%f s)\n", (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0)); } /* end if */ #endif /* H5_HAVE_GETTIMEOFDAY */ /* Dump the write I/O information */ - if(file->fa.flags&H5FD_LOG_FILE_WRITE) { - HDfprintf(file->logfp,"Dumping write I/O information:\n"); - last_val=file->nwrite[0]; - last_addr=0; - addr=1; - while(addreoa) { - if(file->nwrite[addr]!=last_val) { - HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) written to %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val); - last_val=file->nwrite[addr]; - last_addr=addr; + if(file->fa.flags & H5FD_LOG_FILE_WRITE) { + HDfprintf(file->logfp, "Dumping write I/O information:\n"); + last_val = file->nwrite[0]; + last_addr = 0; + addr = 1; + while(addr < file->eoa) { + if(file->nwrite[addr] != last_val) { + HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) written to %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); + last_val = file->nwrite[addr]; + last_addr = addr; } /* end if */ addr++; } /* end while */ - HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) written to %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val); + HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) written to %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); } /* end if */ /* Dump the read I/O information */ - if(file->fa.flags&H5FD_LOG_FILE_READ) { - HDfprintf(file->logfp,"Dumping read I/O information:\n"); - last_val=file->nread[0]; - last_addr=0; - addr=1; - while(addreoa) { - if(file->nread[addr]!=last_val) { - HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) read from %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val); - last_val=file->nread[addr]; - last_addr=addr; + if(file->fa.flags & H5FD_LOG_FILE_READ) { + HDfprintf(file->logfp, "Dumping read I/O information:\n"); + last_val = file->nread[0]; + last_addr = 0; + addr = 1; + while(addr < file->eoa) { + if(file->nread[addr] != last_val) { + HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) read from %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); + last_val = file->nread[addr]; + last_addr = addr; } /* end if */ addr++; } /* end while */ - HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) read from %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val); + HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) read from %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); } /* end if */ /* Dump the I/O flavor information */ - if(file->fa.flags&H5FD_LOG_FLAVOR) { - HDfprintf(file->logfp,"Dumping I/O flavor information:\n"); - last_val=file->flavor[0]; - last_addr=0; - addr=1; - while(addreoa) { - if(file->flavor[addr]!=last_val) { - HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) flavor is %s\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),flavors[last_val]); - last_val=file->flavor[addr]; - last_addr=addr; + if(file->fa.flags & H5FD_LOG_FLAVOR) { + HDfprintf(file->logfp, "Dumping I/O flavor information:\n"); + last_val = file->flavor[0]; + last_addr = 0; + addr = 1; + while(addr < file->eoa) { + if(file->flavor[addr] != last_val) { + HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) flavor is %s\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]); + last_val = file->flavor[addr]; + last_addr = addr; } /* end if */ addr++; } /* end while */ - HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) flavor is %s\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),flavors[last_val]); + HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) flavor is %s\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]); } /* end if */ /* Free the logging information */ @@ -728,7 +729,7 @@ H5FD_log_close(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_log_close() */ /*------------------------------------------------------------------------- diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 2070b1a..9928cf9 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -378,8 +378,10 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "fopen failed", NULL) /* Build the return value */ - if(NULL == (file = (H5FD_stdio_t *)calloc((size_t)1, sizeof(H5FD_stdio_t)))) + if(NULL == (file = (H5FD_stdio_t *)calloc((size_t)1, sizeof(H5FD_stdio_t)))) { + fclose(f); H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL) + } /* end if */ file->fp = f; file->op = H5FD_STDIO_OP_SEEK; file->pos = HADDR_UNDEF; diff --git a/src/H5FL.c b/src/H5FL.c index c72491d..8ac442a 100644 --- a/src/H5FL.c +++ b/src/H5FL.c @@ -380,7 +380,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) /* Make certain the list is initialized first */ if(!head->init) if(H5FL_reg_init(head)<0) - HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'regular' blocks") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'regular' blocks") /* Check for nodes available on the free list first */ if(head->list!=NULL) { @@ -399,7 +399,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) /* Otherwise allocate a node */ else { if (NULL==(ret_value = H5FL_malloc(head->size))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Increment the number of blocks allocated in list */ head->allocated++; @@ -456,7 +456,7 @@ H5FL_reg_calloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) /* Allocate the block */ if (NULL==(ret_value = H5FL_reg_malloc(head H5FL_TRACK_INFO_INT))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Clear to zeros */ /* (Accomodate tracking information, if present) */ @@ -864,7 +864,7 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) /* Make certain the list is initialized first */ if(!head->init) if(H5FL_blk_init(head)<0) - HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'block' list") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'block' list") /* check if there is a free list for blocks of this size */ /* and if there are any blocks available on the list */ @@ -953,7 +953,7 @@ H5FL_blk_calloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) /* Allocate the block */ if (NULL==(ret_value = H5FL_blk_malloc(head,size H5FL_TRACK_INFO_INT))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Clear the block to zeros */ HDmemset(ret_value,0,size); @@ -1335,7 +1335,7 @@ H5FL_arr_init(H5FL_arr_head_t *head) /* Allocate a new garbage collection node */ if(NULL == (new_node = (H5FL_gc_arr_node_t *)H5MM_malloc(sizeof(H5FL_gc_arr_node_t)))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Initialize the new garbage collection node */ new_node->list = head; @@ -1346,7 +1346,7 @@ H5FL_arr_init(H5FL_arr_head_t *head) /* Allocate room for the free lists */ if(NULL == (head->list_arr = (H5FL_arr_node_t *)H5MM_calloc((size_t)head->maxelem*sizeof(H5FL_arr_node_t)))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Initialize the size of each array */ for(u = 0; u < (size_t)head->maxelem; u++) @@ -1469,7 +1469,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem) /* Make certain the list is initialized first */ if(!head->init) if(H5FL_arr_init(head)<0) - HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'array' blocks") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'array' blocks") /* Sanity check that the number of elements is supported */ HDassert(elem<=(unsigned) head->maxelem); @@ -1496,7 +1496,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem) /* Otherwise allocate a node */ else { if(NULL == (new_obj = (H5FL_arr_list_t *)H5FL_malloc(sizeof(H5FL_arr_list_t)+mem_size))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Increment the number of blocks allocated in list */ head->allocated++; @@ -1540,11 +1540,11 @@ H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem) HDassert(elem); /* Allocate the array */ - if (NULL==(ret_value = H5FL_arr_malloc(head,elem))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + if(NULL == (ret_value = H5FL_arr_malloc(head, elem))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Clear to zeros */ - HDmemset(ret_value,0,head->list_arr[elem].size); + HDmemset(ret_value, 0, head->list_arr[elem].size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1938,21 +1938,21 @@ done: H5FL_fac_head_t * H5FL_fac_init(size_t size) { - H5FL_fac_gc_node_t *new_node; /* Pointer to the node for the new list to garbage collect */ - H5FL_fac_head_t *factory; /* Pointer to new block factory */ + H5FL_fac_gc_node_t *new_node = NULL; /* Pointer to the node for the new list to garbage collect */ + H5FL_fac_head_t *factory = NULL; /* Pointer to new block factory */ H5FL_fac_head_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FL_fac_init, NULL) /* Sanity check */ - HDassert(size>0); + HDassert(size > 0); /* Allocate room for the new factory */ if(NULL == (factory = (H5FL_fac_head_t *)H5FL_CALLOC(H5FL_fac_head_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for factory object") /* Set size of blocks for factory */ - factory->size=size; + factory->size = size; /* Allocate a new garbage collection node */ if(NULL == (new_node = (H5FL_fac_gc_node_t *)H5FL_MALLOC(H5FL_fac_gc_node_t))) @@ -1962,15 +1962,15 @@ H5FL_fac_init(size_t size) new_node->list = factory; /* Link in to the garbage collection list */ - new_node->next=H5FL_fac_gc_head.first; - H5FL_fac_gc_head.first=new_node; + new_node->next = H5FL_fac_gc_head.first; + H5FL_fac_gc_head.first = new_node; if(new_node->next) new_node->next->list->prev_gc=new_node; /* The new factory's prev_gc field will be set to NULL */ /* Make certain that the space allocated is large enough to store a free list pointer (eventually) */ - if(factory->sizesize=sizeof(H5FL_fac_node_t); + if(factory->size < sizeof(H5FL_fac_node_t)) + factory->size = sizeof(H5FL_fac_node_t); /* Make certain there's room for tracking information, if any */ #ifdef H5FL_TRACK @@ -1978,12 +1978,19 @@ H5FL_fac_init(size_t size) #endif /* H5FL_TRACK */ /* Indicate that the free list is initialized */ - factory->init=1; + factory->init = 1; /* Set return value */ - ret_value=factory; + ret_value = factory; done: + if(!ret_value) { + if(factory) + factory = H5FL_FREE(H5FL_fac_head_t, factory); + if(new_node) + new_node = H5FL_FREE(H5FL_fac_gc_node_t, new_node); + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_fac_init() */ @@ -2123,7 +2130,7 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) /* Otherwise allocate a node */ else { if (NULL==(ret_value = H5FL_malloc(head->size))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Increment the number of blocks allocated in list */ head->allocated++; @@ -2184,7 +2191,7 @@ H5FL_fac_calloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) /* Allocate the block */ if (NULL==(ret_value = H5FL_fac_malloc(head H5FL_TRACK_INFO_INT))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Clear to zeros */ /* (Accomodate tracking information, if present) */ diff --git a/src/H5FO.c b/src/H5FO.c index 6982e36..bbc3b7d 100644 --- a/src/H5FO.c +++ b/src/H5FO.c @@ -320,7 +320,7 @@ H5FO_marked(const H5F_t *f, haddr_t addr) /* Get the object node from the container */ if(NULL != (open_obj = (H5FO_open_obj_t *)H5SL_search(f->shared->open_objs, &addr))) - ret_value = (htri_t)open_obj->deleted; + ret_value = open_obj->deleted; FUNC_LEAVE_NOAPI(ret_value) } /* end H5FO_marked() */ diff --git a/src/H5FS.c b/src/H5FS.c index 5e3392e..8ee6db4 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -382,7 +382,7 @@ HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC); fspace->alloc_sect_size = (size_t)fspace->sect_size; /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ } /* end if */ @@ -439,7 +439,7 @@ HDfprintf(stderr, "%s: Section info went 'go away'\n", FUNC); fspace->alloc_sect_size = 0; /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end else */ } /* end if */ @@ -455,7 +455,7 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC); fspace->alloc_sect_size = 0; /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") /* Free previous serialized sections disk space */ @@ -508,7 +508,7 @@ H5FS_t * H5FS_new(size_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata) { - H5FS_t *fspace; /* Free space manager */ + H5FS_t *fspace = NULL; /* Free space manager */ size_t u; /* Local index variable */ H5FS_t *ret_value; /* Return value */ @@ -556,6 +556,16 @@ H5FS_new(size_t nclasses, const H5FS_section_class_t *classes[], ret_value = fspace; done: + if(!ret_value) + if(fspace) { + /* Should probably call the class 'term' callback for all classes + * that have had their 'init' callback called... -QAK + */ + if(fspace->sect_cls) + fspace->sect_cls = (H5FS_section_class_t *)H5FL_SEQ_FREE(H5FS_section_class_t, fspace->sect_cls); + fspace = H5FL_FREE(H5FS_t, fspace); + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_new() */ @@ -623,7 +633,7 @@ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fsp /* Check if we should pin the header in the cache */ if(fspace->rc == 0 && H5F_addr_defined(fspace->addr)) - if(H5AC_pin_protected_entry(f, fspace) < 0) + if(H5AC_pin_protected_entry(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPIN, FAIL, "unable to pin free space header") /* Increment reference count on header */ @@ -669,7 +679,7 @@ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fsp /* Check if we should unpin the header in the cache */ if(fspace->rc == 0) { if(H5F_addr_defined(fspace->addr)) { - if(H5AC_unpin_entry(f, fspace) < 0) + if(H5AC_unpin_entry(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin free space header") } /* end if */ else { @@ -713,7 +723,7 @@ HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC); /* Check if the free space manager is persistant */ if(H5F_addr_defined(fspace->addr)) /* Mark header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") done: @@ -874,7 +884,7 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) if(hdr_status & H5AC_ES__IN_CACHE) { /* Unpin the free-space manager header */ - if(H5AC_unpin_entry(f, fspace) < 0) + if(H5AC_unpin_entry(fspace) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header") /* Load the free-space manager header */ diff --git a/src/H5FScache.c b/src/H5FScache.c index 482b9cb..1761adf 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -89,6 +89,7 @@ static herr_t H5FS_cache_sinfo_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, h static herr_t H5FS_cache_sinfo_clear(H5F_t *f, H5FS_sinfo_t *sinfo, hbool_t destroy); static herr_t H5FS_cache_sinfo_size(const H5F_t *f, const H5FS_sinfo_t *sinfo, size_t *size_ptr); + /*********************/ /* Package Variables */ /*********************/ @@ -135,12 +136,12 @@ H5FL_BLK_DEFINE_STATIC(sect_block); * * Purpose: Loads a free space manager header from the disk. * - * Return: Success: Pointer to a new free space header - * Failure: NULL + * Return: Success: Pointer to a new free space header + * Failure: NULL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * May 2 2006 * *------------------------------------------------------------------------- */ @@ -160,9 +161,6 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_fs_prot, H5FS_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_hdr_load) -#ifdef QAK -HDfprintf(stderr, "%s: Load free space header, addr = %a\n", FUNC, addr); -#endif /* QAK */ /* Check arguments */ HDassert(f); @@ -247,12 +245,12 @@ HDfprintf(stderr, "%s: Load free space header, addr = %a\n", FUNC, addr); H5F_DECODE_LENGTH(f, p, fspace->alloc_sect_size); /* Compute checksum on indirect block */ - computed_chksum = H5_checksum_metadata(hdr, (size_t)(p - hdr), 0); + computed_chksum = H5_checksum_metadata(hdr, (size_t)(p - (const uint8_t *)hdr), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); - HDassert((size_t)(p - hdr) == size); + HDassert((size_t)(p - (const uint8_t *)hdr) == size); /* Verify checksum */ if(stored_chksum != computed_chksum) @@ -279,9 +277,9 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * May 2 2006 * *------------------------------------------------------------------------- */ @@ -293,11 +291,6 @@ H5FS_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_hdr_flush) -#ifdef QAK -HDfprintf(stderr, "%s: Flushing free space header, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy); -HDfprintf(stderr, "%s: fspace->sect_addr = %a, fspace->sinfo = %p\n", FUNC, fspace->sect_addr, fspace->sinfo); -HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, fspace->alloc_sect_size, fspace->sect_size); -#endif /* QAK */ /* check arguments */ HDassert(f); @@ -335,12 +328,6 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" HGOTO_ERROR(H5E_FSPACE, H5E_CANTFLUSH, FAIL, "unable to save free space section info to disk") } /* end if */ -#ifdef QAK -HDfprintf(stderr, "%s: Check 2.0\n", FUNC); -HDfprintf(stderr, "%s: fspace->sect_addr = %a, fspace->sinfo = %p\n", FUNC, fspace->sect_addr, fspace->sinfo); -HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, fspace->alloc_sect_size, fspace->sect_size); -#endif /* QAK */ - /* Mark section info clean */ fspace->sinfo->dirty = FALSE; } /* end if */ @@ -416,7 +403,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" H5F_ENCODE_LENGTH(f, p, fspace->alloc_sect_size); /* Compute checksum */ - metadata_chksum = H5_checksum_metadata(hdr, (size_t)(p - hdr), 0); + metadata_chksum = H5_checksum_metadata(hdr, (size_t)(p - (uint8_t *)hdr), 0); /* Metadata checksum */ UINT32ENCODE(p, metadata_chksum); @@ -579,12 +566,12 @@ H5FS_cache_hdr_size(const H5F_t *f, const H5FS_t UNUSED *fspace, size_t *size_pt * * Purpose: Loads free space sections from the disk. * - * Return: Success: Pointer to a new free space section info - * Failure: NULL + * Return: Success: Pointer to a new free space section info + * Failure: NULL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * July 31 2006 * *------------------------------------------------------------------------- */ @@ -602,9 +589,6 @@ H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * H5FS_sinfo_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_load) -#ifdef QAK -HDfprintf(stderr, "%s: Load free space sections, addr = %a\n", FUNC, addr); -#endif /* QAK */ /* Check arguments */ HDassert(f); @@ -621,9 +605,6 @@ HDfprintf(stderr, "%s: Load free space sections, addr = %a\n", FUNC, addr); /* Allocate space for the buffer to serialize the sections into */ H5_ASSIGN_OVERFLOW(/* To: */ old_sect_size, /* From: */ fspace->sect_size, /* From: */ hsize_t, /* To: */ size_t); -#ifdef QAK -HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", FUNC, fspace->sect_size); -#endif /* QAK */ if(NULL == (buf = H5FL_BLK_MALLOC(sect_block, (size_t)fspace->sect_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -645,9 +626,6 @@ HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", FUNC, fspace->sect_size); /* Address of free space header for these sections */ H5F_addr_decode(f, &p, &fs_addr); -#ifdef QAK -HDfprintf(stderr, "%s: fspace->addr = %a, fs_addr = %a\n", FUNC, fspace->addr, fs_addr); -#endif /* QAK */ if(H5F_addr_ne(fs_addr, fspace->addr)) HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "incorrect header address for free space sections") @@ -661,22 +639,12 @@ HDfprintf(stderr, "%s: fspace->addr = %a, fs_addr = %a\n", FUNC, fspace->addr, f /* Compute the size of the section counts */ sect_cnt_size = H5V_limit_enc_size((uint64_t)fspace->serial_sect_count); -#ifdef QAK -HDfprintf(stderr, "%s: sect_cnt_size = %u\n", FUNC, sect_cnt_size); -HDfprintf(stderr, "%s: fspace->sect_len_size = %u\n", FUNC, fspace->sect_len_size); -#endif /* QAK */ /* Reset the section count, the "add" routine will update it */ old_tot_sect_count = fspace->tot_sect_count; old_serial_sect_count = fspace->serial_sect_count; old_ghost_sect_count = fspace->ghost_sect_count; old_tot_space = fspace->tot_space; -#ifdef QAK -HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_count); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", FUNC, fspace->serial_sect_count); -HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_sect_count); -HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); -#endif /* QAK */ fspace->tot_sect_count = 0; fspace->serial_sect_count = 0; fspace->ghost_sect_count = 0; @@ -690,16 +658,10 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); /* The number of sections of this node's size */ UINT64DECODE_VAR(p, node_count, sect_cnt_size); -#ifdef QAK -HDfprintf(stderr, "%s: node_count = %Zu\n", FUNC, node_count); -#endif /* QAK */ HDassert(node_count); /* The size of the sections for this node */ UINT64DECODE_VAR(p, sect_size, sinfo->sect_len_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect_size = %Hu\n", FUNC, sect_size); -#endif /* QAK */ HDassert(sect_size); /* Loop over nodes of this size */ @@ -711,15 +673,9 @@ HDfprintf(stderr, "%s: sect_size = %Hu\n", FUNC, sect_size); /* The address of the section */ UINT64DECODE_VAR(p, sect_addr, sinfo->sect_off_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect_addr = %a\n", FUNC, sect_addr); -#endif /* QAK */ /* The type of this section */ sect_type = *p++; -#ifdef QAK -HDfprintf(stderr, "%s: sect_type = %u\n", FUNC, sect_type); -#endif /* QAK */ /* Call 'deserialize' callback for this section */ des_flags = 0; @@ -729,9 +685,6 @@ HDfprintf(stderr, "%s: sect_type = %u\n", FUNC, sect_type); /* Update offset in serialization buffer */ p += fspace->sect_cls[sect_type].serial_size; -#ifdef QAK -HDfprintf(stderr, "%s: fspace->sect_cls[%u].serial_size = %Zu\n", FUNC, sect_type, fspace->sect_cls[sect_type].serial_size); -#endif /* QAK */ /* Insert section in free space manager, unless requested not to */ if(!(des_flags & H5FS_DESERIALIZE_NO_ADD)) @@ -750,18 +703,18 @@ HDfprintf(stderr, "%s: fspace->sect_cls[%u].serial_size = %Zu\n", FUNC, sect_typ } /* end if */ /* Compute checksum on indirect block */ - computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0); + computed_chksum = H5_checksum_metadata(buf, (size_t)(p - (const uint8_t *)buf), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); - /* Sanity check */ - HDassert((size_t)(p - buf) == old_sect_size); - /* Verify checksum */ if(stored_chksum != computed_chksum) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap indirect block") + /* Sanity check */ + HDassert((size_t)(p - (const uint8_t *)buf) == old_sect_size); + /* Set return value */ ret_value = sinfo; @@ -781,8 +734,7 @@ done: * Purpose: Skip list iterator callback to serialize free space sections * of a particular size * - * Return: Success: non-negative - * Failure: negative + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Monday, May 8, 2006 @@ -811,15 +763,9 @@ H5FS_sinfo_serialize_sect_cb(void *_item, void UNUSED *key, void *_udata) if(!(sect_cls->flags & H5FS_CLS_GHOST_OBJ)) { /* The address of the section */ UINT64ENCODE_VAR(*udata->p, sect->addr, udata->sinfo->sect_off_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect->addr = %a\n", FUNC, sect->addr); -#endif /* QAK */ /* The type of this section */ *(*udata->p)++ = (uint8_t)sect->type; -#ifdef QAK -HDfprintf(stderr, "%s: sect->type = %u\n", FUNC, (unsigned)sect->type); -#endif /* QAK */ /* Call 'serialize' callback for this section */ if(sect_cls->serialize) { @@ -844,8 +790,7 @@ done: * Purpose: Skip list iterator callback to serialize free space sections * in a bin * - * Return: Success: non-negative - * Failure: negative + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Monday, May 8, 2006 @@ -870,15 +815,9 @@ H5FS_sinfo_serialize_node_cb(void *_item, void UNUSED *key, void *_udata) if(fspace_node->serial_count > 0) { /* The number of serializable sections of this node's size */ UINT64ENCODE_VAR(*udata->p, fspace_node->serial_count, udata->sect_cnt_size); -#ifdef QAK -HDfprintf(stderr, "%s: fspace_node->serial_count = %Zu\n", FUNC, fspace_node->serial_count); -#endif /* QAK */ /* The size of the sections for this node */ UINT64ENCODE_VAR(*udata->p, fspace_node->sect_size, udata->sinfo->sect_len_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect_size = %Hu\n", FUNC, fspace_node->sect_size); -#endif /* QAK */ /* Iterate through all the sections of this size */ HDassert(fspace_node->sect_list); @@ -898,15 +837,10 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * July 31 2006 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. *------------------------------------------------------------------------- */ static herr_t @@ -915,9 +849,6 @@ H5FS_cache_sinfo_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_flush) -#ifdef QAK -HDfprintf(stderr, "%s: Flushing free space header, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy); -#endif /* QAK */ /* check arguments */ HDassert(f); @@ -951,23 +882,14 @@ HDfprintf(stderr, "%s: Flushing free space header, addr = %a, destroy = %u\n", F *p++ = H5FS_SINFO_VERSION; /* Address of free space header for these sections */ -#ifdef QAK -HDfprintf(stderr, "%s: sinfo->fspace->addr = %a\n", FUNC, sinfo->fspace->addr); -#endif /* QAK */ H5F_addr_encode(f, &p, sinfo->fspace->addr); /* Set up user data for iterator */ udata.sinfo = sinfo; udata.p = &p; udata.sect_cnt_size = H5V_limit_enc_size((uint64_t)sinfo->fspace->serial_sect_count); -#ifdef QAK -HDfprintf(stderr, "%s: udata.sect_cnt_size = %u\n", FUNC, udata.sect_cnt_size); -#endif /* QAK */ /* Iterate over all the bins */ -#ifdef QAK -HDfprintf(stderr, "%s: Serializing section bins\n", FUNC); -#endif /* QAK */ for(bin = 0; bin < sinfo->nbins; bin++) { /* Check if there are any sections in this bin */ if(sinfo->bins[bin].bin_list) { @@ -986,10 +908,6 @@ HDfprintf(stderr, "%s: Serializing section bins\n", FUNC); /* Sanity check */ HDassert((size_t)(p - buf) == sinfo->fspace->sect_size); HDassert(sinfo->fspace->sect_size <= sinfo->fspace->alloc_sect_size); -#ifdef QAK -HDfprintf(stderr, "%s: sinfo->fspace->sect_size = %Hu\n", FUNC, sinfo->fspace->sect_size); -HDfprintf(stderr, "%s: sinfo->fspace->alloc_sect_size = %Hu\n", FUNC, sinfo->fspace->alloc_sect_size); -#endif /* QAK */ /* Write buffer to disk */ if(H5F_block_write(f, H5FD_MEM_FSPACE_SINFO, sinfo->fspace->sect_addr, (size_t)sinfo->fspace->sect_size, dxpl_id, buf) < 0) @@ -1094,15 +1012,12 @@ H5FS_sinfo_free_node_cb(void *item, void UNUSED *key, void *op_data) *------------------------------------------------------------------------- */ herr_t -H5FS_cache_sinfo_dest(H5F_t *f, H5FS_sinfo_t *sinfo) +H5FS_cache_sinfo_dest(H5F_t UNUSED *f, H5FS_sinfo_t *sinfo) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_dest) -#ifdef QAK -HDfprintf(stderr, "%s: Destroying section info, sinfo->fspace->addr = %a\n", FUNC, sinfo->fspace->addr); -#endif /* QAK */ /* * Check arguments. diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 30885a9..26aac37 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -939,7 +939,8 @@ static herr_t H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect) { - H5FS_node_t *fspace_node = NULL; /* Pointer to free space node of the correct size */ + H5FS_node_t *fspace_node = NULL; /* Pointer to free space node of the correct size */ + hbool_t fspace_node_alloc = FALSE; /* Whether the free space node was allocated */ unsigned bin; /* Bin to put the free space section in */ herr_t ret_value = SUCCEED; /* Return value */ @@ -971,6 +972,7 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s /* Allocate new free list size node */ if(NULL == (fspace_node = H5FL_MALLOC(H5FS_node_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for free space node") + fspace_node_alloc = TRUE; /* Initialize the free list size node */ fspace_node->sect_size = sect->size; @@ -981,6 +983,7 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s /* Insert new free space size node into bin's list */ if(H5SL_insert(sinfo->bins[bin].bin_list, fspace_node, &fspace_node->sect_size) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space node into skip list") + fspace_node_alloc = FALSE; /* (owned by the bin skip list now, don't need to free on error) */ /* Increment number of section sizes */ sinfo->tot_size_count++; @@ -1016,6 +1019,13 @@ HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bi HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space node into skip list") done: + if(ret_value < 0) + if(fspace_node && fspace_node_alloc) { + if(fspace_node->sect_list && H5SL_close(fspace_node->sect_list) < 0) + HDONE_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "can't destroy size free space node's skip list") + fspace_node = H5FL_FREE(H5FS_node_t, fspace_node); + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_sect_link_size() */ diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c index 723005e..ba55b8f 100644 --- a/src/H5Fdbg.c +++ b/src/H5Fdbg.c @@ -123,8 +123,7 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth) f->shared->root_grp ? "" : "(none)"); if(f->shared->root_grp) { if(f->shared->sblock->root_ent) /* Use real root group symbol table entry */ - H5G_ent_debug(f, f->shared->sblock->root_ent, stream, indent + 3, - MAX(0, fwidth - 3), NULL); + H5G_ent_debug(f->shared->sblock->root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL); else { H5O_loc_t *root_oloc; /* Root object location */ H5G_entry_t root_ent; /* Constructed root symbol table entry */ @@ -140,7 +139,7 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth) root_ent.file = f; /* Display root group symbol table entry info */ - H5G_ent_debug(f, &root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL); + H5G_ent_debug(&root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL); } /* end else */ } /* end if */ diff --git a/src/H5Ffake.c b/src/H5Ffake.c index 09e87f2..e96aedf 100644 --- a/src/H5Ffake.c +++ b/src/H5Ffake.c @@ -67,7 +67,7 @@ H5F_init_fake_interface(void) *------------------------------------------------------------------------- */ H5F_t * -H5F_fake_alloc(size_t sizeof_size) +H5F_fake_alloc(uint8_t sizeof_size) { H5F_t *f = NULL; /* Pointer to fake file struct */ H5F_t *ret_value; /* Return value */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 29f3aa7..2952bac 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -526,12 +526,10 @@ H5_DLL herr_t H5F_block_write(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, hid_t dxpl_id, const void *buf); /* Address-related functions */ -H5_DLL void H5F_addr_encode(const H5F_t *, uint8_t** /*in,out*/, haddr_t); -H5_DLL void H5F_addr_encode_len(size_t addr_len, uint8_t** /*in,out*/, haddr_t); -H5_DLL void H5F_addr_decode(const H5F_t *, const uint8_t** /*in,out*/, - haddr_t* /*out*/); -H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t** /*in,out*/, - haddr_t* /*out*/); +H5_DLL void H5F_addr_encode(const H5F_t *f, uint8_t **pp, haddr_t addr); +H5_DLL void H5F_addr_encode_len(size_t addr_len, uint8_t **pp, haddr_t addr); +H5_DLL void H5F_addr_decode(const H5F_t *f, const uint8_t **pp, haddr_t *addr_p); +H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t **pp, haddr_t *addr_p); /* File access property list callbacks */ H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data); @@ -540,7 +538,7 @@ H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data); H5_DLL herr_t H5F_sfile_assert_num(unsigned n); /* Routines for creating & destroying "fake" file structures */ -H5_DLL H5F_t *H5F_fake_alloc(size_t sizeof_size); +H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size); H5_DLL herr_t H5F_fake_free(H5F_t *f); /* Superblock related routines */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 0f79660..71d9fef 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -21,8 +21,8 @@ /* Public header files needed by this file */ #include "H5public.h" -#include "H5Cpublic.h" #include "H5ACpublic.h" +#include "H5Cpublic.h" #include "H5Ipublic.h" /* When this header is included from a private header, don't make calls to H5check() */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index c24cfa1..eb739dc 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -74,6 +74,7 @@ H5FL_DEFINE(H5F_super_t); /* Local Variables */ /*******************/ + /*-------------------------------------------------------------------------- NAME @@ -263,7 +264,7 @@ H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr) /* Twiddle the number of open objects to avoid closing the file. */ f->nopen_objs++; if(H5O_close(ext_ptr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "unable to close superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close superblock extension") f->nopen_objs--; done: @@ -326,7 +327,7 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id) sblock_flags |= H5AC__DIRTIED_FLAG; /* Pin the superblock in the cache */ - if(H5AC_pin_protected_entry(f, sblock) < 0) + if(H5AC_pin_protected_entry(sblock) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPIN, FAIL, "unable to pin superblock") /* Set the pointer to the pinned superblock */ @@ -528,7 +529,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) /* Create the superblock extension for "extra" superblock data, if necessary. */ if(need_ext) { - H5O_loc_t ext_loc; /* Superblock extension object location */ + H5O_loc_t ext_loc; /* Superblock extension object location */ /* The superblock extension isn't actually a group, but the * default group creation list should work fine. @@ -539,7 +540,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) * extension. */ if(H5F_super_ext_create(f, dxpl_id, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to start file's superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create superblock extension") /* Create the Shared Object Header Message table and register it with * the metadata cache, if this file supports shared messages. @@ -608,7 +609,7 @@ done: /* Check if we've cached it already */ if(sblock_in_cache) { /* Unpin superblock in cache */ - if(H5AC_unpin_entry(f, sblock) < 0) + if(H5AC_unpin_entry(sblock) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTUNPIN, FAIL, "unable to unpin superblock") /* Evict the superblock from the cache */ @@ -654,7 +655,7 @@ H5F_super_dirty(H5F_t *f) HDassert(f->shared->sblock); /* Mark superblock dirty in cache, so change to EOA will get encoded */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, f->shared->sblock) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(f->shared->sblock) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") done: @@ -787,7 +788,7 @@ H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_ done: /* Mark superblock dirty in cache, if necessary */ if(sblock_dirty) - if(H5AC_mark_pinned_or_protected_entry_dirty(f, f->shared->sblock) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(f->shared->sblock) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") FUNC_LEAVE_NOAPI(ret_value) @@ -803,6 +804,7 @@ done: * * Programmer: Vailin Choi; Feb 2009 * + * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index f7a35b9..e6e980b 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -155,6 +155,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, const void UNUSED /* Read fixed-size portion of the superblock */ p = sbuf; + H5_CHECK_OVERFLOW(fixed_size, size_t, haddr_t); if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, (haddr_t)fixed_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "set end of space allocation request failed") if(H5FD_read(lf, dxpl_id, H5FD_MEM_SUPER, (haddr_t)0, fixed_size, p) < 0) diff --git a/src/H5Gcache.c b/src/H5Gcache.c index 6d497b6..1b352ca 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -119,13 +119,6 @@ H5FL_SEQ_EXTERN(H5G_entry_t); * matzke@llnl.gov * Jun 23 1997 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Quincey Koziol, 2002-7-180 - * Added dxpl parameter to allow more control over I/O from metadata - * cache. *------------------------------------------------------------------------- */ static H5G_node_t * @@ -223,26 +216,6 @@ done: * matzke@llnl.gov * Jun 23 1997 * - * Modifications: - * rky, 1998-08-28 - * Only p0 writes metadata to disk. - * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Quincey Koziol, 2002-7-180 - * Added dxpl parameter to allow more control over I/O from metadata - * cache. - * - * Pedro Vicente, 18 Sep 2002 - * Added `id to name' support. - * - * JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * *------------------------------------------------------------------------- */ static herr_t @@ -350,8 +323,6 @@ done: * koziol@ncsa.uiuc.edu * Jan 15 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -384,7 +355,7 @@ H5G_node_dest(H5F_t *f, H5G_node_t *sym) /* Release resources */ if(sym->entry) sym->entry = (H5G_entry_t *)H5FL_SEQ_FREE(H5G_entry_t, sym->entry); - (void)H5FL_FREE(H5G_node_t, sym); + sym = H5FL_FREE(H5G_node_t, sym); done: FUNC_LEAVE_NOAPI(ret_value) @@ -402,8 +373,6 @@ done: * koziol@ncsa.uiuc.edu * Mar 20 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -412,28 +381,28 @@ H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy) unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT(H5G_node_clear); + FUNC_ENTER_NOAPI_NOINIT(H5G_node_clear) /* * Check arguments. */ - assert(sym); + HDassert(sym); /* Look for dirty entries and reset their dirty flag. */ for(u = 0; u < sym->nsyms; u++) - sym->entry[u].dirty=FALSE; + sym->entry[u].dirty = FALSE; sym->cache_info.is_dirty = FALSE; /* * Destroy the symbol node? This might happen if the node is being * preempted from the cache. */ - if (destroy) - if (H5G_node_dest(f, sym) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to destroy symbol table node"); + if(destroy) + if(H5G_node_dest(f, sym) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to destroy symbol table node") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_node_clear() */ @@ -449,14 +418,12 @@ done: * Programmer: John Mainzer * 5/13/04 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t H5G_node_size(const H5F_t *f, const H5G_node_t UNUSED *sym, size_t *size_ptr) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_size); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_size) /* * Check arguments. @@ -466,6 +433,6 @@ H5G_node_size(const H5F_t *f, const H5G_node_t UNUSED *sym, size_t *size_ptr) *size_ptr = H5G_node_size_real(f); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5G_node_size() */ diff --git a/src/H5Gent.c b/src/H5Gent.c index 65f302c..18883ac 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -55,7 +55,7 @@ H5FL_BLK_EXTERN(str_buf); *------------------------------------------------------------------------- */ herr_t -H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n) +H5G_ent_decode_vec(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -94,7 +94,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) +H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) { const uint8_t *p_ret = *pp; uint32_t tmp; @@ -161,7 +161,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n) +H5G_ent_encode_vec(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -422,8 +422,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_ent_debug(H5F_t UNUSED *f, const H5G_entry_t *ent, FILE *stream, - int indent, int fwidth, H5HL_t *heap) +H5G_ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, + H5HL_t *heap) { const char *lval = NULL; int nested_indent, nested_fwidth; @@ -471,7 +471,7 @@ H5G_ent_debug(H5F_t UNUSED *f, const H5G_entry_t *ent, FILE *stream, "Link value offset:", (unsigned long)(ent->cache.slink.lval_offset)); if(heap) { - lval = (const char *)H5HL_offset_into(ent->file, heap, ent->cache.slink.lval_offset); + lval = (const char *)H5HL_offset_into(heap, ent->cache.slink.lval_offset); HDfprintf(stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth, "Link value:", lval); diff --git a/src/H5Glink.c b/src/H5Glink.c index 488c05b..f5ad7d9 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -218,13 +218,12 @@ H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2) *------------------------------------------------------------------------- */ herr_t -H5G_ent_to_link(H5F_t *f, H5O_link_t *lnk, const H5HL_t *heap, +H5G_ent_to_link(H5O_link_t *lnk, const H5HL_t *heap, const H5G_entry_t *ent, const char *name) { FUNC_ENTER_NOAPI_NOFUNC(H5G_ent_to_link) /* check arguments */ - HDassert(f); HDassert(lnk); HDassert(heap); HDassert(ent); @@ -241,7 +240,7 @@ H5G_ent_to_link(H5F_t *f, H5O_link_t *lnk, const H5HL_t *heap, if(ent->type == H5G_CACHED_SLINK) { const char *s; /* Pointer to link value */ - s = (const char *)H5HL_offset_into(f, heap, ent->cache.slink.lval_offset); + s = (const char *)H5HL_offset_into(heap, ent->cache.slink.lval_offset); HDassert(s); /* Copy the link value */ @@ -263,61 +262,6 @@ H5G_ent_to_link(H5F_t *f, H5O_link_t *lnk, const H5HL_t *heap, /*------------------------------------------------------------------------- - * Function: H5G_ent_to_info - * - * Purpose: Make link info for a symbol table entry - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Nov 16 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G_ent_to_info(H5F_t *f, H5L_info_t *info, const H5HL_t *heap, - const H5G_entry_t *ent) -{ - FUNC_ENTER_NOAPI_NOFUNC(H5G_ent_to_info) - - /* check arguments */ - HDassert(f); - HDassert(info); - HDassert(heap); - HDassert(ent); - - /* Set (default) common info for info */ - info->cset = H5F_DEFAULT_CSET; - info->corder = 0; - info->corder_valid = FALSE; /* Creation order not valid for this link */ - - /* Object is a symbolic or hard link */ - if(ent->type == H5G_CACHED_SLINK) { - const char *s; /* Pointer to link value */ - - s = (const char *)H5HL_offset_into(f, heap, ent->cache.slink.lval_offset); - HDassert(s); - - /* Get the link value size */ - info->u.val_size = HDstrlen(s) + 1; - - /* Set link type */ - info->type = H5L_TYPE_SOFT; - } /* end if */ - else { - /* Set address of object */ - info->u.address = ent->header; - - /* Set link type */ - info->type = H5L_TYPE_HARD; - } /* end else */ - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_ent_to_info() */ - - -/*------------------------------------------------------------------------- * Function: H5G_link_to_info * * Purpose: Retrieve information from a link object diff --git a/src/H5Gnode.c b/src/H5Gnode.c index a58c66a..18125df 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -51,6 +51,7 @@ typedef struct H5G_node_key_t { size_t offset; /*offset into heap for name */ } H5G_node_key_t; + /* Private macros */ #define H5G_NODE_SIZEOF_HDR(F) (H5_SIZEOF_MAGIC + 4) @@ -131,16 +132,16 @@ H5G_node_get_shared(const H5F_t *f, const void UNUSED *_udata) { H5RC_t *rc; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_get_shared); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_get_shared) - assert(f); + HDassert(f); /* Increment reference count on shared B-tree node */ - rc=H5F_GRP_BTREE_SHARED(f); + rc = H5F_GRP_BTREE_SHARED(f); H5RC_INC(rc); /* Return the pointer to the ref-count object */ - FUNC_LEAVE_NOAPI(rc); + FUNC_LEAVE_NOAPI(rc) } /* end H5G_node_get_shared() */ @@ -155,8 +156,6 @@ H5G_node_get_shared(const H5F_t *f, const void UNUSED *_udata) * matzke@llnl.gov * Jul 8 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -164,16 +163,16 @@ H5G_node_decode_key(const H5F_t *f, const H5B_t UNUSED *bt, const uint8_t *raw, { H5G_node_key_t *key = (H5G_node_key_t *) _key; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_decode_key); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_decode_key) - assert(f); - assert(raw); - assert(key); + HDassert(f); + HDassert(raw); + HDassert(key); H5F_DECODE_LENGTH(f, raw, key->offset); - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5G_node_decode_key() */ /*------------------------------------------------------------------------- @@ -187,8 +186,6 @@ H5G_node_decode_key(const H5F_t *f, const H5B_t UNUSED *bt, const uint8_t *raw, * matzke@llnl.gov * Jul 8 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -196,16 +193,16 @@ H5G_node_encode_key(const H5F_t *f, const H5B_t UNUSED *bt, uint8_t *raw, void * { H5G_node_key_t *key = (H5G_node_key_t *) _key; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_encode_key); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_encode_key) - assert(f); - assert(raw); - assert(key); + HDassert(f); + HDassert(raw); + HDassert(key); H5F_ENCODE_LENGTH(f, raw, key->offset); - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5G_node_encode_key() */ /*------------------------------------------------------------------------- @@ -221,8 +218,8 @@ H5G_node_encode_key(const H5F_t *f, const H5B_t UNUSED *bt, uint8_t *raw, void * *------------------------------------------------------------------------- */ static herr_t -H5G_node_debug_key(FILE *stream, H5F_t *f, hid_t UNUSED dxpl_id, int indent, - int fwidth, const void *_key, const void *_udata) +H5G_node_debug_key(FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, + int indent, int fwidth, const void *_key, const void *_udata) { const H5G_node_key_t *key = (const H5G_node_key_t *) _key; const H5G_bt_common_t *udata = (const H5G_bt_common_t *) _udata; @@ -239,7 +236,7 @@ H5G_node_debug_key(FILE *stream, H5F_t *f, hid_t UNUSED dxpl_id, int indent, HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Name:"); - s = (const char *)H5HL_offset_into(f, udata->heap, key->offset); + s = (const char *)H5HL_offset_into(udata->heap, key->offset); HDfprintf(stream, "%s\n", s); } /* end if */ else @@ -262,8 +259,6 @@ H5G_node_debug_key(FILE *stream, H5F_t *f, hid_t UNUSED dxpl_id, int indent, * matzke@llnl.gov * Jun 23 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ size_t @@ -273,7 +268,7 @@ H5G_node_size_real(const H5F_t *f) FUNC_LEAVE_NOAPI(H5G_NODE_SIZEOF_HDR(f) + (2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY(f)); -} +} /* end H5G_node_size_real() */ /*------------------------------------------------------------------------- @@ -305,7 +300,7 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key, hsize_t size = 0; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5G_node_create); + FUNC_ENTER_NOAPI_NOINIT(H5G_node_create) /* * Check arguments. @@ -316,12 +311,12 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key, if(NULL == (sym = H5FL_CALLOC(H5G_node_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") size = H5G_node_size_real(f); + HDassert(size); if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space") + if(NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f))))) + HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "memory allocation failed") - sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f))); - if(NULL == sym->entry) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") if(H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node") /* @@ -372,7 +367,7 @@ done: *------------------------------------------------------------------------- */ static int -H5G_node_cmp2(H5F_t *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata, +H5G_node_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata, void *_rt_key) { H5G_bt_common_t *udata = (H5G_bt_common_t *) _udata; @@ -390,7 +385,7 @@ H5G_node_cmp2(H5F_t *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata, HDassert(rt_key); /* Get base address of heap */ - base = (const char *)H5HL_offset_into(f, udata->heap, (size_t)0); + base = (const char *)H5HL_offset_into(udata->heap, (size_t)0); HDassert(base); /* Get pointers to string names */ @@ -432,7 +427,7 @@ H5G_node_cmp2(H5F_t *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata, *------------------------------------------------------------------------- */ static int -H5G_node_cmp3(H5F_t *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata, +H5G_node_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata, void *_rt_key) { H5G_bt_common_t *udata = (H5G_bt_common_t *) _udata; @@ -450,7 +445,7 @@ H5G_node_cmp3(H5F_t *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata, HDassert(rt_key); /* Get base address of heap */ - base = (const char *)H5HL_offset_into(f, udata->heap, (size_t)0); + base = (const char *)H5HL_offset_into(udata->heap, (size_t)0); HDassert(base); /* left side */ @@ -522,7 +517,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to protect symbol table node") /* Get base address of heap */ - base = (const char *)H5HL_offset_into(f, udata->common.heap, (size_t)0); + base = (const char *)H5HL_offset_into(udata->common.heap, (size_t)0); HDassert(base); /* @@ -628,7 +623,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node") /* Get base address of heap */ - base = (const char *)H5HL_offset_into(f, udata->common.heap, (size_t)0); + base = (const char *)H5HL_offset_into(udata->common.heap, (size_t)0); HDassert(base); /* @@ -796,7 +791,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, const char *base; /* Base of heap */ /* Get base address of heap */ - base = (const char *)H5HL_offset_into(f, udata->common.heap, (size_t)0); + base = (const char *)H5HL_offset_into(udata->common.heap, (size_t)0); /* Find the name with a binary search */ rt = sn->nsyms; @@ -816,7 +811,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "name not found") /* Get a pointer to the name of the link */ - if(NULL == (lnk.name = (char *)H5HL_offset_into(f, udata->common.heap, sn->entry[idx].name_off))) + if(NULL == (lnk.name = (char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off))) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get link name") /* Set up rest of link structure */ @@ -825,7 +820,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, lnk.cset = H5T_CSET_ASCII; if(sn->entry[idx].type == H5G_CACHED_SLINK) { lnk.type = H5L_TYPE_SOFT; - lnk.u.soft.name = (char *)H5HL_offset_into(f, udata->common.heap, sn->entry[idx].cache.slink.lval_offset); + lnk.u.soft.name = (char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].cache.slink.lval_offset); } /* end if */ else { lnk.type = H5L_TYPE_HARD; @@ -997,11 +992,11 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad const char *name; /* Pointer to link name in heap */ /* Get the pointer to the name of the link in the heap */ - name = (const char *)H5HL_offset_into(f, udata->heap, ents[u].name_off); + name = (const char *)H5HL_offset_into(udata->heap, ents[u].name_off); HDassert(name); /* Convert the entry to a link */ - if(H5G_ent_to_link(f, &lnk, udata->heap, &ents[u], name) < 0) + if(H5G_ent_to_link(&lnk, udata->heap, &ents[u], name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5_ITER_ERROR, "unable to convert symbol table entry to link") /* Make the callback */ @@ -1022,7 +1017,7 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad done: /* Release resources */ - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1066,7 +1061,7 @@ H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr *num_objs += sn->nsyms; done: - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1095,7 +1090,7 @@ H5G_node_by_idx(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t add H5G_node_t *sn = NULL; int ret_value = H5_ITER_CONT; - FUNC_ENTER_NOAPI(H5G_node_by_idx, H5_ITER_ERROR); + FUNC_ENTER_NOAPI(H5G_node_by_idx, H5_ITER_ERROR) /* * Check arguments. @@ -1127,10 +1122,10 @@ H5G_node_by_idx(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t add udata->num_objs += sn->nsyms; done: - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_node_by_idx() */ @@ -1155,7 +1150,7 @@ H5G_node_init(H5F_t *f) size_t sizeof_rkey; /* Size of raw (disk) key */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5G_node_init, FAIL); + FUNC_ENTER_NOAPI(H5G_node_init, FAIL) /* Check arguments. */ HDassert(f); @@ -1175,7 +1170,7 @@ H5G_node_init(H5F_t *f) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_node_init() */ @@ -1200,13 +1195,13 @@ H5G_node_close(const H5F_t *f) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_close) /* Check arguments. */ - assert(f); + HDassert(f); /* Free the raw B-tree node buffer */ - if (H5F_GRP_BTREE_SHARED(f)) + if(H5F_GRP_BTREE_SHARED(f)) H5RC_DEC(H5F_GRP_BTREE_SHARED(f)); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G_node_close */ @@ -1227,13 +1222,13 @@ int H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, const void UNUSED *_rt_key, void *_udata) { - H5G_bt_it_cpy_t *udata = (H5G_bt_it_cpy_t *)_udata; - const H5O_loc_t *src_oloc = udata->src_oloc; - H5O_copy_t *cpy_info = udata->cpy_info; - H5HL_t *heap = NULL; - H5G_node_t *sn = NULL; - unsigned int i; /* Local index variable */ - int ret_value = H5_ITER_CONT; + H5G_bt_it_cpy_t *udata = (H5G_bt_it_cpy_t *)_udata; + const H5O_loc_t *src_oloc = udata->src_oloc; + H5O_copy_t *cpy_info = udata->cpy_info; + H5HL_t *heap = NULL; + H5G_node_t *sn = NULL; + unsigned int i; /* Local index variable */ + int ret_value = H5_ITER_CONT; FUNC_ENTER_NOAPI(H5G_node_copy, H5_ITER_ERROR) @@ -1273,7 +1268,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Get pointer to link value in local heap */ - link_name = (char *)H5HL_offset_into(f, heap, tmp_src_ent.cache.slink.lval_offset); + link_name = (char *)H5HL_offset_into(heap, tmp_src_ent.cache.slink.lval_offset); /* Check if the object pointed by the soft link exists in the source file */ if(H5G_loc_info(&grp_loc, link_name, FALSE, &oinfo, H5P_DEFAULT, dxpl_id) >= 0) { @@ -1311,7 +1306,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, /* Construct link information for eventual insertion */ lnk.type = H5L_TYPE_SOFT; - lnk.u.soft.name = (char *)H5HL_offset_into(f, heap, src_ent->cache.slink.lval_offset); + lnk.u.soft.name = (char *)H5HL_offset_into(heap, src_ent->cache.slink.lval_offset); } /* else if */ else HDassert(0 && "Unknown entry type"); @@ -1323,7 +1318,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, /* lnk.name = name; */ /* This will be set in callback */ /* Determine name of source object */ - name = (const char *)H5HL_offset_into(f, heap, src_ent->name_off); + name = (const char *)H5HL_offset_into(heap, src_ent->name_off); HDassert(name); /* Insert the new object in the destination file's group */ @@ -1333,10 +1328,10 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, } /* end of for (i=0; insyms; i++) */ done: - if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->src_heap_addr) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to unprotect symbol name") - if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1398,20 +1393,20 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_ unsigned linkno; /* Link allocated */ /* Get pointer to link's name in the heap */ - name = (const char *)H5HL_offset_into(f, udata->heap, sn->entry[u].name_off); + name = (const char *)H5HL_offset_into(udata->heap, sn->entry[u].name_off); HDassert(name); /* Determine the link to operate on in the table */ linkno = udata->ltable->nlinks++; /* Convert the entry to a link */ - if(H5G_ent_to_link(f, &udata->ltable->lnks[linkno], udata->heap, &sn->entry[u], name) < 0) + if(H5G_ent_to_link(&udata->ltable->lnks[linkno], udata->heap, &sn->entry[u], name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5_ITER_ERROR, "unable to convert symbol table entry to link") } /* end for */ done: /* Release the locked items */ - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1467,10 +1462,10 @@ herr_t H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth, haddr_t heap_addr) { - H5G_node_t *sn = NULL; - H5HL_t *heap = NULL; - unsigned u; - herr_t ret_value = SUCCEED; /* Return value */ + H5G_node_t *sn = NULL; + H5HL_t *heap = NULL; + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_node_debug, FAIL) @@ -1517,7 +1512,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, fprintf(stream, "%*sSymbol %u:\n", indent - 3, "", u); if(heap) { - const char *s = (const char *)H5HL_offset_into(f, heap, sn->entry[u].name_off); + const char *s = (const char *)H5HL_offset_into(heap, sn->entry[u].name_off); if(s) fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth, "Name:", s); @@ -1525,14 +1520,14 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, else fprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Warning: Invalid heap address given, name not displayed!"); - H5G_ent_debug(f, sn->entry + u, stream, indent, fwidth, heap); + H5G_ent_debug(sn->entry + u, stream, indent, fwidth, heap); } /* end for */ } /* end if */ done: if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node") - if(heap && H5HL_unprotect(f, dxpl_id, heap, heap_addr) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Gobj.c b/src/H5Gobj.c index 271501f..7766280 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -921,7 +921,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id) for(u = 0; u < linfo->nlinks; u++) if(H5O_msg_append_oh(oloc->file, dxpl_id, oh, H5O_LINK_ID, 0, H5O_UPDATE_TIME, &(ltable.lnks[u])) < 0) { /* Release object header */ - if(H5O_unpin(oloc, oh) < 0) + if(H5O_unpin(oh) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTUNPIN, FAIL, "unable to unpin group object header") HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") @@ -933,7 +933,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id) } /* end if */ /* Release object header */ - if(H5O_unpin(oloc, oh) < 0) + if(H5O_unpin(oh) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTUNPIN, FAIL, "unable to unpin group object header") /* Free link table information */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 80c4a7b..33ec680 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -197,8 +197,8 @@ typedef struct H5G_bt_ins_t { */ typedef struct H5G_bt_rm_t { /* downward */ - H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */ - H5RS_str_t *grp_full_path_r; /* Full path of group where link is removed */ + H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */ + H5RS_str_t *grp_full_path_r; /* Full path of group where link is removed */ } H5G_bt_rm_t; /* Typedef for B-tree 'find' operation */ @@ -210,9 +210,9 @@ typedef herr_t (*H5G_bt_find_op_t)(const H5G_entry_t *ent/*in*/, void *operator_ */ typedef struct H5G_bt_lkp_t { /* downward */ - H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */ - H5G_bt_find_op_t op; /* Operator to call when correct entry is found */ - void *op_data; /* Data to pass to operator */ + H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */ + H5G_bt_find_op_t op; /* Operator to call when correct entry is found */ + void *op_data; /* Data to pass to operator */ /* upward */ } H5G_bt_lkp_t; @@ -244,7 +244,6 @@ typedef struct H5G_bt_it_cpy_t { /* Common information for "by index" lookups in symbol tables */ typedef struct H5G_bt_it_idx_common_t { /* downward */ - H5F_t *f; /* Pointer to file that symbol table is in */ hsize_t idx; /* Index of group member to be queried */ hsize_t num_objs; /* The number of objects having been traversed */ H5G_bt_find_op_t op; /* Operator to call when correct entry is found */ @@ -254,7 +253,7 @@ typedef struct H5G_bt_it_idx_common_t { typedef struct H5G_bt_it_bt_t { /* downward */ size_t alloc_nlinks; /* Number of links allocated in table */ - H5HL_t *heap; /*symbol table heap */ + H5HL_t *heap; /* Symbol table heap */ /* upward */ H5G_link_table_t *ltable; /* Link table to add information to */ @@ -426,14 +425,14 @@ H5_DLL H5G_obj_t H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, H5_DLL herr_t H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5_copy_depth_t depth); H5_DLL herr_t H5G_ent_reset(H5G_entry_t *ent); -H5_DLL herr_t H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp, +H5_DLL herr_t H5G_ent_decode_vec(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n); -H5_DLL herr_t H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, +H5_DLL herr_t H5G_ent_encode_vec(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n); H5_DLL herr_t H5G_ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name, const H5O_link_t *lnk, H5G_entry_t *ent); -H5_DLL herr_t H5G_ent_debug(H5F_t *f, const H5G_entry_t *ent, - FILE * stream, int indent, int fwidth, H5HL_t *heap); +H5_DLL herr_t H5G_ent_debug(const H5G_entry_t *ent, FILE * stream, int indent, + int fwidth, H5HL_t *heap); /* Functions that understand symbol table nodes */ H5_DLL herr_t H5G_node_init(H5F_t *f); @@ -456,10 +455,8 @@ H5_DLL int H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2); H5_DLL int H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2); H5_DLL int H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2); H5_DLL int H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2); -H5_DLL herr_t H5G_ent_to_link(H5F_t *f, H5O_link_t *lnk, const H5HL_t *heap, +H5_DLL herr_t H5G_ent_to_link(H5O_link_t *lnk, const H5HL_t *heap, const H5G_entry_t *ent, const char *name); -H5_DLL herr_t H5G_ent_to_info(H5F_t *f, H5L_info_t *info, const H5HL_t *heap, - const H5G_entry_t *ent); H5_DLL herr_t H5G_link_to_info(const H5O_link_t *lnk, H5L_info_t *linfo); H5_DLL herr_t H5G_link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, H5G_loc_t *obj_loc); diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 526fa82..dec40f3 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -184,9 +184,8 @@ H5_DLL herr_t H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream /* * These functions operate on group object locations. */ -H5_DLL herr_t H5G_ent_encode(const H5F_t *f, uint8_t **pp, - const H5G_entry_t *ent); -H5_DLL herr_t H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent/*out*/); +H5_DLL herr_t H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent); +H5_DLL herr_t H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent); /* * These functions operate on group hierarchy names. diff --git a/src/H5Groot.c b/src/H5Groot.c index 7dc98d1..e4cdc46 100644 --- a/src/H5Groot.c +++ b/src/H5Groot.c @@ -261,7 +261,7 @@ done: /* Mark superblock dirty in cache, if necessary */ if(sblock_dirty) - if(H5AC_mark_pinned_or_protected_entry_dirty(f, f->shared->sblock) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(f->shared->sblock) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 52c9d07..cba725f 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -33,9 +33,8 @@ /* User data for finding link information from B-tree */ typedef struct { /* downward */ - H5F_t *file; /* Pointer to file for query */ const char *name; /* Name to search for */ - H5HL_t *heap; /* Local heap for group */ + H5HL_t *heap; /* Local heap for group */ /* upward */ H5O_link_t *lnk; /* Caller's link location */ @@ -45,7 +44,7 @@ typedef struct { typedef struct H5G_bt_it_gnbi_t { /* downward */ H5G_bt_it_idx_common_t common; /* Common information for "by index" lookup */ - H5HL_t *heap; /*symbol table heap */ + H5HL_t *heap; /*symbol table heap */ /* upward */ char *name; /*member name to be returned */ @@ -56,6 +55,7 @@ typedef struct H5G_bt_it_gnbi_t { typedef struct H5G_bt_it_gtbi_t { /* downward */ H5G_bt_it_idx_common_t common; /* Common information for "by index" lookup */ + H5F_t *f; /* Pointer to file that symbol table is in */ hid_t dxpl_id; /* DXPL for operation */ /* upward */ @@ -67,7 +67,7 @@ typedef struct H5G_bt_it_gtbi_t { typedef struct H5G_bt_it_lbi_t { /* downward */ H5G_bt_it_idx_common_t common; /* Common information for "by index" lookup */ - H5HL_t *heap; /*symbol table heap */ + H5HL_t *heap; /*symbol table heap */ /* upward */ H5O_link_t *lnk; /*link to be returned */ @@ -99,9 +99,9 @@ typedef struct H5G_bt_it_lbi_t { herr_t H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t dxpl_id) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - size_t name_offset; /* Offset of "" name */ - herr_t ret_value = SUCCEED; /* Return value */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + size_t name_offset; /* Offset of "" name */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_create_components, FAIL) @@ -136,7 +136,7 @@ H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t d done: /* Release resources */ - if(heap && H5HL_unprotect(f, dxpl_id, heap, stab->heap_addr) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) @@ -223,9 +223,9 @@ herr_t H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name, H5O_link_t *obj_lnk, hid_t dxpl_id) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - H5G_bt_ins_t udata; /* Data to pass through B-tree */ - herr_t ret_value = SUCCEED; /* Return value */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + H5G_bt_ins_t udata; /* Data to pass through B-tree */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_insert_real, FAIL) @@ -250,7 +250,7 @@ H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name, done: /* Release resources */ - if(heap && H5HL_unprotect(f, dxpl_id, heap, stab->heap_addr) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) @@ -315,9 +315,9 @@ H5G_stab_remove(H5O_loc_t *loc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, const char *name) { H5HL_t *heap = NULL; /* Pointer to local heap */ - H5O_stab_t stab; /*symbol table message */ - H5G_bt_rm_t udata; /*data to pass through B-tree */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_stab_t stab; /*symbol table message */ + H5G_bt_rm_t udata; /*data to pass through B-tree */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_remove, FAIL) @@ -343,7 +343,7 @@ H5G_stab_remove(H5O_loc_t *loc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, done: /* Release resources */ - if(heap && H5HL_unprotect(loc->file, dxpl_id, heap, stab.heap_addr) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) @@ -367,11 +367,11 @@ H5G_stab_remove_by_idx(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_ H5_iter_order_t order, hsize_t n) { H5HL_t *heap = NULL; /* Pointer to local heap */ - H5O_stab_t stab; /* Symbol table message */ - H5G_bt_rm_t udata; /* Data to pass through B-tree */ - H5O_link_t obj_lnk; /* Object's link within group */ - hbool_t lnk_copied = FALSE; /* Whether the link was copied */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_stab_t stab; /* Symbol table message */ + H5G_bt_rm_t udata; /* Data to pass through B-tree */ + H5O_link_t obj_lnk; /* Object's link within group */ + hbool_t lnk_copied = FALSE; /* Whether the link was copied */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_remove_by_idx, FAIL) @@ -401,7 +401,7 @@ H5G_stab_remove_by_idx(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_ done: /* Release resources */ - if(heap && H5HL_unprotect(grp_oloc->file, dxpl_id, heap, stab.heap_addr) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") /* Reset the link information, if we have a copy */ @@ -429,9 +429,9 @@ done: herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - H5G_bt_rm_t udata; /*data to pass through B-tree */ - herr_t ret_value = SUCCEED; + H5HL_t *heap = NULL; /* Pointer to local heap */ + H5G_bt_rm_t udata; /*data to pass through B-tree */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_delete, FAIL) @@ -453,7 +453,7 @@ H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table B-tree") /* Release resources */ - if(H5HL_unprotect(f, dxpl_id, heap, stab->heap_addr) < 0) + if(H5HL_unprotect(heap) < 0) HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") heap = NULL; @@ -463,7 +463,7 @@ H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab) done: /* Release resources */ - if(heap && H5HL_unprotect(f, dxpl_id, heap, stab->heap_addr) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) @@ -486,10 +486,10 @@ herr_t H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data) { - H5HL_t *heap = NULL; /* Local heap for group */ - H5O_stab_t stab; /* Info about symbol table */ + H5HL_t *heap = NULL; /* Local heap for group */ + H5O_stab_t stab; /* Info about symbol table */ H5G_link_table_t ltable = {0, NULL}; /* Link table */ - herr_t ret_value; + herr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_iterate, FAIL) @@ -553,7 +553,7 @@ H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, done: /* Release resources */ - if(heap && H5HL_unprotect(oloc->file, dxpl_id, heap, stab.heap_addr) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") if(ltable.lnks && H5G_link_release_table(<able) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") @@ -677,7 +677,7 @@ H5G_stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata) /* Get name offset in heap */ name_off = ent->name_off; - name = (const char *)H5HL_offset_into(udata->common.f, udata->heap, name_off); + name = (const char *)H5HL_offset_into(udata->heap, name_off); HDassert(name); udata->name = H5MM_strdup(name); HDassert(udata->name); @@ -703,10 +703,10 @@ ssize_t H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, char* name, size_t size, hid_t dxpl_id) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - H5O_stab_t stab; /* Info about local heap & B-tree */ - H5G_bt_it_gnbi_t udata; /* Iteration information */ - ssize_t ret_value; /* Return value */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + H5O_stab_t stab; /* Info about local heap & B-tree */ + H5G_bt_it_gnbi_t udata; /* Iteration information */ + ssize_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_get_name_by_idx, FAIL) @@ -734,7 +734,6 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, } /* end if */ /* Set iteration information */ - udata.common.f = oloc->file; udata.common.idx = n; udata.common.num_objs = 0; udata.common.op = H5G_stab_get_name_by_idx_cb; @@ -761,7 +760,7 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, done: /* Release resources */ - if(heap && H5HL_unprotect(oloc->file, dxpl_id, heap, stab.heap_addr) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") /* Free the duplicated name */ @@ -797,7 +796,7 @@ H5G_stab_lookup_cb(const H5G_entry_t *ent, void *_udata) /* Check for setting link info */ if(udata->lnk) /* Convert the entry to a link */ - if(H5G_ent_to_link(udata->file, udata->lnk, udata->heap, ent, udata->name) < 0) + if(H5G_ent_to_link(udata->lnk, udata->heap, ent, udata->name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link") done: @@ -822,10 +821,10 @@ htri_t H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, hid_t dxpl_id) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - H5G_bt_lkp_t bt_udata; /* Data to pass through B-tree */ - H5G_stab_fnd_ud_t udata; /* 'User data' to give to callback */ - H5O_stab_t stab; /* Symbol table message */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + H5G_bt_lkp_t bt_udata; /* Data to pass through B-tree */ + H5G_stab_fnd_ud_t udata; /* 'User data' to give to callback */ + H5O_stab_t stab; /* Symbol table message */ htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_lookup, FAIL) @@ -844,7 +843,6 @@ H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") /* Set up user data to pass to 'find' operation callback */ - udata.file = grp_oloc->file; udata.name = name; udata.lnk = lnk; udata.heap = heap; @@ -861,7 +859,7 @@ H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, done: /* Release resources */ - if(heap && H5HL_unprotect(grp_oloc->file, dxpl_id, heap, stab.heap_addr) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) @@ -896,11 +894,11 @@ H5G_stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata) HDassert(udata && udata->heap); /* Get a pointer to the link name */ - name = (const char *)H5HL_offset_into(udata->common.f, udata->heap, ent->name_off); + name = (const char *)H5HL_offset_into(udata->heap, ent->name_off); HDassert(name); /* Convert the entry to a link */ - if(H5G_ent_to_link(udata->common.f, udata->lnk, udata->heap, ent, name) < 0) + if(H5G_ent_to_link(udata->lnk, udata->heap, ent, name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link") udata->found = TRUE; @@ -926,10 +924,10 @@ herr_t H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n, H5O_link_t *lnk, hid_t dxpl_id) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - H5G_bt_it_lbi_t udata; /* Iteration information */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + H5G_bt_it_lbi_t udata; /* Iteration information */ H5O_stab_t stab; /* Symbol table message */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_lookup_by_idx, FAIL) @@ -958,7 +956,6 @@ H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n, } /* end if */ /* Set iteration information */ - udata.common.f = grp_oloc->file; udata.common.idx = n; udata.common.num_objs = 0; udata.common.op = H5G_stab_lookup_by_idx_cb; @@ -976,7 +973,7 @@ H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n, done: /* Release resources */ - if(heap && H5HL_unprotect(grp_oloc->file, dxpl_id, heap, stab.heap_addr) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) @@ -1051,7 +1048,7 @@ H5G_stab_valid(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5O_stab_t *alt_stab) done: /* Release resources */ - if(heap && H5HL_unprotect(grp_oloc->file, dxpl_id, heap, stab.heap_addr) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) @@ -1098,7 +1095,7 @@ H5G_stab_get_type_by_idx_cb(const H5G_entry_t *ent, void *_udata) H5O_type_t obj_type; /* Type of object at location */ /* Build temporary object location */ - tmp_oloc.file = udata->common.f; + tmp_oloc.file = udata->f; HDassert(H5F_addr_defined(ent->header)); tmp_oloc.addr = ent->header; @@ -1147,10 +1144,10 @@ H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address") /* Set iteration information */ - udata.common.f = oloc->file; udata.common.idx = idx; udata.common.num_objs = 0; udata.common.op = H5G_stab_get_type_by_idx_cb; + udata.f = oloc->file; udata.dxpl_id = dxpl_id; udata.type = H5G_UNKNOWN; diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 26de267..62c6bab 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -616,7 +616,7 @@ H5G_verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) done: /* Release resources */ - if(heap && H5HL_unprotect(grp_oloc->file, H5AC_ind_dxpl_id, heap, stab.heap_addr) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5HF.c b/src/H5HF.c index 539a14f..0856d89 100644 --- a/src/H5HF.c +++ b/src/H5HF.c @@ -785,7 +785,7 @@ H5HF_close(H5HF_t *fh, hid_t dxpl_id) { hbool_t pending_delete = FALSE; /* Whether the heap is pending deletion */ haddr_t heap_addr = HADDR_UNDEF; /* Address of heap (for deletion) */ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HF_close, FAIL) diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 6669853..f96e876 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -250,7 +250,6 @@ H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable) * Purpose: Loads a fractal heap header from the disk. * * Return: Success: Pointer to a new fractal heap - * * Failure: NULL * * Programmer: Quincey Koziol @@ -274,9 +273,6 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud H5HF_hdr_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_hdr_load) -#ifdef QAK -HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr); -#endif /* QAK */ /* Check arguments */ HDassert(f); @@ -352,7 +348,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr); /* Sanity check */ /* (allow for checksum not decoded yet) */ - HDassert((size_t)(p - buf) == (size - H5HF_SIZEOF_CHKSUM)); + HDassert((size_t)(p - (const uint8_t *)buf) == (size - H5HF_SIZEOF_CHKSUM)); /* Check for I/O filter information to decode */ if(hdr->filter_len > 0) { @@ -361,7 +357,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 = (size_t)(p - buf); + filter_info_off = (size_t)(p - (const uint8_t *)buf); /* Compute the size of the extra filter information */ filter_info_size = (size_t)(hdr->sizeof_size /* Size of size for filtered root direct block */ @@ -407,13 +403,13 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr); /* Compute checksum on entire header */ /* (including the filter information, if present) */ - computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0); + computed_chksum = H5_checksum_metadata(buf, (size_t)(p - (const uint8_t *)buf), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); /* Sanity check */ - HDassert((size_t)(p - buf) == hdr->heap_size); + HDassert((size_t)(p - (const uint8_t *)buf) == hdr->heap_size); /* Verify checksum */ if(stored_chksum != computed_chksum) @@ -422,9 +418,6 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr); /* Finish initialization of heap header */ if(H5HF_hdr_finish_init(hdr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't finish initializing shared fractal heap header") -#ifdef QAK -HDfprintf(stderr, "%s: hdr->fspace = %p\n", FUNC, hdr->fspace); -#endif /* QAK */ /* Set return value */ ret_value = hdr; @@ -451,11 +444,6 @@ done: * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu * Feb 24 2006 - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. * *------------------------------------------------------------------------- */ @@ -467,9 +455,6 @@ H5HF_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5H herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_hdr_flush) -#ifdef QAK -HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy); -#endif /* QAK */ /* check arguments */ HDassert(f); @@ -685,7 +670,7 @@ H5HF_cache_hdr_size(const H5F_t UNUSED *f, const H5HF_hdr_t *hdr, size_t *size_p { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_hdr_size) - /* check arguments */ + /* Check arguments */ HDassert(f); HDassert(hdr); HDassert(size_ptr); @@ -730,9 +715,6 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrows H5HF_indirect_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_iblock_load) -#ifdef QAK -HDfprintf(stderr, "%s: Load indirect block, addr = %a\n", FUNC, addr); -#endif /* QAK */ /* Check arguments */ HDassert(f); @@ -858,22 +840,19 @@ HDfprintf(stderr, "%s: Load indirect block, addr = %a\n", FUNC, addr); iblock->nchildren++; iblock->max_child = u; } /* end if */ -#ifdef QAK -HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].addr); -#endif /* QAK */ } /* end for */ /* Sanity check */ HDassert(iblock->nchildren); /* indirect blocks w/no children should have been deleted */ /* Compute checksum on indirect block */ - computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0); + computed_chksum = H5_checksum_metadata(buf, (size_t)(p - (const uint8_t *)buf), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); /* Sanity check */ - HDassert((size_t)(p - buf) == iblock->size); + HDassert((size_t)(p - (const uint8_t *)buf) == iblock->size); /* Verify checksum */ if(stored_chksum != computed_chksum) @@ -918,12 +897,6 @@ done: * koziol@ncsa.uiuc.edu * Mar 6 2006 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * *------------------------------------------------------------------------- */ static herr_t @@ -934,9 +907,6 @@ H5HF_cache_iblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_iblock_flush) -#ifdef QAK -HDfprintf(stderr, "%s: Flushing indirect block, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy); -#endif /* QAK */ /* check arguments */ HDassert(f); @@ -956,12 +926,6 @@ HDfprintf(stderr, "%s: Flushing indirect block, addr = %a, destroy = %u\n", FUNC /* Get the pointer to the shared heap header */ hdr = iblock->hdr; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -HDfprintf(stderr, "%s: iblock->size = %Zu\n", FUNC, iblock->size); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -HDfprintf(stderr, "%s: hdr->man_dtable.cparam.width = %u\n", FUNC, hdr->man_dtable.cparam.width); -#endif /* QAK */ /* Set the shared heap header's file context for this operation */ hdr->f = f; @@ -992,9 +956,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.width = %u\n", FUNC, hdr->man_dtab /* Encode indirect block-specific fields */ for(u = 0; u < (iblock->nrows * hdr->man_dtable.cparam.width); u++) { -#ifdef QAK -HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].addr); -#endif /* QAK */ /* Encode child block address */ H5F_addr_encode(f, &p, iblock->ents[u].addr); @@ -1005,9 +966,6 @@ HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].add /* Encode extra information for direct blocks */ if(u < (hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width)) { -#ifdef QAK -HDfprintf(stderr, "%s: iblock->filt_ents[%Zu] = {%Zu, %x}\n", FUNC, u, iblock->filt_ents[u].size, iblock->filt_ents[u].filter_mask); -#endif /* QAK */ /* Sanity check */ /* (either both the address & size are defined or both are * not defined) @@ -1048,9 +1006,6 @@ HDfprintf(stderr, "%s: iblock->filt_ents[%Zu] = {%Zu, %x}\n", FUNC, u, iblock->f /* 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)); @@ -1144,9 +1099,6 @@ H5HF_cache_iblock_dest(H5F_t *f, H5HF_indirect_t *iblock) HDassert(iblock); HDassert(iblock->rc == 0); HDassert(iblock->hdr); -#ifdef QAK -HDfprintf(stderr, "%s: Destroying indirect block\n", FUNC); -#endif /* QAK */ /* If we're going to free the space on disk, the address must be valid */ HDassert(!iblock->cache_info.free_file_space_on_destroy || H5F_addr_defined(iblock->cache_info.addr)); @@ -1246,7 +1198,7 @@ H5HF_cache_iblock_size(const H5F_t UNUSED *f, const H5HF_indirect_t *iblock, siz { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_iblock_size) - /* check arguments */ + /* Check arguments */ HDassert(iblock); HDassert(size_ptr); @@ -1312,7 +1264,7 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size, /* Allocate block buffer */ /* XXX: Change to using free-list factories */ - if((dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size)) == NULL) + if(NULL == (dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Check for I/O filters on this heap */ @@ -1325,10 +1277,6 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size, /* Check for root direct block */ if(par_info->iblock == NULL) { -#ifdef QAK -HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu, hdr->pline_root_direct_filter_mask = %x\n", FUNC, hdr->pline_root_direct_size, hdr->pline_root_direct_filter_mask); -HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr->man_dtable.table_addr, addr); -#endif /* QAK */ /* Sanity check */ HDassert(H5F_addr_eq(hdr->man_dtable.table_addr, addr)); @@ -1337,11 +1285,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr- filter_mask = hdr->pline_root_direct_filter_mask; } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: par_info->iblock = %p, par_info->entry = %u\n", FUNC, par_info->iblock, par_info->entry); -HDfprintf(stderr, "%s: par_info->iblock->filt_ents[%u].size = %Zu, par_info->iblock->filt_ents[%u].filter_mask = %x\n", FUNC, par_info->entry, par_info->iblock->filt_ents[par_info->entry].size, par_info->entry, par_info->iblock->filt_ents[par_info->entry].filter_mask); -HDfprintf(stderr, "%s: par_info->iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_info->entry, par_info->iblock->ents[par_info->entry].addr, addr); -#endif /* QAK */ /* Sanity check */ HDassert(H5F_addr_eq(par_info->iblock->ents[par_info->entry].addr, addr)); @@ -1353,9 +1296,6 @@ HDfprintf(stderr, "%s: par_info->iblock->ents[%u].addr = %a, addr = %a\n", FUNC, /* Allocate buffer to perform I/O filtering on */ if(NULL == (read_buf = H5MM_malloc(read_size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for pipeline buffer") -#ifdef QAK -HDfprintf(stderr, "%s: read_size = %Zu, read_buf = %p\n", FUNC, read_size, read_buf); -#endif /* QAK */ /* Read filtered direct block from disk */ if(H5F_block_read(f, H5FD_MEM_FHEAP_DBLOCK, addr, read_size, dxpl_id, read_buf) < 0) @@ -1363,12 +1303,8 @@ HDfprintf(stderr, "%s: read_size = %Zu, read_buf = %p\n", FUNC, read_size, read_ /* Push direct block data through I/O filter pipeline */ nbytes = read_size; - if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, - filter_cb, &nbytes, &read_size, &read_buf) < 0) + if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &read_size, &read_buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, NULL, "output pipeline failed") -#ifdef QAK -HDfprintf(stderr, "%s: nbytes = %Zu, read_size = %Zu, read_buf = %p\n", FUNC, nbytes, read_size, read_buf); -#endif /* QAK */ /* Sanity check */ HDassert(nbytes == dblock->size); @@ -1414,7 +1350,7 @@ HDfprintf(stderr, "%s: nbytes = %Zu, read_size = %Zu, read_buf = %p\n", FUNC, nb /* Offset of heap within the heap's address space */ UINT64DECODE_VAR(p, dblock->block_off, hdr->heap_off_size); - /* Encode checksum on direct block, if requested */ + /* Decode checksum on direct block, if requested */ if(hdr->checksum_dblocks) { uint32_t stored_chksum; /* Metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ @@ -1459,12 +1395,6 @@ done: * koziol@ncsa.uiuc.edu * Feb 27 2006 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * *------------------------------------------------------------------------- */ static herr_t @@ -1539,15 +1469,8 @@ H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, /* Push direct block data through I/O filter pipeline */ nbytes = write_size; - if(H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_ENABLE_EDC, - filter_cb, &nbytes, &write_size, &write_buf) < 0) + if(H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &write_size, &write_buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "output pipeline failed") -#ifdef QAK -HDfprintf(stderr, "%s: nbytes = %Zu, write_size = %Zu, write_buf = %p\n", FUNC, nbytes, write_size, write_buf); -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -HDfprintf(stderr, "%s: dblock->size = %Zu, dblock->blk = %p\n", FUNC, dblock->size, dblock->blk); -HDfprintf(stderr, "%s: dblock->parent = %p, dblock->par_entry = %u\n", FUNC, dblock->parent, dblock->par_entry); -#endif /* QAK */ /* Use the compressed number of bytes as the size to write */ write_size = nbytes; @@ -1556,10 +1479,6 @@ HDfprintf(stderr, "%s: dblock->parent = %p, dblock->par_entry = %u\n", FUNC, dbl if(dblock->parent == NULL) { hbool_t hdr_changed = FALSE; /* Whether the header information changed */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu, hdr->pline_root_direct_filter_mask = %x\n", FUNC, hdr->pline_root_direct_size, hdr->pline_root_direct_filter_mask); -HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr->man_dtable.table_addr, addr); -#endif /* QAK */ /* Sanity check */ HDassert(H5F_addr_eq(hdr->man_dtable.table_addr, addr)); HDassert(hdr->pline_root_direct_size > 0); @@ -1572,9 +1491,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr- /* Check if we need to re-size the block on disk */ 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 */ /* 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) { @@ -1614,10 +1530,6 @@ HDfprintf(stderr, "%s: Need to re-allocate root direct block!\n", FUNC); par_iblock = dblock->parent; par_entry = dblock->par_entry; -#ifdef QAK -HDfprintf(stderr, "%s: par_iblock->filt_ents[%u].size = %Zu, par_iblock->filt_ents[%u].filter_mask = %x\n", FUNC, par_entry, par_iblock->filt_ents[par_entry].size, par_entry, par_iblock->filt_ents[par_entry].filter_mask); -HDfprintf(stderr, "%s: par_iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_entry, par_iblock->ents[par_entry].addr, addr); -#endif /* QAK */ /* Sanity check */ HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, addr)); HDassert(par_iblock->filt_ents[par_entry].size > 0); @@ -1630,9 +1542,6 @@ HDfprintf(stderr, "%s: par_iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_e /* Check if we need to re-size the block on disk */ 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 */ /* 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) { @@ -1670,9 +1579,6 @@ HDfprintf(stderr, "%s: Need to re-allocate non-root direct block!\n", FUNC); /* 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 */ @@ -1732,9 +1638,6 @@ HDfprintf(stderr, "%s: Re-allocating direct block in temporary space - addr = %a 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); -#endif /* QAK */ if(H5F_block_write(f, H5FD_MEM_FHEAP_DBLOCK, addr, write_size, dxpl_id, write_buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFLUSH, FAIL, "unable to save fractal heap direct block to disk") @@ -1778,9 +1681,6 @@ H5HF_cache_dblock_dest(H5F_t *f, H5HF_direct_t *dblock) * Check arguments. */ HDassert(dblock); -#ifdef QAK -HDfprintf(stderr, "%s: Destroying direct block, dblock = %p\n", FUNC, dblock); -#endif /* QAK */ /* If we're going to free the space on disk, the address must be valid */ HDassert(!dblock->cache_info.free_file_space_on_destroy || H5F_addr_defined(dblock->cache_info.addr)); diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index e0a1069..027146c 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -158,9 +158,6 @@ HDmemset(dblock->blk, 0, dblock->size); if(HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)dblock->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: direct block address = %a\n", FUNC, dblock_addr); -#endif /* QAK */ /* Attach to parent indirect block, if there is one */ dblock->parent = par_iblock; @@ -231,11 +228,6 @@ H5HF_man_dblock_destroy(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_direct_t *dblock, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_destroy) -#ifdef QAK -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size); -HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); -#endif /* QAK */ /* * Check arguments. @@ -266,9 +258,6 @@ HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); /* Check for root direct block */ if(hdr->man_dtable.curr_root_rows == 0) { -#ifdef QAK -HDfprintf(stderr, "%s: root direct block\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(hdr->man_dtable.table_addr == dblock_addr); HDassert(hdr->man_dtable.cparam.start_block_size == dblock->size); @@ -284,25 +273,11 @@ HDfprintf(stderr, "%s: root direct block\n", FUNC); HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty") } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: root indirect block\n", FUNC); -#endif /* QAK */ - /* Adjust heap statistics */ hdr->man_alloc_size -= dblock->size; -#ifdef QAK -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size); -HDfprintf(stderr, "%s: dblock->parent->nchildren = %u\n", FUNC, dblock->parent->nchildren); -HDfprintf(stderr, "%s: dblock->par_entry = %u\n", FUNC, dblock->par_entry); -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -#endif /* QAK */ /* Check for this direct block being the highest in the heap */ if((dblock->block_off + dblock->size) == hdr->man_iter_off) { -#ifdef QAK -HDfprintf(stderr, "%s: Reversing iterator\n", FUNC); -#endif /* QAK */ /* Move 'next block' iterator backwards (may shrink heap) */ if(H5HF_hdr_reverse_iter(hdr, dxpl_id, dblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reverse 'next block' iterator") @@ -323,16 +298,14 @@ HDfprintf(stderr, "%s: Reversing iterator\n", FUNC); #endif /* 0 */ /* Detach from parent indirect block */ - if(H5HF_man_iblock_detach(dblock->parent, dxpl_id, dblock->par_entry) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block") - dblock->parent = NULL; - dblock->par_entry = 0; + if(dblock->parent) { + if(H5HF_man_iblock_detach(dblock->parent, dxpl_id, dblock->par_entry) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block"); + dblock->parent = NULL; + dblock->par_entry = 0; + } /* end if */ } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: Before releasing direct block's space, dblock_addr = %a, dblock_size = %Hu\n", FUNC, dblock_addr, dblock_size); -#endif /* QAK */ - /* Indicate that the indirect block should be deleted & file space freed */ dblock->file_size = dblock_size; cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; @@ -369,9 +342,6 @@ H5HF_man_dblock_new(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t request, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_new) -#ifdef QAK -HDfprintf(stderr, "%s: request = %Zu\n", FUNC, request); -#endif /* QAK */ /* * Check arguments. @@ -388,15 +358,8 @@ HDfprintf(stderr, "%s: request = %Zu\n", FUNC, request); } /* end else */ /* Adjust the size of block needed to fulfill request, with overhead */ -#ifdef QAK -HDfprintf(stderr, "%s: Check 1 - min_dblock_size = %Zu\n", FUNC, min_dblock_size); -HDfprintf(stderr, "%s: H5HF_MAN_ABS_DIRECT_OVERHEAD= %u\n", FUNC, H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)); -#endif /* QAK */ if((min_dblock_size - request) < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)) min_dblock_size *= 2; -#ifdef QAK -HDfprintf(stderr, "%s: Check 2 - min_dblock_size = %Zu\n", FUNC, min_dblock_size); -#endif /* QAK */ /* Check if this is the first block in the heap */ if(!H5F_addr_defined(hdr->man_dtable.table_addr) && @@ -405,10 +368,6 @@ HDfprintf(stderr, "%s: Check 2 - min_dblock_size = %Zu\n", FUNC, min_dblock_size if(H5HF_man_dblock_create(dxpl_id, hdr, NULL, 0, &dblock_addr, ret_sec_node) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block") -#ifdef QAK -HDfprintf(stderr, "%s: root direct block, dblock_addr = %a\n", FUNC, dblock_addr); -#endif /* QAK */ - /* Point root at new direct block */ hdr->man_dtable.curr_root_rows = 0; hdr->man_dtable.table_addr = dblock_addr; @@ -428,16 +387,10 @@ HDfprintf(stderr, "%s: root direct block, dblock_addr = %a\n", FUNC, dblock_addr unsigned next_entry; /* Iterator's next block entry */ size_t next_size; /* Size of next direct block to create */ -#ifdef QAK -HDfprintf(stderr, "%s: before updating iterator, hdr->man_iter_off = %Hu, hdr->man_size = %Hu\n", FUNC, hdr->man_iter_off, hdr->man_size); -#endif /* QAK */ /* Update iterator to reflect any previous increments as well as allow for requested direct block size */ if(H5HF_hdr_update_iter(hdr, dxpl_id, min_dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUPDATE, FAIL, "unable to update block iterator") -#ifdef QAK -HDfprintf(stderr, "%s: after updating iterator, hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -#endif /* QAK */ /* Retrieve information about current iterator position */ if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") @@ -454,18 +407,9 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "skipping direct block sizes not su if(H5HF_hdr_inc_iter(hdr, (hsize_t)next_size, 1) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment 'next block' iterator") -#ifdef QAK -HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock); -HDfprintf(stderr, "%s: iblock->addr = %a\n", FUNC, iblock->addr); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -#endif /* QAK */ - /* Create new direct block at current location*/ if(H5HF_man_dblock_create(dxpl_id, hdr, iblock, next_entry, &dblock_addr, ret_sec_node) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block") -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); -#endif /* QAK */ } /* end else */ done: @@ -492,14 +436,11 @@ H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr, size_t dblock_size, H5HF_indirect_t *par_iblock, unsigned par_entry, H5AC_protect_t rw) { - H5HF_parent_t par_info; /* Parent info for loading block */ - H5HF_direct_t *dblock; /* Direct block from cache */ - H5HF_direct_t *ret_value; /* Return value */ + H5HF_parent_t par_info; /* Parent info for loading block */ + H5HF_direct_t *dblock; /* Direct block from cache */ + H5HF_direct_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_protect) -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Zu\n", FUNC, dblock_addr, dblock_size); -#endif /* QAK */ /* * Check arguments. @@ -551,9 +492,6 @@ H5HF_man_dblock_locate(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_locate) -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu\n", FUNC, obj_off); -#endif /* QAK */ /* * Check arguments. @@ -566,15 +504,9 @@ HDfprintf(stderr, "%s: obj_off = %Hu\n", FUNC, obj_off); /* Look up row & column for object */ if(H5HF_dtable_lookup(&hdr->man_dtable, obj_off, &row, &col) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object") -#ifdef QAK -HDfprintf(stderr, "%s: row = %u, col = %u\n", FUNC, row, col); -#endif /* QAK */ /* Set initial indirect block info */ iblock_addr = hdr->man_dtable.table_addr; -#ifdef QAK -HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr); -#endif /* QAK */ /* Lock root indirect block */ if(NULL == (iblock = H5HF_man_iblock_protect(hdr, dxpl_id, iblock_addr, hdr->man_dtable.curr_root_rows, NULL, 0, FALSE, rw, &did_protect))) @@ -593,9 +525,6 @@ HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr); /* Compute indirect block's entry */ entry = (row * hdr->man_dtable.cparam.width) + col; -#ifdef QAK -HDfprintf(stderr, "%s: entry = %Zu\n", FUNC, entry); -#endif /* QAK */ /* Locate child indirect block */ iblock_addr = iblock->ents[entry].addr; @@ -620,18 +549,11 @@ HDfprintf(stderr, "%s: entry = %Zu\n", FUNC, entry); /* Switch variables to use new indirect block */ iblock = new_iblock; did_protect = new_did_protect; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->addr = %a\n", FUNC, iblock->addr); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -#endif /* QAK */ /* Look up row & column in new indirect block for object */ if(H5HF_dtable_lookup(&hdr->man_dtable, (obj_off - iblock->block_off), &row, &col) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object") HDassert(row < iblock->nrows); /* child must be smaller than parent */ -#ifdef QAK -HDfprintf(stderr, "%s: row = %u, col = %u\n", FUNC, row, col); -#endif /* QAK */ } /* end while */ /* Set return parameters */ @@ -671,9 +593,6 @@ H5HF_man_dblock_delete(H5F_t *f, hid_t dxpl_id, haddr_t dblock_addr, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_delete) -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Hu\n", FUNC, dblock_addr, dblock_size); -#endif /* QAK */ /* * Check arguments. @@ -691,15 +610,9 @@ HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Hu\n", FUNC, dblock_addr HDassert(!(dblock_status & H5AC_ES__IS_PINNED)); HDassert(!(dblock_status & H5AC_ES__IS_PROTECTED)); -#ifdef QAK -HDfprintf(stderr, "%s: Expunging direct block from cache\n", FUNC); -#endif /* QAK */ /* Evict the direct block from the metadata cache */ if(H5AC_expunge_entry(f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "unable to remove direct block from cache") -#ifdef QAK -HDfprintf(stderr, "%s: Done expunging direct block from cache\n", FUNC); -#endif /* QAK */ } /* end if */ /* Check if the direct block is NOT currently allocated in temp. file space */ diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index c326a59..8652f90 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -132,10 +132,6 @@ H5HF_hdr_alloc(H5F_t *f) ret_value = hdr; done: - if(!ret_value && hdr) - if(H5HF_hdr_free(hdr) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to release fractal heap header") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_hdr_alloc() */ @@ -271,12 +267,6 @@ H5HF_hdr_finish_init_phase2(H5HF_hdr_t *hdr) else if(H5HF_hdr_compute_free_space(hdr, u) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize direct block free space for indirect block") -#ifdef QAK -HDfprintf(stderr, "%s: row_block_size[%Zu] = %Hu\n", FUNC, u, hdr->man_dtable.row_block_size[u]); -HDfprintf(stderr, "%s: row_block_off[%Zu] = %Hu\n", FUNC, u, hdr->man_dtable.row_block_off[u]); -HDfprintf(stderr, "%s: row_tot_dblock_free[%Zu] = %Hu\n", FUNC, u, hdr->man_dtable.row_tot_dblock_free[u]); -HDfprintf(stderr, "%s: row_max_dblock_free[%Zu] = %Zu\n", FUNC, u, hdr->man_dtable.row_max_dblock_free[u]); -#endif /* QAK */ } /* end for */ /* Initialize the block iterator for searching for free space */ @@ -444,9 +434,6 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) /* Compute the I/O filters' encoded size */ if(0 == (hdr->filter_len = H5O_msg_raw_size(hdr->f, H5O_PLINE_ID, FALSE, &(hdr->pline)))) HGOTO_ERROR(H5E_HEAP, H5E_CANTGETSIZE, HADDR_UNDEF, "can't get I/O filter pipeline size") -#ifdef QAK -HDfprintf(stderr, "%s: hdr->filter_len = %u\n", FUNC, hdr->filter_len); -#endif /* QAK */ /* Compute size of header on disk */ hdr->heap_size = H5HF_HEADER_SIZE(hdr) /* Base header size */ @@ -496,9 +483,6 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", FUNC, hdr->filter_len); hdr->id_len = cparam->id_len; break; } /* end switch */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->id_len = %Zu\n", FUNC, hdr->id_len); -#endif /* QAK */ /* Second phase of header final initialization */ /* (needs ID and filter lengths set up) */ @@ -556,7 +540,7 @@ H5HF_hdr_incr(H5HF_hdr_t *hdr) /* Mark header as un-evictable when a block is depending on it */ if(hdr->rc == 0) - if(H5AC_pin_protected_entry(hdr->f, hdr) < 0) + if(H5AC_pin_protected_entry(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin fractal heap header") /* Increment reference count on shared header */ @@ -597,7 +581,7 @@ H5HF_hdr_decr(H5HF_hdr_t *hdr) /* Mark header as evictable again when no child blocks depend on it */ if(hdr->rc == 0) { HDassert(hdr->file_rc == 0); - if(H5AC_unpin_entry(hdr->f, hdr) < 0) + if(H5AC_unpin_entry(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header") } /* end if */ @@ -682,15 +666,12 @@ H5HF_hdr_dirty(H5HF_hdr_t *hdr) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_dirty) -#ifdef QAK -HDfprintf(stderr, "%s: Marking heap header as dirty\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(hdr); /* Mark header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(hdr->f, hdr) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark fractal heap header as dirty") done: @@ -717,9 +698,6 @@ H5HF_hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_adj_free) -#ifdef QAK -HDfprintf(stderr, "%s: amt = %Zd\n", FUNC, amt); -#endif /* QAK */ /* * Check arguments. @@ -729,9 +707,6 @@ HDfprintf(stderr, "%s: amt = %Zd\n", FUNC, amt); /* Update heap header */ HDassert(amt > 0 || hdr->total_man_free >= (hsize_t)-amt); hdr->total_man_free += amt; -#ifdef QAK -HDfprintf(stderr, "%s: hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free); -#endif /* QAK */ /* Mark heap header as modified */ if(H5HF_hdr_dirty(hdr) < 0) @@ -766,12 +741,6 @@ H5HF_hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free) * Check arguments. */ HDassert(hdr); -#ifdef QAK -HDfprintf(stderr, "%s; new_size = %Hu, extra_free = %Hd\n", FUNC, new_size, extra_free); -HDfprintf(stderr, "%s; hdr->total_size = %Hu\n", FUNC, hdr->total_size); -HDfprintf(stderr, "%s; hdr->man_size = %Hu\n", FUNC, hdr->man_size); -HDfprintf(stderr, "%s; hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free); -#endif /* QAK */ /* Set the total managed space in heap */ hdr->man_size = new_size; @@ -814,9 +783,6 @@ H5HF_hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size) /* Update the "allocated" size within the heap */ hdr->man_alloc_size += alloc_size; -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_alloc_size = %Hu\n", "H5HF_hdr_inc_alloc", hdr->man_alloc_size); -#endif /* QAK */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF_hdr_inc_alloc() */ @@ -890,9 +856,6 @@ H5HF_hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") /* Set the offset of the iterator in the heap */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu, curr_off = %Hu\n", FUNC, hdr->man_iter_off, curr_off); -#endif /* QAK */ hdr->man_iter_off = curr_off; done: @@ -922,9 +885,6 @@ H5HF_hdr_skip_blocks(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_indirect_t *iblock, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_skip_blocks) -#ifdef QAK -HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, nentries); -#endif /* QAK */ /* * Check arguments. @@ -937,17 +897,11 @@ HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, ne row = start_entry / hdr->man_dtable.cparam.width; col = start_entry % hdr->man_dtable.cparam.width; sect_size = H5HF_dtable_span_size(&hdr->man_dtable, row, col, nentries); -#ifdef QAK -HDfprintf(stderr, "%s: Check 1.0 - hdr->man_iter_off = %Hu, sect_size = %Hu\n", FUNC, hdr->man_iter_off, sect_size); -#endif /* QAK */ HDassert(sect_size > 0); /* Advance the new block iterator */ if(H5HF_hdr_inc_iter(hdr, sect_size, nentries) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't increase allocated heap size") -#ifdef QAK -HDfprintf(stderr, "%s: Check 2.0 - hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -#endif /* QAK */ /* Add 'indirect' section for blocks skipped in this row */ if(H5HF_sect_indirect_add(hdr, dxpl_id, iblock, start_entry, nentries) < 0) @@ -980,9 +934,6 @@ H5HF_hdr_update_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_size) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_update_iter) -#ifdef QAK -HDfprintf(stderr, "%s: min_dblock_size = %Zu\n", FUNC, min_dblock_size); -#endif /* QAK */ /* * Check arguments. @@ -992,9 +943,6 @@ HDfprintf(stderr, "%s: min_dblock_size = %Zu\n", FUNC, min_dblock_size); /* Check for creating first indirect block */ if(hdr->man_dtable.curr_root_rows == 0) { -#ifdef QAK -HDfprintf(stderr, "%s: Creating root direct block\n", FUNC); -#endif /* QAK */ if(H5HF_man_iblock_root_create(hdr, dxpl_id, min_dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "unable to create root indirect block") } /* end if */ @@ -1005,21 +953,11 @@ HDfprintf(stderr, "%s: Creating root direct block\n", FUNC); unsigned next_entry; /* Iterator's next block entry */ unsigned min_dblock_row; /* Minimum row for direct block size request */ -#ifdef QAK -HDfprintf(stderr, "%s: searching root indirect block\n", FUNC); -#endif /* QAK */ /* Compute min. row for direct block requested */ min_dblock_row = H5HF_dtable_size_to_row(&hdr->man_dtable, min_dblock_size); -#ifdef QAK -HDfprintf(stderr, "%s: min_dblock_size = %Zu, min_dblock_row = %u\n", FUNC, min_dblock_size, min_dblock_row); -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -#endif /* QAK */ /* Initialize block iterator, if necessary */ if(!H5HF_man_iter_ready(&hdr->next_block)) { -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -#endif /* QAK */ /* Start iterator with previous offset of iterator */ if(H5HF_man_iter_start_offset(hdr, dxpl_id, &hdr->next_block, hdr->man_iter_off) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to set block iterator location") @@ -1029,14 +967,6 @@ HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") -#ifdef QAK -HDfprintf(stderr, "%s: Check 1.0\n", FUNC); -HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -#endif /* QAK */ /* Check for skipping over blocks in the current block */ if(min_dblock_row > next_row && next_row < iblock->nrows) { unsigned min_entry; /* Min entry for direct block requested */ @@ -1048,9 +978,6 @@ HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); skip_entries = (iblock->nrows * hdr->man_dtable.cparam.width) - next_entry; else skip_entries = min_entry - next_entry; -#ifdef QAK -HDfprintf(stderr, "%s: min_entry = %u, skip_entries = %u\n", FUNC, min_entry, skip_entries); -#endif /* QAK */ /* Add skipped direct blocks to heap's free space */ if(H5HF_hdr_skip_blocks(hdr, dxpl_id, iblock, next_entry, skip_entries) < 0) @@ -1065,33 +992,15 @@ HDfprintf(stderr, "%s: min_entry = %u, skip_entries = %u\n", FUNC, min_entry, sk /* Reset conditions for leaving loop */ walked_up = walked_down = FALSE; -#ifdef QAK -HDfprintf(stderr, "%s: Check 2.0\n", FUNC); -HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -#endif /* QAK */ - /* Check for walking off end of indirect block */ /* (walk up iterator) */ while(next_row >= iblock->nrows) { -#ifdef QAK -HDfprintf(stderr, "%s: Off the end of a block, next_row = %u, iblock->nrows = %u\n", FUNC, next_row, iblock->nrows); -#endif /* QAK */ /* Check for needing to expand root indirect block */ if(iblock->parent == NULL) { -#ifdef QAK -HDfprintf(stderr, "%s: Doubling root block\n", FUNC); -#endif /* QAK */ if(H5HF_man_iblock_root_double(hdr, dxpl_id, min_dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "unable to double root indirect block") } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: Walking up a level\n", FUNC); -#endif /* QAK */ /* Move iterator up one level */ if(H5HF_man_iter_up(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to advance current block iterator location") @@ -1108,36 +1017,16 @@ HDfprintf(stderr, "%s: Walking up a level\n", FUNC); /* Indicate that we walked up */ walked_up = TRUE; } /* end while */ -#ifdef QAK -HDfprintf(stderr, "%s: Check 3.0\n", FUNC); -HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock); -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -#endif /* QAK */ /* Check for walking into child indirect block */ /* (walk down iterator) */ if(next_row >= hdr->man_dtable.max_direct_rows) { unsigned child_nrows; /* Number of rows in new indirect block */ -#ifdef QAK -HDfprintf(stderr, "%s: Walking down into child indirect block\n", FUNC); -#endif /* QAK */ -#ifdef QAK -HDfprintf(stderr, "%s: Check 3.1\n", FUNC); -HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock); -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -#endif /* QAK */ HDassert(!H5F_addr_defined(iblock->ents[next_entry].addr)); /* Compute # of rows in next child indirect block to use */ child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[next_row]); -#ifdef QAK -HDfprintf(stderr, "%s: child_nrows = %u\n", FUNC, child_nrows); -#endif /* QAK */ /* Check for skipping over indirect blocks */ /* (that don't have direct blocks large enough to hold direct block size requested) */ @@ -1145,19 +1034,12 @@ HDfprintf(stderr, "%s: child_nrows = %u\n", FUNC, child_nrows); unsigned child_rows_needed; /* Number of rows needed to hold direct block */ unsigned child_entry; /* Entry of child indirect block */ -#ifdef QAK -HDfprintf(stderr, "%s: Skipping indirect block row that is too small\n", FUNC); -#endif /* QAK */ /* Compute # of rows needed in child indirect block */ child_rows_needed = (H5V_log2_of2((uint32_t)min_dblock_size) - H5V_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size)) + 2; HDassert(child_rows_needed > child_nrows); child_entry = (next_row + (child_rows_needed - child_nrows)) * hdr->man_dtable.cparam.width; if(child_entry > (iblock->nrows * hdr->man_dtable.cparam.width)) child_entry = iblock->nrows * hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: child_rows_needed = %u\n", FUNC, child_rows_needed); -HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry); -#endif /* QAK */ /* Add skipped indirect blocks to heap's free space */ if(H5HF_hdr_skip_blocks(hdr, dxpl_id, iblock, next_entry, (child_entry - next_entry)) < 0) @@ -1168,9 +1050,6 @@ HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry); hbool_t did_protect; /* Whether we protected the indirect block or not */ haddr_t new_iblock_addr; /* New indirect block's address */ -#ifdef QAK -HDfprintf(stderr, "%s: Allocating new child indirect block\n", FUNC); -#endif /* QAK */ /* Allocate new indirect block */ if(H5HF_man_iblock_create(hdr, dxpl_id, iblock, next_entry, child_nrows, child_nrows, &new_iblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap indirect block") @@ -1189,9 +1068,6 @@ HDfprintf(stderr, "%s: Allocating new child indirect block\n", FUNC); /* Compute entry for direct block size requested */ new_entry = hdr->man_dtable.cparam.width * min_dblock_row; -#ifdef QAK -HDfprintf(stderr, "%s: Skipping rows in new child indirect block - new_entry = %u\n", FUNC, new_entry); -#endif /* QAK */ /* Add skipped blocks to heap's free space */ if(H5HF_hdr_skip_blocks(hdr, dxpl_id, new_iblock, 0, new_entry) < 0) @@ -1243,9 +1119,6 @@ H5HF_hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries) */ HDassert(hdr); HDassert(nentries); -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu, adv_size = %Hu\n", FUNC, hdr->man_iter_off, adv_size); -#endif /* QAK */ /* Advance the iterator for the current location within the indirect block */ if(hdr->next_block.curr) @@ -1301,11 +1174,6 @@ H5HF_hdr_reverse_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr) /* Get information about current iterator location */ if(H5HF_man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator information") -#ifdef QAK -HDfprintf(stderr, "%s: iblock->nchildren = %u\n", FUNC, iblock->nchildren); -HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent); -HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); -#endif /* QAK */ /* Move current iterator position backwards once */ curr_entry--; @@ -1321,23 +1189,14 @@ HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); /* Walk backwards through entries, until we find one that has a child */ /* (Skip direct block that will be deleted, if we find it) */ tmp_entry = curr_entry; -#ifdef QAK -HDfprintf(stderr, "%s: tmp_entry = %d\n", FUNC, tmp_entry); -#endif /* QAK */ while(tmp_entry >= 0 && (H5F_addr_eq(iblock->ents[tmp_entry].addr, dblock_addr) || !H5F_addr_defined(iblock->ents[tmp_entry].addr))) tmp_entry--; -#ifdef QAK -HDfprintf(stderr, "%s: check 2.0 - tmp_entry = %d\n", FUNC, tmp_entry); -#endif /* QAK */ /* Check for no earlier blocks in this indirect block */ if(tmp_entry < 0) { /* Check for parent of current indirect block */ if(iblock->parent) { -#ifdef QAK -HDfprintf(stderr, "%s: Walking up a block\n", FUNC); -#endif /* QAK */ /* Move iterator to parent of current block */ if(H5HF_man_iter_up(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to move current block iterator location up") @@ -1345,11 +1204,6 @@ HDfprintf(stderr, "%s: Walking up a block\n", FUNC); /* Get information about current iterator location */ if(H5HF_man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator information") -#ifdef QAK -HDfprintf(stderr, "%s: iblock->nchildren = %u\n", FUNC, iblock->nchildren); -HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent); -HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); -#endif /* QAK */ /* Move current iterator position backwards once */ curr_entry--; @@ -1358,9 +1212,6 @@ HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); walked_up = TRUE; } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: Heap empty\n", FUNC); -#endif /* QAK */ /* Reset iterator offset */ hdr->man_iter_off = 0; @@ -1376,14 +1227,7 @@ HDfprintf(stderr, "%s: Heap empty\n", FUNC); /* Check if entry is for a direct block */ row = curr_entry / hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); -HDfprintf(stderr, "%s: row = %u\n", FUNC, row); -#endif /* QAK */ if(row < hdr->man_dtable.max_direct_rows) { -#ifdef QAK -HDfprintf(stderr, "%s: Found direct block\n", FUNC); -#endif /* QAK */ /* Increment entry to empty location */ curr_entry++; @@ -1395,19 +1239,12 @@ HDfprintf(stderr, "%s: Found direct block\n", FUNC); hdr->man_iter_off = iblock->block_off; hdr->man_iter_off += hdr->man_dtable.row_block_off[curr_entry / hdr->man_dtable.cparam.width]; hdr->man_iter_off += hdr->man_dtable.row_block_size[curr_entry / hdr->man_dtable.cparam.width] * (curr_entry % hdr->man_dtable.cparam.width); -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); -#endif /* QAK */ } /* end if */ else { H5HF_indirect_t *child_iblock; /* Pointer to child indirect block */ hbool_t did_protect; /* Whether we protected the indirect block or not */ unsigned child_nrows; /* # of rows in child block */ -#ifdef QAK -HDfprintf(stderr, "%s: Walking down into child block\n", FUNC); -#endif /* QAK */ /* Compute # of rows in next child indirect block to use */ child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[row]); @@ -1426,11 +1263,6 @@ HDfprintf(stderr, "%s: Walking down into child block\n", FUNC); /* Update iterator location */ iblock = child_iblock; curr_entry = (child_iblock->nrows * hdr->man_dtable.cparam.width) - 1; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->nchildren = %u\n", FUNC, iblock->nchildren); -HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent); -HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); -#endif /* QAK */ /* Unprotect child indirect block */ if(H5HF_man_iblock_unprotect(child_iblock, dxpl_id, H5AC__NO_FLAGS_SET, did_protect) < 0) @@ -1466,18 +1298,12 @@ H5HF_hdr_empty(H5HF_hdr_t *hdr) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_empty) -#ifdef QAK -HDfprintf(stderr, "%s: Resetting heap header to empty\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(hdr); /* Reset block iterator, if necessary */ if(H5HF_man_iter_ready(&hdr->next_block)) { -#ifdef QAK -HDfprintf(stderr, "%s: 'next block' iterator is ready\n", FUNC); -#endif /* QAK */ if(H5HF_man_iter_reset(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") } /* end if */ @@ -1584,9 +1410,6 @@ H5HF_hdr_delete(H5HF_hdr_t *hdr, hid_t dxpl_id) * will get unpinned) */ if(H5F_addr_defined(hdr->fs_addr)) { -#ifdef QAK -HDfprintf(stderr, "%s: hdr->fs_addr = %a\n", FUNC, hdr->fs_addr); -#endif /* QAK */ /* Delete free space manager for heap */ if(H5HF_space_delete(hdr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap free space manager") @@ -1594,18 +1417,12 @@ HDfprintf(stderr, "%s: hdr->fs_addr = %a\n", FUNC, hdr->fs_addr); /* Check for root direct/indirect block */ if(H5F_addr_defined(hdr->man_dtable.table_addr)) { -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a\n", FUNC, hdr->man_dtable.table_addr); -#endif /* QAK */ if(hdr->man_dtable.curr_root_rows == 0) { hsize_t dblock_size; /* Size of direct block */ /* Check for I/O filters on this heap */ if(hdr->filter_len > 0) { dblock_size = (hsize_t)hdr->pline_root_direct_size; -#ifdef QAK -HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu\n", FUNC, hdr->pline_root_direct_size); -#endif /* QAK */ /* Reset the header's pipeline information */ hdr->pline_root_direct_size = 0; @@ -1627,9 +1444,6 @@ HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu\n", FUNC, hdr->pline_ro /* Check for 'huge' objects in heap */ if(H5F_addr_defined(hdr->huge_bt2_addr)) { -#ifdef QAK -HDfprintf(stderr, "%s: hdr->huge_bt2_addr = %a\n", FUNC, hdr->huge_bt2_addr); -#endif /* QAK */ /* Delete huge objects in heap and their tracker */ if(H5HF_huge_delete(hdr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap 'huge' objects and tracker") diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 8969aae..809a720 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -116,7 +116,7 @@ H5HF_iblock_pin(H5HF_indirect_t *iblock) HDassert(iblock); /* Mark block as un-evictable */ - if(H5AC_pin_protected_entry(iblock->hdr->f, iblock) < 0) + if(H5AC_pin_protected_entry(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin fractal heap indirect block") /* If this indirect block has a parent, update it's child iblock pointer */ @@ -200,7 +200,7 @@ H5HF_iblock_unpin(H5HF_indirect_t *iblock) } /* end if */ /* Mark block as evictable again */ - if(H5AC_unpin_entry(iblock->hdr->f, iblock) < 0) + if(H5AC_unpin_entry(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block") done: @@ -239,10 +239,6 @@ H5HF_iblock_incr(H5HF_indirect_t *iblock) /* Increment reference count on shared indirect block */ iblock->rc++; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->addr = %a, iblock->rc = %Zu\n", FUNC, iblock->addr, iblock->rc); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -#endif /* QAK */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -274,23 +270,13 @@ H5HF_iblock_decr(H5HF_indirect_t *iblock) /* Decrement reference count on shared indirect block */ iblock->rc--; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->addr = %a, iblock->rc = %Zu\n", FUNC, iblock->addr, iblock->rc); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -#endif /* QAK */ /* Mark block as evictable again when no child blocks depend on it */ if(iblock->rc == 0) { -#ifdef QAK -HDfprintf(stderr, "%s: indirect block ref. count at zero, iblock->addr = %a\n", FUNC, iblock->addr); -#endif /* QAK */ if(H5HF_iblock_unpin(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block") if(iblock->nchildren == 0) { -#ifdef QAK -HDfprintf(stderr, "%s: Removing indirect block from cache, iblock->addr = %a\n", FUNC, iblock->addr); -#endif /* QAK */ /* Check for deleting root indirect block (and no root direct block) */ if(iblock->block_off == 0 && iblock->hdr->man_dtable.curr_root_rows > 0) { /* Reset root pointer information */ @@ -341,15 +327,12 @@ H5HF_iblock_dirty(H5HF_indirect_t *iblock) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_iblock_dirty) -#ifdef QAK -HDfprintf(stderr, "%s: Marking indirect block as dirty\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(iblock); /* Mark indirect block as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(iblock->hdr->f, iblock) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark fractal heap indirect block as dirty") done: @@ -384,10 +367,6 @@ H5HF_man_iblock_root_create(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_root_create) -#ifdef QAK -HDfprintf(stderr, "%s: Creating root indirect block\n", FUNC); -#endif /* QAK */ - /* Check for allocating entire root indirect block initially */ if(hdr->man_dtable.cparam.start_root_rows == 0) nrows = hdr->man_dtable.max_root_rows; @@ -404,16 +383,10 @@ HDfprintf(stderr, "%s: Creating root indirect block\n", FUNC); if(nrows < rows_needed) nrows = rows_needed; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: nrows = %u\n", FUNC, nrows); -#endif /* QAK */ /* Allocate root indirect block */ if(H5HF_man_iblock_create(hdr, dxpl_id, NULL, 0, nrows, hdr->man_dtable.max_root_rows, &iblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap indirect block") -#ifdef QAK -HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr); -#endif /* QAK */ /* Move current direct block (used as root) into new indirect block */ @@ -423,9 +396,6 @@ HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr); /* Check if there's already a direct block as root) */ have_direct_block = H5F_addr_defined(hdr->man_dtable.table_addr); -#ifdef QAK -HDfprintf(stderr, "%s: have_direct_block = %u\n", FUNC, (unsigned)have_direct_block); -#endif /* QAK */ if(have_direct_block) { H5HF_direct_t *dblock; /* Pointer to direct block to query */ @@ -527,14 +497,10 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si unsigned new_nrows; /* New # of rows */ hbool_t skip_direct_rows = FALSE; /* Whether we are skipping direct rows */ size_t u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_root_double) -#ifdef QAK -HDfprintf(stderr, "%s: Extending root indirect block, min_dblock_size = %Zu\n", FUNC, min_dblock_size); -#endif /* QAK */ - /* Get "new block" iterator information */ if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") @@ -542,19 +508,10 @@ HDfprintf(stderr, "%s: Extending root indirect block, min_dblock_size = %Zu\n", /* Make certain the iterator is at the root indirect block */ HDassert(iblock->parent == NULL); -#ifdef QAK -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -#endif /* QAK */ HDassert(iblock->block_off == 0); /* Keep this for later */ old_nrows = iblock->nrows; -#ifdef QAK -HDfprintf(stderr, "%s: old_nrows = %u\n", FUNC, old_nrows); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row); -HDfprintf(stderr, "%s: next_size = %Hu\n", FUNC, next_size); -#endif /* QAK */ /* Check for skipping over direct block rows */ if(iblock->nrows < hdr->man_dtable.max_direct_rows && min_dblock_size > next_size) { @@ -573,11 +530,6 @@ HDfprintf(stderr, "%s: next_size = %Hu\n", FUNC, next_size); /* Compute new # of rows in indirect block */ new_nrows = MAX(min_nrows, MIN(2 * iblock->nrows, iblock->max_rows)); -#ifdef QAK -HDfprintf(stderr, "%s: min_nrows = %u, new_nrows = %u\n", FUNC, min_nrows, new_nrows); -HDfprintf(stderr, "%s: iblock->nrows = %u, iblock->max_rows = %u\n", FUNC, iblock->nrows, iblock->max_rows); -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) */ @@ -609,9 +561,6 @@ HDfprintf(stderr, "%s: new_next_entry = %u\n", FUNC, new_next_entry); if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->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") } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: Check 1.0 - iblock->addr = %a, new_addr = %a\n", FUNC, iblock->addr, new_addr); -#endif /* QAK */ /* Move object in cache, if it actually was relocated */ if(H5F_addr_ne(iblock->addr, new_addr)) { @@ -691,11 +640,6 @@ HDfprintf(stderr, "%s: Check 1.0 - iblock->addr = %a, new_addr = %a\n", FUNC, ib hdr->man_dtable.table_addr = new_addr; /* Extend heap to cover new root indirect block */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows - 1] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows - 1]); -HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows]); -HDfprintf(stderr, "%s: acc_dblock_free = %Hu\n", FUNC, acc_dblock_free); -#endif /* QAK */ if(H5HF_hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], (hssize_t)acc_dblock_free) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") @@ -736,19 +680,11 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id) HDassert(iblock->parent == NULL); HDassert(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: Reducing root indirect block\n", FUNC); -#endif /* QAK */ - /* Compute maximum row used by child of indirect block */ max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; /* Compute new # of rows in root indirect block */ new_nrows = 1 << (1 + H5V_log2_gen((uint64_t)max_child_row)); -#ifdef QAK -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) */ @@ -786,9 +722,6 @@ HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->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") } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr); -#endif /* QAK */ /* Move object in cache, if it actually was relocated */ if(H5F_addr_ne(iblock->addr, new_addr)) { @@ -834,11 +767,6 @@ HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr); hdr->man_dtable.table_addr = new_addr; /* Shrink heap to only cover new root indirect block */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows - 1] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows - 1]); -HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows]); -HDfprintf(stderr, "%s: acc_dblock_free = %Hu\n", FUNC, acc_dblock_free); -#endif /* QAK */ if(H5HF_hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], -(hssize_t)acc_dblock_free) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce space to cover root direct block") @@ -879,10 +807,6 @@ H5HF_man_iblock_root_revert(H5HF_indirect_t *root_iblock, hid_t dxpl_id) */ HDassert(root_iblock); -#ifdef QAK -HDfprintf(stderr, "%s: Reverting root indirect block\n", FUNC); -#endif /* QAK */ - /* Set up local convenience variables */ hdr = root_iblock->hdr; dblock_addr = root_iblock->ents[0].addr; @@ -972,13 +896,6 @@ H5HF_man_iblock_alloc_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t ** if(NULL == (iblock = H5HF_sect_row_get_iblock(old_sec_node))) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve indirect block for row section") -#ifdef QAK -HDfprintf(stderr, "%s: iblock->addr = %a\n", FUNC, iblock->addr); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent); -HDfprintf(stderr, "%s: iblock->rc = %Zu\n", FUNC, iblock->rc); -#endif /* QAK */ - /* Hold indirect block in memory, until direct block can point to it */ if(H5HF_iblock_incr(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") @@ -989,9 +906,6 @@ HDfprintf(stderr, "%s: iblock->rc = %Zu\n", FUNC, iblock->rc); HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce row section node") /* Create direct block & single section */ -#ifdef QAK -HDfprintf(stderr, "%s: Allocating direct block, dblock_entry = %u\n", FUNC, dblock_entry); -#endif /* QAK */ if(H5HF_man_dblock_create(dxpl_id, hdr, iblock, dblock_entry, NULL, sec_node) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block") @@ -1049,9 +963,6 @@ H5HF_man_iblock_create(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_indirect_t *par_iblo if(H5HF_hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header") -#ifdef QAK -HDfprintf(stderr, "%s: nrows = %u, max_rows = %u\n", FUNC, nrows, max_rows); -#endif /* QAK */ /* Set info for direct block */ iblock->rc = 0; iblock->nrows = nrows; @@ -1074,9 +985,6 @@ HDfprintf(stderr, "%s: nrows = %u, max_rows = %u\n", FUNC, nrows, max_rows); /* Compute the number of direct rows for this indirect block */ dir_rows = MIN(iblock->nrows, hdr->man_dtable.max_direct_rows); -#ifdef QAK -HDfprintf(stderr, "%s: dir_rows = %u\n", FUNC, dir_rows); -#endif /* QAK */ /* Allocate & initialize indirect block filtered entry array */ if(NULL == (iblock->filt_ents = H5FL_SEQ_CALLOC(H5HF_indirect_filt_ent_t, (size_t)(dir_rows * hdr->man_dtable.cparam.width)))) @@ -1147,7 +1055,7 @@ done: /*------------------------------------------------------------------------- * Function: H5HF_man_iblock_protect * - * Purpose: Convenience wrapper around H5AC_protect on a indirect block + * Purpose: Convenience wrapper around H5AC_protect on an indirect block * * Return: Pointer to indirect block on success, NULL on failure * @@ -1168,9 +1076,6 @@ H5HF_man_iblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t iblock_addr, H5HF_indirect_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_protect) -#ifdef QAK -HDfprintf(stderr, "%s: iblock_addr = %a, iblock_nrows = %u\n", FUNC, iblock_addr, iblock_nrows); -#endif /* QAK */ /* * Check arguments. @@ -1241,7 +1146,7 @@ done: /*------------------------------------------------------------------------- * Function: H5HF_man_iblock_unprotect * - * Purpose: Convenience wrapper around H5AC_unprotect on a indirect block + * Purpose: Convenience wrapper around H5AC_unprotect on an indirect block * * Return: SUCCEED/FAIL * @@ -1296,10 +1201,6 @@ H5HF_man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_ad herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_attach) -#ifdef QAK -HDfprintf(stderr, "%s: iblock = %p, entry = %u, child_addr = %a\n", FUNC, iblock, entry, child_addr); -HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC, iblock->block_off, iblock->nchildren); -#endif /* QAK */ /* * Check arguments. @@ -1365,10 +1266,6 @@ H5HF_man_iblock_detach(H5HF_indirect_t *iblock, hid_t dxpl_id, unsigned entry) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_detach) -#ifdef QAK -HDfprintf(stderr, "%s: iblock = %p, entry = %u\n", FUNC, iblock, entry); -HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC, iblock->block_off, iblock->nchildren); -#endif /* QAK */ /* * Check arguments. @@ -1449,10 +1346,6 @@ HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC, HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") done: -#ifdef QAK -HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); -HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC, iblock->block_off, iblock->nchildren); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_man_iblock_detach() */ @@ -1517,9 +1410,6 @@ H5HF_man_iblock_delete(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t iblock_addr, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_delete) -#ifdef QAK -HDfprintf(stderr, "%s: iblock_addr = %a, iblock_nrows = %u\n", FUNC, iblock_addr, iblock_nrows); -#endif /* QAK */ /* * Check arguments. diff --git a/src/H5HFiter.c b/src/H5HFiter.c index e0f7142..a3c61d7 100644 --- a/src/H5HFiter.c +++ b/src/H5HFiter.c @@ -139,9 +139,6 @@ H5HF_man_iter_start_offset(H5HF_hdr_t *hdr, hid_t dxpl_id, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iter_start_offset) -#ifdef QAK -HDfprintf(stderr, "%s: offset = %Hu\n", FUNC, offset); -#endif /* QAK */ /* * Check arguments. @@ -185,19 +182,11 @@ HDfprintf(stderr, "%s: offset = %Hu\n", FUNC, offset); /* Compute column */ H5_CHECK_OVERFLOW((curr_offset / hdr->man_dtable.row_block_size[row]), hsize_t, unsigned); col = (unsigned)(curr_offset / hdr->man_dtable.row_block_size[row]); -#ifdef QAK -HDfprintf(stderr, "%s: row = %u, col = %u\n", FUNC, row, col); -HDfprintf(stderr, "%s: offset = %Hu\n", FUNC, offset); -HDfprintf(stderr, "%s: curr_offset = %Hu\n", FUNC, curr_offset); -#endif /* QAK */ /* Set the current level's context */ biter->curr->row = row; biter->curr->col = col; biter->curr->entry = (row * hdr->man_dtable.cparam.width) + col; -#ifdef QAK -HDfprintf(stderr, "%s: biter->curr->entry = %u\n", FUNC, biter->curr->entry); -#endif /* QAK */ /* Get the context indirect block's information */ if(root_block) { @@ -457,11 +446,6 @@ H5HF_man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries) biter->curr->row = biter->curr->entry / hdr->man_dtable.cparam.width; biter->curr->col = biter->curr->entry % hdr->man_dtable.cparam.width; /* HDassert(biter->curr->row <= biter->curr->context->nrows); */ -#ifdef QAK -HDfprintf(stderr, "%s: biter->curr->entry = %u\n", "H5HF_man_iter_next", biter->curr->entry); -HDfprintf(stderr, "%s: biter->curr->row = %u\n", "H5HF_man_iter_next", biter->curr->row); -HDfprintf(stderr, "%s: biter->curr->col = %u\n", "H5HF_man_iter_next", biter->curr->col); -#endif /* QAK */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF_man_iter_next() */ diff --git a/src/H5HFman.c b/src/H5HFman.c index 3fb0cfb..47478e6 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -117,9 +117,6 @@ H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_insert) -#ifdef QAK -HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); -#endif /* QAK */ /* * Check arguments. @@ -135,9 +132,6 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); /* Look for free space */ if((node_found = H5HF_space_find(hdr, dxpl_id, (hsize_t)obj_size, &sec_node)) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap") -#ifdef QAK -HDfprintf(stderr, "%s: After H5HF_space_find(), node_found = %t\n", FUNC, node_found); -#endif /* QAK */ /* If we didn't find a node, go create a direct block big enough to hold the requested block */ if(!node_found) @@ -148,15 +142,6 @@ HDfprintf(stderr, "%s: After H5HF_space_find(), node_found = %t\n", FUNC, node_f /* Check for row section */ if(sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW || sec_node->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW) { -#ifdef QAK -HDfprintf(stderr, "%s: sec_node->sect_info.addr = %a\n", FUNC, sec_node->sect_info.addr); -HDfprintf(stderr, "%s: sec_node->sect_info.size = %Hu\n", FUNC, sec_node->sect_info.size); -HDfprintf(stderr, "%s: sec_node->sect_info.type = %s\n", FUNC, (sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW ? "H5HF_FSPACE_SECT_FIRST_ROW" : "H5HF_FSPACE_SECT_NORMAL_ROW")); -HDfprintf(stderr, "%s: sec_node->u.row.under = %p\n", FUNC, sec_node->u.row.under); -HDfprintf(stderr, "%s: sec_node->u.row.row = %u\n", FUNC, sec_node->u.row.row); -HDfprintf(stderr, "%s: sec_node->u.row.col = %u\n", FUNC, sec_node->u.row.col); -HDfprintf(stderr, "%s: sec_node->u.row.num_entries = %u\n", FUNC, sec_node->u.row.num_entries); -#endif /* QAK */ /* Allocate 'single' selection out of 'row' selection */ if(H5HF_man_iblock_alloc_row(hdr, dxpl_id, &sec_node) < 0) @@ -174,14 +159,6 @@ HDfprintf(stderr, "%s: sec_node->u.row.num_entries = %u\n", FUNC, sec_node->u.ro /* Retrieve direct block address from section */ if(H5HF_sect_single_dblock_info(hdr, dxpl_id, sec_node, &dblock_addr, &dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information") -#ifdef QAK -HDfprintf(stderr, "%s: sec_node->sect_info.addr = %a\n", FUNC, sec_node->sect_info.addr); -HDfprintf(stderr, "%s: sec_node->sect_info.size = %Hu\n", FUNC, sec_node->sect_info.size); -HDfprintf(stderr, "%s: sec_node->u.single.parent = %p\n", FUNC, sec_node->u.single.parent); -if(sec_node->u.single.parent) - HDfprintf(stderr, "%s: sec_node->u.single.parent->addr = %a\n", FUNC, sec_node->u.single.parent->addr); -HDfprintf(stderr, "%s: sec_node->u.single.par_entry = %u\n", FUNC, sec_node->u.single.par_entry); -#endif /* QAK */ /* Lock direct block */ if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, sec_node->u.single.parent, sec_node->u.single.par_entry, H5AC_WRITE))) @@ -192,16 +169,8 @@ HDfprintf(stderr, "%s: sec_node->u.single.par_entry = %u\n", FUNC, sec_node->u.s /* Get the offset of the object within the block */ H5_CHECK_OVERFLOW((sec_node->sect_info.addr - dblock->block_off), hsize_t, size_t); blk_off = (size_t)(sec_node->sect_info.addr - dblock->block_off); -#ifdef QAK -HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off); -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -#endif /* QAK */ /* Sanity checks */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free); -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -#endif /* QAK */ HDassert(sec_node->sect_info.size >= obj_size); /* Reduce (& possibly re-add) single section */ @@ -224,13 +193,7 @@ HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); } /* end block */ /* Set the heap ID for the new object (heap offset & obj length) */ -#ifdef QAK -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -#endif /* QAK */ H5HF_MAN_ID_ENCODE(id, hdr, (dblock->block_off + blk_off), obj_size); -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, (dblock->block_off + blk_off), obj_size); -#endif /* QAK */ /* Update statistics about heap */ hdr->man_nobjs++; @@ -303,16 +266,8 @@ H5HF_man_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, id++; /* Decode the object offset within the heap & its length */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->heap_off_size = %u, hdr->heap_len_size = %u\n", FUNC, (unsigned)hdr->heap_off_size, (unsigned)hdr->heap_len_size); -#endif /* QAK */ UINT64DECODE_VAR(id, obj_off, hdr->heap_off_size); UINT64DECODE_VAR(id, obj_len, hdr->heap_len_size); -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len); -HDfprintf(stderr, "%s: hdr->man_size = %Hu, hdr->max_man_size = %u\n", FUNC, hdr->man_size, (unsigned)hdr->max_man_size); -HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hdr->man_dtable.cparam.max_direct_size); -#endif /* QAK */ HDassert(obj_off > 0); HDassert(obj_len > 0); @@ -342,9 +297,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hd /* Look up indirect block containing direct block */ if(H5HF_man_dblock_locate(hdr, dxpl_id, obj_off, &iblock, &entry, &did_protect, H5AC_READ) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") -#ifdef QAK -HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[entry].addr); -#endif /* QAK */ /* Set direct block info */ dblock_addr = iblock->ents[entry].addr; @@ -374,9 +326,6 @@ HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[entry].addr); HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") iblock = NULL; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Zu\n", FUNC, dblock_addr, dblock_size); -#endif /* QAK */ /* Compute offset of object within block */ HDassert((obj_off - dblock->block_off) < (hsize_t)dblock_size); @@ -559,16 +508,8 @@ H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) id++; /* Decode the object offset within the heap & it's length */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->heap_off_size = %u, hdr->heap_len_size = %u\n", FUNC, (unsigned)hdr->heap_off_size, (unsigned)hdr->heap_len_size); -#endif /* QAK */ UINT64DECODE_VAR(id, obj_off, hdr->heap_off_size); UINT64DECODE_VAR(id, obj_len, hdr->heap_len_size); -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len); -HDfprintf(stderr, "%s: hdr->man_size = %Hu, hdr->max_man_size = %u\n", FUNC, hdr->man_size, (unsigned)hdr->max_man_size); -HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hdr->man_dtable.cparam.max_direct_size); -#endif /* QAK */ HDassert(obj_off > 0); HDassert(obj_len > 0); @@ -582,24 +523,15 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hd /* Check for root direct block */ if(hdr->man_dtable.curr_root_rows == 0) { -#ifdef QAK -HDfprintf(stderr, "%s: direct root block\n", FUNC); -#endif /* QAK */ /* Set direct block info */ dblock_size = hdr->man_dtable.cparam.start_block_size; dblock_block_off = 0; dblock_entry = 0; } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: indirect root block\n", FUNC); -#endif /* QAK */ /* Look up indirect block containing direct block */ if(H5HF_man_dblock_locate(hdr, dxpl_id, obj_off, &iblock, &dblock_entry, &did_protect, H5AC_WRITE) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") -#ifdef QAK -HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[dblock_entry].addr); -#endif /* QAK */ /* Check for offset of invalid direct block */ if(!H5F_addr_defined(iblock->ents[dblock_entry].addr)) @@ -615,16 +547,10 @@ HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[dblock_entry].a dblock_block_off += hdr->man_dtable.row_block_off[dblock_entry / hdr->man_dtable.cparam.width]; dblock_block_off += hdr->man_dtable.row_block_size[dblock_entry / hdr->man_dtable.cparam.width] * (dblock_entry % hdr->man_dtable.cparam.width); } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: dblock_size = %Zu\n", FUNC, dblock_size); -#endif /* QAK */ /* Compute offset of object within block */ HDassert((obj_off - dblock_block_off) < (hsize_t)dblock_size); blk_off = (size_t)(obj_off - dblock_block_off); -#ifdef QAK -HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off); -#endif /* QAK */ /* Check for object's offset in the direct block prefix information */ if(blk_off < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)) @@ -637,14 +563,6 @@ HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off); /* Create free space section node */ if(NULL == (sec_node = H5HF_sect_single_new(obj_off, obj_len, iblock, dblock_entry))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create section for direct block's free space") -#ifdef QAK -HDfprintf(stderr, "%s: sec_node->sect_info.addr = %a\n", FUNC, sec_node->sect_info.addr); -HDfprintf(stderr, "%s: sec_node->sect_info.size = %Hu\n", FUNC, sec_node->sect_info.size); -HDfprintf(stderr, "%s: sec_node->u.single.parent = %p\n", FUNC, sec_node->u.single.parent); -if(sec_node->u.single.parent) - HDfprintf(stderr, "%s: sec_node->u.single.parent->addr = %a\n", FUNC, sec_node->u.single.parent->addr); -HDfprintf(stderr, "%s: sec_node->u.single.par_entry = %u\n", FUNC, sec_node->u.single.par_entry); -#endif /* QAK */ /* Unlock indirect block */ if(iblock) { diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 91031be..102dc7c 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -490,7 +490,6 @@ H5HF_sect_single_new(hsize_t sect_off, size_t sect_size, H5HF_indirect_t *parent, unsigned par_entry) { H5HF_free_section_t *sect = NULL; /* 'Single' free space section to add */ - hbool_t par_incr = FALSE; /* Indicate that parent iblock has been incremented */ H5HF_free_section_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_single_new) @@ -509,7 +508,6 @@ H5HF_sect_single_new(hsize_t sect_off, size_t sect_size, if(sect->u.single.parent) { if(H5HF_iblock_incr(sect->u.single.parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block") - par_incr = TRUE; } /* end if */ sect->u.single.par_entry = par_entry; @@ -518,13 +516,6 @@ H5HF_sect_single_new(hsize_t sect_off, size_t sect_size, done: if(!ret_value && sect) { - /* Check if we should decrement parent ref. count */ - if(par_incr) { - HDassert(sect->u.single.parent); - if(H5HF_iblock_decr(sect->u.single.parent) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTDEC, NULL, "can't decrement reference count on parent indirect block") - } /* end if */ - /* Release the section */ (void)H5FL_FREE(H5HF_free_section_t, sect); } /* end if */ @@ -814,10 +805,6 @@ H5HF_sect_single_full_dblock(H5HF_hdr_t *hdr, hid_t dxpl_id, HDassert(sect->sect_info.state == H5FS_SECT_LIVE); HDassert(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - /* Retrieve direct block address from section */ if(H5HF_sect_single_dblock_info(hdr, dxpl_id, sect, &dblock_addr, &dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information") @@ -825,18 +812,10 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_ /* Check for section occupying entire direct block */ /* (and not the root direct block) */ dblock_overhead = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: dblock_size = %u\n", FUNC, dblock_size); -HDfprintf(stderr, "%s: dblock_overhead = %Zu\n", FUNC, dblock_overhead); -HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", FUNC, hdr->man_dtable.curr_root_rows); -#endif /* QAK */ if((dblock_size - dblock_overhead) == sect->sect_info.size && hdr->man_dtable.curr_root_rows > 0) { H5HF_direct_t *dblock; /* Pointer to direct block for section */ -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); -#endif /* QAK */ if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, sect->u.single.parent, sect->u.single.par_entry, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block") HDassert(H5F_addr_eq(dblock->block_off + dblock_overhead, sect->sect_info.addr)); @@ -845,11 +824,6 @@ HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); if(H5HF_sect_row_from_single(hdr, sect, dblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCONVERT, FAIL, "can't convert single section into row section") -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out); -#endif /* QAK */ - /* Destroy direct block */ if(H5HF_man_dblock_destroy(hdr, dxpl_id, dblock, dblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release direct block") @@ -895,10 +869,6 @@ H5HF_sect_single_add(H5FS_section_info_t *_sect, unsigned *flags, void *_udata) HDassert(sect); HDassert(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_add", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - /* Check if single section covers entire direct block it's in */ /* (converts to row section possibly) */ if(H5HF_sect_single_full_dblock(hdr, dxpl_id, sect) < 0) @@ -988,11 +958,6 @@ H5HF_sect_single_can_merge(const H5FS_section_info_t *_sect1, HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_can_merge", sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_can_merge", sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - /* Check if second section adjoins first section */ /* (This can only occur within a direct block, due to the direct block * overhead at the beginning of a block, so no need to check if sections @@ -1042,11 +1007,6 @@ H5HF_sect_single_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2, HDassert(sect2->sect_info.type == H5HF_FSPACE_SECT_SINGLE); HDassert(H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr)); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - /* Add second section's size to first section */ sect1->sect_info.size += sect2->sect_info.size; @@ -1100,11 +1060,6 @@ H5HF_sect_single_can_shrink(const H5FS_section_info_t *_sect, void *_udata) /* Check arguments. */ HDassert(sect); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_can_shrink", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", "H5HF_sect_single_can_shrink", hdr->man_dtable.curr_root_rows); -#endif /* QAK */ - /* Check for section occupying entire root direct block */ /* (We shouldn't ever have a single section that occupies an entire * direct block, unless it's in the root direct block (because it @@ -1117,10 +1072,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", "H5HF_sect_single dblock_size = hdr->man_dtable.cparam.start_block_size; dblock_overhead = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: dblock_size = %Zu\n", "H5HF_sect_single_can_shrink", dblock_size); -HDfprintf(stderr, "%s: dblock_overhead = %Zu\n", "H5HF_sect_single_can_shrink", dblock_overhead); -#endif /* QAK */ if((dblock_size - dblock_overhead) == sect->sect_info.size) HGOTO_DONE(TRUE) } /* end if */ @@ -1170,10 +1121,6 @@ H5HF_sect_single_shrink(H5FS_section_info_t **_sect, void UNUSED *_udata) HDassert(*sect); HDassert((*sect)->sect_info.type == H5HF_FSPACE_SECT_SINGLE); -#ifdef QAK -HDfprintf(stderr, "%s: (*sect).sect_info = {%a, %Hu, %u}\n", FUNC, (*sect)->sect_info.addr, (*sect)->sect_info.size, (*sect)->sect_info.type); -#endif /* QAK */ - /* Check to see if we should revive section */ if((*sect)->sect_info.state != H5FS_SECT_LIVE) if(H5HF_sect_single_revive(hdr, dxpl_id, (*sect)) < 0) @@ -1186,9 +1133,6 @@ HDfprintf(stderr, "%s: (*sect).sect_info = {%a, %Hu, %u}\n", FUNC, (*sect)->sect /* Protect the direct block for the section */ /* (should be a root direct block) */ HDassert(dblock_addr == hdr->man_dtable.table_addr); -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); -#endif /* QAK */ if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, (*sect)->u.single.parent, (*sect)->u.single.par_entry, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block") @@ -1276,9 +1220,6 @@ H5HF_sect_single_valid(const H5FS_section_class_t UNUSED *cls, const H5FS_sectio /* Check arguments. */ HDassert(sect); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_valid", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ if(sect->sect_info.state == H5FS_SECT_LIVE) { /* Check if this section is not in a direct block that is the root direct block */ /* (not enough information to check on a single section in a root direct block) */ @@ -1290,9 +1231,6 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single unsigned dblock_status = 0; /* Direct block's status in the metadata cache */ herr_t status; /* Generic status value */ -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.single = {%p, %u, %a, %Zu}\n", "H5HF_sect_single_valid", sect->u.single.parent, sect->u.single.par_entry); -#endif /* QAK */ /* Sanity check settings for section's direct block's parent */ iblock = sect->u.single.parent; HDassert(H5F_addr_defined(iblock->ents[sect->u.single.par_entry].addr)); @@ -1419,11 +1357,6 @@ H5HF_sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, HDassert(hdr); HDassert(sect); HDassert(dblock); -#ifdef QAK -HDfprintf(stderr, "%s: sect.sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: dblock->parent = %p\n", FUNC, dblock->parent); -HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", FUNC, hdr->man_dtable.curr_root_rows); -#endif /* QAK */ /* Convert 'single' section information to 'row' section info */ sect->sect_info.addr = dblock->block_off; @@ -1517,10 +1450,6 @@ H5HF_sect_row_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *sect, sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); HDassert(sect->sect_info.state == H5FS_SECT_LIVE); HDassert(entry_p); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out); -#endif /* QAK */ /* Mark the row as checked out from the free space manager */ HDassert(sect->u.row.checked_out == FALSE); @@ -1538,9 +1467,6 @@ HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect->u.row. /* Check for eliminating the section */ if(sect->u.row.num_entries == 1) { -#ifdef QAK -HDfprintf(stderr, "%s: Freeing row section\n", FUNC); -#endif /* QAK */ /* Free row section */ if(H5HF_sect_row_free((H5FS_section_info_t *)sect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free row section node") @@ -1844,16 +1770,6 @@ H5HF_sect_row_can_merge(const H5FS_section_info_t *_sect1, HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_can_merge", sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_can_merge", sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - -#ifdef QAK -HDfprintf(stderr, "%s: sect1->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_can_merge", sect1->u.row.under, sect1->u.row.row, sect1->u.row.col, sect1->u.row.num_entries, sect1->u.row.checked_out); -HDfprintf(stderr, "%s: sect2->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_can_merge", sect2->u.row.under, sect2->u.row.row, sect2->u.row.col, sect2->u.row.num_entries, sect2->u.row.checked_out); -#endif /* QAK */ - /* Get the top indirect section underlying each row */ top_indir_sect1 = H5HF_sect_indirect_top(sect1->u.row.under); HDassert(top_indir_sect1); @@ -1866,11 +1782,6 @@ HDfprintf(stderr, "%s: sect2->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_ca */ if(top_indir_sect1 != top_indir_sect2) { if(H5HF_sect_indirect_iblock_off(top_indir_sect1) == H5HF_sect_indirect_iblock_off(top_indir_sect2)) { -#ifdef QAK -HDfprintf(stderr, "%s: top_indir_sect1->sect_info.addr = %a\n", "H5HF_sect_row_can_merge", top_indir_sect1->sect_info.addr); -HDfprintf(stderr, "%s: top_indir_sect1->u.indirect.span_size = %Hu\n", "H5HF_sect_row_can_merge", top_indir_sect1->u.indirect.span_size); -HDfprintf(stderr, "%s: top_indir_sect2->sect_info.addr = %a\n", "H5HF_sect_row_can_merge", top_indir_sect2->sect_info.addr); -#endif /* QAK */ /* Check if second section adjoins first section */ if(H5F_addr_eq((top_indir_sect1->sect_info.addr + top_indir_sect1->u.indirect.span_size), top_indir_sect2->sect_info.addr)) HGOTO_DONE(TRUE) @@ -1878,9 +1789,6 @@ HDfprintf(stderr, "%s: top_indir_sect2->sect_info.addr = %a\n", "H5HF_sect_row_c } /* end if */ done: -#ifdef QAK -HDfprintf(stderr, "%s: ret_value = %t\n", "H5HF_sect_row_can_merge", ret_value); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* H5HF_sect_row_can_merge() */ @@ -1920,15 +1828,7 @@ H5HF_sect_row_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2, HDassert(sect2); HDassert(sect2->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - /* Check if second section is past end of "next block" iterator */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", "H5HF_sect_row_can_shrink", hdr->man_iter_off); -#endif /* QAK */ if(sect2->sect_info.addr >= hdr->man_iter_off) { H5HF_free_section_t *top_indir_sect; /* Top indirect section for row */ @@ -1949,10 +1849,6 @@ HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", "H5HF_sect_row_can_shrink", h if(sect2->sect_info.state != H5FS_SECT_LIVE) if(H5HF_sect_row_revive(hdr, dxpl_id, sect2) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section") -#ifdef QAK -HDfprintf(stderr, "%s: sect1->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect1->u.row.under, sect1->u.row.row, sect1->u.row.col, sect1->u.row.num_entries, sect1->u.row.checked_out); -HDfprintf(stderr, "%s: sect2->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect2->u.row.under, sect2->u.row.row, sect2->u.row.col, sect2->u.row.num_entries, sect2->u.row.checked_out); -#endif /* QAK */ /* Merge rows' underlying indirect sections together */ if(H5HF_sect_indirect_merge_row(hdr, dxpl_id, sect1, sect2) < 0) @@ -1996,15 +1892,7 @@ H5HF_sect_row_can_shrink(const H5FS_section_info_t *_sect, void UNUSED *_udata) HDassert(sect); HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_can_shrink", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_can_shrink", sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out); -#endif /* QAK */ - /* Check if section is past end of "next block" iterator */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", "H5HF_sect_row_can_shrink", hdr->man_iter_off); -#endif /* QAK */ if(sect->sect_info.addr >= hdr->man_iter_off) HGOTO_DONE(TRUE) @@ -2044,11 +1932,6 @@ H5HF_sect_row_shrink(H5FS_section_info_t **_sect, void *_udata) HDassert(*sect); HDassert((*sect)->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); -#ifdef QAK -HDfprintf(stderr, "%s: (*sect)->sect_info = {%a, %Hu, %u, %s}\n", FUNC, (*sect)->sect_info.addr, (*sect)->sect_info.size, (*sect)->sect_info.type, ((*sect)->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: (*sect)->u.row = {%p, %u, %u, %u}\n", FUNC, (*sect)->u.row.under, (*sect)->u.row.row, (*sect)->u.row.col, (*sect)->u.row.num_entries); -#endif /* QAK */ - /* Get the top indirect section underlying each row */ top_indir_sect = H5HF_sect_indirect_top((*sect)->u.row.under); @@ -2166,19 +2049,12 @@ H5HF_sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t * cls_prvt = (H5HF_sect_private_t *)cls->cls_private; hdr = cls_prvt->hdr; -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_valid", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_valid", sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out); -#endif /* QAK */ /* Sanity checking on the row */ HDassert(sect->u.row.under); HDassert(sect->u.row.num_entries); HDassert(sect->u.row.checked_out == FALSE); indir_sect = sect->u.row.under; indir_idx = sect->u.row.row - indir_sect->u.indirect.row; -#ifdef QAK -HDfprintf(stderr, "%s: indir_idx = %u\n", "H5HF_sect_row_valid", indir_idx); -#endif /* QAK */ HDassert(indir_sect->u.indirect.dir_rows[indir_idx] == sect); /* Check if the section is actually within the heap */ @@ -2277,9 +2153,6 @@ H5HF_sect_indirect_iblock_off(const H5HF_free_section_t *sect) ret_value = sect->sect_info.state == H5FS_SECT_LIVE ? sect->u.indirect.u.iblock->block_off : sect->u.indirect.u.iblock_off; -#ifdef QAK -HDfprintf(stderr, "%s: Leaving, ret_value = %Hu\n", "H5HF_sect_indirect_iblock_off", ret_value); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_sect_indirect_iblock_off() */ @@ -2309,17 +2182,11 @@ H5HF_sect_indirect_top(H5HF_free_section_t *sect) */ HDassert(sect); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->u.indirect.parent = %p\n", "H5HF_sect_indirect_top", sect->u.indirect.parent); -#endif /* QAK */ if(sect->u.indirect.parent) ret_value = H5HF_sect_indirect_top(sect->u.indirect.parent); else ret_value = sect; -#ifdef QAK -HDfprintf(stderr, "%s: Leaving, ret_value = %p\n", "H5HF_sect_indirect_top", ret_value); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_sect_indirect_top() */ @@ -2415,7 +2282,6 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, unsigned nentries) { H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */ - hbool_t iblock_incr = FALSE; /* Indicate that parent iblock has been incremented */ H5HF_free_section_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_new) @@ -2438,7 +2304,6 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, sect->u.indirect.u.iblock->max_rows; if(H5HF_iblock_incr(sect->u.indirect.u.iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block") - iblock_incr = TRUE; } /* end if */ else { sect->u.indirect.u.iblock_off = iblock_off; @@ -2462,13 +2327,8 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, done: if(!ret_value && sect) { - /* Check if we should decrement parent ref. count */ - if(iblock_incr) - if(H5HF_iblock_decr(sect->u.indirect.u.iblock) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTDEC, NULL, "can't decrement reference count on shared indirect block") - /* Release the section */ - (void)H5FL_FREE(H5HF_free_section_t, sect); + sect = H5FL_FREE(H5HF_free_section_t, sect); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -2504,9 +2364,6 @@ H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, HDassert(iblock); HDassert(row_sect); HDassert(row_sect->u.row.row < hdr->man_dtable.max_direct_rows); -#ifdef QAK -HDfprintf(stderr, "%s: Entering\n", FUNC); -#endif /* QAK */ /* Create free space section node */ if(NULL == (sect = H5HF_sect_indirect_new(hdr, row_sect->sect_info.addr, @@ -2537,9 +2394,6 @@ done: if(H5HF_sect_indirect_free(sect) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "can't free indirect section node") -#ifdef QAK -HDfprintf(stderr, "%s: Leaving\n", FUNC); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_sect_indirect_for_row() */ @@ -2576,12 +2430,6 @@ H5HF_sect_indirect_init_rows(H5HF_hdr_t *hdr, hid_t dxpl_id, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_init_rows) -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: first_child = %t\n", FUNC, first_child); -HDfprintf(stderr, "%s: start_row = %u, start_col = %u\n", FUNC, start_row, start_col); -HDfprintf(stderr, "%s: end_row = %u, end_col = %u\n", FUNC, end_row, end_col); -#endif /* QAK */ /* * Check arguments. @@ -2671,9 +2519,6 @@ HDfprintf(stderr, "%s: end_row = %u, end_col = %u\n", FUNC, end_row, end_col); if(u < hdr->man_dtable.max_direct_rows) { H5HF_free_section_t *row_sect = NULL; /* 'Row' free space section to add */ -#ifdef QAK -HDfprintf(stderr, "%s: Creating direct row, row_col = %u, row_entries = %u\n", FUNC, row_col, row_entries); -#endif /* QAK */ /* Create 'row' free space section node */ if(NULL == (row_sect = H5HF_sect_row_create(curr_off, (hdr->man_dtable.row_block_size[u] - dblock_overhead), first_child, u, row_col, @@ -2715,11 +2560,6 @@ HDfprintf(stderr, "%s: Creating direct row, row_col = %u, row_entries = %u\n", F /* Compute info about row's indirect blocks for child section */ child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[u]); child_nentries = child_nrows * hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: child_nrows = %u\n", FUNC, child_nrows); -HDfprintf(stderr, "%s: child_nentries = %u\n", FUNC, child_nentries); -HDfprintf(stderr, "%s: row_entries = %u\n", FUNC, row_entries); -#endif /* QAK */ /* Add an indirect section for each indirect block in the row */ for(v = 0; v < row_entries; v++) { @@ -2732,9 +2572,6 @@ HDfprintf(stderr, "%s: row_entries = %u\n", FUNC, row_entries); /* Get the address of the child indirect block */ if(H5HF_man_iblock_entry_addr(sect->u.indirect.u.iblock, curr_entry, &child_iblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve child indirect block's address") -#ifdef QAK -HDfprintf(stderr, "%s: child_iblock_addr = %a\n", FUNC, child_iblock_addr); -#endif /* QAK */ /* If the child indirect block's address is defined, protect it */ if(H5F_addr_defined(child_iblock_addr)) { @@ -2835,9 +2672,6 @@ H5HF_sect_indirect_add(H5HF_hdr_t *hdr, hid_t dxpl_id, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_add) -#ifdef QAK -HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, nentries); -#endif /* QAK */ /* * Check arguments. @@ -2860,9 +2694,6 @@ HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, ne for(u = 0; u < start_row; u++) sect_off += hdr->man_dtable.row_block_size[u] * hdr->man_dtable.cparam.width; sect_off += hdr->man_dtable.row_block_size[start_row] * start_col; -#ifdef QAK -HDfprintf(stderr, "%s: sect_off = %Hu\n", FUNC, sect_off); -#endif /* QAK */ /* Create free space section node */ if(NULL == (sect = H5HF_sect_indirect_new(hdr, sect_off, (hsize_t)0, iblock, @@ -2915,9 +2746,6 @@ H5HF_sect_indirect_decr(H5HF_free_section_t *sect) */ HDassert(sect); HDassert(sect->u.indirect.rc); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.rc = %u\n", FUNC, sect->u.indirect.rc); -#endif /* QAK */ /* Decrement ref. count for indirect section */ sect->u.indirect.rc--; @@ -2975,10 +2803,6 @@ H5HF_sect_indirect_revive_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_ HDassert(sect->sect_info.state == H5FS_SECT_SERIALIZED); /* Look up indirect block containing indirect blocks for section */ -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info.addr = %a\n", FUNC, sect->sect_info.addr); -HDfprintf(stderr, "%s: sect->u.indirect.u.iblock_off = %Hu\n", FUNC, sect->u.indirect.u.iblock_off); -#endif /* QAK */ if(H5HF_man_dblock_locate(hdr, dxpl_id, sect->sect_info.addr, &sec_iblock, NULL, &did_protect, H5AC_READ) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") @@ -3045,10 +2869,6 @@ H5HF_sect_indirect_revive(H5HF_hdr_t *hdr, hid_t dxpl_id, HDassert(sect->sect_info.state == H5FS_SECT_SERIALIZED); HDassert(sect_iblock); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info.addr = %a\n", FUNC, sect->sect_info.addr); -HDfprintf(stderr, "%s: sect->u.indirect.u.iblock_off = %Hu\n", FUNC, sect->u.indirect.u.iblock_off); -#endif /* QAK */ /* Increment reference count on indirect block that free section is in */ if(H5HF_iblock_incr(sect_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") @@ -3118,11 +2938,6 @@ H5HF_sect_indirect_reduce_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_ /* Compute starting & ending information for row section */ row_start_entry = (row_sect->u.row.row * hdr->man_dtable.cparam.width) + row_sect->u.row.col; row_end_entry = (row_start_entry + row_sect->u.row.num_entries) - 1; -#ifdef QAK -HDfprintf(stderr, "%s: row_sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, row_sect->sect_info.addr, row_sect->sect_info.size, row_sect->sect_info.type, (row_sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: row_sect->u.row.row = %u, row_sect->u.row.col = %u, row_sect->u.row.num_entries = %u\n", FUNC, row_sect->u.row.row, row_sect->u.row.col, row_sect->u.row.num_entries); -HDfprintf(stderr, "%s: row_start_entry = %u, row_end_entry = %u\n", FUNC, row_start_entry, row_end_entry); -#endif /* QAK */ /* Compute starting & ending information for indirect section */ sect = row_sect->u.row.under; @@ -3138,31 +2953,16 @@ HDfprintf(stderr, "%s: row_start_entry = %u, row_end_entry = %u\n", FUNC, row_st HDassert(sect->u.indirect.dir_nrows > 0); HDassert(sect->u.indirect.dir_rows); HDassert(sect->u.indirect.dir_rows[(row_sect->u.row.row - start_row)] == row_sect); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.indirect.parent = %p, sect->u.indirect.par_entry = %u\n", FUNC, sect->u.indirect.parent, sect->u.indirect.par_entry); -HDfprintf(stderr, "%s: start_entry = %u, start_row = %u, start_col = %u\n", FUNC, start_entry, start_row, start_col); -HDfprintf(stderr, "%s: end_entry = %u, end_row = %u\n", FUNC, end_entry, end_row); -#endif /* QAK */ /* Check if we should allocate from end of indirect section */ if(row_end_entry == end_entry && start_row != end_row) { *alloc_from_start = FALSE; row_entry = row_end_entry; -#ifdef QAK -HDfprintf(stderr, "%s: Row is at end of indirect section\n", FUNC); -#endif /* QAK */ } /* end if */ else { *alloc_from_start = TRUE; row_entry = row_start_entry; -#ifdef QAK -HDfprintf(stderr, "%s: Row is NOT at end of indirect section\n", FUNC); -#endif /* QAK */ } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: row_entry = %u\n", FUNC, row_entry); -#endif /* QAK */ /* Check if we have a parent section to be detached from */ if(sect->u.indirect.parent) { @@ -3189,9 +2989,6 @@ HDfprintf(stderr, "%s: row_entry = %u\n", FUNC, row_entry); /* Check how to adjust section for allocated entry */ if(sect->u.indirect.num_entries > 1) { if(row_entry == start_entry) { -#ifdef QAK -HDfprintf(stderr, "%s: Entry is at start of indirect section\n", FUNC); -#endif /* QAK */ /* Adjust section start */ sect->sect_info.addr += hdr->man_dtable.row_block_size[sect->u.indirect.row]; @@ -3206,9 +3003,6 @@ HDfprintf(stderr, "%s: Entry is at start of indirect section\n", FUNC); /* Adjust direct row information */ sect->u.indirect.dir_nrows--; -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.dir_nrows = %u\n", FUNC, sect->u.indirect.dir_nrows); -#endif /* QAK */ /* Adjust direct row sections for indirect section */ if(sect->u.indirect.dir_nrows > 0) { @@ -3244,9 +3038,6 @@ HDfprintf(stderr, "%s: sect->u.indirect.dir_nrows = %u\n", FUNC, sect->u.indirec else if(row_entry == end_entry) { unsigned new_end_row; /* New end row for entries */ -#ifdef QAK -HDfprintf(stderr, "%s: Entry is at end of indirect section\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(sect->u.indirect.indir_nents == 0); HDassert(sect->u.indirect.indir_ents == NULL); @@ -3271,9 +3062,6 @@ HDfprintf(stderr, "%s: Entry is at end of indirect section\n", FUNC); unsigned new_start_row; /* New starting row for current indirect section */ unsigned u; /* Local index variable */ -#ifdef QAK -HDfprintf(stderr, "%s: Entry is in middle of indirect section\n", FUNC); -#endif /* QAK */ /* Sanity checks */ HDassert(row_sect->u.row.col == 0); HDassert(row_sect->u.row.row > 0); @@ -3285,10 +3073,6 @@ HDfprintf(stderr, "%s: Entry is in middle of indirect section\n", FUNC); new_start_row = row_sect->u.row.row; peer_nentries = row_entry - start_entry; peer_dir_nrows = new_start_row - start_row; -#ifdef QAK -HDfprintf(stderr, "%s: peer_nentries = %u, peer_dir_nrows = %u\n", FUNC, peer_nentries, peer_dir_nrows); -HDfprintf(stderr, "%s: new_start_row = %u\n", FUNC, new_start_row); -#endif /* QAK */ /* Get indirect block information for peer */ if(sect->sect_info.state == H5FS_SECT_LIVE) { @@ -3299,9 +3083,6 @@ HDfprintf(stderr, "%s: new_start_row = %u\n", FUNC, new_start_row); iblock = NULL; iblock_off = sect->u.indirect.u.iblock_off; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: iblock = %p, iblock_off = %Hu\n", FUNC, iblock, iblock_off); -#endif /* QAK */ /* Create peer indirect section */ if(NULL == (peer_sect = H5HF_sect_indirect_new(hdr, sect->sect_info.addr, @@ -3409,9 +3190,6 @@ H5HF_sect_indirect_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *s HDassert(sect); HDassert(sect->u.indirect.span_size > 0); HDassert(sect->u.indirect.iblock_entries > 0); -#ifdef QAK -HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry); -#endif /* QAK */ /* Compute starting & ending information for indirect section */ start_row = sect->u.indirect.row; @@ -3419,12 +3197,6 @@ HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry); start_entry = (start_row * hdr->man_dtable.cparam.width) + start_col; end_entry = (start_entry + sect->u.indirect.num_entries) - 1; end_row = end_entry / hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.indirect.parent = %p, sect->u.indirect.par_entry = %u\n", FUNC, sect->u.indirect.parent, sect->u.indirect.par_entry); -HDfprintf(stderr, "%s: start_entry = %u, start_row = %u, start_col = %u\n", FUNC, start_entry, start_row, start_col); -HDfprintf(stderr, "%s: end_entry = %u, end_row = %u\n", FUNC, end_entry, end_row); -#endif /* QAK */ /* Check how to adjust section for allocated entry */ if(sect->u.indirect.num_entries > 1) { @@ -3449,9 +3221,6 @@ HDfprintf(stderr, "%s: end_entry = %u, end_row = %u\n", FUNC, end_entry, end_row /* Check if we can allocate from start of indirect section */ if(child_entry == start_entry) { -#ifdef QAK -HDfprintf(stderr, "%s: Child is at start of indirect section\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(sect->u.indirect.dir_nrows == 0); HDassert(sect->u.indirect.dir_rows == NULL); @@ -3482,9 +3251,6 @@ HDfprintf(stderr, "%s: Child is at start of indirect section\n", FUNC); HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't make new 'first row' for child indirect section") } /* end if */ else if(child_entry == end_entry) { -#ifdef QAK -HDfprintf(stderr, "%s: Child is at end of indirect section\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(sect->u.indirect.indir_nents > 0); HDassert(sect->u.indirect.indir_ents); @@ -3510,9 +3276,6 @@ HDfprintf(stderr, "%s: Child is at end of indirect section\n", FUNC); unsigned new_nentries; /* New number of entries for current indirect section */ unsigned u; /* Local index variable */ -#ifdef QAK -HDfprintf(stderr, "%s: Child is in middle of indirect section\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(sect->u.indirect.indir_nents > 0); HDassert(sect->u.indirect.indir_ents); @@ -3523,10 +3286,6 @@ HDfprintf(stderr, "%s: Child is in middle of indirect section\n", FUNC); peer_start_col = (child_entry + 1) % hdr->man_dtable.cparam.width; child_row = child_entry / hdr->man_dtable.cparam.width; new_nentries = sect->u.indirect.num_entries - (peer_nentries + 1); -#ifdef QAK -HDfprintf(stderr, "%s: peer_nentries = %u, peer_start_row = %u, peer_start_col = %u\n", FUNC, peer_nentries, peer_start_row, peer_start_col); -HDfprintf(stderr, "%s: new_nentries = %u\n", FUNC, new_nentries); -#endif /* QAK */ HDassert(child_row >= hdr->man_dtable.max_direct_rows); /* Get indirect block information for peer */ @@ -3538,27 +3297,18 @@ HDfprintf(stderr, "%s: new_nentries = %u\n", FUNC, new_nentries); iblock = NULL; iblock_off = sect->u.indirect.u.iblock_off; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: iblock = %p, iblock_off = %Hu\n", FUNC, iblock, iblock_off); -#endif /* QAK */ /* Update the number of entries in current section & calculate it's span size */ /* (Will use this to compute the section address for the peer section */ sect->u.indirect.num_entries = new_nentries; sect->u.indirect.span_size = H5HF_dtable_span_size(&hdr->man_dtable, sect->u.indirect.row, sect->u.indirect.col, new_nentries); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.span_size = %Hu\n", FUNC, sect->u.indirect.span_size); -#endif /* QAK */ HDassert(sect->u.indirect.span_size > 0); /* Compute address of peer indirect section */ peer_sect_addr = sect->sect_info.addr; peer_sect_addr += sect->u.indirect.span_size; peer_sect_addr += hdr->man_dtable.row_block_size[child_row]; -#ifdef QAK -HDfprintf(stderr, "%s: peer_sect_addr = %a\n", FUNC, peer_sect_addr); -#endif /* QAK */ /* Create peer indirect section */ if(NULL == (peer_sect = H5HF_sect_indirect_new(hdr, peer_sect_addr, @@ -3582,9 +3332,6 @@ HDfprintf(stderr, "%s: peer_sect_addr = %a\n", FUNC, peer_sect_addr); /* Eliminate indirect entries for this section, if appropriate */ if(sect->u.indirect.indir_nents == 0) sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.indir_ents); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.indir_nents = %u\n", FUNC, sect->u.indirect.indir_nents); -#endif /* QAK */ /* Re-target transferred row sections to point to new underlying indirect section */ for(u = 0; u < peer_nentries; u++) @@ -3597,10 +3344,6 @@ HDfprintf(stderr, "%s: sect->u.indirect.indir_nents = %u\n", FUNC, sect->u.indir /* Adjust reference counts for current & peer sections */ peer_sect->u.indirect.rc = peer_nentries; sect->u.indirect.rc -= peer_nentries; -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.rc = %u\n", FUNC, sect->u.indirect.rc); -HDfprintf(stderr, "%s: peer_sect->u.indirect.rc = %u\n", FUNC, peer_sect->u.indirect.rc); -#endif /* QAK */ /* Transfer cached information about indirect block */ peer_sect->u.indirect.iblock_entries = sect->u.indirect.iblock_entries; @@ -3798,10 +3541,6 @@ H5HF_sect_indirect_merge_row(H5HF_hdr_t *hdr, hid_t dxpl_id, HDassert(sect1); sect2 = H5HF_sect_indirect_top(row_sect2->u.row.under); HDassert(sect2); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ /* Sanity check some assumptions about the indirect sections */ HDassert(sect1->sect_info.state == H5FS_SECT_LIVE); @@ -3818,18 +3557,7 @@ HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sec start_entry1 = (start_row1 * hdr->man_dtable.cparam.width) + start_col1; end_entry1 = (start_entry1 + sect1->u.indirect.num_entries) - 1; end_row1 = end_entry1 / hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: sect1->u.indirect.dir_nrows = %u\n", FUNC, sect1->u.indirect.dir_nrows); -HDfprintf(stderr, "%s: start_row1 = %u, start_col1 = %u, start_entry1 = %u\n", FUNC, start_row1, start_col1, start_entry1); -HDfprintf(stderr, "%s: sect1->u.indirect.num_entries = %u\n", FUNC, sect1->u.indirect.num_entries); -HDfprintf(stderr, "%s: end_row1 = %u, end_entry1 = %u\n", FUNC, end_row1, end_entry1); -#endif /* QAK */ start_row2 = sect2->u.indirect.row; -#ifdef QAK -HDfprintf(stderr, "%s: sect2->u.indirect.dir_nrows = %u\n", FUNC, sect2->u.indirect.dir_nrows); -HDfprintf(stderr, "%s: start_row2 = %u\n", FUNC, start_row2); -HDfprintf(stderr, "%s: sect2->u.indirect.num_entries = %u\n", FUNC, sect2->u.indirect.num_entries); -#endif /* QAK */ /* Check for direct sections in second section */ /* (second indirect section can be parent of indirect section for second @@ -3853,9 +3581,6 @@ HDfprintf(stderr, "%s: sect2->u.indirect.num_entries = %u\n", FUNC, sect2->u.ind if(row_sect1->u.row.under->u.indirect.u.iblock->block_off == row_sect2->u.row.under->u.indirect.u.iblock->block_off && end_row1 == start_row2) { H5HF_free_section_t *last_row_sect1; /* Last row in first indirect section */ -#ifdef QAK -HDfprintf(stderr, "%s: Sections share a row\n", FUNC); -#endif /* QAK */ /* Locate the last row section in first indirect section, if we don't already have it */ if(row_sect1->u.row.row != end_row1) @@ -3878,9 +3603,6 @@ HDfprintf(stderr, "%s: Sections share a row\n", FUNC); merged_rows = TRUE; } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: Sections don't share a row\n", FUNC); -#endif /* QAK */ /* Set up parameters for transfer of rows */ src_row2 = 0; @@ -3890,11 +3612,6 @@ HDfprintf(stderr, "%s: Sections don't share a row\n", FUNC); /* Indicate that the rows were _not_ merged */ merged_rows = FALSE; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: new_dir_nrows1 = %u\n", FUNC, new_dir_nrows1); -HDfprintf(stderr, "%s: src_row2 = %u\n", FUNC, src_row2); -HDfprintf(stderr, "%s: nrows_moved2 = %u\n", FUNC, nrows_moved2); -#endif /* QAK */ /* Check if we need to move additional rows */ if(nrows_moved2 > 0) { @@ -3980,9 +3697,6 @@ HDfprintf(stderr, "%s: nrows_moved2 = %u\n", FUNC, nrows_moved2); /* Wrap up, freeing or re-inserting second row section */ /* (want this to be after the first indirection section is consistent again) */ if(merged_rows) { -#ifdef QAK -HDfprintf(stderr, "%s: Finishing sections share a row\n", FUNC); -#endif /* QAK */ /* Release second row section */ /* (indirectly releases second indirect section, since all of it's * other dependents are gone) @@ -3992,9 +3706,6 @@ HDfprintf(stderr, "%s: Finishing sections share a row\n", FUNC); HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free row section") } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: Finishing sections don't share a row\n", FUNC); -#endif /* QAK */ /* Decrement ref. count on second indirect section's parent */ HDassert(sect2->u.indirect.rc == 0); if(sect2->u.indirect.parent) @@ -4009,27 +3720,14 @@ HDfprintf(stderr, "%s: Finishing sections don't share a row\n", FUNC); /* (it's already been added to first indirect section, but it's been removed * from the free space manager and needs to be re-added) */ -#ifdef QAK -HDfprintf(stderr, "%s: Re-inserting second row section\n", FUNC); -#endif /* QAK */ row_sect2->sect_info.type = H5HF_FSPACE_SECT_NORMAL_ROW; if(H5HF_space_add(hdr, dxpl_id, row_sect2, H5FS_ADD_SKIP_VALID) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't re-add second row section to free space") -#ifdef QAK -HDfprintf(stderr, "%s: Done re-inserting second row section\n", FUNC); -#endif /* QAK */ } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: sect1->u.indirect.iblock_entries = %u\n", FUNC, sect1->u.indirect.iblock_entries); -HDfprintf(stderr, "%s: sect1->u.indirect.num_entries = %u\n", FUNC, sect1->u.indirect.num_entries); -#endif /* QAK */ /* Check if we can create parent indirect section for first section */ /* (i.e. merged indirect sections cover an entire indirect block) */ if(sect1->u.indirect.iblock_entries == sect1->u.indirect.num_entries) { -#ifdef QAK -HDfprintf(stderr, "%s: creating parent indirect section\n", FUNC); -#endif /* QAK */ /* Build parent section for fully populated indirect section */ HDassert(sect1->u.indirect.parent == NULL); if(H5HF_sect_indirect_build_parent(hdr, sect1) < 0) @@ -4064,9 +3762,6 @@ H5HF_sect_indirect_build_parent(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_build_parent) -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ /* Sanity check parameters */ HDassert(hdr); @@ -4076,18 +3771,12 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_ HDassert(sect->u.indirect.iblock_entries == sect->u.indirect.num_entries); HDassert(sect->u.indirect.u.iblock); HDassert(sect->u.indirect.parent == NULL); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect = {%p, %u, %u, %u}\n", FUNC, sect->u.indirect.u.iblock, sect->u.indirect.row, sect->u.indirect.col, sect->u.indirect.num_entries); -#endif /* QAK */ /* Get information for creating parent indirect section */ par_entry = sect->u.indirect.u.iblock->par_entry; par_row = par_entry / hdr->man_dtable.cparam.width; par_col = par_entry % hdr->man_dtable.cparam.width; HDassert(par_row >= hdr->man_dtable.max_direct_rows); -#ifdef QAK -HDfprintf(stderr, "%s: par_entry = %u, par_row = %u, par_col = %u\n", FUNC, par_entry, par_row, par_col); -#endif /* QAK */ par_iblock = sect->u.indirect.u.iblock->parent; HDassert(par_iblock); @@ -4144,12 +3833,6 @@ H5HF_sect_indirect_shrink(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *s /* Sanity check some assumptions about the indirect section */ HDassert(sect->u.indirect.dir_nrows > 0 || sect->u.indirect.indir_nents > 0); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.indirect = {%p, %u, %u, %u}\n", FUNC, sect->u.indirect.u.iblock, sect->u.indirect.row, sect->u.indirect.col, sect->u.indirect.num_entries); -HDfprintf(stderr, "%s: sect->u.indirect.span_size = %Hu\n", FUNC, sect->u.indirect.span_size); -HDfprintf(stderr, "%s: sect->u.indirect.parent = %p\n", FUNC, sect->u.indirect.parent); -#endif /* QAK */ /* Walk through direct rows, freeing them */ for(u = 0; u < sect->u.indirect.dir_nrows; u++) { @@ -4205,9 +3888,6 @@ H5HF_sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, HDassert(hdr); HDassert(sect); HDassert(buf); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ /* Check if this indirect section has a parent & forward if this section is first */ if(sect->u.indirect.parent) { @@ -4220,35 +3900,18 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_ if(sect->sect_info.state == H5FS_SECT_LIVE) { HDassert(sect->u.indirect.u.iblock); UINT64ENCODE_VAR(buf, sect->u.indirect.u.iblock->block_off, hdr->heap_off_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.u.iblock->block_off = %Hu\n", FUNC, sect->u.indirect.u.iblock->block_off); -#endif /* QAK */ } /* end if */ else -{ UINT64ENCODE_VAR(buf, sect->u.indirect.u.iblock_off, hdr->heap_off_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.u.iblock_off = %Hu\n", FUNC, sect->u.indirect.u.iblock_off); -#endif /* QAK */ -} /* Indirect range's row */ UINT16ENCODE(buf, sect->u.indirect.row); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.row = %u\n", FUNC, sect->u.indirect.row); -#endif /* QAK */ /* Indirect range's column */ UINT16ENCODE(buf, sect->u.indirect.col); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.col = %u\n", FUNC, sect->u.indirect.col); -#endif /* QAK */ /* Indirect range's # of entries */ UINT16ENCODE(buf, sect->u.indirect.num_entries); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.num_entries = %u\n", FUNC, sect->u.indirect.num_entries); -#endif /* QAK */ } /* end else */ done: @@ -4293,33 +3956,18 @@ H5HF_sect_indirect_deserialize(H5HF_hdr_t *hdr, hid_t dxpl_id, HDassert(buf); HDassert(H5F_addr_defined(sect_addr)); HDassert(sect_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect_addr = %a, sect_size = %Hu\n", FUNC, sect_addr, sect_size); -#endif /* QAK */ /* Indirect range's indirect block's block offset */ UINT64DECODE_VAR(buf, iblock_off, hdr->heap_off_size); -#ifdef QAK -HDfprintf(stderr, "%s: iblock_off = %Hu\n", FUNC, iblock_off); -#endif /* QAK */ /* Indirect section's row */ UINT16DECODE(buf, start_row); -#ifdef QAK -HDfprintf(stderr, "%s: start_row = %u\n", FUNC, start_row); -#endif /* QAK */ /* Indirect section's column */ UINT16DECODE(buf, start_col); -#ifdef QAK -HDfprintf(stderr, "%s: start_col = %u\n", FUNC, start_col); -#endif /* QAK */ /* Indirect section's # of entries */ UINT16DECODE(buf, nentries); -#ifdef QAK -HDfprintf(stderr, "%s: nentries = %u\n", FUNC, nentries); -#endif /* QAK */ /* Create free space section node */ if(NULL == (new_sect = H5HF_sect_indirect_new(hdr, sect_addr, sect_size, @@ -4426,15 +4074,6 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) HDassert(hdr); HDassert(sect); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_indirect_valid", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -if(sect->sect_info.state == H5FS_SECT_LIVE) - HDfprintf(stderr, "%s: sect->u.indirect = {%p, ", "H5HF_sect_indirect_valid", sect->u.indirect.u.iblock); -else - HDfprintf(stderr, "%s: sect->u.indirect = {%Hu, ", "H5HF_sect_indirect_valid", sect->u.indirect.u.iblock_off); -HDfprintf(stderr, "%u, %u, %u}\n", sect->u.indirect.row, sect->u.indirect.col, sect->u.indirect.num_entries); -#endif /* QAK */ - /* Compute starting entry, column & row */ start_row = sect->u.indirect.row; start_col = sect->u.indirect.col; @@ -4443,10 +4082,6 @@ HDfprintf(stderr, "%u, %u, %u}\n", sect->u.indirect.row, sect->u.indirect.col, s /* Compute ending entry, column & row */ end_entry = (start_entry + sect->u.indirect.num_entries) - 1; end_row = end_entry / hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: start_row = %u, start_col = %u, start_entry = %u\n", "H5HF_sect_indirect_valid", start_row, start_col, start_entry); -HDfprintf(stderr, "%s: end_row = %u, end_entry = %u\n", "H5HF_sect_indirect_valid", end_row, end_entry); -#endif /* QAK */ /* Sanity check any direct rows */ if(sect->u.indirect.dir_nrows > 0) { diff --git a/src/H5HG.c b/src/H5HG.c index 520f2eb..0e3f0e9 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -99,6 +99,15 @@ static haddr_t H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size); /* Package Variables */ /*********************/ +/* Declare a free list to manage the H5HG_t struct */ +H5FL_DEFINE(H5HG_heap_t); + +/* Declare a free list to manage sequences of H5HG_obj_t's */ +H5FL_SEQ_DEFINE(H5HG_obj_t); + +/* Declare a PQ free list to manage heap chunks */ +H5FL_BLK_DEFINE(gheap_chunk); + /*****************************/ /* Library Private Variables */ @@ -109,15 +118,6 @@ static haddr_t H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size); /* Local Variables */ /*******************/ -/* Declare a free list to manage the H5HG_t struct */ -H5FL_DEFINE(H5HG_heap_t); - -/* Declare a free list to manage sequences of H5HG_obj_t's */ -H5FL_SEQ_DEFINE(H5HG_obj_t); - -/* Declare a PQ free list to manage heap chunks */ -H5FL_BLK_DEFINE(gheap_chunk); - /*------------------------------------------------------------------------- @@ -137,52 +137,31 @@ H5FL_BLK_DEFINE(gheap_chunk); * Programmer: Robb Matzke * Friday, March 27, 1998 * - * Modifications: - * - * John Mainzer 5/26/04 - * Modified function to return the disk address of the new - * global heap collection, or HADDR_UNDEF on failure. This - * is necessary, as in some cases (i.e. flexible parallel) - * H5AC_set() will imediately flush and destroy the in memory - * version of the new collection. For the same reason, I - * moved the code which places the new collection on the cwfs - * list to just before the call to H5AC_set(). - * - * John Mainzer 6/8/05 - * Removed code setting the is_dirty field of the cache info. - * This is no longer pemitted, as the cache code is now - * manageing this field. Since this function uses a call to - * H5AC_set() (which marks the entry dirty automaticly), no - * other change is required. - * *------------------------------------------------------------------------- */ static haddr_t -H5HG_create (H5F_t *f, hid_t dxpl_id, size_t size) +H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size) { H5HG_heap_t *heap = NULL; - haddr_t ret_value = HADDR_UNDEF; uint8_t *p = NULL; haddr_t addr; size_t n; + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HG_create) /* Check args */ - assert (f); - if (sizeaddr = addr; heap->size = size; @@ -203,14 +182,14 @@ HDmemset(heap->chunk, 0, size); *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ - H5F_ENCODE_LENGTH (f, p, size); + H5F_ENCODE_LENGTH(f, p, size); /* * Padding so free space object is aligned. If malloc returned memory * which was always at least H5HG_ALIGNMENT aligned then we could just * align the pointer, but this might not be the case. */ - n = H5HG_ALIGN(p-heap->chunk) - (p-heap->chunk); + n = H5HG_ALIGN(p - heap->chunk) - (p - heap->chunk); #ifdef OLD_WAY /* Don't bother zeroing out the rest of the info in the heap -QAK */ HDmemset(p, 0, n); @@ -225,7 +204,7 @@ HDmemset(heap->chunk, 0, size); UINT16ENCODE(p, 0); /*object ID*/ UINT16ENCODE(p, 0); /*reference count*/ UINT32ENCODE(p, 0); /*reserved*/ - H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); + H5F_ENCODE_LENGTH(f, p, heap->obj[0].size); #ifdef OLD_WAY /* Don't bother zeroing out the rest of the info in the heap -QAK */ HDmemset (p, 0, (size_t)((heap->chunk+heap->size) - p)); @@ -244,7 +223,7 @@ HDmemset(heap->chunk, 0, size); MIN(f->shared->ncwfs, H5HG_NCWFS - 1) * sizeof(H5HG_heap_t *)); f->shared->cwfs[0] = heap; f->shared->ncwfs = MIN(H5HG_NCWFS, f->shared->ncwfs+1); - } + } /* end else */ /* Add the heap to the cache */ if(H5AC_set(f, dxpl_id, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0) @@ -253,11 +232,20 @@ HDmemset(heap->chunk, 0, size); ret_value = addr; done: - if ( ! ( H5F_addr_defined(addr) ) && heap) { - if ( H5HG_dest(f,heap) < 0 ) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, \ - "unable to destroy global heap collection"); - } + /* Cleanup on error */ + if(!H5F_addr_defined(ret_value)) { + if(H5F_addr_defined(addr)) { + /* Release the space on disk */ + if(H5MF_xfree(f, H5FD_MEM_GHEAP, dxpl_id, addr, (hsize_t)size) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, HADDR_UNDEF, "unable to free global heap") + + /* Check if the heap object was allocated */ + if(heap) + /* Destroy the heap object */ + if(H5HG_dest(f, heap) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy global heap collection") + } /* end if */ + } /* end if */ FUNC_LEAVE_NOAPI(ret_value); } /* H5HG_create() */ @@ -279,16 +267,6 @@ done: * Programmer: Robb Matzke * Friday, March 27, 1998 * - * Modifications: - * - * John Mainzer, 6/8/05 - * Modified the function to use the new dirtied parameter of - * of H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. - * - * In this case, that required adding the new heap_dirtied_ptr - * parameter to the function's argument list. - * *------------------------------------------------------------------------- */ static size_t @@ -501,30 +479,6 @@ done: * Programmer: Robb Matzke * Friday, March 27, 1998 * - * Modifications: - * - * John Mainzer -- 5/24/04 - * The function used to modify the heap without protecting - * the relevant collection first. I did a half assed job - * of fixing the problem, which should hold until we try to - * support multi-threading. At that point it will have to - * be done right. - * - * See in line comment of this date for more details. - * - * John Mainzer - 5/26/04 - * Modified H5HG_create() to return the disk address of the - * new collection, instead of the address of its - * representation in core. This was necessary as in FP - * mode, the cache will immediately flush and destroy any - * entry inserted in it via H5AC_set(). I then modified - * this function to account for the change in H5HG_create(). - * - * John Mainzer - 6/8/05 - * Modified function to use the dirtied parameter of - * H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. - * *------------------------------------------------------------------------- */ herr_t @@ -635,7 +589,6 @@ H5HG_insert(H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out*/ --cwfsno; } /* end if */ } /* end else */ - HDassert(H5F_addr_defined(addr)); if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") @@ -759,54 +712,47 @@ done: * Programmer: Robb Matzke * Monday, March 30, 1998 * - * Modifications: - * - * John Mainzer - 6/8/05 - * Modified function to use the dirtied parameter of - * H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. - * *------------------------------------------------------------------------- */ int -H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) +H5HG_link(H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) { H5HG_heap_t *heap = NULL; unsigned heap_flags = H5AC__NO_FLAGS_SET; int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5HG_link, FAIL); + FUNC_ENTER_NOAPI(H5HG_link, FAIL) /* Check args */ - assert (f); - assert (hobj); - if (0==(f->intent & H5F_ACC_RDWR)) + HDassert(f); + HDassert(hobj); + if(0 == (f->intent & H5F_ACC_RDWR)) HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") - if(adjust!=0) { - /* Load the heap */ - if (NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") - - assert (hobj->idxnused); - assert (heap->obj[hobj->idx].begin); - if (heap->obj[hobj->idx].nrefs+adjust<0) - HGOTO_ERROR (H5E_HEAP, H5E_BADRANGE, FAIL, "new link count would be out of range") - if (heap->obj[hobj->idx].nrefs+adjust>H5HG_MAXLINK) - HGOTO_ERROR (H5E_HEAP, H5E_BADVALUE, FAIL, "new link count would be out of range") + /* Load the heap */ + if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") + + if(adjust != 0) { + HDassert(hobj->idx < heap->nused); + HDassert(heap->obj[hobj->idx].begin); + if((heap->obj[hobj->idx].nrefs + adjust) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "new link count would be out of range") + if((heap->obj[hobj->idx].nrefs + adjust) > H5HG_MAXLINK) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "new link count would be out of range") heap->obj[hobj->idx].nrefs += adjust; heap_flags |= H5AC__DIRTIED_FLAG; } /* end if */ /* Set return value */ - ret_value=heap->obj[hobj->idx].nrefs; + ret_value = heap->obj[hobj->idx].nrefs; done: - if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, heap_flags)<0) + if(heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, heap_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header") - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HG_link() */ /*------------------------------------------------------------------------- @@ -884,7 +830,6 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) * The collection is empty. Remove it from the CWFS list and return it * to the file free list. */ - H5_CHECK_OVERFLOW(heap->size, size_t, hsize_t); flags |= H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; /* Indicate that the object was deleted, for the unprotect call */ } /* end if */ else { diff --git a/src/H5HGcache.c b/src/H5HGcache.c index ee318aa..b7a701a 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -75,16 +75,6 @@ static herr_t H5HG_size(const H5F_t *f, const H5HG_heap_t *heap, size_t *size_pt /* Package Variables */ /*********************/ - -/*****************************/ -/* Library Private Variables */ -/*****************************/ - - -/*******************/ -/* Local Variables */ -/*******************/ - /* H5HG inherits cache-like properties from H5AC */ const H5AC_class_t H5AC_GHEAP[1] = {{ H5AC_GHEAP_ID, @@ -97,6 +87,16 @@ const H5AC_class_t H5AC_GHEAP[1] = {{ }}; +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + /*------------------------------------------------------------------------- * Function: H5HG_load @@ -381,7 +381,7 @@ H5HG_dest(H5F_t *f, H5HG_heap_t *heap) heap->chunk = H5FL_BLK_FREE(gheap_chunk, heap->chunk); if(heap->obj) heap->obj = H5FL_SEQ_FREE(H5HG_obj_t, heap->obj); - (void)H5FL_FREE(H5HG_heap_t, heap); + heap = H5FL_FREE(H5HG_heap_t, heap); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5HL.c b/src/H5HL.c index a69eb16..f7c1f22 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -72,6 +72,12 @@ static herr_t H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap); /* Package Variables */ /*********************/ +/* Declare a free list to manage the H5HL_free_t struct */ +H5FL_DEFINE(H5HL_free_t); + +/* Declare a PQ free list to manage the heap chunk information */ +H5FL_BLK_DEFINE(lheap_chunk); + /*****************************/ /* Library Private Variables */ @@ -82,15 +88,6 @@ static herr_t H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap); /* Local Variables */ /*******************/ -/* Declare a free list to manage the H5HL_free_t struct */ -H5FL_DEFINE(H5HL_free_t); - -/* Declare a free list to manage the H5HL_t struct */ -H5FL_DEFINE(H5HL_t); - -/* Declare a PQ free list to manage the heap chunk information */ -H5FL_BLK_DEFINE(lheap_chunk); - /*------------------------------------------------------------------------- @@ -117,10 +114,10 @@ H5FL_BLK_DEFINE(lheap_chunk); herr_t H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/) { - H5HL_t *heap = NULL; - hsize_t total_size; /*total heap size on disk */ - size_t sizeof_hdr; /* Cache H5HL header size for file */ - herr_t ret_value = SUCCEED; + H5HL_t *heap = NULL; /* Heap created */ + H5HL_prfx_t *prfx = NULL; /* Heap prefix */ + hsize_t total_size; /* Total heap size on disk */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HL_create, FAIL) @@ -128,30 +125,32 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/) HDassert(f); HDassert(addr_p); + /* Adjust size hint as necessary */ if(size_hint && size_hint < H5HL_SIZEOF_FREE(f)) size_hint = H5HL_SIZEOF_FREE(f); size_hint = H5HL_ALIGN(size_hint); - /* Cache this for later */ - sizeof_hdr = H5HL_SIZEOF_HDR(f); + /* Allocate memory structure */ + if(NULL == (heap = H5HL_new(H5F_SIZEOF_SIZE(f), H5F_SIZEOF_ADDR(f), H5HL_SIZEOF_HDR(f)))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") - /* allocate file version */ - total_size = sizeof_hdr + size_hint; - if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, total_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file memory") + /* Allocate file space */ + total_size = heap->prfx_size + size_hint; + if(HADDR_UNDEF == (heap->prfx_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, total_size))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate file memory") - /* allocate memory version */ - if(NULL == (heap = H5FL_CALLOC(H5HL_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - heap->addr = *addr_p + (hsize_t)sizeof_hdr; - heap->heap_alloc = size_hint; - if(NULL == (heap->chunk = H5FL_BLK_CALLOC(lheap_chunk, (sizeof_hdr + size_hint)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + /* Initialize info */ + heap->single_cache_obj = TRUE; + heap->dblk_addr = heap->prfx_addr + (hsize_t)heap->prfx_size; + heap->dblk_size = size_hint; + if(size_hint) + if(NULL == (heap->dblk_image = H5FL_BLK_CALLOC(lheap_chunk, size_hint))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") /* free list */ if(size_hint) { if(NULL == (heap->freelist = H5FL_MALLOC(H5HL_free_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") heap->freelist->offset = 0; heap->freelist->size = size_hint; heap->freelist->prev = heap->freelist->next = NULL; @@ -159,17 +158,32 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/) else heap->freelist = NULL; - /* add to cache */ - if(H5AC_set(f, dxpl_id, H5AC_LHEAP, *addr_p, heap, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache heap") + /* Allocate the heap prefix */ + if(NULL == (prfx = H5HL_prfx_new(heap))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") + + /* Add to cache */ + if(H5AC_set(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache local heap prefix") + + /* Set address to return */ + *addr_p = heap->prfx_addr; done: if(ret_value < 0) { - if(H5F_addr_defined(*addr_p)) - H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, *addr_p, total_size); - if(heap) - if(H5HL_dest(f,heap) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap collection") + if(prfx) { + if(H5HL_prfx_dest(prfx) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap prefix") + } /* end if */ + else { + if(heap) { + if(H5F_addr_defined(heap->prfx_addr)) + if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, heap->prfx_addr, total_size) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't release heap data?") + if(H5HL_dest(heap) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap") + } /* end if */ + } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -177,6 +191,110 @@ done: /*------------------------------------------------------------------------- + * Function: H5HL_dblk_realloc + * + * Purpose: Reallocate data block for heap + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Oct 12 2008 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HL_dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size) +{ + H5HL_dblk_t *dblk; /* Local heap data block */ + haddr_t old_addr; /* Old location of heap data block */ + haddr_t new_addr; /* New location of heap data block */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HL_dblk_realloc) + + /* check arguments */ + HDassert(heap); + HDassert(new_heap_size > 0); + + /* Release old space on disk */ + old_addr = heap->dblk_addr; + H5_CHECK_OVERFLOW(heap->dblk_size, size_t, hsize_t); + if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, old_addr, (hsize_t)heap->dblk_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't release old heap data?") + + /* Allocate new space on disk */ + H5_CHECK_OVERFLOW(new_heap_size, size_t, hsize_t); + if(HADDR_UNDEF == (new_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, (hsize_t)new_heap_size))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate file space for heap") + + /* Check if heap data block actually moved in the file */ + if(H5F_addr_eq(old_addr, new_addr)) { + /* Check if heap data block is contiguous w/prefix */ + if(heap->single_cache_obj) { + /* Sanity check */ + HDassert(H5F_addr_eq(heap->prfx_addr + heap->prfx_size, heap->dblk_addr)); + HDassert(heap->prfx); + + /* Resize the heap prefix in the cache */ + if(H5AC_resize_pinned_entry(heap->prfx, (size_t)(heap->prfx_size + new_heap_size)) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap in cache") + } /* end if */ + else { + /* Sanity check */ + HDassert(H5F_addr_ne(heap->prfx_addr + heap->prfx_size, heap->dblk_addr)); + HDassert(heap->dblk); + + /* Resize the heap data block in the cache */ + if(H5AC_resize_pinned_entry(heap->dblk, (size_t)new_heap_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap in cache") + } /* end else */ + } /* end if */ + else { + /* Check if heap data block was contiguous w/prefix previously */ + if(heap->single_cache_obj) { + /* Create new heap data block */ + if(NULL == (dblk = H5HL_dblk_new(heap))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate local heap data block") + + /* Resize current heap prefix */ + heap->prfx_size = H5HL_SIZEOF_HDR(f); + if(H5AC_resize_pinned_entry(heap->prfx, (size_t)heap->prfx_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap prefix in cache") + + /* Insert data block into cache (pinned) */ + if(H5AC_set(f, dxpl_id, H5AC_LHEAP_DBLK, new_addr, dblk, H5AC__PIN_ENTRY_FLAG) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache local heap data block") + dblk = NULL; + + /* Reset 'single cache object' flag */ + heap->single_cache_obj = FALSE; + } /* end if */ + else { + /* Resize the heap data block in the cache */ + /* (ignore [unlikely] case where heap data block ends up + * contiguous w/heap prefix again. + */ + if(H5AC_resize_pinned_entry(heap->dblk, (size_t)new_heap_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap data block in cache") + + /* Relocate the heap data block in the cache */ + if(H5AC_rename(f, H5AC_LHEAP_DBLK, old_addr, new_addr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRENAME, FAIL, "unable to move heap data block in cache") + } /* end else */ + } /* end else */ + + /* Update heap info*/ + heap->dblk_addr = new_addr; + heap->dblk_size = new_heap_size; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_dblk_realloc() */ + + +/*------------------------------------------------------------------------- * Function: H5HL_minimize_heap_space * * Purpose: Go through the heap's freelist and determine if we can @@ -194,9 +312,8 @@ done: static herr_t H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) { - size_t new_heap_size = heap->heap_alloc; /* New size of heap */ - size_t sizeof_hdr; - herr_t ret_value = SUCCEED; + size_t new_heap_size = heap->dblk_size; /* New size of heap */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HL_minimize_heap_space, FAIL) @@ -204,8 +321,6 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) HDassert(f); HDassert(heap); - sizeof_hdr = H5HL_SIZEOF_HDR(f); /* cache H5HL header size for file */ - /* * Check to see if we can reduce the size of the heap in memory by * eliminating free blocks at the tail of the buffer before flushing the @@ -218,7 +333,7 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) /* Search for a free block at the end of the buffer */ for(tmp_fl = heap->freelist; tmp_fl; tmp_fl = tmp_fl->next) /* Check if the end of this free block is at the end of the buffer */ - if(tmp_fl->offset + tmp_fl->size == heap->heap_alloc) { + if(tmp_fl->offset + tmp_fl->size == heap->dblk_size) { last_fl = tmp_fl; break; } /* end if */ @@ -233,7 +348,7 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) * buffer size (and the memory buffer is larger than the * minimum size), reduce or eliminate it. */ - if(last_fl->size >= (heap->heap_alloc / 2) && heap->heap_alloc > H5HL_MIN_HEAP) { + if(last_fl->size >= (heap->dblk_size / 2) && heap->dblk_size > H5HL_MIN_HEAP) { /* * Reduce size of buffer until it's too small or would * eliminate the free block @@ -255,8 +370,9 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) /* Truncate the free block */ last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset); new_heap_size = last_fl->offset + last_fl->size; - assert(last_fl->size >= H5HL_SIZEOF_FREE(f)); - } else { + HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f)); + } /* end if */ + else { /* * Set the size of the memory buffer to the start * of the free list @@ -266,12 +382,13 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) /* Eliminate the free block from the list */ last_fl = H5HL_remove_free(heap, last_fl); } /* end else */ - } else { + } /* end if */ + else { /* Truncate the free block */ last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset); new_heap_size = last_fl->offset + last_fl->size; - assert(last_fl->size >= H5HL_SIZEOF_FREE(f)); - assert(last_fl->size == H5HL_ALIGN(last_fl->size)); + HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f)); + HDassert(last_fl->size == H5HL_ALIGN(last_fl->size)); } /* end else */ } /* end if */ } /* end if */ @@ -282,31 +399,16 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) * data segment of the heap to another contiguous block of disk * storage. */ - if(new_heap_size != heap->heap_alloc) { - haddr_t old_addr = heap->addr, - new_addr; - - HDassert(new_heap_size < heap->heap_alloc); + if(new_heap_size != heap->dblk_size) { + HDassert(new_heap_size < heap->dblk_size); /* Resize the memory buffer */ - heap->chunk = H5FL_BLK_REALLOC(lheap_chunk, heap->chunk, (sizeof_hdr + new_heap_size)); - if(!heap->chunk) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* Release old space on disk */ - /* (Should be safe to free old heap space first, since it's shrinking -QAK) */ - H5_CHECK_OVERFLOW(heap->heap_alloc, size_t, hsize_t); - if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, old_addr, (hsize_t)heap->heap_alloc) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap") - - /* Allocate new space on disk */ - H5_CHECK_OVERFLOW(new_heap_size, size_t, hsize_t); - if(HADDR_UNDEF == (new_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, (hsize_t)new_heap_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file space for heap") - - /* Update heap info*/ - heap->addr = new_addr; - heap->heap_alloc = new_heap_size; + if(NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, new_heap_size))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") + + /* Reallocate data block in file */ + if(H5HL_dblk_realloc(f, dxpl_id, heap, new_heap_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "reallocating data block failed") } /* end if */ done: @@ -317,26 +419,9 @@ done: /*------------------------------------------------------------------------- * Function: H5HL_protect * - * Purpose: This function is a wrapper for the H5AC_protect call. The - * old H5HL_peek call (which this once was) wasn't "safe" - * for FPHDF5. (It'd get a read lock on an object but once - * it got that object, it'd release it keeping the old - * pointer value, which is no longer valid. This won't work - * since the pointer into some metdata block can become - * invalid.) - * - * N.B.: This function is always called in conjunction with - * the H5HL_offset_into function. The return from that - * function is the proper pointer to the heap's object. This - * is done so that the return from this function can be sent - * to H5HL_unprotect. - * - * Return: Success: Ptr to the object. The pointer points to a - * chunk of memory large enough to hold the - * object from the specified offset (usually the - * beginning of the object) to the end of the - * object. Do not attempt to read past the end - * of the object. + * Purpose: This function is a wrapper for the H5AC_protect call. + * + * Return: Success: Non-NULL pointer to the local heap prefix. * Failure: NULL * * Programmer: Bill Wendling @@ -348,7 +433,13 @@ done: H5HL_t * H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw) { - H5HL_t *ret_value; + H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ + H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ + H5HL_dblk_t *dblk = NULL; /* Local heap data block */ + H5HL_t *heap; /* Heap data structure */ + unsigned prfx_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting prefix entry */ + unsigned dblk_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting data block entry */ + H5HL_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5HL_protect, NULL) @@ -356,10 +447,65 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw) HDassert(f); HDassert(H5F_addr_defined(addr)); - if(NULL == (ret_value = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, rw))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap") + /* Construct the user data for protect callback */ + prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); + prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); + prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); + prfx_udata.loaded = FALSE; + prfx_udata.free_block = H5HL_FREE_NULL; + + /* Protect the local heap prefix */ + if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, NULL, &prfx_udata, rw))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap prefix") + + /* Get the pointer to the heap */ + heap = prfx->heap; + + /* Check if the heap is already pinned in memory */ + /* (for re-entrant situation) */ + if(heap->prots == 0) { + /* Check if heap has separate data block */ + if(heap->single_cache_obj) { + /* Set the flag for pinning the prefix when unprotecting it */ + prfx_cache_flags |= H5AC__PIN_ENTRY_FLAG; + } /* end if */ + else { + H5HL_cache_dblk_ud_t dblk_udata; /* User data for protecting local heap data block */ + + /* Construct the user data for protect callback */ + dblk_udata.heap = heap; + dblk_udata.free_block = prfx_udata.loaded ? prfx_udata.free_block : + (heap->freelist ? heap->freelist->offset : H5HL_FREE_NULL); + dblk_udata.loaded = FALSE; + + /* Protect the local heap data block */ + if(NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, NULL, &dblk_udata, rw))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap data block") + + /* Pin the prefix, if the data block was loaded from file */ + if(dblk_udata.loaded) + prfx_cache_flags |= H5AC__PIN_ENTRY_FLAG; + + /* Set the flag for pinning the data block when unprotecting it */ + dblk_cache_flags |= H5AC__PIN_ENTRY_FLAG; + } /* end if */ + } /* end if */ + + /* Increment # of times heap is protected */ + heap->prots++; + + /* Set return value */ + ret_value = heap; done: + /* Release the prefix from the cache, now pinned */ + if(prfx && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, prfx_cache_flags) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap prefix") + + /* Release the data block from the cache, now pinned */ + if(dblk && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, dblk_cache_flags) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap data block") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL_protect() */ @@ -380,7 +526,7 @@ done: *------------------------------------------------------------------------- */ void * -H5HL_offset_into(H5F_t *f, const H5HL_t *heap, size_t offset) +H5HL_offset_into(const H5HL_t *heap, size_t offset) { /* * We need to have called some other function before this to get a @@ -388,11 +534,11 @@ H5HL_offset_into(H5F_t *f, const H5HL_t *heap, size_t offset) */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_offset_into) - HDassert(f); + /* Sanity check */ HDassert(heap); - HDassert(offset < heap->heap_alloc); + HDassert(offset < heap->dblk_size); - FUNC_LEAVE_NOAPI(heap->chunk + H5HL_SIZEOF_HDR(f) + offset) + FUNC_LEAVE_NOAPI(heap->dblk_image + offset) } /* end H5HL_offset_into() */ @@ -411,19 +557,36 @@ H5HL_offset_into(H5F_t *f, const H5HL_t *heap, size_t offset) *------------------------------------------------------------------------- */ herr_t -H5HL_unprotect(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, haddr_t addr) +H5HL_unprotect(H5HL_t *heap) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5HL_unprotect, FAIL) /* check arguments */ - HDassert(f); HDassert(heap); - HDassert(H5F_addr_defined(addr)); - if(H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, (void *)heap, H5AC__NO_FLAGS_SET) != SUCCEED) - HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header") + /* Decrement # of times heap is protected */ + heap->prots--; + + /* Check for last unprotection of heap */ + if(heap->prots == 0) { + /* Check for separate heap data block */ + if(heap->single_cache_obj) { + /* Mark local heap prefix as evictable again */ + if(H5AC_unpin_entry(heap->prfx) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap data block") + } /* end if */ + else { + /* Sanity check */ + HDassert(heap->dblk); + + /* Mark local heap data block as evictable again */ + /* (data block still pins prefix) */ + if(H5AC_unpin_entry(heap->dblk) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap data block") + } /* end else */ + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -462,13 +625,55 @@ H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl) /*------------------------------------------------------------------------- + * Function: H5HL_dirty + * + * Purpose: Mark heap as dirty + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Oct 12 2008 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HL_dirty(H5HL_t *heap) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HL_dirty) + + /* check arguments */ + HDassert(heap); + HDassert(heap->prfx); + + /* Mark heap data block as dirty, if there is one */ + if(!heap->single_cache_obj) { + /* Sanity check */ + HDassert(heap->dblk); + + if(H5AC_mark_pinned_or_protected_entry_dirty(heap->dblk) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap data block as dirty") + } /* end if */ + + /* Mark heap prefix as dirty */ + if(H5AC_mark_pinned_or_protected_entry_dirty(heap->prfx) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap prefix as dirty") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_dirty() */ + + +/*------------------------------------------------------------------------- * Function: H5HL_insert * * Purpose: Inserts a new item into the heap. * * Return: Success: Offset of new item within heap. - * - * Failure: (size_t)(-1) + * Failure: UFAIL * * Programmer: Robb Matzke * matzke@llnl.gov @@ -483,10 +688,9 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * size_t offset = 0; size_t need_size; hbool_t found; - size_t sizeof_hdr; /* Cache H5HL header size for file */ size_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5HL_insert, (size_t)(-1)) + FUNC_ENTER_NOAPI(H5HL_insert, UFAIL) /* check arguments */ HDassert(f); @@ -500,11 +704,8 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * * so we just accept that an extra flush of the heap info could occur * if an error occurs -QAK) */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, (size_t)(-1), "unable to mark heap as dirty") - - /* Cache this for later */ - sizeof_hdr = H5HL_SIZEOF_HDR(f); + if(H5HL_dirty(heap) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, UFAIL, "unable to mark heap as dirty") /* * In order to keep the free list descriptors aligned on word boundaries, @@ -548,12 +749,13 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * */ if(found == FALSE) { size_t need_more; /* How much more space we need */ - size_t new_heap_alloc; /* Final size of space allocated for heap */ + size_t new_dblk_size; /* Final size of space allocated for heap data block */ + size_t old_dblk_size; /* Previous size of space allocated for heap data block */ htri_t extended; /* Whether the local heap's data segment on disk was extended */ /* At least double the heap's size, making certain there's enough room * for the new object */ - need_more = MAX(need_size, heap->heap_alloc); + need_more = MAX(need_size, heap->dblk_size); /* If there is no last free block or it's not at the end of the heap, * and the amount of space to allocate is not big enough to include at @@ -561,72 +763,46 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * * space requested to just the amount of space needed. (Generally * speaking, this only occurs when the heap is small -QAK) */ - if(!(last_fl && last_fl->offset + last_fl->size == heap->heap_alloc) + if(!(last_fl && last_fl->offset + last_fl->size == heap->dblk_size) && (need_more < (need_size + H5HL_SIZEOF_FREE(f)))) need_more = need_size; - new_heap_alloc = heap->heap_alloc + need_more; -#if 0 /* JRM */ /* delete this once we are convinced that the general - * fix will do the job. - */ -/* - * XXX: This is a _total_ hack, a real kludge. :-/ The metadata cache currently - * responds very poorly when an object is inserted into the cache (or - * resized) that is larger than the current cache size. It waits through - * an entire 'epoch' of cache operations to resize the cache larger (getting - * _very_ poor performance), instead of immediately accommodating the large - * object by increasing the cache size. - * - * So, what we are doing here is to look at the current cache size, check - * if the new local heap will overwhelm the cache and, if so, resize the - * cache to be large enough to hold the new local heap block along with - * leaving room for other objects in the cache. - * - * John will be working on a fix inside the cache itself, so this special - * case code here can be removed when he's finished. - QAK, 2007/12/21 - */ -{ - H5AC_cache_config_t mdc_config; - - /* Retrieve the current cache information */ - mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION; - if(H5AC_get_cache_auto_resize_config(f->shared->cache, &mdc_config) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (size_t)-1, "H5AC_get_cache_auto_resize_config() failed.") - - /* Check if the current cache will get blown out by adding this heap - * block and resize it if so. - */ - if((2 * new_heap_alloc) >= mdc_config.initial_size) { - mdc_config.set_initial_size = TRUE; - mdc_config.initial_size = 2 * new_heap_alloc; - - if(H5AC_set_cache_auto_resize_config(f->shared->cache, &mdc_config) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (size_t)-1, "H5AC_set_cache_auto_resize_config() failed.") - } /* end if */ -} -#endif /* JRM */ - HDassert(heap->heap_alloc < new_heap_alloc); - H5_CHECK_OVERFLOW(heap->heap_alloc, size_t, hsize_t); - H5_CHECK_OVERFLOW(new_heap_alloc, size_t, hsize_t); + new_dblk_size = heap->dblk_size + need_more; + HDassert(heap->dblk_size < new_dblk_size); + old_dblk_size = heap->dblk_size; + H5_CHECK_OVERFLOW(heap->dblk_size, size_t, hsize_t); + H5_CHECK_OVERFLOW(new_dblk_size, size_t, hsize_t); /* Extend current heap if possible */ - extended = H5MF_try_extend(f, dxpl_id, H5FD_MEM_LHEAP, heap->addr, (hsize_t)(heap->heap_alloc), (hsize_t)need_more); + extended = H5MF_try_extend(f, dxpl_id, H5FD_MEM_LHEAP, heap->dblk_addr, (hsize_t)(heap->dblk_size), (hsize_t)need_more); if(extended < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, (size_t)(-1), "error trying to extend heap") - - /* If we couldn't extend the heap, release old chunk and allocate a new one */ - if(extended == FALSE) { - /* Release old space on disk */ - if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, heap->addr, (hsize_t)heap->heap_alloc) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, (size_t)(-1), "unable to free local heap") - - /* allocate new disk space for the heap */ - if((heap->addr = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, (hsize_t)new_heap_alloc)) == HADDR_UNDEF) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, (size_t)(-1), "unable to allocate file space for heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, UFAIL, "error trying to extend heap") + + /* Check if we extended the heap data block in file */ + if(extended == TRUE) { + /* Check for prefix & data block contiguous */ + if(heap->single_cache_obj) { + /* Resize prefix+data block */ + if(H5AC_resize_pinned_entry(heap->prfx, (size_t)(heap->prfx_size + new_dblk_size)) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, UFAIL, "unable to resize heap prefix in cache") + } /* end if */ + else { + /* Resize 'standalone' data block */ + if(H5AC_resize_pinned_entry(heap->dblk, (size_t)new_dblk_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, UFAIL, "unable to resize heap data block in cache") + } /* end else */ + + /* Note new size */ + heap->dblk_size = new_dblk_size; + } /* end if */ + else { /* ...if we can't, allocate a new chunk & release the old */ + /* Reallocate data block in file */ + if(H5HL_dblk_realloc(f, dxpl_id, heap, new_dblk_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, UFAIL, "reallocating data block failed") } /* end if */ /* If the last free list in the heap is at the end of the heap, extend it */ - if(last_fl && last_fl->offset + last_fl->size == heap->heap_alloc) { + if(last_fl && last_fl->offset + last_fl->size == old_dblk_size) { /* * Increase the size of the last free block. */ @@ -651,17 +827,18 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * * Create a new free list element large enough that we can * take some space out of it right away. */ - offset = heap->heap_alloc; + offset = old_dblk_size; if(need_more - need_size >= H5HL_SIZEOF_FREE(f)) { if(NULL == (fl = H5FL_MALLOC(H5HL_free_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, (size_t)(-1), "memory allocation failed") - fl->offset = heap->heap_alloc + need_size; + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, UFAIL, "memory allocation failed") + fl->offset = old_dblk_size + need_size; fl->size = need_more - need_size; HDassert(fl->offset == H5HL_ALIGN(fl->offset)); HDassert(fl->size == H5HL_ALIGN(fl->size)); fl->prev = NULL; fl->next = heap->freelist; - if (heap->freelist) heap->freelist->prev = fl; + if(heap->freelist) + heap->freelist->prev = fl; heap->freelist = fl; #ifdef H5HL_DEBUG } else if (H5DEBUG(HL) && need_more > need_size) { @@ -676,24 +853,20 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * if (H5DEBUG(HL)) { fprintf(H5DEBUG(HL), "H5HL: resize mem buf from %lu to %lu bytes\n", - (unsigned long)(heap->heap_alloc), - (unsigned long)(heap->heap_alloc + need_more)); + (unsigned long)(old_dblk_size), + (unsigned long)(old_dblk_size + need_more)); } #endif - heap->heap_alloc = new_heap_alloc; - heap->chunk = H5FL_BLK_REALLOC(lheap_chunk, heap->chunk, (sizeof_hdr + heap->heap_alloc)); - if(NULL == heap->chunk) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, (size_t)(-1), "memory allocation failed") + if(NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, heap->dblk_size))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, UFAIL, "memory allocation failed") /* Clear new section so junk doesn't appear in the file */ /* (Avoid clearing section which will be overwritten with newly inserted data) */ - HDmemset(heap->chunk + sizeof_hdr + offset + buf_size, 0, (new_heap_alloc - (offset + buf_size))); + HDmemset(heap->dblk_image + offset + buf_size, 0, (new_dblk_size - (offset + buf_size))); } /* end if */ - /* - * Copy the data into the heap - */ - HDmemcpy(heap->chunk + sizeof_hdr + offset, buf, buf_size); + /* Copy the data into the heap */ + HDmemcpy(heap->dblk_image + offset, buf, buf_size); /* Set return value */ ret_value = offset; @@ -743,8 +916,8 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size) size = H5HL_ALIGN(size); - HDassert(offset < heap->heap_alloc); - HDassert(offset + size <= heap->heap_alloc); + HDassert(offset < heap->dblk_size); + HDassert(offset + size <= heap->dblk_size); /* Mark heap as dirty in cache */ /* (A bit early in the process, but it's difficult to determine in the @@ -752,7 +925,7 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size) * so we just accept that an extra flush of the heap info could occur * if an error occurs -QAK) */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, heap) < 0) + if(H5HL_dirty(heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap as dirty") /* @@ -767,56 +940,56 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size) if((offset + size) == fl->offset) { fl->offset = offset; fl->size += size; - HDassert(fl->offset==H5HL_ALIGN (fl->offset)); - HDassert(fl->size==H5HL_ALIGN (fl->size)); + HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); fl2 = fl->next; while(fl2) { if((fl2->offset + fl2->size) == fl->offset) { fl->offset = fl2->offset; fl->size += fl2->size; - HDassert(fl->offset == H5HL_ALIGN (fl->offset)); - HDassert(fl->size == H5HL_ALIGN (fl->size)); + HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); fl2 = H5HL_remove_free(heap, fl2); - if(((fl->offset + fl->size) == heap->heap_alloc ) && - ((2 * fl->size) > heap->heap_alloc )) { + if(((fl->offset + fl->size) == heap->dblk_size) && + ((2 * fl->size) > heap->dblk_size)) { if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed") } HGOTO_DONE(SUCCEED); } fl2 = fl2->next; } - if(((fl->offset + fl->size) == heap->heap_alloc) && - ((2 * fl->size) > heap->heap_alloc)) { + if(((fl->offset + fl->size) == heap->dblk_size) && + ((2 * fl->size) > heap->dblk_size)) { if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed") } HGOTO_DONE(SUCCEED); } else if(fl->offset + fl->size == offset) { fl->size += size; fl2 = fl->next; - HDassert(fl->size==H5HL_ALIGN (fl->size)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); while(fl2) { if(fl->offset + fl->size == fl2->offset) { fl->size += fl2->size; - HDassert(fl->size==H5HL_ALIGN (fl->size)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); fl2 = H5HL_remove_free(heap, fl2); - if(((fl->offset + fl->size) == heap->heap_alloc) && - ((2 * fl->size) > heap->heap_alloc)) { + if(((fl->offset + fl->size) == heap->dblk_size) && + ((2 * fl->size) > heap->dblk_size)) { if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed") - } + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed") + } /* end if */ HGOTO_DONE(SUCCEED); - } + } /* end if */ fl2 = fl2->next; - } - if(((fl->offset + fl->size) == heap->heap_alloc) && - ((2 * fl->size) > heap->heap_alloc)) { + } /* end while */ + if(((fl->offset + fl->size) == heap->dblk_size) && + ((2 * fl->size) > heap->dblk_size)) { if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed") - } + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed") + } /* end if */ HGOTO_DONE(SUCCEED); - } + } /* end if */ fl = fl->next; } /* end while */ @@ -839,7 +1012,7 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size) * Add an entry to the free list. */ if(NULL == (fl = H5FL_MALLOC(H5HL_free_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") fl->offset = offset; fl->size = size; HDassert(fl->offset == H5HL_ALIGN(fl->offset)); @@ -850,10 +1023,10 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size) heap->freelist->prev = fl; heap->freelist = fl; - if(((fl->offset + fl->size) == heap->heap_alloc) && - ((2 * fl->size) > heap->heap_alloc)) { + if(((fl->offset + fl->size) == heap->dblk_size) && + ((2 * fl->size) > heap->dblk_size)) { if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed") } /* end if */ done: @@ -877,9 +1050,12 @@ done: herr_t H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) { - H5HL_t *heap = NULL; /* Local heap to delete */ + H5HL_t *heap; /* Local heap to delete */ + H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ + H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ + H5HL_dblk_t *dblk = NULL; /* Local heap data block */ unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting heap */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HL_delete, FAIL) @@ -887,16 +1063,71 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) HDassert(f); HDassert(H5F_addr_defined(addr)); - /* Get heap pointer */ - if(NULL == (heap = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") + /* Construct the user data for protect callback */ + prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); + prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); + prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); + prfx_udata.loaded = FALSE; + prfx_udata.free_block = H5HL_FREE_NULL; + + /* Protect the local heap prefix */ + if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, NULL, &prfx_udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix") + + /* Get the pointer to the heap */ + heap = prfx->heap; + + /* Check if heap has separate data block */ + if(!heap->single_cache_obj) { + H5HL_cache_dblk_ud_t dblk_udata; /* User data for protecting local heap data block */ + + /* Construct the user data for protect callback */ + dblk_udata.heap = heap; + dblk_udata.free_block = prfx_udata.loaded ? prfx_udata.free_block : + (heap->freelist ? heap->freelist->offset : H5HL_FREE_NULL); + dblk_udata.loaded = FALSE; + + /* Protect the local heap data block */ + if(NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, NULL, &dblk_udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap data block") + + /* Pin the prefix, if the data block was loaded from file */ + if(dblk_udata.loaded) { + if(H5AC_pin_protected_entry(prfx) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin local heap prefix") + } /* end if */ + } /* end if */ - /* Set the cache flags to delete the heap & free its file space */ + /* Check if the heap is contiguous on disk */ + if(heap->single_cache_obj) { + /* Free the contiguous local heap in one call */ + H5_CHECK_OVERFLOW(heap->prfx_size + heap->dblk_size, size_t, hsize_t); + if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, addr, (hsize_t)(heap->prfx_size + heap->dblk_size)) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free contiguous local heap") + } /* end if */ + else { + /* Free the local heap's prefix */ + H5_CHECK_OVERFLOW(heap->prfx_size, size_t, hsize_t); + if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, heap->prfx_addr, (hsize_t)heap->prfx_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap header") + + /* Free the local heap's data block */ + H5_CHECK_OVERFLOW(heap->dblk_size, size_t, hsize_t); + if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, heap->dblk_addr, (hsize_t)heap->dblk_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap data") + } /* end else */ + + /* Set the flags for releasing the prefix and data block */ cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; done: - if(heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, cache_flags) < 0) - HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release local heap") + /* Release the data block from the cache, now deleted */ + if(dblk && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, cache_flags) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap data block") + + /* Release the prefix from the cache, now deleted */ + if(prfx && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, cache_flags) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix") FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL_delete() */ @@ -918,8 +1149,10 @@ done: herr_t H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size) { - H5HL_t *heap = NULL; /* Heap to query */ - herr_t ret_value = SUCCEED; /* Return value */ + H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ + H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ + H5HL_t *heap; /* Heap data structure */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HL_get_size, FAIL) @@ -928,16 +1161,26 @@ H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size) HDassert(H5F_addr_defined(addr)); HDassert(size); - /* Get heap pointer */ - if(NULL == (heap = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") + /* Construct the user data for protect callback */ + prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); + prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); + prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); + prfx_udata.loaded = FALSE; + prfx_udata.free_block = H5HL_FREE_NULL; + + /* Protect the local heap prefix */ + if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, NULL, &prfx_udata, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix") + + /* Get the pointer to the heap */ + heap = prfx->heap; /* Set the size to return */ - *size = heap->heap_alloc; + *size = heap->dblk_size; done: - if(heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release local heap") + if(prfx && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix") FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL_get_size() */ @@ -959,9 +1202,10 @@ done: herr_t H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size) { - H5HL_t *heap = NULL; /* Heap to query */ - size_t local_heap_size = 0; - herr_t ret_value = SUCCEED; /* Return value */ + H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ + H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ + H5HL_t *heap; /* Heap data structure */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HL_heapsize, FAIL) @@ -970,20 +1214,26 @@ H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size) HDassert(H5F_addr_defined(addr)); HDassert(heap_size); - /* Get heap pointer */ - if(NULL == (heap = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") + /* Construct the user data for protect callback */ + prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); + prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); + prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); + prfx_udata.loaded = FALSE; + prfx_udata.free_block = H5HL_FREE_NULL; + + /* Protect the local heap prefix */ + if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, NULL, &prfx_udata, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix") - /* Get the total size of the local heap */ - if(H5HL_size(f, heap, &local_heap_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to compute size of local heap") + /* Get the pointer to the heap */ + heap = prfx->heap; /* Accumulate the size of the local heap */ - *heap_size += (hsize_t)local_heap_size; + *heap_size += (hsize_t)(heap->prfx_size + heap->dblk_size); done: - if(heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release local heap") + if(prfx && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix") FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL_heapsize() */ diff --git a/src/H5HLcache.c b/src/H5HLcache.c index fa458ca..6e725ac 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -38,6 +38,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5HLpkg.h" /* Local Heaps */ #include "H5MFprivate.h" /* File memory management */ +#include "H5WBprivate.h" /* Wrapped Buffers */ /****************/ @@ -45,7 +46,12 @@ /****************/ #define H5HL_VERSION 0 /* Local heap collection version */ -#define H5HL_FREE_NULL 1 /* End of free list on disk */ + +/* Set the local heap size to speculatively read in */ +/* (needs to be more than the local heap prefix size to work at all and + * should be larger than the default local heap size to save the + * extra I/O operations) */ +#define H5HL_SPEC_READ_SIZE 512 /******************/ @@ -62,20 +68,48 @@ /* Local Prototypes */ /********************/ -/* Local encode/decode routines */ -static herr_t H5HL_serialize(H5F_t *f, H5HL_t *heap, uint8_t *buf); - /* Metadata cache callbacks */ -static H5HL_t *H5HL_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, - void *udata2); -static herr_t H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, H5HL_t *heap, unsigned UNUSED * flags_ptr); -static herr_t H5HL_clear(H5F_t *f, H5HL_t *heap, hbool_t destroy); +static void *H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, + const void *udata1, void *udata2); +static herr_t H5HL_prefix_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, + void *thing, unsigned *flags_ptr); +static herr_t H5HL_prefix_dest(H5F_t *f, void *thing); +static herr_t H5HL_prefix_clear(H5F_t *f, void *thing, hbool_t destroy); +static herr_t H5HL_prefix_size(const H5F_t *f, const void *thing, size_t *size_ptr); +static void *H5HL_datablock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, + const void *udata1, void *udata2); +static herr_t H5HL_datablock_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, + void *thing, unsigned *flags_ptr); +static herr_t H5HL_datablock_dest(H5F_t *f, void *thing); +static herr_t H5HL_datablock_clear(H5F_t *f, void *thing, hbool_t destroy); +static herr_t H5HL_datablock_size(const H5F_t *f, const void *thing, size_t *size_ptr); /*********************/ /* Package Variables */ /*********************/ +/* H5HL inherits cache-like properties from H5AC */ +const H5AC_class_t H5AC_LHEAP_PRFX[1] = {{ + H5AC_LHEAP_PRFX_ID, + H5HL_prefix_load, + H5HL_prefix_flush, + H5HL_prefix_dest, + H5HL_prefix_clear, + NULL, + H5HL_prefix_size, +}}; + +const H5AC_class_t H5AC_LHEAP_DBLK[1] = {{ + H5AC_LHEAP_DBLK_ID, + H5HL_datablock_load, + H5HL_datablock_flush, + H5HL_datablock_dest, + H5HL_datablock_clear, + NULL, + H5HL_datablock_size, +}}; + /*****************************/ /* Library Private Variables */ @@ -86,85 +120,120 @@ static herr_t H5HL_clear(H5F_t *f, H5HL_t *heap, hbool_t destroy); /* Local Variables */ /*******************/ -/* H5HL inherits cache-like properties from H5AC */ -const H5AC_class_t H5AC_LHEAP[1] = {{ - H5AC_LHEAP_ID, - (H5AC_load_func_t)H5HL_load, - (H5AC_flush_func_t)H5HL_flush, - (H5AC_dest_func_t)H5HL_dest, - (H5AC_clear_func_t)H5HL_clear, - (H5AC_notify_func_t)NULL, - (H5AC_size_func_t)H5HL_size, -}}; /*------------------------------------------------------------------------- - * Function: H5HL_serialize + * Function: H5HL_fl_deserialize * - * Purpose: Serialize the heap. This function will eliminate free - * blocks at the tail of the heap and also split the block - * if it needs to be split for the file. This is so that we - * can serialize it correctly. + * Purpose: Deserialize the free list for a heap data block * * Return: Non-negative on success/Negative on failure * - * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu - * Sept. 16, 2003 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Oct 12 2008 * *------------------------------------------------------------------------- */ static herr_t -H5HL_serialize(H5F_t *f, H5HL_t *heap, uint8_t *buf) +H5HL_fl_deserialize(H5HL_t *heap, hsize_t free_block) { - H5HL_free_t *fl; - uint8_t *p; - herr_t ret_value = SUCCEED; + H5HL_free_t *fl, *tail = NULL; /* Heap free block nodes */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_serialize) + FUNC_ENTER_NOAPI_NOINIT(H5HL_fl_deserialize) - /* check args */ - assert(buf); - assert(heap); + /* check arguments */ + HDassert(heap); - /* serialize the header */ - p = buf; - fl = heap->freelist; - HDmemcpy(p, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC); - p += H5_SIZEOF_MAGIC; - *p++ = H5HL_VERSION; - *p++ = 0; /*reserved*/ - *p++ = 0; /*reserved*/ - *p++ = 0; /*reserved*/ - H5F_ENCODE_LENGTH(f, p, heap->heap_alloc); - H5F_ENCODE_LENGTH(f, p, fl ? fl->offset : H5HL_FREE_NULL); - H5F_addr_encode(f, &p, heap->addr); - - /* serialize the free list */ - for (; fl; fl = fl->next) { - assert (fl->offset == H5HL_ALIGN (fl->offset)); - p = heap->chunk + H5HL_SIZEOF_HDR(f) + fl->offset; - - if (fl->next) { - H5F_ENCODE_LENGTH(f, p, fl->next->offset); - } else { - H5F_ENCODE_LENGTH(f, p, H5HL_FREE_NULL); - } - - H5F_ENCODE_LENGTH(f, p, fl->size); - } + /* Build free list */ + while(H5HL_FREE_NULL != free_block) { + const uint8_t *p; /* Pointer into image buffer */ + + /* Sanity check */ + if(free_block >= heap->dblk_size) + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "bad heap free list") + /* Allocate & initialize free list node */ + if(NULL == (fl = H5FL_MALLOC(H5HL_free_t))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") + fl->offset = (size_t)free_block; + fl->prev = tail; + fl->next = NULL; + + /* Insert node into list */ + if(tail) + tail->next = fl; + tail = fl; + if(!heap->freelist) + heap->freelist = fl; + + /* Decode offset of next free block */ + p = heap->dblk_image + free_block; + H5F_DECODE_LENGTH_LEN(p, free_block, heap->sizeof_size); + if(free_block == 0) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "free block size is zero?") + + /* Decode length of this free block */ + H5F_DECODE_LENGTH_LEN(p, fl->size, heap->sizeof_size); + if(fl->offset + fl->size > heap->dblk_size) + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "bad heap free list") + } /* end while */ + +done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_serialize() */ +} /* end H5HL_fl_deserialize() */ /*------------------------------------------------------------------------- - * Function: H5HL_load + * Function: H5HL_fl_serialize * - * Purpose: Loads a heap from disk. + * Purpose: Serialize the free list for a heap data block * - * Return: Success: Ptr to a local heap memory data structure. + * Return: Success: SUCCESS + * Failure: FAIL * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Oct 12 2008 + * + *------------------------------------------------------------------------- + */ +static void +H5HL_fl_serialize(const H5HL_t *heap) +{ + H5HL_free_t *fl; /* Pointer to heap free list node */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_fl_serialize) + + /* check arguments */ + HDassert(heap); + + /* Serialize the free list into the heap data's image */ + for(fl = heap->freelist; fl; fl = fl->next) { + uint8_t *p; /* Pointer into raw data buffer */ + + HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + p = heap->dblk_image + fl->offset; + + if(fl->next) + H5F_ENCODE_LENGTH_LEN(p, fl->next->offset, heap->sizeof_size) + else + H5F_ENCODE_LENGTH_LEN(p, H5HL_FREE_NULL, heap->sizeof_size) + + H5F_ENCODE_LENGTH_LEN(p, fl->size, heap->sizeof_size) + } /* end for */ + + FUNC_LEAVE_NOAPI_VOID +} /* end H5HL_fl_serialize() */ + + +/*------------------------------------------------------------------------- + * Function: H5HL_prefix_load + * + * Purpose: Loads a local heap prefix from disk. + * + * Return: Success: Ptr to a local heap memory data structure. * Failure: NULL * * Programmer: Robb Matzke @@ -173,110 +242,426 @@ H5HL_serialize(H5F_t *f, H5HL_t *heap, uint8_t *buf) * *------------------------------------------------------------------------- */ -static H5HL_t * -H5HL_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1, - void UNUSED * udata2) +static void * +H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, + void *_udata) { - uint8_t hdr[52]; - size_t sizeof_hdr; /* Cache H5HL header size for file */ - const uint8_t *p = NULL; - H5HL_t *heap = NULL; - H5HL_free_t *fl = NULL, *tail = NULL; - size_t free_block = H5HL_FREE_NULL; - H5HL_t *ret_value; + H5HL_t *heap = NULL; /* Local heap */ + H5HL_prfx_t *prfx = NULL; /* Heap prefix deserialized */ + H5HL_cache_prfx_ud_t *udata = (H5HL_cache_prfx_ud_t *)_udata; /* User data for protecting local heap prefix */ + uint8_t buf[H5HL_SPEC_READ_SIZE]; /* Buffer for decoding */ + size_t spec_read_size; /* Size of buffer to speculatively read in */ + const uint8_t *p; /* Pointer into decoding buffer */ + haddr_t eoa; /* Relative end of file address */ + void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5HL_load, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5HL_prefix_load) /* check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(!udata1); - HDassert(!udata2); - - /* Cache this for later */ - sizeof_hdr = H5HL_SIZEOF_HDR(f); - HDassert(sizeof_hdr <= sizeof(hdr)); - - /* Get the local heap's header */ - if(H5F_block_read(f, H5FD_MEM_LHEAP, addr, sizeof_hdr, dxpl_id, hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read heap header") - p = hdr; + HDassert(udata); + HDassert(udata->sizeof_size > 0); + HDassert(udata->sizeof_addr > 0); + HDassert(udata->sizeof_prfx > 0); + HDassert(udata->sizeof_prfx <= sizeof(buf)); + + /* Make certain we don't speculatively read off the end of the file */ + if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_LHEAP))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, NULL, "unable to determine file size") + + /* Compute the size of the speculative local heap prefix buffer */ + H5_ASSIGN_OVERFLOW(spec_read_size, MIN(eoa - addr, H5HL_SPEC_READ_SIZE), /* From: */ hsize_t, /* To: */ size_t); + HDassert(spec_read_size >= udata->sizeof_prfx); + + /* Attempt to speculatively read both local heap prefix and heap data */ + if(H5F_block_read(f, H5FD_MEM_LHEAP, addr, spec_read_size, dxpl_id, buf) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read local heap prefix") + p = buf; /* Check magic number */ - if(HDmemcmp(hdr, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "bad heap signature") + if(HDmemcmp(p, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "bad local heap signature") p += H5_SIZEOF_MAGIC; /* Version */ if(H5HL_VERSION != *p++) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong version number in global heap") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "wrong version number in global heap") /* Reserved */ p += 3; /* Allocate space in memory for the heap */ - if(NULL == (heap = H5FL_CALLOC(H5HL_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + if(NULL == (heap = H5HL_new(udata->sizeof_size, udata->sizeof_addr, udata->sizeof_prfx))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap structure") + + /* Allocate the heap prefix */ + if(NULL == (prfx = H5HL_prfx_new(heap))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap prefix") + + /* Store the prefix's address & length */ + heap->prfx_addr = addr; + heap->prfx_size = udata->sizeof_prfx; + + /* Heap data size */ + H5F_DECODE_LENGTH_LEN(p, heap->dblk_size, udata->sizeof_size); + + /* Free list head */ + H5F_DECODE_LENGTH_LEN(p, udata->free_block, udata->sizeof_size); + if(udata->free_block != H5HL_FREE_NULL && udata->free_block >= heap->dblk_size) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "bad heap free list") + + /* Heap data address */ + H5F_addr_decode_len(udata->sizeof_addr, &p, &(heap->dblk_addr)); + + /* Check if heap block exists */ + if(heap->dblk_size) { + /* Check if heap data block is contiguous with header */ + if(H5F_addr_eq((heap->prfx_addr + heap->prfx_size), heap->dblk_addr)) { + /* Note that the heap should be a single object in the cache */ + heap->single_cache_obj = TRUE; + + /* Allocate space for the heap data image */ + if(NULL == (heap->dblk_image = H5FL_BLK_MALLOC(lheap_chunk, heap->dblk_size))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") + + /* Check if the current buffer from the speculative read already has the heap data */ + if(spec_read_size >= (heap->prfx_size + heap->dblk_size)) { + /* Copy the heap data from the speculative read buffer */ + HDmemcpy(heap->dblk_image, p, heap->dblk_size); + } /* end if */ + else { + /* Read the local heap data block directly into buffer */ + if(H5F_block_read(f, H5FD_MEM_LHEAP, heap->dblk_addr, heap->dblk_size, dxpl_id, heap->dblk_image) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read heap data") + } /* end else */ + + /* Build free list */ + if(H5HL_fl_deserialize(heap, udata->free_block) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list") + } /* end if */ + else + /* Note that the heap should _NOT_ be a single object in the cache */ + heap->single_cache_obj = FALSE; + } /* end if */ + + /* Set flag to indicate prefix from loaded from file */ + udata->loaded = TRUE; - /* heap data size */ - H5F_DECODE_LENGTH(f, p, heap->heap_alloc); + /* Set return value */ + ret_value = prfx; - /* free list head */ - H5F_DECODE_LENGTH(f, p, free_block); - if(free_block != H5HL_FREE_NULL && free_block >= heap->heap_alloc) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "bad heap free list") +done: + /* Release the [possibly partially initialized] local heap on errors */ + if(!ret_value) { + if(prfx) { + if(H5HL_prfx_dest(prfx) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap prefix") + } /* end if */ + else { + if(heap && H5HL_dest(heap) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap") + } /* end else */ + } /* end if */ - /* data */ - H5F_addr_decode(f, &p, &(heap->addr)); - if(NULL == (heap->chunk = H5FL_BLK_CALLOC(lheap_chunk, (sizeof_hdr + heap->heap_alloc)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - if(heap->heap_alloc && - H5F_block_read(f, H5FD_MEM_LHEAP, heap->addr, heap->heap_alloc, dxpl_id, heap->chunk + sizeof_hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to read heap data") + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_prefix_load() */ - /* Build free list */ - while(H5HL_FREE_NULL != free_block) { - if(free_block >= heap->heap_alloc) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "bad heap free list") - if(NULL == (fl = H5FL_MALLOC(H5HL_free_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - fl->offset = free_block; - fl->prev = tail; - fl->next = NULL; - if(tail) - tail->next = fl; - tail = fl; - if(!heap->freelist) - heap->freelist = fl; + +/*------------------------------------------------------------------------- + * Function: H5HL_prefix_flush + * + * Purpose: Flushes a heap from memory to disk if it's dirty. Optionally + * deletes the heap from memory. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jul 17 1997 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HL_prefix_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, + void *thing, unsigned UNUSED *flags_ptr) +{ + H5HL_prfx_t *prfx = (H5HL_prfx_t *)thing; /* Local heap prefix to flush */ + H5WB_t *wb = NULL; /* Wrapped buffer for heap data */ + uint8_t heap_buf[H5HL_SPEC_READ_SIZE]; /* Buffer for heap */ + herr_t ret_value = SUCCEED; /* Return value */ - p = heap->chunk + sizeof_hdr + free_block; + FUNC_ENTER_NOAPI_NOINIT(H5HL_prefix_flush) - H5F_DECODE_LENGTH(f, p, free_block); - if(free_block == 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "free block size is zero?") + /* check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(prfx); + + if(prfx->cache_info.is_dirty) { + H5HL_t *heap = prfx->heap; /* Pointer to the local heap */ + H5HL_free_t *fl = heap->freelist; /* Pointer to heap's free list */ + uint8_t *buf; /* Pointer to heap buffer */ + size_t buf_size; /* Size of buffer for encoding & writing heap info */ + uint8_t *p; /* Pointer into raw data buffer */ + + /* Wrap the local buffer for serialized heap info */ + if(NULL == (wb = H5WB_wrap(heap_buf, sizeof(heap_buf)))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't wrap buffer") + + /* Compute the size of the buffer to encode & write */ + buf_size = heap->prfx_size; + if(heap->single_cache_obj) + buf_size += heap->dblk_size; + + /* Get a pointer to a buffer that's large enough for serialized heap */ + if(NULL == (buf = (uint8_t *)H5WB_actual(wb, buf_size))) + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "can't get actual buffer") + + /* Serialize the heap prefix */ + p = buf; + HDmemcpy(p, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC); + p += H5_SIZEOF_MAGIC; + *p++ = H5HL_VERSION; + *p++ = 0; /*reserved*/ + *p++ = 0; /*reserved*/ + *p++ = 0; /*reserved*/ + H5F_ENCODE_LENGTH_LEN(p, heap->dblk_size, heap->sizeof_size); + H5F_ENCODE_LENGTH_LEN(p, fl ? fl->offset : H5HL_FREE_NULL, heap->sizeof_size); + H5F_addr_encode_len(heap->sizeof_addr, &p, heap->dblk_addr); + + /* Check if the local heap is a single object in cache */ + if(heap->single_cache_obj) { + /* Serialize the free list into the heap data's image */ + H5HL_fl_serialize(heap); + + /* Copy the heap data block into the cache image */ + HDmemcpy(p, heap->dblk_image, heap->dblk_size); + } /* end if */ - H5F_DECODE_LENGTH(f, p, fl->size); - if(fl->offset + fl->size > heap->heap_alloc) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "bad heap free list") - } /* end while */ + /* Write the prefix [and possibly the data block] to the file */ + if(H5F_block_write(f, H5FD_MEM_LHEAP, addr, buf_size, dxpl_id, buf) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap header and data to file") + + prfx->cache_info.is_dirty = FALSE; + } /* end if */ + + /* Should we destroy the memory version? */ + if(destroy) + if(H5HL_prfx_dest(prfx) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap prefix") + +done: + /* Release resources */ + if(wb && H5WB_unwrap(wb) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_prefix_flush() */ + + +/*------------------------------------------------------------------------- + * Function: H5HL_prefix_dest + * + * Purpose: Destroys a heap prefix in memory. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Jan 15 2003 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HL_prefix_dest(H5F_t UNUSED *f, void *thing) +{ + H5HL_prfx_t *prfx = (H5HL_prfx_t *)thing; /* Local heap prefix to destroy */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HL_prefix_dest) + + /* check arguments */ + HDassert(prfx); + HDassert(prfx->heap); + HDassert(H5F_addr_eq(prfx->cache_info.addr, prfx->heap->prfx_addr)); + + /* Verify that entry is clean */ + HDassert(prfx->cache_info.is_dirty == FALSE); + + /* If we're going to free the space on disk, the address must be valid */ + HDassert(!prfx->cache_info.free_file_space_on_destroy || H5F_addr_defined(prfx->cache_info.addr)); + + /* Check for freeing file space for local heap prefix */ + if(prfx->cache_info.free_file_space_on_destroy) { + hsize_t free_size; /* Size of region to free in file */ + + /* Compute size to free for later */ + free_size = prfx->heap->prfx_size; + if(prfx->heap->single_cache_obj) + free_size += prfx->heap->dblk_size; + + /* Free the local heap prefix [and possible the data block] on disk */ + /* (XXX: Nasty usage of internal DXPL value! -QAK) */ + if(H5MF_xfree(f, H5FD_MEM_LHEAP, H5AC_dxpl_id, prfx->cache_info.addr, free_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap prefix") + } /* end if */ + + /* Destroy local heap prefix */ + if(H5HL_prfx_dest(prfx) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't destroy local heap prefix") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_prefix_dest() */ + + +/*------------------------------------------------------------------------- + * Function: H5HL_prefix_clear + * + * Purpose: Mark a local heap prefix in memory as non-dirty. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Mar 20 2003 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HL_prefix_clear(H5F_t UNUSED *f, void *thing, hbool_t destroy) +{ + H5HL_prfx_t *prfx = (H5HL_prfx_t *)thing; /* The local heap prefix to operate on */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HL_prefix_clear) + + /* check arguments */ + HDassert(prfx); + + /* Mark heap prefix as clean */ + prfx->cache_info.is_dirty = FALSE; + + if(destroy) + if(H5HL_prfx_dest(prfx) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap prefix") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_prefix_clear() */ + + +/*------------------------------------------------------------------------- + * Function: H5HL_prefix_size + * + * Purpose: Compute the size in bytes of the heap prefix on disk, + * and return it in *len_ptr. On failure, the value of *len_ptr + * is undefined. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 5/13/04 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HL_prefix_size(const H5F_t UNUSED *f, const void *thing, size_t *size_ptr) +{ + const H5HL_prfx_t *prfx = (const H5HL_prfx_t *)thing; /* Pointer to local heap prefix to query */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_prefix_size) + + /* check arguments */ + HDassert(prfx); + HDassert(prfx->heap); + HDassert(size_ptr); + + /* Calculate size of prefix in cache */ + *size_ptr = prfx->heap->prfx_size; + + /* If the heap is stored as a single object, add in the data block size also */ + if(prfx->heap->single_cache_obj) + *size_ptr += prfx->heap->dblk_size; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5HL_prefix_size() */ + + +/*------------------------------------------------------------------------- + * Function: H5HL_datablock_load + * + * Purpose: Loads a local heap data block from disk. + * + * Return: Success: Ptr to a local heap data block memory data structure. + * Failure: NULL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jan 5 2010 + * + *------------------------------------------------------------------------- + */ +static void * +H5HL_datablock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, + void *_udata) +{ + H5HL_dblk_t *dblk = NULL; /* Heap data block deserialized */ + H5HL_cache_dblk_ud_t *udata = (H5HL_cache_dblk_ud_t *)_udata; /* User data for protecting local heap data block */ + void *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HL_datablock_load) + + /* check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(!udata1); + HDassert(udata); + HDassert(udata->heap); + HDassert(!udata->heap->single_cache_obj); + + /* Allocate space in memory for the heap data block */ + if(NULL == (dblk = H5HL_dblk_new(udata->heap))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") + + /* Check for heap still retaining image */ + if(NULL == udata->heap->dblk_image) { + /* Allocate space for the heap data image */ + if(NULL == (udata->heap->dblk_image = H5FL_BLK_MALLOC(lheap_chunk, udata->heap->dblk_size))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate data block image buffer") + + /* Read local heap data block */ + if(H5F_block_read(f, H5FD_MEM_LHEAP, udata->heap->dblk_addr, udata->heap->dblk_size, dxpl_id, udata->heap->dblk_image) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read local heap data block") + + /* Build free list */ + if(H5HL_fl_deserialize(udata->heap, udata->free_block) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list") + } /* end if */ + + /* Set flag to indicate data block from loaded from file */ + udata->loaded = TRUE; /* Set return value */ - ret_value = heap; + ret_value = dblk; done: - if(!ret_value && heap) - if(H5HL_dest(f,heap) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy local heap collection") + /* Release the [possibly partially initialized] local heap on errors */ + if(!ret_value && dblk) + if(H5HL_dblk_dest(dblk) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap data block") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_load() */ +} /* end H5HL_datablock_load() */ /*------------------------------------------------------------------------- - * Function: H5HL_flush + * Function: H5HL_datablock_flush * - * Purpose: Flushes a heap from memory to disk if it's dirty. Optionally - * deletes the heap from memory. + * Purpose: Flushes a heap's data block from memory to disk if it's dirty. + * Optionally deletes the heap data block from memory. * * Return: Non-negative on success/Negative on failure * @@ -287,58 +672,48 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HL_t *heap, unsigned UNUSED * flags_ptr) +H5HL_datablock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, + void *_thing, unsigned UNUSED * flags_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ + H5HL_dblk_t *dblk = (H5HL_dblk_t *)_thing; /* Pointer to the local heap data block */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5HL_flush, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5HL_datablock_flush) /* check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); - HDassert(heap); - - if(heap->cache_info.is_dirty) { - haddr_t hdr_end_addr; - size_t sizeof_hdr = H5HL_SIZEOF_HDR(f); /* cache H5HL header size for file */ - - /* Write the header */ - if(H5HL_serialize(f, heap, heap->chunk) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSERIALIZE, FAIL, "unable to serialize local heap") + HDassert(dblk); + HDassert(dblk->heap); + HDassert(!dblk->heap->single_cache_obj); - /* Copy buffer to disk */ - hdr_end_addr = addr + (hsize_t)sizeof_hdr; + if(dblk->cache_info.is_dirty) { + H5HL_t *heap = dblk->heap; /* Pointer to the local heap */ - if(H5F_addr_eq(heap->addr, hdr_end_addr)) { - /* The header and data are contiguous */ - if(H5F_block_write(f, H5FD_MEM_LHEAP, addr, (sizeof_hdr + heap->heap_alloc), dxpl_id, heap->chunk) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap header and data to file") - } /* end if */ - else { - if(H5F_block_write(f, H5FD_MEM_LHEAP, addr, sizeof_hdr, dxpl_id, heap->chunk) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap header to file") + /* Serialize the free list into the heap data's image */ + H5HL_fl_serialize(heap); - if(H5F_block_write(f, H5FD_MEM_LHEAP, heap->addr, heap->heap_alloc, dxpl_id, heap->chunk + sizeof_hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap data to file") - } /* end else */ + /* Write the data block to the file */ + if(H5F_block_write(f, H5FD_MEM_LHEAP, heap->dblk_addr, heap->dblk_size, dxpl_id, heap->dblk_image) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap data block to file") - heap->cache_info.is_dirty = FALSE; + dblk->cache_info.is_dirty = FALSE; } /* end if */ /* Should we destroy the memory version? */ if(destroy) - if(H5HL_dest(f, heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap collection") + if(H5HL_dblk_dest(dblk) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap data block") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_flush() */ +} /* end H5HL_datablock_flush() */ /*------------------------------------------------------------------------- - * Function: H5HL_dest + * Function: H5HL_datablock_dest * - * Purpose: Destroys a heap in memory. + * Purpose: Destroys a local heap data block in memory. * * Return: Non-negative on success/Negative on failure * @@ -348,75 +723,47 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5HL_dest(H5F_t *f, H5HL_t *heap) +static herr_t +H5HL_datablock_dest(H5F_t UNUSED *f, void *_thing) { - H5HL_free_t *fl; /* Heap object free list */ + H5HL_dblk_t *dblk = (H5HL_dblk_t *)_thing; /* Pointer to the local heap data block */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5HL_dest) + FUNC_ENTER_NOAPI_NOINIT(H5HL_datablock_dest) /* check arguments */ - HDassert(heap); + HDassert(dblk); + HDassert(dblk->heap); + HDassert(!dblk->heap->single_cache_obj); + HDassert(H5F_addr_eq(dblk->cache_info.addr, dblk->heap->dblk_addr)); - /* Verify that node is clean */ - HDassert(heap->cache_info.is_dirty == FALSE); + /* Verify that entry is clean */ + HDassert(dblk->cache_info.is_dirty == FALSE); /* If we're going to free the space on disk, the address must be valid */ - HDassert(!heap->cache_info.free_file_space_on_destroy || H5F_addr_defined(heap->cache_info.addr)); - - /* Check for freeing file space for local heap */ - if(heap->cache_info.free_file_space_on_destroy) { - size_t sizeof_hdr; /* H5HL header size for file */ - haddr_t hdr_addr; /* Address of heap header in file */ - - /* Compute this for later */ - sizeof_hdr = H5HL_SIZEOF_HDR(f); - hdr_addr = heap->cache_info.addr; - - /* Check if the heap is contiguous on disk */ - HDassert(!H5F_addr_overflow(hdr_addr, sizeof_hdr)); - if(H5F_addr_eq(heap->addr, hdr_addr + sizeof_hdr)) { - /* Free the contiguous local heap in one call */ - /* (XXX: Nasty usage of internal DXPL value! -QAK) */ - H5_CHECK_OVERFLOW(sizeof_hdr + heap->heap_alloc, size_t, hsize_t); - if(H5MF_xfree(f, H5FD_MEM_LHEAP, H5AC_dxpl_id, hdr_addr, (hsize_t)(sizeof_hdr + heap->heap_alloc)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free contiguous local heap") - } /* end if */ - else { - /* Free the local heap's header */ - /* (XXX: Nasty usage of internal DXPL value! -QAK) */ - H5_CHECK_OVERFLOW(sizeof_hdr, size_t, hsize_t); - if(H5MF_xfree(f, H5FD_MEM_LHEAP, H5AC_dxpl_id, hdr_addr, (hsize_t)sizeof_hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap header") - - /* Free the local heap's data */ - /* (XXX: Nasty usage of internal DXPL value! -QAK) */ - H5_CHECK_OVERFLOW(heap->heap_alloc, size_t, hsize_t); - if(H5MF_xfree(f, H5FD_MEM_LHEAP, H5AC_dxpl_id, heap->addr, (hsize_t)heap->heap_alloc) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap data") - } /* end else */ + HDassert(!dblk->cache_info.free_file_space_on_destroy || H5F_addr_defined(dblk->cache_info.addr)); + + /* Check for freeing file space for local heap data block */ + if(dblk->cache_info.free_file_space_on_destroy) { + /* Free the local heap data block on disk */ + /* (XXX: Nasty usage of internal DXPL value! -QAK) */ + if(H5MF_xfree(f, H5FD_MEM_LHEAP, H5AC_dxpl_id, dblk->cache_info.addr, (hsize_t)dblk->heap->dblk_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap data block") } /* end if */ - /* Release resources */ - if(heap->chunk) - heap->chunk = H5FL_BLK_FREE(lheap_chunk, heap->chunk); - while(heap->freelist) { - fl = heap->freelist; - heap->freelist = fl->next; - (void)H5FL_FREE(H5HL_free_t, fl); - } /* end while */ - (void)H5FL_FREE(H5HL_t, heap); + /* Destroy local heap data block */ + if(H5HL_dblk_dest(dblk) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't destroy local heap data block") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_dest() */ +} /* end H5HL_datablock_dest() */ /*------------------------------------------------------------------------- - * Function: H5HL_clear + * Function: H5HL_datablock_clear * - * Purpose: Mark a local heap in memory as non-dirty. + * Purpose: Mark a local heap data block in memory as non-dirty. * * Return: Non-negative on success/Negative on failure * @@ -427,33 +774,34 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HL_clear(H5F_t *f, H5HL_t *heap, hbool_t destroy) +H5HL_datablock_clear(H5F_t UNUSED *f, void *_thing, hbool_t destroy) { + H5HL_dblk_t *dblk = (H5HL_dblk_t *)_thing; /* Pointer to the local heap data block */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5HL_clear) + FUNC_ENTER_NOAPI_NOINIT(H5HL_datablock_clear) /* check arguments */ - HDassert(heap); + HDassert(dblk); - /* Mark heap as clean */ - heap->cache_info.is_dirty = FALSE; + /* Mark local heap data block as clean */ + dblk->cache_info.is_dirty = FALSE; if(destroy) - if(H5HL_dest(f, heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap collection") + if(H5HL_dblk_dest(dblk) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap data block") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_clear() */ +} /* end H5HL_datablock_clear() */ /*------------------------------------------------------------------------- - * Function: H5HL_size + * Function: H5HL_datablock_size * - * Purpose: Compute the size in bytes of the specified instance of - * H5HL_t on disk, and return it in *len_ptr. On failure, - * the value of *len_ptr is undefined. + * Purpose: Compute the size in bytes of the local heap data block on disk, + * and return it in *len_ptr. On failure, the value of *len_ptr + * is undefined. * * Return: Non-negative on success/Negative on failure * @@ -462,18 +810,21 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5HL_size(const H5F_t *f, const H5HL_t *heap, size_t *size_ptr) +static herr_t +H5HL_datablock_size(const H5F_t UNUSED *f, const void *_thing, size_t *size_ptr) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_size) + const H5HL_dblk_t *dblk = (const H5HL_dblk_t *)_thing; /* Pointer to the local heap data block */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_datablock_size) /* check arguments */ - HDassert(f); - HDassert(heap); + HDassert(dblk); + HDassert(dblk->heap); HDassert(size_ptr); - *size_ptr = H5HL_SIZEOF_HDR(f) + heap->heap_alloc; + /* Set size of data block in cache */ + *size_ptr = dblk->heap->dblk_size; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HL_size() */ +} /* H5HL_datablock_size() */ diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index 1ebb14f..b8a8d35 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -22,7 +22,6 @@ #include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5HLpkg.h" /* Local heaps */ #include "H5Iprivate.h" /* ID Functions */ @@ -59,82 +58,77 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int H5HL_free_t *freelist = NULL; uint8_t *marker = NULL; size_t amount_free = 0; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5HL_debug, FAIL); + FUNC_ENTER_NOAPI(H5HL_debug, FAIL) /* check arguments */ - assert(f); - assert(H5F_addr_defined(addr)); - assert(stream); - assert(indent >= 0); - assert(fwidth >= 0); + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(stream); + HDassert(indent >= 0); + HDassert(fwidth >= 0); - if (NULL == (h = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); + if(NULL == (h = (H5HL_t *)H5HL_protect(f, dxpl_id, addr, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") fprintf(stream, "%*sLocal Heap...\n", indent, ""); - fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, - "Dirty:", - (int) (h->cache_info.is_dirty)); fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Header size (in bytes):", - (unsigned long) H5HL_SIZEOF_HDR(f)); + (unsigned long)h->prfx_size); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of heap data:", - h->addr); + h->dblk_addr); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data bytes allocated for heap:", - h->heap_alloc); + h->dblk_size); /* * Traverse the free list and check that all free blocks fall within * the heap and that no two free blocks point to the same region of * the heap. */ - if (NULL==(marker = (uint8_t *)H5MM_calloc(h->heap_alloc))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + if(NULL == (marker = (uint8_t *)H5MM_calloc(h->dblk_size))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") fprintf(stream, "%*sFree Blocks (offset, size):\n", indent, ""); - for (free_block=0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) { + for(free_block = 0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) { char temp_str[32]; sprintf(temp_str,"Block #%d:",free_block); HDfprintf(stream, "%*s%-*s %8Zu, %8Zu\n", indent+3, "", MAX(0,fwidth-9), temp_str, freelist->offset, freelist->size); - if (freelist->offset + freelist->size > h->heap_alloc) { + if((freelist->offset + freelist->size) > h->dblk_size) fprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n"); - } else { - for (i=overlap=0; i<(int)(freelist->size); i++) { - if (marker[freelist->offset + i]) + else { + for(i = overlap = 0; i < (int)(freelist->size); i++) { + if(marker[freelist->offset + i]) overlap++; marker[freelist->offset + i] = 1; - } - if (overlap) { - fprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS " - "ONE!\n"); - } else { + } /* end for */ + if(overlap) + fprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); + else amount_free += freelist->size; - } - } - } + } /* end for */ + } /* end for */ - if (h->heap_alloc) { + if(h->dblk_size) fprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:", - (100.0 * (double)(h->heap_alloc - amount_free) / (double)h->heap_alloc)); - } + (100.0 * (double)(h->dblk_size - amount_free) / (double)h->dblk_size)); /* * Print the data in a VMS-style octal dump. */ - H5_buffer_dump(stream, indent, h->chunk, marker, H5HL_SIZEOF_HDR(f), h->heap_alloc); + H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size); done: - if (h && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, h, FALSE) != SUCCEED) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); + if(h && H5HL_unprotect(h) < 0) + HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") H5MM_xfree(marker); - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_debug() */ + diff --git a/src/H5HLint.c b/src/H5HLint.c new file mode 100644 index 0000000..c6d6839 --- /dev/null +++ b/src/H5HLint.c @@ -0,0 +1,417 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5HLint.c + * Oct 12 2008 + * Quincey Koziol + * + * Purpose: Local heap internal routines. + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ + +#define H5HL_PACKAGE /* Suppress error about including H5HLpkg */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5HLpkg.h" /* Local Heaps */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Declare a free list to manage the H5HL_t struct */ +H5FL_DEFINE_STATIC(H5HL_t); + +/* Declare a free list to manage the H5HL_dblk_t struct */ +H5FL_DEFINE_STATIC(H5HL_dblk_t); + +/* Declare a free list to manage the H5HL_prfx_t struct */ +H5FL_DEFINE_STATIC(H5HL_prfx_t); + + + +/*------------------------------------------------------------------------- + * Function: H5HL_new + * + * Purpose: Create a new local heap object + * + * Return: Success: non-NULL pointer to new local heap + * Failure: NULL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jan 5 2010 + * + *------------------------------------------------------------------------- + */ +H5HL_t * +H5HL_new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size) +{ + H5HL_t *heap = NULL; /* New local heap */ + H5HL_t *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5HL_new, NULL) + + /* check arguments */ + HDassert(sizeof_size > 0); + HDassert(sizeof_addr > 0); + HDassert(prfx_size > 0); + + /* Allocate new local heap structure */ + if(NULL == (heap = H5FL_CALLOC(H5HL_t))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") + + /* Initialize non-zero fields */ + heap->sizeof_size = sizeof_size; + heap->sizeof_addr = sizeof_addr; + heap->prfx_size = prfx_size; + + /* Set the return value */ + ret_value = heap; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_new() */ + + +/*------------------------------------------------------------------------- + * Function: H5HL_inc_rc + * + * Purpose: Increment ref. count on heap + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Oct 12 2008 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HL_inc_rc(H5HL_t *heap) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_inc_rc) + + /* check arguments */ + HDassert(heap); + + /* Increment heap's ref. count */ + heap->rc++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5HL_inc_rc() */ + + +/*------------------------------------------------------------------------- + * Function: H5HL_dec_rc + * + * Purpose: Decrement ref. count on heap + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Oct 12 2008 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HL_dec_rc(H5HL_t *heap) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_dec_rc) + + /* check arguments */ + HDassert(heap); + + /* Decrement heap's ref. count */ + heap->rc--; + + /* Check if we should destroy the heap */ + if(heap->rc == 0) + H5HL_dest(heap); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5HL_dec_rc() */ + + +/*------------------------------------------------------------------------- + * Function: H5HL_dest + * + * Purpose: Destroys a heap in memory. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Jan 15 2003 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HL_dest(H5HL_t *heap) +{ + FUNC_ENTER_NOAPI_NOFUNC(H5HL_dest) + + /* check arguments */ + HDassert(heap); + + /* Verify that node is unused */ + HDassert(heap->prots == 0); + HDassert(heap->rc == 0); + HDassert(heap->prfx == NULL); + HDassert(heap->dblk == NULL); + + if(heap->dblk_image) + heap->dblk_image = H5FL_BLK_FREE(lheap_chunk, heap->dblk_image); + while(heap->freelist) { + H5HL_free_t *fl; + + fl = heap->freelist; + heap->freelist = fl->next; + fl = H5FL_FREE(H5HL_free_t, fl); + } /* end while */ + heap = H5FL_FREE(H5HL_t, heap); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5HL_dest() */ + + +/*------------------------------------------------------------------------- + * Function: H5HL_prfx_new + * + * Purpose: Create a new local heap prefix object + * + * Return: Success: non-NULL pointer to new local heap prefix + * Failure: NULL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Oct 12 2008 + * + *------------------------------------------------------------------------- + */ +H5HL_prfx_t * +H5HL_prfx_new(H5HL_t *heap) +{ + H5HL_prfx_t *prfx = NULL; /* New local heap prefix */ + H5HL_prfx_t *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5HL_prfx_new, NULL) + + /* check arguments */ + HDassert(heap); + + /* Allocate new local heap prefix */ + if(NULL == (prfx = H5FL_CALLOC(H5HL_prfx_t))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") + + /* Increment ref. count on heap data structure */ + if(H5HL_inc_rc(heap) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count") + + /* Link the heap & the prefix */ + prfx->heap = heap; + heap->prfx = prfx; + + /* Set the return value */ + ret_value = prfx; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_prfx_new() */ + + +/*------------------------------------------------------------------------- + * Function: H5HL_prfx_dest + * + * Purpose: Destroy a local heap prefix object + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Oct 12 2008 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HL_prfx_dest(H5HL_prfx_t *prfx) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5HL_prfx_dest, FAIL) + + /* check arguments */ + HDassert(prfx); + + /* Check if prefix was initialized */ + if(prfx->heap) { + /* Unlink prefix from heap */ + prfx->heap->prfx = NULL; + + /* Decrement ref. count on heap data structure */ + if(H5HL_dec_rc(prfx->heap) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count") + + /* Unlink heap from prefix */ + prfx->heap = NULL; + } /* end if */ + + /* Free local heap prefix */ + prfx = H5FL_FREE(H5HL_prfx_t, prfx); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_prfx_dest() */ + + +/*------------------------------------------------------------------------- + * Function: H5HL_dblk_new + * + * Purpose: Create a new local heap data block object + * + * Return: Success: non-NULL pointer to new local heap data block + * Failure: NULL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Oct 12 2008 + * + *------------------------------------------------------------------------- + */ +H5HL_dblk_t * +H5HL_dblk_new(H5HL_t *heap) +{ + H5HL_dblk_t *dblk = NULL; /* New local heap data block */ + H5HL_dblk_t *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5HL_dblk_new, NULL) + + /* check arguments */ + HDassert(heap); + + /* Allocate new local heap data block */ + if(NULL == (dblk = H5FL_CALLOC(H5HL_dblk_t))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") + + /* Increment ref. count on heap data structure */ + if(H5HL_inc_rc(heap) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count") + + /* Link the heap & the data block */ + dblk->heap = heap; + heap->dblk = dblk; + + /* Set the return value */ + ret_value = dblk; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_dblk_new() */ + + +/*------------------------------------------------------------------------- + * Function: H5HL_dblk_dest + * + * Purpose: Destroy a local heap data block object + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Oct 12 2008 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HL_dblk_dest(H5HL_dblk_t *dblk) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5HL_dblk_dest, FAIL) + + /* check arguments */ + HDassert(dblk); + + /* Check if data block was initialized */ + if(dblk->heap) { + /* Unlink data block from heap */ + dblk->heap->dblk = NULL; + + /* Unpin the local heap prefix */ + if(H5AC_unpin_entry(dblk->heap->prfx) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "can't unpin local heap prefix") + + /* Decrement ref. count on heap data structure */ + if(H5HL_dec_rc(dblk->heap) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count") + + /* Unlink heap from data block */ + dblk->heap = NULL; + } /* end if */ + + /* Free local heap data block */ + dblk = H5FL_FREE(H5HL_dblk_t, dblk); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_dblk_dest() */ + diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h index 1e34a48..926ecd3 100644 --- a/src/H5HLpkg.h +++ b/src/H5HLpkg.h @@ -32,7 +32,6 @@ #include "H5HLprivate.h" /* Other private headers needed by this file */ -#include "H5ACprivate.h" /* Metadata cache */ #include "H5FLprivate.h" /* Free lists */ @@ -40,15 +39,15 @@ /* Package Private Variables */ /*****************************/ -/* The cache subclass */ -H5_DLLVAR const H5AC_class_t H5AC_LHEAP[1]; +/* The local heap prefix cache subclass */ +H5_DLLVAR const H5AC_class_t H5AC_LHEAP_PRFX[1]; + +/* The local heap data block cache subclass */ +H5_DLLVAR const H5AC_class_t H5AC_LHEAP_DBLK[1]; /* Declare extern the free list to manage the H5HL_free_t struct */ H5FL_EXTERN(H5HL_free_t); -/* Declare extern the free list to manage the H5HL_t struct */ -H5FL_EXTERN(H5HL_t); - /* Declare extern the PQ free list to manage the heap chunk information */ H5FL_BLK_EXTERN(lheap_chunk); @@ -59,10 +58,14 @@ H5FL_BLK_EXTERN(lheap_chunk); #define H5HL_SIZEOF_HDR(F) \ H5HL_ALIGN(H5_SIZEOF_MAGIC + /*heap signature */ \ - 4 + /*reserved */ \ - H5F_SIZEOF_SIZE (F) + /*data size */ \ - H5F_SIZEOF_SIZE (F) + /*free list head */ \ - H5F_SIZEOF_ADDR (F)) /*data address */ + 1 + /*version */ \ + 3 + /*reserved */ \ + H5F_SIZEOF_SIZE(F) + /*data size */ \ + H5F_SIZEOF_SIZE(F) + /*free list head */ \ + H5F_SIZEOF_ADDR(F)) /*data address */ + +/* Value indicating end of free list on disk */ +#define H5HL_FREE_NULL 1 /****************************/ @@ -76,22 +79,83 @@ typedef struct H5HL_free_t { struct H5HL_free_t *next; /*next entry in free list */ } H5HL_free_t; +/* Forward declarations */ +typedef struct H5HL_dblk_t H5HL_dblk_t; +typedef struct H5HL_prfx_t H5HL_prfx_t; + struct H5HL_t { - H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ - /* first field in structure */ - haddr_t addr; /*address of data */ - size_t heap_alloc; /*size of heap on disk and in mem */ - uint8_t *chunk; /*the chunk, including header */ + /* General heap-management fields */ + size_t rc; /* Ref. count for prefix & data block using this struct */ + size_t prots; /* # of times the heap has been protected */ + size_t sizeof_size; /* Size of file sizes */ + size_t sizeof_addr; /* Size of file addresses */ + hbool_t single_cache_obj; /* Indicate if the heap is a single object in the cache */ + + /* Prefix-specific fields */ + H5HL_prfx_t *prfx; /* The prefix object for the heap */ + haddr_t prfx_addr; /* address of heap prefix */ + size_t prfx_size; /* size of heap prefix */ + + /* Data block-specific fields */ + H5HL_dblk_t *dblk; /* The data block object for the heap */ + haddr_t dblk_addr; /* address of data block */ + size_t dblk_size; /* size of heap data block on disk and in mem */ + uint8_t *dblk_image; /* The data block image */ H5HL_free_t *freelist; /*the free list */ }; +/* Struct for heap data block */ +struct H5HL_dblk_t { + H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ + /* first field in structure */ + H5HL_t *heap; /* Pointer to heap for data block */ +}; + +/* Struct for heap prefix */ +struct H5HL_prfx_t { + H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ + /* first field in structure */ + H5HL_t *heap; /* Pointer to heap for prefix */ +}; + +/* Callback information for loading local heap prefix from disk */ +typedef struct H5HL_cache_prfx_ud_t { + /* Downwards */ + size_t sizeof_size; /* Size of file sizes */ + size_t sizeof_addr; /* Size of file addresses */ + size_t sizeof_prfx; /* Size of heap prefix */ + + /* Upwards */ + hbool_t loaded; /* Whether prefix was loaded from file */ + hsize_t free_block; /* First free block in heap */ +} H5HL_cache_prfx_ud_t; + +/* Callback information for loading local heap data block from disk */ +typedef struct H5HL_cache_dblk_ud_t { + /* Downwards */ + H5HL_t *heap; /* Local heap */ + hsize_t free_block; /* First free block in heap */ + + /* Upwards */ + hbool_t loaded; /* Whether data block was loaded from file */ +} H5HL_cache_dblk_ud_t; + /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5HL_dest(H5F_t *f, H5HL_t *heap); -H5_DLL herr_t H5HL_size(const H5F_t *f, const H5HL_t *heap, size_t *size_ptr); +/* Heap routines */ +H5_DLL H5HL_t *H5HL_new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size); +H5_DLL herr_t H5HL_dest(H5HL_t *heap); + +/* Heap prefix routines */ +H5_DLL H5HL_prfx_t *H5HL_prfx_new(H5HL_t *heap); +H5_DLL herr_t H5HL_prfx_dest(H5HL_prfx_t *prfx); + +/* Heap data block routines */ +H5_DLL H5HL_dblk_t *H5HL_dblk_new(H5HL_t *heap); +H5_DLL herr_t H5HL_dblk_dest(H5HL_dblk_t *dblk); #endif /* _H5HLpkg_H */ diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index 2a3e2df..8679bee 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -62,10 +62,10 @@ typedef struct H5HL_t H5HL_t; */ H5_DLL herr_t H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr/*out*/); H5_DLL H5HL_t *H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw); -H5_DLL void *H5HL_offset_into(H5F_t *f, const H5HL_t *heap, size_t offset); +H5_DLL void *H5HL_offset_into(const H5HL_t *heap, size_t offset); H5_DLL herr_t H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size); -H5_DLL herr_t H5HL_unprotect(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, haddr_t addr); +H5_DLL herr_t H5HL_unprotect(H5HL_t *heap); H5_DLL size_t H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t size, const void *buf); H5_DLL herr_t H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr); diff --git a/src/H5I.c b/src/H5I.c index b116424..cf78d3b 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -1276,8 +1276,6 @@ done: * Programmer: Quincey Koziol * Dec 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -2096,7 +2094,7 @@ done: ssize_t H5Iget_name(hid_t id, char *name/*out*/, size_t size) { - ssize_t ret_value; + ssize_t ret_value; /* Return value */ FUNC_ENTER_API(H5Iget_name, FAIL) H5TRACE3("Zs", "ixz", id, name, size); diff --git a/src/H5L.c b/src/H5L.c index b217abe..bedd593 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -569,7 +569,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_ud() */ diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index b99012c..db762cf 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -25,7 +25,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lpkg.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Opublic.h" /* File objects */ +#include "H5Opublic.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ static hid_t H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group, @@ -594,8 +594,8 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: - if(norm_obj_name) - H5MM_free(ext_link_buf); + H5MM_xfree(ext_link_buf); + H5MM_xfree(norm_obj_name); FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_external() */ diff --git a/src/H5O.c b/src/H5O.c index 1d70f09..4d8c9c9 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -367,7 +367,6 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ - hbool_t loc_found = FALSE; /* Location at 'name' found */ hid_t lapl_id = H5P_LINK_ACCESS_DEFAULT; /* lapl to use to open this object */ hid_t ret_value = FAIL; @@ -393,9 +392,6 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: - if(ret_value < 0 && loc_found) - if(H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") FUNC_LEAVE_API(ret_value) } /* end H5Oopen_by_addr() */ @@ -1194,7 +1190,8 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id, /* Cache object header */ if(H5AC_set(f, dxpl_id, H5AC_OHDR, oh_addr, oh, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to cache object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header") + oh = NULL; /* Set up object location */ loc->file = f; @@ -1422,7 +1419,7 @@ int H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags) { haddr_t addr = H5O_OH_GET_ADDR(oh); /* Object header address */ - int ret_value; /* Return value */ + int ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5O_link_oh, FAIL) @@ -1432,7 +1429,11 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags) /* Check for too large of an adjustment */ if((unsigned)(-adjust) > oh->nlink) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative") + + /* Adjust the link count for the object header */ oh->nlink += adjust; + + /* Mark object header as dirty in cache */ *oh_flags |= H5AC__DIRTIED_FLAG; /* Check if the object should be deleted */ @@ -1448,7 +1449,7 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags) if(H5O_delete_oh(f, dxpl_id, oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file") - /* Mark the object header as deleted */ + /* Mark the object header for deletion */ *oh_flags = H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; } /* end else */ } /* end if */ @@ -1464,7 +1465,10 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags) } /* end if */ } /* end if */ + /* Adjust the link count for the object header */ oh->nlink += adjust; + + /* Mark object header as dirty in cache */ *oh_flags |= H5AC__DIRTIED_FLAG; } /* end if */ @@ -1538,10 +1542,10 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) HDassert(loc->file); HDassert(H5F_addr_defined(loc->addr)); - /* get header */ + /* Get header */ oh_acc = adjust ? H5AC_WRITE : H5AC_READ; if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, oh_acc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Call the "real" link routine */ if((ret_value = H5O_link_oh(loc->file, adjust, dxpl_id, oh, &oh_flags)) < 0) @@ -1549,7 +1553,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_link() */ @@ -1575,8 +1579,8 @@ done: H5O_t * H5O_pin(H5O_loc_t *loc, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Object header */ - H5O_t *ret_value; /* Return value */ + H5O_t *oh = NULL; /* Object header */ + H5O_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5O_pin, NULL) @@ -1587,7 +1591,7 @@ H5O_pin(H5O_loc_t *loc, hid_t dxpl_id) /* Check for write access on the file */ if(0 == (H5F_INTENT(loc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "no write intent on file") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "no write intent on file") /* Lock the object header into the cache */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) @@ -1596,7 +1600,7 @@ H5O_pin(H5O_loc_t *loc, hid_t dxpl_id) /* Check if the object header needs to be pinned */ if(0 == oh->npins) { /* Mark object header as un-evictable */ - if(H5AC_pin_protected_entry(loc->file, oh) < 0) + if(H5AC_pin_protected_entry(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, NULL, "unable to pin object header") } /* end if */ @@ -1631,22 +1635,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_unpin(H5O_loc_t *loc, H5O_t *oh) +H5O_unpin(H5O_t *oh) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_unpin, FAIL) /* check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); HDassert(oh); /* Check if this is the last unpin operation */ if(1 == oh->npins) { /* Mark object header as evictable again */ - if(H5AC_unpin_entry(loc->file, oh) < 0) + if(H5AC_unpin_entry(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") } /* end if */ @@ -1732,7 +1733,7 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force) } /* end else */ /* Mark object header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, oh) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") } /* end if */ @@ -1757,11 +1758,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_touch(H5O_loc_t *loc, hbool_t force, hid_t dxpl_id) +H5O_touch(const H5O_loc_t *loc, hbool_t force, hid_t dxpl_id) { - H5O_t *oh = NULL; - unsigned oh_flags = H5AC__NO_FLAGS_SET; - herr_t ret_value = SUCCEED; /* Return value */ + H5O_t *oh = NULL; /* Object header to modify */ + unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting object header */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_touch, FAIL) @@ -1774,18 +1775,18 @@ H5O_touch(H5O_loc_t *loc, hbool_t force, hid_t dxpl_id) /* Get the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Create/Update the modification time message */ if(H5O_touch_oh(loc->file, dxpl_id, oh, force) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to update object modificaton time") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to update object modificaton time") /* Mark object header as changed */ oh_flags |= H5AC__DIRTIED_FLAG; done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_touch() */ @@ -1875,7 +1876,7 @@ H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) H5O_t *oh = NULL; /* Object header information */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_delete,FAIL) + FUNC_ENTER_NOAPI(H5O_delete, FAIL) /* Check args */ HDassert(f); @@ -1883,7 +1884,7 @@ H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) /* Get the object header information */ if(NULL == (oh = (H5O_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Delete object */ if(H5O_delete_oh(f, dxpl_id, oh) < 0) @@ -1964,15 +1965,15 @@ H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id) /* Load the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Retrieve the type of the object */ if(H5O_obj_type_real(oh, obj_type) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type") done: - if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) != SUCCEED) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_obj_type() */ @@ -2042,15 +2043,15 @@ H5O_obj_class(const H5O_loc_t *loc, hid_t dxpl_id) /* Load the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header") /* Test whether entry qualifies as a particular type of object */ if(NULL == (ret_value = H5O_obj_class_real(oh))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to determine object type") done: - if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) != SUCCEED) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, NULL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_obj_class() */ @@ -2437,7 +2438,7 @@ H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) *------------------------------------------------------------------------- */ herr_t -H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, +H5O_get_info(const H5O_loc_t *loc, hid_t dxpl_id, hbool_t want_ih_info, H5O_info_t *oinfo) { const H5O_obj_class_t *obj_class; /* Class of object for header */ @@ -2447,21 +2448,21 @@ H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, FUNC_ENTER_NOAPI(H5O_get_info, FAIL) /* Check args */ - HDassert(oloc); + HDassert(loc); HDassert(oinfo); /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Reset the object info structure */ HDmemset(oinfo, 0, sizeof(*oinfo)); /* Retrieve the file's fileno */ - H5F_GET_FILENO(oloc->file, oinfo->fileno); + H5F_GET_FILENO(loc->file, oinfo->fileno); /* Set the object's address */ - oinfo->addr = oloc->addr; + oinfo->addr = loc->addr; /* Get class for object */ if(NULL == (obj_class = H5O_obj_class_real(oh))) @@ -2497,7 +2498,7 @@ H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME message") if(exists > 0) { /* Get "old style" modification time info */ - if(NULL == H5O_msg_read_oh(oloc->file, dxpl_id, oh, H5O_MTIME_ID, &oinfo->ctime)) + if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_MTIME_ID, &oinfo->ctime)) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME message") } /* end if */ else { @@ -2506,7 +2507,7 @@ H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME_NEW message") if(exists > 0) { /* Get "new style" modification time info */ - if(NULL == H5O_msg_read_oh(oloc->file, dxpl_id, oh, H5O_MTIME_NEW_ID, &oinfo->ctime)) + if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_MTIME_NEW_ID, &oinfo->ctime)) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME_NEW message") } /* end if */ else @@ -2519,7 +2520,7 @@ H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info") /* Retrieve # of attributes */ - if(H5O_attr_count_real(oloc->file, dxpl_id, oh, &oinfo->num_attrs) < 0) + if(H5O_attr_count_real(loc->file, dxpl_id, oh, &oinfo->num_attrs) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count") /* Get B-tree & heap metadata storage size, if requested */ @@ -2527,20 +2528,20 @@ H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, /* Check for 'bh_info' callback for this type of object */ if(obj_class->bh_info) { /* Call the object's class 'bh_info' routine */ - if((obj_class->bh_info)(oloc->file, dxpl_id, oh, &(oinfo->meta_size.obj) /* out */) < 0) + if((obj_class->bh_info)(loc->file, dxpl_id, oh, &oinfo->meta_size.obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info") } /* end if */ /* Get B-tree & heap info for any attributes */ if(oinfo->num_attrs > 0) { - if(H5O_attr_bh_info(oloc->file, dxpl_id, oh, &oinfo->meta_size.attr/*out*/) < 0) + if(H5O_attr_bh_info(loc->file, dxpl_id, oh, &oinfo->meta_size.attr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info") } /* end if */ } /* end if */ done: - if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_info() */ @@ -2560,7 +2561,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_get_create_plist(const H5O_loc_t *oloc, hid_t dxpl_id, H5P_genplist_t *oc_plist) +H5O_get_create_plist(const H5O_loc_t *loc, hid_t dxpl_id, H5P_genplist_t *oc_plist) { H5O_t *oh = NULL; /* Object header */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2568,12 +2569,12 @@ H5O_get_create_plist(const H5O_loc_t *oloc, hid_t dxpl_id, H5P_genplist_t *oc_pl FUNC_ENTER_NOAPI(H5O_get_create_plist, FAIL) /* Check args */ - HDassert(oloc); + HDassert(loc); HDassert(oc_plist); /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Set property values, if they were used for the object */ if(oh->version > H5O_VERSION_1) { @@ -2594,8 +2595,8 @@ H5O_get_create_plist(const H5O_loc_t *oloc, hid_t dxpl_id, H5P_genplist_t *oc_pl } /* end if */ done: - if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_create_plist() */ @@ -2615,7 +2616,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_get_nlinks(const H5O_loc_t *oloc, hid_t dxpl_id, hsize_t *nlinks) +H5O_get_nlinks(const H5O_loc_t *loc, hid_t dxpl_id, hsize_t *nlinks) { H5O_t *oh = NULL; /* Object header */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2623,19 +2624,19 @@ H5O_get_nlinks(const H5O_loc_t *oloc, hid_t dxpl_id, hsize_t *nlinks) FUNC_ENTER_NOAPI(H5O_get_nlinks, FAIL) /* Check args */ - HDassert(oloc); + HDassert(loc); HDassert(nlinks); /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Retrieve the # of link messages seen when the object header was loaded */ *nlinks = oh->link_msgs_seen; done: - if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_nlinks() */ @@ -2733,7 +2734,7 @@ H5O_get_oh_addr(const H5O_t *oh) *------------------------------------------------------------------------- */ herr_t -H5O_get_rc_and_type(const H5O_loc_t *oloc, hid_t dxpl_id, unsigned *rc, H5O_type_t *otype) +H5O_get_rc_and_type(const H5O_loc_t *loc, hid_t dxpl_id, unsigned *rc, H5O_type_t *otype) { H5O_t *oh = NULL; /* Object header */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2741,13 +2742,13 @@ H5O_get_rc_and_type(const H5O_loc_t *oloc, hid_t dxpl_id, unsigned *rc, H5O_type FUNC_ENTER_NOAPI(H5O_get_rc_and_type, FAIL) /* Check args */ - HDassert(oloc); + HDassert(loc); HDassert(rc); HDassert(otype); /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Set the object's reference count */ *rc = oh->nlink; @@ -2757,8 +2758,8 @@ H5O_get_rc_and_type(const H5O_loc_t *oloc, hid_t dxpl_id, unsigned *rc, H5O_type HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type") done: - if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_rc_and_type() */ diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index e61d899..0984cd4 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -431,17 +431,17 @@ H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, if(H5A_dense_create(file_dst, dxpl_id, ainfo_dst) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes") - if ( (H5A_dense_copy_file_all(file_src, ainfo_src, file_dst, ainfo_dst, recompute_size, cpy_info, dxpl_id)) <0) + if((H5A_dense_copy_file_all(file_src, ainfo_src, file_dst, ainfo_dst, recompute_size, cpy_info, dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes") - } + } /* end if */ /* Set return value */ ret_value = ainfo_dst; done: /* Release destination attribute information on failure */ - if(ret_value == NULL && ainfo_dst != NULL) - (void)H5FL_FREE(H5O_ainfo_t, ainfo_dst); + if(!ret_value && ainfo_dst) + ainfo_dst = H5FL_FREE(H5O_ainfo_t, ainfo_dst); FUNC_LEAVE_NOAPI(ret_value) } /* H5O_ainfo_copy_file() */ diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index bfc6908..dc72799 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -71,7 +71,7 @@ static unsigned H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, static htri_t H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u, hid_t dxpl_id); static htri_t H5O_move_msgs_forward(H5F_t *f, H5O_t *oh, hid_t dxpl_id); static htri_t H5O_merge_null(H5F_t *f, H5O_t *oh, hid_t dxpl_id); -static htri_t H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh, hid_t dxpl_id); +static htri_t H5O_remove_empty_chunks(H5F_t *f, hid_t dxpl_id, H5O_t *oh); static herr_t H5O_alloc_shrink_chunk(H5F_t *f, H5O_t *oh, hid_t dxpl_id, unsigned chunkno); @@ -171,7 +171,6 @@ H5O_add_gap(H5O_t *oh, unsigned chunkno, unsigned idx, /* Create new null message, with the tail of the previous null message */ null_msg = &(oh->mesg[oh->nmesgs++]); null_msg->type = H5O_MSG_NULL; - null_msg->dirty = TRUE; null_msg->native = NULL; null_msg->raw_size = new_gap_size - H5O_SIZEOF_MSGHDR_OH(oh); null_msg->raw = (oh->chunk[chunkno].image + oh->chunk[chunkno].size) @@ -182,6 +181,9 @@ H5O_add_gap(H5O_t *oh, unsigned chunkno, unsigned idx, if(null_msg->raw_size) HDmemset(null_msg->raw, 0, null_msg->raw_size); + /* Mark message as dirty */ + null_msg->dirty = TRUE; + /* Reset size of gap in chunk */ oh->chunk[chunkno].gap = 0; } /* end if */ @@ -347,12 +349,14 @@ H5O_alloc_null(H5O_t *oh, unsigned null_idx, const H5O_msg_class_t *new_type, /* Create new null message, with the tail of the previous null message */ null_msg = &(oh->mesg[oh->nmesgs++]); null_msg->type = H5O_MSG_NULL; - null_msg->dirty = TRUE; null_msg->native = NULL; null_msg->raw = alloc_msg->raw + new_mesg_size; null_msg->raw_size = alloc_msg->raw_size - new_mesg_size; null_msg->chunkno = alloc_msg->chunkno; + /* Mark the message as dirty */ + null_msg->dirty = TRUE; + /* Check for gap in new null message's chunk */ if(oh->chunk[null_msg->chunkno].gap > 0) { unsigned null_chunkno = null_msg->chunkno; /* Chunk w/gap */ @@ -374,9 +378,11 @@ H5O_alloc_null(H5O_t *oh, unsigned null_idx, const H5O_msg_class_t *new_type, /* Initialize the new message */ alloc_msg->type = new_type; - alloc_msg->dirty = TRUE; alloc_msg->native = new_native; + /* Mark the new message as dirty */ + alloc_msg->dirty = TRUE; + done: FUNC_LEAVE_NOAPI(ret_value) } /* H5O_alloc_null() */ @@ -458,12 +464,8 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_alloc_extend_chunk(H5F_t *f, - hid_t dxpl_id, - H5O_t *oh, - unsigned chunkno, - size_t size, - unsigned * msg_idx) +H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, + size_t size, unsigned * msg_idx) { size_t delta; /* Change in chunk's size */ size_t aligned_size = H5O_ALIGN_OH(oh, size); @@ -596,7 +598,7 @@ H5O_alloc_extend_chunk(H5F_t *f, if(oh->mesg[u].chunkno == chunkno) { oh->mesg[u].raw = oh->chunk[chunkno].image + extra_prfx_size + (oh->mesg[u].raw - old_image); - /* Flag message as dirty */ + /* Flag message as dirty directly */ oh->mesg[u].dirty = TRUE; } /* endif */ @@ -605,7 +607,7 @@ H5O_alloc_extend_chunk(H5F_t *f, * it's size is directly encoded in the object header) */ if(chunkno > 0 && (H5O_CONT_ID == oh->mesg[u].type->id) && (((H5O_cont_t *)(oh->mesg[u].native))->chunkno == chunkno)) { - /* Adjust size of continuation message */ + /* Adjust size in continuation message */ HDassert(((H5O_cont_t *)(oh->mesg[u].native))->size == old_size); ((H5O_cont_t *)(oh->mesg[u].native))->size = oh->chunk[chunkno].size; @@ -658,10 +660,7 @@ done: *------------------------------------------------------------------------- */ static unsigned -H5O_alloc_new_chunk(H5F_t *f, - hid_t dxpl_id, - H5O_t *oh, - size_t size) +H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) { /* Struct for storing information about "best" messages to allocate from */ typedef struct { @@ -917,7 +916,6 @@ H5O_alloc_new_chunk(H5F_t *f, found_null = oh->nmesgs++; null_msg = &(oh->mesg[found_null]); null_msg->type = H5O_MSG_NULL; - null_msg->dirty = TRUE; null_msg->native = NULL; null_msg->raw = oh->mesg[found_other.msgno].raw; null_msg->raw_size = oh->mesg[found_other.msgno].raw_size; @@ -964,6 +962,9 @@ H5O_alloc_new_chunk(H5F_t *f, /* Adjust message index for new NULL message */ found_null--; } /* end if */ + + /* Mark the new null message as dirty */ + null_msg->dirty = TRUE; } /* end if */ HDassert(found_null >= 0); @@ -1077,7 +1078,7 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, UFAIL, "can't split null message") /* Mark object header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, oh) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, UFAIL, "unable to mark object header as dirty") /* Set return value */ @@ -1133,7 +1134,7 @@ H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg, /* Clear message flags */ mesg->flags = 0; - /* Indicate that the message was modified */ + /* Mark the message as modified */ mesg->dirty = TRUE; /* Check if chunk has a gap currently */ @@ -1455,12 +1456,14 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh, hid_t dxpl_id) /* Initialize new null message to take over non-null message's location */ oh->mesg[new_null_msg].type = H5O_MSG_NULL; - oh->mesg[new_null_msg].dirty = TRUE; oh->mesg[new_null_msg].native = NULL; oh->mesg[new_null_msg].raw = old_raw; oh->mesg[new_null_msg].raw_size = curr_msg->raw_size; oh->mesg[new_null_msg].chunkno = old_chunkno; + /* Mark new null message dirty */ + oh->mesg[new_null_msg].dirty = TRUE; + /* Check for gap in new null message's chunk */ if(oh->chunk[old_chunkno].gap > 0) { /* Eliminate the gap in the chunk */ @@ -1498,7 +1501,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh, hid_t dxpl_id) } while(packed_msg); /* Set return value */ - ret_value = did_packing; + ret_value = (htri_t)did_packing; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1612,7 +1615,7 @@ H5O_merge_null(H5F_t *f, H5O_t *oh, hid_t dxpl_id) } while(merged_msg); /* Set return value */ - ret_value = did_merging; + ret_value = (htri_t)did_merging; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1638,7 +1641,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh, hid_t dxpl_id) +H5O_remove_empty_chunks(H5F_t *f, hid_t dxpl_id, H5O_t *oh) { hbool_t deleted_chunk; /* Whether to a chunk was deleted */ hbool_t did_deleting = FALSE; /* Whether any chunks were deleted */ @@ -1725,7 +1728,10 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh, hid_t dxpl_id) /* Adjust chunk # for messages in chunks after deleted chunk */ for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) { + /* Sanity check - there should be no messages in deleted chunk */ HDassert(curr_msg->chunkno != deleted_chunkno); + + /* Adjust chunk index for messages in later chunks */ if(curr_msg->chunkno > deleted_chunkno) curr_msg->chunkno--; @@ -1752,7 +1758,7 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh, hid_t dxpl_id) } while(deleted_chunk); /* Set return value */ - ret_value = did_deleting; + ret_value = (htri_t)did_deleting; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1810,7 +1816,7 @@ H5O_condense_header(H5F_t *f, H5O_t *oh, hid_t dxpl_id) rescan_header = TRUE; /* Scan for empty chunks to remove */ - result = H5O_remove_empty_chunks(f, oh, dxpl_id); + result = H5O_remove_empty_chunks(f, dxpl_id, oh); if(result < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk") if(result > 0) diff --git a/src/H5Oattr.c b/src/H5Oattr.c index ad068ad..4d8b17a 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -668,7 +668,7 @@ H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *mesg_type, if(H5T_set_loc(((H5A_t *)native_src)->shared->dt, file_src, H5T_LOC_DISK) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location") - if ( NULL == (ret_value=H5A_attr_copy_file((H5A_t *)native_src, file_dst, recompute_size, cpy_info, dxpl_id))) + if(NULL == (ret_value = H5A_attr_copy_file((H5A_t *)native_src, file_dst, recompute_size, cpy_info, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy attribute") done: diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 67d0a92..72f02df 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -235,7 +235,7 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check if this object already has attribute information */ if(oh->version > H5O_VERSION_1) { @@ -401,7 +401,7 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_create() */ @@ -488,7 +488,7 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, NULL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -545,7 +545,7 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, NULL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_open_by_name() */ @@ -629,7 +629,7 @@ H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, NULL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header") /* Find out whether it has already been opened. If it has, close the object * and make a copy of the already opened object to share the object info. @@ -655,7 +655,7 @@ H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, done: if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, NULL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_open_by_idx() */ @@ -846,7 +846,7 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, HDassert(!udata->found); /* Check for correct attribute message to modify */ - if(HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->attr->shared->name) == 0) { + if(0 == HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->attr->shared->name)) { /* Update the shared attribute in the SOHM storage */ if(mesg->flags & H5O_MSG_FLAG_SHARED) if(H5O_attr_update_shared(udata->f, udata->dxpl_id, oh, udata->attr, (H5O_shared_t *)mesg->native) < 0) @@ -898,7 +898,7 @@ H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -944,7 +944,7 @@ H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_write */ @@ -1036,7 +1036,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, if(H5A_set_version(udata->f, ((H5A_t *)mesg->native)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5_ITER_ERROR, "unable to update attribute version") - /* Mark message as dirty */ + /* Mark the message as modified */ mesg->dirty = TRUE; /* Check for shared message */ @@ -1132,7 +1132,7 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name, /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1189,7 +1189,7 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name, done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_rename */ @@ -1227,7 +1227,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1245,7 +1245,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, /* Release the object header */ if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") oh = NULL; /* Iterate over attributes in dense storage */ @@ -1259,7 +1259,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, /* Release the object header */ if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") oh = NULL; /* Check for skipping too many attributes */ @@ -1274,7 +1274,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, done: /* Release resources */ if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(atable.attrs && H5A_attr_release_table(&atable) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") @@ -1402,8 +1402,7 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo, /* Insert attribute message into object header (Will increment reference count on shared attributes) */ /* Find out whether the attribute has been opened */ - if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, - (atable.attrs[u])->shared->name)) < 0) + if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "failed in finding opened attribute") /* If found the attribute is already opened, use the opened message to insert. @@ -1523,7 +1522,7 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1574,7 +1573,7 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_remove() */ @@ -1611,7 +1610,7 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1670,7 +1669,7 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(atable.attrs && H5A_attr_release_table(&atable) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") @@ -1799,7 +1798,7 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1837,7 +1836,7 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_exists */ @@ -1953,7 +1952,7 @@ H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id) /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Retrieve # of attributes on object */ if(H5O_attr_count_real(loc->file, dxpl_id, oh, &nattrs) < 0) @@ -1964,7 +1963,7 @@ H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_count */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index c0c1bfa..0709e60 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -135,9 +135,9 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, haddr_t eoa; /* Relative end of file address */ H5O_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_load, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5O_load) - /* check args */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(!_udata1); @@ -155,7 +155,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header") p = read_buf; - /* allocate ohdr and init chunk list */ + /* Allocate space for the object header data structure */ if(NULL == (oh = H5FL_CALLOC(H5O_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -163,7 +163,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, oh->sizeof_size = H5F_SIZEOF_SIZE(f); oh->sizeof_addr = H5F_SIZEOF_ADDR(f); - /* Check for magic number */ + /* Check for presence of magic number */ /* (indicates version 2 or later) */ if(!HDmemcmp(p, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* Magic number */ @@ -268,12 +268,12 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, (nmesgs == 0 && chunk_size > 0)) HGOTO_ERROR(H5E_OHDR, H5E_VERSION, NULL, "bad object header chunk size") - /* Reserved, in version 1 */ + /* Reserved, in version 1 (for 8-byte alignment padding) */ p += 4; } /* end else */ /* Determine object header prefix length */ - prefix_size = (size_t)(p - read_buf); + prefix_size = (size_t)(p - (const uint8_t *)read_buf); HDassert((size_t)prefix_size == (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh))); /* Compute first chunk address */ @@ -282,7 +282,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, /* Allocate the message array */ oh->alloc_nmesgs = (nmesgs > 0) ? nmesgs : 1; if(NULL == (oh->mesg = H5FL_SEQ_MALLOC(H5O_mesg_t, oh->alloc_nmesgs))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed") /* Read each chunk from disk */ while(H5F_addr_defined(chunk_addr)) { @@ -298,7 +298,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, H5O_chunk_t *x = H5FL_SEQ_REALLOC(H5O_chunk_t, oh->chunk, (size_t)na); if(!x) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed") oh->alloc_nchunks = na; oh->chunk = x; } /* end if */ @@ -317,7 +317,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, oh->chunk[chunkno].size = chunk_size; } /* end else */ if(NULL == (oh->chunk[chunkno].image = H5FL_BLK_MALLOC(chunk_image, oh->chunk[chunkno].size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed") /* Handle chunk 0 as special case */ if(chunkno == 0) { @@ -401,7 +401,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, if(oh->version == H5O_VERSION_1) p += 3; /*reserved*/ else { - /* Only encode creation index if they are being tracked */ + /* Only decode creation index if they are being tracked */ if(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) UINT16DECODE(p, crt_idx); } /* end else */ @@ -434,7 +434,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, /* Check if we need to extend message table to hold the new message */ if(oh->nmesgs >= oh->alloc_nmesgs) if(H5O_alloc_msgs(oh, (size_t)1) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate more space for messages") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate more space for messages") /* Get index for message */ mesgno = oh->nmesgs++; @@ -455,12 +455,12 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, /* Allocate "unknown" message info */ if(NULL == (unknown = H5FL_MALLOC(H5O_unknown_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed") /* Save the original message type ID */ *unknown = id; - /* Save 'native' form of continuation message */ + /* Save 'native' form of unknown message */ oh->mesg[mesgno].native = unknown; /* Set message to "unknown" class */ @@ -646,22 +646,16 @@ done: * matzke@llnl.gov * Aug 5 1997 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * *------------------------------------------------------------------------- */ static herr_t H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr, H5O_t *oh, unsigned UNUSED * flags_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_flush, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5O_flush) - /* check args */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(oh); diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 807d147..8bdbed5 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -44,6 +44,7 @@ #include "H5Opkg.h" /* Object headers */ #include "H5Pprivate.h" /* Property lists */ + /****************/ /* Local Macros */ /****************/ @@ -316,7 +317,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, /* Get source object header */ if(NULL == (oh_src = (H5O_t *)H5AC_protect(oloc_src->file, dxpl_id, H5AC_OHDR, oloc_src->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Get pointer to object class for this object */ if(NULL == (obj_class = H5O_obj_class_real(oh_src))) @@ -451,7 +452,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, if(cpy_info->preserve_null && deleted[mesgno]) { mesg_dst->type = H5O_MSG_NULL; mesg_dst->flags = 0; - mesg_dst->dirty = 1; + mesg_dst->dirty = TRUE; } /* end if */ /* Check for message class to operate on */ @@ -720,7 +721,8 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, /* Insert destination object header in cache */ if(H5AC_set(oloc_dst->file, dxpl_id, H5AC_OHDR, oloc_dst->addr, oh_dst, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to cache object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header") + oh_dst = NULL; done: /* Free deleted array */ @@ -728,17 +730,12 @@ done: HDfree(deleted); /* Release pointer to source object header and its derived objects */ - if(oh_src != NULL) { - /* Unprotect the source object header */ - if(H5AC_unprotect(oloc_src->file, dxpl_id, H5AC_OHDR, oloc_src->addr, oh_src, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") - } /* end if */ + if(oh_src && H5AC_unprotect(oloc_src->file, dxpl_id, H5AC_OHDR, oloc_src->addr, oh_src, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") /* Release pointer to destination object header */ - if(ret_value < 0 && oh_dst) { - if(H5O_dest(oloc_dst->file, oh_dst) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data") - } /* end if */ + if(ret_value < 0 && oh_dst && H5O_dest(oloc_dst->file, oh_dst) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data") /* Release user data for particular type of object to copy */ if(udata) { diff --git a/src/H5Odbg.c b/src/H5Odbg.c index cd041e0..b731ce9 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -534,8 +534,8 @@ done: herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth) { - H5O_t *oh = NULL; - herr_t ret_value = SUCCEED; + H5O_t *oh = NULL; /* Object header to display */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_debug, FAIL) @@ -547,14 +547,14 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f HDassert(fwidth >= 0); if(NULL == (oh = (H5O_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* debug */ H5O_debug_real(f, dxpl_id, oh, addr, stream, indent, fwidth); done: if(oh && H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_debug() */ diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 5702b34..0eb4ba2 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -126,11 +126,11 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh, if(NULL == (heap = H5HL_protect(f, dxpl_id, mesg->heap_addr, H5AC_READ))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read protect link value") - s = (const char *)H5HL_offset_into(f, heap, 0); + s = (const char *)H5HL_offset_into(heap, 0); HDassert(s && !*s); - if(H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr) < 0) + if(H5HL_unprotect(heap) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value") heap = NULL; #endif @@ -146,7 +146,7 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh, /* Name */ H5F_DECODE_LENGTH (f, p, mesg->slot[u].name_offset); - s = (const char *)H5HL_offset_into(f, heap, mesg->slot[u].name_offset); + s = (const char *)H5HL_offset_into(heap, mesg->slot[u].name_offset); HDassert(s && *s); mesg->slot[u].name = H5MM_xstrdup (s); HDassert(mesg->slot[u].name); @@ -159,7 +159,7 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh, HDassert(mesg->slot[u].size > 0); } /* end for */ - if(H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr) < 0) + if(H5HL_unprotect(heap) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value") heap = NULL; @@ -482,7 +482,7 @@ H5O_efl_copy_file(H5F_t UNUSED *file_src, void *mesg_src, H5F_t *file_dst, done: /* Release resources */ - if(heap && H5HL_unprotect(file_dst, dxpl_id, heap, efl_dst->heap_addr) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_EFL, H5E_PROTECT, NULL, "unable to unprotect EFL file name heap") if(!ret_value) if(efl_dst) diff --git a/src/H5Ofill.c b/src/H5Ofill.c index d133a0a..f403b81 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -556,7 +556,7 @@ H5O_fill_copy(const void *_src, void *_dst) H5I_dec_ref(src_id, FALSE); H5I_dec_ref(dst_id, FALSE); if(bkg_buf) - (void)H5FL_BLK_FREE(type_conv, bkg_buf); + bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, NULL, "datatype conversion failed") } /* end if */ @@ -564,7 +564,7 @@ H5O_fill_copy(const void *_src, void *_dst) H5I_dec_ref(src_id, FALSE); H5I_dec_ref(dst_id, FALSE); if(bkg_buf) - (void)H5FL_BLK_FREE(type_conv, bkg_buf); + bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); } /* end if */ } /* end if */ } /* end if */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 330189c..7a15947 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -560,8 +560,10 @@ H5O_layout_copy(const void *_mesg, void *_dest) /* check args */ HDassert(mesg); + + /* Allocate destination message, if necessary */ if(!dest && NULL == (dest = H5FL_MALLOC(H5O_layout_t))) - HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "layout message allocation failed") /* copy */ *dest = *mesg; @@ -584,6 +586,10 @@ H5O_layout_copy(const void *_mesg, void *_dest) ret_value = dest; done: + if(ret_value == NULL) + if(NULL == _dest) + dest = H5FL_FREE(H5O_layout_t, dest); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_layout_copy() */ @@ -880,7 +886,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, done: if(!ret_value) if(layout_dst) - (void)H5FL_FREE(H5O_layout_t, layout_dst); + layout_dst = H5FL_FREE(H5O_layout_t, layout_dst); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_layout_copy_file() */ diff --git a/src/H5Olink.c b/src/H5Olink.c index ffe80e7..4ddfbf6 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -705,7 +705,6 @@ H5O_link_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file_ hid_t UNUSED dxpl_id) { H5O_link_t *link_src = (H5O_link_t *)native_src; - H5O_link_t *link_dst = NULL; void *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5O_link_copy_file) @@ -721,17 +720,10 @@ H5O_link_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file_ /* Allocate "blank" link for destination */ /* (values will be filled in during 'post copy' operation) */ - if(NULL == (link_dst = H5FL_CALLOC(H5O_link_t))) + if(NULL == (ret_value = H5FL_CALLOC(H5O_link_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - /* Set return value */ - ret_value = link_dst; - done: - if(!ret_value) - if(link_dst) - H5O_link_free(link_dst); - FUNC_LEAVE_NOAPI(ret_value) } /* H5O_link_copy_file() */ diff --git a/src/H5Omessage.c b/src/H5Omessage.c index 4a9ecb5..fc6146a 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -133,7 +133,7 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, /* Protect the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Go append message to object header */ if(H5O_msg_append_oh(loc->file, dxpl_id, oh, type_id, mesg_flags, update_flags, mesg) < 0) @@ -141,7 +141,7 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_create() */ @@ -286,7 +286,7 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, /* Protect the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Call the "real" modify routine */ if(H5O_msg_write_real(loc->file, dxpl_id, oh, type, mesg_flags, update_flags, mesg) < 0) @@ -294,7 +294,7 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_write() */ @@ -485,7 +485,7 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg, /* Get the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header") /* Call the "real" read routine */ if(NULL == (ret_value = H5O_msg_read_oh(loc->file, dxpl_id, oh, type_id, mesg))) @@ -493,7 +493,7 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg, done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_read() */ @@ -810,14 +810,14 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) /* Load the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Count the messages of the correct type */ ret_value = H5O_msg_count_real(oh, type); done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_count() */ @@ -891,7 +891,7 @@ H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) /* Load the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Call the "real" exists routine */ if((ret_value = H5O_msg_exists_oh(oh, type_id)) < 0) @@ -899,7 +899,7 @@ H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) != SUCCEED) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_exists() */ @@ -988,7 +988,7 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Call the "real" remove routine */ if((ret_value = H5O_msg_remove_real(loc->file, oh, type, sequence, NULL, NULL, adj_link, dxpl_id)) < 0) @@ -996,7 +996,7 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_remove() */ @@ -1040,7 +1040,7 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence, /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Call the "real" remove routine */ if((ret_value = H5O_msg_remove_real(loc->file, oh, type, sequence, op, op_data, adj_link, dxpl_id)) < 0) @@ -1048,7 +1048,7 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence, done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_remove_op() */ @@ -1231,7 +1231,7 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Call the "real" iterate routine */ if((ret_value = H5O_msg_iterate_real(loc->file, oh, type, op, op_data, dxpl_id)) < 0) @@ -1239,7 +1239,7 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_iterate() */ @@ -1336,7 +1336,7 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update time on object") /* Mark object header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, oh) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") } /* end if */ @@ -1859,7 +1859,6 @@ H5O_msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, void *native_src, H5F_t *file_dst, hbool_t *recompute_size, H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id) { - void *native_mesg = NULL; void *ret_value; FUNC_ENTER_NOAPI_NOINIT(H5O_msg_copy_file) @@ -1876,16 +1875,10 @@ H5O_msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, /* The copy_file callback will return an H5O_shared_t only if the message * to be copied is a committed datatype. */ - if(NULL == (native_mesg = (type->copy_file)(file_src, native_src, file_dst, recompute_size, cpy_info, udata, dxpl_id))) + if(NULL == (ret_value = (type->copy_file)(file_src, native_src, file_dst, recompute_size, cpy_info, udata, dxpl_id))) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object header message to file") - /* Set return value */ - ret_value = native_mesg; - done: - if(NULL == ret_value && native_mesg) - H5O_msg_free(type->id, native_mesg); - FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_copy_file() */ @@ -1988,8 +1981,10 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx, if(NULL == (idx_msg->native = (type->copy)(mesg, idx_msg->native))) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy message to object header") - /* Update the message flags and mark the message as modified */ + /* Update the message flags */ idx_msg->flags = mesg_flags; + + /* Mark the message as modified */ idx_msg->dirty = TRUE; /* Update the modification time, if requested */ @@ -1998,7 +1993,7 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx, HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update time on object") /* Mark object header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, oh) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") done: diff --git a/src/H5Opkg.h b/src/H5Opkg.h index edb5d94..3b738a4 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -222,8 +222,8 @@ struct H5O_msg_class_t { const char *name; /*for debugging */ size_t native_size; /*size of native message */ unsigned share_flags; /* Message sharing settings */ - void *(*decode)(H5F_t*, hid_t, H5O_t *, unsigned, unsigned *, const uint8_t *); - herr_t (*encode)(H5F_t*, hbool_t, uint8_t*, const void *); + void *(*decode)(H5F_t *, hid_t, H5O_t *, unsigned, unsigned *, const uint8_t *); + herr_t (*encode)(H5F_t *, hbool_t, uint8_t *, const void *); void *(*copy)(const void *, void *); /*copy native value */ size_t (*raw_size)(const H5F_t *, hbool_t, const void *);/*sizeof encoded message */ herr_t (*reset)(void *); /*free nested data structs */ @@ -260,7 +260,7 @@ typedef struct H5O_chunk_t { } H5O_chunk_t; struct H5O_t { - H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ + H5AC_info_t cache_info; /* Information for metadata cache functions, _must_ be */ /* first field in structure */ /* File-specific information (not stored) */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index db2dab8..d7e4e04 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -675,8 +675,8 @@ H5_DLL herr_t H5O_close(H5O_loc_t *loc); H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id); H5_DLL int H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags); H5_DLL H5O_t *H5O_pin(H5O_loc_t *loc, hid_t dxpl_id); -H5_DLL herr_t H5O_unpin(H5O_loc_t *loc, H5O_t *oh); -H5_DLL herr_t H5O_touch(H5O_loc_t *loc, hbool_t force, hid_t dxpl_id); +H5_DLL herr_t H5O_unpin(H5O_t *oh); +H5_DLL herr_t H5O_touch(const H5O_loc_t *loc, hbool_t force, hid_t dxpl_id); H5_DLL herr_t H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force); #ifdef H5O_ENABLE_BOGUS diff --git a/src/H5Otest.c b/src/H5Otest.c index c7cd8a9..5282538 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -97,24 +97,24 @@ H5O_is_attr_dense_test(hid_t oid) { H5O_t *oh = NULL; /* Object header */ H5O_ainfo_t ainfo; /* Attribute information for object */ - H5O_loc_t *oloc; /* Pointer to object's location */ + H5O_loc_t *loc; /* Pointer to object's location */ htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5O_is_attr_dense_test, FAIL) /* Get object location for object */ - if(NULL == (oloc = H5O_get_loc(oid))) + if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) + if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -129,8 +129,8 @@ H5O_is_attr_dense_test(hid_t oid) ret_value = FALSE; done: - if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_is_attr_dense_test() */ @@ -161,24 +161,24 @@ H5O_is_attr_empty_test(hid_t oid) H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ H5O_ainfo_t ainfo; /* Attribute information for object */ htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ - H5O_loc_t *oloc; /* Pointer to object's location */ + H5O_loc_t *loc; /* Pointer to object's location */ hsize_t nattrs; /* Number of attributes */ htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5O_is_attr_empty_test, FAIL) /* Get object location for object */ - if(NULL == (oloc = H5O_get_loc(oid))) + if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if((ainfo_exists = H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo)) < 0) + if((ainfo_exists = H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -194,7 +194,7 @@ H5O_is_attr_empty_test(hid_t oid) HDassert(nattrs == 0); /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(oloc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) + if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in name index */ @@ -216,8 +216,8 @@ done: /* Release resources */ if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") - if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_is_attr_empty_test() */ @@ -248,25 +248,25 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) H5O_t *oh = NULL; /* Object header */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ H5O_ainfo_t ainfo; /* Attribute information for object */ - H5O_loc_t *oloc; /* Pointer to object's location */ + H5O_loc_t *loc; /* Pointer to object's location */ hsize_t obj_nattrs; /* Number of attributes */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_num_attrs_test, FAIL) /* Get object location for object */ - if(NULL == (oloc = H5O_get_loc(oid))) + if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) + if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -281,7 +281,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) HDassert(obj_nattrs == 0); /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(oloc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) + if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in name index */ @@ -300,8 +300,8 @@ done: /* Release resources */ if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") - if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_num_attrs_test() */ @@ -335,24 +335,24 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */ H5O_ainfo_t ainfo; /* Attribute information for object */ - H5O_loc_t *oloc; /* Pointer to object's location */ + H5O_loc_t *loc; /* Pointer to object's location */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_attr_dense_info_test, FAIL) /* Get object location for object */ - if(NULL == (oloc = H5O_get_loc(oid))) + if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) + if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -363,7 +363,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) HGOTO_DONE(FAIL) /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(oloc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) + if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in name index */ @@ -373,7 +373,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) /* Check if there is a creation order index */ if(H5F_addr_defined(ainfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ - if(NULL == (bt2_corder = H5B2_open(oloc->file, H5AC_ind_dxpl_id, ainfo.corder_bt2_addr, NULL))) + if(NULL == (bt2_corder = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.corder_bt2_addr, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Retrieve # of records in creation order index */ @@ -389,8 +389,8 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") if(bt2_corder && H5B2_close(bt2_corder, H5AC_ind_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") - if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_attr_dense_info_test() */ @@ -421,7 +421,7 @@ herr_t H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) { H5O_t *oh = NULL; /* Object header */ - H5O_loc_t *oloc; /* Pointer to object's location */ + H5O_loc_t *loc; /* Pointer to object's location */ H5O_mesg_t *idx_msg; /* Pointer to message */ unsigned idx; /* Index of message */ herr_t ret_value = SUCCEED; /* Return value */ @@ -429,12 +429,12 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) FUNC_ENTER_NOAPI(H5O_check_msg_marked_test, FAIL) /* Get object location for object */ - if(NULL == (oloc = H5O_get_loc(oid))) + if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Locate "unknown" message */ for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) @@ -452,8 +452,8 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "'unknown' message type not found") done: - if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_check_msg_marked_test() */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 17e1011..f62d47c 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -1488,13 +1488,13 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) /* Convert the fill value */ if(H5T_convert(tpath, type_id, type_id, (size_t)1, (size_t)0, (size_t)0, fill.buf, bkg_buf, H5AC_ind_dxpl_id) < 0) { if(bkg_buf) - (void)H5FL_BLK_FREE(type_conv, bkg_buf); + bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed") } /* end if */ /* Release the background buffer */ if(bkg_buf) - (void)H5FL_BLK_FREE(type_conv, bkg_buf); + bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); } /* end if */ } /* end if */ else diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 486bda3..5d73afe 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -1336,27 +1336,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pset_mdc_config(hid_t plist_id, - H5AC_cache_config_t *config_ptr) +H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_API(H5Pset_mdc_config, FAIL); + FUNC_ENTER_API(H5Pset_mdc_config, FAIL) H5TRACE2("e", "i*x", plist_id, config_ptr); /* Get the plist structure */ - if( NULL == ( plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS) ) ) { - - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - } + if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* validate the new configuration */ - if ( H5AC_validate_config(config_ptr) < 0 ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "invalid metadata cache configuration"); - } + if(H5AC_validate_config(config_ptr) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid metadata cache configuration") /* set the modified config */ @@ -1364,16 +1358,11 @@ H5Pset_mdc_config(hid_t plist_id, * will have to test the version and do translation here. */ - if(H5P_set(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr)<0) { - - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, \ - "can't set metadata cache initial config"); - } + if(H5P_set(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set metadata cache initial config") done: - FUNC_LEAVE_API(ret_value); - } /* H5Pset_mdc_config() */ @@ -1398,33 +1387,25 @@ done: * *------------------------------------------------------------------------- */ - herr_t -H5Pget_mdc_config(hid_t plist_id, - H5AC_cache_config_t *config_ptr) +H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_API(H5Pget_mdc_config, FAIL); + FUNC_ENTER_API(H5Pget_mdc_config, FAIL) H5TRACE2("e", "i*x", plist_id, config_ptr); /* Get the plist structure */ - if ( NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)) ) { - - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - } + if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* validate the config_ptr */ - if ( config_ptr == NULL ) { - + if(config_ptr == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.") - } - - if ( config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION ) { + if(config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version.") - } /* If we ever support multiple versions of H5AC_cache_config_t, we * will have to get the cannonical version here, and then translate @@ -1432,16 +1413,11 @@ H5Pget_mdc_config(hid_t plist_id, */ /* Get the current initial metadata cache resize configuration */ - if ( H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr) < 0 ) { - - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, \ - "can't get metadata cache initial resize config"); - } + if(H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get metadata cache initial resize config") done: - - FUNC_LEAVE_API(ret_value); - + FUNC_LEAVE_API(ret_value) } /* H5Pget_mdc_config() */ diff --git a/src/H5S.c b/src/H5S.c index c723127..83ee11c 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -19,7 +19,6 @@ #define H5_INTERFACE_INIT_FUNC H5S_init_interface -#define _H5S_IN_H5S_C #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ @@ -207,8 +206,10 @@ H5S_create(H5S_class_t type) ret_value = new_ds; done: - if(ret_value == NULL && new_ds) - H5S_close(new_ds); + if(ret_value == NULL) { + if(new_ds && H5S_close(new_ds) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, NULL, "unable to release dataspace") + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_create() */ @@ -238,7 +239,7 @@ H5Screate(H5S_class_t type) H5S_t *new_ds=NULL; /* New dataspace structure */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Screate, FAIL); + FUNC_ENTER_API(H5Screate, FAIL) H5TRACE1("i", "Sc", type); /* Check args */ @@ -253,10 +254,12 @@ H5Screate(H5S_class_t type) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") done: - if(ret_value < 0 && new_ds) - H5S_close(new_ds); + if(ret_value < 0) { + if(new_ds && H5S_close(new_ds) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + } /* end if */ - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Screate() */ @@ -279,7 +282,7 @@ H5S_extent_release(H5S_extent_t *extent) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5S_extent_release, FAIL); + FUNC_ENTER_NOAPI(H5S_extent_release, FAIL) assert(extent); @@ -292,7 +295,7 @@ H5S_extent_release(H5S_extent_t *extent) } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_extent_release() */ @@ -311,20 +314,22 @@ done: herr_t H5S_close(H5S_t *ds) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5S_close, FAIL) HDassert(ds); /* Release selection (this should come before the extent release) */ - H5S_SELECT_RELEASE(ds); + if(H5S_SELECT_RELEASE(ds) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace selection") /* Release extent */ - H5S_extent_release(&ds->extent); + if(H5S_extent_release(&ds->extent) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent") /* Release the main structure */ - (void)H5FL_FREE(H5S_t, ds); + ds = H5FL_FREE(H5S_t, ds); done: FUNC_LEAVE_NOAPI(ret_value) @@ -352,7 +357,7 @@ H5Sclose(hid_t space_id) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Sclose, FAIL); + FUNC_ENTER_API(H5Sclose, FAIL) H5TRACE1("e", "i", space_id); /* Check args */ @@ -364,7 +369,7 @@ H5Sclose(hid_t space_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } @@ -391,29 +396,29 @@ H5Scopy(hid_t space_id) H5S_t *dst = NULL; hid_t ret_value; - FUNC_ENTER_API(H5Scopy, FAIL); + FUNC_ENTER_API(H5Scopy, FAIL) H5TRACE1("i", "i", space_id); /* Check args */ - if (NULL==(src=(H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + if(NULL == (src = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Copy */ - if (NULL == (dst = H5S_copy(src, FALSE, TRUE))) + if(NULL == (dst = H5S_copy(src, FALSE, TRUE))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace") /* Atomize */ - if ((ret_value=H5I_register (H5I_DATASPACE, dst, TRUE))<0) + if((ret_value = H5I_register (H5I_DATASPACE, dst, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") done: - if(ret_value<0) { - if(dst!=NULL) - H5S_close(dst); + if(ret_value < 0) { + if(dst && H5S_close(dst) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") } /* end if */ - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Scopy() */ /*------------------------------------------------------------------------- @@ -565,6 +570,10 @@ H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max) ret_value = dst; done: + if(NULL == ret_value) + if(dst) + dst = H5FL_FREE(H5S_t, dst); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_copy() */ @@ -672,7 +681,7 @@ H5S_get_npoints_max(const H5S_t *ds) hsize_t ret_value; unsigned u; - FUNC_ENTER_NOAPI(H5S_get_npoints_max, 0); + FUNC_ENTER_NOAPI(H5S_get_npoints_max, 0) /* check args */ assert(ds); @@ -709,7 +718,7 @@ H5S_get_npoints_max(const H5S_t *ds) } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -826,7 +835,7 @@ H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[]/*out*/, H5S_t *ds; int ret_value; - FUNC_ENTER_API(H5Sget_simple_extent_dims, FAIL); + FUNC_ENTER_API(H5Sget_simple_extent_dims, FAIL) H5TRACE3("Is", "ixx", space_id, dims, maxdims); /* Check args */ @@ -836,7 +845,7 @@ H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[]/*out*/, ret_value = H5S_get_simple_extent_dims(ds, dims, maxdims); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } @@ -1106,7 +1115,7 @@ H5Sis_simple(hid_t space_id) H5S_t *space; /* dataspace to modify */ htri_t ret_value; - FUNC_ENTER_API(H5Sis_simple, FAIL); + FUNC_ENTER_API(H5Sis_simple, FAIL) H5TRACE1("t", "i", space_id); /* Check args and all the boring stuff. */ @@ -1116,7 +1125,7 @@ H5Sis_simple(hid_t space_id) ret_value = H5S_is_simple(space); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } @@ -1160,7 +1169,7 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], int u; /* local counting variable */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Sset_extent_simple, FAIL); + FUNC_ENTER_API(H5Sset_extent_simple, FAIL) H5TRACE4("e", "iIs*[a1]h*[a1]h", space_id, rank, dims, max); /* Check args */ @@ -1192,7 +1201,7 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set simple extent") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } @@ -1291,67 +1300,66 @@ done: * * Failure: Negative * - * Errors: - * * Programmer: Quincey Koziol * Tuesday, January 27, 1998 * - * Modifications: Christian Chilan 01/17/2007 - * Verifies that each element of DIMS is not equal to - * H5S_UNLIMITED. - * *------------------------------------------------------------------------- */ hid_t H5Screate_simple(int rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/*rank*/]) { - hid_t ret_value; H5S_t *space = NULL; int i; + hid_t ret_value; - FUNC_ENTER_API(H5Screate_simple, FAIL); + FUNC_ENTER_API(H5Screate_simple, FAIL) H5TRACE3("i", "Is*[a0]h*[a0]h", rank, dims, maxdims); /* Check arguments */ - if (rank<0) + if(rank < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality cannot be negative") - if (rank>H5S_MAX_RANK) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality is too large") - if (!dims && dims!=0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified") + if(rank > H5S_MAX_RANK) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality is too large") + + /* We allow users to use this function to create scalar or null dataspace. + * Check DIMS isn't set when the RANK is 0. + */ + if(!dims && rank != 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dataspace information") + /* Check whether the current dimensions are valid */ - for (i=0; iextent.type=H5S_NO_CLASS; done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Sset_extent_none() */ @@ -1767,7 +1775,7 @@ H5Soffset_simple(hid_t space_id, const hssize_t *offset) H5S_t *space; /* dataspace to modify */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Soffset_simple, FAIL); + FUNC_ENTER_API(H5Soffset_simple, FAIL) H5TRACE2("e", "i*Hs", space_id, offset); /* Check args */ @@ -1784,7 +1792,7 @@ H5Soffset_simple(hid_t space_id, const hssize_t *offset) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set offset") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Soffset_simple() */ @@ -1854,9 +1862,9 @@ done: hbool_t H5S_has_extent(const H5S_t *ds) { - htri_t ret_value; + hbool_t ret_value; - FUNC_ENTER_NOAPI(H5S_has_extent, FAIL) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_has_extent) HDassert(ds); @@ -1865,7 +1873,6 @@ H5S_has_extent(const H5S_t *ds) else ret_value = TRUE; -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_has_extent() */ diff --git a/src/H5SM.c b/src/H5SM.c index cbb063b..9a97d88 100755 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -2248,7 +2248,7 @@ H5SM_read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, /* Load the object header from the cache */ if(NULL == (oh = (H5O_t *)H5AC_protect(oloc.file, dxpl_id, H5AC_OHDR, oloc.addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load object header") } /* end if */ else oh = open_oh; diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 1380e71..070b00e 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -175,7 +175,7 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1 /* Don't count the checksum in the table size yet, since it comes after * all of the index headers */ - HDassert((size_t)(p - buf) == H5SM_TABLE_SIZE(f) - H5SM_SIZEOF_CHECKSUM); + HDassert((size_t)(p - (const uint8_t *)buf) == H5SM_TABLE_SIZE(f) - H5SM_SIZEOF_CHECKSUM); /* Allocate space for the index headers in memory*/ if(NULL == (table->indexes = (H5SM_index_header_t *)H5FL_ARR_MALLOC(H5SM_index_header_t, (size_t)table->num_indexes))) @@ -216,7 +216,7 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1 UINT32DECODE(p, stored_chksum); /* Sanity check */ - HDassert((size_t)(p - buf) == size); + HDassert((size_t)(p - (const uint8_t *)buf) == size); /* Compute checksum on entire header */ computed_chksum = H5_checksum_metadata(buf, (size - H5SM_SIZEOF_CHECKSUM), 0); @@ -257,7 +257,7 @@ H5SM_table_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma { H5WB_t *wb = NULL; /* Wrapped buffer for table data */ uint8_t tbl_buf[H5SM_TBL_BUF_SIZE]; /* Buffer for table */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5SM_table_flush) diff --git a/src/H5Sall.c b/src/H5Sall.c index 1c086b9..115d5d35 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -630,7 +630,7 @@ H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_all_offset(const H5S_t *space, hsize_t *offset) +H5S_all_offset(const H5S_t UNUSED *space, hsize_t *offset) { FUNC_ENTER_NOAPI_NOFUNC(H5S_all_offset) @@ -828,7 +828,7 @@ done: herr_t H5Sselect_all(hid_t spaceid) { - H5S_t *space; /* Dataspace to modify selection of */ + H5S_t *space; /* Dataspace to modify selection of */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(H5Sselect_all, FAIL) @@ -839,7 +839,7 @@ H5Sselect_all(hid_t spaceid) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") /* Call internal routine to do the work */ - if((ret_value = H5S_select_all(space, TRUE)) < 0) + if(H5S_select_all(space, TRUE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") done: diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 21e08d4..bdcdc28 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -3531,58 +3531,61 @@ done: herr_t H5S_hyper_add_span_element(H5S_t *space, unsigned rank, hsize_t *coords) { - herr_t ret_value=SUCCEED; /* Return value */ + H5S_hyper_span_info_t *head = NULL; /* Pointer to new head of span tree */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_add_span_element); + FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_add_span_element) - assert(space); - assert(rank>0); - assert(coords); + HDassert(space); + HDassert(rank > 0); + HDassert(coords); /* Check if this is the first element in the selection */ - if(space->select.sel_info.hslab==NULL) { - H5S_hyper_span_info_t *head; /* Pointer to new head of span tree */ - + if(NULL == space->select.sel_info.hslab) { /* Allocate a span info node */ - if((head = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span"); + if(NULL == (head = H5FL_MALLOC(H5S_hyper_span_info_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") /* Set the reference count */ - head->count=1; + head->count = 1; /* Reset the scratch pad space */ - head->scratch=0; + head->scratch = 0; /* Build span tree for this coordinate */ - if((head->head=H5S_hyper_coord_to_span(rank,coords))==NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span"); + if(NULL == (head->head = H5S_hyper_coord_to_span(rank, coords))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") /* Allocate selection info */ - if((space->select.sel_info.hslab=H5FL_MALLOC(H5S_hyper_sel_t))==NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info"); + if(NULL == (space->select.sel_info.hslab = H5FL_MALLOC(H5S_hyper_sel_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info") /* Set the selection to the new span tree */ - space->select.sel_info.hslab->span_lst=head; + space->select.sel_info.hslab->span_lst = head; /* Set selection type */ - space->select.type=H5S_sel_hyper; + space->select.type = H5S_sel_hyper; /* Reset "regular" hyperslab flag */ - space->select.sel_info.hslab->diminfo_valid=FALSE; + space->select.sel_info.hslab->diminfo_valid = FALSE; /* Set # of elements in selection */ - space->select.num_elem=1; + space->select.num_elem = 1; } /* end if */ else { - if(H5S_hyper_add_span_element_helper(space->select.sel_info.hslab->span_lst,rank,coords)<0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span"); + if(H5S_hyper_add_span_element_helper(space->select.sel_info.hslab->span_lst, rank, coords) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") /* Increment # of elements in selection */ space->select.num_elem++; } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value); + if(ret_value < 0) + if(head) + H5S_hyper_free_span_info(head); + + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_hyper_add_span_element() */ @@ -4382,13 +4385,13 @@ done: static herr_t H5S_hyper_append_span (H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t ** span_tree, hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next) { - H5S_hyper_span_t *new_span; - herr_t ret_value=SUCCEED; /* Return value */ + H5S_hyper_span_t *new_span = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_append_span); - assert(prev_span); - assert(span_tree); + HDassert(prev_span); + HDassert(span_tree); /* Check for adding first node to merged spans */ if(*prev_span==NULL) { @@ -4452,7 +4455,13 @@ H5S_hyper_append_span (H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t ** sp } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value); + if(ret_value < 0) { + if(new_span) + if(H5S_hyper_free_span(new_span) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "failed to release new hyperslab span") + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_hyper_append_span() */ @@ -5264,9 +5273,15 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf } /* end else */ /* Set return value */ - ret_value=merged_spans; + ret_value = merged_spans; done: + if(ret_value == NULL) { + if(merged_spans) + if(H5S_hyper_free_span_info(merged_spans) < 0) + HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, NULL, "failed to release merged hyperslab spans") + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value); } /* H5S_hyper_merge_spans_helper() */ @@ -5409,85 +5424,109 @@ static H5S_hyper_span_info_t * H5S_hyper_make_spans (unsigned rank, const hsize_t *start, const hsize_t *stride, const hsize_t *count, const hsize_t *block) { - H5S_hyper_span_info_t *down;/* Pointer to spans in next dimension down */ - H5S_hyper_span_t *span; /* New hyperslab span */ - H5S_hyper_span_t *last_span;/* Current position in hyperslab span list */ - H5S_hyper_span_t *head; /* Head of new hyperslab span list */ - hsize_t stride_iter; /* Iterator over the stride values */ - int i; /* Counters */ - unsigned u; /* Counters */ - H5S_hyper_span_info_t *ret_value; + H5S_hyper_span_info_t *down; /* Pointer to spans in next dimension down */ + H5S_hyper_span_t *span; /* New hyperslab span */ + H5S_hyper_span_t *last_span; /* Current position in hyperslab span list */ + H5S_hyper_span_t *head; /* Head of new hyperslab span list */ + hsize_t stride_iter; /* Iterator over the stride values */ + int i; /* Counters */ + unsigned u; /* Counters */ + H5S_hyper_span_info_t *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_make_spans); /* Check args */ - assert (rank>0); - assert (start); - assert (stride); - assert (count); - assert (block); + HDassert(rank > 0); + HDassert(start); + HDassert(stride); + HDassert(count); + HDassert(block); /* Start creating spans in fastest changing dimension */ - down=NULL; - for(i=(rank-1); i>=0; i--) { + down = NULL; + for(i = (rank - 1); i >= 0; i--) { /* Start a new list in this dimension */ - head=last_span=NULL; + head = NULL; + last_span = NULL; - /* Generate all the spans segments for this dimension */ - for(u=0, stride_iter=0; ulow=start[i]+stride_iter; - span->high=span->low+(block[i]-1); - span->nelem=block[i]; - span->pstride=stride[i]; - span->next=NULL; + span->low = start[i] + stride_iter; + span->high = span->low + (block[i]-1); + span->nelem = block[i]; + span->pstride = stride[i]; + span->next = NULL; /* Append to the list of spans in this dimension */ - if(head==NULL) - head=span; + if(head == NULL) + head = span; else - last_span->next=span; + last_span->next = span; /* Move current pointer */ - last_span=span; + last_span = span; /* Set the information for the next dimension down's spans, if appropriate */ - if(down!=NULL) { - span->down=down; + if(down != NULL) { + span->down = down; down->count++; /* Increment reference count for shared span */ } /* end if */ else { - span->down=NULL; + span->down = NULL; } /* end else */ } /* end for */ /* Allocate a span info node */ - if((down = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL) + if(NULL == (down = H5FL_MALLOC(H5S_hyper_span_info_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span"); /* Set the reference count */ - down->count=0; + down->count = 0; /* Reset the scratch pad space */ - down->scratch=0; + down->scratch = 0; /* Keep the pointer to the next dimension down's completed list */ - down->head=head; + down->head = head; } /* end for */ /* Indicate that there is a pointer to this tree */ - down->count=1; + down->count = 1; /* Success! Return the head of the list in the slowest changing dimension */ - ret_value=down; + ret_value = down; done: - FUNC_LEAVE_NOAPI(ret_value); + /* cleanup if error (ret_value will be NULL) */ + if(!ret_value) { + if(head || down) { + if(head && down) + if(down->head != head) + down = NULL; + + do { + if(down) { + head = down->head; + (void)H5FL_FREE(H5S_hyper_span_info_t, down); + } /* end if */ + down = head->down; + + while(head) { + last_span = head->next; + (void)H5FL_FREE(H5S_hyper_span_t, head); + head = last_span; + } /* end while */ + } while(down); + } /* end if */ + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_hyper_make_spans() */ @@ -5929,14 +5968,6 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); } /* end switch */ - /* Free the hyperslab trees generated from the clipping algorithm */ - if(a_not_b) - H5S_hyper_free_span_info(a_not_b); - if(a_and_b) - H5S_hyper_free_span_info(a_and_b); - if(b_not_a) - H5S_hyper_free_span_info(b_not_a); - /* Check if the resulting hyperslab span tree is empty */ if(space->select.sel_info.hslab->span_lst==NULL) { H5S_hyper_span_info_t *spans; /* Empty hyperslab span tree */ @@ -5973,10 +6004,19 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, } /* end else */ done: - /* Free the new spans */ - if(new_spans!=NULL) - if(H5S_hyper_free_span_info(new_spans)<0) - HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans"); + /* Free resources */ + if(a_not_b) + if(H5S_hyper_free_span_info(a_not_b) < 0) + HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans") + if(a_and_b) + if(H5S_hyper_free_span_info(a_and_b) < 0) + HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans") + if(b_not_a) + if(H5S_hyper_free_span_info(b_not_a) < 0) + HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans") + if(new_spans) + if(H5S_hyper_free_span_info(new_spans) < 0) + HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans") FUNC_LEAVE_NOAPI(ret_value); } /* end H5S_generate_hyperslab() */ @@ -6946,7 +6986,7 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], /* Copy the first dataspace */ if (NULL == (new_space = H5S_copy (space, TRUE, TRUE))) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space"); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space"); /* Go modify the selection in the new dataspace */ if (H5S_select_hyperslab(new_space, op, start, stride, count, block)<0) @@ -6954,7 +6994,7 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], /* Atomize */ if ((ret_value=H5I_register (H5I_DATASPACE, new_space, TRUE))<0) - HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom"); + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom"); done: if (ret_value<0 && new_space) @@ -7002,7 +7042,7 @@ H5S_combine_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2) /* Copy the first dataspace */ if (NULL == (new_space = H5S_copy (space1, TRUE, TRUE))) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space"); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space"); /* Free the current selection for the new dataspace */ if(H5S_SELECT_RELEASE(new_space)<0) @@ -7082,7 +7122,7 @@ H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id) /* Atomize */ if ((ret_value=H5I_register (H5I_DATASPACE, new_space, TRUE))<0) - HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom"); + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom"); done: if (ret_value<0 && new_space) @@ -7533,6 +7573,7 @@ partial_done: /* Yes, goto's are evil, so sue me... :-) */ /* Check if we are done */ if(io_bytes_left==0 || curr_seq>=maxseq) { + HDassert(curr_span); abs_arr[fast_dim]=curr_span->low+(span_size/elem_size); /* Check if we are still within the span */ diff --git a/src/H5Snone.c b/src/H5Snone.c index fdea677..c6e8a6a 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -586,7 +586,7 @@ H5S_none_bounds(const H5S_t UNUSED *space, hsize_t UNUSED *start, hsize_t UNUSED REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_none_offset(const H5S_t *space, hsize_t *offset) +H5S_none_offset(const H5S_t UNUSED *space, hsize_t UNUSED *offset) { FUNC_ENTER_NOAPI_NOFUNC(H5S_none_offset) diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 84b427e..5f4c74d 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -119,11 +119,11 @@ H5FL_DEFINE_STATIC(H5S_pnt_list_t); herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) { - FUNC_ENTER_NOAPI_NOFUNC(H5S_point_iter_init); + FUNC_ENTER_NOAPI_NOFUNC(H5S_point_iter_init) /* Check args */ - assert (space && H5S_SEL_POINTS==H5S_GET_SELECT_TYPE(space)); - assert (iter); + HDassert(space && H5S_SEL_POINTS==H5S_GET_SELECT_TYPE(space)); + HDassert(iter); /* Initialize the number of points to iterate over */ iter->elmt_left=space->select.num_elem; @@ -134,7 +134,7 @@ H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) /* Initialize type of selection iterator */ iter->type=H5S_sel_iter_point; - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_iter_init() */ @@ -156,16 +156,16 @@ H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) static herr_t H5S_point_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_coords); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_coords) /* Check args */ - assert (iter); - assert (coords); + HDassert(iter); + HDassert(coords); /* Copy the offset of the current point */ HDmemcpy(coords,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_iter_coords() */ @@ -187,18 +187,18 @@ H5S_point_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords) static herr_t H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_block); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_block) /* Check args */ - assert (iter); - assert (start); - assert (end); + HDassert(iter); + HDassert(start); + HDassert(end); /* Copy the current point as a block */ HDmemcpy(start,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); HDmemcpy(end,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_iter_block() */ @@ -219,12 +219,12 @@ H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) static hsize_t H5S_point_iter_nelmts (const H5S_sel_iter_t *iter) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_nelmts); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_nelmts) /* Check args */ - assert (iter); + HDassert(iter); - FUNC_LEAVE_NOAPI(iter->elmt_left); + FUNC_LEAVE_NOAPI(iter->elmt_left) } /* H5S_point_iter_nelmts() */ @@ -250,17 +250,17 @@ H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter) { htri_t ret_value=TRUE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_has_next_block); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_has_next_block) /* Check args */ - assert (iter); + HDassert(iter); /* Check if there is another point in the list */ if(iter->u.pnt.curr->next==NULL) HGOTO_DONE(FALSE); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_point_iter_has_next_block() */ @@ -285,11 +285,11 @@ done: static herr_t H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_next); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_next) /* Check args */ - assert (iter); - assert (nelem>0); + HDassert(iter); + HDassert(nelem>0); /* Increment the iterator */ while(nelem>0) { @@ -297,7 +297,7 @@ H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem) nelem--; } /* end while */ - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_iter_next() */ @@ -321,15 +321,15 @@ H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem) static herr_t H5S_point_iter_next_block(H5S_sel_iter_t *iter) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_next_block); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_next_block) /* Check args */ - assert (iter); + HDassert(iter); /* Increment the iterator */ iter->u.pnt.curr=iter->u.pnt.curr->next; - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_iter_next_block() */ @@ -353,12 +353,12 @@ H5S_point_iter_next_block(H5S_sel_iter_t *iter) static herr_t H5S_point_iter_release (H5S_sel_iter_t UNUSED * iter) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_release); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_release) /* Check args */ - assert (iter); + HDassert(iter); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_iter_release() */ @@ -471,10 +471,10 @@ H5S_point_release (H5S_t *space) { H5S_pnt_node_t *curr, *next; /* Point selection nodes */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_release); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_release) /* Check args */ - assert (space); + HDassert(space); /* Delete all the nodes from the list */ curr=space->select.sel_info.pnt_lst->head; @@ -492,7 +492,7 @@ H5S_point_release (H5S_t *space) /* Reset the number of elements in the selection */ space->select.num_elem=0; - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_release() */ @@ -584,42 +584,60 @@ done: static herr_t H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t UNUSED share_selection) { - H5S_pnt_node_t *curr, *new_node, *new_head; /* Point information nodes */ - herr_t ret_value=SUCCEED; /* return value */ + H5S_pnt_node_t *curr, *new_node, *new_tail; /* Point information nodes */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5S_point_copy); + FUNC_ENTER_NOAPI_NOINIT(H5S_point_copy) - assert(src); - assert(dst); + HDassert(src); + HDassert(dst); /* Allocate room for the head of the point list */ - if((dst->select.sel_info.pnt_lst=H5FL_MALLOC(H5S_pnt_list_t))==NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node"); + if(NULL == (dst->select.sel_info.pnt_lst = H5FL_MALLOC(H5S_pnt_list_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node") - curr=src->select.sel_info.pnt_lst->head; - new_head=NULL; - while(curr!=NULL) { - /* Create each point */ + curr = src->select.sel_info.pnt_lst->head; + new_tail = NULL; + while(curr) { + /* Create new point */ if(NULL == (new_node = H5FL_MALLOC(H5S_pnt_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node"); - if((new_node->pnt = (hsize_t *)H5MM_malloc(src->extent.rank*sizeof(hsize_t)))==NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); - HDmemcpy(new_node->pnt, curr->pnt, (src->extent.rank * sizeof(hsize_t))); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node") new_node->next = NULL; + if(NULL == (new_node->pnt = (hsize_t *)H5MM_malloc(src->extent.rank*sizeof(hsize_t)))) { + new_node = H5FL_FREE(H5S_pnt_node_t, new_node); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information") + } /* end if */ + + /* Copy over the point's coordinates */ + HDmemcpy(new_node->pnt, curr->pnt, (src->extent.rank * sizeof(hsize_t))); /* Keep the order the same when copying */ - if(new_head==NULL) - new_head=dst->select.sel_info.pnt_lst->head=new_node; + if(NULL == new_tail) + new_tail = dst->select.sel_info.pnt_lst->head = new_node; else { - new_head->next=new_node; - new_head=new_node; + new_tail->next = new_node; + new_tail = new_node; } /* end else */ - curr=curr->next; + curr = curr->next; } /* end while */ done: - FUNC_LEAVE_NOAPI(ret_value); + if(ret_value < 0) { + /* Traverse the (incomplete?) dst list, freeing all memory */ + curr = dst->select.sel_info.pnt_lst->head; + while(curr) { + H5S_pnt_node_t *tmp_node = curr; + + curr->pnt = H5MM_xfree(curr->pnt); + curr = curr->next; + tmp_node = H5FL_FREE(H5S_pnt_node_t, tmp_node); + } /* end while */ + + dst->select.sel_info.pnt_lst = H5FL_FREE(H5S_pnt_list_t, dst->select.sel_info.pnt_lst); + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_point_copy() */ @@ -650,9 +668,9 @@ H5S_point_is_valid (const H5S_t *space) unsigned u; /* Counter */ htri_t ret_value=TRUE; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_valid); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_valid) - assert(space); + HDassert(space); /* Check each point to determine whether selection+offset is within extent */ curr = space->select.sel_info.pnt_lst->head; @@ -670,7 +688,7 @@ H5S_point_is_valid (const H5S_t *space) } /* end while */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_point_is_valid() */ @@ -738,9 +756,9 @@ H5S_point_serial_size (const H5S_t *space) H5S_pnt_node_t *curr; /* Point information nodes */ hssize_t ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serial_size); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serial_size) - assert(space); + HDassert(space); /* Basic number of bytes required to serialize point selection: * + + + @@ -756,7 +774,7 @@ H5S_point_serial_size (const H5S_t *space) curr=curr->next; } /* end while */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_point_serial_size() */ @@ -787,9 +805,9 @@ H5S_point_serialize (const H5S_t *space, uint8_t *buf) uint32_t len=0; /* number of bytes used */ unsigned u; /* local counting variable */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serialize); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serialize) - assert(space); + HDassert(space); /* Store the preamble information */ UINT32ENCODE(buf, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ @@ -822,7 +840,7 @@ H5S_point_serialize (const H5S_t *space, uint8_t *buf) /* Encode length */ UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */ - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_serialize() */ @@ -1168,9 +1186,9 @@ H5S_point_is_contiguous(const H5S_t *space) { htri_t ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_contiguous); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_contiguous) - assert(space); + HDassert(space); /* One point is definitely contiguous */ if(space->select.num_elem==1) @@ -1178,7 +1196,7 @@ H5S_point_is_contiguous(const H5S_t *space) else /* More than one point might be contiguous, but it's complex to check and we don't need it right now */ ret_value=FALSE; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_point_is_contiguous() */ @@ -1205,9 +1223,9 @@ H5S_point_is_single(const H5S_t *space) { htri_t ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_single); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_single) - assert(space); + HDassert(space); /* One point is definitely 'single' :-) */ if(space->select.num_elem==1) @@ -1215,7 +1233,7 @@ H5S_point_is_single(const H5S_t *space) else ret_value=FALSE; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_point_is_single() */ @@ -1245,10 +1263,10 @@ H5S_point_is_regular(const H5S_t *space) { htri_t ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_regular); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_regular) /* Check args */ - assert(space); + HDassert(space); /* Only simple check for regular points for now... */ if(space->select.num_elem==1) @@ -1256,7 +1274,7 @@ H5S_point_is_regular(const H5S_t *space) else ret_value=FALSE; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_point_is_regular() */ @@ -1420,31 +1438,31 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, int i; /* Local index variable */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT(H5S_point_get_seq_list); + FUNC_ENTER_NOAPI_NOINIT(H5S_point_get_seq_list) /* Check args */ - assert(space); - assert(iter); - assert(maxseq>0); - assert(maxelem>0); - assert(nseq); - assert(nelem); - assert(off); - assert(len); + HDassert(space); + HDassert(iter); + HDassert(maxseq > 0); + HDassert(maxelem > 0); + HDassert(nseq); + HDassert(nelem); + HDassert(off); + HDassert(len); /* Choose the minimum number of bytes to sequence through */ - H5_CHECK_OVERFLOW(iter->elmt_left,hsize_t,size_t); - start_io_left=io_left=(size_t)MIN(iter->elmt_left,maxelem); + H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t); + start_io_left = io_left = (size_t)MIN(iter->elmt_left, maxelem); /* Get the dataspace dimensions */ - if ((ndims=H5S_get_simple_extent_dims (space, dims, NULL))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve data space dimensions"); + if((ndims = H5S_get_simple_extent_dims (space, dims, NULL)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve data space dimensions") /* Walk through the points in the selection, starting at the current */ /* location in the iterator */ - node=iter->u.pnt.curr; - curr_seq=0; - while(node!=NULL) { + node = iter->u.pnt.curr; + curr_seq = 0; + while(NULL != node) { /* Compute the offset of each selected point in the buffer */ for(i = ndims - 1, acc = iter->elmt_size, loc = 0; i >= 0; i--) { loc += (node->pnt[i] + space->select.offset[i]) * acc; @@ -1507,6 +1525,6 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, *nelem=start_io_left-io_left; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_point_get_seq_list() */ diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index fac5e1e..2858ddb 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -260,11 +260,9 @@ H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); H5_DLL herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter); #ifdef H5_HAVE_PARALLEL -#ifndef _H5S_IN_H5S_C /* Global vars whose value comes from environment variable */ /* (Defined in H5S.c) */ H5_DLLVAR hbool_t H5S_mpi_opt_types_g; -#endif /* _H5S_IN_H5S_C */ H5_DLL herr_t H5S_mpio_space_type( const H5S_t *space, size_t elmt_size, diff --git a/src/H5T.c b/src/H5T.c index de917f6..0a7eec4 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -2367,7 +2367,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, } /* end if */ H5T_close(old_path->src); H5T_close(old_path->dst); - H5FL_FREE(H5T_path_t,old_path); + old_path = H5FL_FREE(H5T_path_t, old_path); /* Release temporary atoms */ H5I_dec_ref(tmp_sid, FALSE); @@ -2380,17 +2380,17 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, } /* end else */ done: - if (ret_value<0) { - if (new_path) { - if (new_path->src) + if(ret_value < 0) { + if(new_path) { + if(new_path->src) H5T_close(new_path->src); - if (new_path->dst) + if(new_path->dst) H5T_close(new_path->dst); - H5FL_FREE(H5T_path_t,new_path); + new_path = H5FL_FREE(H5T_path_t, new_path); } /* end if */ - if (tmp_sid>=0) + if(tmp_sid >= 0) H5I_dec_ref(tmp_sid, FALSE); - if (tmp_did>=0) + if(tmp_did >= 0) H5I_dec_ref(tmp_did, FALSE); } /* end if */ @@ -2541,7 +2541,7 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, } H5T_close(path->src); H5T_close(path->dst); - H5FL_FREE(H5T_path_t,path); + path = H5FL_FREE(H5T_path_t, path); H5E_clear_stack(NULL); /*ignore all shutdown errors*/ } /* end else */ } /* end for */ @@ -2862,7 +2862,7 @@ H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc) FUNC_ENTER_NOAPI_NOINIT(H5T_encode) /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc((size_t)0))) + if(NULL == (f = H5F_fake_alloc((uint8_t)0))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") /* Find out the size of buffer needed */ @@ -2918,7 +2918,7 @@ H5T_decode(const unsigned char *buf) FUNC_ENTER_NOAPI_NOINIT(H5T_decode) /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc((size_t)0))) + if(NULL == (f = H5F_fake_alloc((uint8_t)0))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") /* Decode the type of the information */ @@ -2967,66 +2967,71 @@ done: H5T_t * H5T_create(H5T_class_t type, size_t size) { - H5T_t *dt = NULL; - hid_t subtype; - H5T_t *ret_value; + H5T_t *dt = NULL; + H5T_t *ret_value = NULL; - FUNC_ENTER_NOAPI(H5T_create, NULL); + FUNC_ENTER_NOAPI(H5T_create, NULL) - switch (type) { + switch(type) { case H5T_INTEGER: case H5T_FLOAT: case H5T_TIME: case H5T_STRING: case H5T_BITFIELD: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "type class is not appropriate - use H5Tcopy()"); + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "type class is not appropriate - use H5Tcopy()") case H5T_OPAQUE: case H5T_COMPOUND: if(NULL == (dt = H5T_alloc())) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") dt->shared->type = type; - if(type==H5T_COMPOUND) { + if(type == H5T_COMPOUND) { dt->shared->u.compnd.packed=FALSE; /* Start out unpacked */ dt->shared->u.compnd.memb_size=0; } /* end if */ - else if(type==H5T_OPAQUE) + else if(type == H5T_OPAQUE) /* Initialize the tag in case it's not set later. A null tag will * cause problems for later operations. */ dt->shared->u.opaque.tag = H5MM_strdup(""); break; case H5T_ENUM: - if (sizeof(char)==size) { - subtype = H5T_NATIVE_SCHAR_g; - } else if (sizeof(short)==size) { - subtype = H5T_NATIVE_SHORT_g; - } else if (sizeof(int)==size) { - subtype = H5T_NATIVE_INT_g; - } else if (sizeof(long)==size) { - subtype = H5T_NATIVE_LONG_g; - } else if (sizeof(long long)==size) { - subtype = H5T_NATIVE_LLONG_g; - } else { - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "no applicable native integer type"); + { + hid_t subtype; + H5T_t *sub_t_obj; + + if(sizeof(char) == size) + subtype = H5T_NATIVE_SCHAR_g; + else if(sizeof(short) == size) + subtype = H5T_NATIVE_SHORT_g; + else if(sizeof(int) == size) + subtype = H5T_NATIVE_INT_g; + else if(sizeof(long) == size) + subtype = H5T_NATIVE_LONG_g; + else if(sizeof(long long) == size) + subtype = H5T_NATIVE_LLONG_g; + else + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "no applicable native integer type") + if(NULL == (dt = H5T_alloc())) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + dt->shared->type = type; + if(NULL == (sub_t_obj = (H5T_t *)H5I_object(subtype))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, NULL, "unable to get datatype object") + if(NULL == (dt->shared->parent = H5T_copy(sub_t_obj, H5T_COPY_ALL))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to copy base datatype") } - if(NULL == (dt = H5T_alloc())) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - dt->shared->type = type; - if (NULL==(dt->shared->parent=H5T_copy(H5I_object(subtype), H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy base data type"); break; case H5T_VLEN: /* Variable length datatype */ - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tvlen_create()"); + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tvlen_create()") case H5T_ARRAY: /* Array datatype */ - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tarray_create2()"); + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tarray_create2()") default: - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, NULL, "unknown data type class"); - } + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, NULL, "unknown data type class") + } /* end switch */ dt->shared->size = size; @@ -3034,15 +3039,15 @@ H5T_create(H5T_class_t type, size_t size) ret_value = dt; done: - if(ret_value==NULL) { - if(dt && (dt->shared != NULL)) - H5FL_FREE(H5T_shared_t, dt->shared); - if(dt!=NULL) - H5FL_FREE(H5T_t,dt); + if(NULL == ret_value) { + if(dt) { + dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); + dt = H5FL_FREE(H5T_t, dt); + } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_create() */ /*------------------------------------------------------------------------- @@ -3324,10 +3329,11 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method) done: if(ret_value == NULL) { - if(new_dt->shared != NULL) - H5FL_FREE(H5T_shared_t, new_dt->shared); - if(new_dt != NULL) - H5FL_FREE(H5T_t, new_dt); + if(new_dt) { + if(new_dt->shared) + new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared); + new_dt = H5FL_FREE(H5T_t, new_dt); + } /* end if */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -3419,8 +3425,8 @@ done: if(ret_value == NULL) if(dt) { if(dt->shared) - H5FL_FREE(H5T_shared_t, dt->shared); - H5FL_FREE(H5T_t, dt); + dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); + dt = H5FL_FREE(H5T_t, dt); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -3556,7 +3562,7 @@ H5T_close(H5T_t *dt) if(H5T_free(dt) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype"); - H5FL_FREE(H5T_shared_t, dt->shared); + dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); } else { /* * If a named type is being closed then close the object header and @@ -3582,7 +3588,7 @@ H5T_close(H5T_t *dt) } /* end else */ /* Free the datatype struct */ - H5FL_FREE(H5T_t,dt); + dt = H5FL_FREE(H5T_t, dt); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4273,48 +4279,47 @@ done: */ H5T_path_t * H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, - H5T_conv_t func, hid_t dxpl_id, hbool_t is_api) + H5T_conv_t func, hid_t dxpl_id, hbool_t is_api) { int lt, rt; /*left and right edges */ int md; /*middle */ int cmp; /*comparison result */ int old_npaths; /* Previous number of paths in table */ - H5T_path_t *table=NULL; /*path existing in the table */ - H5T_path_t *path=NULL; /*new path */ - H5T_path_t *ret_value; /*return value */ - hid_t src_id=-1, dst_id=-1; /*src and dst type identifiers */ + H5T_path_t *table = NULL; /*path existing in the table */ + H5T_path_t *path = NULL; /*new path */ + hid_t src_id = -1, dst_id = -1; /*src and dst type identifiers */ int i; /*counter */ - int nprint=0; /*lines of output printed */ + int nprint = 0; /*lines of output printed */ + H5T_path_t *ret_value; /*return value */ FUNC_ENTER_NOAPI(H5T_path_find, NULL); - assert((!src && !dst) || (src && dst)); + /* Sanity check */ + HDassert(src); + HDassert(dst); /* * Make sure the first entry in the table is the no-op conversion path. */ - if (0==H5T_g.npaths) { - if (NULL==(H5T_g.path=H5MM_malloc(128*sizeof(H5T_path_t*)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for type conversion path table"); + if(0 == H5T_g.npaths) { + if(NULL == (H5T_g.path = H5MM_malloc(128 * sizeof(H5T_path_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for type conversion path table") H5T_g.apaths = 128; - if (NULL==(H5T_g.path[0]=H5FL_CALLOC(H5T_path_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for no-op conversion path"); + if(NULL == (H5T_g.path[0] = H5FL_CALLOC(H5T_path_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for no-op conversion path") HDstrcpy(H5T_g.path[0]->name, "no-op"); H5T_g.path[0]->func = H5T_conv_noop; H5T_g.path[0]->cdata.command = H5T_CONV_INIT; - if (H5T_conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), - (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id)<0) { + if(H5T_conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0) { #ifdef H5T_DEBUG - if (H5DEBUG(T)) { - fprintf(H5DEBUG(T), "H5T: unable to initialize no-op " - "conversion function (ignored)\n"); - } + if(H5DEBUG(T)) + fprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n"); #endif H5E_clear_stack(NULL); /*ignore the error*/ - } + } /* end if */ H5T_g.path[0]->is_noop = TRUE; H5T_g.npaths = 1; - } + } /* end if */ /* * Find the conversion path. If source and destination types are equal @@ -4325,35 +4330,36 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, * Only allow the no-op conversion to occur if no "force conversion" flags * are set */ - if (src->shared->force_conv==FALSE && dst->shared->force_conv==FALSE && 0==H5T_cmp(src, dst, TRUE)) { + if(src->shared->force_conv == FALSE && dst->shared->force_conv == FALSE && 0 == H5T_cmp(src, dst, TRUE)) { table = H5T_g.path[0]; cmp = 0; md = 0; - } else { + } /* end if */ + else { lt = md = 1; rt = H5T_g.npaths; cmp = -1; - while (cmp && ltsrc, FALSE); - if (0==cmp) cmp = H5T_cmp(dst, H5T_g.path[md]->dst, FALSE); - if (cmp<0) { + if(0 == cmp) + cmp = H5T_cmp(dst, H5T_g.path[md]->dst, FALSE); + if(cmp < 0) rt = md; - } else if (cmp>0) { - lt = md+1; - } else { + else if(cmp > 0) + lt = md + 1; + else table = H5T_g.path[md]; - } - } - } + } /* end while */ + } /* end else */ /* Keep a record of the number of paths in the table, in case one of the * initialization calls below (hard or soft) causes more entries to be * added to the table - QAK, 1/26/02 */ - old_npaths=H5T_g.npaths; + old_npaths = H5T_g.npaths; /* * If we didn't find the path, if the caller is an API function specifying @@ -4361,21 +4367,22 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, * specifying a new hard conversion and the path is a soft conversion, then * create a new path and add the new function to the path. */ - if (!table || (table && func && is_api) || (table && !table->is_hard && func && !is_api)) { - if (NULL==(path=H5FL_CALLOC(H5T_path_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for type conversion path"); - if (name && *name) { + if(!table || (table && func && is_api) || (table && !table->is_hard && func && !is_api)) { + if(NULL == (path = H5FL_CALLOC(H5T_path_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for type conversion path") + if(name && *name) { HDstrncpy(path->name, name, (size_t)H5T_NAMELEN); - path->name[H5T_NAMELEN-1] = '\0'; - } else { + path->name[H5T_NAMELEN - 1] = '\0'; + } /* end if */ + else HDstrcpy(path->name, "NONAME"); - } - if ((src && NULL==(path->src=H5T_copy(src, H5T_COPY_ALL))) || - (dst && NULL==(path->dst=H5T_copy(dst, H5T_COPY_ALL)))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy data type for conversion path"); - } else { + if(NULL == (path->src = H5T_copy(src, H5T_COPY_ALL))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy datatype for conversion path") + if(NULL == (path->dst = H5T_copy(dst, H5T_COPY_ALL))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy datatype for conversion path") + } /* end if */ + else path = table; - } /* * If a hard conversion function is specified and none is defined for the @@ -4383,25 +4390,24 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, * the existing path is a soft function, then add the new conversion to the path * and initialize its conversion data. */ - if (func && (!table || (table && is_api) || (table && !table->is_hard && !is_api))) { - assert(path!=table); - assert(NULL==path->func); - if (path->src && (src_id=H5I_register(H5I_DATATYPE, - H5T_copy(path->src, H5T_COPY_ALL), FALSE))<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register source conversion type for query"); - if (path->dst && (dst_id=H5I_register(H5I_DATATYPE, - H5T_copy(path->dst, H5T_COPY_ALL), FALSE))<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register destination conversion type for query"); + if(func && (!table || (table && is_api) || (table && !table->is_hard && !is_api))) { + HDassert(path != table); + HDassert(NULL == path->func); + if(path->src && (src_id = H5I_register(H5I_DATATYPE, H5T_copy(path->src, H5T_COPY_ALL), FALSE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register source conversion type for query") + if(path->dst && (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(path->dst, H5T_COPY_ALL), FALSE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register destination conversion type for query") path->cdata.command = H5T_CONV_INIT; - if ((func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, - NULL, NULL, dxpl_id)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to initialize conversion function"); - if (src_id>=0) H5I_dec_ref(src_id, FALSE); - if (dst_id>=0) H5I_dec_ref(dst_id, FALSE); + if((func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to initialize conversion function") + if(src_id >= 0) + H5I_dec_ref(src_id, FALSE); + if(dst_id >= 0) + H5I_dec_ref(dst_id, FALSE); src_id = dst_id = -1; path->func = func; path->is_hard = TRUE; - } + } /* end if */ /* * If the path doesn't have a function by now (because it's a new path @@ -4409,116 +4415,118 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, * for an applicable function and add it to the path. This can't happen * for the no-op conversion path. */ - assert(path->func || (src && dst)); - for (i=H5T_g.nsoft-1; i>=0 && !path->func; --i) { - if (src->shared->type!=H5T_g.soft[i].src || - dst->shared->type!=H5T_g.soft[i].dst) { + HDassert(path->func || (src && dst)); + for(i = H5T_g.nsoft - 1; i >= 0 && !path->func; --i) { + if(src->shared->type != H5T_g.soft[i].src || dst->shared->type != H5T_g.soft[i].dst) continue; - } - if ((src_id=H5I_register(H5I_DATATYPE, - H5T_copy(path->src, H5T_COPY_ALL), FALSE))<0 || - (dst_id=H5I_register(H5I_DATATYPE, - H5T_copy(path->dst, H5T_COPY_ALL), FALSE))<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register conversion types for query"); + if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(path->src, H5T_COPY_ALL), FALSE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register src conversion type for query") + if((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(path->dst, H5T_COPY_ALL), FALSE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register dst conversion type for query") path->cdata.command = H5T_CONV_INIT; - if ((H5T_g.soft[i].func) (src_id, dst_id, &(path->cdata), - (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id)<0) { - HDmemset (&(path->cdata), 0, sizeof(H5T_cdata_t)); + if((H5T_g.soft[i].func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0) { + HDmemset(&(path->cdata), 0, sizeof(H5T_cdata_t)); H5E_clear_stack(NULL); /*ignore the error*/ - } else { - HDstrcpy (path->name, H5T_g.soft[i].name); + } /* end if */ + else { + HDstrcpy(path->name, H5T_g.soft[i].name); path->func = H5T_g.soft[i].func; path->is_hard = FALSE; - } + } /* end else */ H5I_dec_ref(src_id, FALSE); H5I_dec_ref(dst_id, FALSE); src_id = dst_id = -1; - } - if (!path->func) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "no appropriate function for conversion path"); + } /* end for */ + if(!path->func) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "no appropriate function for conversion path") /* Check if paths were inserted into the table through a recursive call * and re-compute the correct location for this path if so. - QAK, 1/26/02 */ - if(old_npaths!=H5T_g.npaths) { + if(old_npaths != H5T_g.npaths) { lt = md = 1; rt = H5T_g.npaths; cmp = -1; - while (cmp && ltsrc, FALSE); - if (0==cmp) cmp = H5T_cmp(dst, H5T_g.path[md]->dst, FALSE); - if (cmp<0) { + if(0 == cmp) + cmp = H5T_cmp(dst, H5T_g.path[md]->dst, FALSE); + if(cmp < 0) rt = md; - } else if (cmp>0) { - lt = md+1; - } else { + else if(cmp > 0) + lt = md + 1; + else table = H5T_g.path[md]; - } - } + } /* end while */ } /* end if */ /* Replace an existing table entry or add a new entry */ - if (table && path!=table) { - assert(table==H5T_g.path[md]); + if(table && path != table) { + HDassert(table == H5T_g.path[md]); H5T_print_stats(table, &nprint/*in,out*/); table->cdata.command = H5T_CONV_FREE; - if ((table->func)(FAIL, FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, - NULL, NULL, dxpl_id)<0) { + if((table->func)(FAIL, FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0) { #ifdef H5T_DEBUG - if (H5DEBUG(T)) { + if(H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free " "failed for %s (ignored)\n", (unsigned long)(path->func), path->name); - } + } /* end if */ #endif H5E_clear_stack(NULL); /*ignore the failure*/ - } - if (table->src) H5T_close(table->src); - if (table->dst) H5T_close(table->dst); - H5FL_FREE(H5T_path_t,table); + } /* end if */ + if(table->src) + H5T_close(table->src); + if(table->dst) + H5T_close(table->dst); + table = H5FL_FREE(H5T_path_t, table); table = path; H5T_g.path[md] = path; - } else if (path!=table) { - assert(cmp); - if (H5T_g.npaths >= H5T_g.apaths) { + } else if(path != table) { + HDassert(cmp); + if(H5T_g.npaths >= H5T_g.apaths) { size_t na = MAX(128, 2 * H5T_g.apaths); - H5T_path_t **x = H5MM_realloc (H5T_g.path, - na*sizeof(H5T_path_t*)); - if (!x) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + H5T_path_t **x = H5MM_realloc (H5T_g.path, na * sizeof(H5T_path_t*)); + + if(!x) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") H5T_g.apaths = (int)na; H5T_g.path = x; - } - if (cmp>0) md++; - HDmemmove(H5T_g.path+md+1, H5T_g.path+md, - (H5T_g.npaths-md) * sizeof(H5T_path_t*)); + } /* end if */ + if(cmp > 0) + md++; + HDmemmove(H5T_g.path + md + 1, H5T_g.path + md, (H5T_g.npaths - md) * sizeof(H5T_path_t*)); H5T_g.npaths++; H5T_g.path[md] = path; table = path; - } + } /* end else-if */ /* Set the flag to indicate both source and destination types are compound types * for the optimization of data reading (in H5Dio.c). */ - if(H5T_COMPOUND==H5T_get_class(src, TRUE) && H5T_COMPOUND==H5T_get_class(dst, TRUE)) + if(H5T_COMPOUND == H5T_get_class(src, TRUE) && H5T_COMPOUND == H5T_get_class(dst, TRUE)) path->are_compounds = TRUE; /* Set return value */ ret_value = path; done: - if (!ret_value && path && path!=table) { - if (path->src) H5T_close(path->src); - if (path->dst) H5T_close(path->dst); - H5FL_FREE(H5T_path_t,path); - } - if (src_id>=0) H5I_dec_ref(src_id, FALSE); - if (dst_id>=0) H5I_dec_ref(dst_id, FALSE); + if(!ret_value && path && path != table) { + if(path->src) + H5T_close(path->src); + if(path->dst) + H5T_close(path->dst); + path = H5FL_FREE(H5T_path_t, path); + } /* end if */ + if(src_id >= 0) + H5I_dec_ref(src_id, FALSE); + if(dst_id >= 0) + H5I_dec_ref(dst_id, FALSE); FUNC_LEAVE_NOAPI(ret_value); -} +} /* end H5T_path_find() */ /*------------------------------------------------------------------------- diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index dea6bed..46a1ac8 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -770,12 +770,12 @@ done: if(ret_value == NULL) { if(dt) { if(shared_fo == NULL) /* Need to free shared fo */ - H5FL_FREE(H5T_shared_t, dt->shared); + dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); H5O_loc_free(&(dt->oloc)); H5G_name_free(&(dt->path)); - H5FL_FREE(H5T_t, dt); + dt = H5FL_FREE(H5T_t, dt); } /* end if */ if(shared_fo) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index ecf93e1..bfa5d56 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3185,13 +3185,13 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, done: /* If the conversion buffer doesn't need to be freed, reset its pointer */ if(write_to_file && noop_conv) - conv_buf=NULL; + conv_buf = NULL; /* Release the conversion buffer (always allocated, except on errors) */ - if(conv_buf!=NULL) - H5FL_BLK_FREE(vlen_seq,conv_buf); + if(conv_buf) + conv_buf = H5FL_BLK_FREE(vlen_seq, conv_buf); /* Release the background buffer, if we have one */ - if(tmp_buf!=NULL) - H5FL_BLK_FREE(vlen_seq,tmp_buf); + if(tmp_buf) + tmp_buf = H5FL_BLK_FREE(vlen_seq, tmp_buf); FUNC_LEAVE_NOAPI(ret_value) } @@ -3337,7 +3337,7 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, done: /* Release the background buffer, if we have one */ if(bkg_buf) - H5FL_BLK_FREE(array_seq, bkg_buf); + bkg_buf = H5FL_BLK_FREE(array_seq, bkg_buf); FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_conv_array() */ diff --git a/src/H5Tcset.c b/src/H5Tcset.c index c938cd2..4ec58ab 100644 --- a/src/H5Tcset.c +++ b/src/H5Tcset.c @@ -75,14 +75,14 @@ H5T_init_cset_interface(void) H5T_cset_t H5Tget_cset(hid_t type_id) { - H5T_t *dt = NULL; + H5T_t *dt; H5T_cset_t ret_value; FUNC_ENTER_API(H5Tget_cset, H5T_CSET_ERROR) H5TRACE1("Tc", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_CSET_ERROR, "not a data type") while (dt->shared->parent && !H5T_IS_STRING(dt->shared)) dt = dt->shared->parent; /*defer to parent*/ @@ -121,14 +121,14 @@ done: herr_t H5Tset_cset(hid_t type_id, H5T_cset_t cset) { - H5T_t *dt = NULL; + H5T_t *dt; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5Tset_cset, FAIL) H5TRACE2("e", "iTc", type_id, cset); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") if (H5T_STATE_TRANSIENT!=dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 0314a38..9d9ad36 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -136,7 +136,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Commit the datatype to the file, using default property list values */ diff --git a/src/H5Tnative.c b/src/H5Tnative.c index 75b5d03..8d8920b 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -38,6 +38,8 @@ static H5T_t *H5T_get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction size_t *struct_align, size_t *offset, size_t *comp_size); static H5T_t *H5T_get_native_float(size_t size, H5T_direction_t direction, size_t *struct_align, size_t *offset, size_t *comp_size); +static H5T_t* H5T_get_native_bitfield(size_t prec, H5T_direction_t direction, + size_t *struct_align, size_t *offset, size_t *comp_size); static herr_t H5T_cmp_offset(size_t *comp_size, size_t *offset, size_t elem_size, size_t nelems, size_t align, size_t *struct_align); @@ -108,7 +110,7 @@ H5Tget_native_type(hid_t type_id, H5T_direction_t direction) H5TRACE2("i", "iTd", type_id, direction); /* check argument */ - if(NULL==(dt=H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL==(dt=(H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") if(direction!=H5T_DIR_DEFAULT && direction!=H5T_DIR_ASCEND @@ -210,13 +212,19 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig } break; - /* These 2 types will be supported in the future. Simply return "not supported" + /* The time type will be supported in the future. Simply return "not supported" * message for now.*/ case H5T_TIME: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "time type is not supported yet") case H5T_BITFIELD: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "bit field type is not supported yet") + { + prec = dtype->shared->u.atomic.prec; + + if((ret_value = H5T_get_native_bitfield(prec, direction, struct_align, offset, comp_size))==NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve integer for bitfield type") + } + break; case H5T_OPAQUE: if((ret_value=H5T_copy(dtype, H5T_COPY_TRANSIENT))==NULL) @@ -237,7 +245,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type") /* Decide if the data type is object or dataset region reference. */ - if(NULL==(dt=H5I_object(H5T_STD_REF_OBJ_g))) + if(NULL==(dt=(H5T_t *)H5I_object(H5T_STD_REF_OBJ_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") not_equal = H5T_cmp(ret_value, dt, FALSE); @@ -556,46 +564,19 @@ H5T_get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, native_size = sizeof(long long); } } else if(direction == H5T_DIR_DESCEND) { - if(prec>=H5Tget_precision(H5T_NATIVE_LLONG)) { + if(prec>H5Tget_precision(H5T_NATIVE_LONG)) { match=H5T_NATIVE_INT_MATCH_LLONG; native_size = sizeof(long long); - } else if(prec>=H5Tget_precision(H5T_NATIVE_LONG)) { - if(prec==H5Tget_precision(H5T_NATIVE_LONG)) { - match=H5T_NATIVE_INT_MATCH_LONG; - native_size = sizeof(long); - } else { - match=H5T_NATIVE_INT_MATCH_LLONG; - native_size = sizeof(long long); - } - } - else if(prec>=H5Tget_precision(H5T_NATIVE_INT)) { - if(prec==H5Tget_precision(H5T_NATIVE_INT)) { - match=H5T_NATIVE_INT_MATCH_INT; - native_size = sizeof(int); - } else { - match=H5T_NATIVE_INT_MATCH_LONG; - native_size = sizeof(long); - } - } - else if(prec>=H5Tget_precision(H5T_NATIVE_SHORT)) { - if(prec==H5Tget_precision(H5T_NATIVE_SHORT)) { - match=H5T_NATIVE_INT_MATCH_SHORT; - native_size = sizeof(short); - } else { - match=H5T_NATIVE_INT_MATCH_INT; - native_size = sizeof(int); - } - } - else if(prec>=H5Tget_precision(H5T_NATIVE_SCHAR)) { - if(prec==H5Tget_precision(H5T_NATIVE_SCHAR)) { - match=H5T_NATIVE_INT_MATCH_CHAR; - native_size = sizeof(char); - } else { - match=H5T_NATIVE_INT_MATCH_SHORT; - native_size = sizeof(short); - } - } - else { /* If no native type matches the queried datatype, simply choose the type of smallest size. */ + } else if(prec>H5Tget_precision(H5T_NATIVE_INT)) { + match=H5T_NATIVE_INT_MATCH_LONG; + native_size = sizeof(long); + } else if(prec>H5Tget_precision(H5T_NATIVE_SHORT)) { + match=H5T_NATIVE_INT_MATCH_INT; + native_size = sizeof(int); + } else if(prec>H5Tget_precision(H5T_NATIVE_SCHAR)) { + match=H5T_NATIVE_INT_MATCH_SHORT; + native_size = sizeof(short); + } else { match=H5T_NATIVE_INT_MATCH_CHAR; native_size = sizeof(char); } @@ -654,7 +635,7 @@ H5T_get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, /* Create new native type */ assert(tid>=0); - if(NULL==(dt=H5I_object(tid))) + if(NULL==(dt=(H5T_t *)H5I_object(tid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") if((ret_value=H5T_copy(dt, H5T_COPY_TRANSIENT))==NULL) @@ -733,46 +714,23 @@ H5T_get_native_float(size_t size, H5T_direction_t direction, size_t *struct_alig } } else { #if H5_SIZEOF_LONG_DOUBLE !=0 - if(size>=sizeof(long double)) { + if(size>sizeof(double)) { match=H5T_NATIVE_FLOAT_MATCH_LDOUBLE; native_size = sizeof(long double); } - else if(size>=sizeof(double)) { - if(size==sizeof(double)) { - match=H5T_NATIVE_FLOAT_MATCH_DOUBLE; - native_size = sizeof(double); - } else { - match=H5T_NATIVE_FLOAT_MATCH_LDOUBLE; - native_size = sizeof(long double); - } - } - else if(size>=sizeof(float)) { - if(size==sizeof(float)) { - match=H5T_NATIVE_FLOAT_MATCH_FLOAT; - native_size = sizeof(float); - } else { - match=H5T_NATIVE_FLOAT_MATCH_DOUBLE; - native_size = sizeof(double); - } + else if(size>sizeof(float)) { + match=H5T_NATIVE_FLOAT_MATCH_DOUBLE; + native_size = sizeof(double); } else { match=H5T_NATIVE_FLOAT_MATCH_FLOAT; native_size = sizeof(float); } #else - if(size>=sizeof(double)) { + if(size>sizeof(float)) { match=H5T_NATIVE_FLOAT_MATCH_DOUBLE; native_size = sizeof(double); } - else if(size>=sizeof(float)) { - if(size==sizeof(float)) { - match=H5T_NATIVE_FLOAT_MATCH_FLOAT; - native_size = sizeof(float); - } else { - match=H5T_NATIVE_FLOAT_MATCH_DOUBLE; - native_size = sizeof(double); - } - } else { match=H5T_NATIVE_FLOAT_MATCH_FLOAT; native_size = sizeof(float); @@ -805,7 +763,7 @@ H5T_get_native_float(size_t size, H5T_direction_t direction, size_t *struct_alig /* Create new native type */ assert(tid>=0); - if(NULL==(dt=H5I_object(tid))) + if(NULL==(dt=(H5T_t *)H5I_object(tid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") if((ret_value=H5T_copy(dt, H5T_COPY_TRANSIENT))==NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type") @@ -820,6 +778,94 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_get_native_bitfield + * + * Purpose: Returns the native bitfield type of a datatype. Bitfield + * is similar to unsigned integer. + * + * Return: Success: Returns the native data type if successful. + * + * Failure: negative + * + * Programmer: Raymond Lu + * 1 December 2009 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static H5T_t* +H5T_get_native_bitfield(size_t prec, H5T_direction_t direction, size_t *struct_align, + size_t *offset, size_t *comp_size) +{ + H5T_t *dt; /* Appropriate native datatype to copy */ + hid_t tid=(-1); /* Datatype ID of appropriate native datatype */ + size_t align=0; /* Alignment necessary for native datatype */ + size_t native_size=0; /* Datatype size of the native type */ + H5T_t *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_get_native_bitfield, NULL); + + if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { + if(prec<=H5Tget_precision(H5T_NATIVE_B8)) { + tid = H5T_NATIVE_B8; + native_size = 1; + align = H5T_NATIVE_UINT8_ALIGN_g; + } else if(prec<=H5Tget_precision(H5T_NATIVE_B16)) { + tid = H5T_NATIVE_B16; + native_size = 2; + align = H5T_NATIVE_UINT16_ALIGN_g; + } else if(prec<=H5Tget_precision(H5T_NATIVE_B32)) { + tid = H5T_NATIVE_B32; + native_size = 4; + align = H5T_NATIVE_UINT32_ALIGN_g; + } else if(prec<=H5Tget_precision(H5T_NATIVE_B64)) { + tid = H5T_NATIVE_B64; + native_size = 8; + align = H5T_NATIVE_UINT64_ALIGN_g; + } else { /* If no native type matches the querried datatype, simply choose the type of biggest size. */ + tid = H5T_NATIVE_B64; + native_size = 8; + align = H5T_NATIVE_UINT64_ALIGN_g; + } + } else if(direction == H5T_DIR_DESCEND) { + if(prec>H5Tget_precision(H5T_NATIVE_B32)) { + tid = H5T_NATIVE_B64; + native_size = 8; + align = H5T_NATIVE_UINT64_ALIGN_g; + } else if(prec>H5Tget_precision(H5T_NATIVE_B16)) { + tid = H5T_NATIVE_B32; + native_size = 4; + align = H5T_NATIVE_UINT32_ALIGN_g; + } else if(prec>H5Tget_precision(H5T_NATIVE_B8)) { + tid = H5T_NATIVE_B16; + native_size = 2; + align = H5T_NATIVE_UINT16_ALIGN_g; + } else { + tid = H5T_NATIVE_B8; + native_size = 1; + align = H5T_NATIVE_UINT8_ALIGN_g; + } + } + + /* Create new native type */ + assert(tid>=0); + if(NULL==(dt=(H5T_t *)H5I_object(tid))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") + + if((ret_value=H5T_copy(dt, H5T_COPY_TRANSIENT))==NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot copy type") + + /* compute size and offset of compound type member. */ + if(H5T_cmp_offset(comp_size, offset, native_size, (size_t)1, align, struct_align)<0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} + + +/*------------------------------------------------------------------------- * Function: H5T_cmp_offset * * Purpose: This function is only for convenience. It computes the diff --git a/src/H5Toffset.c b/src/H5Toffset.c index 5495368..17351f4 100644 --- a/src/H5Toffset.c +++ b/src/H5Toffset.c @@ -94,7 +94,7 @@ H5Tget_offset(hid_t type_id) H5TRACE1("Is", "i", type_id); /* Check args */ - if(NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type") /* Get offset */ @@ -198,14 +198,14 @@ done: herr_t H5Tset_offset(hid_t type_id, size_t offset) { - H5T_t *dt = NULL; + H5T_t *dt; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5Tset_offset, FAIL) H5TRACE2("e", "iz", type_id, offset); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type") if (H5T_STATE_TRANSIENT!=dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") diff --git a/src/H5Znbit.c b/src/H5Znbit.c index 6f090c3..8f785a2 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -138,7 +138,7 @@ H5Z_can_apply_nbit(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id) FUNC_ENTER_NOAPI(H5Z_can_apply_nbit, FAIL) /* Get datatype */ - if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Get datatype's class, for checking the "datatype class" */ @@ -742,7 +742,7 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) FUNC_ENTER_NOAPI(H5Z_set_local_nbit, FAIL) /* Get datatype */ - if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Get datatype's class */ @@ -781,7 +781,7 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "datatype needs too many nbit parameters") /* Allocate memory space for cd_values[] */ - if(NULL == (cd_values = H5MM_malloc(cd_values_actual_nparms * sizeof(unsigned)))) + if(NULL == (cd_values = (unsigned *)H5MM_malloc(cd_values_actual_nparms * sizeof(unsigned)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for cd_values[]") /* Get the plist structure */ @@ -862,81 +862,70 @@ done: * Programmer: Xiaowen Wu * Friday, January 21, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf) { - size_t ret_value = 0; /* return value */ - size_t size_out = 0; /* size of output buffer */ - unsigned d_nelmts = 0; /* number of elements in the chunk */ - unsigned char *outbuf = NULL; /* pointer to new output buffer */ + unsigned char *outbuf; /* pointer to new output buffer */ + size_t size_out = 0; /* size of output buffer */ + unsigned d_nelmts = 0; /* number of elements in the chunk */ + size_t ret_value = 0; /* return value */ FUNC_ENTER_NOAPI(H5Z_filter_nbit, 0) /* check arguments * cd_values[0] stores actual number of parameters in cd_values[] */ - if (cd_nelmts!=cd_values[0]) + if(cd_nelmts != cd_values[0]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid nbit aggression level") /* check if need to do nbit compress or decompress * cd_values[1] stores the flag if true indicating no need to compress */ - if (cd_values[1]) { - ret_value = *buf_size; - goto done; - } + if(cd_values[1]) + HGOTO_DONE(*buf_size) /* copy a filter parameter to d_nelmts */ d_nelmts = cd_values[2]; /* input; decompress */ - if (flags & H5Z_FLAG_REVERSE) { + if(flags & H5Z_FLAG_REVERSE) { size_out = d_nelmts * cd_values[4]; /* cd_values[4] stores datatype size */ /* allocate memory space for decompressed buffer */ - if(NULL==(outbuf = H5MM_malloc(size_out))) + if(NULL == (outbuf = (unsigned char *)H5MM_malloc(size_out))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for nbit decompression") /* decompress the buffer */ - H5Z_nbit_decompress(outbuf, d_nelmts, *buf, cd_values); - - *buf_size = size_out; - ret_value = size_out; - } + H5Z_nbit_decompress(outbuf, d_nelmts, (unsigned char *)*buf, cd_values); + } /* end if */ /* output; compress */ else { - assert(nbytes == d_nelmts * cd_values[4]); + HDassert(nbytes == d_nelmts * cd_values[4]); size_out = nbytes; /* allocate memory space for compressed buffer */ - if(NULL==(outbuf = H5MM_malloc(size_out))) + if(NULL == (outbuf = (unsigned char *)H5MM_malloc(size_out))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for nbit compression") /* compress the buffer, size_out will be changed */ - H5Z_nbit_compress(*buf, d_nelmts, outbuf, &size_out, cd_values); - - *buf_size = nbytes; - ret_value = size_out; - } + H5Z_nbit_compress((unsigned char *)*buf, d_nelmts, outbuf, &size_out, cd_values); + } /* end else */ /* free the input buffer */ H5MM_xfree(*buf); /* set return values */ *buf = outbuf; - outbuf = NULL; + *buf_size = size_out; + ret_value = size_out; done: - if(outbuf) - H5MM_xfree(outbuf); FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5Z_filter_nbit() */ /* ======== Nbit Algorithm =============================================== * assume one byte has 8 bit @@ -946,14 +935,17 @@ done: * atomic datatype is treated on byte basis */ -static void H5Z_nbit_next_byte(size_t *j, int *buf_len) +static void +H5Z_nbit_next_byte(size_t *j, int *buf_len) { ++(*j); *buf_len = 8 * sizeof(unsigned char); } -static void H5Z_nbit_decompress_one_byte(unsigned char *data, size_t data_offset, int k, int begin_i, -int end_i, unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p, int datatype_len) +static void +H5Z_nbit_decompress_one_byte(unsigned char *data, size_t data_offset, int k, + int begin_i, int end_i, unsigned char *buffer, size_t *j, int *buf_len, + parms_atomic p, int datatype_len) { int dat_len; /* dat_len is the number of bits to be copied in each data byte */ int uchar_offset; @@ -995,7 +987,8 @@ int end_i, unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p, int d } } -static void H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, +static void +H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, int *buf_len, unsigned size) { unsigned i; /* index */ @@ -1018,7 +1011,8 @@ static void H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_of } } -static void H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, +static void +H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p) { /* begin_i: the index of byte having first significant bit @@ -1054,7 +1048,8 @@ static void H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offs } } -static void H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offset, +static void +H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, int *buf_len, const unsigned parms[]) { unsigned i, total_size, base_class, base_size, n, begin_index; @@ -1101,7 +1096,8 @@ static void H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offse } /* end switch */ } -static void H5Z_nbit_decompress_one_compound(unsigned char *data, size_t data_offset, +static void +H5Z_nbit_decompress_one_compound(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, int *buf_len, const unsigned parms[]) { unsigned i, nmembers, member_offset, member_class, size; @@ -1139,7 +1135,8 @@ static void H5Z_nbit_decompress_one_compound(unsigned char *data, size_t data_of } } -static void H5Z_nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, +static void +H5Z_nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, const unsigned parms[]) { /* i: index of data, j: index of buffer, @@ -1410,7 +1407,5 @@ static void H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned c } break; } /* end switch */ - - *buffer_size = j + 1; /* sometimes is catually j, but to be safe */ } #endif /* H5_HAVE_FILTER_NBIT */ diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 1a6988f..762b316 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -62,7 +62,7 @@ typedef struct H5Z_node { struct H5Z_data_xform_t { char* xform_exp; - struct H5Z_node* parse_root; + H5Z_node* parse_root; H5Z_datval_ptrs* dat_val_pointers; }; @@ -354,7 +354,7 @@ H5Z_unget_token(H5Z_token *current) static H5Z_token * H5Z_get_token(H5Z_token *current) { - void *ret_value = current; + H5Z_token *ret_value = current; FUNC_ENTER_NOAPI(H5Z_get_token, NULL) @@ -464,7 +464,7 @@ H5Z_get_token(H5Z_token *current) current->tok_type = H5Z_XFORM_END; /* Set return value */ - ret_value = (void *)current; + ret_value = current; done: FUNC_LEAVE_NOAPI(ret_value) @@ -732,7 +732,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) { H5Z_node *factor=NULL; H5Z_node *new_node; - void* ret_value; + H5Z_node *ret_value; FUNC_ENTER_NOAPI(H5Z_parse_factor, NULL); @@ -871,17 +871,17 @@ done: static H5Z_node * H5Z_new_node(H5Z_token_type type) { - H5Z_node* ret_value = NULL; + H5Z_node *ret_value; - FUNC_ENTER_NOAPI(H5Z_new_node, NULL); + FUNC_ENTER_NOAPI(H5Z_new_node, NULL) - ret_value = H5MM_calloc(sizeof(H5Z_node)); - if(ret_value == NULL) + if(NULL == (ret_value = (H5Z_node *)H5MM_calloc(sizeof(H5Z_node)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to allocate space for nodes in the parse tree") ret_value->type = type; + done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -1108,66 +1108,52 @@ H5Z_xform_find_type(const H5T_t* type) HDassert(type); /* Check for SHORT type */ - if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_SHORT,H5I_DATATYPE), FALSE)) == 0) + if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_SHORT, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_SHORT) - - /* Check for INT type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_INT,H5I_DATATYPE), FALSE)) == 0) + /* Check for INT type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_INT, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_INT) - - /* Check for LONG type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_LONG,H5I_DATATYPE), FALSE)) == 0) + /* Check for LONG type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_LONG, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_LONG) - - /* Check for LONGLONG type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_LLONG,H5I_DATATYPE), FALSE)) == 0) + /* Check for LONGLONG type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_LLONG, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_LLONG) - - /* Check for UCHAR type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_UCHAR,H5I_DATATYPE), FALSE)) == 0) + /* Check for UCHAR type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_UCHAR, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_UCHAR) - - /* Check for CHAR type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_CHAR,H5I_DATATYPE), FALSE)) == 0) + /* Check for CHAR type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_CHAR, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_CHAR) - - /* Check for SCHAR type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_SCHAR,H5I_DATATYPE), FALSE)) == 0) + /* Check for SCHAR type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_SCHAR, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_SCHAR) - - /* Check for USHORT type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_USHORT,H5I_DATATYPE), FALSE)) == 0) + /* Check for USHORT type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_USHORT, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_USHORT) - - /* Check for UINT type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_UINT,H5I_DATATYPE), FALSE)) == 0) + /* Check for UINT type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_UINT, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_UINT) - - /* Check for ULONG type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_ULONG,H5I_DATATYPE), FALSE)) == 0) + /* Check for ULONG type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_ULONG, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_ULONG) - - /* Check for ULONGLONG type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_ULLONG,H5I_DATATYPE), FALSE)) == 0) + /* Check for ULONGLONG type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_ULLONG, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_ULLONG) - - /* Check for FLOAT type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_FLOAT,H5I_DATATYPE), FALSE)) == 0) + /* Check for FLOAT type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_FLOAT, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_FLOAT) - - /* Check for DOUBLE type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_DOUBLE,H5I_DATATYPE), FALSE)) == 0) + /* Check for DOUBLE type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_DOUBLE, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_DOUBLE) - #if H5_SIZEOF_LONG_DOUBLE !=0 - /* Check for LONGDOUBLE type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_LDOUBLE,H5I_DATATYPE), FALSE)) == 0) + /* Check for LONGDOUBLE type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_LDOUBLE, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_LDOUBLE) #endif else HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not find matching type") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_xform_find_type() */ @@ -1356,22 +1342,20 @@ H5Z_xform_create(const char *expr) assert(expr); /* Allocate space for the data transform information */ - if((data_xform_prop = H5MM_calloc(sizeof(H5Z_data_xform_t)))==NULL) + if(NULL == (data_xform_prop = (H5Z_data_xform_t *)H5MM_calloc(sizeof(H5Z_data_xform_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for data transform info") - if((data_xform_prop->dat_val_pointers = H5MM_malloc(sizeof(H5Z_datval_ptrs))) == NULL) + if(NULL == (data_xform_prop->dat_val_pointers = (H5Z_datval_ptrs *)H5MM_malloc(sizeof(H5Z_datval_ptrs)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for data transform array storage") /* copy the user's string into the property */ - if((data_xform_prop->xform_exp = H5MM_xstrdup(expr))==NULL) + if(NULL == (data_xform_prop->xform_exp = (char *)H5MM_xstrdup(expr))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for data transform expression") /* Find the number of times "x" is used in this equation, and allocate room for storing that many points */ - for(i=0; idat_val_pointers->num_ptrs = 0; /* we generate the parse tree right here and store a poitner to its root in the property. */ - if((data_xform_prop->parse_root = H5Z_xform_parse(expr, data_xform_prop->dat_val_pointers))==NULL) + if((data_xform_prop->parse_root = (H5Z_node *)H5Z_xform_parse(expr, data_xform_prop->dat_val_pointers))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to generate parse tree from expression") /* Sanity check @@ -1496,22 +1480,20 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop) if(*data_xform_prop) { /* Allocate new node */ - if((new_data_xform_prop = H5MM_calloc(sizeof(H5Z_data_xform_t)))==NULL) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform info") + if(NULL == (new_data_xform_prop = (H5Z_data_xform_t *)H5MM_calloc(sizeof(H5Z_data_xform_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform info") /* Copy string */ - if((new_data_xform_prop->xform_exp = H5MM_xstrdup((*data_xform_prop)->xform_exp))==NULL) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform expression") + if(NULL == (new_data_xform_prop->xform_exp = (char *)H5MM_xstrdup((*data_xform_prop)->xform_exp))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform expression") - if((new_data_xform_prop->dat_val_pointers = H5MM_malloc(sizeof(H5Z_datval_ptrs))) == NULL) + if(NULL == (new_data_xform_prop->dat_val_pointers = (H5Z_datval_ptrs *)H5MM_malloc(sizeof(H5Z_datval_ptrs)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform array storage") /* Find the number of times "x" is used in this equation, and allocate room for storing that many points */ - for(i=0; ixform_exp); i++) - { - if(isalpha(new_data_xform_prop->xform_exp[i])) + for(i = 0; i < HDstrlen(new_data_xform_prop->xform_exp); i++) + if(HDisalpha(new_data_xform_prop->xform_exp[i])) count++; - } if(count > 0) if((new_data_xform_prop->dat_val_pointers->ptr_dat_val = (void**) H5MM_calloc(count * sizeof(void**))) == NULL) @@ -1520,7 +1502,6 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop) /* Zero out num_pointers prior to H5Z_xform_cop_tree call; that call will increment it to the right amount */ new_data_xform_prop->dat_val_pointers->num_ptrs = 0; - /* Copy parse tree */ if((new_data_xform_prop->parse_root = (H5Z_node*)H5Z_xform_copy_tree((*data_xform_prop)->parse_root, (*data_xform_prop)->dat_val_pointers, new_data_xform_prop->dat_val_pointers)) == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "error copying the parse tree") diff --git a/src/H5detect.c b/src/H5detect.c index f76f159..ebd042d 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -821,8 +821,7 @@ H5TN_init_interface(void)\n\ done:\n\ if(ret_value < 0) {\n\ if(dt != NULL) {\n\ - if(dt->shared != NULL)\n\ - H5FL_FREE(H5T_shared_t, dt->shared);\n\ + H5FL_FREE(H5T_shared_t, dt->shared);\n\ dt = H5FL_FREE(H5T_t, dt);\n\ } /* end if */\n\ } /* end if */\n\ diff --git a/src/H5private.h b/src/H5private.h index 8f56db0..c0b5054 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1935,14 +1935,6 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * * Programmer: Quincey Koziol * - * Modifications: - * - * Robb Matzke, 4 Aug 1997 - * The pablo mask comes from the constant PABLO_MASK defined on a - * per-file basis. The pablo_func_id comes from an auto variable - * defined by FUNC_ENTER. - * PABLO was deleted on January 21, 2005 EIP - * *------------------------------------------------------------------------- */ /* Threadsafety termination code for API routines */ @@ -1961,6 +1953,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); } /*end scope from end of FUNC_ENTER*/ \ }} /*end scope from beginning of FUNC_ENTER*/ +/* Use this macro to match the FUNC_ENTER_API_NOFS macro */ #define FUNC_LEAVE_API_NOFS(ret_value) \ FINISH_MPE_LOG; \ H5TRACE_RETURN(ret_value); \ diff --git a/src/H5public.h b/src/H5public.h index 3244800..5c1aff8 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 54 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 59 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "FA_a4" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.54-FA_a4" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.59-FA_a4" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/Makefile.am b/src/Makefile.am index 307ce51..5c5a7aa 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -71,7 +71,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \ H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \ H5HG.c H5HGcache.c H5HGdbg.c \ - H5HL.c H5HLcache.c H5HLdbg.c \ + H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c \ H5HP.c H5I.c H5L.c H5Lexternal.c \ H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ H5MM.c H5MP.c H5MPtest.c \ diff --git a/src/Makefile.in b/src/Makefile.in index 4aee8ee..dcabcfe 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -123,14 +123,14 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \ H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFiter.lo \ H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \ H5HFtiny.lo H5HG.lo H5HGcache.lo H5HGdbg.lo H5HL.lo \ - H5HLcache.lo H5HLdbg.lo H5HP.lo H5I.lo H5L.lo H5Lexternal.lo \ - H5MF.lo H5MFaggr.lo H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo \ - H5MPtest.lo H5O.lo H5Oainfo.lo H5Oalloc.lo H5Oattr.lo \ - H5Oattribute.lo H5Obogus.lo H5Obtreek.lo H5Ocache.lo \ - H5Ocont.lo H5Ocopy.lo H5Odbg.lo H5Odrvinfo.lo H5Odtype.lo \ - H5Oefl.lo H5Ofill.lo H5Ofsinfo.lo H5Oginfo.lo H5Olayout.lo \ - H5Olinfo.lo H5Olink.lo H5Omessage.lo H5Omtime.lo H5Oname.lo \ - H5Onull.lo H5Opline.lo H5Orefcount.lo H5Osdspace.lo \ + H5HLcache.lo H5HLdbg.lo H5HLint.lo H5HP.lo H5I.lo H5L.lo \ + H5Lexternal.lo H5MF.lo H5MFaggr.lo H5MFdbg.lo H5MFsection.lo \ + H5MM.lo H5MP.lo H5MPtest.lo H5O.lo H5Oainfo.lo H5Oalloc.lo \ + H5Oattr.lo H5Oattribute.lo H5Obogus.lo H5Obtreek.lo \ + H5Ocache.lo H5Ocont.lo H5Ocopy.lo H5Odbg.lo H5Odrvinfo.lo \ + H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Ofsinfo.lo H5Oginfo.lo \ + H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo H5Omtime.lo \ + H5Oname.lo H5Onull.lo H5Opline.lo H5Orefcount.lo H5Osdspace.lo \ H5Oshared.lo H5Oshmesg.lo H5Ostab.lo H5Ostorage.lo H5Otest.lo \ H5Ounknown.lo H5P.lo H5Pacpl.lo H5Pdapl.lo H5Pdcpl.lo \ H5Pdeprec.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo \ @@ -402,12 +402,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -441,7 +441,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 = 44 +LT_VERS_REVISION = 49 LT_VERS_AGE = 0 H5detect_CFLAGS = -g $(AM_CFLAGS) @@ -487,7 +487,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \ H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \ H5HG.c H5HGcache.c H5HGdbg.c \ - H5HL.c H5HLcache.c H5HLdbg.c \ + H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c \ H5HP.c H5I.c H5L.c H5Lexternal.c \ H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ H5MM.c H5MP.c H5MPtest.c \ @@ -799,6 +799,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HL.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HLcache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HLdbg.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HLint.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HP.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5I.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5L.Plo@am__quote@ @@ -1383,7 +1384,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -1454,7 +1455,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/test/Makefile.am b/test/Makefile.am index 2d5d0b7..accd774 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -92,7 +92,7 @@ timings _timings: testmeta @for timing in $(TIMINGS) dummy; do \ if test $$timing != dummy; then \ echo "Running $$timing $(TEST_FLAGS)"; \ - $(RUNTEST) ./$$timing $(TEST_FLAGS) || exit 1; \ + $(RUNEXEC) ./$$timing $(TEST_FLAGS) || exit 1; \ fi; \ done; diff --git a/test/Makefile.in b/test/Makefile.in index c95c3c2..609c79d 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -647,12 +647,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -1455,7 +1455,7 @@ timings _timings: testmeta @for timing in $(TIMINGS) dummy; do \ if test $$timing != dummy; then \ echo "Running $$timing $(TEST_FLAGS)"; \ - $(RUNTEST) ./$$timing $(TEST_FLAGS) || exit 1; \ + $(RUNEXEC) ./$$timing $(TEST_FLAGS) || exit 1; \ fi; \ done; @@ -1562,7 +1562,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -1633,7 +1633,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/test/cache.c b/test/cache.c index b9525ea..74900ec 100644 --- a/test/cache.c +++ b/test/cache.c @@ -19,6 +19,7 @@ * This file contains tests for the cache implemented in * H5C.c */ +#include "H5private.h" /* Put this first, so H5open() isn't invoked in public macros */ #include "h5test.h" #include "H5Iprivate.h" #include "H5ACprivate.h" @@ -40,20 +41,20 @@ static unsigned smoke_check_10(void); static unsigned write_permitted_check(void); static unsigned check_insert_entry(void); static unsigned check_flush_cache(void); -static void check_flush_cache__empty_cache(H5C_t * cache_ptr); -static void check_flush_cache__multi_entry(H5C_t * cache_ptr); -static void check_flush_cache__multi_entry_test(H5C_t * cache_ptr, +static void check_flush_cache__empty_cache(H5F_t * file_ptr); +static void check_flush_cache__multi_entry(H5F_t * file_ptr); +static void check_flush_cache__multi_entry_test(H5F_t * file_ptr, int test_num, unsigned int flush_flags, int spec_size, struct flush_cache_test_spec spec[]); -static void check_flush_cache__pe_multi_entry_test(H5C_t * cache_ptr, +static void check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, int test_num, unsigned int flush_flags, int spec_size, struct pe_flush_cache_test_spec spec[]); -static void check_flush_cache__single_entry(H5C_t * cache_ptr); -static void check_flush_cache__single_entry_test(H5C_t * cache_ptr, +static void check_flush_cache__single_entry(H5F_t * file_ptr); +static void check_flush_cache__single_entry_test(H5F_t * file_ptr, int test_num, int entry_type, int entry_idx, @@ -65,7 +66,7 @@ static void check_flush_cache__single_entry_test(H5C_t * cache_ptr, hbool_t expected_cleared, hbool_t expected_flushed, hbool_t expected_destroyed); -static void check_flush_cache__pinned_single_entry_test(H5C_t * cache_ptr, +static void check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, int test_num, int entry_type, int entry_idx, @@ -79,8 +80,8 @@ static void check_flush_cache__pinned_single_entry_test(H5C_t * cache_ptr, hbool_t expected_cleared, hbool_t expected_flushed, hbool_t expected_destroyed); -static void check_flush_cache__flush_ops(H5C_t * cache_ptr); -static void check_flush_cache__flush_op_test(H5C_t * cache_ptr, +static void check_flush_cache__flush_ops(H5F_t * file_ptr); +static void check_flush_cache__flush_op_test(H5F_t * file_ptr, int test_num, unsigned int flush_flags, int spec_size, @@ -91,13 +92,13 @@ static void check_flush_cache__flush_op_test(H5C_t * cache_ptr, size_t expected_index_size, int check_size, struct fo_flush_entry_check check[]); -static void check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr); +static void check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr); static unsigned check_flush_protected_err(void); static unsigned check_get_entry_status(void); static unsigned check_expunge_entry(void); static unsigned check_multiple_read_protect(void); static unsigned check_rename_entry(void); -static void check_rename_entry__run_test(H5C_t * cache_ptr, int test_num, +static void check_rename_entry__run_test(H5F_t * file_ptr, int test_num, struct rename_entry_test_spec * spec_ptr); static unsigned check_pin_protected_entry(void); static unsigned check_resize_entry(void); @@ -167,7 +168,7 @@ smoke_check_1(void) hbool_t display_stats = FALSE; int32_t lag = 10; int mile_stone = 1; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; TESTING("smoke check #1 -- all clean, ins, dest, ren, 4/2 MB cache"); @@ -189,14 +190,14 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - cache_ptr = setup_cache((size_t)(4 * 1024 * 1024), + file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024)); if ( show_progress ) /* 3 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* cache_ptr */ cache_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -215,7 +216,7 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_backward(/* cache_ptr */ cache_ptr, + row_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -234,7 +235,7 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* cache_ptr */ cache_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -255,7 +256,7 @@ smoke_check_1(void) /* flush and destroy all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ TRUE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -264,7 +265,7 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_forward(/* cache_ptr */ cache_ptr, + col_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -280,7 +281,7 @@ smoke_check_1(void) /* flush all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ FALSE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -289,7 +290,7 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_backward(/* cache_ptr */ cache_ptr, + col_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -303,7 +304,7 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - takedown_cache(cache_ptr, display_stats, TRUE); + takedown_cache(file_ptr, display_stats, TRUE); if ( show_progress ) /* 11 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -358,7 +359,7 @@ smoke_check_2(void) hbool_t display_stats = FALSE; int32_t lag = 10; int mile_stone = 1; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; TESTING("smoke check #2 -- ~1/2 dirty, ins, dest, ren, 4/2 MB cache"); @@ -380,14 +381,14 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - cache_ptr = setup_cache((size_t)(4 * 1024 * 1024), + file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024)); if ( show_progress ) /* 3 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* cache_ptr */ cache_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -406,7 +407,7 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_backward(/* cache_ptr */ cache_ptr, + row_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -425,7 +426,7 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* cache_ptr */ cache_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -446,7 +447,7 @@ smoke_check_2(void) /* flush and destroy all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ TRUE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -455,7 +456,7 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_forward(/* cache_ptr */ cache_ptr, + col_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -471,7 +472,7 @@ smoke_check_2(void) /* flush all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ FALSE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -480,7 +481,7 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_backward(/* cache_ptr */ cache_ptr, + col_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -494,7 +495,7 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - takedown_cache(cache_ptr, display_stats, TRUE); + takedown_cache(file_ptr, display_stats, TRUE); if ( show_progress ) /* 11 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -548,7 +549,7 @@ smoke_check_3(void) hbool_t display_stats = FALSE; int32_t lag = 10; int mile_stone = 1; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; TESTING("smoke check #3 -- all clean, ins, dest, ren, 2/1 KB cache"); @@ -570,14 +571,14 @@ smoke_check_3(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); if ( show_progress ) /* 3 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* cache_ptr */ cache_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -596,7 +597,7 @@ smoke_check_3(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_backward(/* cache_ptr */ cache_ptr, + row_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -615,7 +616,7 @@ smoke_check_3(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* cache_ptr */ cache_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -636,7 +637,7 @@ smoke_check_3(void) /* flush and destroy all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ TRUE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -645,7 +646,7 @@ smoke_check_3(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_forward(/* cache_ptr */ cache_ptr, + col_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -661,7 +662,7 @@ smoke_check_3(void) /* flush all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ FALSE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -670,7 +671,7 @@ smoke_check_3(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_backward(/* cache_ptr */ cache_ptr, + col_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -684,7 +685,7 @@ smoke_check_3(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - takedown_cache(cache_ptr, display_stats, TRUE); + takedown_cache(file_ptr, display_stats, TRUE); if ( show_progress ) /* 11 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -739,7 +740,7 @@ smoke_check_4(void) hbool_t display_stats = FALSE; int32_t lag = 10; int mile_stone = 1; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; TESTING("smoke check #4 -- ~1/2 dirty, ins, dest, ren, 2/1 KB cache"); @@ -761,14 +762,14 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); if ( show_progress ) /* 3 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* cache_ptr */ cache_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -787,7 +788,7 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_backward(/* cache_ptr */ cache_ptr, + row_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -806,7 +807,7 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* cache_ptr */ cache_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -827,7 +828,7 @@ smoke_check_4(void) /* flush and destroy all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ TRUE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -836,7 +837,7 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_forward(/* cache_ptr */ cache_ptr, + col_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -852,7 +853,7 @@ smoke_check_4(void) /* flush all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ FALSE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -861,7 +862,7 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_backward(/* cache_ptr */ cache_ptr, + col_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -875,7 +876,7 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - takedown_cache(cache_ptr, display_stats, TRUE); + takedown_cache(file_ptr, display_stats, TRUE); if ( show_progress ) /* 11 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -930,6 +931,7 @@ smoke_check_5(void) hbool_t display_stats = FALSE; int32_t max_index = 1024; int mile_stone = 1; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; H5C_auto_size_ctl_t auto_size_ctl = { @@ -1008,8 +1010,9 @@ smoke_check_5(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; if ( pass ) { @@ -1026,7 +1029,7 @@ smoke_check_5(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1039,7 +1042,7 @@ smoke_check_5(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_row_major_scan_backward(/* cache_ptr */ cache_ptr, + hl_row_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1052,7 +1055,7 @@ smoke_check_5(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1067,7 +1070,7 @@ smoke_check_5(void) /* flush and destroy all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ TRUE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -1076,7 +1079,7 @@ smoke_check_5(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_col_major_scan_forward(/* cache_ptr */ cache_ptr, + hl_col_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1092,7 +1095,7 @@ smoke_check_5(void) /* flush all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ FALSE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -1101,7 +1104,7 @@ smoke_check_5(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_col_major_scan_backward(/* cache_ptr */ cache_ptr, + hl_col_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1115,7 +1118,7 @@ smoke_check_5(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - takedown_cache(cache_ptr, display_stats, TRUE); + takedown_cache(file_ptr, display_stats, TRUE); if ( show_progress ) /* 11 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -1170,6 +1173,7 @@ smoke_check_6(void) hbool_t display_stats = FALSE; int mile_stone = 1; int32_t max_index = 1024; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; H5C_auto_size_ctl_t auto_size_ctl = { @@ -1245,8 +1249,9 @@ smoke_check_6(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; if ( pass ) { @@ -1263,7 +1268,7 @@ smoke_check_6(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1276,7 +1281,7 @@ smoke_check_6(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_row_major_scan_backward(/* cache_ptr */ cache_ptr, + hl_row_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1289,7 +1294,7 @@ smoke_check_6(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1304,7 +1309,7 @@ smoke_check_6(void) /* flush and destroy all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ TRUE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -1313,7 +1318,7 @@ smoke_check_6(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_col_major_scan_forward(/* cache_ptr */ cache_ptr, + hl_col_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1329,7 +1334,7 @@ smoke_check_6(void) /* flush all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ FALSE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -1338,7 +1343,7 @@ smoke_check_6(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_col_major_scan_backward(/* cache_ptr */ cache_ptr, + hl_col_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1352,7 +1357,7 @@ smoke_check_6(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - takedown_cache(cache_ptr, display_stats, TRUE); + takedown_cache(file_ptr, display_stats, TRUE); if ( show_progress ) /* 11 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -1407,6 +1412,7 @@ smoke_check_7(void) hbool_t display_stats = FALSE; int mile_stone = 1; int32_t max_index = 1024; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; H5C_auto_size_ctl_t auto_size_ctl = { @@ -1483,8 +1489,9 @@ smoke_check_7(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; if ( pass ) { @@ -1501,7 +1508,7 @@ smoke_check_7(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1514,7 +1521,7 @@ smoke_check_7(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_row_major_scan_backward(/* cache_ptr */ cache_ptr, + hl_row_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1527,7 +1534,7 @@ smoke_check_7(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1542,7 +1549,7 @@ smoke_check_7(void) /* flush and destroy all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ TRUE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -1551,7 +1558,7 @@ smoke_check_7(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_col_major_scan_forward(/* cache_ptr */ cache_ptr, + hl_col_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1567,7 +1574,7 @@ smoke_check_7(void) /* flush all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ FALSE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -1576,7 +1583,7 @@ smoke_check_7(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_col_major_scan_backward(/* cache_ptr */ cache_ptr, + hl_col_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1590,7 +1597,7 @@ smoke_check_7(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - takedown_cache(cache_ptr, display_stats, TRUE); + takedown_cache(file_ptr, display_stats, TRUE); if ( show_progress ) /* 11 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -1645,6 +1652,7 @@ smoke_check_8(void) hbool_t display_stats = FALSE; int mile_stone = 1; int32_t max_index = 1024; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; H5C_auto_size_ctl_t auto_size_ctl = { @@ -1721,8 +1729,8 @@ smoke_check_8(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; if ( pass ) { @@ -1739,7 +1747,7 @@ smoke_check_8(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1752,7 +1760,7 @@ smoke_check_8(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_row_major_scan_backward(/* cache_ptr */ cache_ptr, + hl_row_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1765,7 +1773,7 @@ smoke_check_8(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1780,7 +1788,7 @@ smoke_check_8(void) /* flush and destroy all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ TRUE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -1789,7 +1797,7 @@ smoke_check_8(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_col_major_scan_forward(/* cache_ptr */ cache_ptr, + hl_col_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1805,7 +1813,7 @@ smoke_check_8(void) /* flush all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ FALSE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -1814,7 +1822,7 @@ smoke_check_8(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - hl_col_major_scan_backward(/* cache_ptr */ cache_ptr, + hl_col_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1828,7 +1836,7 @@ smoke_check_8(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - takedown_cache(cache_ptr, display_stats, TRUE); + takedown_cache(file_ptr, display_stats, TRUE); if ( show_progress ) /* 11 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -1886,6 +1894,7 @@ smoke_check_9(void) hbool_t display_detailed_stats = FALSE; int32_t lag = 10; int mile_stone = 1; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; TESTING("smoke check #9 -- all clean, ins, dest, ren, 4/2 MB, corked"); @@ -1908,8 +1917,9 @@ smoke_check_9(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - cache_ptr = setup_cache((size_t)(4 * 1024 * 1024), + file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024)); + cache_ptr = file_ptr->shared->cache; /* disable evictions */ @@ -1932,7 +1942,7 @@ smoke_check_9(void) HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* cache_ptr */ cache_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1968,7 +1978,7 @@ smoke_check_9(void) HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled \n", fcn_name, mile_stone++, (int)pass); - row_major_scan_backward(/* cache_ptr */ cache_ptr, + row_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2002,7 +2012,7 @@ smoke_check_9(void) HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled \n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* cache_ptr */ cache_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2038,7 +2048,7 @@ smoke_check_9(void) /* flush and destroy all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ TRUE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -2062,7 +2072,7 @@ smoke_check_9(void) HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_forward(/* cache_ptr */ cache_ptr, + col_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2078,7 +2088,7 @@ smoke_check_9(void) /* flush all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ FALSE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -2102,7 +2112,7 @@ smoke_check_9(void) HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_backward(/* cache_ptr */ cache_ptr, + col_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2132,7 +2142,7 @@ smoke_check_9(void) HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", fcn_name, mile_stone++, (int)pass); - takedown_cache(cache_ptr, display_stats, TRUE); + takedown_cache(file_ptr, display_stats, TRUE); if ( show_progress ) /* 18 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -2190,6 +2200,7 @@ smoke_check_10(void) hbool_t display_detailed_stats = FALSE; int32_t lag = 10; int mile_stone = 1; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; TESTING("smoke check #10 -- ~1/2 dirty, ins, dest, ren, 4/2 MB, corked"); @@ -2212,14 +2223,15 @@ smoke_check_10(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - cache_ptr = setup_cache((size_t)(4 * 1024 * 1024), + file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024)); + cache_ptr = file_ptr->shared->cache; if ( show_progress ) /* 3 */ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* cache_ptr */ cache_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2253,7 +2265,7 @@ smoke_check_10(void) HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_backward(/* cache_ptr */ cache_ptr, + row_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2287,7 +2299,7 @@ smoke_check_10(void) HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* cache_ptr */ cache_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2323,7 +2335,7 @@ smoke_check_10(void) /* flush and destroy all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ TRUE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -2347,7 +2359,7 @@ smoke_check_10(void) HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_forward(/* cache_ptr */ cache_ptr, + col_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2378,7 +2390,7 @@ smoke_check_10(void) /* flush all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ FALSE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -2402,7 +2414,7 @@ smoke_check_10(void) HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_backward(/* cache_ptr */ cache_ptr, + col_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2431,7 +2443,7 @@ smoke_check_10(void) HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", fcn_name, mile_stone++, (int)pass); - takedown_cache(cache_ptr, display_stats, TRUE); + takedown_cache(file_ptr, display_stats, TRUE); if ( show_progress ) /* 18 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -2483,7 +2495,7 @@ write_permitted_check(void) hbool_t display_stats = FALSE; int32_t lag = 10; int mile_stone = 1; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ @@ -2503,14 +2515,14 @@ write_permitted_check(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - cache_ptr = setup_cache((size_t)(1 * 1024 * 1024), + file_ptr = setup_cache((size_t)(1 * 1024 * 1024), (size_t)(0)); if ( show_progress ) /* 3 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* cache_ptr */ cache_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2531,7 +2543,7 @@ write_permitted_check(void) write_permitted = FALSE; - row_major_scan_backward(/* cache_ptr */ cache_ptr, + row_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2552,7 +2564,7 @@ write_permitted_check(void) write_permitted = TRUE; - row_major_scan_forward(/* cache_ptr */ cache_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2573,7 +2585,7 @@ write_permitted_check(void) /* flush and destroy all entries in the cache: */ - flush_cache(/* cache_ptr */ cache_ptr, + flush_cache(/* file_ptr */ file_ptr, /* destroy_entries */ TRUE, /* dump_stats */ FALSE, /* dump_detailed_stats */ FALSE); @@ -2582,7 +2594,7 @@ write_permitted_check(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_forward(/* cache_ptr */ cache_ptr, + col_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2598,7 +2610,7 @@ write_permitted_check(void) write_permitted = FALSE; - col_major_scan_backward(/* cache_ptr */ cache_ptr, + col_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2614,7 +2626,7 @@ write_permitted_check(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - takedown_cache(cache_ptr, display_stats, TRUE); + takedown_cache(file_ptr, display_stats, TRUE); if ( show_progress ) /* 10 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -2677,6 +2689,7 @@ check_insert_entry(void) hbool_t is_protected; hbool_t is_pinned; size_t entry_size; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -2701,18 +2714,17 @@ check_insert_entry(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024)); + cache_ptr = file_ptr->shared->cache; } if ( pass ) { - insert_entry(cache_ptr, entry_type, 0, TRUE, H5C__NO_FLAGS_SET); - insert_entry(cache_ptr, entry_type, 1, TRUE, - H5C__SET_FLUSH_MARKER_FLAG); - insert_entry(cache_ptr, entry_type, 2, TRUE, H5C__PIN_ENTRY_FLAG); - insert_entry(cache_ptr, entry_type, 3, TRUE, - (H5C__SET_FLUSH_MARKER_FLAG | H5C__PIN_ENTRY_FLAG)); + insert_entry(file_ptr, entry_type, 0, TRUE, H5C__NO_FLAGS_SET); + insert_entry(file_ptr, entry_type, 1, TRUE, H5C__SET_FLUSH_MARKER_FLAG); + insert_entry(file_ptr, entry_type, 2, TRUE, H5C__PIN_ENTRY_FLAG); + insert_entry(file_ptr, entry_type, 3, TRUE, (H5C__SET_FLUSH_MARKER_FLAG | H5C__PIN_ENTRY_FLAG)); } @@ -2726,14 +2738,14 @@ check_insert_entry(void) /* Start by checking everything we can via H5C_get_entry_status() */ - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { pass = FALSE; - failure_mssg = "H5AC_get_entry_status() reports failure."; + failure_mssg = "H5C_get_entry_status() reports failure."; } if ( pass ) { @@ -2769,7 +2781,7 @@ check_insert_entry(void) } } - /* Thats all we can get from H5AC_get_entry_status(). + /* Thats all we can get from H5C_get_entry_status(). * Now start looking at the cache data structures directly. */ @@ -2924,13 +2936,13 @@ check_insert_entry(void) if ( pass ) { - unpin_entry(cache_ptr, entry_type, 2); - unpin_entry(cache_ptr, entry_type, 3); + unpin_entry(entry_type, 2); + unpin_entry(entry_type, 3); } if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -2967,7 +2979,7 @@ check_flush_cache(void) { const char * fcn_name = "check_flush_cache"; hbool_t show_progress = FALSE; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; TESTING("H5C_flush_cache() functionality"); @@ -2987,7 +2999,7 @@ check_flush_cache(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024)); } @@ -3003,7 +3015,7 @@ check_flush_cache(void) fcn_name); } - check_flush_cache__empty_cache(cache_ptr); + check_flush_cache__empty_cache(file_ptr); } /* now do a series of similar tests with a cache with a single entry. @@ -3018,7 +3030,7 @@ check_flush_cache(void) fcn_name); } - check_flush_cache__single_entry(cache_ptr); + check_flush_cache__single_entry(file_ptr); } if ( pass ) { @@ -3029,7 +3041,7 @@ check_flush_cache(void) fcn_name); } - check_flush_cache__multi_entry(cache_ptr); + check_flush_cache__multi_entry(file_ptr); } if ( pass ) { @@ -3040,7 +3052,7 @@ check_flush_cache(void) fcn_name); } - check_flush_cache__flush_ops(cache_ptr); + check_flush_cache__flush_ops(file_ptr); } if ( pass ) { @@ -3051,7 +3063,7 @@ check_flush_cache(void) fcn_name); } - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -3084,9 +3096,10 @@ check_flush_cache(void) */ static void -check_flush_cache__empty_cache(H5C_t * cache_ptr) +check_flush_cache__empty_cache(H5F_t * file_ptr) { /* const char * fcn_name = "check_flush_cache__empty_cache"; */ + H5C_t * cache_ptr = file_ptr->shared->cache; herr_t result; if ( cache_ptr == NULL ) { @@ -3108,7 +3121,8 @@ check_flush_cache__empty_cache(H5C_t * cache_ptr) if ( pass ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + H5C__NO_FLAGS_SET); if ( result < 0 ) { @@ -3119,7 +3133,7 @@ check_flush_cache__empty_cache(H5C_t * cache_ptr) if ( pass ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -3131,7 +3145,7 @@ check_flush_cache__empty_cache(H5C_t * cache_ptr) if ( pass ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_CLEAR_ONLY_FLAG); if ( result < 0 ) { @@ -3144,7 +3158,7 @@ check_flush_cache__empty_cache(H5C_t * cache_ptr) if ( pass ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_MARKED_ENTRIES_FLAG); if ( result < 0 ) { @@ -3177,9 +3191,10 @@ check_flush_cache__empty_cache(H5C_t * cache_ptr) */ static void -check_flush_cache__multi_entry(H5C_t * cache_ptr) +check_flush_cache__multi_entry(H5F_t * file_ptr) { /* const char * fcn_name = "check_flush_cache__multi_entry"; */ + H5C_t *cache_ptr = file_ptr->shared->cache; if ( cache_ptr == NULL ) { @@ -3298,7 +3313,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr) } }; - check_flush_cache__multi_entry_test(cache_ptr, test_num, + check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } @@ -3408,7 +3423,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr) } }; - check_flush_cache__multi_entry_test(cache_ptr, test_num, + check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } @@ -3518,7 +3533,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr) } }; - check_flush_cache__multi_entry_test(cache_ptr, test_num, + check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } @@ -3628,7 +3643,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr) } }; - check_flush_cache__multi_entry_test(cache_ptr, test_num, + check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } @@ -3739,7 +3754,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr) } }; - check_flush_cache__multi_entry_test(cache_ptr, test_num, + check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } @@ -3850,7 +3865,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr) } }; - check_flush_cache__multi_entry_test(cache_ptr, test_num, + check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } @@ -3961,7 +3976,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr) } }; - check_flush_cache__multi_entry_test(cache_ptr, test_num, + check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } @@ -4073,7 +4088,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr) } }; - check_flush_cache__multi_entry_test(cache_ptr, test_num, + check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } @@ -4187,7 +4202,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr) } }; - check_flush_cache__multi_entry_test(cache_ptr, test_num, + check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } @@ -4354,7 +4369,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr) } }; - check_flush_cache__pe_multi_entry_test(cache_ptr, test_num, + check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } @@ -4500,7 +4515,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr) } }; - check_flush_cache__pe_multi_entry_test(cache_ptr, test_num, + check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } @@ -4637,7 +4652,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr) } }; - check_flush_cache__pe_multi_entry_test(cache_ptr, test_num, + check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } @@ -4783,7 +4798,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr) } }; - check_flush_cache__pe_multi_entry_test(cache_ptr, test_num, + check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } @@ -4926,7 +4941,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr) } }; - check_flush_cache__pe_multi_entry_test(cache_ptr, test_num, + check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } @@ -4951,13 +4966,14 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr) */ static void -check_flush_cache__multi_entry_test(H5C_t * cache_ptr, +check_flush_cache__multi_entry_test(H5F_t * file_ptr, int test_num, unsigned int flush_flags, int spec_size, struct flush_cache_test_spec spec[]) { /* const char * fcn_name = "check_flush_cache__multi_entry_test"; */ + H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; herr_t result; int i; @@ -5022,14 +5038,14 @@ check_flush_cache__multi_entry_test(H5C_t * cache_ptr, { if ( spec[i].insert_flag ) { - insert_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index, + insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].dirty_flag, spec[i].flags); } else { - protect_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index); + protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index); - unprotect_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index, + unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, (int)(spec[i].dirty_flag), spec[i].flags); } @@ -5040,7 +5056,7 @@ check_flush_cache__multi_entry_test(H5C_t * cache_ptr, if ( pass ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, flush_flags); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, flush_flags); if ( result < 0 ) { @@ -5117,7 +5133,7 @@ check_flush_cache__multi_entry_test(H5C_t * cache_ptr, /* clean up the cache to prep for the next test */ if ( pass ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -5175,13 +5191,14 @@ check_flush_cache__multi_entry_test(H5C_t * cache_ptr, */ static void -check_flush_cache__pe_multi_entry_test(H5C_t * cache_ptr, +check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, int test_num, unsigned int flush_flags, int spec_size, struct pe_flush_cache_test_spec spec[]) { /* const char * fcn_name = "check_flush_cache__pe_multi_entry_test"; */ + H5C_t *cache_ptr = file_ptr->shared->cache; static char msg[128]; herr_t result; int i; @@ -5249,14 +5266,14 @@ check_flush_cache__pe_multi_entry_test(H5C_t * cache_ptr, { if ( spec[i].insert_flag ) { - insert_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index, + insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].dirty_flag, spec[i].flags); } else { - protect_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index); + protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index); - unprotect_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index, + unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, (int)(spec[i].dirty_flag), spec[i].flags); } @@ -5264,7 +5281,7 @@ check_flush_cache__pe_multi_entry_test(H5C_t * cache_ptr, for ( j = 0; j < spec[i].num_pins; j++ ) { - create_pinned_entry_dependency(cache_ptr, + create_pinned_entry_dependency(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].pin_type[j], @@ -5276,7 +5293,8 @@ check_flush_cache__pe_multi_entry_test(H5C_t * cache_ptr, if ( pass ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, flush_flags); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + flush_flags); if ( result < 0 ) { @@ -5353,7 +5371,7 @@ check_flush_cache__pe_multi_entry_test(H5C_t * cache_ptr, /* clean up the cache to prep for the next test */ if ( pass ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -5417,9 +5435,10 @@ check_flush_cache__pe_multi_entry_test(H5C_t * cache_ptr, */ static void -check_flush_cache__flush_ops(H5C_t * cache_ptr) +check_flush_cache__flush_ops(H5F_t * file_ptr) { /* const char * fcn_name = "check_flush_cache__flush_ops"; */ + H5C_t *cache_ptr = file_ptr->shared->cache; if ( cache_ptr == NULL ) { @@ -5525,7 +5544,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -5633,7 +5652,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -5710,7 +5729,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -5789,7 +5808,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -5869,7 +5888,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -5897,7 +5916,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) spec[0].flush_ops[0].flag = TRUE; test_num = 6; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -5981,7 +6000,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -6014,7 +6033,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) spec[0].flush_ops[0].flag = TRUE; spec[0].expected_destroyed = TRUE; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -6095,7 +6114,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -6123,7 +6142,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) spec[0].flush_ops[0].flag = TRUE; test_num = 10; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -6207,7 +6226,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -6240,7 +6259,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) spec[0].expected_destroyed = TRUE; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -6337,7 +6356,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -6435,7 +6454,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -6532,7 +6551,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -6629,7 +6648,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -6726,7 +6745,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -6754,7 +6773,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) checks[0].at_main_addr = TRUE; checks[1].at_main_addr = TRUE; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -6855,7 +6874,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -6891,7 +6910,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) checks[1].in_cache = FALSE; checks[1].expected_destroyed = TRUE; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -7110,7 +7129,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -7381,7 +7400,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -7651,7 +7670,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -7788,7 +7807,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -7922,7 +7941,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -8353,7 +8372,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -8790,7 +8809,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -8981,7 +9000,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -9174,7 +9193,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } }; - check_flush_cache__flush_op_test(cache_ptr, + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, @@ -9190,7 +9209,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) } /* finally finish up with the flush ops eviction test */ - check_flush_cache__flush_op_eviction_test(cache_ptr); + check_flush_cache__flush_op_eviction_test(file_ptr); return; @@ -9214,7 +9233,7 @@ check_flush_cache__flush_ops(H5C_t * cache_ptr) */ static void -check_flush_cache__flush_op_test(H5C_t * cache_ptr, +check_flush_cache__flush_op_test(H5F_t * file_ptr, int test_num, unsigned int flush_flags, int spec_size, @@ -9227,11 +9246,11 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, struct fo_flush_entry_check check[]) { const char * fcn_name = "check_flush_cache__flush_op_test"; + H5C_t *cache_ptr = file_ptr->shared->cache; static char msg[128]; hbool_t show_progress = FALSE; hbool_t verbose = FALSE; herr_t result; - int target_test = -1; int i; int j; test_entry_t * base_addr; @@ -9242,11 +9261,6 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, test_num); #endif - if ( ( target_test > 0 ) && ( test_num != target_test ) ) { - - show_progress = FALSE; - } - if ( show_progress ) { HDfprintf(stdout, "%s:%d:%d: running sanity checks on entry(1).\n", @@ -9372,7 +9386,7 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, (unsigned)spec[i].flags); } - insert_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index, + insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, TRUE, spec[i].flags); } else { @@ -9386,7 +9400,7 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, (int)(spec[i].entry_index)); } - protect_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index); + protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index); if ( show_progress ) { @@ -9399,14 +9413,14 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, (int)(spec[i].new_size)); } - unprotect_entry_with_size_change(cache_ptr, spec[i].entry_type, + unprotect_entry_with_size_change(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].flags, spec[i].new_size); } for ( j = 0; j < spec[i].num_pins; j++ ) { - create_pinned_entry_dependency(cache_ptr, + create_pinned_entry_dependency(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].pin_type[j], @@ -9449,7 +9463,8 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, if ( pass ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, flush_flags); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + flush_flags); if ( result < 0 ) { @@ -9671,7 +9686,7 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, if ( pass ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -9779,7 +9794,7 @@ check_flush_cache__flush_op_test(H5C_t * cache_ptr, */ static void -check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) +check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) { /* const char * fcn_name = "check_flush_cache__flush_op_eviction_test"; */ int i; @@ -9787,6 +9802,7 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) int num_monster_entries = 31; int num_large_entries = 0; herr_t result; + H5C_t * cache_ptr = file_ptr->shared->cache; test_entry_t * entry_ptr; test_entry_t * base_addr; struct expected_entry_status expected[8 + 31 + 14] = @@ -9905,40 +9921,40 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) * Start by just loading the entries. */ - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 0); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 0, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 0, H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG, (VARIABLE_ENTRY_SIZE / 2)); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 1); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 1, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 1, H5C__NO_FLAGS_SET, (size_t)0); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 2); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 2, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 2); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 2, H5C__NO_FLAGS_SET, (size_t)0); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 3); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 3, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 3, H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG, (VARIABLE_ENTRY_SIZE / 2)); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 4); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 4, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 4); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 4, H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG, (VARIABLE_ENTRY_SIZE / 2)); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 5); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 5, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 5, H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG, (VARIABLE_ENTRY_SIZE / 2)); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 6); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 6, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 6, H5C__NO_FLAGS_SET, (size_t)0); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 7); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 7, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 7, H5C__NO_FLAGS_SET, (size_t)0); if ( ( cache_ptr->index_len != 8 ) || @@ -9957,15 +9973,15 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) * Briefly, (VET, 0) is pinned by (VET, 1), (VET, 2), and (VET, 3) * (VET, 7) is pinned by (VET, 3), and (VET, 5) */ - create_pinned_entry_dependency(cache_ptr, VARIABLE_ENTRY_TYPE, 1, + create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 1, VARIABLE_ENTRY_TYPE, 0); - create_pinned_entry_dependency(cache_ptr, VARIABLE_ENTRY_TYPE, 2, + create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 2, VARIABLE_ENTRY_TYPE, 0); - create_pinned_entry_dependency(cache_ptr, VARIABLE_ENTRY_TYPE, 3, + create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 3, VARIABLE_ENTRY_TYPE, 0); - create_pinned_entry_dependency(cache_ptr, VARIABLE_ENTRY_TYPE, 3, + create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 3, VARIABLE_ENTRY_TYPE, 7); - create_pinned_entry_dependency(cache_ptr, VARIABLE_ENTRY_TYPE, 5, + create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 5, VARIABLE_ENTRY_TYPE, 7); /* Next, set up the flush operations: @@ -10040,15 +10056,15 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) /* Now fill up the cache with other, unrelated entries */ for ( i = 0; i < 31; i++ ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - unprotect_entry_with_size_change(cache_ptr, MONSTER_ENTRY_TYPE, i, + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + unprotect_entry_with_size_change(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG, (size_t)0); } for ( i = 0; i < 1; i++ ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry_with_size_change(cache_ptr, LARGE_ENTRY_TYPE, i, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG, (size_t)0); } @@ -10115,8 +10131,8 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) num_large_entries = 2; - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 1); - unprotect_entry_with_size_change(cache_ptr, LARGE_ENTRY_TYPE, 1, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); + unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG, (size_t)0); if ( ( cache_ptr->index_len != 40 ) || @@ -10181,8 +10197,8 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) num_large_entries = 3; - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 2); - unprotect_entry_with_size_change(cache_ptr, LARGE_ENTRY_TYPE, 2, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); + unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__DIRTIED_FLAG, (size_t)0); if ( ( cache_ptr->index_len != 40 ) || @@ -10254,12 +10270,12 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) num_large_entries = 5; - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3); - unprotect_entry_with_size_change(cache_ptr, LARGE_ENTRY_TYPE, 3, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__DIRTIED_FLAG, (size_t)0); - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 4); - unprotect_entry_with_size_change(cache_ptr, LARGE_ENTRY_TYPE, 4, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 4); + unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, 4, H5C__DIRTIED_FLAG, (size_t)0); /* verify cache size */ @@ -10295,15 +10311,15 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) */ for ( i = 0; i < 31; i++ ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - unprotect_entry_with_size_change(cache_ptr, MONSTER_ENTRY_TYPE, i, + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + unprotect_entry_with_size_change(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG, (size_t)0); } for ( i = 0; i < 5; i++ ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry_with_size_change(cache_ptr, LARGE_ENTRY_TYPE, i, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG, (size_t)0); } @@ -10362,8 +10378,8 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) for ( i = 5; i < 8; i++ ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry_with_size_change(cache_ptr, LARGE_ENTRY_TYPE, i, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG, (size_t)0); } @@ -10424,8 +10440,8 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) for ( i = 8; i < 9; i++ ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry_with_size_change(cache_ptr, LARGE_ENTRY_TYPE, i, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG, (size_t)0); } @@ -10490,8 +10506,8 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) for ( i = 9; i < 10; i++ ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry_with_size_change(cache_ptr, LARGE_ENTRY_TYPE, i, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG, (size_t)0); } @@ -10526,15 +10542,15 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) */ for ( i = 0; i < 31; i++ ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - unprotect_entry_with_size_change(cache_ptr, MONSTER_ENTRY_TYPE, i, + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + unprotect_entry_with_size_change(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG, (size_t)0); } for ( i = 0; i < 10; i++ ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry_with_size_change(cache_ptr, LARGE_ENTRY_TYPE, i, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG, (size_t)0); } @@ -10637,8 +10653,8 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) for ( i = 10; i < 12; i++ ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry_with_size_change(cache_ptr, LARGE_ENTRY_TYPE, i, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG, (size_t)0); } @@ -10670,15 +10686,15 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) */ for ( i = 0; i < num_monster_entries; i++ ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - unprotect_entry_with_size_change(cache_ptr, MONSTER_ENTRY_TYPE, i, + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + unprotect_entry_with_size_change(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG, (size_t)0); } for ( i = 0; i < num_large_entries; i++ ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry_with_size_change(cache_ptr, LARGE_ENTRY_TYPE, i, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG, (size_t)0); } @@ -10764,8 +10780,8 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) for ( i = 12; i < 14; i++ ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry_with_size_change(cache_ptr, LARGE_ENTRY_TYPE, i, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG, (size_t)0); } @@ -10795,8 +10811,8 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) if ( pass ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, - H5C__FLUSH_INVALIDATE_FLAG); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -10932,10 +10948,11 @@ check_flush_cache__flush_op_eviction_test(H5C_t * cache_ptr) */ static void -check_flush_cache__single_entry(H5C_t * cache_ptr) +check_flush_cache__single_entry(H5F_t * file_ptr) { const char * fcn_name = "check_flush_cache__single_entry"; hbool_t show_progress = FALSE; + H5C_t * cache_ptr = file_ptr->shared->cache; if ( cache_ptr == NULL ) { @@ -10957,7 +10974,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 1, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -10984,7 +11001,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 2, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11011,7 +11028,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 3, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11038,7 +11055,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 4, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11065,7 +11082,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 5, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11092,7 +11109,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 6, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11119,7 +11136,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 7, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11146,7 +11163,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 8, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11173,7 +11190,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 9, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11201,7 +11218,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 10, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11229,7 +11246,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 11, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11257,7 +11274,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 12, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11285,7 +11302,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 13, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11313,7 +11330,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 14, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11341,7 +11358,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 15, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11370,7 +11387,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 16, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11399,7 +11416,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 17, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11426,7 +11443,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 18, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11453,7 +11470,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 19, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11480,7 +11497,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 20, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11507,7 +11524,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 21, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11534,7 +11551,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 22, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11561,7 +11578,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 23, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11588,7 +11605,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 24, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11615,7 +11632,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 25, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11643,7 +11660,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 26, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11671,7 +11688,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 27, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11699,7 +11716,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 28, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11727,7 +11744,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 29, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11755,7 +11772,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 30, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11783,7 +11800,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 31, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11812,7 +11829,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 32, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11841,7 +11858,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 33, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11868,7 +11885,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 34, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11895,7 +11912,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 35, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11922,7 +11939,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 36, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11949,7 +11966,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 37, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -11976,7 +11993,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 38, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12003,7 +12020,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 39, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12030,7 +12047,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 40, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12057,7 +12074,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 41, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12085,7 +12102,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 42, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12113,7 +12130,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 43, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12141,7 +12158,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 44, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12169,7 +12186,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 45, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12197,7 +12214,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 46, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12225,7 +12242,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 47, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12254,7 +12271,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 48, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12283,7 +12300,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 49, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12310,7 +12327,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 50, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12337,7 +12354,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 51, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12364,7 +12381,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 52, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12391,7 +12408,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 53, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12418,7 +12435,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 54, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12445,7 +12462,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 55, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12472,7 +12489,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 56, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12499,7 +12516,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 57, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12527,7 +12544,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 58, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12555,7 +12572,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 59, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12583,7 +12600,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 60, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12611,7 +12628,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 61, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12639,7 +12656,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 62, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12667,7 +12684,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 63, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -12696,7 +12713,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ 64, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, @@ -13070,7 +13087,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) check_flush_cache__pinned_single_entry_test ( - /* cache_ptr */ cache_ptr, + /* file_ptr */ file_ptr, /* test_num */ spec[i].test_num, /* entry_type */ spec[i].entry_type, /* entry_idx */ spec[i].entry_idx, @@ -13110,7 +13127,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr) */ static void -check_flush_cache__single_entry_test(H5C_t * cache_ptr, +check_flush_cache__single_entry_test(H5F_t * file_ptr, int test_num, int entry_type, int entry_idx, @@ -13124,6 +13141,7 @@ check_flush_cache__single_entry_test(H5C_t * cache_ptr, hbool_t expected_destroyed) { /* const char * fcn_name = "check_flush_cache__single_entry_test"; */ + H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; herr_t result; test_entry_t * base_addr; @@ -13163,20 +13181,20 @@ check_flush_cache__single_entry_test(H5C_t * cache_ptr, if ( insert_flag ) { - insert_entry(cache_ptr, entry_type, entry_idx, dirty_flag, flags); + insert_entry(file_ptr, entry_type, entry_idx, dirty_flag, flags); } else { - protect_entry(cache_ptr, entry_type, entry_idx); + protect_entry(file_ptr, entry_type, entry_idx); - unprotect_entry(cache_ptr, entry_type, entry_idx, + unprotect_entry(file_ptr, entry_type, entry_idx, (int)dirty_flag, flags); } } if ( pass ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, flush_flags); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, flush_flags); if ( result < 0 ) { @@ -13239,7 +13257,7 @@ check_flush_cache__single_entry_test(H5C_t * cache_ptr, /* clean up the cache to prep for the next test */ if ( pass ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -13297,7 +13315,7 @@ check_flush_cache__single_entry_test(H5C_t * cache_ptr, */ static void -check_flush_cache__pinned_single_entry_test(H5C_t * cache_ptr, +check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, int test_num, int entry_type, int entry_idx, @@ -13313,6 +13331,7 @@ check_flush_cache__pinned_single_entry_test(H5C_t * cache_ptr, hbool_t expected_destroyed) { /* const char *fcn_name = "check_flush_cache__pinned_single_entry_test"; */ + H5C_t *cache_ptr = file_ptr->shared->cache; static char msg[128]; hbool_t expected_loaded = TRUE; herr_t result; @@ -13351,35 +13370,33 @@ check_flush_cache__pinned_single_entry_test(H5C_t * cache_ptr, base_addr = entries[entry_type]; entry_ptr = &(base_addr[entry_idx]); - protect_entry(cache_ptr, entry_type, entry_idx); + protect_entry(file_ptr, entry_type, entry_idx); if ( pop_mark_dirty_prot ) { - mark_pinned_or_protected_entry_dirty(cache_ptr, - entry_type, + mark_pinned_or_protected_entry_dirty(entry_type, entry_idx); } - unprotect_entry(cache_ptr, entry_type, entry_idx, + unprotect_entry(file_ptr, entry_type, entry_idx, (int)dirty_flag, (flags | H5C__PIN_ENTRY_FLAG)); if ( mark_dirty ) { - mark_pinned_entry_dirty(cache_ptr, entry_type, entry_idx, - FALSE, (size_t)0); + mark_pinned_entry_dirty(entry_type, entry_idx, FALSE, (size_t)0); } if ( pop_mark_dirty_pinned ) { - mark_pinned_or_protected_entry_dirty(cache_ptr, - entry_type, + mark_pinned_or_protected_entry_dirty(entry_type, entry_idx); } } if ( pass ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, flush_flags); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + flush_flags); if ( result < 0 ) { @@ -13442,21 +13459,21 @@ check_flush_cache__pinned_single_entry_test(H5C_t * cache_ptr, if ( unprotect_unpin ) { - protect_entry(cache_ptr, entry_type, entry_idx); + protect_entry(file_ptr, entry_type, entry_idx); - unprotect_entry(cache_ptr, entry_type, entry_idx, + unprotect_entry(file_ptr, entry_type, entry_idx, (int)dirty_flag, H5C__UNPIN_ENTRY_FLAG); } else { - unpin_entry(cache_ptr, entry_type, entry_idx); + unpin_entry(entry_type, entry_idx); } } if ( pass ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -13516,7 +13533,7 @@ check_get_entry_status(void) hbool_t is_protected; hbool_t is_pinned; size_t entry_size; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -13528,7 +13545,7 @@ check_get_entry_status(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024)); base_addr = entries[0]; @@ -13541,14 +13558,14 @@ check_get_entry_status(void) * the call. Thus, only check that boolean. */ - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 1."); + "H5C_get_entry_status() reports failure 1."); failure_mssg = msg; } else if ( in_cache ) { @@ -13559,20 +13576,20 @@ check_get_entry_status(void) } } - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 2."); + "H5C_get_entry_status() reports failure 2."); failure_mssg = msg; } else if ( !in_cache || is_dirty || is_protected || is_pinned ) { @@ -13583,18 +13600,18 @@ check_get_entry_status(void) } } - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 3."); + "H5C_get_entry_status() reports failure 3."); failure_mssg = msg; } else if ( !in_cache || is_dirty || !is_protected || is_pinned ) { @@ -13605,18 +13622,18 @@ check_get_entry_status(void) } } - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 4."); + "H5C_get_entry_status() reports failure 4."); failure_mssg = msg; } else if ( !in_cache || is_dirty || is_protected || !is_pinned ) { @@ -13627,18 +13644,18 @@ check_get_entry_status(void) } } - mark_pinned_entry_dirty(cache_ptr, 0, 0, FALSE, (size_t)0); + mark_pinned_entry_dirty(0, 0, FALSE, (size_t)0); if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 5."); + "H5C_get_entry_status() reports failure 5."); failure_mssg = msg; } else if ( !in_cache || !is_dirty || is_protected || !is_pinned ) { @@ -13649,18 +13666,18 @@ check_get_entry_status(void) } } - unpin_entry(cache_ptr, 0, 0); + unpin_entry(0, 0); if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 6."); + "H5C_get_entry_status() reports failure 6."); failure_mssg = msg; } else if ( !in_cache || !is_dirty || is_protected || is_pinned ) { @@ -13673,7 +13690,7 @@ check_get_entry_status(void) if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -13717,7 +13734,7 @@ check_expunge_entry(void) hbool_t is_protected; hbool_t is_pinned; size_t entry_size; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -13729,7 +13746,7 @@ check_expunge_entry(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024)); base_addr = entries[0]; @@ -13742,7 +13759,7 @@ check_expunge_entry(void) * the status call. Thus, only check that boolean. */ - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); @@ -13750,7 +13767,7 @@ check_expunge_entry(void) pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 1."); + "H5C_get_entry_status() reports failure 1."); failure_mssg = msg; } else if ( in_cache ) { @@ -13775,45 +13792,53 @@ check_expunge_entry(void) * it without marking it dirty. */ - protect_entry(cache_ptr, 0, 0); + if ( pass ) { + + protect_entry(file_ptr, 0, 0); - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + + } if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); - if ( result < 0 ) { + if ( result < 0 ) { - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 2."); - failure_mssg = msg; + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5C_get_entry_status() reports failure 2."); + failure_mssg = msg; - } else if ( !in_cache || is_dirty || is_protected || is_pinned ) { + } else if ( !in_cache || is_dirty || is_protected || is_pinned ) { - pass = FALSE; - HDsnprintf(msg, (size_t)128, "Unexpected status 2."); - failure_mssg = msg; + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 2."); + failure_mssg = msg; - } else if ( ( ! entry_ptr->loaded ) || - ( entry_ptr->cleared ) || - ( entry_ptr->flushed ) || - ( entry_ptr->destroyed ) ) { + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( entry_ptr->destroyed ) ) { - pass = FALSE; - HDsnprintf(msg, (size_t)128, "Unexpected entry history 2."); - failure_mssg = msg; + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 2."); + failure_mssg = msg; - } + } } /* Expunge the entry and then verify that it is no longer in the cache. * Also verify that the entry was loaded, cleared, and destroyed, but * not flushed. */ - expunge_entry(cache_ptr, 0, 0); + if ( pass ) { + + expunge_entry(file_ptr, 0, 0); + + } if ( pass ) { @@ -13821,32 +13846,32 @@ check_expunge_entry(void) * by the status call. Thus, only check that boolean. */ - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); - if ( result < 0 ) { + if ( result < 0 ) { - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 3."); - failure_mssg = msg; + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5C_get_entry_status() reports failure 3."); + failure_mssg = msg; - } else if ( in_cache ) { + } else if ( in_cache ) { - pass = FALSE; - HDsnprintf(msg, (size_t)128, "Unexpected status 3."); - failure_mssg = msg; + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 3."); + failure_mssg = msg; - } else if ( ( ! entry_ptr->loaded ) || - ( ! entry_ptr->cleared ) || - ( entry_ptr->flushed ) || - ( ! entry_ptr->destroyed ) ) { + } else if ( ( ! entry_ptr->loaded ) || + ( ! entry_ptr->cleared ) || + ( entry_ptr->flushed ) || + ( ! entry_ptr->destroyed ) ) { - pass = FALSE; - HDsnprintf(msg, (size_t)128, "Unexpected entry history 3."); - failure_mssg = msg; + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 3."); + failure_mssg = msg; - } + } } /* now repeat the process with a different entry. On unprotect @@ -13862,18 +13887,18 @@ check_expunge_entry(void) * the status call. Thus, only check that boolean. */ - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); - if ( result < 0 ) { + if ( result < 0 ) { - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 4."); - failure_mssg = msg; + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5C_get_entry_status() reports failure 4."); + failure_mssg = msg; - } else if ( in_cache ) { + } else if ( in_cache ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 4."); @@ -13888,31 +13913,35 @@ check_expunge_entry(void) HDsnprintf(msg, (size_t)128, "Unexpected entry history 4."); failure_mssg = msg; - } + } } /* protect the entry to force the cache to load it, and then unprotect * it with the dirty flag set. */ - protect_entry(cache_ptr, 0, 1); + if ( pass ) { + + protect_entry(file_ptr, 0, 1); + + unprotect_entry(file_ptr, 0, 1, TRUE, H5C__NO_FLAGS_SET); - unprotect_entry(cache_ptr, 0, 1, TRUE, H5C__NO_FLAGS_SET); + } if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); - if ( result < 0 ) { + if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 5."); + "H5C_get_entry_status() reports failure 5."); failure_mssg = msg; - } else if ( !in_cache || !is_dirty || is_protected || is_pinned ) { + } else if ( !in_cache || !is_dirty || is_protected || is_pinned ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 5."); @@ -13927,14 +13956,18 @@ check_expunge_entry(void) HDsnprintf(msg, (size_t)128, "Unexpected entry history 5."); failure_mssg = msg; - } + } } /* Expunge the entry and then verify that it is no longer in the cache. * Also verify that the entry was loaded, cleared and destroyed, but not * flushed. */ - expunge_entry(cache_ptr, 0, 1); + if ( pass ) { + + expunge_entry(file_ptr, 0, 1); + + } if ( pass ) { @@ -13942,18 +13975,18 @@ check_expunge_entry(void) * by the status call. Thus, only check that boolean. */ - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); - if ( result < 0 ) { + if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 6."); + "H5C_get_entry_status() reports failure 6."); failure_mssg = msg; - } else if ( in_cache ) { + } else if ( in_cache ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 6."); @@ -13968,12 +14001,12 @@ check_expunge_entry(void) HDsnprintf(msg, (size_t)128, "Unexpected entry history 6."); failure_mssg = msg; - } + } } if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -14006,12 +14039,11 @@ check_expunge_entry(void) * *------------------------------------------------------------------------- */ - - static unsigned check_multiple_read_protect(void) { const char * fcn_name = "check_multiple_read_protect()"; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; test_entry_t * entry_ptr; @@ -14044,8 +14076,9 @@ check_multiple_read_protect(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; entry_ptr = &((entries[0])[0]); @@ -14070,7 +14103,7 @@ check_multiple_read_protect(void) if ( pass ) { - protect_entry_ro(cache_ptr, 0, 0); + protect_entry_ro(file_ptr, 0, 0); if ( ( ! ( entry_ptr->header.is_protected ) ) || ( ! ( entry_ptr->header.is_read_only ) ) || @@ -14093,7 +14126,7 @@ check_multiple_read_protect(void) if ( pass ) { - protect_entry_ro(cache_ptr, 0, 0); + protect_entry_ro(file_ptr, 0, 0); if ( ( ! ( entry_ptr->header.is_protected ) ) || ( ! ( entry_ptr->header.is_read_only ) ) || @@ -14116,7 +14149,7 @@ check_multiple_read_protect(void) if ( pass ) { - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); if ( ( ! ( entry_ptr->header.is_protected ) ) || ( ! ( entry_ptr->header.is_read_only ) ) || @@ -14139,7 +14172,7 @@ check_multiple_read_protect(void) if ( pass ) { - protect_entry_ro(cache_ptr, 0, 0); + protect_entry_ro(file_ptr, 0, 0); if ( ( ! ( entry_ptr->header.is_protected ) ) || ( ! ( entry_ptr->header.is_read_only ) ) || @@ -14162,7 +14195,7 @@ check_multiple_read_protect(void) if ( pass ) { - protect_entry_ro(cache_ptr, 0, 0); + protect_entry_ro(file_ptr, 0, 0); if ( ( ! ( entry_ptr->header.is_protected ) ) || ( ! ( entry_ptr->header.is_read_only ) ) || @@ -14185,7 +14218,7 @@ check_multiple_read_protect(void) if ( pass ) { - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); if ( ( ! ( entry_ptr->header.is_protected ) ) || ( ! ( entry_ptr->header.is_read_only ) ) || @@ -14208,7 +14241,7 @@ check_multiple_read_protect(void) if ( pass ) { - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); if ( ( ! ( entry_ptr->header.is_protected ) ) || ( ! ( entry_ptr->header.is_read_only ) ) || @@ -14231,7 +14264,7 @@ check_multiple_read_protect(void) if ( pass ) { - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); if ( ( entry_ptr->header.is_protected ) || ( entry_ptr->header.is_read_only ) || @@ -14259,7 +14292,7 @@ check_multiple_read_protect(void) if ( pass ) { - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); if ( ( ! ( entry_ptr->header.is_protected ) ) || ( entry_ptr->header.is_read_only ) || @@ -14282,7 +14315,7 @@ check_multiple_read_protect(void) if ( pass ) { - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); if ( ( entry_ptr->header.is_protected ) || ( entry_ptr->header.is_read_only ) || @@ -14314,36 +14347,36 @@ check_multiple_read_protect(void) if ( pass ) { - protect_entry(cache_ptr, 0, 2); /* (0,2) write */ - protect_entry_ro(cache_ptr, 0, 4); /* (0,4) read only (1) */ - protect_entry(cache_ptr, 0, 6); /* (0,6) write */ + protect_entry(file_ptr, 0, 2); /* (0,2) write */ + protect_entry_ro(file_ptr, 0, 4); /* (0,4) read only (1) */ + protect_entry(file_ptr, 0, 6); /* (0,6) write */ - unprotect_entry(cache_ptr, 0, 2, FALSE, /* (0,2) unprotect */ + unprotect_entry(file_ptr, 0, 2, FALSE, /* (0,2) unprotect */ H5C__NO_FLAGS_SET); - protect_entry_ro(cache_ptr, 0, 2); /* (0,2) read only (1) */ - protect_entry(cache_ptr, 0, 1); /* (0,1) write */ - protect_entry_ro(cache_ptr, 0, 4); /* (0,4) read only (2) */ - protect_entry(cache_ptr, 0, 0); /* (0,0) write */ - protect_entry_ro(cache_ptr, 0, 2); /* (0,2) read only (2) */ + protect_entry_ro(file_ptr, 0, 2); /* (0,2) read only (1) */ + protect_entry(file_ptr, 0, 1); /* (0,1) write */ + protect_entry_ro(file_ptr, 0, 4); /* (0,4) read only (2) */ + protect_entry(file_ptr, 0, 0); /* (0,0) write */ + protect_entry_ro(file_ptr, 0, 2); /* (0,2) read only (2) */ - unprotect_entry(cache_ptr, 0, 2, FALSE, /* (0,2) read only (1) pin */ + unprotect_entry(file_ptr, 0, 2, FALSE, /* (0,2) read only (1) pin */ H5C__PIN_ENTRY_FLAG); - unprotect_entry(cache_ptr, 0, 6, FALSE, /* (0,6) unprotect */ + unprotect_entry(file_ptr, 0, 6, FALSE, /* (0,6) unprotect */ H5C__NO_FLAGS_SET); - protect_entry_ro(cache_ptr, 0, 4); /* (0,4) read only (3) */ + protect_entry_ro(file_ptr, 0, 4); /* (0,4) read only (3) */ - unprotect_entry(cache_ptr, 0, 2, FALSE, /* (0,2) unprotect */ + unprotect_entry(file_ptr, 0, 2, FALSE, /* (0,2) unprotect */ H5C__NO_FLAGS_SET); - unprotect_entry(cache_ptr, 0, 1, FALSE, /* (0,1) unprotect */ + unprotect_entry(file_ptr, 0, 1, FALSE, /* (0,1) unprotect */ H5C__NO_FLAGS_SET); if ( pass ) { entry_ptr = &((entries[0])[4]); - if ( H5C_pin_protected_entry(cache_ptr, (void *)entry_ptr) < 0 ) { + if ( H5C_pin_protected_entry((void *)entry_ptr) < 0 ) { pass = FALSE; failure_mssg = "H5C_pin_protected_entry() failed.\n"; @@ -14361,9 +14394,9 @@ check_multiple_read_protect(void) } } - unprotect_entry(cache_ptr, 0, 4, FALSE, /* (0,4) read only (2) */ + unprotect_entry(file_ptr, 0, 4, FALSE, /* (0,4) read only (2) */ H5C__NO_FLAGS_SET); - unprotect_entry(cache_ptr, 0, 4, FALSE, /* (0,4) read only (1) */ + unprotect_entry(file_ptr, 0, 4, FALSE, /* (0,4) read only (1) */ H5C__UNPIN_ENTRY_FLAG); if ( ( pass ) && ( entry_ptr->header.is_pinned ) ) { @@ -14373,12 +14406,12 @@ check_multiple_read_protect(void) } - unprotect_entry(cache_ptr, 0, 4, FALSE, /* (0,4) unprotect */ + unprotect_entry(file_ptr, 0, 4, FALSE, /* (0,4) unprotect */ H5C__NO_FLAGS_SET); - unprotect_entry(cache_ptr, 0, 0, FALSE, /* (0,0) unprotect */ + unprotect_entry(file_ptr, 0, 0, FALSE, /* (0,0) unprotect */ H5C__NO_FLAGS_SET); - unpin_entry(cache_ptr, 0, 2); + unpin_entry(0, 2); } #if H5C_COLLECT_CACHE_STATS @@ -14394,7 +14427,7 @@ check_multiple_read_protect(void) if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -14432,7 +14465,7 @@ check_rename_entry(void) { const char * fcn_name = "check_rename_entry"; int i; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; struct rename_entry_test_spec test_specs[4] = { { @@ -14494,20 +14527,20 @@ check_rename_entry(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024)); } i = 0; while ( ( pass ) && ( i < 4 ) ) { - check_rename_entry__run_test(cache_ptr, i, &(test_specs[i])); + check_rename_entry__run_test(file_ptr, i, &(test_specs[i])); i++; } if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -14543,34 +14576,20 @@ check_rename_entry(void) */ static void -check_rename_entry__run_test(H5C_t * cache_ptr, +check_rename_entry__run_test(H5F_t * file_ptr, int test_num, struct rename_entry_test_spec * spec_ptr) { /* const char * fcn_name = "check_rename_entry__run_test"; */ + H5C_t *cache_ptr = file_ptr->shared->cache; static char msg[128]; unsigned int flags = H5C__NO_FLAGS_SET; test_entry_t * base_addr; test_entry_t * entry_ptr = NULL; H5C_cache_entry_t * test_ptr = NULL; - if ( cache_ptr == NULL ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "cache_ptr NULL on entry to rename test #%d.", - test_num); - failure_mssg = msg; - - } else if ( spec_ptr == NULL ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "spec_ptr NULL on entry to rename test #%d.", - test_num); - failure_mssg = msg; - - } + assert( cache_ptr ); + assert( spec_ptr ); if ( pass ) { @@ -14595,12 +14614,16 @@ check_rename_entry__run_test(H5C_t * cache_ptr, } } - protect_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index); + if ( pass ) { + + protect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index); - unprotect_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index, - (int)(spec_ptr->is_dirty), flags); + unprotect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index, + (int)(spec_ptr->is_dirty), flags); - rename_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index, FALSE); + rename_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index, FALSE); + + } if ( pass ) { @@ -14640,7 +14663,7 @@ check_rename_entry__run_test(H5C_t * cache_ptr, } } - unpin_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index); + unpin_entry(spec_ptr->entry_type, spec_ptr->entry_index); } else { @@ -14694,7 +14717,7 @@ check_pin_protected_entry(void) const char * fcn_name = "check_pin_protected_entry"; static char msg[128]; herr_t result; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -14711,18 +14734,18 @@ check_pin_protected_entry(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024)); } - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); if ( pass ) { base_addr = entries[0]; entry_ptr = &(base_addr[0]); - result = H5C_pin_protected_entry(cache_ptr, (void *)entry_ptr); + result = H5C_pin_protected_entry((void *)entry_ptr); if ( result < 0 ) { @@ -14743,11 +14766,11 @@ check_pin_protected_entry(void) } } - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__UNPIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__UNPIN_ENTRY_FLAG); if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -14793,6 +14816,7 @@ check_resize_entry(void) hbool_t is_pinned; size_t entry_size; size_t reported_entry_size; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -14836,8 +14860,9 @@ check_resize_entry(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024)); + cache_ptr = file_ptr->shared->cache; base_addr = entries[LARGE_ENTRY_TYPE]; entry_ptr = &(base_addr[0]); @@ -14858,7 +14883,7 @@ check_resize_entry(void) } } - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); if ( pass ) { @@ -14877,15 +14902,16 @@ check_resize_entry(void) if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, NULL, NULL); + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, + NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 1."); + "H5C_get_entry_status() reports failure 1."); failure_mssg = msg; } else if ( !in_cache || is_dirty || !is_protected || is_pinned ) { @@ -14908,11 +14934,9 @@ check_resize_entry(void) if ( pass ) { - result = H5C_unprotect(NULL, -1, -1, cache_ptr, - &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, - (void *)entry_ptr, - H5C__SIZE_CHANGED_FLAG | H5C__DIRTIED_FLAG, - (LARGE_ENTRY_SIZE / 2)); + result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, (void *)entry_ptr, + H5C__SIZE_CHANGED_FLAG | H5C__DIRTIED_FLAG, (LARGE_ENTRY_SIZE / 2)); if ( result < 0 ) { @@ -14947,15 +14971,16 @@ check_resize_entry(void) if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, NULL, NULL); + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, + NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 2."); + "H5C_get_entry_status() reports failure 2."); failure_mssg = msg; } else if ( !in_cache || !is_dirty || is_protected || is_pinned || @@ -14977,15 +15002,13 @@ check_resize_entry(void) } } - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); if ( pass ) { - result = H5C_unprotect(NULL, -1, -1, cache_ptr, - &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, - (void *)entry_ptr, - (H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG), - LARGE_ENTRY_SIZE); + result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, (void *)entry_ptr, + (H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG), LARGE_ENTRY_SIZE); if ( result < 0 ) { @@ -15020,15 +15043,16 @@ check_resize_entry(void) if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, NULL, NULL); + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, + NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 3."); + "H5C_get_entry_status() reports failure 3."); failure_mssg = msg; } else if ( !in_cache || !is_dirty || is_protected || is_pinned || @@ -15050,14 +15074,13 @@ check_resize_entry(void) } } - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__PIN_ENTRY_FLAG); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__PIN_ENTRY_FLAG); if ( pass ) { - result = H5C_resize_pinned_entry(cache_ptr, (void *)entry_ptr, - (LARGE_ENTRY_SIZE / 4)); + result = H5C_resize_pinned_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 4)); if ( result < 0 ) { @@ -15085,15 +15108,16 @@ check_resize_entry(void) if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, NULL, NULL); + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, + NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 4."); + "H5C_get_entry_status() reports failure 4."); failure_mssg = msg; } else if ( !in_cache || !is_dirty || is_protected || ! is_pinned || @@ -15117,8 +15141,7 @@ check_resize_entry(void) if ( pass ) { - result = H5C_resize_pinned_entry(cache_ptr, (void *)entry_ptr, - LARGE_ENTRY_SIZE); + result = H5C_resize_pinned_entry((void *)entry_ptr, LARGE_ENTRY_SIZE); if ( result < 0 ) { @@ -15146,15 +15169,16 @@ check_resize_entry(void) if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, NULL, NULL); + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, + NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 5."); + "H5C_get_entry_status() reports failure 5."); failure_mssg = msg; } else if ( !in_cache || !is_dirty || is_protected || ! is_pinned || @@ -15176,14 +15200,14 @@ check_resize_entry(void) } } - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, FALSE, + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG); if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); @@ -15191,7 +15215,7 @@ check_resize_entry(void) pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 6."); + "H5C_get_entry_status() reports failure 6."); failure_mssg = msg; } else if ( in_cache ) { @@ -15246,14 +15270,14 @@ check_resize_entry(void) entry_size = LARGE_ENTRY_SIZE; } - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__NO_FLAGS_SET); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__NO_FLAGS_SET); - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 1); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 1, TRUE, H5C__NO_FLAGS_SET); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, TRUE, H5C__NO_FLAGS_SET); - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 2); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 2, FALSE, H5C__NO_FLAGS_SET); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, FALSE, H5C__NO_FLAGS_SET); if ( pass ) { @@ -15270,7 +15294,7 @@ check_resize_entry(void) } } - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); if ( pass ) { @@ -15289,15 +15313,16 @@ check_resize_entry(void) if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, NULL, NULL); + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, + NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 7."); + "H5C_get_entry_status() reports failure 7."); failure_mssg = msg; } else if ( !in_cache || is_dirty || !is_protected || is_pinned ) { @@ -15320,11 +15345,9 @@ check_resize_entry(void) if ( pass ) { - result = H5C_unprotect(NULL, -1, -1, cache_ptr, - &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, - (void *)entry_ptr, - H5C__SIZE_CHANGED_FLAG | H5C__DIRTIED_FLAG, - (LARGE_ENTRY_SIZE / 2)); + result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, (void *)entry_ptr, + H5C__SIZE_CHANGED_FLAG | H5C__DIRTIED_FLAG, (LARGE_ENTRY_SIZE / 2)); if ( result < 0 ) { @@ -15361,15 +15384,16 @@ check_resize_entry(void) if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, NULL, NULL); + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, + NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 8."); + "H5C_get_entry_status() reports failure 8."); failure_mssg = msg; } else if ( !in_cache || !is_dirty || is_protected || is_pinned || @@ -15391,15 +15415,13 @@ check_resize_entry(void) } } - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); if ( pass ) { - result = H5C_unprotect(NULL, -1, -1, cache_ptr, - &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, - (void *)entry_ptr, - (H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG), - LARGE_ENTRY_SIZE); + result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, (void *)entry_ptr, + (H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG), LARGE_ENTRY_SIZE); if ( result < 0 ) { @@ -15434,15 +15456,16 @@ check_resize_entry(void) if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, NULL, NULL); + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, + NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 9."); + "H5C_get_entry_status() reports failure 9."); failure_mssg = msg; } else if ( !in_cache || !is_dirty || is_protected || is_pinned || @@ -15464,14 +15487,13 @@ check_resize_entry(void) } } - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3, FALSE, H5C__PIN_ENTRY_FLAG); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, FALSE, H5C__PIN_ENTRY_FLAG); if ( pass ) { - result = H5C_resize_pinned_entry(cache_ptr, (void *)entry_ptr, - (LARGE_ENTRY_SIZE / 4)); + result = H5C_resize_pinned_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 4)); if ( result < 0 ) { @@ -15501,15 +15523,16 @@ check_resize_entry(void) if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, NULL, NULL); + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, + NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 10."); + "H5C_get_entry_status() reports failure 10."); failure_mssg = msg; } else if ( !in_cache || !is_dirty || is_protected || ! is_pinned || @@ -15533,8 +15556,7 @@ check_resize_entry(void) if ( pass ) { - result = H5C_resize_pinned_entry(cache_ptr, (void *)entry_ptr, - LARGE_ENTRY_SIZE); + result = H5C_resize_pinned_entry((void *)entry_ptr, LARGE_ENTRY_SIZE); if ( result < 0 ) { @@ -15562,15 +15584,16 @@ check_resize_entry(void) if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, NULL, NULL); + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, + NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 11."); + "H5C_get_entry_status() reports failure 11."); failure_mssg = msg; } else if ( !in_cache || !is_dirty || is_protected || ! is_pinned || @@ -15592,14 +15615,14 @@ check_resize_entry(void) } } - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3, FALSE, + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, FALSE, H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG); if ( pass ) { - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); @@ -15607,7 +15630,7 @@ check_resize_entry(void) pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 12."); + "H5C_get_entry_status() reports failure 12."); failure_mssg = msg; } else if ( in_cache ) { @@ -15642,14 +15665,14 @@ check_resize_entry(void) } } - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 2); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 2, FALSE, H5C__DELETED_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, FALSE, H5C__DELETED_FLAG); - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 1); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 1, FALSE, H5C__DELETED_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, FALSE, H5C__DELETED_FLAG); - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__DELETED_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__DELETED_FLAG); if ( pass ) { @@ -15668,7 +15691,7 @@ check_resize_entry(void) if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -15713,6 +15736,7 @@ check_evictions_enabled(void) hbool_t in_cache; int i; int mile_stone = 1; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -15765,8 +15789,9 @@ check_evictions_enabled(void) reset_entries(); - cache_ptr = setup_cache((size_t)(1 * 1024 * 1024), + file_ptr = setup_cache((size_t)(1 * 1024 * 1024), (size_t)( 512 * 1024)); + cache_ptr = file_ptr->shared->cache; base_addr = entries[MONSTER_ENTRY_TYPE]; } @@ -15815,8 +15840,8 @@ check_evictions_enabled(void) /* fill the cache */ for ( i = 0; i < 16 ; i++ ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, FALSE, H5C__NO_FLAGS_SET); } @@ -15846,8 +15871,8 @@ check_evictions_enabled(void) fcn_name, mile_stone++, (int)pass); /* protect and unprotect another entry */ - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 16); - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 16, + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16, FALSE, H5C__NO_FLAGS_SET); if ( show_progress ) /* 7 */ @@ -15878,14 +15903,15 @@ check_evictions_enabled(void) entry_ptr = &(base_addr[0]); - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - NULL, &in_cache, NULL, NULL, NULL, NULL, NULL); + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, + NULL, &in_cache, NULL, NULL, NULL, + NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 1."); + "H5C_get_entry_status() reports failure 1."); failure_mssg = msg; } else if ( in_cache ) { @@ -15911,7 +15937,7 @@ check_evictions_enabled(void) fcn_name, mile_stone++, (int)pass); /* insert an entry */ - insert_entry(cache_ptr, MONSTER_ENTRY_TYPE, 17, TRUE, H5C__NO_FLAGS_SET); + insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 17, TRUE, H5C__NO_FLAGS_SET); if ( show_progress ) /* 10 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15941,14 +15967,14 @@ check_evictions_enabled(void) entry_ptr = &(base_addr[1]); - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 2."); + "H5C_get_entry_status() reports failure 2."); failure_mssg = msg; } else if ( in_cache ) { @@ -16011,8 +16037,8 @@ check_evictions_enabled(void) fcn_name, mile_stone++, (int)pass); /* protect and unprotect another entry */ - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 18); - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 18, + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18, FALSE, H5C__NO_FLAGS_SET); if ( show_progress ) /* 15 */ @@ -16040,7 +16066,7 @@ check_evictions_enabled(void) fcn_name, mile_stone++, (int)pass); /* insert another entry */ - insert_entry(cache_ptr, MONSTER_ENTRY_TYPE, 19, TRUE, H5C__NO_FLAGS_SET); + insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 19, TRUE, H5C__NO_FLAGS_SET); if ( show_progress ) /* 17 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -16084,8 +16110,8 @@ check_evictions_enabled(void) fcn_name, mile_stone++, (int)pass); /* protect and unprotect an entry that is in the cache */ - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 19); - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 19, + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19, FALSE, H5C__NO_FLAGS_SET); if ( show_progress ) /* 20 */ @@ -16113,8 +16139,8 @@ check_evictions_enabled(void) fcn_name, mile_stone++, (int)pass); /* protect and unprotect an entry that isn't in the cache */ - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 20); - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 20, + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20, FALSE, H5C__NO_FLAGS_SET); if ( show_progress ) /* 22 */ @@ -16148,14 +16174,14 @@ check_evictions_enabled(void) entry_ptr = &(base_addr[2]); - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 3."); + "H5C_get_entry_status() reports failure 3."); failure_mssg = msg; } else if ( in_cache ) { @@ -16184,14 +16210,14 @@ check_evictions_enabled(void) entry_ptr = &(base_addr[3]); - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 4."); + "H5C_get_entry_status() reports failure 4."); failure_mssg = msg; } else if ( in_cache ) { @@ -16236,8 +16262,8 @@ check_evictions_enabled(void) /* protect and unprotect an entry that isn't in the cache, forcing * the cache to grow. */ - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 21); - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 21, + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21, FALSE, H5C__NO_FLAGS_SET); @@ -16283,7 +16309,7 @@ check_evictions_enabled(void) fcn_name, mile_stone++, (int)pass); /* insert an entry */ - insert_entry(cache_ptr, MONSTER_ENTRY_TYPE, 22, TRUE, H5C__NO_FLAGS_SET); + insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 22, TRUE, H5C__NO_FLAGS_SET); if ( show_progress ) /* 30 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -16313,14 +16339,14 @@ check_evictions_enabled(void) entry_ptr = &(base_addr[4]); - result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL, NULL); if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5AC_get_entry_status() reports failure 5."); + "H5C_get_entry_status() reports failure 5."); failure_mssg = msg; } else if ( in_cache ) { @@ -16364,7 +16390,7 @@ check_evictions_enabled(void) if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( show_progress ) /* 34 */ @@ -16404,7 +16430,7 @@ static unsigned check_flush_protected_err(void) { const char * fcn_name = "check_flush_protected_err"; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; TESTING("flush cache with protected entry error"); @@ -16419,30 +16445,30 @@ check_flush_protected_err(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); - if ( H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET) - >= 0 ) { + if ( H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + H5C__NO_FLAGS_SET) >= 0 ) { pass = FALSE; failure_mssg = "flush succeeded on cache with protected entry.\n"; } else { - unprotect_entry(cache_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); - if ( H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET) - < 0 ) { + if ( H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + H5C__NO_FLAGS_SET) < 0 ) { pass = FALSE; failure_mssg = "flush failed after unprotect.\n"; } else { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } } } @@ -16477,11 +16503,13 @@ check_flush_protected_err(void) *------------------------------------------------------------------------- */ +extern H5C_t * saved_cache; + static unsigned check_destroy_pinned_err(void) { const char * fcn_name = "check_destroy_pinned_err()"; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; TESTING("destroy cache with permanently pinned entry error"); @@ -16496,28 +16524,44 @@ check_destroy_pinned_err(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - protect_entry(cache_ptr, 0, 0); - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); + protect_entry(file_ptr, 0, 0); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); - if ( H5C_dest(NULL, -1, -1, cache_ptr) >= 0 ) { + if ( H5C_dest(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT) >= 0 ) { pass = FALSE; failure_mssg = "destroy succeeded on cache with pinned entry.\n"; } else { - unpin_entry(cache_ptr, 0, 0); + unpin_entry(0, 0); - if ( H5C_dest(NULL, -1, -1, cache_ptr) < 0 ) { + if ( H5C_dest(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT) < 0 ) { pass = FALSE; failure_mssg = "destroy failed after unpin.\n"; - } + } else { + file_ptr->shared->cache = NULL; + } } + + if ( saved_cache != NULL ) { + + file_ptr->shared->cache = saved_cache; + saved_cache = NULL; + + } + + /* call takedown_cache() with a NULL file_ptr parameter. + * This causes the function to close and delete the file, + * while skipping the call to H5C_dest(). + */ + takedown_cache(NULL, FALSE, FALSE); + } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -16553,7 +16597,7 @@ static unsigned check_destroy_protected_err(void) { const char * fcn_name = "check_destroy_protected_err"; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; TESTING("destroy cache with protected entry error"); @@ -16568,27 +16612,42 @@ check_destroy_protected_err(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); - if ( H5C_dest(NULL, -1, -1, cache_ptr) >= 0 ) { + if ( H5C_dest(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT) >= 0 ) { pass = FALSE; failure_mssg = "destroy succeeded on cache with protected entry.\n"; } else { - unprotect_entry(cache_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); - if ( H5C_dest(NULL, -1, -1, cache_ptr) < 0 ) { + if ( H5C_dest(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT) < 0 ) { pass = FALSE; failure_mssg = "destroy failed after unprotect.\n"; - } + } else { + file_ptr->shared->cache = NULL; + } } + + if ( saved_cache != NULL ) { + + file_ptr->shared->cache = saved_cache; + saved_cache = NULL; + + } + + /* call takedown_cache() with a NULL file_ptr parameter. + * This causes the function to close and delete the file, + * while skipping the call to H5C_dest(). + */ + takedown_cache(NULL, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -16625,7 +16684,7 @@ check_duplicate_insert_err(void) { const char * fcn_name = "check_duplicate_insert_err"; herr_t result = -1; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -16642,19 +16701,18 @@ check_duplicate_insert_err(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); if ( pass ) { base_addr = entries[0]; entry_ptr = &(base_addr[0]); - result = H5C_insert_entry(NULL, -1, -1, cache_ptr, - &(types[0]), entry_ptr->addr, - (void *)entry_ptr, H5C__NO_FLAGS_SET); + result = H5C_insert_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[0]), entry_ptr->addr, (void *)entry_ptr, H5C__NO_FLAGS_SET); if ( result >= 0 ) { @@ -16663,9 +16721,9 @@ check_duplicate_insert_err(void) } else { - unprotect_entry(cache_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } } } @@ -16704,6 +16762,7 @@ check_rename_err(void) { const char * fcn_name = "check_rename_err()"; herr_t result; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; test_entry_t * entry_0_0_ptr; test_entry_t * entry_0_1_ptr; @@ -16722,12 +16781,13 @@ check_rename_err(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; - insert_entry(cache_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); - insert_entry(cache_ptr, 0, 1, TRUE, H5C__NO_FLAGS_SET); - insert_entry(cache_ptr, 1, 0, TRUE, H5C__NO_FLAGS_SET); + insert_entry(file_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); + insert_entry(file_ptr, 0, 1, TRUE, H5C__NO_FLAGS_SET); + insert_entry(file_ptr, 1, 0, TRUE, H5C__NO_FLAGS_SET); entry_0_0_ptr = &((entries[0])[0]); entry_0_1_ptr = &((entries[0])[1]); @@ -16760,7 +16820,7 @@ check_rename_err(void) if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -16799,7 +16859,7 @@ check_double_pin_err(void) { const char * fcn_name = "check_double_pin_err()"; herr_t result; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; test_entry_t * entry_ptr; TESTING("pin a pinned entry error"); @@ -16816,23 +16876,23 @@ check_double_pin_err(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); entry_ptr = &((entries[0])[0]); } if ( pass ) { - result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[0]), - entry_ptr->addr, (void *)entry_ptr, - H5C__PIN_ENTRY_FLAG, (size_t)0); + result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[0]), entry_ptr->addr, (void *)entry_ptr, + H5C__PIN_ENTRY_FLAG, (size_t)0); if ( result > 0 ) { @@ -16842,13 +16902,13 @@ check_double_pin_err(void) } else { - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__UNPIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__UNPIN_ENTRY_FLAG); } } if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -16887,7 +16947,7 @@ check_double_unpin_err(void) { const char * fcn_name = "check_double_unpin_err()"; herr_t result; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; test_entry_t * entry_ptr; TESTING("unpin an unpinned entry error"); @@ -16906,19 +16966,19 @@ check_double_unpin_err(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); entry_ptr = &((entries[0])[0]); } if ( pass ) { - result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[0]), - entry_ptr->addr, (void *)entry_ptr, - H5C__UNPIN_ENTRY_FLAG, (size_t)0); + result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[0]), entry_ptr->addr, (void *)entry_ptr, + H5C__UNPIN_ENTRY_FLAG, (size_t)0); if ( result > 0 ) { @@ -16928,13 +16988,13 @@ check_double_unpin_err(void) } else { - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); } } if ( pass ) { - result = H5C_unpin_entry(cache_ptr, (void *)entry_ptr); + result = H5C_unpin_entry((void *)entry_ptr); if ( result > 0 ) { @@ -16947,7 +17007,7 @@ check_double_unpin_err(void) if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -16986,7 +17046,7 @@ check_pin_entry_errs(void) { const char * fcn_name = "check_pin_entry_errs()"; herr_t result; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; test_entry_t * entry_ptr; TESTING("pin entry related errors"); @@ -17009,19 +17069,19 @@ check_pin_entry_errs(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); entry_ptr = &((entries[0])[0]); } if ( pass ) { - result = H5C_pin_protected_entry(cache_ptr, (void *)entry_ptr); + result = H5C_pin_protected_entry((void *)entry_ptr); if ( result > 0 ) { @@ -17031,17 +17091,17 @@ check_pin_entry_errs(void) } else { - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); } } if ( pass ) { - result = H5C_pin_protected_entry(cache_ptr, (void *)entry_ptr); + result = H5C_pin_protected_entry((void *)entry_ptr); if ( result > 0 ) { @@ -17051,14 +17111,14 @@ check_pin_entry_errs(void) } else { - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__UNPIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__UNPIN_ENTRY_FLAG); } } if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -17099,7 +17159,7 @@ static unsigned check_double_protect_err(void) { const char * fcn_name = "check_double_protect_err()"; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; test_entry_t * entry_ptr; H5C_cache_entry_t * cache_entry_ptr; @@ -17116,19 +17176,18 @@ check_double_protect_err(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); entry_ptr = &((entries[0])[0]); } if ( pass ) { - cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(NULL, -1, -1, cache_ptr, &(types[0]), - entry_ptr->addr, NULL, NULL, - H5C__NO_FLAGS_SET); + cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[0]), entry_ptr->addr, NULL, NULL, H5C__NO_FLAGS_SET); if ( cache_entry_ptr != NULL ) { @@ -17139,12 +17198,12 @@ check_double_protect_err(void) if ( pass ) { - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); } if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -17189,7 +17248,7 @@ check_double_unprotect_err(void) { const char * fcn_name = "check_double_unprotect_err()"; herr_t result; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; test_entry_t * entry_ptr; TESTING("unprotect an unprotected entry error"); @@ -17205,21 +17264,21 @@ check_double_unprotect_err(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); entry_ptr = &((entries[0])[0]); } if ( pass ) { - result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[0]), - entry_ptr->addr, (void *)entry_ptr, - H5C__NO_FLAGS_SET, (size_t)0); + result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[0]), entry_ptr->addr, (void *)entry_ptr, + H5C__NO_FLAGS_SET, (size_t)0); if ( result > 0 ) { @@ -17231,7 +17290,7 @@ check_double_unprotect_err(void) if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -17279,7 +17338,7 @@ check_mark_entry_dirty_errs(void) { const char * fcn_name = "check_mark_entry_dirty_errs()"; herr_t result; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; test_entry_t * entry_ptr; TESTING("mark entry dirty related errors"); @@ -17302,22 +17361,21 @@ check_mark_entry_dirty_errs(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); entry_ptr = &((entries[0])[0]); } if ( pass ) { - result = H5C_mark_pinned_entry_dirty(cache_ptr, (void *)entry_ptr, - FALSE, (size_t)0); + result = H5C_mark_pinned_entry_dirty((void *)entry_ptr, FALSE, (size_t)0); if ( result > 0 ) { @@ -17327,14 +17385,13 @@ check_mark_entry_dirty_errs(void) } else { - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__UNPIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__UNPIN_ENTRY_FLAG); } } if ( pass ) { - result = H5C_mark_pinned_entry_dirty(cache_ptr, (void *)entry_ptr, - FALSE, (size_t)0); + result = H5C_mark_pinned_entry_dirty((void *)entry_ptr, FALSE, (size_t)0); if ( result > 0 ) { @@ -17347,8 +17404,7 @@ check_mark_entry_dirty_errs(void) if ( pass ) { - result = H5C_mark_pinned_or_protected_entry_dirty(cache_ptr, - (void *)entry_ptr); + result = H5C_mark_pinned_or_protected_entry_dirty((void *)entry_ptr); if ( result > 0 ) { @@ -17361,7 +17417,7 @@ check_mark_entry_dirty_errs(void) if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -17400,7 +17456,7 @@ check_expunge_entry_errs(void) { const char * fcn_name = "check_expunge_entry_errs()"; herr_t result; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; test_entry_t * entry_ptr; TESTING("expunge entry related errors"); @@ -17423,19 +17479,19 @@ check_expunge_entry_errs(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); entry_ptr = &((entries[0])[0]); - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); } if ( pass ) { - result = H5C_expunge_entry(NULL, -1, -1, cache_ptr, - &(types[0]), entry_ptr->addr, H5AC__NO_FLAGS_SET); + result = H5C_expunge_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[0]), entry_ptr->addr, H5C__NO_FLAGS_SET); if ( result > 0 ) { @@ -17445,15 +17501,15 @@ check_expunge_entry_errs(void) } else { - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); } } if ( pass ) { - result = H5C_expunge_entry(NULL, -1, -1, cache_ptr, - &(types[0]), entry_ptr->addr, H5AC__NO_FLAGS_SET); + result = H5C_expunge_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[0]), entry_ptr->addr, H5C__NO_FLAGS_SET); if ( result > 0 ) { @@ -17463,15 +17519,15 @@ check_expunge_entry_errs(void) } else { - unpin_entry(cache_ptr, 0, 0); + unpin_entry(0, 0); } } if ( pass ) { - result = H5C_expunge_entry(NULL, -1, -1, cache_ptr, - &(types[0]), entry_ptr->addr, H5AC__NO_FLAGS_SET); + result = H5C_expunge_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[0]), entry_ptr->addr, H5C__NO_FLAGS_SET); if ( result < 0 ) { @@ -17485,7 +17541,7 @@ check_expunge_entry_errs(void) if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -17524,7 +17580,7 @@ check_resize_entry_errs(void) { const char * fcn_name = "check_resize_entry_errs()"; herr_t result; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; test_entry_t * entry_ptr; TESTING("resize entry related errors"); @@ -17546,18 +17602,18 @@ check_resize_entry_errs(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); entry_ptr = &((entries[0])[0]); - protect_entry(cache_ptr, 0, 0); + protect_entry(file_ptr, 0, 0); } if ( pass ) { - result = H5C_resize_pinned_entry(cache_ptr, (void *)entry_ptr, (size_t)1); + result = H5C_resize_pinned_entry((void *)entry_ptr, (size_t)1); if ( result > 0 ) { @@ -17567,14 +17623,14 @@ check_resize_entry_errs(void) } else { - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); } } if ( pass ) { - result = H5C_resize_pinned_entry(cache_ptr, (void *)entry_ptr, (size_t)0); + result = H5C_resize_pinned_entry((void *)entry_ptr, (size_t)0); if ( result > 0 ) { @@ -17584,14 +17640,14 @@ check_resize_entry_errs(void) } else { - unpin_entry(cache_ptr, 0, 0); + unpin_entry(0, 0); } } if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -17630,7 +17686,7 @@ check_unprotect_ro_dirty_err(void) { const char * fcn_name = "check_unprotect_ro_dirty_err()"; herr_t result; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; test_entry_t * entry_ptr; TESTING("unprotect a read only entry dirty error"); @@ -17646,19 +17702,19 @@ check_unprotect_ro_dirty_err(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - protect_entry_ro(cache_ptr, 0, 0); + protect_entry_ro(file_ptr, 0, 0); entry_ptr = &((entries[0])[0]); } if ( pass ) { - result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[0]), - entry_ptr->addr, (void *)entry_ptr, - H5C__DIRTIED_FLAG, (size_t)0); + result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[0]), entry_ptr->addr, (void *)entry_ptr, + H5C__DIRTIED_FLAG, (size_t)0); if ( result >= 0 ) { @@ -17670,13 +17726,13 @@ check_unprotect_ro_dirty_err(void) if ( pass ) { - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); } if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } /* allocate a another cache, protect an entry read only twice, and @@ -17689,20 +17745,20 @@ check_unprotect_ro_dirty_err(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - protect_entry_ro(cache_ptr, 0, 0); - protect_entry_ro(cache_ptr, 0, 0); + protect_entry_ro(file_ptr, 0, 0); + protect_entry_ro(file_ptr, 0, 0); entry_ptr = &((entries[0])[0]); } if ( pass ) { - result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[0]), - entry_ptr->addr, (void *)entry_ptr, - H5C__DIRTIED_FLAG, (size_t)0); + result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[0]), entry_ptr->addr, (void *)entry_ptr, + H5C__DIRTIED_FLAG, (size_t)0); if ( result > 0 ) { @@ -17714,14 +17770,14 @@ check_unprotect_ro_dirty_err(void) if ( pass ) { - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); } if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -17759,7 +17815,7 @@ static unsigned check_protect_ro_rw_err(void) { const char * fcn_name = "check_protect_ro_rw_err()"; - H5C_t * cache_ptr = NULL; + H5F_t * file_ptr = NULL; test_entry_t * entry_ptr; void * thing_ptr = NULL; @@ -17777,18 +17833,18 @@ check_protect_ro_rw_err(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - protect_entry_ro(cache_ptr, 0, 0); + protect_entry_ro(file_ptr, 0, 0); entry_ptr = &((entries[0])[0]); } if ( pass ) { - thing_ptr = H5C_protect(NULL, -1, -1, cache_ptr, &(types[0]), - entry_ptr->addr, NULL, NULL, H5C__NO_FLAGS_SET); + thing_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[0]), entry_ptr->addr, NULL, NULL, H5C__NO_FLAGS_SET); if ( thing_ptr != NULL ) { @@ -17799,12 +17855,12 @@ check_protect_ro_rw_err(void) if ( pass ) { - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); } if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -17844,6 +17900,7 @@ check_check_evictions_enabled_err(void) const char * fcn_name = "check_evictions_enabled_err()"; herr_t result; hbool_t evictions_enabled; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; TESTING("get/set evictions enabled errors"); @@ -17867,8 +17924,9 @@ check_check_evictions_enabled_err(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; } if ( pass ) { @@ -17914,7 +17972,7 @@ check_check_evictions_enabled_err(void) if ( result == SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_evictions_enabled succeeded() 1.\n"; + failure_mssg = "H5C_get_evictions_enabled succeeded() 1.\n"; } else if ( cache_ptr->evictions_enabled == TRUE ) { @@ -17932,16 +17990,16 @@ check_check_evictions_enabled_err(void) if ( result == SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_evictions_enabled succeeded() 2.\n"; + failure_mssg = "H5C_get_evictions_enabled succeeded() 2.\n"; } (cache_ptr->resize_ctl).decr_mode = H5C_decr__off; } - if ( pass ) { + if ( cache_ptr ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -18003,6 +18061,7 @@ check_auto_cache_resize(void) herr_t result; int32_t i; int32_t checkpoint = 0; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; H5C_auto_size_ctl_t auto_size_ctl = { @@ -18065,8 +18124,9 @@ check_auto_cache_resize(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; } if ( pass ) { @@ -18101,10 +18161,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, PICO_ENTRY_TYPE, i); + protect_entry(file_ptr, PICO_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, PICO_ENTRY_TYPE, i, + unprotect_entry(file_ptr, PICO_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18131,10 +18191,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18161,10 +18221,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, PICO_ENTRY_TYPE, i); + protect_entry(file_ptr, PICO_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, PICO_ENTRY_TYPE, i, + unprotect_entry(file_ptr, PICO_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18191,10 +18251,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18221,10 +18281,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18251,10 +18311,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18282,10 +18342,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18312,10 +18372,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18342,10 +18402,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18373,10 +18433,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18473,10 +18533,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18504,10 +18564,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18535,10 +18595,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18566,10 +18626,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18596,10 +18656,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18626,10 +18686,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18656,10 +18716,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 900 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18667,10 +18727,10 @@ check_auto_cache_resize(void) while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i + 1000); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i + 1000); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i + 1000, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i + 1000, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18697,10 +18757,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18727,10 +18787,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18827,10 +18887,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18857,10 +18917,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18887,10 +18947,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -18917,10 +18977,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19024,10 +19084,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19051,10 +19111,10 @@ check_auto_cache_resize(void) i = 1000; while ( ( pass ) && ( i < 2000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19078,10 +19138,10 @@ check_auto_cache_resize(void) i = 2000; while ( ( pass ) && ( i < 3000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19109,10 +19169,10 @@ check_auto_cache_resize(void) i = 3000; while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19139,10 +19199,10 @@ check_auto_cache_resize(void) i = 3000; while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19168,10 +19228,10 @@ check_auto_cache_resize(void) i = 3000; while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19197,10 +19257,10 @@ check_auto_cache_resize(void) i = 3000; while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19227,10 +19287,10 @@ check_auto_cache_resize(void) i = 3000; while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19258,10 +19318,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19285,10 +19345,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19312,10 +19372,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19342,10 +19402,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19451,10 +19511,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19478,10 +19538,10 @@ check_auto_cache_resize(void) i = 1000; while ( ( pass ) && ( i < 2000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19505,10 +19565,10 @@ check_auto_cache_resize(void) i = 2000; while ( ( pass ) && ( i < 3000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19536,10 +19596,10 @@ check_auto_cache_resize(void) i = 3000; while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19566,10 +19626,10 @@ check_auto_cache_resize(void) i = 3000; while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19595,10 +19655,10 @@ check_auto_cache_resize(void) i = 2000; while ( ( pass ) && ( i < 3000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19624,10 +19684,10 @@ check_auto_cache_resize(void) i = 3000; while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19653,10 +19713,10 @@ check_auto_cache_resize(void) i = 2000; while ( ( pass ) && ( i < 3000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19682,10 +19742,10 @@ check_auto_cache_resize(void) i = 3000; while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19711,10 +19771,10 @@ check_auto_cache_resize(void) i = 2000; while ( ( pass ) && ( i < 3000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19740,10 +19800,10 @@ check_auto_cache_resize(void) i = 3000; while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19770,10 +19830,10 @@ check_auto_cache_resize(void) i = 2000; while ( ( pass ) && ( i < 3000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19801,10 +19861,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19828,10 +19888,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19857,10 +19917,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19887,10 +19947,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -19995,10 +20055,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20022,10 +20082,10 @@ check_auto_cache_resize(void) i = 1000; while ( ( pass ) && ( i < 2000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20049,10 +20109,10 @@ check_auto_cache_resize(void) i = 2000; while ( ( pass ) && ( i < 3000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20080,10 +20140,10 @@ check_auto_cache_resize(void) i = 3000; while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20110,10 +20170,10 @@ check_auto_cache_resize(void) i = 3000; while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20139,10 +20199,10 @@ check_auto_cache_resize(void) i = 3000; while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20168,10 +20228,10 @@ check_auto_cache_resize(void) i = 3000; while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20198,10 +20258,10 @@ check_auto_cache_resize(void) i = 3000; while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20229,10 +20289,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20256,10 +20316,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20283,10 +20343,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20313,10 +20373,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20420,10 +20480,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20447,10 +20507,10 @@ check_auto_cache_resize(void) i = 1000; while ( ( pass ) && ( i < 2000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20474,10 +20534,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20502,10 +20562,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20530,10 +20590,10 @@ check_auto_cache_resize(void) i = 1000; while ( ( pass ) && ( i < 2000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20558,10 +20618,10 @@ check_auto_cache_resize(void) i = 1002; while ( ( pass ) && ( i < 2002 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20587,10 +20647,10 @@ check_auto_cache_resize(void) i = 1003; while ( ( pass ) && ( i < 2003 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20689,10 +20749,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20716,10 +20776,10 @@ check_auto_cache_resize(void) i = 1000; while ( ( pass ) && ( i < 2000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20751,10 +20811,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20782,10 +20842,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20813,10 +20873,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20845,10 +20905,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20875,10 +20935,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20906,10 +20966,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20938,10 +20998,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -20970,10 +21030,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -21002,10 +21062,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -21032,10 +21092,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -21062,10 +21122,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -21092,10 +21152,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -21122,10 +21182,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -21152,10 +21212,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -21176,7 +21236,7 @@ check_auto_cache_resize(void) if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } /* now test the flash cache size increment code. At least at present, @@ -21201,8 +21261,9 @@ check_auto_cache_resize(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21282,10 +21343,10 @@ check_auto_cache_resize(void) /* Load a huge entry into the cache */ if ( pass ) { - protect_entry(cache_ptr, HUGE_ENTRY_TYPE, 0); + protect_entry(file_ptr, HUGE_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, HUGE_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } @@ -21310,10 +21371,10 @@ check_auto_cache_resize(void) */ if ( pass ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } @@ -21339,9 +21400,9 @@ check_auto_cache_resize(void) */ if ( pass ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 1); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 1); - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 1, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 1, NO_CHANGE, H5C__NO_FLAGS_SET); if ( ( pass ) && @@ -21364,9 +21425,9 @@ check_auto_cache_resize(void) */ if ( pass ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 2); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 2); - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 2, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 2, NO_CHANGE, H5C__NO_FLAGS_SET); if ( ( pass ) && @@ -21388,13 +21449,12 @@ check_auto_cache_resize(void) */ if ( pass ) { - expunge_entry(cache_ptr, MONSTER_ENTRY_TYPE, 1); - expunge_entry(cache_ptr, MONSTER_ENTRY_TYPE, 2); + expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 1); + expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 2); if ( pass ) { - result = H5C_set_cache_auto_resize_config(cache_ptr, - &auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if ( result != SUCCEED ) { @@ -21424,14 +21484,13 @@ check_auto_cache_resize(void) /* insert a huge entry into the cache */ if ( pass ) { - insert_entry(cache_ptr, HUGE_ENTRY_TYPE, 1, TRUE, - H5C__NO_FLAGS_SET); + insert_entry(file_ptr, HUGE_ENTRY_TYPE, 1, TRUE, H5C__NO_FLAGS_SET); /* protect and unprotect a couple times to increment cache_accesses */ - protect_entry(cache_ptr, HUGE_ENTRY_TYPE, 1); - unprotect_entry(cache_ptr, HUGE_ENTRY_TYPE, 1, + protect_entry(file_ptr, HUGE_ENTRY_TYPE, 1); + unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, 1, NO_CHANGE, H5C__NO_FLAGS_SET); - protect_entry(cache_ptr, HUGE_ENTRY_TYPE, 1); - unprotect_entry(cache_ptr, HUGE_ENTRY_TYPE, 1, + protect_entry(file_ptr, HUGE_ENTRY_TYPE, 1); + unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, 1, NO_CHANGE, H5C__NO_FLAGS_SET); if ( ( pass ) && @@ -21455,8 +21514,7 @@ check_auto_cache_resize(void) */ if ( pass ) { - insert_entry(cache_ptr, MONSTER_ENTRY_TYPE, 4, TRUE, - H5C__NO_FLAGS_SET); + insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 4, TRUE, H5C__NO_FLAGS_SET); if ( ( pass ) && ( ( ( cache_ptr->max_cache_size != (80 * 1024) ) || @@ -21477,8 +21535,7 @@ check_auto_cache_resize(void) */ if ( pass ) { - insert_entry(cache_ptr, MONSTER_ENTRY_TYPE, 5, TRUE, - H5C__NO_FLAGS_SET); + insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 5, TRUE, H5C__NO_FLAGS_SET); if ( ( pass ) && ( ( ( cache_ptr->max_cache_size != (144 * 1024) ) || @@ -21500,9 +21557,9 @@ check_auto_cache_resize(void) */ if ( pass ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 6); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 6); - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 6, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 6, NO_CHANGE, H5C__NO_FLAGS_SET); if ( ( pass ) && @@ -21526,33 +21583,32 @@ check_auto_cache_resize(void) */ if ( pass ) { - expunge_entry(cache_ptr, MONSTER_ENTRY_TYPE, 5); - expunge_entry(cache_ptr, MONSTER_ENTRY_TYPE, 6); + expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 5); + expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 6); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1024); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1024); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1024); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 13); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 13, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 13, H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1024); - flush_cache(cache_ptr, TRUE, FALSE, FALSE); + flush_cache(file_ptr, TRUE, FALSE, FALSE); if ( pass ) { auto_size_ctl.initial_size = 6 * 1024; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if ( result != SUCCEED ) { @@ -21578,20 +21634,20 @@ check_auto_cache_resize(void) /* Now load the variable entries into the cache */ if ( pass ) { - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, H5C__NO_FLAGS_SET); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, H5C__NO_FLAGS_SET); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, H5C__NO_FLAGS_SET); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 13); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 13, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, NO_CHANGE, H5C__NO_FLAGS_SET); if ( ( pass ) && @@ -21613,8 +21669,8 @@ check_auto_cache_resize(void) */ if ( pass ) { - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 3 * 1024); @@ -21638,8 +21694,8 @@ check_auto_cache_resize(void) */ if ( pass ) { - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 10 * 1024); @@ -21662,8 +21718,8 @@ check_auto_cache_resize(void) */ if ( pass ) { - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 10 * 1024); @@ -21686,8 +21742,8 @@ check_auto_cache_resize(void) */ if ( pass ) { - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 10 * 1024); @@ -21711,21 +21767,20 @@ check_auto_cache_resize(void) */ if ( pass ) { - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); if ( pass ) { auto_size_ctl.initial_size = 6 * 1024; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if ( result != SUCCEED ) { @@ -21752,10 +21807,10 @@ check_auto_cache_resize(void) */ if ( pass ) { - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, H5C__PIN_ENTRY_FLAG); - resize_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024, TRUE); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024, TRUE); if ( ( pass ) && ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || @@ -21773,7 +21828,7 @@ check_auto_cache_resize(void) if ( pass ) { - resize_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024, TRUE); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024, TRUE); if ( ( pass ) && ( ( ( cache_ptr->max_cache_size != (13 * 1024) ) || @@ -21791,10 +21846,10 @@ check_auto_cache_resize(void) if ( pass ) { - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, H5C__PIN_ENTRY_FLAG); - resize_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024, TRUE); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024, TRUE); if ( ( pass ) && ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || @@ -21812,10 +21867,10 @@ check_auto_cache_resize(void) if ( pass ) { - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, H5C__PIN_ENTRY_FLAG); - resize_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024, TRUE); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024, TRUE); if ( ( pass ) && ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || @@ -21836,16 +21891,16 @@ check_auto_cache_resize(void) */ if ( pass ) { - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, H5C__UNPIN_ENTRY_FLAG); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, H5C__UNPIN_ENTRY_FLAG); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, H5C__UNPIN_ENTRY_FLAG); if ( ( pass ) && @@ -21868,21 +21923,20 @@ check_auto_cache_resize(void) */ if ( pass ) { - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); - unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); if ( pass ) { auto_size_ctl.initial_size = 6 * 1024; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if ( result != SUCCEED ) { @@ -21905,8 +21959,8 @@ check_auto_cache_resize(void) if ( pass ) { - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, H5C__PIN_ENTRY_FLAG); resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024); @@ -21944,8 +21998,8 @@ check_auto_cache_resize(void) if ( pass ) { - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, H5C__PIN_ENTRY_FLAG); resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024); @@ -21965,8 +22019,8 @@ check_auto_cache_resize(void) if ( pass ) { - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, H5C__PIN_ENTRY_FLAG); resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024); @@ -21989,16 +22043,16 @@ check_auto_cache_resize(void) */ if ( pass ) { - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, H5C__UNPIN_ENTRY_FLAG); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, H5C__UNPIN_ENTRY_FLAG); - protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); - unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, H5C__UNPIN_ENTRY_FLAG); if ( ( pass ) && @@ -22018,10 +22072,10 @@ check_auto_cache_resize(void) */ if ( pass ) { - expunge_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); - expunge_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); - expunge_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); - expunge_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 13); + expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); + expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); + expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); + expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13); if ( ( pass ) && ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || @@ -22118,8 +22172,8 @@ check_auto_cache_resize(void) rpt_fcn_called = FALSE; - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, NO_CHANGE, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); if ( ( pass ) && @@ -22145,8 +22199,8 @@ check_auto_cache_resize(void) rpt_fcn_called = FALSE; - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 1); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 1, NO_CHANGE, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, NO_CHANGE, H5C__NO_FLAGS_SET); if ( ( pass ) && @@ -22171,11 +22225,11 @@ check_auto_cache_resize(void) rpt_fcn_called = FALSE; - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 2); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 2, NO_CHANGE, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, NO_CHANGE, H5C__NO_FLAGS_SET); - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3, NO_CHANGE, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, NO_CHANGE, H5C__NO_FLAGS_SET); if ( ( pass ) && @@ -22202,10 +22256,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, TINY_ENTRY_TYPE, 0); + protect_entry(file_ptr, TINY_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, TINY_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, TINY_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -22228,8 +22282,8 @@ check_auto_cache_resize(void) rpt_fcn_called = FALSE; - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, NO_CHANGE, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); if ( ( pass ) && @@ -22256,10 +22310,10 @@ check_auto_cache_resize(void) i = 0; while ( ( pass ) && ( i < 500 ) ) { - protect_entry(cache_ptr, TINY_ENTRY_TYPE, i); + protect_entry(file_ptr, TINY_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, TINY_ENTRY_TYPE, i, + unprotect_entry(file_ptr, TINY_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -22280,7 +22334,7 @@ check_auto_cache_resize(void) if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -22326,6 +22380,7 @@ check_auto_cache_resize_disable(void) herr_t result; int32_t i; int32_t checkpoint = 0; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; H5C_auto_size_ctl_t auto_size_ctl = { @@ -22388,8 +22443,9 @@ check_auto_cache_resize_disable(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; } if ( pass ) { @@ -22497,10 +22553,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -22528,10 +22584,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -22558,10 +22614,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -22658,10 +22714,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -22689,10 +22745,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -22719,10 +22775,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -22819,10 +22875,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -22850,10 +22906,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -22880,10 +22936,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -22981,10 +23037,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23010,10 +23066,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23040,10 +23096,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23139,10 +23195,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23169,10 +23225,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23199,10 +23255,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23298,10 +23354,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23328,10 +23384,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23358,10 +23414,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23451,7 +23507,7 @@ check_auto_cache_resize_disable(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); /* flush the cache and destroy all entries so we start from a known point */ - flush_cache(cache_ptr, TRUE, FALSE, FALSE); + flush_cache(file_ptr, TRUE, FALSE, FALSE); if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -23464,10 +23520,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(file_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23494,10 +23550,10 @@ check_auto_cache_resize_disable(void) i = 1000; while ( ( pass ) && ( i < 2000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(file_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23526,10 +23582,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(file_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23556,10 +23612,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23588,10 +23644,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23679,7 +23735,7 @@ check_auto_cache_resize_disable(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); /* flush the cache and destroy all entries so we start from a known point */ - flush_cache(cache_ptr, TRUE, FALSE, FALSE); + flush_cache(file_ptr, TRUE, FALSE, FALSE); if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -23692,10 +23748,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(file_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23722,10 +23778,10 @@ check_auto_cache_resize_disable(void) i = 1000; while ( ( pass ) && ( i < 2000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(file_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23754,10 +23810,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(file_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23784,10 +23840,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23816,10 +23872,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23914,7 +23970,7 @@ check_auto_cache_resize_disable(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); /* flush the cache and destroy all entries so we start from a known point */ - flush_cache(cache_ptr, TRUE, FALSE, FALSE); + flush_cache(file_ptr, TRUE, FALSE, FALSE); if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -23927,10 +23983,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(file_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23957,10 +24013,10 @@ check_auto_cache_resize_disable(void) i = 1000; while ( ( pass ) && ( i < 2000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(file_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -23991,10 +24047,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(file_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -24023,10 +24079,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -24057,10 +24113,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 999); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 999); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 999, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 999, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -24161,10 +24217,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -24193,10 +24249,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -24290,10 +24346,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -24322,10 +24378,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -24419,10 +24475,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -24451,10 +24507,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -24548,10 +24604,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -24580,10 +24636,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -24678,10 +24734,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -24710,10 +24766,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -24808,10 +24864,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -24840,10 +24896,10 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -24963,8 +25019,8 @@ check_auto_cache_resize_disable(void) rpt_fcn_called = FALSE; - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); if ( ( pass ) && @@ -25003,8 +25059,8 @@ check_auto_cache_resize_disable(void) rpt_fcn_called = FALSE; - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); if ( ( pass ) && @@ -25034,7 +25090,7 @@ check_auto_cache_resize_disable(void) if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -25077,6 +25133,7 @@ check_auto_cache_resize_epoch_markers(void) int32_t i; int32_t j; int32_t checkpoint = 0; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; H5C_auto_size_ctl_t auto_size_ctl = { @@ -25134,8 +25191,9 @@ check_auto_cache_resize_epoch_markers(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; } if ( pass ) { @@ -25249,10 +25307,10 @@ check_auto_cache_resize_epoch_markers(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -25282,10 +25340,10 @@ check_auto_cache_resize_epoch_markers(void) i = (j - 2) * 1000; while ( ( pass ) && ( i < (j - 1) * 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(file_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -25314,10 +25372,10 @@ check_auto_cache_resize_epoch_markers(void) i = 9000; while ( ( pass ) && ( i < 10000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(file_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -25428,10 +25486,10 @@ check_auto_cache_resize_epoch_markers(void) i = 9000; while ( ( pass ) && ( i < 10000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(file_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -25620,10 +25678,10 @@ check_auto_cache_resize_epoch_markers(void) i = (j - 1) * 1000; while ( ( pass ) && ( i < j * 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(file_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -25742,7 +25800,7 @@ check_auto_cache_resize_epoch_markers(void) if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -25845,6 +25903,7 @@ check_auto_cache_resize_input_errs(void) { const char * fcn_name = "check_auto_cache_resize_input_errs()"; herr_t result; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; H5C_auto_size_ctl_t ref_auto_size_ctl = { @@ -25909,14 +25968,14 @@ check_auto_cache_resize_input_errs(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; } if ( pass ) { - result = H5C_set_cache_auto_resize_config(cache_ptr, - &ref_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &ref_auto_size_ctl); if ( result != SUCCEED ) { @@ -25997,8 +26056,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(NULL, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(NULL, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -26073,8 +26131,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -26150,8 +26207,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -26224,8 +26280,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -26300,8 +26355,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -26373,8 +26427,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -26450,8 +26503,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -26523,8 +26575,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -26596,8 +26647,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -26672,8 +26722,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -26745,8 +26794,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -26822,8 +26870,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -26896,8 +26943,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -26972,8 +27018,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -27045,8 +27090,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -27118,8 +27162,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -27195,8 +27238,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -27272,8 +27314,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -27348,8 +27389,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -27422,8 +27462,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -27498,8 +27537,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -27572,8 +27610,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -27648,8 +27685,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -27722,8 +27758,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -27798,8 +27833,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -27871,8 +27905,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -27947,8 +27980,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -28020,8 +28052,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -28095,8 +28126,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = -0.0000001; /* INVALID */ - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -28168,8 +28198,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); if ( result != FAIL ) { @@ -28215,7 +28244,7 @@ check_auto_cache_resize_input_errs(void) if ( pass ) { - result = H5C_get_cache_auto_resize_config((H5C_t *)&test_auto_size_ctl, + result = H5C_get_cache_auto_resize_config((const H5C_t *)&test_auto_size_ctl, &test_auto_size_ctl); if ( result != FAIL ) { @@ -28238,9 +28267,9 @@ check_auto_cache_resize_input_errs(void) } } - if ( pass ) { + if ( cache_ptr ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -28283,6 +28312,7 @@ check_auto_cache_resize_aux_fcns(void) const char * fcn_name = "check_auto_cache_resize_aux_fcns()"; herr_t result; int32_t i; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; double hit_rate; size_t max_size; @@ -28350,14 +28380,14 @@ check_auto_cache_resize_aux_fcns(void) reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; } if ( pass ) { - result = H5C_set_cache_auto_resize_config(cache_ptr, - &auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if ( result != SUCCEED ) { @@ -28413,11 +28443,11 @@ check_auto_cache_resize_aux_fcns(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, PICO_ENTRY_TYPE, i); + protect_entry(file_ptr, PICO_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, PICO_ENTRY_TYPE, i, + unprotect_entry(file_ptr, PICO_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -28459,11 +28489,11 @@ check_auto_cache_resize_aux_fcns(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, PICO_ENTRY_TYPE, 0); + protect_entry(file_ptr, PICO_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, PICO_ENTRY_TYPE, 0, + unprotect_entry(file_ptr, PICO_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -28542,11 +28572,11 @@ check_auto_cache_resize_aux_fcns(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, PICO_ENTRY_TYPE, i + 500); + protect_entry(file_ptr, PICO_ENTRY_TYPE, i + 500); if ( pass ) { - unprotect_entry(cache_ptr, PICO_ENTRY_TYPE, i + 500, + unprotect_entry(file_ptr, PICO_ENTRY_TYPE, i + 500, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -28647,11 +28677,11 @@ check_auto_cache_resize_aux_fcns(void) */ if ( pass ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); } if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } @@ -28700,9 +28730,6 @@ check_auto_cache_resize_aux_fcns(void) if ( pass ) { max_size = 0; - min_clean_size = 0; - cur_size = 0; - cur_num_entries = 0; result = H5C_get_cache_size(cache_ptr, &max_size, NULL, NULL, NULL); @@ -28717,22 +28744,12 @@ check_auto_cache_resize_aux_fcns(void) failure_mssg = "H5C_get_cache_size reports unexpected max_size 3.\n"; - } else if ( ( min_clean_size != 0 ) || - ( cur_size != 0 ) || - ( cur_num_entries != 0 ) ) { - - pass = FALSE; - failure_mssg = "Phantom returns from H5C_get_cache_size?\n"; - } } if ( pass ) { - max_size = 0; min_clean_size = 0; - cur_size = 0; - cur_num_entries = 0; result = H5C_get_cache_size(cache_ptr, NULL, &min_clean_size, NULL, NULL); @@ -28748,22 +28765,12 @@ check_auto_cache_resize_aux_fcns(void) failure_mssg = "H5C_get_cache_size reports unexpected min_clean_size 4.\n"; - } else if ( ( max_size != 0 ) || - ( cur_size != 0 ) || - ( cur_num_entries != 0 ) ) { - - pass = FALSE; - failure_mssg = "Phantom returns from H5C_get_cache_size?\n"; - } } if ( pass ) { - max_size = 0; - min_clean_size = 0; cur_size = 0; - cur_num_entries = 0; result = H5C_get_cache_size(cache_ptr, NULL, NULL, &cur_size, NULL); @@ -28779,21 +28786,11 @@ check_auto_cache_resize_aux_fcns(void) failure_mssg = "H5C_get_cache_size reports unexpected cur_size 5.\n"; - } else if ( ( max_size != 0 ) || - ( min_clean_size != 0 ) || - ( cur_num_entries != 0 ) ) { - - pass = FALSE; - failure_mssg = "Phantom returns from H5C_get_cache_size?\n"; - - } + } } if ( pass ) { - max_size = 0; - min_clean_size = 0; - cur_size = 0; cur_num_entries = 0; result = H5C_get_cache_size(cache_ptr, NULL, NULL, NULL, @@ -28810,19 +28807,12 @@ check_auto_cache_resize_aux_fcns(void) failure_mssg = "H5C_get_cache_size reports unexpected cur_num_entries 2.\n"; - } else if ( ( max_size != 0 ) || - ( min_clean_size != 0 ) || - ( cur_size != 0 ) ) { - - pass = FALSE; - failure_mssg = "Phantom returns from H5C_get_cache_size?\n"; - } } - if ( pass ) { + if ( cache_ptr ) { - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); } if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -28872,6 +28862,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) const char * fcn_name = "check_metadata_blizzard_absence"; int entry_type = HUGE_ENTRY_TYPE; size_t entry_size = HUGE_ENTRY_SIZE; /* 16 KB */ + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; hbool_t show_progress = FALSE; int32_t checkpoint = 0; @@ -29064,14 +29055,17 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) * The max_cache_size should have room for 50 entries. * The min_clean_size is half of that, or 25 entries. */ - cache_ptr = setup_cache((size_t)(50 * entry_size), /* max_cache_size */ + file_ptr = setup_cache((size_t)(50 * entry_size), /* max_cache_size */ (size_t)(25 * entry_size)); /* min_clean_size */ - if ( cache_ptr == NULL) { + if ( file_ptr == NULL) { pass = FALSE; failure_mssg = "bad return from cache intialization.\n"; - } + + } + else + cache_ptr = file_ptr->shared->cache; } if ( show_progress) /* 1 */ @@ -29108,18 +29102,18 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) for (entry_idx = 0; entry_idx < 26; entry_idx++) { if (fill_via_insertion) { - insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + insert_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx, /* int32_t idx */ TRUE, /* hbool_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ } else { - protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + protect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx); /* int32-t idx */ - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx, /* int32_t idx */ TRUE, /* int32_t dirty */ @@ -29131,7 +29125,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) */ expected[entry_idx].in_cache = TRUE; expected[entry_idx].is_dirty = TRUE; - expected[entry_idx].loaded = loaded; + expected[entry_idx].loaded = (unsigned char)loaded; verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ entry_idx, /* int tag */ @@ -29169,17 +29163,17 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) * constraint. */ if (fill_via_insertion) { - insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + insert_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx++, /* int32_t idx */ TRUE, /* hbool_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ } else { - protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + protect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx); /* int32-t idx */ - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx++, /* int32_t idx */ TRUE, /* int32_t dirty */ @@ -29203,7 +29197,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) /* entry w/ index 26 is now in the cache and dirty. */ expected[26].in_cache = TRUE; expected[26].is_dirty = TRUE; - expected[26].loaded = loaded; + expected[26].loaded = (unsigned char)loaded; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29225,17 +29219,17 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) * satisfy the min_clean_size constraint. */ if (fill_via_insertion) { - insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + insert_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx++, /* int32_t idx */ TRUE, /* hbool_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ } else { - protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + protect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx); /* int32-t idx */ - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx++, /* int32_t idx */ TRUE, /* int32_t dirty */ @@ -29259,7 +29253,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) /* entry w/ index 27 is now in the cache and dirty. */ expected[27].in_cache = TRUE; expected[27].is_dirty = TRUE; - expected[27].loaded = loaded; + expected[27].loaded = (unsigned char)loaded; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29279,17 +29273,17 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) for (entry_idx = entry_idx; entry_idx < 50; entry_idx++) { if (fill_via_insertion) { - insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + insert_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx, /* int32_t idx */ TRUE, /* hbool_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ } else { - protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + protect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx); /* int32-t idx */ - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx, /* int32_t idx */ TRUE, /* int32_t dirty */ @@ -29306,7 +29300,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) expected[entry_idx].in_cache = TRUE; expected[entry_idx].is_dirty = TRUE; - expected[entry_idx].loaded = loaded; + expected[entry_idx].loaded = (unsigned char)loaded; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29353,17 +29347,17 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) * have to evict in order to make room for the new entry. */ if (fill_via_insertion) { - insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + insert_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx++, /* int32_t idx */ TRUE, /* hbool_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ } else { - protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + protect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx); /* int32-t idx */ - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx++, /* int32_t idx */ TRUE, /* int32_t dirty */ @@ -29391,7 +29385,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) /* entry w/ index 50 is now in the cache and dirty */ expected[50].in_cache = TRUE; expected[50].is_dirty = TRUE; - expected[50].loaded = loaded; + expected[50].loaded = (unsigned char)loaded; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29418,17 +29412,17 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) for (entry_idx = entry_idx; entry_idx < 100; entry_idx++) { if (fill_via_insertion) { - insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + insert_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx, /* int32_t idx */ TRUE, /* hbool_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ } else { - protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + protect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx); /* int32-t idx */ - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx, /* int32_t idx */ TRUE, /* int32_t dirty */ @@ -29438,7 +29432,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) /* This past inserted entry is now in the cache and dirty */ expected[entry_idx].in_cache = TRUE; expected[entry_idx].is_dirty = TRUE; - expected[entry_idx].loaded = loaded; + expected[entry_idx].loaded = (unsigned char)loaded; /* The entry inserted 50 insertions ago has been evicted */ expected[entry_idx - 50].in_cache = FALSE; @@ -29508,7 +29502,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) * to an empty cache. */ - flush_cache(cache_ptr, /* H5C_t * cache_ptr */ + flush_cache(file_ptr, /* H5F_t * file_ptr */ FALSE, /* hbool_t destory_entries */ FALSE, /* hbool_t dump_stats */ FALSE); /* hbool_t dump_detailed_stats */ @@ -29550,18 +29544,18 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) for (entry_idx = 100; entry_idx < 126; entry_idx++) { if (fill_via_insertion) { - insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + insert_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx, /* int32_t idx */ TRUE, /* hbool_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ } else { - protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + protect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx); /* int32-t idx */ - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx, /* int32_t idx */ TRUE, /* int32_t dirty */ @@ -29571,7 +29565,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) /* This past inserted entry is now in the cache and dirty */ expected[entry_idx].in_cache = TRUE; expected[entry_idx].is_dirty = TRUE; - expected[entry_idx].loaded = loaded; + expected[entry_idx].loaded = (unsigned char)loaded; /* The entry with ID minus 50 will have been evicted */ expected[entry_idx - 50].in_cache = FALSE; @@ -29593,17 +29587,17 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) /* Insert the 127th entry (index = 126) into the cache. */ if (fill_via_insertion) { - insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + insert_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx++, /* int32_t idx */ TRUE, /* hbool_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ } else { - protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + protect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx); /* int32-t idx */ - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx++, /* int32_t idx */ TRUE, /* int32_t dirty */ @@ -29629,7 +29623,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) /* entry w/ index 26 is now in the cache and dirty. */ expected[126].in_cache = TRUE; expected[126].is_dirty = TRUE; - expected[126].loaded = loaded; + expected[126].loaded = (unsigned char)loaded; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29648,18 +29642,18 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) for (entry_idx = 127; entry_idx < 150; entry_idx++) { if (fill_via_insertion) { - insert_entry(cache_ptr, /* H5C_t * cache_ptr */ + insert_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx, /* int32_t idx */ TRUE, /* hbool_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ } else { - protect_entry(cache_ptr, /* H5C_t * cache_ptr */ + protect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx); /* int32-t idx */ - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ entry_idx, /* int32_t idx */ TRUE, /* int32_t dirty */ @@ -29669,7 +29663,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) /* This past inserted entry is now in the cache and dirty */ expected[entry_idx].in_cache = TRUE; expected[entry_idx].is_dirty = TRUE; - expected[entry_idx].loaded = loaded; + expected[entry_idx].loaded = (unsigned char)loaded; /* The entry with ID minus 50 will have been evicted */ expected[entry_idx - 50].in_cache = FALSE; @@ -29695,7 +29689,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) if ( pass ) { /* We're done with testing. We can take down the cache. */ - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); reset_entries(); } @@ -29726,10 +29720,10 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) static unsigned check_flush_deps(void) { + H5F_t * file_ptr = NULL; /* File for this test */ H5C_t * cache_ptr = NULL; /* Metadata cache for this test */ test_entry_t *base_addr; /* Base address of entries for test */ int entry_type = PICO_ENTRY_TYPE; /* Use very small entry size (size of entries doesn't matter) */ - size_t entry_size = PICO_ENTRY_SIZE; /* 1 byte */ unsigned u; /* Local index variable */ struct expected_entry_status expected[5] = { @@ -29751,14 +29745,15 @@ check_flush_deps(void) */ reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; base_addr = entries[entry_type]; if ( !pass ) CACHE_ERROR("setup_cache failed") /* Insert entries to work with into the cache */ for(u = 0; u < 5; u++) { - insert_entry(cache_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET); + insert_entry(file_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET); if ( !pass ) CACHE_ERROR("insert_entry failed") /* Change expected values, and verify the status of the entries @@ -29782,12 +29777,12 @@ check_flush_deps(void) hbool_t in_cache, is_flush_dep_parent, is_flush_dep_child; test_entry_t * entry_ptr; - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") /* Check the parent's entry status */ entry_ptr = &(base_addr[1]); - if(H5C_get_entry_status(cache_ptr, entry_ptr->addr, NULL, &in_cache, + if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) CACHE_ERROR("H5C_get_entry_status() failed") if(!in_cache || is_flush_dep_parent || is_flush_dep_child) @@ -29795,18 +29790,18 @@ check_flush_deps(void) /* Check the child's entry status */ entry_ptr = &(base_addr[0]); - if(H5C_get_entry_status(cache_ptr, entry_ptr->addr, NULL, &in_cache, + if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) CACHE_ERROR("H5C_get_entry_status() failed") if(!in_cache || is_flush_dep_parent || is_flush_dep_child) CACHE_ERROR("invalid entry status") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + create_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Check the parent's entry status */ entry_ptr = &(base_addr[1]); - if(H5C_get_entry_status(cache_ptr, entry_ptr->addr, NULL, &in_cache, + if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) CACHE_ERROR("H5C_get_entry_status() failed") if(!in_cache || !is_flush_dep_parent || is_flush_dep_child) @@ -29814,7 +29809,7 @@ check_flush_deps(void) /* Check the child's entry status */ entry_ptr = &(base_addr[0]); - if(H5C_get_entry_status(cache_ptr, entry_ptr->addr, NULL, &in_cache, + if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) CACHE_ERROR("H5C_get_entry_status() failed") if(!in_cache || is_flush_dep_parent || !is_flush_dep_child) @@ -29840,10 +29835,10 @@ check_flush_deps(void) /* Destroy flush dependency between entries 0 (child) & 1 (parent) */ { - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + destroy_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -29872,13 +29867,13 @@ check_flush_deps(void) /* Create flush dependency between entries 0, 1 (children) & 2 (parent) */ { - protect_entry(cache_ptr, entry_type, 2); + protect_entry(file_ptr, entry_type, 2); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 0); + create_flush_dependency(entry_type, 2, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + create_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -29903,13 +29898,13 @@ check_flush_deps(void) /* Destroy flush dependency between entries 0, 1 (children) & 2 (parent) */ { - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 0); + destroy_flush_dependency(entry_type, 2, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + destroy_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 2, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -29942,10 +29937,10 @@ check_flush_deps(void) /* Create flush dependency between entries (child) 0->1->2->3 (parent) */ { - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + create_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -29965,10 +29960,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 2); + protect_entry(file_ptr, entry_type, 2); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + create_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -29988,10 +29983,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 3); + protect_entry(file_ptr, entry_type, 3); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 3, entry_type, 2); + create_flush_dependency(entry_type, 3, entry_type, 2); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30014,10 +30009,10 @@ check_flush_deps(void) /* Destroy flush dependency between entries, from the "top down" */ { - destroy_flush_dependency(cache_ptr, entry_type, 3, entry_type, 2); + destroy_flush_dependency(entry_type, 3, entry_type, 2); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 3, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30041,10 +30036,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + destroy_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 2, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30068,10 +30063,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + destroy_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30102,10 +30097,10 @@ check_flush_deps(void) /* Create flush dependency between entries (child) 0->1->2->3 (parent) */ { - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + create_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30125,10 +30120,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 2); + protect_entry(file_ptr, entry_type, 2); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + create_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30148,10 +30143,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 3); + protect_entry(file_ptr, entry_type, 3); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 3, entry_type, 2); + create_flush_dependency(entry_type, 3, entry_type, 2); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30174,10 +30169,10 @@ check_flush_deps(void) /* Destroy flush dependency between entries, from the "bottom up" */ { - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + destroy_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30207,10 +30202,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + destroy_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 2, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30237,10 +30232,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 3, entry_type, 2); + destroy_flush_dependency(entry_type, 3, entry_type, 2); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 3, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30271,10 +30266,10 @@ check_flush_deps(void) /* Create flush dependency between entries (child) 0->1->2->3 (parent) */ { - protect_entry(cache_ptr, entry_type, 3); + protect_entry(file_ptr, entry_type, 3); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 3, entry_type, 2); + create_flush_dependency(entry_type, 3, entry_type, 2); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30294,10 +30289,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 2); + protect_entry(file_ptr, entry_type, 2); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + create_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30320,10 +30315,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + create_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30352,10 +30347,10 @@ check_flush_deps(void) /* Destroy flush dependency between entries, from the "top down" */ { - destroy_flush_dependency(cache_ptr, entry_type, 3, entry_type, 2); + destroy_flush_dependency(entry_type, 3, entry_type, 2); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 3, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30379,10 +30374,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + destroy_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 2, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30406,10 +30401,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + destroy_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30440,10 +30435,10 @@ check_flush_deps(void) /* Create flush dependency between entries (child) 0->1->2->3 (parent) */ { - protect_entry(cache_ptr, entry_type, 3); + protect_entry(file_ptr, entry_type, 3); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 3, entry_type, 2); + create_flush_dependency(entry_type, 3, entry_type, 2); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30463,10 +30458,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 2); + protect_entry(file_ptr, entry_type, 2); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + create_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30489,10 +30484,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + create_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30521,10 +30516,10 @@ check_flush_deps(void) /* Destroy flush dependency between entries, from the "bottom up" */ { - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + destroy_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30554,10 +30549,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + destroy_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 2, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30584,10 +30579,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 3, entry_type, 2); + destroy_flush_dependency(entry_type, 3, entry_type, 2); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 3, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30616,11 +30611,11 @@ check_flush_deps(void) /* Create flush dependency between entries (child) 0,1,2,3->4 (parent) */ { - protect_entry(cache_ptr, entry_type, 4); + protect_entry(file_ptr, entry_type, 4); if ( !pass ) CACHE_ERROR("protect_entry failed") for(u = 0; u < 4; u++) { - create_flush_dependency(cache_ptr, entry_type, 4, entry_type, (int32_t)u); + create_flush_dependency(entry_type, 4, entry_type, (int32_t)u); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30645,7 +30640,7 @@ check_flush_deps(void) /* Destroy flush dependency between entries */ { for(u = 0; u < 4; u++) { - destroy_flush_dependency(cache_ptr, entry_type, 4, entry_type, (int32_t)u); + destroy_flush_dependency(entry_type, 4, entry_type, (int32_t)u); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30657,7 +30652,7 @@ check_flush_deps(void) /* Check for destroying flush dependency on last entry */ if(3 == u) { - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 4, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30689,10 +30684,10 @@ check_flush_deps(void) * then add entry 4 as a child of 0 */ { - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + create_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30712,10 +30707,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 4); + protect_entry(file_ptr, entry_type, 4); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 4, entry_type, 3); + create_flush_dependency(entry_type, 4, entry_type, 3); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30735,10 +30730,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 0); + protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 0, entry_type, 4); + create_flush_dependency(entry_type, 0, entry_type, 4); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30765,10 +30760,10 @@ check_flush_deps(void) /* Destroy flush dependency between entries, detaching 3->4 from 0 first */ { - destroy_flush_dependency(cache_ptr, entry_type, 0, entry_type, 4); + destroy_flush_dependency(entry_type, 0, entry_type, 4); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 0, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30795,10 +30790,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 4, entry_type, 3); + destroy_flush_dependency(entry_type, 4, entry_type, 3); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 4, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30822,10 +30817,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + destroy_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -30858,10 +30853,10 @@ check_flush_deps(void) * then add entry 4 as a child of 1 */ { - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + create_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30875,16 +30870,16 @@ check_flush_deps(void) expected[1].flush_dep_height = 1; /* Verify the status */ - verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + verify_entry_status(cache_ptr, /* H5F_t * cache_ptr */ (int)0, /* int tag */ (int)5, /* int num_entries */ expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 2); + protect_entry(file_ptr, entry_type, 2); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + create_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30904,10 +30899,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 4); + protect_entry(file_ptr, entry_type, 4); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 4, entry_type, 3); + create_flush_dependency(entry_type, 4, entry_type, 3); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30927,7 +30922,7 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 4); + create_flush_dependency(entry_type, 1, entry_type, 4); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30952,7 +30947,7 @@ check_flush_deps(void) /* Destroy flush dependency between entries, detaching 3->4 from 1 first */ { - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 4); + destroy_flush_dependency(entry_type, 1, entry_type, 4); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -30973,10 +30968,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 4, entry_type, 3); + destroy_flush_dependency(entry_type, 4, entry_type, 3); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 4, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31000,10 +30995,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + destroy_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 2, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31027,10 +31022,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + destroy_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31063,10 +31058,10 @@ check_flush_deps(void) * then add entry 4 as a child of 2 */ { - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + create_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -31086,10 +31081,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 2); + protect_entry(file_ptr, entry_type, 2); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + create_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -31109,10 +31104,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 4); + protect_entry(file_ptr, entry_type, 4); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 4, entry_type, 3); + create_flush_dependency(entry_type, 4, entry_type, 3); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -31132,7 +31127,7 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 4); + create_flush_dependency(entry_type, 2, entry_type, 4); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -31153,7 +31148,7 @@ check_flush_deps(void) /* Destroy flush dependency between entries, detaching 3->4 from 2 first */ { - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 4); + destroy_flush_dependency(entry_type, 2, entry_type, 4); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -31170,10 +31165,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 4, entry_type, 3); + destroy_flush_dependency(entry_type, 4, entry_type, 3); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 4, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31197,10 +31192,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + destroy_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 2, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31224,10 +31219,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + destroy_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31258,13 +31253,13 @@ check_flush_deps(void) /* Create flush dependency between entries 0 (child) & 1 (parent) */ { - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - pin_entry(cache_ptr, entry_type, 1); + pin_entry(entry_type, 1); if ( !pass ) CACHE_ERROR("pin_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + create_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -31287,13 +31282,13 @@ check_flush_deps(void) /* Unpin entry & destroy flush dependency between entries 0 (child) & 1 (parent) */ { - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + destroy_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unpin_entry(cache_ptr, entry_type, 1); + unpin_entry(entry_type, 1); if ( !pass ) CACHE_ERROR("unpin_entry failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31324,13 +31319,13 @@ check_flush_deps(void) /* Create flush dependency between entries 0 (child) & 1 (parent) */ { - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - pin_entry(cache_ptr, entry_type, 1); + pin_entry(entry_type, 1); if ( !pass ) CACHE_ERROR("pin_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + create_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -31353,7 +31348,7 @@ check_flush_deps(void) /* Unpin entry & destroy flush dependency between entries 0 (child) & 1 (parent) */ { - unpin_entry(cache_ptr, entry_type, 1); + unpin_entry(entry_type, 1); if ( !pass ) CACHE_ERROR("unpin_entry failed") /* Verify the status */ @@ -31363,10 +31358,10 @@ check_flush_deps(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + destroy_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31393,8 +31388,8 @@ check_flush_deps(void) done: - if(cache_ptr) - takedown_cache(cache_ptr, FALSE, FALSE); + if(file_ptr) + takedown_cache(file_ptr, FALSE, FALSE); if ( pass ) PASSED() @@ -31423,7 +31418,7 @@ done: static unsigned check_flush_deps_err(void) { - H5C_t * cache_ptr = NULL; /* Metadata cache for this test */ + H5F_t * file_ptr = NULL; /* File for this test */ int entry_type = PICO_ENTRY_TYPE; /* Use very small entry size (size of entries doesn't matter) */ unsigned test_count; /* Test iteration variable */ @@ -31440,12 +31435,12 @@ check_flush_deps_err(void) /* Allocate a cache */ reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); if ( !pass ) CACHE_ERROR("setup_cache failed") /* Insert entries to work with into the cache */ for(u = 0; u < 10; u++) { - insert_entry(cache_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET); + insert_entry(file_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET); if ( !pass ) CACHE_ERROR("insert_entry failed") } /* end for */ @@ -31453,19 +31448,19 @@ check_flush_deps_err(void) switch(test_count) { /* Verify that parent entry in flush dependency must be protected */ case 0: - result = H5C_create_flush_dependency(cache_ptr, &((entries[entry_type])[0]), &((entries[entry_type])[1])); + result = H5C_create_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[1])); if( result != FAIL ) CACHE_ERROR("Creating flush dependency with unprotected entry succeeded") break; /* Verify that entry can't have flush dependency on itself */ case 1: - protect_entry(cache_ptr, entry_type, 0); + protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") - result = H5C_create_flush_dependency(cache_ptr, &((entries[entry_type])[0]), &((entries[entry_type])[0])); + result = H5C_create_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[0])); if( result != FAIL ) CACHE_ERROR("Creating flush dependency with parent == child") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 0, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31475,29 +31470,29 @@ check_flush_deps_err(void) /* Verify that a child entry can only have one flush dependency parent */ case 2: - protect_entry(cache_ptr, entry_type, 0); + protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 0, entry_type, 2); + create_flush_dependency(entry_type, 0, entry_type, 2); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - result = H5C_create_flush_dependency(cache_ptr, &((entries[entry_type])[1]), &((entries[entry_type])[2])); + result = H5C_create_flush_dependency(&((entries[entry_type])[1]), &((entries[entry_type])[2])); if( result != FAIL ) CACHE_ERROR("Creating second flush dependency for child") - destroy_flush_dependency(cache_ptr, entry_type, 0, entry_type, 2); + destroy_flush_dependency(entry_type, 0, entry_type, 2); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 0, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31507,122 +31502,122 @@ check_flush_deps_err(void) /* Verify that a flush dependency chain can't be higher than (H5C__NUM_FLUSH_DEP_HEIGHTS - 1) */ case 3: - protect_entry(cache_ptr, entry_type, 0); + protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); + create_flush_dependency(entry_type, 0, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 2); + create_flush_dependency(entry_type, 1, entry_type, 2); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - protect_entry(cache_ptr, entry_type, 2); + protect_entry(file_ptr, entry_type, 2); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 3); + create_flush_dependency(entry_type, 2, entry_type, 3); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - protect_entry(cache_ptr, entry_type, 3); + protect_entry(file_ptr, entry_type, 3); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 3, entry_type, 4); + create_flush_dependency(entry_type, 3, entry_type, 4); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - protect_entry(cache_ptr, entry_type, 4); + protect_entry(file_ptr, entry_type, 4); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 4, entry_type, 5); + create_flush_dependency(entry_type, 4, entry_type, 5); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - protect_entry(cache_ptr, entry_type, 5); + protect_entry(file_ptr, entry_type, 5); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 5, entry_type, 6); + create_flush_dependency(entry_type, 5, entry_type, 6); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - protect_entry(cache_ptr, entry_type, 6); + protect_entry(file_ptr, entry_type, 6); if ( !pass ) CACHE_ERROR("protect_entry failed") - result = H5C_create_flush_dependency(cache_ptr, &((entries[entry_type])[6]), &((entries[entry_type])[7])); + result = H5C_create_flush_dependency(&((entries[entry_type])[6]), &((entries[entry_type])[7])); if( result != FAIL ) CACHE_ERROR("Creating flush dependency that's too tall") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 6, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - protect_entry(cache_ptr, entry_type, 7); + protect_entry(file_ptr, entry_type, 7); if ( !pass ) CACHE_ERROR("protect_entry failed") - result = H5C_create_flush_dependency(cache_ptr, &((entries[entry_type])[7]), &((entries[entry_type])[0])); + result = H5C_create_flush_dependency(&((entries[entry_type])[7]), &((entries[entry_type])[0])); if( result != FAIL ) CACHE_ERROR("Creating flush dependency that's too tall") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 7, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - destroy_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); + destroy_flush_dependency(entry_type, 0, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 0, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 2); + destroy_flush_dependency(entry_type, 1, entry_type, 2); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 3); + destroy_flush_dependency(entry_type, 2, entry_type, 3); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 2, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - destroy_flush_dependency(cache_ptr, entry_type, 3, entry_type, 4); + destroy_flush_dependency(entry_type, 3, entry_type, 4); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 3, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - destroy_flush_dependency(cache_ptr, entry_type, 4, entry_type, 5); + destroy_flush_dependency(entry_type, 4, entry_type, 5); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 4, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - destroy_flush_dependency(cache_ptr, entry_type, 5, entry_type, 6); + destroy_flush_dependency(entry_type, 5, entry_type, 6); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 5, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31632,19 +31627,19 @@ check_flush_deps_err(void) /* Verify that parent entry must be protected */ case 4: - result = H5C_destroy_flush_dependency(cache_ptr, &((entries[entry_type])[0]), &((entries[entry_type])[1])); + result = H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[1])); if( result != FAIL ) CACHE_ERROR("Destroying [non-existant] dependency when parent isn't protected") break; /* Verify that parent entry has flush dependency */ case 5: - protect_entry(cache_ptr, entry_type, 0); + protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") - result = H5C_destroy_flush_dependency(cache_ptr, &((entries[entry_type])[0]), &((entries[entry_type])[1])); + result = H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[1])); if( result != FAIL ) CACHE_ERROR("Destroying dependency when parent isn't in relationship") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 0, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31654,19 +31649,19 @@ check_flush_deps_err(void) /* Verify that child entry is in flush dependency relationship */ case 6: - protect_entry(cache_ptr, entry_type, 0); + protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); + create_flush_dependency(entry_type, 0, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - result = H5C_destroy_flush_dependency(cache_ptr, &((entries[entry_type])[0]), &((entries[entry_type])[2])); + result = H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[2])); if( result != FAIL ) CACHE_ERROR("Destroying dependency when child isn't in relationship") - destroy_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); + destroy_flush_dependency(entry_type, 0, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 0, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31676,51 +31671,51 @@ check_flush_deps_err(void) /* Verify that parent has child entries at this height */ case 7: - protect_entry(cache_ptr, entry_type, 0); + protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); + create_flush_dependency(entry_type, 0, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 2); + create_flush_dependency(entry_type, 1, entry_type, 2); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - protect_entry(cache_ptr, entry_type, 3); + protect_entry(file_ptr, entry_type, 3); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 3, entry_type, 4); + create_flush_dependency(entry_type, 3, entry_type, 4); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - result = H5C_destroy_flush_dependency(cache_ptr, &((entries[entry_type])[0]), &((entries[entry_type])[4])); + result = H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[4])); if( result != FAIL ) CACHE_ERROR("Destroying dependency when parent has no children at child's height") - destroy_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); + destroy_flush_dependency(entry_type, 0, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 0, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 2); + destroy_flush_dependency(entry_type, 1, entry_type, 2); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - destroy_flush_dependency(cache_ptr, entry_type, 3, entry_type, 4); + destroy_flush_dependency(entry_type, 3, entry_type, 4); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 3, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31731,35 +31726,35 @@ check_flush_deps_err(void) /* Verify that child entry is child of parent */ case 8: - protect_entry(cache_ptr, entry_type, 0); + protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); + create_flush_dependency(entry_type, 0, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - protect_entry(cache_ptr, entry_type, 2); + protect_entry(file_ptr, entry_type, 2); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 3); + create_flush_dependency(entry_type, 2, entry_type, 3); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - result = H5C_destroy_flush_dependency(cache_ptr, &((entries[entry_type])[0]), &((entries[entry_type])[3])); + result = H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[3])); if( result != FAIL ) CACHE_ERROR("Destroying dependency when child isn't in relationship") - destroy_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); + destroy_flush_dependency(entry_type, 0, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 0, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 3); + destroy_flush_dependency(entry_type, 2, entry_type, 3); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 2, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31771,15 +31766,15 @@ check_flush_deps_err(void) CACHE_ERROR("Unknown test case!") } /* end switch */ - takedown_cache(cache_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); if ( !pass ) CACHE_ERROR("takedown_cache failed") - cache_ptr = NULL; + file_ptr = NULL; } /* end for */ done: - if(cache_ptr) - takedown_cache(cache_ptr, FALSE, FALSE); + if(file_ptr) + takedown_cache(file_ptr, FALSE, FALSE); if ( pass ) PASSED() @@ -31809,9 +31804,9 @@ done: static unsigned check_flush_deps_order(void) { + H5F_t * file_ptr = NULL; /* File for this test */ H5C_t * cache_ptr = NULL; /* Metadata cache for this test */ int entry_type = PICO_ENTRY_TYPE; /* Use very small entry size (size of entries doesn't matter) */ - size_t entry_size = PICO_ENTRY_SIZE; /* 1 byte */ unsigned u; /* Local index variable */ struct expected_entry_status expected[5] = { @@ -31834,13 +31829,14 @@ check_flush_deps_order(void) */ reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; if ( !pass ) CACHE_ERROR("setup_cache failed") /* Insert entries to work with into the cache */ for(u = 0; u < 5; u++) { - insert_entry(cache_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET); + insert_entry(file_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET); if ( !pass ) CACHE_ERROR("insert_entry failed") /* Change expected values, and verify the status of the entries @@ -31861,10 +31857,10 @@ check_flush_deps_order(void) /* Create flush dependency between entries 0 (child) & 1 (parent) */ { - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + create_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -31894,7 +31890,7 @@ check_flush_deps_order(void) add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31904,7 +31900,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -31934,7 +31930,7 @@ check_flush_deps_order(void) /* Destroy flush dependency between entries 0 (child) & 1 (parent) */ { - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + destroy_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -31958,10 +31954,10 @@ check_flush_deps_order(void) /* Create flush dependency between entries 0 (child) & 1 (parent) */ { - protect_entry(cache_ptr, entry_type, 0); + protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); + create_flush_dependency(entry_type, 0, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -31991,7 +31987,7 @@ check_flush_deps_order(void) add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 0, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -31999,8 +31995,8 @@ check_flush_deps_order(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") /* Mark entries 0 & 1 dirty, so they are flushed */ - dirty_entry(cache_ptr, entry_type, 0, TRUE); - dirty_entry(cache_ptr, entry_type, 1, FALSE); + dirty_entry(file_ptr, entry_type, 0, TRUE); + dirty_entry(file_ptr, entry_type, 1, FALSE); if ( !pass ) CACHE_ERROR("dirty_entry failed") /* Reset 'flushed' flag & 'flush_order' value in expected array */ @@ -32012,7 +32008,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -32036,7 +32032,7 @@ check_flush_deps_order(void) /* Destroy flush dependency between entries 0 (child) & 1 (parent) */ { - destroy_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); + destroy_flush_dependency(entry_type, 0, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32062,13 +32058,13 @@ check_flush_deps_order(void) /* Create flush dependency between entries 0, 1 (children) & 2 (parent) */ { - protect_entry(cache_ptr, entry_type, 2); + protect_entry(file_ptr, entry_type, 2); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 0); + create_flush_dependency(entry_type, 2, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + create_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32102,7 +32098,7 @@ check_flush_deps_order(void) add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 2, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -32110,9 +32106,9 @@ check_flush_deps_order(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") /* Mark entries 0, 1 & 2 dirty, so they are flushed */ - dirty_entry(cache_ptr, entry_type, 0, FALSE); - dirty_entry(cache_ptr, entry_type, 1, FALSE); - dirty_entry(cache_ptr, entry_type, 2, TRUE); + dirty_entry(file_ptr, entry_type, 0, FALSE); + dirty_entry(file_ptr, entry_type, 1, FALSE); + dirty_entry(file_ptr, entry_type, 2, TRUE); if ( !pass ) CACHE_ERROR("dirty_entry failed") /* Reset 'flushed' flag & 'flush_order' value in expected array */ @@ -32126,7 +32122,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -32153,10 +32149,10 @@ check_flush_deps_order(void) /* Destroy flush dependency between entries 0, 1 (children) & 2 (parent) */ { - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 0); + destroy_flush_dependency(entry_type, 2, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + destroy_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32184,13 +32180,13 @@ check_flush_deps_order(void) /* Create flush dependency between entries 1, 2 (children) & 0 (parent) */ { - protect_entry(cache_ptr, entry_type, 0); + protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); + create_flush_dependency(entry_type, 0, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - create_flush_dependency(cache_ptr, entry_type, 0, entry_type, 2); + create_flush_dependency(entry_type, 0, entry_type, 2); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32224,7 +32220,7 @@ check_flush_deps_order(void) add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 0, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -32232,9 +32228,9 @@ check_flush_deps_order(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") /* Mark entries 0, 1 & 2 dirty, so they are flushed */ - dirty_entry(cache_ptr, entry_type, 0, TRUE); - dirty_entry(cache_ptr, entry_type, 1, FALSE); - dirty_entry(cache_ptr, entry_type, 2, FALSE); + dirty_entry(file_ptr, entry_type, 0, TRUE); + dirty_entry(file_ptr, entry_type, 1, FALSE); + dirty_entry(file_ptr, entry_type, 2, FALSE); if ( !pass ) CACHE_ERROR("dirty_entry failed") /* Reset 'flushed' flag & 'flush_order' value in expected array */ @@ -32248,7 +32244,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -32275,10 +32271,10 @@ check_flush_deps_order(void) /* Destroy flush dependency between entries 1, 2 (children) & 0 (parent) */ { - destroy_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); + destroy_flush_dependency(entry_type, 0, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - destroy_flush_dependency(cache_ptr, entry_type, 0, entry_type, 2); + destroy_flush_dependency(entry_type, 0, entry_type, 2); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32306,10 +32302,10 @@ check_flush_deps_order(void) /* Create flush dependency between entries (child) 0->1->2->3 (parent) */ { - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + create_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32329,10 +32325,10 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 2); + protect_entry(file_ptr, entry_type, 2); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + create_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32352,10 +32348,10 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 3); + protect_entry(file_ptr, entry_type, 3); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 3, entry_type, 2); + create_flush_dependency(entry_type, 3, entry_type, 2); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32389,21 +32385,21 @@ check_flush_deps_order(void) add_flush_op(entry_type, 3, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 2, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 3, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -32411,10 +32407,10 @@ check_flush_deps_order(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") /* Mark entries 0-3 dirty, so they are flushed */ - dirty_entry(cache_ptr, entry_type, 0, FALSE); - dirty_entry(cache_ptr, entry_type, 1, TRUE); - dirty_entry(cache_ptr, entry_type, 2, TRUE); - dirty_entry(cache_ptr, entry_type, 3, TRUE); + dirty_entry(file_ptr, entry_type, 0, FALSE); + dirty_entry(file_ptr, entry_type, 1, TRUE); + dirty_entry(file_ptr, entry_type, 2, TRUE); + dirty_entry(file_ptr, entry_type, 3, TRUE); if ( !pass ) CACHE_ERROR("dirty_entry failed") /* Reset 'flushed' flag & 'flush_order' value in expected array */ @@ -32430,7 +32426,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -32461,7 +32457,7 @@ check_flush_deps_order(void) /* Destroy flush dependency between entries, from the "top down" */ { - destroy_flush_dependency(cache_ptr, entry_type, 3, entry_type, 2); + destroy_flush_dependency(entry_type, 3, entry_type, 2); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32480,7 +32476,7 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + destroy_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32499,7 +32495,7 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + destroy_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32525,10 +32521,10 @@ check_flush_deps_order(void) /* Create flush dependency between entries (child) 0->1->2->3 (parent) */ { - protect_entry(cache_ptr, entry_type, 0); + protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); + create_flush_dependency(entry_type, 0, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32548,10 +32544,10 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 2); + create_flush_dependency(entry_type, 1, entry_type, 2); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32574,10 +32570,10 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 2); + protect_entry(file_ptr, entry_type, 2); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 3); + create_flush_dependency(entry_type, 2, entry_type, 3); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32617,21 +32613,21 @@ check_flush_deps_order(void) add_flush_op(entry_type, 3, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 0, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 2, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -32639,10 +32635,10 @@ check_flush_deps_order(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") /* Mark entries 0-3 dirty, so they are flushed */ - dirty_entry(cache_ptr, entry_type, 0, TRUE); - dirty_entry(cache_ptr, entry_type, 1, TRUE); - dirty_entry(cache_ptr, entry_type, 2, TRUE); - dirty_entry(cache_ptr, entry_type, 3, FALSE); + dirty_entry(file_ptr, entry_type, 0, TRUE); + dirty_entry(file_ptr, entry_type, 1, TRUE); + dirty_entry(file_ptr, entry_type, 2, TRUE); + dirty_entry(file_ptr, entry_type, 3, FALSE); if ( !pass ) CACHE_ERROR("dirty_entry failed") /* Reset 'flushed' flag & 'flush_order' value in expected array */ @@ -32658,7 +32654,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -32690,7 +32686,7 @@ check_flush_deps_order(void) /* Destroy flush dependency between entries, from the "bottom up" */ { - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 3); + destroy_flush_dependency(entry_type, 2, entry_type, 3); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32715,7 +32711,7 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 2); + destroy_flush_dependency(entry_type, 1, entry_type, 2); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32737,7 +32733,7 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); + destroy_flush_dependency(entry_type, 0, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32761,11 +32757,11 @@ check_flush_deps_order(void) /* Create flush dependency between entries (child) 0,1,2,3->4 (parent) */ { - protect_entry(cache_ptr, entry_type, 4); + protect_entry(file_ptr, entry_type, 4); if ( !pass ) CACHE_ERROR("protect_entry failed") for(u = 0; u < 4; u++) { - create_flush_dependency(cache_ptr, entry_type, 4, entry_type, (int32_t)u); + create_flush_dependency(entry_type, 4, entry_type, (int32_t)u); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32802,7 +32798,7 @@ check_flush_deps_order(void) add_flush_op(entry_type, 4, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 4, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -32810,11 +32806,11 @@ check_flush_deps_order(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") /* Mark entries 0-4 dirty, so they are flushed */ - dirty_entry(cache_ptr, entry_type, 0, FALSE); - dirty_entry(cache_ptr, entry_type, 1, FALSE); - dirty_entry(cache_ptr, entry_type, 2, FALSE); - dirty_entry(cache_ptr, entry_type, 3, FALSE); - dirty_entry(cache_ptr, entry_type, 4, TRUE); + dirty_entry(file_ptr, entry_type, 0, FALSE); + dirty_entry(file_ptr, entry_type, 1, FALSE); + dirty_entry(file_ptr, entry_type, 2, FALSE); + dirty_entry(file_ptr, entry_type, 3, FALSE); + dirty_entry(file_ptr, entry_type, 4, TRUE); if ( !pass ) CACHE_ERROR("dirty_entry failed") /* Reset 'flushed' flag & 'flush_order' value in expected array */ @@ -32832,7 +32828,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -32866,7 +32862,7 @@ check_flush_deps_order(void) /* Destroy flush dependency between entries */ { for(u = 0; u < 4; u++) { - destroy_flush_dependency(cache_ptr, entry_type, 4, entry_type, (int32_t)u); + destroy_flush_dependency(entry_type, 4, entry_type, (int32_t)u); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32898,11 +32894,11 @@ check_flush_deps_order(void) /* Create flush dependency between entries (child) 0,1,2,3->4 (parent) */ { - protect_entry(cache_ptr, entry_type, 0); + protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") for(u = 1; u < 5; u++) { - create_flush_dependency(cache_ptr, entry_type, 0, entry_type, (int32_t)u); + create_flush_dependency(entry_type, 0, entry_type, (int32_t)u); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -32939,7 +32935,7 @@ check_flush_deps_order(void) add_flush_op(entry_type, 4, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 0, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -32947,11 +32943,11 @@ check_flush_deps_order(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") /* Mark entries 0-4 dirty, so they are flushed */ - dirty_entry(cache_ptr, entry_type, 0, TRUE); - dirty_entry(cache_ptr, entry_type, 1, FALSE); - dirty_entry(cache_ptr, entry_type, 2, FALSE); - dirty_entry(cache_ptr, entry_type, 3, FALSE); - dirty_entry(cache_ptr, entry_type, 4, FALSE); + dirty_entry(file_ptr, entry_type, 0, TRUE); + dirty_entry(file_ptr, entry_type, 1, FALSE); + dirty_entry(file_ptr, entry_type, 2, FALSE); + dirty_entry(file_ptr, entry_type, 3, FALSE); + dirty_entry(file_ptr, entry_type, 4, FALSE); if ( !pass ) CACHE_ERROR("dirty_entry failed") /* Reset 'flushed' flag & 'flush_order' value in expected array */ @@ -32969,7 +32965,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -33003,7 +32999,7 @@ check_flush_deps_order(void) /* Destroy flush dependency between entries */ { for(u = 1; u < 5; u++) { - destroy_flush_dependency(cache_ptr, entry_type, 0, entry_type, (int32_t)u); + destroy_flush_dependency(entry_type, 0, entry_type, (int32_t)u); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33039,10 +33035,10 @@ check_flush_deps_order(void) * then add entry 4 as a child of 0 */ { - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + create_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33062,10 +33058,10 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 4); + protect_entry(file_ptr, entry_type, 4); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 4, entry_type, 3); + create_flush_dependency(entry_type, 4, entry_type, 3); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33085,10 +33081,10 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 0); + protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 0, entry_type, 4); + create_flush_dependency(entry_type, 0, entry_type, 4); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33127,21 +33123,21 @@ check_flush_deps_order(void) add_flush_op(entry_type, 4, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 0, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 4, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -33149,10 +33145,10 @@ check_flush_deps_order(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") /* Mark entries 0 & 1, 3 & 4 dirty, so they are flushed */ - dirty_entry(cache_ptr, entry_type, 0, TRUE); - dirty_entry(cache_ptr, entry_type, 1, TRUE); - dirty_entry(cache_ptr, entry_type, 3, FALSE); - dirty_entry(cache_ptr, entry_type, 4, TRUE); + dirty_entry(file_ptr, entry_type, 0, TRUE); + dirty_entry(file_ptr, entry_type, 1, TRUE); + dirty_entry(file_ptr, entry_type, 3, FALSE); + dirty_entry(file_ptr, entry_type, 4, TRUE); if ( !pass ) CACHE_ERROR("dirty_entry failed") /* Reset 'flushed' flag & 'flush_order' value in expected array */ @@ -33170,7 +33166,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -33204,7 +33200,7 @@ check_flush_deps_order(void) /* Destroy flush dependency between entries, detaching 3->4 from 0 first */ { - destroy_flush_dependency(cache_ptr, entry_type, 0, entry_type, 4); + destroy_flush_dependency(entry_type, 0, entry_type, 4); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33226,7 +33222,7 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 4, entry_type, 3); + destroy_flush_dependency(entry_type, 4, entry_type, 3); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33245,7 +33241,7 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + destroy_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33273,10 +33269,10 @@ check_flush_deps_order(void) * then add entry 4 as a child of 1 */ { - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + create_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33296,10 +33292,10 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 2); + protect_entry(file_ptr, entry_type, 2); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + create_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33319,10 +33315,10 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 4); + protect_entry(file_ptr, entry_type, 4); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 4, entry_type, 3); + create_flush_dependency(entry_type, 4, entry_type, 3); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33342,7 +33338,7 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 4); + create_flush_dependency(entry_type, 1, entry_type, 4); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33380,21 +33376,21 @@ check_flush_deps_order(void) add_flush_op(entry_type, 4, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 2, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 4, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -33402,11 +33398,11 @@ check_flush_deps_order(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") /* Mark entries 0-4 dirty, so they are flushed */ - dirty_entry(cache_ptr, entry_type, 0, FALSE); - dirty_entry(cache_ptr, entry_type, 1, TRUE); - dirty_entry(cache_ptr, entry_type, 2, TRUE); - dirty_entry(cache_ptr, entry_type, 3, FALSE); - dirty_entry(cache_ptr, entry_type, 4, TRUE); + dirty_entry(file_ptr, entry_type, 0, FALSE); + dirty_entry(file_ptr, entry_type, 1, TRUE); + dirty_entry(file_ptr, entry_type, 2, TRUE); + dirty_entry(file_ptr, entry_type, 3, FALSE); + dirty_entry(file_ptr, entry_type, 4, TRUE); if ( !pass ) CACHE_ERROR("dirty_entry failed") /* Reset 'flushed' flag & 'flush_order' value in expected array */ @@ -33424,7 +33420,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -33460,7 +33456,7 @@ check_flush_deps_order(void) /* Destroy flush dependency between entries, detaching 3->4 from 1 first */ { - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 4); + destroy_flush_dependency(entry_type, 1, entry_type, 4); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33481,7 +33477,7 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 4, entry_type, 3); + destroy_flush_dependency(entry_type, 4, entry_type, 3); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33500,7 +33496,7 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + destroy_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33519,7 +33515,7 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + destroy_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33547,10 +33543,10 @@ check_flush_deps_order(void) * then add entry 4 as a child of 2 */ { - protect_entry(cache_ptr, entry_type, 1); + protect_entry(file_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + create_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33570,10 +33566,10 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 2); + protect_entry(file_ptr, entry_type, 2); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + create_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33593,10 +33589,10 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - protect_entry(cache_ptr, entry_type, 4); + protect_entry(file_ptr, entry_type, 4); if ( !pass ) CACHE_ERROR("protect_entry failed") - create_flush_dependency(cache_ptr, entry_type, 4, entry_type, 3); + create_flush_dependency(entry_type, 4, entry_type, 3); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33616,7 +33612,7 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - create_flush_dependency(cache_ptr, entry_type, 2, entry_type, 4); + create_flush_dependency(entry_type, 2, entry_type, 4); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33650,21 +33646,21 @@ check_flush_deps_order(void) add_flush_op(entry_type, 4, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 1, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 2, /* int32_t idx */ FALSE, /* int32_t dirty */ H5C__NO_FLAGS_SET); /* unsigned int flags */ if ( !pass ) CACHE_ERROR("unprotect_entry failed") - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 4, /* int32_t idx */ FALSE, /* int32_t dirty */ @@ -33672,11 +33668,11 @@ check_flush_deps_order(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") /* Mark entries 0-4 dirty, so they are flushed */ - dirty_entry(cache_ptr, entry_type, 0, FALSE); - dirty_entry(cache_ptr, entry_type, 1, TRUE); - dirty_entry(cache_ptr, entry_type, 2, TRUE); - dirty_entry(cache_ptr, entry_type, 3, FALSE); - dirty_entry(cache_ptr, entry_type, 4, TRUE); + dirty_entry(file_ptr, entry_type, 0, FALSE); + dirty_entry(file_ptr, entry_type, 1, TRUE); + dirty_entry(file_ptr, entry_type, 2, TRUE); + dirty_entry(file_ptr, entry_type, 3, FALSE); + dirty_entry(file_ptr, entry_type, 4, TRUE); if ( !pass ) CACHE_ERROR("dirty_entry failed") /* Reset 'flushed' flag & 'flush_order' value in expected array */ @@ -33694,7 +33690,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -33730,7 +33726,7 @@ check_flush_deps_order(void) /* Destroy flush dependency between entries, detaching 3->4 from 2 first */ { - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 4); + destroy_flush_dependency(entry_type, 2, entry_type, 4); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33747,7 +33743,7 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 4, entry_type, 3); + destroy_flush_dependency(entry_type, 4, entry_type, 3); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33766,7 +33762,7 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 2, entry_type, 1); + destroy_flush_dependency(entry_type, 2, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33785,7 +33781,7 @@ check_flush_deps_order(void) expected); /* struct expected_entry_staus[] */ if ( !pass ) CACHE_ERROR("verify_entry_status failed") - destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + destroy_flush_dependency(entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") /* Change expected values, and verify the status of the entries @@ -33807,8 +33803,8 @@ check_flush_deps_order(void) done: - if(cache_ptr) - takedown_cache(cache_ptr, FALSE, FALSE); + if(file_ptr) + takedown_cache(file_ptr, FALSE, FALSE); if ( pass ) PASSED() @@ -33837,11 +33833,11 @@ done: static unsigned check_notify_cb(void) { + H5F_t * file_ptr = NULL; /* File for this test */ H5C_t * cache_ptr = NULL; /* Metadata cache for this test */ test_entry_t *base_addr; /* Base address of entries for test */ test_entry_t * entry_ptr; /* Cache entry to examine/manipulate */ int entry_type = NOTIFY_ENTRY_TYPE; /* Use entry w/notify callback (size of entries doesn't matter) */ - size_t entry_size = NOTIFY_ENTRY_SIZE; /* 1 byte */ unsigned u; /* Local index variable */ struct expected_entry_status expected[5] = { @@ -33863,14 +33859,15 @@ check_notify_cb(void) */ reset_entries(); - cache_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + cache_ptr = file_ptr->shared->cache; base_addr = entries[entry_type]; if ( !pass ) CACHE_ERROR("setup_cache failed") /* Insert entries to work with into the cache */ for(u = 0; u < 5; u++) { - insert_entry(cache_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET); + insert_entry(file_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET); if ( !pass ) CACHE_ERROR("insert_entry failed") /* Change expected values, and verify the status of the entries @@ -33896,7 +33893,7 @@ check_notify_cb(void) /* Remove entries from the cache */ for(u = 0; u < 5; u++) { - expunge_entry(cache_ptr, entry_type, (int32_t)u); + expunge_entry(file_ptr, entry_type, (int32_t)u); if ( !pass ) CACHE_ERROR("expunge_entry failed") /* Change expected values, and verify the status of the entries @@ -33924,7 +33921,7 @@ check_notify_cb(void) /* Protect entries to bring them into the cache */ for(u = 0; u < 5; u++) { - protect_entry(cache_ptr, entry_type, (int32_t)u); + protect_entry(file_ptr, entry_type, (int32_t)u); if ( !pass ) CACHE_ERROR("protect_entry failed") /* Change expected values, and verify the status of the entries @@ -33952,7 +33949,7 @@ check_notify_cb(void) /* Unprotect entries, evicting them from the cache */ for(u = 0; u < 5; u++) { - unprotect_entry(cache_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET); if ( !pass ) CACHE_ERROR("unprotect_entry failed") /* Change expected values, and verify the status of the entries @@ -33979,7 +33976,7 @@ check_notify_cb(void) /* Remove entries from the cache */ for(u = 0; u < 5; u++) { - expunge_entry(cache_ptr, entry_type, (int32_t)u); + expunge_entry(file_ptr, entry_type, (int32_t)u); if ( !pass ) CACHE_ERROR("expunge_entry failed") /* Change expected values, and verify the status of the entries @@ -34006,8 +34003,8 @@ check_notify_cb(void) } /* end for */ done: - if(cache_ptr) - takedown_cache(cache_ptr, FALSE, FALSE); + if(file_ptr) + takedown_cache(file_ptr, FALSE, FALSE); if ( pass ) PASSED() diff --git a/test/cache_api.c b/test/cache_api.c index ad5c823..796e303 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -27,11 +27,6 @@ /* global variable declarations: */ -const char *FILENAME[] = { - "cache_api", - NULL -}; - /* macro definitions */ #define RESIZE_CONFIGS_ARE_EQUAL(a, b, compare_init) \ @@ -331,7 +326,7 @@ check_fapl_mdc_api_calls(void) /* setup the file name */ if ( pass ) { - if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) + if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass = FALSE; @@ -354,7 +349,7 @@ check_fapl_mdc_api_calls(void) /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = H5I_object_verify(file_id, H5I_FILE); + file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -480,7 +475,7 @@ check_fapl_mdc_api_calls(void) /* setup the file name */ if ( pass ) { - if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) + if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass = FALSE; @@ -503,7 +498,7 @@ check_fapl_mdc_api_calls(void) /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = H5I_object_verify(file_id, H5I_FILE); + file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -651,7 +646,7 @@ validate_mdc_config(hid_t file_id, /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = H5I_object_verify(file_id, H5I_FILE); + file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -919,7 +914,7 @@ check_file_mdc_api_calls(void) /* setup the file name */ if ( pass ) { - if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) + if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass = FALSE; @@ -1123,7 +1118,7 @@ check_and_validate_cache_hit_rate(hid_t file_id, /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = H5I_object_verify(file_id, H5I_FILE); + file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -1262,7 +1257,7 @@ check_and_validate_cache_size(hid_t file_id, /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = H5I_object_verify(file_id, H5I_FILE); + file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -1381,7 +1376,6 @@ mdc_api_call_smoke_check(int express_test) const char * fcn_name = "mdc_api_call_smoke_check()"; char filename[512]; hbool_t valid_chunk; - hbool_t report_progress = FALSE; hbool_t dump_hit_rate = FALSE; int64_t min_accesses = 1000; double min_hit_rate = 0.90; @@ -1524,16 +1518,9 @@ mdc_api_call_smoke_check(int express_test) */ /* setup the file name */ - - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout,"\nSetting up file ... "); - HDfflush(stdout); - } - if ( pass ) { - if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) + if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass = FALSE; @@ -1569,21 +1556,7 @@ mdc_api_call_smoke_check(int express_test) /* verify that the cache is now set to the alternate config */ validate_mdc_config(file_id, &mod_config_1, TRUE, 2); - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout,"Done.\n"); /* setting up file */ - HDfflush(stdout); - } - - /* create the datasets */ - - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout,"Creating datasets ... "); - HDfflush(stdout); - } - if ( pass ) { i = 0; @@ -1688,22 +1661,10 @@ mdc_api_call_smoke_check(int express_test) } } - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout,"Done.\n"); - HDfflush(stdout); - } - /* initialize all datasets on a round robin basis */ i = 0; progress_counter = 0; - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout, "Initializing datasets "); - HDfflush(stdout); - } - while ( ( pass ) && ( i < DSET_SIZE ) ) { j = 0; @@ -1770,23 +1731,6 @@ mdc_api_call_smoke_check(int express_test) i += CHUNK_SIZE; - if ( ( pass ) && ( report_progress ) ) { - - progress_counter += CHUNK_SIZE; - - if ( progress_counter >= DSET_SIZE / 20 ) { - - progress_counter = 0; - HDfprintf(stdout, "."); - HDfflush(stdout); - } - } - } - - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout," Done.\n"); /* initializing data sets */ - HDfflush(stdout); } /* set alternate config 2 */ @@ -1803,13 +1747,6 @@ mdc_api_call_smoke_check(int express_test) validate_mdc_config(file_id, &mod_config_2, TRUE, 3); /* do random reads on all datasets */ - - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout, "Doing random reads on all datasets "); - HDfflush(stdout); - } - n = 0; progress_counter = 0; while ( ( pass ) && ( n < NUM_RANDOM_ACCESSES ) ) @@ -1895,26 +1832,8 @@ mdc_api_call_smoke_check(int express_test) n++; - if ( ( pass ) && ( report_progress ) ) { - - progress_counter++; - - if ( progress_counter >= NUM_RANDOM_ACCESSES / 20 ) { - - progress_counter = 0; - HDfprintf(stdout, "."); - HDfflush(stdout); - } - } - } - - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout, " Done.\n"); /* random reads on all data sets */ - HDfflush(stdout); } - /* close the file spaces we are done with */ i = 1; while ( ( pass ) && ( i < NUM_DSETS ) ) @@ -1954,13 +1873,6 @@ mdc_api_call_smoke_check(int express_test) validate_mdc_config(file_id, &mod_config_3, TRUE, 4); /* do random reads on data set 0 only */ - - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout, "Doing random reads on dataset 0 "); - HDfflush(stdout); - } - m = 0; n = 0; progress_counter = 0; @@ -2042,33 +1954,8 @@ mdc_api_call_smoke_check(int express_test) n++; - if ( ( pass ) && ( report_progress ) ) { - - progress_counter++; - - if ( progress_counter >= NUM_RANDOM_ACCESSES / 20 ) { - - progress_counter = 0; - HDfprintf(stdout, "."); - HDfflush(stdout); - } - } - } - - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout, " Done.\n"); /* random reads data set 0 */ - HDfflush(stdout); - } - - - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout,"Shutting down ... "); - HDfflush(stdout); } - /* close file space 0 */ if ( pass ) { @@ -2125,13 +2012,6 @@ mdc_api_call_smoke_check(int express_test) } } - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout,"Done.\n"); /* shutting down */ - HDfflush(stdout); - } - - if ( pass ) { PASSED(); } else { H5_FAILED(); } if ( ! pass ) @@ -3724,7 +3604,7 @@ check_file_mdc_api_errs(void) HDfprintf(stdout, "%s: calling h5_fixname().\n", fcn_name); } - if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) + if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass = FALSE; diff --git a/test/cache_common.c b/test/cache_common.c index 4768f53..335704d 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -19,18 +19,49 @@ * This file contains common code for tests of the cache * implemented in H5C.c */ +#include "H5private.h" /* Put this first, so H5open() isn't invoked in public macros */ #include "h5test.h" +#include "H5Cprivate.h" #include "H5Iprivate.h" -#include "H5ACprivate.h" +#include "H5MFprivate.h" #include "cache_common.h" /* global variable declarations: */ +const char *FILENAME[] = { + "cache_test", + "cache_api_test", + NULL +}; + +hid_t saved_fapl_id = H5P_DEFAULT; /* store the fapl id here between + * cache setup and takedown. Note + * that if saved_fapl_id == H5P_DEFAULT, + * we assume that there is no fapl to + * close. + */ + +hid_t saved_fid = -1; /* store the file id here between cache setup + * and takedown. + */ + +H5C_t * saved_cache = NULL; /* store the pointer to the instance of + * of H5C_t created by H5Fcreate() + * here between test cache setup and + * shutdown. + */ + +haddr_t saved_actual_base_addr = HADDR_UNDEF; /* Store the address of the + space allocated for cache items in the file between + cache setup & takedown */ + hbool_t write_permitted = TRUE; hbool_t pass = TRUE; /* set to false on error */ hbool_t skip_long_tests = TRUE; hbool_t run_full_test = TRUE; +hbool_t try_core_file_driver = FALSE; +hbool_t core_file_driver_failed = FALSE; const char *failure_mssg = NULL; test_entry_t pico_entries[NUM_PICO_ENTRIES], orig_pico_entries[NUM_PICO_ENTRIES]; @@ -266,6 +297,9 @@ static void * load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, void *udata2); static herr_t size(H5F_t * f, void * thing, size_t * size_ptr); static herr_t notify(H5C_notify_action_t action, void *thing); +static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, + struct flush_op *op_ptr, unsigned *flags_ptr); + @@ -647,8 +681,7 @@ destroy(H5F_t UNUSED * f, if ( pinned_entry_ptr->pinning_ref_count <= 0 ) { - unpin_entry(pinned_entry_ptr->cache_ptr, - pinned_entry_ptr->type, + unpin_entry(pinned_entry_ptr->type, pinned_entry_ptr->index); } @@ -806,7 +839,7 @@ flush(H5F_t *f, for ( i = 0; i < entry_ptr->num_flush_ops; i++ ) { - execute_flush_op(entry_ptr->cache_ptr, + execute_flush_op(f, entry_ptr, &((entry_ptr->flush_ops)[i]), flags_ptr); @@ -1363,7 +1396,7 @@ add_flush_op(int target_type, */ void -create_pinned_entry_dependency(H5C_t * cache_ptr, +create_pinned_entry_dependency(H5F_t * file_ptr, int pinning_type, int pinning_idx, int pinned_type, @@ -1407,8 +1440,8 @@ create_pinned_entry_dependency(H5C_t * cache_ptr, if ( pinned_entry_ptr->pinning_ref_count == 0 ) { - protect_entry(cache_ptr, pinned_type, pinned_idx); - unprotect_entry(cache_ptr, pinned_type, pinned_idx, FALSE, + protect_entry(file_ptr, pinned_type, pinned_idx); + unprotect_entry(file_ptr, pinned_type, pinned_idx, FALSE, H5C__PIN_ENTRY_FLAG); } @@ -1446,7 +1479,7 @@ create_pinned_entry_dependency(H5C_t * cache_ptr, */ void -dirty_entry(H5C_t * cache_ptr, +dirty_entry(H5F_t * file_ptr, int32_t type, int32_t idx, hbool_t dirty_pin) @@ -1454,13 +1487,16 @@ dirty_entry(H5C_t * cache_ptr, test_entry_t * base_addr; test_entry_t * entry_ptr; - HDassert( cache_ptr ); + HDassert( file_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); if ( pass ) { if ( dirty_pin ) { + H5C_t *cache_ptr = file_ptr->shared->cache; + + HDassert(cache_ptr); if ( ! entry_in_cache(cache_ptr, type, idx) ) { @@ -1483,14 +1519,14 @@ dirty_entry(H5C_t * cache_ptr, } else { - mark_pinned_entry_dirty(cache_ptr, type, idx, FALSE, (size_t)0); + mark_pinned_entry_dirty(type, idx, FALSE, (size_t)0); } } } else { - protect_entry(cache_ptr, type, idx); - unprotect_entry(cache_ptr, type, idx, TRUE, H5C__NO_FLAGS_SET); + protect_entry(file_ptr, type, idx); + unprotect_entry(file_ptr, type, idx, TRUE, H5C__NO_FLAGS_SET); } } @@ -1520,11 +1556,15 @@ dirty_entry(H5C_t * cache_ptr, */ void -execute_flush_op(H5C_t * cache_ptr, +execute_flush_op(H5F_t * file_ptr, struct test_entry_t * entry_ptr, struct flush_op * op_ptr, unsigned * flags_ptr) { + H5C_t * cache_ptr; + + HDassert( file_ptr ) ; + cache_ptr = file_ptr->shared->cache; HDassert( cache_ptr != NULL ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); HDassert( entry_ptr != NULL ); @@ -1555,7 +1595,7 @@ execute_flush_op(H5C_t * cache_ptr, HDassert( ( entry_ptr->type != op_ptr->type ) || ( entry_ptr->index != op_ptr->idx ) ); - dirty_entry(cache_ptr, op_ptr->type, op_ptr->idx, op_ptr->flag); + dirty_entry(file_ptr, op_ptr->type, op_ptr->idx, op_ptr->flag); break; case FLUSH_OP__RESIZE: @@ -1586,7 +1626,7 @@ execute_flush_op(H5C_t * cache_ptr, /* change the size of some other entry */ - resize_entry(cache_ptr, op_ptr->type, op_ptr->idx, + resize_entry(file_ptr, op_ptr->type, op_ptr->idx, op_ptr->size, op_ptr->flag); } break; @@ -1697,22 +1737,22 @@ reset_entries(void) { int i; + int32_t max_index; + test_entry_t * base_addr; + test_entry_t * orig_base_addr; if( !orig_entry_arrays_init) { - haddr_t addr = 0; + haddr_t addr = PICO_BASE_ADDR; haddr_t alt_addr = PICO_ALT_BASE_ADDR; + size_t entry_size; for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ ) { - int32_t max_index; - size_t entry_size; - test_entry_t * base_addr; - test_entry_t * orig_base_addr; int j; - entry_size = entry_sizes[i]; max_index = max_indices[i]; + entry_size = entry_sizes[i]; base_addr = entries[i]; orig_base_addr = orig_entries[i]; @@ -1809,9 +1849,9 @@ reset_entries(void) else { for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ ) { - int32_t max_index = max_indices[i]; - test_entry_t * base_addr = entries[i]; - test_entry_t * orig_base_addr = orig_entries[i]; + max_index = max_indices[i]; + base_addr = entries[i]; + orig_base_addr = orig_entries[i]; /* Make copy of entries in base_addr for later */ HDmemcpy(base_addr, orig_base_addr, (size_t)(max_index + 1) * sizeof( *base_addr )); @@ -1851,7 +1891,7 @@ reset_entries(void) */ void -resize_entry(H5C_t * cache_ptr, +resize_entry(H5F_t * file_ptr, int32_t type, int32_t idx, size_t new_size, @@ -1860,7 +1900,6 @@ resize_entry(H5C_t * cache_ptr, test_entry_t * base_addr; test_entry_t * entry_ptr; - HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( type == VARIABLE_ENTRY_TYPE ); HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); @@ -1876,6 +1915,9 @@ resize_entry(H5C_t * cache_ptr, HDassert( entry_ptr == entry_ptr->self ); if ( resize_pin ) { + H5C_t *cache_ptr = file_ptr->shared->cache; + + HDassert( cache_ptr ); if ( ! entry_in_cache(cache_ptr, type, idx) ) { @@ -1891,14 +1933,13 @@ resize_entry(H5C_t * cache_ptr, } else { - mark_pinned_entry_dirty(cache_ptr, type, idx, - TRUE, new_size); + mark_pinned_entry_dirty(type, idx, TRUE, new_size); } } } else { - protect_entry(cache_ptr, type, idx); - unprotect_entry_with_size_change(cache_ptr, type, idx, + protect_entry(file_ptr, type, idx); + unprotect_entry_with_size_change(file_ptr, type, idx, H5C__SIZE_CHANGED_FLAG, new_size); } } @@ -1970,8 +2011,7 @@ resize_pinned_entry(H5C_t * cache_ptr, entry_ptr->size = new_size; - result = H5C_resize_pinned_entry(cache_ptr, - (void *)entry_ptr, + result = H5C_resize_pinned_entry((void *)entry_ptr, new_size); if ( result != SUCCEED ) { @@ -2488,38 +2528,267 @@ verify_unprotected(void) * Programmer: John Mainzer * 6/11/04 * - * Modifications: - * *------------------------------------------------------------------------- */ -H5C_t * +H5F_t * setup_cache(size_t max_cache_size, size_t min_clean_size) { + const char * fcn_name = "setup_cache()"; + char filename[512]; + hbool_t show_progress = FALSE; + hbool_t verbose = TRUE; + int mile_stone = 1; + hid_t fid = -1; + haddr_t actual_base_addr; + H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; + H5F_t * ret_val = NULL; + hid_t fapl_id = H5P_DEFAULT; - cache_ptr = H5C_create(max_cache_size, - min_clean_size, - (NUMBER_OF_ENTRY_TYPES - 1), - (const char **)entry_type_names, - check_write_permitted, - TRUE, - NULL, - NULL); + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( cache_ptr == NULL ) { + saved_fid = -1; - pass = FALSE; - failure_mssg = "H5C_create() returned NULL."; + /* setup the file name */ + if ( pass ) { - } else { + if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( ( pass ) && ( try_core_file_driver ) ) { + + if ( (fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == FAIL ) { + + pass = FALSE; + failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n"; + } + else if ( H5Pset_fapl_core(fapl_id, MAX_ADDR, FALSE) < 0 ) { + + H5Pclose(fapl_id); + fapl_id = H5P_DEFAULT; + pass = FALSE; + failure_mssg = "H5P_set_fapl_core() failed.\n"; + } + else if ( (fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) + < 0 ) { + + core_file_driver_failed = TRUE; + + if ( verbose ) { + HDfprintf(stdout, "%s: H5Fcreate() with CFD failed.\n", fcn_name); + } + + } else { + + saved_fapl_id = fapl_id; + } + } + + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* if we either aren't using the core file driver, or a create + * with the core file driver failed, try again with a regular file. + * If this fails, we are cooked. + */ + if ( ( pass ) && ( fid < 0 ) ) { + + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + + saved_fid = fid; + + if ( fid < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fcreate() failed."; + + if ( verbose ) { + HDfprintf(stdout, "%s: H5Fcreate() failed.\n", fcn_name); + } + } + } + + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + HDassert( fid >= 0 ); + + saved_fid = fid; + + if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fflush() failed."; + + if ( verbose ) { + HDfprintf(stdout, "%s: H5Fflush() failed.\n", fcn_name); + } + + } else { + + file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE); + + if ( file_ptr == NULL ) { + + pass = FALSE; + failure_mssg = "Can't get file_ptr."; + + if ( verbose ) { + HDfprintf(stdout, "%s: H5Fflush() failed.\n", fcn_name); + } + } + } + } + + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + /* A bit of fancy footwork here: + * + * The call to H5Fcreate() allocates an instance of H5C_t, + * initializes it, and stores its address in f->shared->cache. + * + * We don't want to use this cache, as it has a bunch of extra + * initialization that may change over time, and in any case + * it will not in general be configured the way we want it. + * + * We used to deal with this problem by storing the file pointer + * in another instance of H5C_t, and then ignoring the original + * version. However, this strategy doesn't work any more, as + * we can't store the file pointer in the instance of H5C_t, + * and we have modified many cache routines to use a file + * pointer to look up the target cache. + * + * Thus we now make note of the address of the instance of + * H5C_t created by the call to H5Fcreate(), set + * file_ptr->shared->cache to NULL, call H5C_create() + * to allocate a new instance of H5C_t for test purposes, + * and store than new instance's address in + * file_ptr->shared->cache. + * + * On shut down, we call H5C_dest on our instance of H5C_t, + * set file_ptr->shared->cache to point to the original + * instance, and then close the file normally. + */ + + HDassert( saved_cache == NULL ); + + saved_cache = file_ptr->shared->cache; + + file_ptr->shared->cache = NULL; + + cache_ptr = H5C_create(max_cache_size, + min_clean_size, + (NUMBER_OF_ENTRY_TYPES - 1), + (const char **)entry_type_names, + check_write_permitted, + TRUE, + NULL, + NULL); + + file_ptr->shared->cache = cache_ptr; + } + + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + if ( cache_ptr == NULL ) { + + pass = FALSE; + failure_mssg = "H5C_create() failed."; + + if ( verbose ) { + HDfprintf(stdout, "%s: H5C_create() failed.\n", fcn_name); + } + + } else if ( cache_ptr->magic != H5C__H5C_T_MAGIC ) { + + pass = FALSE; + failure_mssg = "Bad cache_ptr magic."; + + if ( verbose ) { + HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", fcn_name); + } + } + } + + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { /* allocate space for test entries */ + + actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT, + (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); + + if ( actual_base_addr == HADDR_UNDEF ) { + + pass = FALSE; + failure_mssg = "H5MF_alloc() failed."; + + if ( verbose ) { + HDfprintf(stdout, "%s: H5MF_alloc() failed.\n", fcn_name); + } + + } else if ( actual_base_addr > BASE_ADDR ) { + + /* If this happens, must increase BASE_ADDR so that the + * actual_base_addr is <= BASE_ADDR. This should only happen + * if the size of the superblock is increase. + */ + pass = FALSE; + failure_mssg = "actual_base_addr > BASE_ADDR"; + + if ( verbose ) { + HDfprintf(stdout, "%s: actual_base_addr > BASE_ADDR.\n", + fcn_name); + } + } + + saved_actual_base_addr = actual_base_addr; + } + + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + H5C_stats__reset(cache_ptr); H5C_set_skip_flags(cache_ptr, TRUE, TRUE); + + ret_val = file_ptr; } - return(cache_ptr); + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + return(ret_val); } /* setup_cache() */ @@ -2534,26 +2803,83 @@ setup_cache(size_t max_cache_size, * Programmer: John Mainzer * 6/11/04 * - * Modifications: - * *------------------------------------------------------------------------- */ void -takedown_cache(H5C_t * cache_ptr, +takedown_cache(H5F_t * file_ptr, hbool_t dump_stats, hbool_t dump_detailed_stats) { - HDassert(cache_ptr); + char filename[512]; - if ( pass ) { + if ( file_ptr != NULL ) { + H5C_t * cache_ptr = file_ptr->shared->cache; if ( dump_stats ) { H5C_stats(cache_ptr, "test cache", dump_detailed_stats); } + + flush_cache(file_ptr, TRUE, FALSE, FALSE); + + H5C_dest(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT); + + if ( saved_cache != NULL ) { + + file_ptr->shared->cache = saved_cache; + saved_cache = NULL; + } - H5C_dest(NULL, -1, -1, cache_ptr); + } + + if ( saved_fapl_id != H5P_DEFAULT ) { + + H5Pclose(saved_fapl_id); + saved_fapl_id = H5P_DEFAULT; + } + + if ( saved_fid != -1 ) { + + if ( H5F_addr_defined(saved_actual_base_addr) ) { + + if ( NULL == file_ptr ) { + file_ptr = (H5F_t *)H5I_object_verify(saved_fid, H5I_FILE); + HDassert ( file_ptr ); + } + + H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT, saved_actual_base_addr, + (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); + saved_actual_base_addr = HADDR_UNDEF; + } + + if ( H5Fclose(saved_fid) < 0 ) { + + pass = FALSE; + failure_mssg = "couldn't close test file."; + + } else { + + saved_fid = -1; + + } + + if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { + + if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "couldn't delete test file."; + + } + } } return; @@ -2581,7 +2907,7 @@ takedown_cache(H5C_t * cache_ptr, */ void -expunge_entry(H5C_t * cache_ptr, +expunge_entry(H5F_t * file_ptr, int32_t type, int32_t idx) { @@ -2591,8 +2917,12 @@ expunge_entry(H5C_t * cache_ptr, test_entry_t * entry_ptr; if ( pass ) { +#ifndef NDEBUG + H5C_t * cache_ptr = file_ptr->shared->cache; HDassert( cache_ptr ); +#endif /* NDEBUG */ + HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); @@ -2608,8 +2938,8 @@ expunge_entry(H5C_t * cache_ptr, HDassert( ! ( entry_ptr->header.is_pinned ) ); HDassert( ! ( entry_ptr->is_pinned ) ); - result = H5C_expunge_entry(NULL, -1, -1, cache_ptr, &(types[type]), - entry_ptr->addr, H5AC__NO_FLAGS_SET); + result = H5C_expunge_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[type]), entry_ptr->addr, H5C__NO_FLAGS_SET); if ( result < 0 ) { @@ -2641,29 +2971,32 @@ expunge_entry(H5C_t * cache_ptr, */ void -flush_cache(H5C_t * cache_ptr, +flush_cache(H5F_t * file_ptr, hbool_t destroy_entries, hbool_t dump_stats, hbool_t dump_detailed_stats) { const char * fcn_name = "flush_cache()"; + H5C_t * cache_ptr; herr_t result = 0; hbool_t verbose = FALSE; - HDassert(cache_ptr); - verify_unprotected(); if ( pass ) { + HDassert(file_ptr); + + cache_ptr = file_ptr->shared->cache; + if ( destroy_entries ) { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); } else { - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); } } @@ -2743,12 +3076,13 @@ flush_cache(H5C_t * cache_ptr, */ void -insert_entry(H5C_t * cache_ptr, +insert_entry(H5F_t * file_ptr, int32_t type, int32_t idx, hbool_t UNUSED dirty, unsigned int flags) { + H5C_t * cache_ptr; herr_t result; hbool_t insert_pinned; test_entry_t * base_addr; @@ -2756,6 +3090,8 @@ insert_entry(H5C_t * cache_ptr, if ( pass ) { + cache_ptr = file_ptr->shared->cache; + HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); @@ -2772,8 +3108,8 @@ insert_entry(H5C_t * cache_ptr, entry_ptr->is_dirty = TRUE; - result = H5C_insert_entry(NULL, -1, -1, cache_ptr, &(types[type]), - entry_ptr->addr, (void *)entry_ptr, flags); + result = H5C_insert_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[type]), entry_ptr->addr, (void *)entry_ptr, flags); if ( ( result < 0 ) || ( entry_ptr->header.is_protected ) || @@ -2845,8 +3181,7 @@ insert_entry(H5C_t * cache_ptr, */ void -mark_pinned_entry_dirty(H5C_t * cache_ptr, - int32_t type, +mark_pinned_entry_dirty(int32_t type, int32_t idx, hbool_t size_changed, size_t new_size) @@ -2858,7 +3193,6 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr, if ( pass ) { - HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); @@ -2868,7 +3202,6 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr, HDassert( entry_ptr->index == idx ); HDassert( entry_ptr->type == type ); HDassert( entry_ptr == entry_ptr->self ); - HDassert( entry_ptr->cache_ptr == cache_ptr ); HDassert( ! (entry_ptr->header.is_protected) ); HDassert( entry_ptr->header.is_pinned ); HDassert( entry_ptr->is_pinned ); @@ -2881,8 +3214,7 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr, entry_ptr->size = new_size; } - result = H5C_mark_pinned_entry_dirty(cache_ptr, - (void *)entry_ptr, + result = H5C_mark_pinned_entry_dirty((void *)entry_ptr, size_changed, new_size); @@ -2943,8 +3275,7 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr, */ void -mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, - int32_t type, +mark_pinned_or_protected_entry_dirty(int32_t type, int32_t idx) { /* const char * fcn_name = "mark_pinned_or_protected_entry_dirty()"; */ @@ -2954,7 +3285,6 @@ mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, if ( pass ) { - HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); @@ -2964,14 +3294,12 @@ mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, HDassert( entry_ptr->index == idx ); HDassert( entry_ptr->type == type ); HDassert( entry_ptr == entry_ptr->self ); - HDassert( entry_ptr->cache_ptr == cache_ptr ); HDassert( entry_ptr->header.is_protected || entry_ptr->header.is_pinned ); entry_ptr->is_dirty = TRUE; - result = H5C_mark_pinned_or_protected_entry_dirty(cache_ptr, - (void *)entry_ptr); + result = H5C_mark_pinned_or_protected_entry_dirty((void *)entry_ptr); if ( ( result < 0 ) || @@ -3137,17 +3465,20 @@ rename_entry(H5C_t * cache_ptr, */ void -protect_entry(H5C_t * cache_ptr, +protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx) { /* const char * fcn_name = "protect_entry()"; */ + H5C_t * cache_ptr; test_entry_t * base_addr; test_entry_t * entry_ptr; H5C_cache_entry_t * cache_entry_ptr; if ( pass ) { + cache_ptr = file_ptr->shared->cache; + HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); @@ -3160,9 +3491,8 @@ protect_entry(H5C_t * cache_ptr, HDassert( entry_ptr == entry_ptr->self ); HDassert( !(entry_ptr->is_protected) ); - cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(NULL, -1, -1, cache_ptr, &(types[type]), - entry_ptr->addr, NULL, NULL, - H5C__NO_FLAGS_SET); + cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[type]), entry_ptr->addr, NULL, NULL, H5C__NO_FLAGS_SET); if ( ( cache_entry_ptr != (void *)entry_ptr ) || ( !(entry_ptr->header.is_protected) ) || @@ -3234,17 +3564,20 @@ protect_entry(H5C_t * cache_ptr, */ void -protect_entry_ro(H5C_t * cache_ptr, +protect_entry_ro(H5F_t * file_ptr, int32_t type, int32_t idx) { /* const char * fcn_name = "protect_entry_ro()"; */ + H5C_t *cache_ptr; test_entry_t * base_addr; test_entry_t * entry_ptr; H5C_cache_entry_t * cache_entry_ptr; if ( pass ) { + cache_ptr = file_ptr->shared->cache; + HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); @@ -3259,9 +3592,8 @@ protect_entry_ro(H5C_t * cache_ptr, ( ( entry_ptr->is_read_only ) && ( entry_ptr->ro_ref_count > 0 ) ) ); - cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(NULL, -1, -1, cache_ptr, &(types[type]), - entry_ptr->addr, NULL, NULL, - H5C__READ_ONLY_FLAG); + cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[type]), entry_ptr->addr, NULL, NULL, H5C__READ_ONLY_FLAG); if ( ( cache_entry_ptr != (void *)entry_ptr ) || ( !(entry_ptr->header.is_protected) ) || @@ -3309,11 +3641,9 @@ protect_entry_ro(H5C_t * cache_ptr, */ void -pin_entry(H5C_t * cache_ptr, - int32_t type, +pin_entry(int32_t type, int32_t idx) { - HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); @@ -3331,7 +3661,7 @@ pin_entry(H5C_t * cache_ptr, HDassert( entry_ptr->is_protected ); HDassert( !(entry_ptr->pinned_from_client) ); - result = H5C_pin_protected_entry(cache_ptr, (void *)entry_ptr); + result = H5C_pin_protected_entry((void *)entry_ptr); if ( result < 0 ) { @@ -3376,8 +3706,7 @@ pin_entry(H5C_t * cache_ptr, */ void -unpin_entry(H5C_t * cache_ptr, - int32_t type, +unpin_entry(int32_t type, int32_t idx) { /* const char * fcn_name = "unpin_entry()"; */ @@ -3387,7 +3716,6 @@ unpin_entry(H5C_t * cache_ptr, if ( pass ) { - HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); @@ -3397,13 +3725,12 @@ unpin_entry(H5C_t * cache_ptr, HDassert( entry_ptr->index == idx ); HDassert( entry_ptr->type == type ); HDassert( entry_ptr == entry_ptr->self ); - HDassert( entry_ptr->cache_ptr == cache_ptr ); HDassert( entry_ptr->header.is_pinned ); HDassert( entry_ptr->header.pinned_from_client ); HDassert( entry_ptr->is_pinned ); HDassert( entry_ptr->pinned_from_client ); - result = H5C_unpin_entry(cache_ptr, (void *)entry_ptr); + result = H5C_unpin_entry((void *)entry_ptr); if ( ( result < 0 ) || ( entry_ptr->header.pinned_from_client ) || @@ -3466,13 +3793,14 @@ unpin_entry(H5C_t * cache_ptr, */ void -unprotect_entry(H5C_t * cache_ptr, +unprotect_entry(H5F_t * file_ptr, int32_t type, int32_t idx, int dirty, unsigned int flags) { /* const char * fcn_name = "unprotect_entry()"; */ + H5C_t *cache_ptr; herr_t result; hbool_t pin_flag_set; hbool_t unpin_flag_set; @@ -3481,6 +3809,8 @@ unprotect_entry(H5C_t * cache_ptr, if ( pass ) { + cache_ptr = file_ptr->shared->cache; + HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); @@ -3508,9 +3838,9 @@ unprotect_entry(H5C_t * cache_ptr, entry_ptr->is_dirty = (hbool_t)(entry_ptr->is_dirty || dirty); } - result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[type]), - entry_ptr->addr, (void *)entry_ptr, - flags, (size_t)0); + result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[type]), entry_ptr->addr, (void *)entry_ptr, flags, + (size_t)0); if ( ( result < 0 ) || ( ( entry_ptr->header.is_protected ) && @@ -3622,24 +3952,26 @@ unprotect_entry(H5C_t * cache_ptr, */ void -unprotect_entry_with_size_change(H5C_t * cache_ptr, +unprotect_entry_with_size_change(H5F_t * file_ptr, int32_t type, int32_t idx, unsigned int flags, size_t new_size) { const char * fcn_name = "unprotect_entry_with_size_change()"; + H5C_t *cache_ptr; herr_t result; hbool_t dirty_flag_set; hbool_t pin_flag_set; hbool_t unpin_flag_set; hbool_t size_changed_flag_set; - hbool_t verbose = FALSE; test_entry_t * base_addr; test_entry_t * entry_ptr; if ( pass ) { + cache_ptr = file_ptr->shared->cache; + HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); @@ -3675,9 +4007,9 @@ unprotect_entry_with_size_change(H5C_t * cache_ptr, entry_ptr->size = new_size; } - result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[type]), - entry_ptr->addr, (void *)entry_ptr, - flags, new_size); + result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, + &(types[type]), entry_ptr->addr, (void *)entry_ptr, flags, + new_size); if ( ( result < 0 ) || ( entry_ptr->header.is_protected ) || @@ -3685,39 +4017,25 @@ unprotect_entry_with_size_change(H5C_t * cache_ptr, ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { - if ( verbose ) { + if ( result < 0 ) + HDfprintf(stdout, "%s: H5C_unprotect() failed.\n", fcn_name); - if ( result < 0 ) { - HDfprintf(stdout, "%s: H5C_unprotect() failed.\n", fcn_name); - } + if ( entry_ptr->header.is_protected ) + HDfprintf(stdout, "%s: entry still protected?!?.\n", fcn_name); - if ( entry_ptr->header.is_protected ) { - HDfprintf(stdout, "%s: entry still protected?!?.\n", - fcn_name); - } + if ( entry_ptr->header.type != &(types[type]) ) + HDfprintf(stdout, "%s: entry has bad type after unprotect.\n", fcn_name); - if ( entry_ptr->header.type != &(types[type]) ) { - HDfprintf(stdout, - "%s: entry has bad type after unprotect.\n", - fcn_name); - } + if ( entry_ptr->size != entry_ptr->header.size ) + HDfprintf(stdout, "%s: bad entry size after unprotect. e/a = %d/%d\n", fcn_name, + (int)(entry_ptr->size), + (int)(entry_ptr->header.size)); - if ( entry_ptr->size != entry_ptr->header.size ) { - HDfprintf(stdout, - "%s: bad entry size after unprotect. e/a = %d/%d\n", - fcn_name, - (int)(entry_ptr->size), - (int)(entry_ptr->header.size)); - } + if ( entry_ptr->addr != entry_ptr->header.addr ) + HDfprintf(stdout, "%s: bad entry addr after unprotect. e/a = 0x%llx/0x%llx\n", fcn_name, + (long long)(entry_ptr->addr), + (long long)(entry_ptr->header.addr)); - if ( entry_ptr->addr != entry_ptr->header.addr ) { - HDfprintf(stdout, - "%s: bad entry addr after unprotect. e/a = 0x%llx/0x%llx\n", - fcn_name, - (long long)(entry_ptr->addr), - (long long)(entry_ptr->header.addr)); - } - } pass = FALSE; failure_mssg = "error in H5C_unprotect()."; @@ -3778,7 +4096,7 @@ unprotect_entry_with_size_change(H5C_t * cache_ptr, */ void -row_major_scan_forward(H5C_t * cache_ptr, +row_major_scan_forward(H5F_t * file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, @@ -3794,19 +4112,25 @@ row_major_scan_forward(H5C_t * cache_ptr, int dirty_unprotects) { const char * fcn_name = "row_major_scan_forward"; - int32_t type; + H5C_t * cache_ptr; + int32_t type = 0; int32_t idx; if ( verbose ) HDfprintf(stdout, "%s(): entering.\n", fcn_name); - HDassert( lag >= 10 ); + if ( pass ) { - type = 0; + cache_ptr = file_ptr->shared->cache; - if ( ( pass ) && ( reset_stats ) ) { + HDassert( cache_ptr != NULL ); - H5C_stats__reset(cache_ptr); + HDassert( lag >= 10 ); + + if ( reset_stats ) { + + H5C_stats__reset(cache_ptr); + } } while ( ( pass ) && ( type < NUMBER_OF_ENTRY_TYPES ) ) @@ -3828,7 +4152,7 @@ row_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag)); - insert_entry(cache_ptr, type, (idx + lag), dirty_inserts, + insert_entry(file_ptr, type, (idx + lag), dirty_inserts, H5C__NO_FLAGS_SET); } @@ -3840,7 +4164,7 @@ row_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(p, %d, %d) ", type, (idx + lag - 1)); - protect_entry(cache_ptr, type, (idx + lag - 1)); + protect_entry(file_ptr, type, (idx + lag - 1)); } if ( ( pass ) && ( (idx + lag - 2) >= 0 ) && @@ -3850,7 +4174,7 @@ row_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag - 2)); - unprotect_entry(cache_ptr, type, idx+lag-2, NO_CHANGE, + unprotect_entry(file_ptr, type, idx+lag-2, NO_CHANGE, H5C__NO_FLAGS_SET); } @@ -3871,7 +4195,7 @@ row_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(p, %d, %d) ", type, (idx + lag - 3)); - protect_entry(cache_ptr, type, (idx + lag - 3)); + protect_entry(file_ptr, type, (idx + lag - 3)); } if ( ( pass ) && ( (idx + lag - 5) >= 0 ) && @@ -3881,7 +4205,7 @@ row_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag - 5)); - unprotect_entry(cache_ptr, type, idx+lag-5, NO_CHANGE, + unprotect_entry(file_ptr, type, idx+lag-5, NO_CHANGE, H5C__NO_FLAGS_SET); } @@ -3895,7 +4219,7 @@ row_major_scan_forward(H5C_t * cache_ptr, HDfprintf(stdout, "(p-ro, %d, %d) ", type, (idx + lag - 5)); - protect_entry_ro(cache_ptr, type, (idx + lag - 5)); + protect_entry_ro(file_ptr, type, (idx + lag - 5)); } if ( ( pass ) && ( (idx + lag - 6) >= 0 ) && @@ -3906,7 +4230,7 @@ row_major_scan_forward(H5C_t * cache_ptr, HDfprintf(stdout, "(p-ro, %d, %d) ", type, (idx + lag - 6)); - protect_entry_ro(cache_ptr, type, (idx + lag - 6)); + protect_entry_ro(file_ptr, type, (idx + lag - 6)); } if ( ( pass ) && ( (idx + lag - 7) >= 0 ) && @@ -3917,7 +4241,7 @@ row_major_scan_forward(H5C_t * cache_ptr, HDfprintf(stdout, "(p-ro, %d, %d) ", type, (idx + lag - 7)); - protect_entry_ro(cache_ptr, type, (idx + lag - 7)); + protect_entry_ro(file_ptr, type, (idx + lag - 7)); } if ( ( pass ) && ( (idx + lag - 7) >= 0 ) && @@ -3928,7 +4252,7 @@ row_major_scan_forward(H5C_t * cache_ptr, HDfprintf(stdout, "(u-ro, %d, %d) ", type, (idx + lag - 7)); - unprotect_entry(cache_ptr, type, (idx + lag - 7), + unprotect_entry(file_ptr, type, (idx + lag - 7), FALSE, H5C__NO_FLAGS_SET); } @@ -3940,7 +4264,7 @@ row_major_scan_forward(H5C_t * cache_ptr, HDfprintf(stdout, "(u-ro, %d, %d) ", type, (idx + lag - 8)); - unprotect_entry(cache_ptr, type, (idx + lag - 8), + unprotect_entry(file_ptr, type, (idx + lag - 8), FALSE, H5C__NO_FLAGS_SET); } @@ -3952,7 +4276,7 @@ row_major_scan_forward(H5C_t * cache_ptr, HDfprintf(stdout, "(u-ro, %d, %d) ", type, (idx + lag - 9)); - unprotect_entry(cache_ptr, type, (idx + lag - 9), + unprotect_entry(file_ptr, type, (idx + lag - 9), FALSE, H5C__NO_FLAGS_SET); } } /* if ( do_mult_ro_protects ) */ @@ -3962,7 +4286,7 @@ row_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(p, %d, %d) ", type, idx); - protect_entry(cache_ptr, type, idx); + protect_entry(file_ptr, type, idx); } if ( ( pass ) && ( (idx - lag + 2) >= 0 ) && @@ -3972,7 +4296,7 @@ row_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag + 2)); - unprotect_entry(cache_ptr, type, idx-lag+2, NO_CHANGE, + unprotect_entry(file_ptr, type, idx-lag+2, NO_CHANGE, H5C__NO_FLAGS_SET); } @@ -3983,7 +4307,7 @@ row_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(p, %d, %d) ", type, (idx - lag + 1)); - protect_entry(cache_ptr, type, (idx - lag + 1)); + protect_entry(file_ptr, type, (idx - lag + 1)); } @@ -3995,36 +4319,36 @@ row_major_scan_forward(H5C_t * cache_ptr, switch ( (idx - lag) %4 ) { case 0: /* we just did an insert */ - unprotect_entry(cache_ptr, type, idx - lag, + unprotect_entry(file_ptr, type, idx - lag, NO_CHANGE, H5C__NO_FLAGS_SET); break; case 1: if ( (entries[type])[idx-lag].is_dirty ) { - unprotect_entry(cache_ptr, type, idx - lag, + unprotect_entry(file_ptr, type, idx - lag, NO_CHANGE, H5C__NO_FLAGS_SET); } else { - unprotect_entry(cache_ptr, type, idx - lag, + unprotect_entry(file_ptr, type, idx - lag, dirty_unprotects, H5C__NO_FLAGS_SET); } break; case 2: /* we just did an insrt */ - unprotect_entry(cache_ptr, type, idx - lag, + unprotect_entry(file_ptr, type, idx - lag, NO_CHANGE, H5C__DELETED_FLAG); break; case 3: if ( (entries[type])[idx-lag].is_dirty ) { - unprotect_entry(cache_ptr, type, idx - lag, + unprotect_entry(file_ptr, type, idx - lag, NO_CHANGE, H5C__DELETED_FLAG); } else { - unprotect_entry(cache_ptr, type, idx - lag, + unprotect_entry(file_ptr, type, idx - lag, dirty_destroys, H5C__DELETED_FLAG); } @@ -4044,7 +4368,7 @@ row_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag)); - unprotect_entry(cache_ptr, type, idx - lag, + unprotect_entry(file_ptr, type, idx - lag, dirty_unprotects, H5C__NO_FLAGS_SET); } } @@ -4090,7 +4414,7 @@ row_major_scan_forward(H5C_t * cache_ptr, */ void -hl_row_major_scan_forward(H5C_t * cache_ptr, +hl_row_major_scan_forward(H5F_t * file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats, @@ -4100,7 +4424,8 @@ hl_row_major_scan_forward(H5C_t * cache_ptr, hbool_t dirty_inserts) { const char * fcn_name = "hl_row_major_scan_forward"; - int32_t type; + H5C_t * cache_ptr; + int32_t type = 0; int32_t idx; int32_t i; int32_t lag = 100; @@ -4109,15 +4434,19 @@ hl_row_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "%s(): entering.\n", fcn_name); - HDassert( lag > 5 ); - HDassert( max_index >= 200 ); - HDassert( max_index <= MAX_ENTRIES ); + if ( pass ) { - type = 0; + cache_ptr = file_ptr->shared->cache; - if ( ( pass ) && ( reset_stats ) ) { + HDassert( cache_ptr != NULL ); + HDassert( lag > 5 ); + HDassert( max_index >= 200 ); + HDassert( max_index <= MAX_ENTRIES ); - H5C_stats__reset(cache_ptr); + if ( reset_stats ) { + + H5C_stats__reset(cache_ptr); + } } while ( ( pass ) && ( type < NUMBER_OF_ENTRY_TYPES ) ) @@ -4136,7 +4465,7 @@ hl_row_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag)); - insert_entry(cache_ptr, type, (idx + lag), dirty_inserts, + insert_entry(file_ptr, type, (idx + lag), dirty_inserts, H5C__NO_FLAGS_SET); } @@ -4149,12 +4478,12 @@ hl_row_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(p, %d, %d) ", type, i); - protect_entry(cache_ptr, type, i); + protect_entry(file_ptr, type, i); if ( verbose ) HDfprintf(stdout, "(u, %d, %d) ", type, i); - unprotect_entry(cache_ptr, type, i, NO_CHANGE, + unprotect_entry(file_ptr, type, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i--; @@ -4190,17 +4519,11 @@ hl_row_major_scan_forward(H5C_t * cache_ptr, * Programmer: John Mainzer * 6/12/04 * - * Modifications: - * - * JRM -- 4/4/07 - * Added code supporting multiple read only protects. - * Note that this increased the minimum lag to 10. - * *------------------------------------------------------------------------- */ void -row_major_scan_backward(H5C_t * cache_ptr, +row_major_scan_backward(H5F_t * file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, @@ -4216,19 +4539,24 @@ row_major_scan_backward(H5C_t * cache_ptr, int dirty_unprotects) { const char * fcn_name = "row_major_scan_backward"; - int32_t type; + H5C_t * cache_ptr; + int32_t type = NUMBER_OF_ENTRY_TYPES - 1; int32_t idx; if ( verbose ) HDfprintf(stdout, "%s(): Entering.\n", fcn_name); - HDassert( lag >= 10 ); + if ( pass ) { - type = NUMBER_OF_ENTRY_TYPES - 1; + cache_ptr = file_ptr->shared->cache; + + HDassert( cache_ptr != NULL ); + HDassert( lag >= 10 ); - if ( ( pass ) && ( reset_stats ) ) { + if ( reset_stats ) { - H5C_stats__reset(cache_ptr); + H5C_stats__reset(cache_ptr); + } } while ( ( pass ) && ( type >= 0 ) ) @@ -4245,7 +4573,7 @@ row_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(i, %d, %d) ", type, (idx - lag)); - insert_entry(cache_ptr, type, (idx - lag), dirty_inserts, + insert_entry(file_ptr, type, (idx - lag), dirty_inserts, H5C__NO_FLAGS_SET); } @@ -4257,7 +4585,7 @@ row_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(p, %d, %d) ", type, (idx - lag + 1)); - protect_entry(cache_ptr, type, (idx - lag + 1)); + protect_entry(file_ptr, type, (idx - lag + 1)); } if ( ( pass ) && ( (idx - lag + 2) >= 0 ) && @@ -4267,7 +4595,7 @@ row_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag + 2)); - unprotect_entry(cache_ptr, type, idx-lag+2, NO_CHANGE, + unprotect_entry(file_ptr, type, idx-lag+2, NO_CHANGE, H5C__NO_FLAGS_SET); } @@ -4288,7 +4616,7 @@ row_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(p, %d, %d) ", type, (idx - lag + 3)); - protect_entry(cache_ptr, type, (idx - lag + 3)); + protect_entry(file_ptr, type, (idx - lag + 3)); } if ( ( pass ) && ( (idx - lag + 5) >= 0 ) && @@ -4298,7 +4626,7 @@ row_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag + 5)); - unprotect_entry(cache_ptr, type, idx-lag+5, NO_CHANGE, + unprotect_entry(file_ptr, type, idx-lag+5, NO_CHANGE, H5C__NO_FLAGS_SET); } @@ -4312,7 +4640,7 @@ row_major_scan_backward(H5C_t * cache_ptr, HDfprintf(stdout, "(p-ro, %d, %d) ", type, (idx - lag + 5)); - protect_entry_ro(cache_ptr, type, (idx - lag + 5)); + protect_entry_ro(file_ptr, type, (idx - lag + 5)); } if ( ( pass ) && ( (idx - lag + 6) >= 0 ) && @@ -4323,7 +4651,7 @@ row_major_scan_backward(H5C_t * cache_ptr, HDfprintf(stdout, "(p-ro, %d, %d) ", type, (idx - lag + 6)); - protect_entry_ro(cache_ptr, type, (idx - lag + 6)); + protect_entry_ro(file_ptr, type, (idx - lag + 6)); } if ( ( pass ) && ( (idx - lag + 7) >= 0 ) && @@ -4334,7 +4662,7 @@ row_major_scan_backward(H5C_t * cache_ptr, HDfprintf(stdout, "(p-ro, %d, %d) ", type, (idx - lag + 7)); - protect_entry_ro(cache_ptr, type, (idx - lag + 7)); + protect_entry_ro(file_ptr, type, (idx - lag + 7)); } if ( ( pass ) && ( (idx - lag + 7) >= 0 ) && @@ -4345,7 +4673,7 @@ row_major_scan_backward(H5C_t * cache_ptr, HDfprintf(stdout, "(u-ro, %d, %d) ", type, (idx - lag + 7)); - unprotect_entry(cache_ptr, type, (idx - lag + 7), + unprotect_entry(file_ptr, type, (idx - lag + 7), FALSE, H5C__NO_FLAGS_SET); } @@ -4357,7 +4685,7 @@ row_major_scan_backward(H5C_t * cache_ptr, HDfprintf(stdout, "(u-ro, %d, %d) ", type, (idx - lag + 8)); - unprotect_entry(cache_ptr, type, (idx - lag + 8), + unprotect_entry(file_ptr, type, (idx - lag + 8), FALSE, H5C__NO_FLAGS_SET); } @@ -4369,7 +4697,7 @@ row_major_scan_backward(H5C_t * cache_ptr, HDfprintf(stdout, "(u-ro, %d, %d) ", type, (idx - lag + 9)); - unprotect_entry(cache_ptr, type, (idx - lag + 9), + unprotect_entry(file_ptr, type, (idx - lag + 9), FALSE, H5C__NO_FLAGS_SET); } } /* if ( do_mult_ro_protects ) */ @@ -4379,7 +4707,7 @@ row_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(p, %d, %d) ", type, idx); - protect_entry(cache_ptr, type, idx); + protect_entry(file_ptr, type, idx); } @@ -4390,7 +4718,7 @@ row_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag - 2)); - unprotect_entry(cache_ptr, type, idx+lag-2, NO_CHANGE, + unprotect_entry(file_ptr, type, idx+lag-2, NO_CHANGE, H5C__NO_FLAGS_SET); } @@ -4401,7 +4729,7 @@ row_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(p, %d, %d) ", type, (idx + lag - 1)); - protect_entry(cache_ptr, type, (idx + lag - 1)); + protect_entry(file_ptr, type, (idx + lag - 1)); } @@ -4415,36 +4743,36 @@ row_major_scan_backward(H5C_t * cache_ptr, case 0: if ( (entries[type])[idx+lag].is_dirty ) { - unprotect_entry(cache_ptr, type, idx + lag, + unprotect_entry(file_ptr, type, idx + lag, NO_CHANGE, H5C__NO_FLAGS_SET); } else { - unprotect_entry(cache_ptr, type, idx + lag, + unprotect_entry(file_ptr, type, idx + lag, dirty_unprotects, H5C__NO_FLAGS_SET); } break; case 1: /* we just did an insert */ - unprotect_entry(cache_ptr, type, idx + lag, + unprotect_entry(file_ptr, type, idx + lag, NO_CHANGE, H5C__NO_FLAGS_SET); break; case 2: if ( (entries[type])[idx + lag].is_dirty ) { - unprotect_entry(cache_ptr, type, idx + lag, + unprotect_entry(file_ptr, type, idx + lag, NO_CHANGE, H5C__DELETED_FLAG); } else { - unprotect_entry(cache_ptr, type, idx + lag, + unprotect_entry(file_ptr, type, idx + lag, dirty_destroys, H5C__DELETED_FLAG); } break; case 3: /* we just did an insrt */ - unprotect_entry(cache_ptr, type, idx + lag, + unprotect_entry(file_ptr, type, idx + lag, NO_CHANGE, H5C__DELETED_FLAG); break; @@ -4461,7 +4789,7 @@ row_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag)); - unprotect_entry(cache_ptr, type, idx + lag, + unprotect_entry(file_ptr, type, idx + lag, dirty_unprotects, H5C__NO_FLAGS_SET); } } @@ -4507,7 +4835,7 @@ row_major_scan_backward(H5C_t * cache_ptr, */ void -hl_row_major_scan_backward(H5C_t * cache_ptr, +hl_row_major_scan_backward(H5F_t * file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats, @@ -4517,7 +4845,8 @@ hl_row_major_scan_backward(H5C_t * cache_ptr, hbool_t dirty_inserts) { const char * fcn_name = "hl_row_major_scan_backward"; - int32_t type; + H5C_t * cache_ptr; + int32_t type = NUMBER_OF_ENTRY_TYPES - 1; int32_t idx; int32_t i; int32_t lag = 100; @@ -4526,15 +4855,19 @@ hl_row_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "%s(): entering.\n", fcn_name); - HDassert( lag > 5 ); - HDassert( max_index >= 200 ); - HDassert( max_index <= MAX_ENTRIES ); + if ( pass ) { - type = NUMBER_OF_ENTRY_TYPES - 1; + cache_ptr = file_ptr->shared->cache; - if ( ( pass ) && ( reset_stats ) ) { + HDassert( cache_ptr != NULL ); + HDassert( lag > 5 ); + HDassert( max_index >= 200 ); + HDassert( max_index <= MAX_ENTRIES ); - H5C_stats__reset(cache_ptr); + if ( reset_stats ) { + + H5C_stats__reset(cache_ptr); + } } while ( ( pass ) && ( type >= 0 ) ) @@ -4553,7 +4886,7 @@ hl_row_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag)); - insert_entry(cache_ptr, type, (idx + lag), dirty_inserts, + insert_entry(file_ptr, type, (idx + lag), dirty_inserts, H5C__NO_FLAGS_SET); } @@ -4566,12 +4899,12 @@ hl_row_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(p, %d, %d) ", type, i); - protect_entry(cache_ptr, type, i); + protect_entry(file_ptr, type, i); if ( verbose ) HDfprintf(stdout, "(u, %d, %d) ", type, i); - unprotect_entry(cache_ptr, type, i, NO_CHANGE, + unprotect_entry(file_ptr, type, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i--; @@ -4613,7 +4946,7 @@ hl_row_major_scan_backward(H5C_t * cache_ptr, */ void -col_major_scan_forward(H5C_t * cache_ptr, +col_major_scan_forward(H5F_t * file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, @@ -4624,19 +4957,23 @@ col_major_scan_forward(H5C_t * cache_ptr, int dirty_unprotects) { const char * fcn_name = "col_major_scan_forward()"; - int32_t type; + H5C_t * cache_ptr; + int32_t type = 0; int32_t idx; if ( verbose ) HDfprintf(stdout, "%s: entering.\n", fcn_name); - HDassert( lag > 5 ); + if ( pass ) { - type = 0; + cache_ptr = file_ptr->shared->cache; - if ( ( pass ) && ( reset_stats ) ) { + HDassert( lag > 5 ); - H5C_stats__reset(cache_ptr); + if ( reset_stats ) { + + H5C_stats__reset(cache_ptr); + } } idx = -lag; @@ -4655,7 +4992,7 @@ col_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag)); - insert_entry(cache_ptr, type, (idx + lag), dirty_inserts, + insert_entry(file_ptr, type, (idx + lag), dirty_inserts, H5C__NO_FLAGS_SET); } @@ -4664,7 +5001,7 @@ col_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(p, %d, %d) ", type, idx); - protect_entry(cache_ptr, type, idx); + protect_entry(file_ptr, type, idx); } if ( ( pass ) && ( (idx - lag) >= 0 ) && @@ -4673,7 +5010,7 @@ col_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag)); - unprotect_entry(cache_ptr, type, idx - lag, + unprotect_entry(file_ptr, type, idx - lag, dirty_unprotects, H5C__NO_FLAGS_SET); } @@ -4719,7 +5056,7 @@ col_major_scan_forward(H5C_t * cache_ptr, */ void -hl_col_major_scan_forward(H5C_t * cache_ptr, +hl_col_major_scan_forward(H5F_t * file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats, @@ -4730,7 +5067,8 @@ hl_col_major_scan_forward(H5C_t * cache_ptr, int dirty_unprotects) { const char * fcn_name = "hl_col_major_scan_forward()"; - int32_t type; + H5C_t * cache_ptr; + int32_t type = 0; int32_t idx; int32_t lag = 200; int32_t i; @@ -4739,15 +5077,19 @@ hl_col_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "%s: entering.\n", fcn_name); - HDassert( lag > 5 ); - HDassert( max_index >= 500 ); - HDassert( max_index <= MAX_ENTRIES ); + if ( pass ) { - type = 0; + cache_ptr = file_ptr->shared->cache; - if ( ( pass ) && ( reset_stats ) ) { + HDassert( cache_ptr != NULL ); + HDassert( lag > 5 ); + HDassert( max_index >= 500 ); + HDassert( max_index <= MAX_ENTRIES ); - H5C_stats__reset(cache_ptr); + if ( reset_stats ) { + + H5C_stats__reset(cache_ptr); + } } idx = 0; @@ -4773,7 +5115,7 @@ hl_col_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(i, %d, %d) ", type, i); - insert_entry(cache_ptr, type, i, dirty_inserts, + insert_entry(file_ptr, type, i, dirty_inserts, H5C__NO_FLAGS_SET); } @@ -4782,7 +5124,7 @@ hl_col_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(p, %d, %d) ", type, i); - protect_entry(cache_ptr, type, i); + protect_entry(file_ptr, type, i); } if ( ( pass ) && ( i >= 0 ) && @@ -4791,7 +5133,7 @@ hl_col_major_scan_forward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(u, %d, %d) ", type, i); - unprotect_entry(cache_ptr, type, i, + unprotect_entry(file_ptr, type, i, dirty_unprotects, H5C__NO_FLAGS_SET); } @@ -4835,7 +5177,7 @@ hl_col_major_scan_forward(H5C_t * cache_ptr, */ void -col_major_scan_backward(H5C_t * cache_ptr, +col_major_scan_backward(H5F_t * file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, @@ -4846,6 +5188,7 @@ col_major_scan_backward(H5C_t * cache_ptr, int dirty_unprotects) { const char * fcn_name = "col_major_scan_backward()"; + H5C_t * cache_ptr; int mile_stone = 1; int32_t type; int32_t idx; @@ -4853,11 +5196,18 @@ col_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "%s: entering.\n", fcn_name); - HDassert( lag > 5 ); + if ( pass ) { + + cache_ptr = file_ptr->shared->cache; - if ( ( pass ) && ( reset_stats ) ) { + HDassert( cache_ptr != NULL ); - H5C_stats__reset(cache_ptr); + HDassert( lag > 5 ); + + if ( reset_stats ) { + + H5C_stats__reset(cache_ptr); + } } idx = MAX_ENTRIES + lag; @@ -4880,7 +5230,7 @@ col_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(i, %d, %d) ", type, (idx - lag)); - insert_entry(cache_ptr, type, (idx - lag), dirty_inserts, + insert_entry(file_ptr, type, (idx - lag), dirty_inserts, H5C__NO_FLAGS_SET); } @@ -4889,7 +5239,7 @@ col_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(p, %d, %d) ", type, idx); - protect_entry(cache_ptr, type, idx); + protect_entry(file_ptr, type, idx); } if ( ( pass ) && ( (idx + lag) >= 0 ) && @@ -4898,7 +5248,7 @@ col_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag)); - unprotect_entry(cache_ptr, type, idx + lag, + unprotect_entry(file_ptr, type, idx + lag, dirty_unprotects, H5C__NO_FLAGS_SET); } @@ -4950,7 +5300,7 @@ col_major_scan_backward(H5C_t * cache_ptr, */ void -hl_col_major_scan_backward(H5C_t * cache_ptr, +hl_col_major_scan_backward(H5F_t * file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats, @@ -4961,7 +5311,8 @@ hl_col_major_scan_backward(H5C_t * cache_ptr, int dirty_unprotects) { const char * fcn_name = "hl_col_major_scan_backward()"; - int32_t type; + H5C_t * cache_ptr; + int32_t type = 0; int32_t idx; int32_t lag = 50; int32_t i; @@ -4970,21 +5321,25 @@ hl_col_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "%s: entering.\n", fcn_name); - HDassert( lag > 5 ); - HDassert( max_index >= 500 ); - HDassert( max_index <= MAX_ENTRIES ); + if ( pass ) { + + cache_ptr = file_ptr->shared->cache; + + HDassert( cache_ptr != NULL ); + HDassert( lag > 5 ); + HDassert( max_index >= 500 ); + HDassert( max_index <= MAX_ENTRIES ); - type = 0; + local_max_index = MIN(max_index, MAX_ENTRIES); - local_max_index = MIN(max_index, MAX_ENTRIES); + if ( reset_stats ) { - if ( ( pass ) && ( reset_stats ) ) { + H5C_stats__reset(cache_ptr); + } - H5C_stats__reset(cache_ptr); + idx = local_max_index; } - idx = local_max_index; - while ( ( pass ) && ( idx >= 0 ) ) { @@ -5003,7 +5358,7 @@ hl_col_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(i, %d, %d) ", type, i); - insert_entry(cache_ptr, type, i, dirty_inserts, + insert_entry(file_ptr, type, i, dirty_inserts, H5C__NO_FLAGS_SET); } @@ -5012,7 +5367,7 @@ hl_col_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(p, %d, %d) ", type, i); - protect_entry(cache_ptr, type, i); + protect_entry(file_ptr, type, i); } if ( ( pass ) && ( i >= 0 ) && @@ -5021,7 +5376,7 @@ hl_col_major_scan_backward(H5C_t * cache_ptr, if ( verbose ) HDfprintf(stdout, "(u, %d, %d) ", type, i); - unprotect_entry(cache_ptr, type, i, + unprotect_entry(file_ptr, type, i, dirty_unprotects, H5C__NO_FLAGS_SET); } @@ -5063,13 +5418,11 @@ hl_col_major_scan_backward(H5C_t * cache_ptr, */ void -create_flush_dependency(H5C_t * cache_ptr, - int32_t par_type, +create_flush_dependency(int32_t par_type, int32_t par_idx, int32_t chd_type, int32_t chd_idx) { - HDassert( cache_ptr ); HDassert( ( 0 <= par_type ) && ( par_type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= par_idx ) && ( par_idx <= max_indices[par_type] ) ); HDassert( ( 0 <= chd_type ) && ( chd_type < NUMBER_OF_ENTRY_TYPES ) ); @@ -5103,8 +5456,7 @@ create_flush_dependency(H5C_t * cache_ptr, HDassert( chd_entry_ptr->type == chd_type ); HDassert( chd_entry_ptr == chd_entry_ptr->self ); - result = H5C_create_flush_dependency(cache_ptr, par_entry_ptr, - chd_entry_ptr); + result = H5C_create_flush_dependency(par_entry_ptr, chd_entry_ptr); if ( ( result < 0 ) || ( !par_entry_ptr->header.is_pinned ) || @@ -5164,13 +5516,11 @@ create_flush_dependency(H5C_t * cache_ptr, */ void -destroy_flush_dependency(H5C_t * cache_ptr, - int32_t par_type, +destroy_flush_dependency(int32_t par_type, int32_t par_idx, int32_t chd_type, int32_t chd_idx) { - HDassert( cache_ptr ); HDassert( ( 0 <= par_type ) && ( par_type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= par_idx ) && ( par_idx <= max_indices[par_type] ) ); HDassert( ( 0 <= chd_type ) && ( chd_type < NUMBER_OF_ENTRY_TYPES ) ); @@ -5205,7 +5555,7 @@ destroy_flush_dependency(H5C_t * cache_ptr, HDassert( chd_entry_ptr->flush_dep_height < par_entry_ptr->flush_dep_height ); HDassert( chd_entry_ptr == chd_entry_ptr->self ); - if ( H5C_destroy_flush_dependency(cache_ptr, par_entry_ptr, chd_entry_ptr) < 0 ) { + if ( H5C_destroy_flush_dependency(par_entry_ptr, chd_entry_ptr) < 0 ) { pass = FALSE; failure_mssg = "error in H5C_destroy_flush_dependency()."; } /* end if */ diff --git a/test/cache_common.h b/test/cache_common.h index d150f2a..7f2af16 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -81,7 +81,11 @@ #define MAX_ENTRIES (10 * 1024) -#define PICO_BASE_ADDR (haddr_t)0 +/* The choice of the BASE_ADDR below is arbitrary -- it just has to be + * larger than the superblock. + */ +#define BASE_ADDR (haddr_t)1024 +#define PICO_BASE_ADDR BASE_ADDR #define NANO_BASE_ADDR (haddr_t)(PICO_BASE_ADDR + \ (PICO_ENTRY_SIZE * NUM_PICO_ENTRIES)) #define MICRO_BASE_ADDR (haddr_t)(NANO_BASE_ADDR + \ @@ -125,6 +129,9 @@ (MONSTER_ENTRY_SIZE * NUM_MONSTER_ENTRIES)) #define NOTIFY_ALT_BASE_ADDR (haddr_t)(VARIABLE_ALT_BASE_ADDR + \ (VARIABLE_ENTRY_SIZE * NUM_VARIABLE_ENTRIES)) +#define MAX_ADDR (haddr_t)(NOTIFY_ALT_BASE_ADDR + \ + (NOTIFY_ENTRY_SIZE * NUM_NOTIFY_ENTRIES)) +#define ADDR_SPACE_SIZE (haddr_t)(MAX_ADDR - BASE_ADDR) #define MAX_PINS 8 /* Maximum number of entries that can be * directly pinned by a single entry. @@ -474,15 +481,15 @@ struct expected_entry_status int entry_type; int entry_index; size_t size; - hbool_t in_cache; - hbool_t at_main_addr; - hbool_t is_dirty; - hbool_t is_protected; - hbool_t is_pinned; - hbool_t loaded; - hbool_t cleared; - hbool_t flushed; - hbool_t destroyed; + unsigned char in_cache; + unsigned char at_main_addr; + unsigned char is_dirty; + unsigned char is_protected; + unsigned char is_pinned; + unsigned char loaded; + unsigned char cleared; + unsigned char flushed; + unsigned char destroyed; int flush_dep_par_type; /* Entry type of flush dependency parent */ int flush_dep_par_idx; /* Index of flush dependency parent */ uint64_t child_flush_dep_height_rc[H5C__NUM_FLUSH_DEP_HEIGHTS]; @@ -644,29 +651,27 @@ haddr_t type_and_index_to_addr(int32_t type, int32_t idx); #endif -void dirty_entry(H5C_t * cache_ptr, +void dirty_entry(H5F_t * file_ptr, int32_t type, int32_t idx, hbool_t dirty_pin); -void expunge_entry(H5C_t * cache_ptr, +void expunge_entry(H5F_t * file_ptr, int32_t type, int32_t idx); -void insert_entry(H5C_t * cache_ptr, +void insert_entry(H5F_t * file_ptr, int32_t type, int32_t idx, hbool_t dirty, unsigned int flags); -void mark_pinned_entry_dirty(H5C_t * cache_ptr, - int32_t type, +void mark_pinned_entry_dirty(int32_t type, int32_t idx, hbool_t size_changed, size_t new_size); -void mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, - int32_t type, +void mark_pinned_or_protected_entry_dirty(int32_t type, int32_t idx); void rename_entry(H5C_t * cache_ptr, @@ -674,36 +679,30 @@ void rename_entry(H5C_t * cache_ptr, int32_t idx, hbool_t main_addr); -void protect_entry(H5C_t * cache_ptr, +void protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx); -void protect_entry_ro(H5C_t * cache_ptr, +void protect_entry_ro(H5F_t * file_ptr, int32_t type, int32_t idx); -void pin_entry(H5C_t * cache_ptr, - int32_t type, +void pin_entry(int32_t type, int32_t idx); hbool_t entry_in_cache(H5C_t * cache_ptr, int32_t type, int32_t idx); -void create_pinned_entry_dependency(H5C_t * cache_ptr, +void create_pinned_entry_dependency(H5F_t * file_ptr, int pinning_type, int pinning_idx, int pinned_type, int pinned_idx); -void execute_flush_op(H5C_t * cache_ptr, - struct test_entry_t * entry_ptr, - struct flush_op * op_ptr, - unsigned * flags_ptr); - void reset_entries(void); -void resize_entry(H5C_t * cache_ptr, +void resize_entry(H5F_t * file_ptr, int32_t type, int32_t idx, size_t new_size, @@ -714,9 +713,9 @@ void resize_pinned_entry(H5C_t * cache_ptr, int32_t idx, size_t new_size); -H5C_t * setup_cache(size_t max_cache_size, size_t min_clean_size); +H5F_t *setup_cache(size_t max_cache_size, size_t min_clean_size); -void row_major_scan_forward(H5C_t * cache_ptr, +void row_major_scan_forward(H5F_t * file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, @@ -731,7 +730,7 @@ void row_major_scan_forward(H5C_t * cache_ptr, int dirty_destroys, int dirty_unprotects); -void hl_row_major_scan_forward(H5C_t * cache_ptr, +void hl_row_major_scan_forward(H5F_t * file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats, @@ -740,7 +739,7 @@ void hl_row_major_scan_forward(H5C_t * cache_ptr, hbool_t do_inserts, hbool_t dirty_inserts); -void row_major_scan_backward(H5C_t * cache_ptr, +void row_major_scan_backward(H5F_t * file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, @@ -755,7 +754,7 @@ void row_major_scan_backward(H5C_t * cache_ptr, int dirty_destroys, int dirty_unprotects); -void hl_row_major_scan_backward(H5C_t * cache_ptr, +void hl_row_major_scan_backward(H5F_t * file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats, @@ -764,7 +763,7 @@ void hl_row_major_scan_backward(H5C_t * cache_ptr, hbool_t do_inserts, hbool_t dirty_inserts); -void col_major_scan_forward(H5C_t * cache_ptr, +void col_major_scan_forward(H5F_t * file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, @@ -774,7 +773,7 @@ void col_major_scan_forward(H5C_t * cache_ptr, hbool_t dirty_inserts, int dirty_unprotects); -void hl_col_major_scan_forward(H5C_t * cache_ptr, +void hl_col_major_scan_forward(H5F_t * file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats, @@ -784,7 +783,7 @@ void hl_col_major_scan_forward(H5C_t * cache_ptr, hbool_t dirty_inserts, int dirty_unprotects); -void col_major_scan_backward(H5C_t * cache_ptr, +void col_major_scan_backward(H5F_t * file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, @@ -794,7 +793,7 @@ void col_major_scan_backward(H5C_t * cache_ptr, hbool_t dirty_inserts, int dirty_unprotects); -void hl_col_major_scan_backward(H5C_t * cache_ptr, +void hl_col_major_scan_backward(H5F_t * file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats, @@ -804,26 +803,25 @@ void hl_col_major_scan_backward(H5C_t * cache_ptr, hbool_t dirty_inserts, int dirty_unprotects); -void takedown_cache(H5C_t * cache_ptr, +void takedown_cache(H5F_t * file_ptr, hbool_t dump_stats, hbool_t dump_detailed_stats); -void flush_cache(H5C_t * cache_ptr, +void flush_cache(H5F_t * file_ptr, hbool_t destroy_entries, hbool_t dump_stats, hbool_t dump_detailed_stats); -void unpin_entry(H5C_t * cache_ptr, - int32_t type, +void unpin_entry(int32_t type, int32_t idx); -void unprotect_entry(H5C_t * cache_ptr, +void unprotect_entry(H5F_t * file_ptr, int32_t type, int32_t idx, int dirty, unsigned int flags); -void unprotect_entry_with_size_change(H5C_t * cache_ptr, +void unprotect_entry_with_size_change(H5F_t * file_ptr, int32_t type, int32_t idx, unsigned int flags, @@ -838,14 +836,12 @@ void verify_entry_status(H5C_t * cache_ptr, void verify_unprotected(void); -void create_flush_dependency(H5C_t * cache_ptr, - int32_t parent_type, +void create_flush_dependency(int32_t parent_type, int32_t parent_idx, int32_t child_type, int32_t child_idx); -void destroy_flush_dependency(H5C_t * cache_ptr, - int32_t parent_type, +void destroy_flush_dependency(int32_t parent_type, int32_t parent_idx, int32_t child_type, int32_t child_idx); diff --git a/test/dt_arith.c b/test/dt_arith.c index 420570a..ff6b4e0 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -1334,7 +1334,6 @@ test_derived_integer(void) char filename[1024]; size_t src_size, dst_size; unsigned char *buf=NULL, *saved_buf=NULL; - int *aligned=NULL; int endian; /*endianess */ size_t nelmts = NTESTELEM; unsigned int fails_this_test = 0; @@ -1597,7 +1596,6 @@ test_derived_integer(void) error: if (buf) free(buf); if (saved_buf) free(saved_buf); - if (aligned) free(aligned); HDfflush(stdout); H5E_BEGIN_TRY { H5Tclose (tid1); @@ -5001,192 +4999,177 @@ run_int_fp_conv(const char *name) static int run_fp_int_conv(const char *name) { +#ifdef H5_FP_TO_INTEGER_OVERFLOW_WORKS int nerrors = 0; int test_values; - int i; - int run_test = TRUE; - -#ifndef H5_FP_TO_INTEGER_OVERFLOW_WORKS - /* For Cray X1, the compiler generates floating exception when the - * conversion overflows. So disable all of the conversions from - * floating-point numbers to integers. - */ - run_test = FALSE; -#endif #ifdef H5_VMS - run_test = TRUE; -#endif - - if(run_test) { -#ifdef H5_VMS - test_values = TEST_NORMAL; - { + test_values = TEST_NORMAL; #else - for(i=0; i<3; i++) { - if(i==0) - test_values = TEST_NORMAL; - else if(i==1) - test_values = TEST_DENORM; - else - test_values = TEST_SPECIAL; + for(test_values = TEST_NORMAL; test_values <= TEST_SPECIAL; test_values++) { #endif /*H5_VMS*/ - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_SCHAR); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_SCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_UCHAR); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_UCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_UCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_UCHAR); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_SHORT); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_SHORT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_SHORT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_SHORT); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_USHORT); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_USHORT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_USHORT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_USHORT); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_INT); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_INT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_INT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_INT); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_UINT); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_UINT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_UINT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_UINT); #if H5_SIZEOF_LONG!=H5_SIZEOF_INT - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LONG); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LONG); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_ULONG); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_ULONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_ULONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_ULONG); #endif #if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG - if(!strcmp(name, "hw")) { /* Hardware conversion */ - /* Windows .NET 2003 doesn't work for hardware conversion of this case. - * .NET should define this macro H5_HW_FP_TO_LLONG_NOT_WORKS. */ + if(!strcmp(name, "hw")) { /* Hardware conversion */ + /* Windows .NET 2003 doesn't work for hardware conversion of this case. + * .NET should define this macro H5_HW_FP_TO_LLONG_NOT_WORKS. */ #ifndef H5_HW_FP_TO_LLONG_NOT_WORKS - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LLONG); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LLONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LLONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LLONG); #endif /*H5_HW_FP_TO_LLONG_NOT_WORKS*/ - } else { /* Software conversion */ - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LLONG); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LLONG); - } + } else { /* Software conversion */ + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LLONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LLONG); + } #ifdef H5_FP_TO_ULLONG_RIGHT_MAXIMUM - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_ULLONG); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_ULLONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_ULLONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_ULLONG); #else /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM*/ - { - char str[256]; /*hello string */ - - sprintf(str, "Testing %s %s -> %s conversions", - name, "float", "unsigned long long"); - printf("%-70s", str); - SKIPPED(); - HDputs(" Test skipped due to hardware conversion error."); - - sprintf(str, "Testing %s %s -> %s conversions", - name, "double", "unsigned long long"); - printf("%-70s", str); - SKIPPED(); - HDputs(" Test skipped due to hardware conversion error."); - } + { + char str[256]; /*hello string */ + + sprintf(str, "Testing %s %s -> %s conversions", + name, "float", "unsigned long long"); + printf("%-70s", str); + SKIPPED(); + HDputs(" Test skipped due to hardware conversion error."); + + sprintf(str, "Testing %s %s -> %s conversions", + name, "double", "unsigned long long"); + printf("%-70s", str); + SKIPPED(); + HDputs(" Test skipped due to hardware conversion error."); + } #endif /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM*/ #endif #if H5_LDOUBLE_TO_INTEGER_WORKS && H5_LDOUBLE_TO_INTEGER_ACCURATE #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT); #if H5_LDOUBLE_TO_UINT_ACCURATE - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); #else /*H5_LDOUBLE_TO_UINT_ACCURATE*/ - { - char str[256]; /*string */ + { + char str[256]; /*string */ - sprintf(str, "Testing %s %s -> %s conversions", - name, "long double", "unsigned int"); - printf("%-70s", str); - SKIPPED(); + sprintf(str, "Testing %s %s -> %s conversions", + name, "long double", "unsigned int"); + printf("%-70s", str); + SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 - HDputs(" Test skipped due to hardware conversion error."); + HDputs(" Test skipped due to hardware conversion error."); #else - HDputs(" Test skipped due to disabled long double."); + HDputs(" Test skipped due to disabled long double."); #endif - } + } #endif /*H5_LDOUBLE_TO_UINT_ACCURATE*/ #if H5_SIZEOF_LONG!=H5_SIZEOF_INT && H5_SIZEOF_LONG_DOUBLE!=0 - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG); #endif #if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG && H5_SIZEOF_LONG_DOUBLE!=0 #ifdef H5_LDOUBLE_TO_LLONG_ACCURATE - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LLONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LLONG); #else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ - { - char str[256]; /*string */ + { + char str[256]; /*string */ - sprintf(str, "Testing %s %s -> %s conversions", - name, "long double", "long long"); - printf("%-70s", str); - SKIPPED(); + sprintf(str, "Testing %s %s -> %s conversions", + name, "long double", "long long"); + printf("%-70s", str); + SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 - HDputs(" Test skipped due to hardware conversion error."); + HDputs(" Test skipped due to hardware conversion error."); #else - HDputs(" Test skipped due to disabled long double."); + HDputs(" Test skipped due to disabled long double."); #endif - } + } #endif /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ #if defined(H5_FP_TO_ULLONG_RIGHT_MAXIMUM) && defined(H5_LDOUBLE_TO_LLONG_ACCURATE) - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULLONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULLONG); #else /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM && H5_LDOUBLE_TO_LLONG_ACCURATE*/ - { - char str[256]; /*string */ + { + char str[256]; /*string */ - sprintf(str, "Testing %s %s -> %s conversions", - name, "long double", "unsigned long long"); - printf("%-70s", str); - SKIPPED(); + sprintf(str, "Testing %s %s -> %s conversions", + name, "long double", "unsigned long long"); + printf("%-70s", str); + SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 - HDputs(" Test skipped due to hardware conversion error."); + HDputs(" Test skipped due to hardware conversion error."); #else - HDputs(" Test skipped due to disabled long double."); + HDputs(" Test skipped due to disabled long double."); #endif - } + } #endif /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM && H5_LDOUBLE_TO_LLONG_ACCURATE*/ #endif #endif #else /*H5_LDOUBLE_TO_INTEGER_WORKS && H5_LDOUBLE_TO_INTEGER_ACCURATE*/ - { - char str[256]; /*hello string */ + { + char str[256]; /*hello string */ - sprintf(str, "Testing %s %s -> %s conversions", - name, "long double", "all integers"); - printf("%-70s", str); - SKIPPED(); + sprintf(str, "Testing %s %s -> %s conversions", + name, "long double", "all integers"); + printf("%-70s", str); + SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 - HDputs(" Test skipped due to hardware conversion error."); + HDputs(" Test skipped due to hardware conversion error."); #else - HDputs(" Test skipped due to disabled long double."); + HDputs(" Test skipped due to disabled long double."); #endif - } -#endif /*H5_LDOUBLE_TO_INTEGER_WORKS && H5_LDOUBLE_TO_INTEGER_ACCURATE*/ } - } else { - char str[256]; /*string */ +#endif /*H5_LDOUBLE_TO_INTEGER_WORKS && H5_LDOUBLE_TO_INTEGER_ACCURATE*/ +#ifndef H5_VMS + } /* end for */ +#endif /* H5_VMS */ +#else /* H5_FP_TO_INTEGER_OVERFLOW_WORKS */ +/* For Cray X1, the compiler generates floating exception when the + * conversion overflows. So disable all of the conversions from + * floating-point numbers to integers. + */ + char str[256]; /*string */ - sprintf(str, "Testing %s %s -> %s conversions", - name, "all floating-point numbers", "all integers"); - printf("%-70s", str); - SKIPPED(); + sprintf(str, "Testing %s %s -> %s conversions", + name, "all floating-point numbers", "all integers"); + printf("%-70s", str); + SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 - HDputs(" Test skipped due to hardware conversion error."); + HDputs(" Test skipped due to hardware conversion error."); #else - HDputs(" Test skipped due to disbaled long double."); + HDputs(" Test skipped due to disbaled long double."); #endif - } +#endif /* H5_FP_TO_INTEGER_OVERFLOW_WORKS */ return nerrors; } diff --git a/test/dtypes.c b/test/dtypes.c index 04f526a..f32afe5 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -515,39 +515,37 @@ test_compound_1(void) H5T_str_t strpad; H5T_order_t order; H5T_sign_t sign; - char* tag; + char *tag = NULL; int offset; herr_t ret; + int retval = 1; TESTING("compound datatypes"); /* Create the empty type */ - if ((complex_id = H5Tcreate(H5T_COMPOUND, sizeof(complex_t))) < 0) goto error; + if ((complex_id = H5Tcreate(H5T_COMPOUND, sizeof(complex_t))) < 0) + goto error; /* Attempt to add the new compound datatype as a field within itself */ H5E_BEGIN_TRY { ret=H5Tinsert(complex_id, "compound", 0, complex_id); } H5E_END_TRY; if (ret>=0) { - H5_FAILED(); - printf("Inserted compound datatype into itself?\n"); - goto error; + FAIL_PUTS_ERROR("Inserted compound datatype into itself?"); } /* end if */ /* Add a couple fields */ - if (H5Tinsert(complex_id, "real", HOFFSET(complex_t, re), - H5T_NATIVE_DOUBLE) < 0) goto error; - if (H5Tinsert(complex_id, "imaginary", HOFFSET(complex_t, im), - H5T_NATIVE_DOUBLE) < 0) goto error; + if(H5Tinsert(complex_id, "real", HOFFSET(complex_t, re), H5T_NATIVE_DOUBLE) < 0) + goto error; + if(H5Tinsert(complex_id, "imaginary", HOFFSET(complex_t, im), H5T_NATIVE_DOUBLE) < 0) + goto error; /* Test some functions that aren't supposed to work for compound type */ H5E_BEGIN_TRY { size=H5Tget_precision(complex_id); } H5E_END_TRY; if (size>0) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ size = 128; @@ -555,108 +553,89 @@ test_compound_1(void) ret = H5Tset_precision(complex_id, size); } H5E_END_TRY; if (ret>=0) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ H5E_BEGIN_TRY { ret = H5Tget_pad(complex_id, &lsb, &msb); } H5E_END_TRY; if (ret>=0) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ H5E_BEGIN_TRY { size = H5Tget_ebias(complex_id); } H5E_END_TRY; if (size>0) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ H5E_BEGIN_TRY { lsb = H5Tget_inpad(complex_id); } H5E_END_TRY; if (lsb>=0) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ H5E_BEGIN_TRY { cset = H5Tget_cset(complex_id); } H5E_END_TRY; if (cset>-1) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ H5E_BEGIN_TRY { strpad = H5Tget_strpad(complex_id); } H5E_END_TRY; if (strpad>-1) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ H5E_BEGIN_TRY { offset = H5Tget_offset(complex_id); } H5E_END_TRY; if (offset>=0) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ H5E_BEGIN_TRY { order = H5Tget_order(complex_id); } H5E_END_TRY; if (order>-1) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ H5E_BEGIN_TRY { sign = H5Tget_sign(complex_id); } H5E_END_TRY; if (sign>-1) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ H5E_BEGIN_TRY { tag = H5Tget_tag(complex_id); } H5E_END_TRY; if (tag) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ H5E_BEGIN_TRY { super = H5Tget_super(complex_id); } H5E_END_TRY; if (super>=0) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ - if (H5Tclose (complex_id) < 0) goto error; + if (H5Tclose (complex_id) < 0) + goto error; PASSED(); - return 0; + retval = 0; - error: - return 1; +error: + if(tag) + HDfree(tag); + return retval; } @@ -1068,6 +1047,7 @@ test_compound_5(void) dst_type_t *dst; void *buf = calloc(2, sizeof(dst_type_t)); void *bkg = calloc(2, sizeof(dst_type_t)); + int retval = 1; #if 1 TESTING("optimized struct converter"); @@ -1124,14 +1104,17 @@ test_compound_5(void) src[1].coll_ids[2]!=dst[1].coll_ids[2] || src[1].coll_ids[3]!=dst[1].coll_ids[3]) { H5_FAILED(); - return 1; + } else { + PASSED(); + retval = 0; } /* Free memory buffers */ - free(buf); - free(bkg); - PASSED(); - return 0; + if(buf) + HDfree(buf); + if(bkg) + HDfree(bkg); + return retval; } @@ -2054,10 +2037,11 @@ test_compound_11(void) hid_t big_tid, little_tid; /* Datatype IDs for type conversion */ hid_t big_tid2, little_tid2; /* Datatype IDs for type conversion */ hid_t opaq_src_tid, opaq_dst_tid; /* Datatype IDs for type conversion */ - void *buf, /* Conversion buffer */ - *buf_orig, /* Copy of original conversion buffer */ - *bkg; /* Background buffer */ + void *buf = NULL; /* Conversion buffer */ + void *buf_orig = NULL; /* Copy of original conversion buffer */ + void *bkg = NULL; /* Background buffer */ size_t u; /* Local index variable */ + int retval = 1; TESTING("registering type conversion routine with compound conversions"); @@ -2216,18 +2200,21 @@ test_compound_11(void) if(H5Tclose(opaq_src_tid) < 0) TEST_ERROR if(H5Tclose(little_tid2) < 0) TEST_ERROR if(H5Tclose(big_tid2) < 0) TEST_ERROR - HDfree(bkg); - HDfree(buf_orig); - HDfree(buf); if(H5Tclose(little_tid) < 0) TEST_ERROR if(H5Tclose(big_tid) < 0) TEST_ERROR if(H5Tclose(var_string_tid) < 0) TEST_ERROR PASSED(); - return 0; + retval = 0; - error: - return 1; +error: + if(buf) + HDfree(buf); + if(buf_orig) + HDfree(buf_orig); + if(bkg) + HDfree(bkg); + return retval; } @@ -4133,7 +4120,7 @@ test_conv_str_3(void) int size; H5T_pad_t inpad; H5T_sign_t sign; - char* tag; + char *tag = NULL; herr_t ret; TESTING("some type functions for string"); @@ -4163,63 +4150,54 @@ test_conv_str_3(void) ret=H5Tset_precision(type, nelmts); } H5E_END_TRY; if (ret>=0) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ H5E_BEGIN_TRY { size = H5Tget_ebias(type); } H5E_END_TRY; if (size>0) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ H5E_BEGIN_TRY { inpad=H5Tget_inpad(type); } H5E_END_TRY; if (inpad>-1) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ H5E_BEGIN_TRY { sign=H5Tget_sign(type); } H5E_END_TRY; if (sign>-1) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ H5E_BEGIN_TRY { tag = H5Tget_tag(type); } H5E_END_TRY; if (tag) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ H5E_BEGIN_TRY { super = H5Tget_super(type); } H5E_END_TRY; if (super>=0) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; + FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ PASSED(); ret_value = 0; - error: - if (buf) HDfree(buf); +error: + if(buf) + HDfree(buf); + if(tag) + HDfree(tag); reset_hdf5(); - return ret_value; + return ret_value; /* Number of errors */ } @@ -4496,7 +4474,7 @@ test_conv_bitfield(void) static int test_bitfield_funcs(void) { - hid_t type=-1, super=-1; + hid_t type=-1, ntype=-1, super=-1; int size; char* tag; H5T_pad_t inpad; @@ -4521,6 +4499,7 @@ test_bitfield_funcs(void) if(H5Tset_pad(type, H5T_PAD_ONE, H5T_PAD_ONE)) goto error; if((size=H5Tget_size(type))==0) goto error; if(H5Tset_order(type, H5T_ORDER_BE) < 0) goto error; + if((ntype = H5Tget_native_type(type, H5T_DIR_ASCEND)) < 0) goto error; H5E_BEGIN_TRY { size=H5Tget_ebias(type); @@ -4585,16 +4564,8 @@ test_bitfield_funcs(void) goto error; } /* end if */ - H5E_BEGIN_TRY { - super = H5Tget_native_type(type, H5T_DIR_ASCEND); - } H5E_END_TRY; - if (super>=0) { - H5_FAILED(); - printf("Operation not allowed for this type.\n"); - goto error; - } /* end if */ - H5Tclose(type); + H5Tclose(ntype); PASSED(); reset_hdf5(); return 0; diff --git a/test/gen_bad_ohdr.c b/test/gen_bad_ohdr.c index d04996d..6d50230 100644 --- a/test/gen_bad_ohdr.c +++ b/test/gen_bad_ohdr.c @@ -28,10 +28,12 @@ #include "H5private.h" #include "H5Oprivate.h" +#ifdef H5O_ENABLE_BAD_MESG_COUNT #define FILENAME "tbad_msg_count.h5" #define GROUPNAME "Group" #define ATTRNAME1 "Attribute #1" #define ATTRNAME2 "Attribute #2" +#endif /* H5O_ENABLE_BAD_MESG_COUNT */ #ifndef TRUE #define TRUE 1 diff --git a/test/gen_bogus.c b/test/gen_bogus.c index a8b88bf..7456ae6 100644 --- a/test/gen_bogus.c +++ b/test/gen_bogus.c @@ -25,7 +25,9 @@ #include "hdf5.h" #include "H5Oprivate.h" +#ifdef H5O_ENABLE_BOGUS #define FILENAME "tbogus.h5" +#endif /* H5O_ENABLE_BOGUS */ #ifndef TRUE #define TRUE 1 diff --git a/test/gen_deflate.c b/test/gen_deflate.c index 16de92e..2d0b746 100644 --- a/test/gen_deflate.c +++ b/test/gen_deflate.c @@ -66,7 +66,7 @@ main(void) /* (Try for something easily compressible) */ for(i=0; i4) buf[j] = '\0'; + for(j = 4; j < i; j++) + buf[j] = '0' + j % 10; + if(j > 4) + buf[j] = '\0'; - if ((size_t)(-1)==(obj[i]=H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap, strlen(buf)+1, buf))) { + if((size_t)(-1) == (obj[i] = H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap, strlen(buf) + 1, buf))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; } } - if (H5HL_unprotect(f, H5P_DATASET_XFER_DEFAULT, heap, heap_addr) < 0) { + if(H5HL_unprotect(heap) < 0) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -116,16 +118,18 @@ main(void) TESTING("local heap read"); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) goto error; - if (NULL==(f=H5I_object(file))) { + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) goto error; + if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; } - for (i=0; i4) buf[j] = '\0'; + for(j = 4; j < i; j++) + buf[j] = '0' + j % 10; + if(j > 4) + buf[j] = '\0'; if (NULL == (heap = H5HL_protect(f, H5P_DATASET_XFER_DEFAULT, heap_addr, H5AC_READ))) { H5_FAILED(); @@ -133,7 +137,7 @@ main(void) goto error; } - if (NULL == (s = H5HL_offset_into(f, heap, obj[i]))) { + if (NULL == (s = (const char *)H5HL_offset_into(heap, obj[i]))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -147,7 +151,7 @@ main(void) goto error; } - if (H5HL_unprotect(f, H5P_DATASET_XFER_DEFAULT, heap, heap_addr) < 0) { + if(H5HL_unprotect(heap) < 0) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -168,3 +172,4 @@ main(void) } H5E_END_TRY; return 1; } + diff --git a/test/ntypes.c b/test/ntypes.c index 87484d9..6efabc6 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -52,14 +52,15 @@ int ipoints3[DIM0][DIM1][5], icheck3[DIM0][DIM1][5]; #define DSET_VLSTR_NAME "vlstr_type" #define DSET_STR_NAME "str_type" #define DSET_OPAQUE_NAME "opaque_type" -#define DSET_BITFIELD_NAME "bitfield_type" +#define DSET1_BITFIELD_NAME "bitfield_type_1" +#define DSET2_BITFIELD_NAME "bitfield_type_2" #define SPACE1_DIM1 4 #define SPACE1_RANK 1 #define SPACE2_RANK 2 #define SPACE2_DIM1 10 #define SPACE2_DIM2 10 - +#define BITFIELD_ENUMB 8 /*------------------------------------------------------------------------- @@ -2519,53 +2520,106 @@ error: * October 15, 2002 * * Modifications: - * + * Raymond Lu + * 1 December 2009 + * I added the support for bitfield and changed the test to + * compare the data being read back. *------------------------------------------------------------------------- */ static herr_t test_bitfield_dtype(hid_t file) { - hid_t type = -1, space = -1, dset = -1; - hid_t dataset = -1, dtype = -1, native_type = -1; - size_t i; - unsigned char wbuf[32]; - hsize_t nelmts; + hid_t type=-1, space=-1, dset1=-1, dset2=-1; + hid_t dataset1=-1, dataset2=-1, dtype=-1, native_type=-1; + size_t ntype_size, i; + unsigned char wbuf[BITFIELD_ENUMB*sizeof(int)]; + unsigned char *p=NULL; + void *rbuf = NULL; + unsigned int intw[BITFIELD_ENUMB], intr[BITFIELD_ENUMB]; + hsize_t nelmts; TESTING("bitfield datatype"); - /* opaque_1 */ - nelmts = sizeof(wbuf); - if((type = H5Tcopy(H5T_STD_B8LE)) < 0) TEST_ERROR; + nelmts = BITFIELD_ENUMB; + if((type = H5Tcopy(H5T_STD_B32BE)) < 0) TEST_ERROR; + if((space = H5Screate_simple(1, &nelmts, NULL)) < 0) TEST_ERROR; - if((dset = H5Dcreate2(file, DSET_BITFIELD_NAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR; - for(i = 0; i < sizeof(wbuf); i++) - wbuf[i] = (unsigned char)0xff ^ (unsigned char)i; + /* Create and write to dataset1 with a unsigned char buffer */ + if((dset1 = H5Dcreate2(file, DSET1_BITFIELD_NAME, type, space, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) TEST_ERROR; - if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; + for(i = 0; i < BITFIELD_ENUMB*sizeof(int); i++) + wbuf[i] = (unsigned int)0xff ^ (unsigned int)i; + + if(H5Dwrite(dset1, H5T_NATIVE_B32, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; + if(H5Dclose(dset1) < 0) TEST_ERROR; + + /* Create and write to dataset2 with a unsigned int buffer */ + if((dset2 = H5Dcreate2(file, DSET2_BITFIELD_NAME, type, space, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) TEST_ERROR; + + for(i = 0; i < BITFIELD_ENUMB; i++) + intw[i] = (unsigned int)0xff << (unsigned int)((i*8)%32); + + if(H5Dwrite(dset2, H5T_NATIVE_B32, H5S_ALL, H5S_ALL, H5P_DEFAULT, intw) < 0) TEST_ERROR; + if(H5Dclose(dset2) < 0) TEST_ERROR; if(H5Sclose(space) < 0) TEST_ERROR; - if(H5Dclose(dset) < 0) TEST_ERROR; + if(H5Tclose(type) < 0) TEST_ERROR; + /* Open dataset1 again to check H5Tget_native_type */ + if((dataset1 = H5Dopen2(file, DSET1_BITFIELD_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; - /* Open dataset again to check H5Tget_native_type */ - if((dataset = H5Dopen2(file, DSET_BITFIELD_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; + if((dtype = H5Dget_type(dataset1)) < 0) TEST_ERROR; - if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; - H5E_BEGIN_TRY { - native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT); - } H5E_END_TRY; - if(native_type > 0) { - H5_FAILED(); - puts(" Bit field isn't supported. Should have failed."); - TEST_ERROR; - } /* end if */ + if((ntype_size = H5Tget_size(native_type)) == 0) TEST_ERROR; + + rbuf = malloc((size_t)nelmts*ntype_size); + + /* Read the data and compare them */ + if(H5Dread(dataset1, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; + + p = (unsigned int*)rbuf; + for(i = 0; i < BITFIELD_ENUMB*4; i++) { + if(*p != wbuf[i]) { + H5_FAILED(); + printf(" Read different values than written.\n"); + printf(" At index %d\n", i); + TEST_ERROR; + } + p++; + } - if(H5Tclose(type) < 0) TEST_ERROR; if(H5Tclose(dtype) < 0) TEST_ERROR; - if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Dclose(dataset1) < 0) TEST_ERROR; + if(rbuf) free(rbuf); + + /* Open dataset2 again to check H5Tget_native_type */ + if((dataset2 = H5Dopen2(file, DSET2_BITFIELD_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; + + if((dtype = H5Dget_type(dataset2)) < 0) TEST_ERROR; + + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; + /* Read the data and compare them */ + if(H5Dread(dataset2, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, intr) < 0) TEST_ERROR; + + for(i = 0; i < BITFIELD_ENUMB; i++) { + if(intr[i] != intw[i]) { + H5_FAILED(); + printf(" Read different values than written.\n"); + printf(" At index %d\n", i); + TEST_ERROR; + } + } + + if(H5Tclose(dtype) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Dclose(dataset2) < 0) TEST_ERROR; + PASSED(); return 0; @@ -2575,8 +2629,10 @@ error: H5Tclose(type); H5Tclose(dtype); H5Tclose(native_type); - H5Dclose(dset); - H5Dclose(dataset); + H5Dclose(dset1); + H5Dclose(dset2); + H5Dclose(dataset1); + H5Dclose(dataset2); } H5E_END_TRY; return -1; diff --git a/test/ohdr.c b/test/ohdr.c index 16ffc7c..f59dace 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -441,6 +441,8 @@ main(void) /* Open the dataset with the "mark if unknown" message */ if((dset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close the dataset */ if(H5Dclose(dset) < 0) TEST_ERROR diff --git a/test/pool.c b/test/pool.c index 43e9cfd..9b2e8b9 100644 --- a/test/pool.c +++ b/test/pool.c @@ -46,14 +46,11 @@ * Purpose: Test trivial creating & closing memory pool * * Return: Success: 0 - * * Failure: 1 * * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -74,18 +71,18 @@ test_create(void) /* Check free space */ if(H5MP_get_pool_free_size(mp, &free_size) < 0) - TEST_ERROR; + TEST_ERROR if(free_size != 0) TEST_ERROR /* Check first page */ - if (H5MP_get_pool_first_page(mp, &page) < 0) - TEST_ERROR; + if(H5MP_get_pool_first_page(mp, &page) < 0) + TEST_ERROR if(page != NULL) TEST_ERROR /* Close the memory pool */ - if (H5MP_close(mp) < 0) + if(H5MP_close(mp) < 0) TEST_ERROR PASSED(); @@ -94,7 +91,10 @@ test_create(void) error: H5E_BEGIN_TRY { + if(mp) + H5MP_close(mp); } H5E_END_TRY; + return 1; } /* test_create() */ @@ -105,14 +105,11 @@ error: * Purpose: Tests closing pool with one block allocated * * Return: Success: 0 - * * Failure: 1 * * Programmer: Quincey Koziol * Friday, May 6, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -143,7 +140,10 @@ test_close_one(void) error: H5E_BEGIN_TRY { + if(mp) + H5MP_close(mp); } H5E_END_TRY; + return 1; } /* test_close_one() */ @@ -154,14 +154,11 @@ error: * Purpose: Tests allocating first block in pool * * Return: Success: 0 - * * Failure: 1 * * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -187,29 +184,29 @@ test_allocate_first(void) /* Check pool's free space */ if(H5MP_get_pool_free_size(mp, &free_size) < 0) - TEST_ERROR; + TEST_ERROR if(free_size != MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))) TEST_ERROR /* Get first page */ - if (H5MP_get_pool_first_page(mp, &page) < 0) - TEST_ERROR; + if(H5MP_get_pool_first_page(mp, &page) < 0) + TEST_ERROR if(page == NULL) TEST_ERROR /* Check page's free space */ - if (H5MP_get_page_free_size(page, &free_size) < 0) - TEST_ERROR; + if(H5MP_get_page_free_size(page, &free_size) < 0) + TEST_ERROR if(free_size != MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))) TEST_ERROR /* Check that free space totals match */ - if (H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + if(H5MP_pool_is_free_size_correct(mp) <= 0) + TEST_ERROR /* Check next page */ - if (H5MP_get_page_next_page(page, &page) < 0) - TEST_ERROR; + if(H5MP_get_page_next_page(page, &page) < 0) + TEST_ERROR if(page != NULL) TEST_ERROR @@ -217,17 +214,17 @@ test_allocate_first(void) H5MP_free(mp, spc); /* Check pool's free space */ - if (H5MP_get_pool_free_size(mp, &free_size) < 0) - TEST_ERROR; + if(H5MP_get_pool_free_size(mp, &free_size) < 0) + TEST_ERROR if(free_size != MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))) TEST_ERROR /* Check that free space totals match */ - if (H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + if(H5MP_pool_is_free_size_correct(mp) <= 0) + TEST_ERROR /* Close the memory pool */ - if (H5MP_close(mp) < 0) + if(H5MP_close(mp) < 0) TEST_ERROR PASSED(); @@ -244,29 +241,29 @@ test_allocate_first(void) /* Check pool's free space */ if(H5MP_get_pool_free_size(mp, &free_size) < 0) - TEST_ERROR; + TEST_ERROR if(free_size != 0) TEST_ERROR /* Get first page */ - if (H5MP_get_pool_first_page(mp, &page) < 0) - TEST_ERROR; + if(H5MP_get_pool_first_page(mp, &page) < 0) + TEST_ERROR if(page == NULL) TEST_ERROR /* Check page's free space */ - if (H5MP_get_page_free_size(page, &free_size) < 0) - TEST_ERROR; + if(H5MP_get_page_free_size(page, &free_size) < 0) + TEST_ERROR if(free_size != 0) TEST_ERROR /* Check that free space totals match */ - if (H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + if(H5MP_pool_is_free_size_correct(mp) <= 0) + TEST_ERROR /* Check next page */ - if (H5MP_get_page_next_page(page, &page) < 0) - TEST_ERROR; + if(H5MP_get_page_next_page(page, &page) < 0) + TEST_ERROR if(page != NULL) TEST_ERROR @@ -274,17 +271,17 @@ test_allocate_first(void) H5MP_free(mp, spc); /* Check pool's free space */ - if (H5MP_get_pool_free_size(mp, &free_size) < 0) - TEST_ERROR; + if(H5MP_get_pool_free_size(mp, &free_size) < 0) + TEST_ERROR if(free_size != MPOOL_LARGE_BLOCK + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))) TEST_ERROR /* Check that free space totals match */ - if (H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + if(H5MP_pool_is_free_size_correct(mp) <= 0) + TEST_ERROR /* Close the memory pool */ - if (H5MP_close(mp) < 0) + if(H5MP_close(mp) < 0) TEST_ERROR PASSED(); @@ -293,7 +290,10 @@ test_allocate_first(void) error: H5E_BEGIN_TRY { + if(mp) + H5MP_close(mp); } H5E_END_TRY; + return 1; } /* test_allocate_first() */ @@ -305,14 +305,11 @@ error: * existing block * * Return: Success: 0 - * * Failure: 1 * * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -338,13 +335,13 @@ test_allocate_split(void) /* Check pool's free space */ if(H5MP_get_pool_free_size(mp, &free_size) < 0) - TEST_ERROR; + TEST_ERROR if(free_size != MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))) TEST_ERROR /* Check that free space totals match */ - if (H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + if(H5MP_pool_is_free_size_correct(mp) <= 0) + TEST_ERROR /* Allocate more space in pool */ if(NULL == (spc2 = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK))) @@ -352,42 +349,42 @@ test_allocate_split(void) /* Check pool's free space */ if(H5MP_get_pool_free_size(mp, &free_size) < 0) - TEST_ERROR; + TEST_ERROR if(free_size != MPOOL_PAGE_SIZE - (((H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))) * 2) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))) TEST_ERROR /* Check that free space totals match */ - if (H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + if(H5MP_pool_is_free_size_correct(mp) <= 0) + TEST_ERROR /* Free first block in pool */ H5MP_free(mp, spc1); /* Check pool's free space */ - if (H5MP_get_pool_free_size(mp, &free_size) < 0) - TEST_ERROR; + if(H5MP_get_pool_free_size(mp, &free_size) < 0) + TEST_ERROR if(free_size != MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))) TEST_ERROR /* Check that free space totals match */ - if (H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + if(H5MP_pool_is_free_size_correct(mp) <= 0) + TEST_ERROR /* Free second block in pool (should merge with first block) */ H5MP_free(mp, spc2); /* Check pool's free space */ - if (H5MP_get_pool_free_size(mp, &free_size) < 0) - TEST_ERROR; + if(H5MP_get_pool_free_size(mp, &free_size) < 0) + TEST_ERROR if(free_size != MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))) TEST_ERROR /* Check that free space totals match */ - if (H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + if(H5MP_pool_is_free_size_correct(mp) <= 0) + TEST_ERROR /* Close the memory pool */ - if (H5MP_close(mp) < 0) + if(H5MP_close(mp) < 0) TEST_ERROR PASSED(); @@ -396,7 +393,10 @@ test_allocate_split(void) error: H5E_BEGIN_TRY { + if(mp) + H5MP_close(mp); } H5E_END_TRY; + return 1; } /* test_allocate_split() */ @@ -407,14 +407,11 @@ error: * Purpose: Tests allocating many small blocks in a pool * * Return: Success: 0 - * * Failure: 1 * * Programmer: Quincey Koziol * Tuesday, May 6, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -441,13 +438,13 @@ test_allocate_many_small(void) /* Check pool's free space */ if(H5MP_get_pool_free_size(mp, &free_size) < 0) - TEST_ERROR; + TEST_ERROR if(free_size != MPOOL_PAGE_SIZE - (((H5MP_BLOCK_ALIGN(MPOOL_SMALL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))) * MPOOL_NUM_SMALL_BLOCKS) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))) TEST_ERROR /* Check that free space totals match */ - if (H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + if(H5MP_pool_is_free_size_correct(mp) <= 0) + TEST_ERROR /* Free blocks in pool */ /* (Tests free block merging with block after it */ @@ -455,17 +452,17 @@ test_allocate_many_small(void) H5MP_free(mp, spc[i]); /* Check pool's free space */ - if (H5MP_get_pool_free_size(mp, &free_size) < 0) - TEST_ERROR; + if(H5MP_get_pool_free_size(mp, &free_size) < 0) + TEST_ERROR if(free_size != MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))) TEST_ERROR /* Check that free space totals match */ - if (H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + if(H5MP_pool_is_free_size_correct(mp) <= 0) + TEST_ERROR /* Close the memory pool */ - if (H5MP_close(mp) < 0) + if(H5MP_close(mp) < 0) TEST_ERROR PASSED(); @@ -474,7 +471,10 @@ test_allocate_many_small(void) error: H5E_BEGIN_TRY { + if(mp) + H5MP_close(mp); } H5E_END_TRY; + return 1; } /* test_allocate_many_small() */ @@ -486,14 +486,11 @@ error: * new page * * Return: Success: 0 - * * Failure: 1 * * Programmer: Quincey Koziol * Friday, May 6, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -522,13 +519,13 @@ test_allocate_new_page(void) /* Check pool's free space */ if(H5MP_get_pool_free_size(mp, &free_size) < 0) - TEST_ERROR; + TEST_ERROR if(free_size != (MPOOL_PAGE_SIZE * 3) - (((H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))) * MPOOL_NUM_NORMAL_BLOCKS) + (H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)) * 3))) TEST_ERROR /* Check that free space totals match */ - if (H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + if(H5MP_pool_is_free_size_correct(mp) <= 0) + TEST_ERROR /* Free blocks in pool */ /* (Free alternating blocks, in two passes, which tests block merging w/both neighbors) */ @@ -538,17 +535,17 @@ test_allocate_new_page(void) H5MP_free(mp, spc[u]); /* Check pool's free space */ - if (H5MP_get_pool_free_size(mp, &free_size) < 0) - TEST_ERROR; + if(H5MP_get_pool_free_size(mp, &free_size) < 0) + TEST_ERROR if(free_size != ((MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))) * 3)) TEST_ERROR /* Check that free space totals match */ - if (H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + if(H5MP_pool_is_free_size_correct(mp) <= 0) + TEST_ERROR /* Close the memory pool */ - if (H5MP_close(mp) < 0) + if(H5MP_close(mp) < 0) TEST_ERROR PASSED(); @@ -568,32 +565,32 @@ test_allocate_new_page(void) TEST_ERROR /* Check pool's free space */ - if (H5MP_get_pool_free_size(mp, &free_size) < 0) - TEST_ERROR; + if(H5MP_get_pool_free_size(mp, &free_size) < 0) + TEST_ERROR if(free_size != MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))) TEST_ERROR /* Check that free space totals match */ - if (H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + if(H5MP_pool_is_free_size_correct(mp) <= 0) + TEST_ERROR /* Free blocks in pool */ H5MP_free(mp, spc1); H5MP_free(mp, spc2); /* Check pool's free space */ - if (H5MP_get_pool_free_size(mp, &free_size) < 0) - TEST_ERROR; + if(H5MP_get_pool_free_size(mp, &free_size) < 0) + TEST_ERROR if(free_size != ((MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))) + MPOOL_LARGE_BLOCK + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)))) TEST_ERROR /* Check that free space totals match */ - if (H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + if(H5MP_pool_is_free_size_correct(mp) <= 0) + TEST_ERROR /* Close the memory pool */ - if (H5MP_close(mp) < 0) + if(H5MP_close(mp) < 0) TEST_ERROR PASSED(); @@ -602,7 +599,10 @@ test_allocate_new_page(void) error: H5E_BEGIN_TRY { + if(mp) + H5MP_close(mp); } H5E_END_TRY; + return 1; } /* test_allocate_new_page() */ @@ -613,14 +613,11 @@ error: * Purpose: Tests allocating random sized blocks in pool * * Return: Success: 0 - * * Failure: 1 * * Programmer: Quincey Koziol * Friday, May 6, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -640,7 +637,7 @@ test_allocate_random(void) TESTING("allocate many random sized blocks"); /* Initialize random number seed */ - curr_time=HDtime(NULL); + curr_time = HDtime(NULL); #ifdef QAK curr_time=1115412944; HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); @@ -670,7 +667,7 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); /* Check that free space totals match */ if(H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + TEST_ERROR /* Shuffle pointers to free */ for(u = 0; u < MPOOL_NUM_RANDOM; u++) { @@ -685,8 +682,8 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); H5MP_free(mp, spc[u]); /* Check that free space totals match */ - if (H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + if(H5MP_pool_is_free_size_correct(mp) <= 0) + TEST_ERROR /* Initialize the block sizes with random values */ for(u = 0; u < MPOOL_NUM_RANDOM; u++) @@ -700,10 +697,10 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); /* Check that free space totals match */ if(H5MP_pool_is_free_size_correct(mp) <= 0) - TEST_ERROR; + TEST_ERROR /* Close the memory pool */ - if (H5MP_close(mp) < 0) + if(H5MP_close(mp) < 0) TEST_ERROR /* Free memory for block sizes & pointers */ @@ -720,7 +717,10 @@ error: if(spc) HDfree(spc); H5E_BEGIN_TRY { + if(mp) + H5MP_close(mp); } H5E_END_TRY; + return 1; } /* test_allocate_random() */ @@ -731,20 +731,17 @@ error: * Purpose: Test the memory pool code * * Return: Success: - * * Failure: * * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ int main(void) { - int nerrors=0; + int nerrors = 0; /* Reset library */ h5_reset(); @@ -762,14 +759,14 @@ main(void) nerrors += test_allocate_new_page(); nerrors += test_allocate_random(); - if (nerrors) goto error; + if(nerrors) + goto error; puts("All memory pool tests passed."); + return 0; error: puts("*** TESTS FAILED ***"); - H5E_BEGIN_TRY { - } H5E_END_TRY; return 1; } diff --git a/test/stab.c b/test/stab.c index c2655a8..cab0b1b 100644 --- a/test/stab.c +++ b/test/stab.c @@ -680,9 +680,6 @@ read_old(void) /* Open copied file */ if((fid = H5Fopen(FILE_OLD_GROUPS_COPY, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR - /* Open copied file */ - if((fid = H5Fopen(FILE_OLD_GROUPS_COPY, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR - /* Attempt to open "old" group */ if((gid = H5Gopen2(fid, "old", H5P_DEFAULT)) < 0) TEST_ERROR diff --git a/test/tarray.c b/test/tarray.c index cc0a0ca..590d48c 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -44,16 +44,9 @@ #define ARRAY3_DIM2 3 /* 1-D dataset with fixed dimensions */ -#define SPACE1_NAME "Space1" #define SPACE1_RANK 1 #define SPACE1_DIM1 4 -/* 2-D dataset with fixed dimensions */ -#define SPACE2_NAME "Space2" -#define SPACE2_RANK 2 -#define SPACE2_DIM1 10 -#define SPACE2_DIM2 10 - /**************************************************************** ** ** test_array_atomic_1d(): Test basic array datatype code. diff --git a/test/tattr.c b/test/tattr.c index afe45eb..dcf13bc 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -57,7 +57,6 @@ #define CORDER_ITER_STOP 3 /* 3-D dataset with fixed dimensions */ -#define SPACE1_NAME "Space1" #define SPACE1_RANK 3 #define SPACE1_DIM1 3 #define SPACE1_DIM2 15 diff --git a/test/tconfig.c b/test/tconfig.c index 47eed64..6b8fd84 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -61,7 +61,12 @@ void test_exit_definitions(void); * September 25, 2001 * * Modifications: - * + * Raymond Lu + * 16 Dec 2009 + * On Boeing's OpenVMS, the value of EXIT_FAILURE is 268435458. + * (The test is in test_exit_definitions.) Their document says + * it's supposed to be 2. I commented it out for OpenVMS for + * further consideration. *------------------------------------------------------------------------- */ void @@ -70,7 +75,9 @@ test_configure(void) /* Output message about test being performed */ MESSAGE(5, ("Testing configure definitions\n")); test_config_ctypes(); +#ifndef H5_VMS test_exit_definitions(); +#endif } diff --git a/test/testframe.c b/test/testframe.c index dd2f2f4..f0d94d8 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -45,7 +45,7 @@ typedef struct TestStruct { * Variables used by testing framework. */ static int num_errs = 0; /* Total number of errors during testing */ -static int Verbosity = VERBO_DEF; /* Default Verbosity is Low */ +int TestVerbosity = VERBO_DEF; /* Default Verbosity is Low */ static int Summary = 0; /* Show test summary. Default is no. */ static int CleanUp = 1; /* Do cleanup or not. Default is yes. */ static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */ @@ -361,7 +361,7 @@ void TestCleanup(void) */ int GetTestVerbosity(void) { - return(Verbosity); + return(TestVerbosity); } /* @@ -372,8 +372,8 @@ int SetTestVerbosity(int newval) { int oldval; - oldval = Verbosity; - Verbosity = newval; + oldval = TestVerbosity; + TestVerbosity = newval; return(oldval); } diff --git a/test/testhdf5.h b/test/testhdf5.h index f2a820f..adac3fe 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -29,10 +29,14 @@ /* Include generic testing header also */ #include "h5test.h" +/* A macro version of HDGetTestVerbosity(). */ +/* Should be used internally by the libtest.a only. */ +#define HDGetTestVerbosity() (TestVerbosity) + /* Use %ld to print the value because long should cover most cases. */ /* Used to make certain a return value _is_not_ a value */ #define CHECK(ret, val, where) do { \ - if (GetTestVerbosity()>=VERBO_HI) print_func(" Call to routine: %15s at line %4d " \ + if (HDGetTestVerbosity()>=VERBO_HI) print_func(" Call to routine: %15s at line %4d " \ "in %s returned %ld \n", \ where, (int)__LINE__, __FILE__, \ (long)(ret)); \ @@ -44,7 +48,7 @@ } while(0) #define CHECK_I(ret,where) { \ - if (GetTestVerbosity()>=VERBO_HI) { \ + if (HDGetTestVerbosity()>=VERBO_HI) { \ print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \ (where), (int)__LINE__, __FILE__, (long)(ret)); \ } \ @@ -56,7 +60,7 @@ } #define CHECK_PTR(ret,where) { \ - if (GetTestVerbosity()>=VERBO_HI) { \ + if (HDGetTestVerbosity()>=VERBO_HI) { \ print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ (where), (int)__LINE__, __FILE__, (ret)); \ } \ @@ -70,7 +74,7 @@ /* Used to make certain a return value _is_ a value */ #define VERIFY(_x, _val, where) do { \ long __x = (long)_x, __val = (long)_val; \ - if(GetTestVerbosity() >= VERBO_HI) { \ + if(HDGetTestVerbosity() >= VERBO_HI) { \ print_func(" Call to routine: %15s at line %4d in %s had value " \ "%ld \n", (where), (int)__LINE__, __FILE__, __x); \ } \ @@ -84,7 +88,7 @@ /* Used to make certain a (non-'long' type's) return value _is_ a value */ #define VERIFY_TYPE(_x, _val, _type, _format, where) do { \ _type __x = (_type)_x, __val = (_type)_val; \ - if(GetTestVerbosity() >= VERBO_HI) { \ + if(HDGetTestVerbosity() >= VERBO_HI) { \ print_func(" Call to routine: %15s at line %4d in %s had value " \ _format " \n", (where), (int)__LINE__, __FILE__, __x); \ } \ @@ -97,7 +101,7 @@ /* Used to make certain a string return value _is_ a value */ #define VERIFY_STR(x, val, where) do { \ - if (GetTestVerbosity()>=VERBO_HI) { \ + if (HDGetTestVerbosity()>=VERBO_HI) { \ print_func(" Call to routine: %15s at line %4d in %s had value " \ "%s \n", (where), (int)__LINE__, __FILE__, x); \ } \ @@ -110,11 +114,11 @@ /* Used to document process through a test and to check for errors */ #define RESULT(ret,func) do { \ - if (GetTestVerbosity()>VERBO_MED) { \ + if (HDGetTestVerbosity()>VERBO_MED) { \ print_func(" Call to routine: %15s at line %4d in %s returned " \ "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \ } \ - if (GetTestVerbosity()>=VERBO_HI) \ + if (HDGetTestVerbosity()>=VERBO_HI) \ H5Eprint2(H5E_DEFAULT, stdout); \ if ((ret) == FAIL) { \ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ @@ -124,7 +128,7 @@ } while(0) /* Used to document process through a test */ -#define MESSAGE(V,A) {if (GetTestVerbosity()>(V)) print_func A;} +#define MESSAGE(V,A) {if (HDGetTestVerbosity()>(V)) print_func A;} /* definitions for command strings */ #define VERBOSITY_STR "Verbosity" @@ -185,6 +189,9 @@ void cleanup_sohm(void); void cleanup_misc(void); void cleanup_unicode(void); +/* Extern global variables */ +extern int TestVerbosity; + #ifdef __cplusplus } #endif diff --git a/test/th5s.c b/test/th5s.c index 5bf7845..a38e384 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -39,14 +39,12 @@ #define NULLATTR "null_attribute" /* 3-D dataset with fixed dimensions */ -#define SPACE1_NAME "Space1" #define SPACE1_RANK 3 #define SPACE1_DIM1 3 #define SPACE1_DIM2 15 #define SPACE1_DIM3 13 /* 4-D dataset with one unlimited dimension */ -#define SPACE2_NAME "Space2" #define SPACE2_RANK 4 #define SPACE2_DIM1 0 #define SPACE2_DIM2 15 @@ -58,13 +56,10 @@ #define SPACE2_MAX4 23 /* Scalar dataset with simple datatype */ -#define SPACE3_NAME "Scalar1" #define SPACE3_RANK 0 unsigned space3_data=65; /* Scalar dataset with compound datatype */ -#define SPACE4_NAME "Scalar2" -#define SPACE4_RANK 0 #define SPACE4_FIELDNAME1 "c1" #define SPACE4_FIELDNAME2 "u" #define SPACE4_FIELDNAME3 "f" @@ -704,11 +699,11 @@ test_h5s_scalar_write(void) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ + hid_t sid1; /* Dataspace ID */ int rank; /* Logical rank of dataspace */ hsize_t tdims[4]; /* Dimension array to test with */ hssize_t n; /* Number of dataspace elements */ - H5S_class_t ext_type; /* Extent type */ + H5S_class_t ext_type; /* Extent type */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -718,6 +713,12 @@ test_h5s_scalar_write(void) fid1 = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid1, FAIL, "H5Fcreate"); + /* Verify a non-zero rank fails with a NULL dimension. */ + H5E_BEGIN_TRY { + sid1 = H5Screate_simple(SPACE1_RANK, NULL, NULL); + } H5E_END_TRY + VERIFY(sid1, FAIL, "H5Screate_simple"); + /* Create scalar dataspace */ sid1 = H5Screate_simple(SPACE3_RANK, NULL, NULL); CHECK(sid1, FAIL, "H5Screate_simple"); diff --git a/test/trefer.c b/test/trefer.c index bf9692f..dbf12bc 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -30,18 +30,15 @@ #define FILE3 "trefer3.h5" /* 1-D dataset with fixed dimensions */ -#define SPACE1_NAME "Space1" #define SPACE1_RANK 1 #define SPACE1_DIM1 4 /* 2-D dataset with fixed dimensions */ -#define SPACE2_NAME "Space2" #define SPACE2_RANK 2 #define SPACE2_DIM1 10 #define SPACE2_DIM2 10 /* Larger 1-D dataset with fixed dimensions */ -#define SPACE3_NAME "Space3" #define SPACE3_RANK 1 #define SPACE3_DIM1 100 diff --git a/testpar/Makefile.in b/testpar/Makefile.in index c06e6d4..86218ea 100644 --- a/testpar/Makefile.in +++ b/testpar/Makefile.in @@ -339,12 +339,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -835,7 +835,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -906,7 +906,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 9bf3a8d..5b0e187 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -360,19 +360,14 @@ void lock_and_unlock_random_entries(H5C_t * cache_ptr, H5F_t * file_ptr, void lock_and_unlock_random_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int min_idx, int max_idx); void lock_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int32_t idx); -void mark_pinned_entry_dirty(H5C_t * cache_ptr, H5F_t * file_ptr, - int32_t idx, hbool_t size_changed, size_t new_size); -void mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, - H5F_t * file_ptr, - int32_t idx); +void mark_pinned_entry_dirty(int32_t idx, hbool_t size_changed, size_t new_size); +void mark_pinned_or_protected_entry_dirty(int32_t idx); void pin_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty); -void pin_protected_entry(H5C_t * cache_ptr, H5F_t * file_ptr, - int32_t idx, hbool_t global); +void pin_protected_entry(int32_t idx, hbool_t global); void rename_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int32_t old_idx, int32_t new_idx); -void resize_entry(H5C_t * cache_ptr, H5F_t * file_ptr, - int32_t idx, size_t new_size); +void resize_entry(int32_t idx, size_t new_size); hbool_t setup_cache_for_test(hid_t * fid_ptr, H5F_t ** file_ptr_ptr, H5C_t ** cache_ptr_ptr); void setup_rand(void); @@ -1428,7 +1423,7 @@ serve_read_request(struct mssg_t * mssg_ptr) success = FALSE; if ( verbose ) { HDfprintf(stdout, - "%d:%s: data[i].len = %d != mssg->len = %d.\n", + "%d:%s: data[i].len = %Zu != mssg->len = %d.\n", world_mpi_rank, fcn_name, data[target_index].len, mssg_ptr->len); } @@ -1440,7 +1435,7 @@ serve_read_request(struct mssg_t * mssg_ptr) HDfprintf(stdout, "%d:%s: proc %d read invalid entry. idx/base_addr = %d/%a.\n", world_mpi_rank, fcn_name, - mssg_ptr->src, target_index, + mssg_ptr->src, target_index, data[target_index].base_addr); } @@ -1605,7 +1600,7 @@ serve_write_request(struct mssg_t * mssg_ptr) success = FALSE; if ( verbose ) { HDfprintf(stdout, - "%d:%s: data[i].len = %d != mssg->len = %d.\n", + "%d:%s: data[i].len = %Zu != mssg->len = %d.\n", world_mpi_rank, fcn_name, data[target_index].len, mssg_ptr->len); } @@ -2227,7 +2222,7 @@ expunge_entry(H5C_t * cache_ptr, HDassert( ((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE ); HDassert( ! ((entry_ptr->header).is_dirty) ); - result = H5C_get_entry_status(cache_ptr, entry_ptr->base_addr, + result = H5C_get_entry_status(file_ptr, entry_ptr->base_addr, NULL, &in_cache, NULL, NULL, NULL, NULL, NULL); if ( result < 0 ) { @@ -2740,7 +2735,7 @@ lock_entry(H5C_t * cache_ptr, HDassert( ! (entry_ptr->locked) ); - cache_entry_ptr = H5AC_protect(file_ptr, -1, &(types[0]), + cache_entry_ptr = (H5C_cache_entry_t *)H5AC_protect(file_ptr, -1, &(types[0]), entry_ptr->base_addr, NULL, NULL, H5AC_WRITE); @@ -2786,9 +2781,7 @@ lock_entry(H5C_t * cache_ptr, *****************************************************************************/ void -mark_pinned_entry_dirty(H5C_t * cache_ptr, - H5F_t * file_ptr, - int32_t idx, +mark_pinned_entry_dirty(int32_t idx, hbool_t size_changed, size_t new_size) { @@ -2798,8 +2791,6 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr, if ( nerrors == 0 ) { - HDassert( file_ptr ); - HDassert( cache_ptr ); HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) ); HDassert( idx < virt_num_data_entries ); @@ -2811,8 +2802,7 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr, (entry_ptr->ver)++; entry_ptr->dirty = TRUE; - result = H5AC_mark_pinned_entry_dirty(file_ptr, - (void *)entry_ptr, + result = H5AC_mark_pinned_entry_dirty((void *)entry_ptr, size_changed, new_size); @@ -2854,9 +2844,7 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr, *****************************************************************************/ void -mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, - H5F_t * file_ptr, - int32_t idx) +mark_pinned_or_protected_entry_dirty(int32_t idx) { const char * fcn_name = "mark_pinned_or_protected_entry_dirty()"; herr_t result; @@ -2864,8 +2852,6 @@ mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, if ( nerrors == 0 ) { - HDassert( file_ptr ); - HDassert( cache_ptr ); HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) ); HDassert( idx < virt_num_data_entries ); @@ -2876,8 +2862,7 @@ mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, (entry_ptr->ver)++; entry_ptr->dirty = TRUE; - result = H5AC_mark_pinned_or_protected_entry_dirty(file_ptr, - (void *)entry_ptr); + result = H5AC_mark_pinned_or_protected_entry_dirty((void *)entry_ptr); if ( result < 0 ) { @@ -2991,17 +2976,13 @@ pin_entry(H5C_t * cache_ptr, *****************************************************************************/ void -pin_protected_entry(H5C_t * cache_ptr, - H5F_t * file_ptr, - int32_t idx, +pin_protected_entry(int32_t idx, hbool_t global) { const char * fcn_name = "pin_protected_entry()"; herr_t result; struct datum * entry_ptr; - HDassert( cache_ptr ); - HDassert( file_ptr ); HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) ); HDassert( idx < virt_num_data_entries ); @@ -3011,7 +2992,7 @@ pin_protected_entry(H5C_t * cache_ptr, if ( nerrors == 0 ) { - result = H5AC_pin_protected_entry(file_ptr, (void *)entry_ptr); + result = H5AC_pin_protected_entry((void *)entry_ptr); if ( ( result < 0 ) || ( entry_ptr->header.type != &(types[0]) ) || @@ -3180,9 +3161,7 @@ rename_entry(H5C_t * cache_ptr, *****************************************************************************/ void -resize_entry(H5C_t * cache_ptr, - H5F_t * file_ptr, - int32_t idx, +resize_entry(int32_t idx, size_t new_size) { const char * fcn_name = "resize_entry()"; @@ -3191,8 +3170,6 @@ resize_entry(H5C_t * cache_ptr, if ( nerrors == 0 ) { - HDassert( cache_ptr ); - HDassert( file_ptr ); HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) ); HDassert( idx < virt_num_data_entries ); @@ -3208,8 +3185,7 @@ resize_entry(H5C_t * cache_ptr, HDassert( new_size > 0 ); HDassert( new_size <= entry_ptr->len ); - result = H5AC_resize_pinned_entry(file_ptr, (void *)entry_ptr, - new_size); + result = H5AC_resize_pinned_entry((void *)entry_ptr, new_size); if ( result < 0 ) { @@ -3295,7 +3271,7 @@ setup_cache_for_test(hid_t * fid_ptr, world_mpi_rank, fcn_name); } } else { - file_ptr = H5I_object_verify(fid, H5I_FILE); + file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE); } if ( file_ptr == NULL ) { @@ -3553,9 +3529,11 @@ setup_rand(void) } } else { seed = (unsigned)tv.tv_usec; - HDfprintf(stdout, "%d:%s: seed = %d.\n", - world_mpi_rank, fcn_name, seed); - fflush(stdout); + if ( verbose ) { + HDfprintf(stdout, "%d:%s: seed = %d.\n", + world_mpi_rank, fcn_name, seed); + fflush(stdout); + } HDsrand(seed); } } @@ -3776,12 +3754,11 @@ unpin_entry(H5C_t * cache_ptr, if ( dirty ) { - mark_pinned_entry_dirty(cache_ptr, file_ptr, idx, FALSE, - (size_t)0); + mark_pinned_entry_dirty(idx, FALSE, (size_t)0); } - result = H5AC_unpin_entry(file_ptr, (void *)entry_ptr); + result = H5AC_unpin_entry((void *)entry_ptr); if ( result < 0 ) { @@ -5225,7 +5202,7 @@ smoke_check_5(void) if ( i % 2 == 0 ) { - mark_pinned_or_protected_entry_dirty(cache_ptr, file_ptr, i); + mark_pinned_or_protected_entry_dirty(i); } unlock_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET); @@ -5257,23 +5234,21 @@ smoke_check_5(void) { if ( i % 8 <= 4 ) { - resize_entry(cache_ptr, file_ptr, i, data[i].len / 2); + resize_entry(i, data[i].len / 2); } if ( i % 4 == 0 ) { - mark_pinned_or_protected_entry_dirty(cache_ptr, - file_ptr, i); + mark_pinned_or_protected_entry_dirty(i); } else { - mark_pinned_entry_dirty(cache_ptr, file_ptr, i, - FALSE, (size_t)0); + mark_pinned_entry_dirty(i, FALSE, (size_t)0); } if ( i % 8 <= 4 ) { - resize_entry(cache_ptr, file_ptr, i, data[i].len); + resize_entry(i, data[i].len); } } @@ -5539,22 +5514,22 @@ trace_file_check(void) insert_entry(cache_ptr, file_ptr, 3, H5AC__NO_FLAGS_SET); lock_entry(cache_ptr, file_ptr, 0); - mark_pinned_or_protected_entry_dirty(cache_ptr, file_ptr, 0); + mark_pinned_or_protected_entry_dirty(0); unlock_entry(cache_ptr, file_ptr, 0, H5AC__NO_FLAGS_SET); lock_entry(cache_ptr, file_ptr, 1); - pin_protected_entry(cache_ptr, file_ptr, 1, TRUE); + pin_protected_entry(1, TRUE); unlock_entry(cache_ptr, file_ptr, 1, H5AC__NO_FLAGS_SET); unpin_entry(cache_ptr, file_ptr, 1, TRUE, FALSE, FALSE); expunge_entry(cache_ptr,file_ptr, 1); lock_entry(cache_ptr, file_ptr, 2); - pin_protected_entry(cache_ptr, file_ptr, 2, TRUE); + pin_protected_entry(2, TRUE); unlock_entry(cache_ptr, file_ptr, 2, H5AC__NO_FLAGS_SET); - mark_pinned_entry_dirty(cache_ptr, file_ptr, 2, FALSE, 0); - resize_entry(cache_ptr, file_ptr, 2, data[2].len / 2); - resize_entry(cache_ptr, file_ptr, 2, data[2].len); + mark_pinned_entry_dirty(2, FALSE, 0); + resize_entry(2, data[2].len / 2); + resize_entry(2, data[2].len); unpin_entry(cache_ptr, file_ptr, 2, TRUE, FALSE, FALSE); rename_entry(cache_ptr, file_ptr, 0, 20); diff --git a/testpar/t_pflush1.c b/testpar/t_pflush1.c index 0773b93..ebe5c38 100644 --- a/testpar/t_pflush1.c +++ b/testpar/t_pflush1.c @@ -157,12 +157,11 @@ main(int argc, char* argv[]) PASSED(); fflush(stdout); fflush(stderr); - } - else - { + } /* end if */ + else { SKIPPED(); puts(" Test not compatible with current Virtual File Driver"); - } + } /* end else */ /* * Some systems like Linux with mpich, if you just _exit without MPI_Finalize @@ -176,23 +175,23 @@ main(int argc, char* argv[]) */ /* close file1 */ - if(H5Fget_vfd_handle(file1, fapl, (void **)&mpifh_p) < 0){ + if(H5Fget_vfd_handle(file1, fapl, (void **)&mpifh_p) < 0) { printf("H5Fget_vfd_handle for file1 failed\n"); goto error; - } - if(MPI_File_close(mpifh_p)!=MPI_SUCCESS){ + } /* end if */ + if(MPI_File_close(mpifh_p) != MPI_SUCCESS) { printf("MPI_File_close for file1 failed\n"); goto error; - } + } /* end if */ /* close file2 */ - if(H5Fget_vfd_handle(file2, fapl, (void **)&mpifh_p) < 0){ + if(H5Fget_vfd_handle(file2, fapl, (void **)&mpifh_p) < 0) { printf("H5Fget_vfd_handle for file2 failed\n"); goto error; - } - if(MPI_File_close(mpifh_p)!=MPI_SUCCESS){ + } /* end if */ + if(MPI_File_close(mpifh_p) != MPI_SUCCESS) { printf("MPI_File_close for file2 failed\n"); goto error; - } + } /* end if */ fflush(stdout); fflush(stderr); diff --git a/tools/Makefile.in b/tools/Makefile.in index e482ea2..f403257 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -330,12 +330,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -845,7 +845,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -916,7 +916,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5copy/Makefile.in b/tools/h5copy/Makefile.in index d2a8e0d..113abba 100644 --- a/tools/h5copy/Makefile.in +++ b/tools/h5copy/Makefile.in @@ -322,12 +322,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -839,7 +839,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -910,7 +910,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c index f2a41ae..2d5b95d 100644 --- a/tools/h5copy/h5copy.c +++ b/tools/h5copy/h5copy.c @@ -428,7 +428,7 @@ main (int argc, const char *argv[]) h5tools_close(); - return 0; + return EXIT_SUCCESS; error: printf("Error in copy...Exiting\n"); @@ -449,6 +449,6 @@ error: h5tools_close(); - return 1; + return EXIT_FAILURE; } diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh index b513938..c330602 100644 --- a/tools/h5copy/testh5copy.sh +++ b/tools/h5copy/testh5copy.sh @@ -19,6 +19,10 @@ # Thursday, July 20, 2006 # +TESTNAME=h5copy +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + H5COPY=h5copy # The tool name H5COPY_BIN=`pwd`/$H5COPY # The path of the tool binary H5DIFF=h5diff # The h5diff tool name @@ -304,8 +308,9 @@ echo " " COPYOBJECTS h5copytst_new.h5 if test $nerrors -eq 0 ; then - echo "All h5copy tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors - diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in index 04a64da..e11ee1f 100644 --- a/tools/h5diff/Makefile.in +++ b/tools/h5diff/Makefile.in @@ -329,12 +329,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -860,7 +860,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -931,7 +931,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index 3403935..64b0097 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -31,7 +31,7 @@ const char *progname = "h5diff"; * Command-line options: The user can specify short or long-named * parameters. */ -static const char *s_opts = "hVrvqn:d:p:Nc"; +static const char *s_opts = "hVrvqn:d:p:Ncl"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "version", no_arg, 'V' }, @@ -44,6 +44,7 @@ static struct long_options l_opts[] = { { "nan", no_arg, 'N' }, { "compare", no_arg, 'c' }, { "use-system-epsilon", no_arg, 'e' }, + { "link-follow", no_arg, 'l' }, { NULL, 0, '\0' } }; @@ -100,6 +101,9 @@ void parse_command_line(int argc, case 'r': options->m_report = 1; break; + case 'l': + options->linkfollow = 1; + break; case 'd': options->d=1; @@ -360,6 +364,7 @@ void usage(void) printf(" -r, --report Report mode. Print differences\n"); printf(" -v, --verbose Verbose mode. Print differences, list of objects\n"); printf(" -q, --quiet Quiet mode. Do not do output\n"); + printf(" -l, --link-follow Follow link(s)\n"); printf(" -c, --compare List objects that are not comparable\n"); printf(" -N, --nan Avoid NaNs detection\n"); printf(" -n C, --count=C Print differences up to C number, C is a positive integer.\n"); diff --git a/tools/h5diff/testfiles/h5diff_10.txt b/tools/h5diff/testfiles/h5diff_10.txt index 4788a79..a6b637a 100644 --- a/tools/h5diff/testfiles/h5diff_10.txt +++ b/tools/h5diff/testfiles/h5diff_10.txt @@ -9,6 +9,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -l, --link-follow Follow link(s) -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number, C is a positive integer. diff --git a/tools/h5diff/testfiles/h5diff_200.txt b/tools/h5diff/testfiles/h5diff_200.txt index 5a4d02e..56d723d 100644 --- a/tools/h5diff/testfiles/h5diff_200.txt +++ b/tools/h5diff/testfiles/h5diff_200.txt @@ -1,4 +1,3 @@ -dataset: and -------------------------------- Some objects are not comparable -------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_201.txt b/tools/h5diff/testfiles/h5diff_201.txt index da916ea..84d6766 100644 --- a/tools/h5diff/testfiles/h5diff_201.txt +++ b/tools/h5diff/testfiles/h5diff_201.txt @@ -1,2 +1 @@ -dataset: and Not comparable: or is an empty dataset diff --git a/tools/h5diff/testfiles/h5diff_202.txt b/tools/h5diff/testfiles/h5diff_202.txt index 8e3c7ac..fd4a191 100644 --- a/tools/h5diff/testfiles/h5diff_202.txt +++ b/tools/h5diff/testfiles/h5diff_202.txt @@ -1,3 +1,2 @@ -dataset: and Not comparable: is of class H5T_FLOAT and is of class H5T_INTEGER Not comparable: has sign H5T_SGN_ERROR and has sign H5T_SGN_2 diff --git a/tools/h5diff/testfiles/h5diff_203.txt b/tools/h5diff/testfiles/h5diff_203.txt index 90294e3..496523c 100644 --- a/tools/h5diff/testfiles/h5diff_203.txt +++ b/tools/h5diff/testfiles/h5diff_203.txt @@ -1,3 +1,2 @@ -dataset: and Not comparable: has rank 1, dimensions [6], max dimensions [6] and has rank 2, dimensions [3x2], max dimensions [3x2] diff --git a/tools/h5diff/testfiles/h5diff_204.txt b/tools/h5diff/testfiles/h5diff_204.txt index a94091d..098a203 100644 --- a/tools/h5diff/testfiles/h5diff_204.txt +++ b/tools/h5diff/testfiles/h5diff_204.txt @@ -1,3 +1,2 @@ -dataset: and Not comparable: has rank 2, dimensions [3x2], max dimensions [3x2] and has rank 2, dimensions [2x2], max dimensions [2x2] diff --git a/tools/h5diff/testfiles/h5diff_205.txt b/tools/h5diff/testfiles/h5diff_205.txt index c3708cb..3e2d1f2 100644 --- a/tools/h5diff/testfiles/h5diff_205.txt +++ b/tools/h5diff/testfiles/h5diff_205.txt @@ -1,4 +1,3 @@ -dataset: and Not comparable: has rank 2, dimensions [2x2], max dimensions [2x2] and has rank 2, dimensions [3x2], max dimensions [3x2] Not comparable: has sign H5T_SGN_2 and has sign H5T_SGN_NONE diff --git a/tools/h5diff/testfiles/h5diff_206.txt b/tools/h5diff/testfiles/h5diff_206.txt index 3557b1e..164aed9 100644 --- a/tools/h5diff/testfiles/h5diff_206.txt +++ b/tools/h5diff/testfiles/h5diff_206.txt @@ -1,2 +1 @@ -dataset: and Not comparable: has a class H5T_FLOAT and has a class H5T_INTEGER diff --git a/tools/h5diff/testfiles/h5diff_207.txt b/tools/h5diff/testfiles/h5diff_207.txt index 4dfcbb7..bb8e23f 100644 --- a/tools/h5diff/testfiles/h5diff_207.txt +++ b/tools/h5diff/testfiles/h5diff_207.txt @@ -1,3 +1,2 @@ -dataset: and Not comparable: or is an empty dataset Not comparable: has 2 members has 1 members diff --git a/tools/h5diff/testfiles/h5diff_300.txt b/tools/h5diff/testfiles/h5diff_300.txt new file mode 100755 index 0000000..0cfc01b --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_300.txt @@ -0,0 +1,2 @@ +link : and +1 differences found diff --git a/tools/h5diff/testfiles/h5diff_400.txt b/tools/h5diff/testfiles/h5diff_400.txt new file mode 100644 index 0000000..4b910f5 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_400.txt @@ -0,0 +1,54 @@ + +file1 file2 +--------------------------------------- + x x / + x x /softlink_dset1_1 + x x /softlink_dset1_2 + x x /softlink_dset2 + x x /softlink_group1 + x x /softlink_group2 + x x /softlink_noexist + x x /target_dset1 + x x /target_dset2 + x x /target_group + x x /target_group/dset + +group : and +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +warn: link target "/no_obj" doesn't exist +warn: link target "/no_obj" doesn't exist +link : and +Comparison not supported: and are of type unknown type +0 differences found +dataset: and +0 differences found +dataset: and +0 differences found +group : and +0 differences found +dataset: and +0 differences found +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects. diff --git a/tools/h5diff/testfiles/h5diff_401.txt b/tools/h5diff/testfiles/h5diff_401.txt new file mode 100644 index 0000000..5c599e3 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_401.txt @@ -0,0 +1,12 @@ +dataset: and +size: [2x4] [2x4] +position target_dset1 target_dset2 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_402.txt b/tools/h5diff/testfiles/h5diff_402.txt new file mode 100644 index 0000000..228c8cc --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_402.txt @@ -0,0 +1,12 @@ +dataset: and +size: [2x4] [2x4] +position target_dset2 target_dset1 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_403.txt b/tools/h5diff/testfiles/h5diff_403.txt new file mode 100644 index 0000000..5c599e3 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_403.txt @@ -0,0 +1,12 @@ +dataset: and +size: [2x4] [2x4] +position target_dset1 target_dset2 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_404.txt b/tools/h5diff/testfiles/h5diff_404.txt new file mode 100644 index 0000000..2a0b856 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_404.txt @@ -0,0 +1,36 @@ + +file1 file2 +--------------------------------------- + x x / + x x /ext_link_dset1 + x x /ext_link_dset2 + x x /ext_link_grp1 + x x /ext_link_grp2 + x x /ext_link_noexist1 + x x /ext_link_noexist2 + +group : and +0 differences found +external link: and +dataset: and +0 differences found +0 differences found +external link: and +dataset: and +0 differences found +0 differences found +external link: and +group : and +0 differences found +0 differences found +external link: and +group : and +0 differences found +0 differences found +external link: and +Object could not be found in +Object could not be found in +0 differences found +external link: and +h5diff: : unable to open file +0 differences found diff --git a/tools/h5diff/testfiles/h5diff_405.txt b/tools/h5diff/testfiles/h5diff_405.txt new file mode 100644 index 0000000..edbf22a --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_405.txt @@ -0,0 +1,12 @@ +dataset: and +size: [2x4] [2x4] +position x_dset x_dset difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_406.txt b/tools/h5diff/testfiles/h5diff_406.txt new file mode 100644 index 0000000..7c5eb3e --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_406.txt @@ -0,0 +1,12 @@ +dataset: and +size: [2x4] [2x4] +position x_dset x_dset difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_407.txt b/tools/h5diff/testfiles/h5diff_407.txt new file mode 100644 index 0000000..edbf22a --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_407.txt @@ -0,0 +1,12 @@ +dataset: and +size: [2x4] [2x4] +position x_dset x_dset difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_408.txt b/tools/h5diff/testfiles/h5diff_408.txt new file mode 100644 index 0000000..11a928a --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_408.txt @@ -0,0 +1,12 @@ +dataset: and +size: [2x4] [2x4] +position target_dset1 x_dset difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_409.txt b/tools/h5diff/testfiles/h5diff_409.txt new file mode 100644 index 0000000..3b95e7c --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_409.txt @@ -0,0 +1,12 @@ +dataset: and +size: [2x4] [2x4] +position x_dset target_dset1 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_410.txt b/tools/h5diff/testfiles/h5diff_410.txt new file mode 100644 index 0000000..8c645d2 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_410.txt @@ -0,0 +1,85 @@ + +file1 file2 +--------------------------------------- + x x / + x x /softlink1_to_dset1 + x x /softlink1_to_slink1 + x x /softlink1_to_slink2 + x x /softlink2_to_dset2 + x x /softlink2_to_slink1 + x x /softlink2_to_slink2 + x x /softlink3_to_group1 + x x /softlink3_to_slink1 + x x /softlink3_to_slink2 + x x /softlink4_to_group2 + x x /softlink4_to_slink1 + x x /softlink4_to_slink2 + x x /target_dset1 + x x /target_dset2 + x x /target_group + x x /target_group/dset + x x /target_group1 + x x /target_group2 + +group : and +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +dataset: and +0 differences found +dataset: and +0 differences found +group : and +0 differences found +dataset: and +0 differences found +group : and +0 differences found +group : and +0 differences found diff --git a/tools/h5diff/testfiles/h5diff_411.txt b/tools/h5diff/testfiles/h5diff_411.txt new file mode 100644 index 0000000..2775677 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_411.txt @@ -0,0 +1,12 @@ +dataset: and +size: [2x4] [2x4] +position target_dset2 softlink1_to_slink1 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_412.txt b/tools/h5diff/testfiles/h5diff_412.txt new file mode 100644 index 0000000..0924099 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_412.txt @@ -0,0 +1,12 @@ +dataset: and +size: [2x4] [2x4] +position softlink1_to_slink1 target_dset2 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_413.txt b/tools/h5diff/testfiles/h5diff_413.txt new file mode 100644 index 0000000..ae6cfea --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_413.txt @@ -0,0 +1,12 @@ +dataset: and +size: [2x4] [2x4] +position softlink1_to_slink1 softlink2_to_slink1 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_414.txt b/tools/h5diff/testfiles/h5diff_414.txt new file mode 100644 index 0000000..0f07a14 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_414.txt @@ -0,0 +1,2 @@ +group : and +1 differences found diff --git a/tools/h5diff/testfiles/h5diff_415.txt b/tools/h5diff/testfiles/h5diff_415.txt new file mode 100644 index 0000000..3a9d863 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_415.txt @@ -0,0 +1,2 @@ +group : and +1 differences found diff --git a/tools/h5diff/testfiles/h5diff_416.txt b/tools/h5diff/testfiles/h5diff_416.txt new file mode 100644 index 0000000..39d88bc --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_416.txt @@ -0,0 +1,2 @@ +group : and +1 differences found diff --git a/tools/h5diff/testfiles/h5diff_417.txt b/tools/h5diff/testfiles/h5diff_417.txt new file mode 100644 index 0000000..56031e9 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_417.txt @@ -0,0 +1,6 @@ +warn: link target "/no_obj" doesn't exist + is of type unknown type and is of type H5G_DATASET +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects. diff --git a/tools/h5diff/testfiles/h5diff_418.txt b/tools/h5diff/testfiles/h5diff_418.txt new file mode 100644 index 0000000..0222174 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_418.txt @@ -0,0 +1,6 @@ +warn: link target "/no_obj" doesn't exist + is of type H5G_DATASET and is of type unknown type +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects. diff --git a/tools/h5diff/testfiles/h5diff_419.txt b/tools/h5diff/testfiles/h5diff_419.txt new file mode 100644 index 0000000..836e95f --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_419.txt @@ -0,0 +1,2 @@ +error: : unable to open file +error: unable to get external link info from "/ext_link_noexist2" diff --git a/tools/h5diff/testfiles/h5diff_420.txt b/tools/h5diff/testfiles/h5diff_420.txt new file mode 100644 index 0000000..836e95f --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_420.txt @@ -0,0 +1,2 @@ +error: : unable to open file +error: unable to get external link info from "/ext_link_noexist2" diff --git a/tools/h5diff/testfiles/h5diff_421.txt b/tools/h5diff/testfiles/h5diff_421.txt new file mode 100644 index 0000000..c686b69 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_421.txt @@ -0,0 +1,2 @@ +error: "/no_obj" doesn't exist +error: unable to get external link info from "/ext_link_noexist1" diff --git a/tools/h5diff/testfiles/h5diff_422.txt b/tools/h5diff/testfiles/h5diff_422.txt new file mode 100644 index 0000000..c686b69 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_422.txt @@ -0,0 +1,2 @@ +error: "/no_obj" doesn't exist +error: unable to get external link info from "/ext_link_noexist1" diff --git a/tools/h5diff/testfiles/h5diff_423.txt b/tools/h5diff/testfiles/h5diff_423.txt new file mode 100644 index 0000000..5eb6766 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_423.txt @@ -0,0 +1,12 @@ +dataset: and +size: [2x4] [2x4] +position dset1 dset2 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_424.txt b/tools/h5diff/testfiles/h5diff_424.txt new file mode 100644 index 0000000..cd240cf --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_424.txt @@ -0,0 +1,12 @@ +dataset: and +size: [2x4] [2x4] +position dset2 dset1 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_425.txt b/tools/h5diff/testfiles/h5diff_425.txt new file mode 100644 index 0000000..5eb6766 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_425.txt @@ -0,0 +1,12 @@ +dataset: and +size: [2x4] [2x4] +position dset1 dset2 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_600.txt b/tools/h5diff/testfiles/h5diff_600.txt index 82c5240..376e530 100644 --- a/tools/h5diff/testfiles/h5diff_600.txt +++ b/tools/h5diff/testfiles/h5diff_600.txt @@ -9,6 +9,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -l, --link-follow Follow link(s) -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number, C is a positive integer. diff --git a/tools/h5diff/testfiles/h5diff_603.txt b/tools/h5diff/testfiles/h5diff_603.txt index e115114..f8a858d 100644 --- a/tools/h5diff/testfiles/h5diff_603.txt +++ b/tools/h5diff/testfiles/h5diff_603.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -l, --link-follow Follow link(s) -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number, C is a positive integer. diff --git a/tools/h5diff/testfiles/h5diff_606.txt b/tools/h5diff/testfiles/h5diff_606.txt index db361fd..ab317bd 100644 --- a/tools/h5diff/testfiles/h5diff_606.txt +++ b/tools/h5diff/testfiles/h5diff_606.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -l, --link-follow Follow link(s) -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number, C is a positive integer. diff --git a/tools/h5diff/testfiles/h5diff_609.txt b/tools/h5diff/testfiles/h5diff_609.txt index 9369dd9..e69de29 100644 --- a/tools/h5diff/testfiles/h5diff_609.txt +++ b/tools/h5diff/testfiles/h5diff_609.txt @@ -1,2 +0,0 @@ -dataset: and -0 differences found diff --git a/tools/h5diff/testfiles/h5diff_612.txt b/tools/h5diff/testfiles/h5diff_612.txt index bbd6b00..875e17e 100644 --- a/tools/h5diff/testfiles/h5diff_612.txt +++ b/tools/h5diff/testfiles/h5diff_612.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -l, --link-follow Follow link(s) -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number, C is a positive integer. diff --git a/tools/h5diff/testfiles/h5diff_615.txt b/tools/h5diff/testfiles/h5diff_615.txt index 9c8f0c7..258124a 100644 --- a/tools/h5diff/testfiles/h5diff_615.txt +++ b/tools/h5diff/testfiles/h5diff_615.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -l, --link-follow Follow link(s) -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number, C is a positive integer. diff --git a/tools/h5diff/testfiles/h5diff_618.txt b/tools/h5diff/testfiles/h5diff_618.txt index 9369dd9..e69de29 100644 --- a/tools/h5diff/testfiles/h5diff_618.txt +++ b/tools/h5diff/testfiles/h5diff_618.txt @@ -1,2 +0,0 @@ -dataset: and -0 differences found diff --git a/tools/h5diff/testfiles/h5diff_621.txt b/tools/h5diff/testfiles/h5diff_621.txt index 79eebed..1fd7f08 100644 --- a/tools/h5diff/testfiles/h5diff_621.txt +++ b/tools/h5diff/testfiles/h5diff_621.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -l, --link-follow Follow link(s) -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number, C is a positive integer. diff --git a/tools/h5diff/testfiles/h5diff_622.txt b/tools/h5diff/testfiles/h5diff_622.txt index 09de51d..bf15c2a 100644 --- a/tools/h5diff/testfiles/h5diff_622.txt +++ b/tools/h5diff/testfiles/h5diff_622.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -l, --link-follow Follow link(s) -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number, C is a positive integer. diff --git a/tools/h5diff/testfiles/h5diff_623.txt b/tools/h5diff/testfiles/h5diff_623.txt index dc60b94..5186dcc 100644 --- a/tools/h5diff/testfiles/h5diff_623.txt +++ b/tools/h5diff/testfiles/h5diff_623.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -l, --link-follow Follow link(s) -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number, C is a positive integer. diff --git a/tools/h5diff/testfiles/h5diff_624.txt b/tools/h5diff/testfiles/h5diff_624.txt index 016ab77..d646a25 100644 --- a/tools/h5diff/testfiles/h5diff_624.txt +++ b/tools/h5diff/testfiles/h5diff_624.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -l, --link-follow Follow link(s) -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number, C is a positive integer. diff --git a/tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 b/tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 new file mode 100644 index 0000000..50b7d2b Binary files /dev/null and b/tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 b/tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 new file mode 100644 index 0000000..610e890 Binary files /dev/null and b/tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_extlink_src.h5 b/tools/h5diff/testfiles/h5diff_extlink_src.h5 new file mode 100644 index 0000000..cfc1066 Binary files /dev/null and b/tools/h5diff/testfiles/h5diff_extlink_src.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_extlink_trg.h5 b/tools/h5diff/testfiles/h5diff_extlink_trg.h5 new file mode 100644 index 0000000..3a322c9 Binary files /dev/null and b/tools/h5diff/testfiles/h5diff_extlink_trg.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_linked_softlink.h5 b/tools/h5diff/testfiles/h5diff_linked_softlink.h5 new file mode 100644 index 0000000..03c5dee Binary files /dev/null and b/tools/h5diff/testfiles/h5diff_linked_softlink.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_links.h5 b/tools/h5diff/testfiles/h5diff_links.h5 new file mode 100755 index 0000000..8af66a6 Binary files /dev/null and b/tools/h5diff/testfiles/h5diff_links.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_softlinks.h5 b/tools/h5diff/testfiles/h5diff_softlinks.h5 new file mode 100644 index 0000000..67a843d Binary files /dev/null and b/tools/h5diff/testfiles/h5diff_softlinks.h5 differ diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index f316d7c..247e3e1 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -29,36 +29,30 @@ ## test file names ############################################################################### -INDIR=$srcdir/testfiles - -SRCFILE1=h5diff_basic1.h5 -SRCFILE2=h5diff_basic2.h5 -SRCFILE3=h5diff_types.h5 -SRCFILE4=h5diff_dtypes.h5 -SRCFILE5=h5diff_attr1.h5 -SRCFILE6=h5diff_attr2.h5 -SRCFILE7=h5diff_dset1.h5 -SRCFILE8=h5diff_dset2.h5 -SRCFILE9=h5diff_hyper1.h5 -SRCFILE10=h5diff_hyper2.h5 -SRCFILE11=h5diff_empty.h5 -SRCFILE12=h5diff_dset_idx1.h5 -SRCFILE13=h5diff_dset_idx2.h5 - -FILE1="$INDIR/$SRCFILE1" -FILE2="$INDIR/$SRCFILE2" -FILE3="$INDIR/$SRCFILE3" -FILE4="$INDIR/$SRCFILE4" -FILE5="$INDIR/$SRCFILE5" -FILE6="$INDIR/$SRCFILE6" -FILE7="$INDIR/$SRCFILE7" -FILE8="$INDIR/$SRCFILE8" -FILE9="$INDIR/$SRCFILE9" -FILE10="$INDIR/$SRCFILE10" -FILE11="$INDIR/$SRCFILE11" -FILE12="$INDIR/$SRCFILE12" -FILE13="$INDIR/$SRCFILE13" - +FILE1=h5diff_basic1.h5 +FILE2=h5diff_basic2.h5 +FILE3=h5diff_types.h5 +FILE4=h5diff_dtypes.h5 +FILE5=h5diff_attr1.h5 +FILE6=h5diff_attr2.h5 +FILE7=h5diff_dset1.h5 +FILE8=h5diff_dset2.h5 +FILE9=h5diff_hyper1.h5 +FILE10=h5diff_hyper2.h5 +FILE11=h5diff_empty.h5 +FILE12=h5diff_links.h5 +FILE13=h5diff_softlinks.h5 +FILE14=h5diff_linked_softlink.h5 +FILE15=h5diff_extlink_src.h5 +FILE16=h5diff_extlink_trg.h5 +FILE17=h5diff_ext2softlink_src.h5 +FILE18=h5diff_ext2softlink_trg.h5 +FILE19=h5diff_dset_idx1.h5 +FILE20=h5diff_dset_idx2.h5 + +TESTNAME=h5diff +EXIT_SUCCESS=0 +EXIT_FAILURE=1 H5DIFF=h5diff # The tool name H5DIFF_BIN=`pwd`/$H5DIFF # The path of the tool binary @@ -84,6 +78,7 @@ test -d ./testfiles || mkdir ./testfiles while [ $# -gt 0 ]; do case "$1" in -p) # reset the tool name and bin to run ph5diff tests + TESTNAME=ph5diff H5DIFF=ph5diff # The tool name H5DIFF_BIN=`pwd`/$H5DIFF pmode=yes @@ -205,11 +200,12 @@ TOOLTEST() { fi # Run test. + TESTING $H5DIFF $@ ( #echo "#############################" #echo "Expected output for '$H5DIFF $@'" #echo "#############################" - #cd $srcdir/testfiles + cd $srcdir/testfiles eval $RUNCMD $H5DIFF_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -258,8 +254,8 @@ TOOLTEST() { # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav - rm -f $actual_sorted $expect_sorted + rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual_sorted $expect_sorted fi } @@ -285,55 +281,42 @@ SKIP() { # 1.0 -TESTING $H5DIFF -h TOOLTEST h5diff_10.txt -h # 1.1 normal mode -TESTING $H5DIFF $SRCFILE1 $SRCFILE2 TOOLTEST h5diff_11.txt $FILE1 $FILE2 # 1.2 normal mode with objects -TESTING $H5DIFF $SRCFILE1 $SRCFILE2 g1/dset1 g1/dset2 TOOLTEST h5diff_12.txt $FILE1 $FILE2 g1/dset1 g1/dset2 # 1.3 report mode -TESTING $H5DIFF -r $SRCFILE1 $SRCFILE2 TOOLTEST h5diff_13.txt -r $FILE1 $FILE2 # 1.4 report mode with objects -TESTING $H5DIFF -r $SRCFILE1 $SRCFILE2 g1/dset1 g1/dset2 TOOLTEST h5diff_14.txt -r $FILE1 $FILE2 g1/dset1 g1/dset2 # 1.5 with -d -TESTING $H5DIFF --report --delta=5 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_15.txt --report --delta=5 $FILE1 $FILE2 g1/dset3 g1/dset4 # 1.6.1 with -p (int) -TESTING $H5DIFF -v -p 0.02 $SRCFILE1 $SRCFILE1 g1/dset5 g1/dset6 TOOLTEST h5diff_16_1.txt -v -p 0.02 $FILE1 $FILE1 g1/dset5 g1/dset6 # 1.6.2 with -p (unsigned long_long) -TESTING $H5DIFF --verbose --relative=0.02 $SRCFILE1 $SRCFILE1 g1/dset7 g1/dset8 TOOLTEST h5diff_16_2.txt --verbose --relative=0.02 $FILE1 $FILE1 g1/dset7 g1/dset8 # 1.6.3 with -p (double) -TESTING $H5DIFF -v -p 0.02 $SRCFILE1 $SRCFILE1 g1/dset9 g1/dset10 TOOLTEST h5diff_16_3.txt -v -p 0.02 $FILE1 $FILE1 g1/dset9 g1/dset10 # 1.7 verbose mode -TESTING $H5DIFF -v $SRCFILE1 $SRCFILE2 TOOLTEST h5diff_17.txt -v $FILE1 $FILE2 # 1.8 test 32-bit INFINITY -TESTING $H5DIFF $SRCFILE1 $SRCFILE1 /g1/fp19 -TOOLTEST h5diff_171.txt -v $SRCFILE1 $SRCFILE1 /g1/fp19 +TOOLTEST h5diff_171.txt -v $FILE1 $FILE1 /g1/fp19 # 1.8 test 64-bit INFINITY -TESTING $H5DIFF $SRCFILE1 $SRCFILE1 /g1/fp20 -TOOLTEST h5diff_172.txt -v $SRCFILE1 $SRCFILE1 /g1/fp20 +TOOLTEST h5diff_172.txt -v $FILE1 $FILE1 /g1/fp20 # 1.8 quiet mode -TESTING $H5DIFF -q $SRCFILE1 $SRCFILE2 TOOLTEST h5diff_18.txt -q $FILE1 $FILE2 @@ -343,15 +326,12 @@ TOOLTEST h5diff_18.txt -q $FILE1 $FILE2 # ############################################################################## # 2.0 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 dset g1 TOOLTEST h5diff_20.txt -v $FILE3 $FILE3 dset g1 # 2.1 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 dset l1 TOOLTEST h5diff_21.txt -v $FILE3 $FILE3 dset l1 # 2.2 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 dset t1 TOOLTEST h5diff_22.txt -v $FILE3 $FILE3 dset t1 # ############################################################################## @@ -359,27 +339,21 @@ TOOLTEST h5diff_22.txt -v $FILE3 $FILE3 dset t1 # ############################################################################## # 2.3 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 g1 g1 TOOLTEST h5diff_23.txt -v $FILE3 $FILE3 g1 g1 # 2.4 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 t1 t1 TOOLTEST h5diff_24.txt -v $FILE3 $FILE3 t1 t1 # 2.5 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 l1 l1 TOOLTEST h5diff_25.txt -v $FILE3 $FILE3 l1 l1 # 2.6 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 g1 g2 TOOLTEST h5diff_26.txt -v $FILE3 $FILE3 g1 g2 # 2.7 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 t1 t2 TOOLTEST h5diff_27.txt -v $FILE3 $FILE3 t1 t2 # 2.8 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 l1 l2 TOOLTEST h5diff_28.txt -v $FILE3 $FILE3 l1 l2 @@ -389,39 +363,30 @@ TOOLTEST h5diff_28.txt -v $FILE3 $FILE3 l1 l2 # ############################################################################## # 5.0 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset0a dset0b TOOLTEST h5diff_50.txt -v $FILE4 $FILE4 dset0a dset0b # 5.1 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset1a dset1b TOOLTEST h5diff_51.txt -v $FILE4 $FILE4 dset1a dset1b # 5.2 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset2a dset2b TOOLTEST h5diff_52.txt -v $FILE4 $FILE4 dset2a dset2b # 5.3 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset3a dset4b TOOLTEST h5diff_53.txt -v $FILE4 $FILE4 dset3a dset4b # 5.4 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset4a dset4b TOOLTEST h5diff_54.txt -v $FILE4 $FILE4 dset4a dset4b # 5.5 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset5a dset5b TOOLTEST h5diff_55.txt -v $FILE4 $FILE4 dset5a dset5b # 5.6 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset6a dset6b TOOLTEST h5diff_56.txt -v $FILE4 $FILE4 dset6a dset6b # 5.7 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset7a dset7b TOOLTEST h5diff_57.txt -v $FILE4 $FILE4 dset7a dset7b # 5.8 (region reference) -TESTING $H5DIFF -v $SRCFILE7 $SRCFILE8 refreg TOOLTEST h5diff_58.txt -v $FILE7 $FILE8 refreg # ############################################################################## @@ -430,7 +395,6 @@ TOOLTEST h5diff_58.txt -v $FILE7 $FILE8 refreg # 6.0: Check if the command line number of arguments is less than 3 -TESTING $H5DIFF $SRCFILE1 TOOLTEST h5diff_600.txt $FILE1 @@ -440,35 +404,27 @@ TOOLTEST h5diff_600.txt $FILE1 # 6.3: negative value -TESTING $H5DIFF -d -4 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_603.txt -d -4 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.4: zero -TESTING $H5DIFF -d 0 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_604.txt -d 0 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.5: non number -TESTING $H5DIFF -d u $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_605.txt -d u $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.6: hexadecimal -TESTING $H5DIFF -d 0x1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_606.txt -d 0x1 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.7: string -TESTING $H5DIFF -d "1" $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_607.txt -d "1" $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.8: use system epsilon -TESTING $H5DIFF --use-system-epsilon $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_608.txt --use-system-epsilon $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.9: number larger than biggest difference -TESTING $H5DIFF -d 200 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_609.txt -d 200 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.10: number smaller than smallest difference -TESTING $H5DIFF -d 1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_610.txt -d 1 $FILE1 $FILE2 g1/dset3 g1/dset4 @@ -478,35 +434,27 @@ TOOLTEST h5diff_610.txt -d 1 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.12: negative value -TESTING $H5DIFF -p -4 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_612.txt -p -4 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.13: zero -TESTING $H5DIFF -p 0 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_613.txt -p 0 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.14: non number -TESTING $H5DIFF -p u $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_614.txt -p u $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.15: hexadecimal -TESTING $H5DIFF -p 0x1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_615.txt -p 0x1 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.16: string -TESTING $H5DIFF -p "0.21" $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_616.txt -p "0.21" $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.17: repeated option -TESTING $H5DIFF -p 0.21 -p 0.22 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_617.txt -p 0.21 -p 0.22 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.18: number larger than biggest difference -TESTING $H5DIFF -p 2 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_618.txt -p 2 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.19: number smaller than smallest difference -TESTING $H5DIFF -p 0.005 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_619.txt -p 0.005 $FILE1 $FILE2 g1/dset3 g1/dset4 @@ -516,110 +464,214 @@ TOOLTEST h5diff_619.txt -p 0.005 $FILE1 $FILE2 g1/dset3 g1/dset4 # ############################################################################## # 6.21: negative value -TESTING $H5DIFF -n -4 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_621.txt -n -4 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.22: zero -TESTING $H5DIFF -n 0 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_622.txt -n 0 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.23: non number -TESTING $H5DIFF -n u $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_623.txt -n u $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.24: hexadecimal -TESTING $H5DIFF -n 0x1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_624.txt -n 0x1 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.25: string -TESTING $H5DIFF -n "2" $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_625.txt -n "2" $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.26: repeated option -TESTING $H5DIFF -n 2 -n 3 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_626.txt -n 2 -n 3 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.27: number larger than biggest difference -TESTING $H5DIFF --count=200 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_627.txt --count=200 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.28: number smaller than smallest difference -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 # ############################################################################## # 7. attributes # ############################################################################## -TESTING $H5DIFF -v $SRCFILE5 $SRCFILE6 TOOLTEST h5diff_70.txt -v $FILE5 $FILE6 # ############################################################################## # 8. all dataset datatypes # ############################################################################## -TESTING $H5DIFF -v $SRCFILE7 $SRCFILE8 TOOLTEST h5diff_80.txt -v $FILE7 $FILE8 # 9. compare a file with itself -TESTING $H5DIFF -v $SRCFILE2 $SRCFILE2 TOOLTEST h5diff_90.txt -v $FILE2 $FILE2 # 10. read by hyperslab, print indexes if test -n "$pmode" -a "$mydomainname" = hdfgroup.uiuc.edu; then # skip this test which sometimes hangs in some THG machines - SKIP -v $SRCFILE9 $SRCFILE10 + SKIP -v $FILE9 $FILE10 else - TESTING $H5DIFF -v $SRCFILE9 $SRCFILE10 TOOLTEST h5diff_100.txt -v $FILE9 $FILE10 fi # 11. floating point comparison -TESTING $H5DIFF -v $SRCFILE1 $SRCFILE1 g1/d1 g1/d2 TOOLTEST h5diff_101.txt -v $FILE1 $FILE1 g1/d1 g1/d2 -TESTING $H5DIFF -v $SRCFILE1 $SRCFILE1 g1/fp1 g1/fp2 TOOLTEST h5diff_102.txt -v $FILE1 $FILE1 g1/fp1 g1/fp2 # not comparable -c flag -TESTING $H5DIFF $SRCFILE2 $SRCFILE2 g2/dset1 g2/dset2 TOOLTEST h5diff_200.txt $FILE2 $FILE2 g2/dset1 g2/dset2 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset1 g2/dset2 TOOLTEST h5diff_201.txt -c $FILE2 $FILE2 g2/dset1 g2/dset2 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset2 g2/dset3 TOOLTEST h5diff_202.txt -c $FILE2 $FILE2 g2/dset2 g2/dset3 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset3 g2/dset4 TOOLTEST h5diff_203.txt -c $FILE2 $FILE2 g2/dset3 g2/dset4 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset4 g2/dset5 TOOLTEST h5diff_204.txt -c $FILE2 $FILE2 g2/dset4 g2/dset5 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset5 g2/dset6 TOOLTEST h5diff_205.txt -c $FILE2 $FILE2 g2/dset5 g2/dset6 # not comparable in compound -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset7 g2/dset8 TOOLTEST h5diff_206.txt -c $FILE2 $FILE2 g2/dset7 g2/dset8 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset8 g2/dset9 TOOLTEST h5diff_207.txt -c $FILE2 $FILE2 g2/dset8 g2/dset9 +# ############################################################################## +# # Links compare without -l (link follow) +# ############################################################################## +# test for bug1749 +TOOLTEST h5diff_300.txt -v $FILE12 $FILE12 /link_g1 /link_g2 # ############################################################################## -# 12. The comparision for the two datasets between the 2 files should be the same -# SRCFILE12: B-tree indexing is used for the datasets -# SRCFILE13: Fixed Array indexing is used for the datasets +# # Links compare with -l (link follow) # ############################################################################## -TESTING $H5DIFF -v $SRCFILE12 $SRCFILE13 -TOOLTEST h5diff_idx.txt -v $FILE12 $FILE13 +# soft links file to file +TOOLTEST h5diff_400.txt -l -v $FILE13 $FILE13 + +# softlink vs dset" +TOOLTEST h5diff_401.txt -l -v $FILE13 $FILE13 /softlink_dset1_1 /target_dset2 + + +# dset vs softlink" +TOOLTEST h5diff_402.txt -l -v $FILE13 $FILE13 /target_dset2 /softlink_dset1_1 + + +# softlink vs softlink" +TOOLTEST h5diff_403.txt -l -v $FILE13 $FILE13 /softlink_dset1_1 /softlink_dset2 + + +# extlink vs extlink (FILE)" +if test -n "$pmode"; then + # TODO: Skip below test due to hang in prarllel mode + echo "Skip below test due to hang in prarllel mode" + SKIP -l -v $FILE15 $FILE15 +else + TOOLTEST h5diff_404.txt -l -v $FILE15 $FILE15 +fi + + +# extlink vs dset" +TOOLTEST h5diff_405.txt -l -v $FILE15 $FILE16 /ext_link_dset1 /target_group2/x_dset + + +# dset vs extlink" +TOOLTEST h5diff_406.txt -l -v $FILE16 $FILE15 /target_group2/x_dset /ext_link_dset1 + + +# extlink vs extlink" +TOOLTEST h5diff_407.txt -l -v $FILE15 $FILE15 /ext_link_dset1 /ext_link_dset2 + + +# softlink vs extlink" +TOOLTEST h5diff_408.txt -l -v $FILE13 $FILE15 /softlink_dset1_1 /ext_link_dset2 + + +# extlink vs softlink " +TOOLTEST h5diff_409.txt -l -v $FILE15 $FILE13 /ext_link_dset2 /softlink_dset1_1 + + +# linked_softlink vs linked_softlink (FILE)" +TOOLTEST h5diff_410.txt -l -v $FILE14 $FILE14 + + +# dset2 vs linked_softlink_dset1" +TOOLTEST h5diff_411.txt -l -v $FILE14 $FILE14 /target_dset2 /softlink1_to_slink2 + + +# linked_softlink_dset1 vs dset2" +TOOLTEST h5diff_412.txt -l -v $FILE14 $FILE14 /softlink1_to_slink2 /target_dset2 + + +# linked_softlink_to_dset1 vs linked_softlink_to_dset2" +TOOLTEST h5diff_413.txt -l -v $FILE14 $FILE14 /softlink1_to_slink2 /softlink2_to_slink2 + + +# group vs linked_softlink_group1" +TOOLTEST h5diff_414.txt -l -v $FILE14 $FILE14 /target_group /softlink3_to_slink2 + + +# linked_softlink_group1 vs group" +TOOLTEST h5diff_415.txt -l -v $FILE14 $FILE14 /softlink3_to_slink2 /target_group + + +# linked_softlink_to_group1 vs linked_softlink_to_group2" +TOOLTEST h5diff_416.txt -l -v $FILE14 $FILE14 /softlink3_to_slink2 /softlink4_to_slink2 + + +# non-exist-softlink vs softlink" +TOOLTEST h5diff_417.txt -l -v $FILE13 $FILE13 /softlink_noexist /softlink_dset2 + + +# softlink vs non-exist-softlink" +TOOLTEST h5diff_418.txt -l -v $FILE13 $FILE13 /softlink_dset2 /softlink_noexist + + +# non-exist-extlink_file vs extlink" +if test -n "$pmode"; then + # TODO: Skip below test due to hang in prarllel mode + echo "Skip below test due to hang in prarllel mode" + SKIP -l -v $FILE15 $FILE15 /ext_link_noexist2 /ext_link_dset2 +else + TOOLTEST h5diff_419.txt -l -v $FILE15 $FILE15 /ext_link_noexist2 /ext_link_dset2 +fi + + +# exlink vs non-exist-extlink_file" +if test -n "$pmode"; then + # TODO: Skip below test due to hang in prarllel mode + echo "Skip below test due to hang in prarllel mode" + SKIP -l -v $FILE15 $FILE15 /ext_link_dset2 /ext_link_noexist2 +else + TOOLTEST h5diff_420.txt -l -v $FILE15 $FILE15 /ext_link_dset2 /ext_link_noexist2 +fi + + +# extlink vs non-exist-extlink_obj" +TOOLTEST h5diff_421.txt -l -v $FILE15 $FILE15 /ext_link_dset2 /ext_link_noexist1 + + +# non-exist-extlink_obj vs extlink" +TOOLTEST h5diff_422.txt -l -v $FILE15 $FILE15 /ext_link_noexist1 /ext_link_dset2 + + +# extlink_to_softlink_to_dset1 vs dset2" +TOOLTEST h5diff_423.txt -l -v $FILE17 $FILE18 /ext_link_to_slink1 /dset2 + + +# dset2 vs extlink_to_softlink_to_dset1" +TOOLTEST h5diff_424.txt -l -v $FILE18 $FILE17 /dset2 /ext_link_to_slink1 + + +# extlink_to_softlink_to_dset1 vs extlink_to_softlink_to_dset2" +TOOLTEST h5diff_425.txt -l -v $FILE17 $FILE17 /ext_link_to_slink1 /ext_link_to_slink2 + +# ############################################################################## +# 19. The comparision for the two datasets between the 2 files should be the same +# FILE19: B-tree indexing is used for the datasets +# FILE20: Fixed Array indexing is used for the datasets +# ############################################################################## +TOOLTEST h5diff_idx.txt -v $FILE19 $FILE20 # ############################################################################## @@ -627,7 +679,9 @@ TOOLTEST h5diff_idx.txt -v $FILE12 $FILE13 # ############################################################################## if test $nerrors -eq 0 ; then - echo "All $H5DIFF tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors diff --git a/tools/h5diff/testph5diff.sh b/tools/h5diff/testph5diff.sh index 1375756..0734d21 100755 --- a/tools/h5diff/testph5diff.sh +++ b/tools/h5diff/testph5diff.sh @@ -19,6 +19,10 @@ if test -z "$srcdir"; then srcdir=. fi +TESTNAME=ph5diff +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + TOOL=${srcdir}/testh5diff.sh nerrors=0 @@ -53,12 +57,10 @@ TOOLTEST() { # testphdf5 test using the MPI-POSIX VFL driver TOOLTEST -p -# Emit message about testing status +# no need to print any message since this is just a shell to invoke +# testh5diff.sh which has already printed the result. Just exit. if test $nerrors -eq 0 ; then - echo "All $TEST_APP tests passed." + exit $EXIT_SUCCESS else - echo "ERROR! One or more $TOOL tests failed." + exit $EXIT_FAILURE fi - -# Propagate a useful exit code -exit $nerrors diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index 8ca6684..1791da5 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -327,12 +327,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -851,7 +851,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -922,7 +922,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index abe97ea..0f25efe 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -2707,14 +2707,13 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) H5D_fill_time_t ft; hsize_t storage_size; haddr_t ioffset; - int i, next; + int i; unsigned j; - storage_size=H5Dget_storage_size(obj_id); + storage_size = H5Dget_storage_size(obj_id); nfilters = H5Pget_nfilters(dcpl_id); - ioffset=H5Dget_offset(obj_id); - next=H5Pget_external_count(dcpl_id); - strcpy(f_name,"\0"); + ioffset = H5Dget_offset(obj_id); + HDstrcpy(f_name,"\0"); /*------------------------------------------------------------------------- * STORAGE_LAYOUT @@ -2819,6 +2818,10 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) printf("%s\n",END); } else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl_id)) { + int next; + + next = H5Pget_external_count(dcpl_id); + /*------------------------------------------------------------------------- * EXTERNAL_FILE *------------------------------------------------------------------------- @@ -4531,8 +4534,7 @@ print_enum(hid_t type) size_t dst_size; /*destination value type size */ unsigned i; - nmembs = H5Tget_nmembers(type); - assert(nmembs>0); + nmembs = (unsigned)H5Tget_nmembers(type); super = H5Tget_super(type); /* @@ -4542,17 +4544,16 @@ print_enum(hid_t type) * 2. unsigned long long -- the largest native unsigned integer * 3. raw format */ - if (H5Tget_size(type) <= sizeof(long long)) { - dst_size = sizeof(long long); + if(H5Tget_size(type) <= sizeof(long long)) { + dst_size = sizeof(long long); - if (H5T_SGN_NONE == H5Tget_sign(type)) { - native = H5T_NATIVE_ULLONG; - } else { - native = H5T_NATIVE_LLONG; - } - } else { - dst_size = H5Tget_size(type); - } + if(H5T_SGN_NONE == H5Tget_sign(type)) + native = H5T_NATIVE_ULLONG; + else + native = H5T_NATIVE_LLONG; + } /* end if */ + else + dst_size = H5Tget_size(type); /* Get the names and raw values of all members */ name = calloc(nmembs, sizeof(char *)); @@ -5838,19 +5839,19 @@ xml_dump_group(hid_t gid, const char *name) t_objname, parentxid, par_name); free(t_objname); free(par_name); - } - indentation(indent + COL); - t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */ - par_name = xml_escape_the_name(par); - xml_name_to_XID(found_obj->objname, ptrstr, 100, 1); - xml_name_to_XID(par, parentxid, 100, 1); - printf("<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - ptrstr, t_objname, parentxid, par_name); - free(t_objname); - free(par_name); + indentation(indent + COL); + t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */ + par_name = xml_escape_the_name(par); + xml_name_to_XID(found_obj->objname, ptrstr, 100, 1); + xml_name_to_XID(par, parentxid, 100, 1); + printf("<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", + xmlnsprefix, + ptrstr, t_objname, parentxid, par_name); + free(t_objname); + free(par_name); + } free(ptrstr); } else { @@ -6712,7 +6713,7 @@ xml_print_enum(hid_t type) unsigned i; /*miscellaneous counters */ size_t j; - nmembs = H5Tget_nmembers(type); + nmembs = (unsigned)H5Tget_nmembers(type); super = H5Tget_super(type); indentation(indent); diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 84274cf..55434ab 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -23,6 +23,10 @@ USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@" USE_FILTER_NBIT="@USE_FILTER_NBIT@" USE_FILTER_SCALEOFFSET="@USE_FILTER_SCALEOFFSET@" +TESTNAME=h5dump +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + DUMPER=h5dump # The tool name DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary TESTDIR=`pwd`/../testfiles @@ -512,8 +516,9 @@ TOOLTEST textlinkfar.ddl textlinkfar.h5 TOOLTEST tdset_idx.ddl -p -H tdset_idx.h5 if test $nerrors -eq 0 ; then - echo "All $DUMPER tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors - diff --git a/tools/h5dump/testh5dumpxml.sh.in b/tools/h5dump/testh5dumpxml.sh.in index 3e81a05..c4c8657 100755 --- a/tools/h5dump/testh5dumpxml.sh.in +++ b/tools/h5dump/testh5dumpxml.sh.in @@ -15,6 +15,10 @@ # # Tests for the h5dump tool +TESTNAME=h5dumpxml +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + H5_LONE_COLON="@H5_LONE_COLON@" DUMPER=h5dump # The tool name @@ -185,10 +189,10 @@ TOOLTEST torderattr3.h5.xml --xml -H --sort_by=creation_order --sort_order=ascen TOOLTEST torderattr4.h5.xml --xml -H --sort_by=creation_order --sort_order=descending torderattr.h5 - - if test $nerrors -eq 0 ; then - echo "All $DUMPER tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in index 15fcf90..620d0c0 100755 --- a/tools/h5import/Makefile.in +++ b/tools/h5import/Makefile.in @@ -322,12 +322,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -833,7 +833,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -904,7 +904,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index 60ef494..e9e7dac 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) case 6: /* -h found; help, then exit */ help(argv[0]); - exit(0); + exit(EXIT_SUCCESS); break; case 7: /* -d found; look for dimensions */ diff --git a/tools/h5import/h5importtestutil.sh b/tools/h5import/h5importtestutil.sh index ca445ed..d8b54a7 100755 --- a/tools/h5import/h5importtestutil.sh +++ b/tools/h5import/h5importtestutil.sh @@ -16,8 +16,12 @@ # HDF Utilities Test script # Usage: h5importtestutil.sh [machine-type] +TESTNAME=h5import +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + # initialize errors variable -errors=0 +nerrors=0 TESTING() { SPACES=" " @@ -37,7 +41,7 @@ cd .. cmp -s tmp_testfiles/log1 log2 || err=1 rm -f log2 tmp_testfiles/log1 if [ $err -eq 1 ]; then -errors="` expr $errors + 1 `"; +nerrors="` expr $nerrors + 1 `"; echo "*FAILED*" else echo " PASSED" @@ -120,18 +124,15 @@ rm -f *.txt *.bin *.h5 rm -rf tmp_testfiles else echo "** h5import or h5importtest not available ***" - errors="` expr $errors + 1 `"; + nerrors="` expr $nerrors + 1 `"; fi # # Check errors result -if [ $errors -eq 0 ]; then - echo "======================================" - echo " H5IMPORT Utilities tests have passed." - echo "======================================" +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS else - echo "*********************************************" - echo " H5IMPORT Utilities tests encountered errors" - echo "*********************************************" + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi -exit $errors diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in index 5509801..fe7fbd7 100644 --- a/tools/h5jam/Makefile.in +++ b/tools/h5jam/Makefile.in @@ -336,12 +336,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -864,7 +864,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -935,7 +935,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index c6fdb5c..cceed75 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -454,7 +454,7 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout, if (nchars <= 0) { printf ("huh? \n"); - exit (1); + exit (EXIT_FAILURE); } /*ncw = */ HDwrite (outfid, buf, (unsigned) nchars); diff --git a/tools/h5jam/testh5jam.sh.in b/tools/h5jam/testh5jam.sh.in index e17c860..cfefcdc 100644 --- a/tools/h5jam/testh5jam.sh.in +++ b/tools/h5jam/testh5jam.sh.in @@ -21,6 +21,10 @@ USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@" USE_FILTER_SHUFFLE="@USE_FILTER_SHUFFLE@" USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@" +TESTNAME=h5jam/h5unjam +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + DUMPER=h5dump # The dumper to use DUMPER_BIN=`pwd`/../$DUMPER # The path of the dumper binary JAM=h5jam # Tool to test @@ -526,7 +530,9 @@ CLEANUP tac3.h5 taj3.h5 if test $nerrors -eq 0 ; then - echo "All $JAM tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in index c11dc43..fdd09c6 100644 --- a/tools/h5ls/Makefile.in +++ b/tools/h5ls/Makefile.in @@ -316,12 +316,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -814,7 +814,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -885,7 +885,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index dd33879..aa7781e 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -336,12 +336,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -887,7 +887,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -958,7 +958,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index e9aae81..69f5059 100755 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -27,6 +27,10 @@ USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@" USE_FILTER_NBIT="@USE_FILTER_NBIT@" USE_FILTER_SCALEOFFSET="@USE_FILTER_SCALEOFFSET@" +TESTNAME=h5repack +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + H5REPACK=h5repack # The tool name H5REPACK_BIN=`pwd`/$H5REPACK # The path of the tool binary @@ -528,8 +532,10 @@ TOOLTEST $FILE15 TOOLTEST1 $FILE16 if test $nerrors -eq 0 ; then - echo "All $H5REPACK tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi -exit $nerrors - diff --git a/tools/h5stat/Makefile.in b/tools/h5stat/Makefile.in index 08de49b..a9bedaa 100644 --- a/tools/h5stat/Makefile.in +++ b/tools/h5stat/Makefile.in @@ -345,12 +345,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -907,7 +907,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -978,7 +978,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index b21e5a0..aa10eb4 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -580,10 +580,12 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) iter->dset_comptype[0]++; for(u = 0; u < (unsigned)nfltr; u++) { fltr = H5Pget_filter2(dcpl, u, 0, 0, 0, 0, 0, NULL); - if(fltr < (H5_NFILTERS_IMPL - 1)) - iter->dset_comptype[fltr]++; - else - iter->dset_comptype[H5_NFILTERS_IMPL - 1]++; /*other filters*/ + if(fltr >= 0) { + if(fltr < (H5_NFILTERS_IMPL - 1)) + iter->dset_comptype[fltr]++; + else + iter->dset_comptype[H5_NFILTERS_IMPL - 1]++; /*other filters*/ + } /* end if */ } /* end for */ } /* endif nfltr */ diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in index 28837ec..a1fff1d 100644 --- a/tools/h5stat/testh5stat.sh.in +++ b/tools/h5stat/testh5stat.sh.in @@ -23,6 +23,10 @@ USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@" USE_FILTER_NBIT="@USE_FILTER_NBIT@" USE_FILTER_SCALEOFFSET="@USE_FILTER_SCALEOFFSET@" +TESTNAME=h5stat +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + STAT=h5stat # The tool name STAT_BIN=`pwd`/$STAT # The path of the tool binary @@ -128,10 +132,11 @@ TOOLTEST h5stat_newgrat.ddl h5stat_newgrat.h5 TOOLTEST h5stat_idx.ddl h5stat_idx.h5 echo - if test $nerrors -eq 0 ; then - echo "All $STAT tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi -exit $nerrors - diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index 2b269ca..09c8edf 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -315,12 +315,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -796,7 +796,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -867,7 +867,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 7d11f2f..4b7b796 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -20,6 +20,31 @@ #include "h5tools.h" #include "h5tools_utils.h" +/* This code is layout for common code among tools */ +typedef enum toolname_t { + TOOL_H5DIFF, TOOL_H5LS, TOOL__H5DUMP /* add as necessary */ +} h5tool_toolname_t; +/* this struct can be used to differntiate among tools if necessary */ +typedef struct { + h5tool_toolname_t toolname; + int mode; +} h5tool_opt_t; + +/* To return link's target info + * Functions: + * H5tools_get_softlink_target_info() + * H5tools_get_extlink_target_info() + * Note: this may be move to h5tools code if used by other tools + */ +typedef struct { + const char *buf; /* IN: must be allocated along with H5Lget_info[li.u.val_size] */ + H5O_type_t type; /* OUT: target type */ + const char *path; /* OUT: target name */ + int is_path_malloced; /* VAR: Set to TRUE if path is malloced, so can be freed by checking this later. Needed when ext-link's target is soft-link */ + const char *extfile; /* OUT: if external link, external filename */ + hid_t extfile_id; /* OUT: if external link, external file id */ + h5tool_opt_t opt; /* IN: options */ +} h5tool_link_trg_info_t; /* * Debug printf macros. The prefix allows output filtering by test scripts. */ @@ -168,6 +193,235 @@ static void print_incoming_data(void) #endif /*------------------------------------------------------------------------- + * Function: H5tools_get_softlink_target_info + * + * Purpose: Get target object's type and path from soft-link path + * + * Patameters: + * - [IN] fileid : soft-link file id + * - [IN] linkpath : soft-link's source path + * - [IN] h5li : soft-link's source H5L_info_t + * - [OUT] trg_info: returning target info (refer to struct) + * + * Return: + * Success - 1 and return data via trg_info struct + * Fail - 0 + * + * Note: + * trg_info->buf must be allocated along with H5Lget_info[li.u.val_size] + * before passing to this function. + * + * Programmer: Jonathan Kim + * + * Date: Jan 20, 2010 + *-------------------------------------------------------------------------*/ +static int H5tools_get_softlink_target_info(hid_t file_id, const char * linkpath, H5L_info_t h5li, h5tool_link_trg_info_t *s_trg_info) +{ + H5O_type_t otype = H5O_TYPE_UNKNOWN; + H5O_info_t oinfo; + H5L_info_t linfo; + int ret = 0; /* init to fail */ + + + if((H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0)) + { + parallel_print("error: \"%s\" doesn't exist \n",linkpath); + goto out; + } + + if(H5Lget_info(file_id, linkpath, &linfo, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link info from \"%s\"\n",linkpath); + goto out; + } + + /* get target name for softlink */ + if(linfo.type == H5L_TYPE_SOFT) + { + /* s_trg_info->buf should be already allocated out of + * this function and free when done */ + if(H5Lget_val(file_id, linkpath, s_trg_info->buf, h5li.u.val_size, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link value from \"%s\"\n",s_trg_info->path); + goto out; + } + /* target path */ + s_trg_info->path = s_trg_info->buf; + } + /* if obj is hard link, will still get the type */ + else if (linfo.type == H5L_TYPE_HARD) + { + s_trg_info->path = linkpath; + } + + /*-------------------------------------------------------------- + * if link target or object exit, get type + */ + if((H5Lexists(file_id, s_trg_info->path, H5P_DEFAULT) == TRUE)) + { + + if(H5Oget_info_by_name(file_id, s_trg_info->path, &oinfo, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get object information for \"%s\"\n", s_trg_info->path); + goto out; + } + + otype = oinfo.type; + + + /* check unknown type */ + if (otype < H5O_TYPE_GROUP || otype >=H5O_TYPE_NTYPES) + { + parallel_print("<%s> is unknown type\n", s_trg_info->path); + goto out; + } + } + else + { + parallel_print("warn: link target \"%s\" doesn't exist \n", s_trg_info->path); + } + + /* set target obj type to return */ + s_trg_info->type = otype; + + /* succeed */ + ret = 1; +out: + return ret; +} + +/*------------------------------------------------------------------------- + * Function: H5tools_get_extlink_target_info + * + * Purpose: Get target object's type, path, file_id and filename from + * external-link + * + * Patameters: + * - [IN] fileid : external-link source file-id + * - [IN] linkpath : external-link source path + * - [IN] h5li : external-link source H5L_info_t + * - [OUT] trg_info : returning target info (refer to struct) + * + * Return: + * Success - 1 and return data via trg_info struct + * Fail - 0 + * + * Note: + * - trg_info->buf must be allocated along with H5Lget_info[li.u.val_size] + * before passing to this function. + * - if target is soft-link, trg_info->path will be malloced. so check if + * trg_info->is_path_malloced==TRUE, then free trg_info->path along with freeing + * trg_info->buf outside of this function. + * + * Programmer: Jonathan Kim + * + * Date: Jan 20, 2010 + *-------------------------------------------------------------------------*/ +static int H5tools_get_extlink_target_info(hid_t fileid, const char *linkpath, H5L_info_t h5li, h5tool_link_trg_info_t *trg_info) +{ + + hid_t extfile_id; + const char *extlink_file; + const char *extlink_path; + h5tool_link_trg_info_t soft_trg_info; + H5L_info_t slinfo; + int ret=0; /* init to Fail */ + + /* init */ + HDmemset(&soft_trg_info, 0, sizeof(h5tool_link_trg_info_t)); + trg_info->type = H5O_TYPE_UNKNOWN; + + if(H5Lget_val(fileid, linkpath, trg_info->buf, h5li.u.val_size, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link value from \"%s\"\n",linkpath); + goto out; + } + /*--------------------------------------- + * get target filename and object path + */ + if(H5Lunpack_elink_val(trg_info->buf, h5li.u.val_size, NULL, &extlink_file, &extlink_path)<0) + { + parallel_print("error: unable to unpack external link value\n"); + goto out; + } + + /* return target filename and obj path */ + trg_info->path = extlink_path; + trg_info->extfile = extlink_file; + + /* --------------------------------- + * get file id from external file + * mimicked from h5diff() for Parallel code + * , but not sure if it's needed + */ + H5E_BEGIN_TRY + { + /* open file */ + if((extfile_id = h5tools_fopen(extlink_file, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) + { + parallel_print("error: <%s>: unable to open file\n", extlink_file); +#ifdef H5_HAVE_PARALLEL + if(g_Parallel) + /* Let tasks know that they won't be needed */ + phdiff_dismiss_workers(); +#endif + goto out; + } /* end if */ + } H5E_END_TRY; + + /* get external file id */ + trg_info->extfile_id = extfile_id; + + /* -------------------------------------------------- + * check if target is soft link, if so allocate buffer + */ + if((H5Lexists(trg_info->extfile_id, trg_info->path, H5P_DEFAULT) <= 0)) + { + parallel_print("error: \"%s\" doesn't exist \n", trg_info->path); + goto out; + } + if(H5Lget_info(trg_info->extfile_id, trg_info->path, &slinfo, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link info from \"%s\"\n", trg_info->path); + goto out; + } + + /* if ext-link's target is soft-link */ + if(slinfo.type == H5L_TYPE_SOFT) + { + size_t bufsize = (h5li.u.val_size > slinfo.u.val_size)?h5li.u.val_size:slinfo.u.val_size; + soft_trg_info.buf = (char*)HDcalloc(bufsize, sizeof(char)); + HDassert(trg_info->path); + } + + /* get target obj type */ + if(H5tools_get_softlink_target_info(trg_info->extfile_id, trg_info->path, h5li, &soft_trg_info)==0) + { + parallel_print("error: unable to get link info from \"%s\"\n", trg_info->path); + goto out; + } + + /* target obj type */ + trg_info->type = soft_trg_info.type; + + /* if ext-link's target is soft-link */ + if(slinfo.type == H5L_TYPE_SOFT) + { + trg_info->path = HDstrdup(soft_trg_info.buf); + HDassert(trg_info->path); + /* set TRUE so this can be freed later */ + trg_info->is_path_malloced = TRUE; + } + + /* Success */ + ret=1; +out: + if(soft_trg_info.buf) + HDfree(soft_trg_info.buf); + + return ret; +} +/*------------------------------------------------------------------------- * Function: h5diff * * Purpose: public function, can be called in an application program. @@ -826,9 +1080,34 @@ hsize_t diff_compare(hid_t file1_id, int f1 = 0; int f2 = 0; hsize_t nfound = 0; + ssize_t i,j; + + /* local variables for diff() */ + hid_t l_fileid1=file1_id; + hid_t l_fileid2=file2_id; + h5trav_type_t obj1type, obj2type; + const char *obj1name, *obj2name; + + /* softlink info to get target name and type */ + h5tool_link_trg_info_t softlinkinfo1; + h5tool_link_trg_info_t softlinkinfo2; + + /* external link file id */ + hid_t extfile1_id = (-1); + hid_t extfile2_id = (-1); + h5tool_link_trg_info_t extlinkinfo1; + h5tool_link_trg_info_t extlinkinfo2; - ssize_t i = h5trav_getindex (info1, obj1_name); - ssize_t j = h5trav_getindex (info2, obj2_name); + /* init softlink info */ + HDmemset(&softlinkinfo1, 0, sizeof(h5tool_link_trg_info_t)); + HDmemset(&softlinkinfo2, 0, sizeof(h5tool_link_trg_info_t)); + + /* init external link info */ + HDmemset(&extlinkinfo1, 0, sizeof(h5tool_link_trg_info_t)); + HDmemset(&extlinkinfo2, 0, sizeof(h5tool_link_trg_info_t)); + + i = h5trav_getindex (info1, obj1_name); + j = h5trav_getindex (info2, obj2_name); if (i == -1) { @@ -849,28 +1128,206 @@ hsize_t diff_compare(hid_t file1_id, } /* use the name with "/" first, as obtained by iterator function */ - obj1_name = info1->paths[i].path; - obj2_name = info2->paths[j].path; + obj1name = info1->paths[i].path; + obj2name = info2->paths[j].path; + + obj1type = info1->paths[i].type; + obj2type = info2->paths[j].type; + + /*----------------------------------------------------------------- + * follow link option, compare with target object + */ + if (options->linkfollow) + { + H5L_info_t li1, li2; + + /*------------------------------------------------------------ + * Soft links + *------------------------------------------------------------*/ + /*------------------------ + * if object1 softlink + */ + if (obj1type == H5TRAV_TYPE_LINK) + { + if(H5Lget_info(file1_id, obj1_name, &li1, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link info from \"%s\"\n",obj1_name); + goto out; + } + + softlinkinfo1.buf = (char*)HDcalloc(li1.u.val_size, sizeof(char)); + HDassert(softlinkinfo1.buf); + + /* get type and name of target object */ + if(H5tools_get_softlink_target_info(file1_id, obj1_name, li1, &softlinkinfo1)==0) + { + parallel_print("error: unable to get softlink info from \"%s\"\n",obj1_name); + goto out; + } + + /* set target name and type to pass diff() */ + obj1type = softlinkinfo1.type; + obj1name = softlinkinfo1.path; + } + + /*------------------------ + * if object2 is softlink + */ + if (obj2type == H5TRAV_TYPE_LINK) + { + if(H5Lget_info(file2_id, obj2_name, &li2, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link info from \"%s\"\n",obj2_name); + goto out; + } + + + softlinkinfo2.buf = (char*)HDcalloc(li2.u.val_size, sizeof(char)); + HDassert(softlinkinfo2.buf); + + /* get type and name of target object */ + if(H5tools_get_softlink_target_info(file2_id, obj2_name, li2, &softlinkinfo2)==0) + { + parallel_print("error: unable to get softlink info from \"%s\"\n",obj2_name); + goto out; + } + + /* set target name and type to pass diff() */ + obj2type = softlinkinfo2.type; + obj2name = softlinkinfo2.path; + } + + /*------------------------------------------------------------ + * External links + *------------------------------------------------------------*/ + + /*------------------------------- + * if object1 is external link + */ + if (obj1type == H5TRAV_TYPE_UDLINK) + { + if(H5Lget_info(file1_id, obj1_name, &li1, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link info from \"%s\"\n",obj1_name); + goto out; + } + + /* for external link */ + if(li1.type == H5L_TYPE_EXTERNAL) + { + extlinkinfo1.buf = (char*)HDcalloc(li1.u.val_size, sizeof(char)); + HDassert(extlinkinfo1.buf); + + /* get type and name of target object */ + if(H5tools_get_extlink_target_info(file1_id, obj1_name, li1, &extlinkinfo1)==0) + { + parallel_print("error: unable to get external link info from \"%s\"\n",obj1_name); + goto out; + } + + /* if valid actual object */ + if (extlinkinfo1.type < H5O_TYPE_GROUP || extlinkinfo1.type >= H5O_TYPE_NTYPES) + { + if (options->m_verbose) + { + parallel_print("<%s> is invaild type\n", obj1_name); + } + goto out; + } + + /* set target fileid, name and type to pass diff() */ + l_fileid1 = extlinkinfo1.extfile_id; + obj1name = extlinkinfo1.path; + obj1type = extlinkinfo1.type; + } + } + + /*------------------------------- + * if object2 is external link + */ + if (obj2type == H5TRAV_TYPE_UDLINK) + { + if(H5Lget_info(file2_id, obj2_name, &li2, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link info from \"%s\"\n",obj2_name); + goto out; + } + /* for external link */ + if(li2.type == H5L_TYPE_EXTERNAL) + { + extlinkinfo2.buf = (char*)HDcalloc(li2.u.val_size, sizeof(char)); + HDassert(extlinkinfo2.buf); + + /* get type and name of target object */ + if(H5tools_get_extlink_target_info(file2_id, obj2_name, li2, &extlinkinfo2)==0) + { + parallel_print("error: unable to get external link info from \"%s\"\n",obj2_name); + goto out; + } + /* if valid actual object */ + if (extlinkinfo2.type < H5O_TYPE_GROUP || extlinkinfo2.type >= H5O_TYPE_NTYPES) + { + if (options->m_verbose) + { + parallel_print("<%s> is invaild type\n", obj2_name); + } + goto out; + } + + /* set target fileid, name and type to pass diff() */ + l_fileid2 = extlinkinfo2.extfile_id; + obj2name = extlinkinfo2.path; + obj2type = extlinkinfo2.type; + } + } + } /* end of linkfollow */ + /* objects are not the same type */ - if (info1->paths[i].type != info2->paths[j].type) + if (obj1type != obj2type) { if (options->m_verbose||options->m_list_not_cmp) { parallel_print("<%s> is of type %s and <%s> is of type %s\n", - obj1_name, get_type(info1->paths[i].type), obj2_name, - get_type(info2->paths[j].type)); + obj1name, get_type(obj1type), obj2name, + get_type(obj2type)); } options->not_cmp=1; - return 0; + goto out; } - nfound = diff(file1_id, - obj1_name, - file2_id, - obj2_name, - options, - info1->paths[i].type); + nfound = diff(l_fileid1, obj1name, + l_fileid2, obj2name, + options, obj1type); + +out: + /* free soft link buffer */ + if (softlinkinfo1.buf) + HDfree(softlinkinfo1.buf); + if (softlinkinfo2.buf) + HDfree(softlinkinfo2.buf); + /* free external link buffer */ + if (extlinkinfo1.buf); + { + HDfree(extlinkinfo1.buf); + /* case for ext-link's target is soft-link */ + if(extlinkinfo1.is_path_malloced) + HDfree(extlinkinfo1.path); + } + if (extlinkinfo2.buf); + { + HDfree(extlinkinfo2.buf); + /* case for ext-link's target is soft-link */ + if(extlinkinfo2.is_path_malloced) + HDfree(extlinkinfo2.path); + } + + /* close external file */ + H5E_BEGIN_TRY + { + H5Fclose(extfile1_id); + H5Fclose(extfile2_id); + } H5E_END_TRY; return nfound; } @@ -909,6 +1366,17 @@ hsize_t diff(hid_t file1_id, int ret; hsize_t nfound = 0; + char *extlinkbuf1=NULL; + char *extlinkbuf2=NULL; + + /* used in soft link case (H5TRAV_TYPE_LINK) */ + h5tool_link_trg_info_t softlinkinfo1; + h5tool_link_trg_info_t softlinkinfo2; + /*init */ + HDmemset(&softlinkinfo1,0,sizeof(h5tool_link_trg_info_t)); + HDmemset(&softlinkinfo2,0,sizeof(h5tool_link_trg_info_t)); + + switch(type) { /*------------------------------------------------------------------------- @@ -931,11 +1399,13 @@ hsize_t diff(hid_t file1_id, /* the rest (-c, none, ...) */ else { - do_print_objname("dataset", path1, path2); nfound = diff_dataset(file1_id, file2_id, path1, path2, options); - /* not comparable, no display the different number */ - if (!options->not_cmp) + /* print info if compatible and difference found */ + if (!options->not_cmp && nfound) + { + do_print_objname("dataset", path1, path2); print_found(nfound); + } } break; @@ -1020,35 +1490,66 @@ hsize_t diff(hid_t file1_id, case H5TRAV_TYPE_LINK: { H5L_info_t li1, li2; - char *buf1, *buf2; if(H5Lget_info(file1_id, path1, &li1, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link info from \"%s\"\n", path1); goto out; - if(H5Lget_info(file1_id, path1, &li2, H5P_DEFAULT) < 0) + } + if(H5Lget_info(file2_id, path2, &li2, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link info from \"%s\"\n", path2); goto out; + } - buf1 = HDmalloc(li1.u.val_size); - buf2 = HDmalloc(li2.u.val_size); + softlinkinfo1.buf = (char*)HDcalloc(li1.u.val_size, sizeof(char)); + HDassert(softlinkinfo1.buf); + softlinkinfo2.buf = (char*)HDcalloc(li2.u.val_size, sizeof(char)); + HDassert(softlinkinfo2.buf); - if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0) + if(H5tools_get_softlink_target_info(file1_id,path1,li1,&softlinkinfo1)==0) + { + parallel_print("error: unable to get softlink info from \"%s\"\n", path1); goto out; - if(H5Lget_val(file2_id, path2, buf2, li2.u.val_size, H5P_DEFAULT) < 0) + } + if(H5tools_get_softlink_target_info(file2_id,path2,li2,&softlinkinfo2)==0) + { + parallel_print("error: unable to get softlink info from \"%s\"\n", path2); goto out; + } - ret = HDstrcmp(buf1, buf2); + ret = HDstrcmp(softlinkinfo1.path, softlinkinfo2.path); - /* if "buf1" != "buf2" then the links are "different" */ + /* if the target link name is not same then the links are "different" */ nfound = (ret != 0) ? 1 : 0; if(print_objname(options, nfound)) do_print_objname("link", path1, path2); + if (options->linkfollow) + { + /* objects are not the same type */ + if (softlinkinfo1.type != softlinkinfo2.type) + { + if (options->m_verbose||options->m_list_not_cmp) + { + parallel_print("<%s> is of type %d and <%s> is of type %d\n", softlinkinfo1.path, softlinkinfo1.type, softlinkinfo2.path, softlinkinfo2.type); + } + options->not_cmp=1; + goto out; + } + + nfound += diff(file1_id, softlinkinfo1.path, + file2_id, softlinkinfo2.path, + options, softlinkinfo1.type); + } + /* always print the number of differences found in verbose mode */ if(options->m_verbose) print_found(nfound); - HDfree(buf1); - HDfree(buf2); + HDfree(softlinkinfo1.buf); + HDfree(softlinkinfo2.buf); } break; @@ -1061,55 +1562,80 @@ hsize_t diff(hid_t file1_id, H5L_info_t li1, li2; if(H5Lget_info(file1_id, path1, &li1, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get udlink info from \"%s\"\n", path1); goto out; - if(H5Lget_info(file1_id, path1, &li2, H5P_DEFAULT) < 0) + } + if(H5Lget_info(file2_id, path2, &li2, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get udlink info from \"%s\"\n", path2); goto out; + } /* Only external links will have a query function registered */ - if(li1.type == H5L_TYPE_EXTERNAL && li2.type == H5L_TYPE_EXTERNAL) { - char *buf1, *buf2; + if(li1.type == H5L_TYPE_EXTERNAL && li2.type == H5L_TYPE_EXTERNAL) + { - buf1 = HDmalloc(li1.u.val_size); - buf2 = HDmalloc(li2.u.val_size); + extlinkbuf1 = (char*)HDcalloc(li1.u.val_size, sizeof(char)); + HDassert(extlinkbuf1); + extlinkbuf2 = (char*)HDcalloc(li2.u.val_size, sizeof(char)); + HDassert(extlinkbuf2); - if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0) { - HDfree(buf1); - HDfree(buf2); + if(H5Lget_val(file1_id, path1, extlinkbuf1, li1.u.val_size, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link value from \"%s\"\n",path1); goto out; } /* end if */ - if(H5Lget_val(file2_id, path2, buf2, li2.u.val_size, H5P_DEFAULT) < 0) { - HDfree(buf1); - HDfree(buf2); + if(H5Lget_val(file2_id, path2, extlinkbuf2, li2.u.val_size, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link value from \"%s\"\n",path2); goto out; } /* end if */ /* If the buffers are the same size, compare them */ - if(li1.u.val_size == li2.u.val_size) { - if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0) { - HDfree(buf1); - HDfree(buf2); - goto out; - } /* end if */ - if(H5Lget_val(file2_id, path2, buf2, li2.u.val_size, H5P_DEFAULT) < 0) { - HDfree(buf1); - HDfree(buf2); - goto out; - } /* end if */ - ret = HDmemcmp(buf1, buf2, li1.u.val_size); + if(li1.u.val_size == li2.u.val_size) + { + ret = HDmemcmp(extlinkbuf1, extlinkbuf2, li1.u.val_size); } else ret = 1; - /* if "buf1" != "buf2" then the links are "different" */ + /* if "extlinkbuf1" != "extlinkbuf2" then the links are "different" */ nfound = (ret != 0) ? 1 : 0; if(print_objname(options, nfound)) do_print_objname("external link", path1, path2); - HDfree(buf1); - HDfree(buf2); + if (options->linkfollow) + { + const char *extlink_file1; + const char *extlink_path1; + const char *extlink_file2; + const char *extlink_path2; + + /* get file name and obj path */ + if(H5Lunpack_elink_val(extlinkbuf1, li1.u.val_size, NULL, &extlink_file1, &extlink_path1)<0) + { + parallel_print("error: unable to unpack external link value of obj1\n"); + goto out; + } + + /* get file name and obj path */ + if(H5Lunpack_elink_val(extlinkbuf2, li2.u.val_size, NULL, &extlink_file2, &extlink_path2)<0) + { + parallel_print("error: unable to unpack external link value of obj2\n"); + goto out; + } + + nfound = h5diff(extlink_file1, extlink_file2, + extlink_path1, extlink_path2, options); + } + + HDfree(extlinkbuf1); + HDfree(extlinkbuf2); } /* end if */ - else { + else + { /* If one or both of these links isn't an external link, we can only * compare information from H5Lget_info since we don't have a query * function registered for them. @@ -1145,6 +1671,18 @@ hsize_t diff(hid_t file1_id, out: options->err_stat = 1; + /* free buf used for softlink */ + if (softlinkinfo1.buf) + HDfree(softlinkinfo1.buf); + if (softlinkinfo2.buf) + HDfree(softlinkinfo2.buf); + + /* free buf used for softlink */ + if (extlinkbuf1) + HDfree(extlinkbuf1); + if (extlinkbuf2) + HDfree(extlinkbuf2); + /* close */ /* disable error reporting */ H5E_BEGIN_TRY { diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index df264dd..090d3d9 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -35,6 +35,7 @@ typedef struct { double percent; /* relative error value */ int n; /* count, compare up to count */ hsize_t count; /* count value */ + int linkfollow; /* link follow*/ int err_stat; /* an error ocurred (1, error, 0, no error) */ int cmn_objs; /* do we have common objects */ int not_cmp; /* are the objects comparable */ diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 73a7ee7..2cf6539 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -242,7 +242,6 @@ hsize_t diff_attr(hid_t loc1_id, /* the rest (-c, none, ...) */ else { - do_print_objname ("attribute", np1, np2); nfound = diff_array(buf1, buf2, nelmts1, @@ -257,8 +256,11 @@ hsize_t diff_attr(hid_t loc1_id, attr2_id); /* not comparable, no display the different number */ - if (!options->not_cmp) + if (!options->not_cmp && nfound) + { + do_print_objname ("attribute", np1, np2); print_found(nfound); + } } diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index ad9331d..2cc84ca 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -545,11 +545,6 @@ hsize_t diff_datasetid( hid_t did1, } /* elmtno */ H5Sclose(sm_space); - /* free */ - HDfree(sm_buf1); - sm_buf1 = NULL; - HDfree(sm_buf2); - sm_buf2 = NULL; } /* hyperslab read */ }/*can_compare*/ diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 55075a0..7f1019a 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -2000,10 +2000,10 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c /* calculate the potential number of elements we're going to print */ if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); if((sm_nelmts = H5Sget_select_npoints(f_space)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed"); if (sm_nelmts > 0) { /* @@ -2011,7 +2011,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c * a hyperslab whose size is manageable. */ if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); if (ctx->ndims > 0) for (i = ctx->ndims; i > 0; --i) { @@ -2025,18 +2025,17 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c assert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/ if((sm_buf = HDmalloc((size_t) sm_nelmts * p_type_nbytes)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine"); if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, &zero, NULL, &sm_nelmts, NULL) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); /* read the data */ - if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) { - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); - } + if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed"); /* print the data */ flags = START_OF_DATA; @@ -2050,7 +2049,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c /* print array indices. get the lower bound of the hyperslab and calulate the element position at the start of hyperslab */ if(H5Sget_select_bounds(f_space, low, high) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed"); elmtno = 0; for (i = 0; i < (size_t) ctx->ndims - 1; i++) { @@ -2066,10 +2065,12 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c ctx->sm_pos = elmtno; h5tools_dump_simple_data(stream, info, dset, ctx, flags, sm_nelmts, p_type, sm_buf); -done: + if(H5Sclose(sm_space) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - HDfree(sm_buf); + H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + if(sm_buf) + HDfree(sm_buf); + sm_buf = NULL; } else H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print"); @@ -2081,6 +2082,9 @@ done: } /* hyperslab_count loop */ CATCH + if(sm_buf) + HDfree(sm_buf); + return ret_value; } @@ -2272,7 +2276,8 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset hid_t p_type, struct subset_t *sset, int indentlevel) { HERR_INIT(herr_t, SUCCEED) - hid_t f_space; /* file data space */ + int sndims; + hid_t f_space = -1; /* file data space */ size_t i; /* counters */ hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/ h5tools_context_t ctx; /* print context */ @@ -2288,8 +2293,9 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset memset(&ctx, 0, sizeof(ctx)); ctx.indent_level = indentlevel; ctx.need_prefix = 1; - if((ctx.ndims = H5Sget_simple_extent_ndims(f_space)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + if((sndims = H5Sget_simple_extent_ndims(f_space)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + ctx.ndims = (unsigned)sndims; /* assume entire data space to be printed */ if (ctx.ndims > 0) @@ -2297,10 +2303,11 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset ctx.p_min_idx[i] = 0; if(H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); ctx.size_last_dim = total_size[ctx.ndims - 1]; h5tools_display_simple_subset(stream, info, &ctx, dset, p_type, sset, f_space, total_size); + /* Terminate the output */ if (ctx.cur_column) { fputs(OPT(info->line_suf, ""), stream); @@ -2308,11 +2315,10 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset fputs(OPT(info->line_sep, ""), stream); } -done: - if(H5Sclose(f_space) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - CATCH + if(f_space >= 0 && H5Sclose(f_space) < 0) + H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + return ret_value; } @@ -3283,17 +3289,19 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type) char **name = NULL; /*member names */ unsigned char *value = NULL; /*value array */ unsigned char *copy = NULL; /*a pointer to value array */ - unsigned nmembs; /*number of members */ + unsigned nmembs = 0; /*number of members */ int nchars; /*number of output characters */ hid_t super = -1; /*enum base integer type */ hid_t native = -1; /*native integer datatype */ H5T_sign_t sign_type; /*sign of value type */ size_t type_size; /*value type size */ size_t dst_size; /*destination value type size */ + int snmembs; unsigned i; - if((nmembs = H5Tget_nmembers(type)) < 0) + if((snmembs = H5Tget_nmembers(type)) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + nmembs = (unsigned)snmembs; assert(nmembs > 0); if((super = H5Tget_super(type)) < 0) @@ -3301,6 +3309,7 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type) if((type_size = H5Tget_size(type)) <= 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed"); + /* * Determine what datatype to use for the native values. To simplify * things we entertain three possibilities: @@ -3308,21 +3317,18 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type) * 2. unsigned long long -- the largest native unsigned integer * 3. raw format */ - if (type_size <= sizeof(long long)) { + if(type_size <= sizeof(long long)) { dst_size = sizeof(long long); if((sign_type = H5Tget_sign(type))<0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed"); - if (H5T_SGN_NONE == sign_type) { + if(H5T_SGN_NONE == sign_type) native = H5T_NATIVE_ULLONG; - } - else { + else native = H5T_NATIVE_LLONG; - } - } - else { + } /* end if */ + else dst_size = type_size; - } /* Get the names and raw values of all members */ if((name = calloc(nmembs, sizeof(char *))) == NULL) @@ -3377,10 +3383,9 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type) } CATCH - if(name) { /* Release resources */ - for (i = 0; i < nmembs; i++) + for(i = 0; i < nmembs; i++) if(name[i]) free(name[i]); free(name); @@ -3390,9 +3395,9 @@ CATCH free(value); if(super >= 0 && H5Tclose(super) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class"); - if (0 == nmembs) + if(0 == nmembs) h5tools_str_append(buffer, "\n"); return ret_value; diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h index 9efe223..dc5f87b 100644 --- a/tools/lib/h5tools_error.h +++ b/tools/lib/h5tools_error.h @@ -71,7 +71,7 @@ extern hid_t H5E_tools_min_id_g; /* Macro for "catching" flow of control when an error occurs. Note that the * H5_LEAVE macro won't jump back here once it's past this point. */ -#define CATCH past_catch = TRUE; catch_except:; +#define CATCH catch_except:; past_catch = TRUE; /* * H5_LEAVE macro, used to facilitate control flow between a @@ -116,3 +116,4 @@ extern hid_t H5E_tools_min_id_g; #define HGOTO_DONE(ret_val) {ret_value = ret_val; goto done;} #endif /* H5TOOLS_ERROR_H_ */ + diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index 325023d..341a5c9 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -49,31 +49,6 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr int nfilters; /* number of filters */ H5Z_filter_t filtn; /* filter identification number */ int i; /* index */ - int have_deflate=0; /* assume initially we do not have filters */ - int have_szip=0; - int have_shuffle=0; - int have_fletcher=0; - int have_nbit=0; - int have_scaleoffset=0; - -#ifdef H5_HAVE_FILTER_DEFLATE - have_deflate=1; -#endif -#ifdef H5_HAVE_FILTER_SZIP - have_szip=1; -#endif -#ifdef H5_HAVE_FILTER_SHUFFLE - have_shuffle=1; -#endif -#ifdef H5_HAVE_FILTER_FLETCHER32 - have_fletcher=1; -#endif -#ifdef H5_HAVE_FILTER_NBIT - have_nbit=1; -#endif -#ifdef H5_HAVE_FILTER_SCALEOFFSET - have_scaleoffset=1; -#endif /* get information about filters */ @@ -106,72 +81,66 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr *------------------------------------------------------------------------- */ case H5Z_FILTER_DEFLATE: - if (!have_deflate) - { +#ifndef H5_HAVE_FILTER_DEFLATE if (name) print_warning(name,"deflate"); return 0; - } +#endif break; /*------------------------------------------------------------------------- * H5Z_FILTER_SZIP 4 , szip compression *------------------------------------------------------------------------- */ case H5Z_FILTER_SZIP: - if (!have_szip) - { +#ifndef H5_HAVE_FILTER_SZIP if (name) print_warning(name,"SZIP"); return 0; - } +#endif break; /*------------------------------------------------------------------------- * H5Z_FILTER_SHUFFLE 2 , shuffle the data *------------------------------------------------------------------------- */ case H5Z_FILTER_SHUFFLE: - if (!have_shuffle) - { +#ifndef H5_HAVE_FILTER_SHUFFLE if (name) print_warning(name,"shuffle"); return 0; - } +#endif break; /*------------------------------------------------------------------------- * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC *------------------------------------------------------------------------- */ case H5Z_FILTER_FLETCHER32: - if (!have_fletcher) - { +#ifndef H5_HAVE_FILTER_FLETCHER32 if (name) print_warning(name,"fletcher32"); return 0; - } +#endif break; /*------------------------------------------------------------------------- * H5Z_FILTER_NBIT *------------------------------------------------------------------------- */ case H5Z_FILTER_NBIT: - if (!have_nbit) - { +#ifndef H5_HAVE_FILTER_NBIT if (name) print_warning(name,"nbit"); return 0; - } +#endif break; /*------------------------------------------------------------------------- * H5Z_FILTER_SCALEOFFSET *------------------------------------------------------------------------- */ case H5Z_FILTER_SCALEOFFSET: - if (!have_scaleoffset) - { +#ifndef H5_HAVE_FILTER_SCALEOFFSET if (name) print_warning(name,"scaleoffset"); return 0; - } +#endif break; }/*switch*/ }/*for*/ @@ -197,34 +166,6 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr */ int h5tools_can_encode( H5Z_filter_t filtn) { - - int have_deflate=0; /* assume initially we do not have filters */ - int have_szip=0; - int have_shuffle=0; - int have_fletcher=0; - int have_nbit=0; - int have_scaleoffset=0; - unsigned int filter_config_flags; - -#ifdef H5_HAVE_FILTER_DEFLATE - have_deflate=1; -#endif -#ifdef H5_HAVE_FILTER_SZIP - have_szip=1; -#endif -#ifdef H5_HAVE_FILTER_SHUFFLE - have_shuffle=1; -#endif -#ifdef H5_HAVE_FILTER_FLETCHER32 - have_fletcher=1; -#endif -#ifdef H5_HAVE_FILTER_NBIT - have_nbit=1; -#endif -#ifdef H5_HAVE_FILTER_SCALEOFFSET - have_scaleoffset=1; -#endif - switch (filtn) { /* user defined filter */ @@ -232,16 +173,17 @@ int h5tools_can_encode( H5Z_filter_t filtn) return 0; case H5Z_FILTER_DEFLATE: - if (!have_deflate) - { - return 0; - } +#ifndef H5_HAVE_FILTER_DEFLATE + return 0; +#endif break; case H5Z_FILTER_SZIP: - if (!have_szip) +#ifndef H5_HAVE_FILTER_SZIP + return 0; +#else { - return 0; - } + unsigned int filter_config_flags; + if(H5Zget_filter_info(filtn, &filter_config_flags)<0) return -1; if ((filter_config_flags & @@ -263,30 +205,28 @@ int h5tools_can_encode( H5Z_filter_t filtn) (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) { return 1; } + } +#endif break; case H5Z_FILTER_SHUFFLE: - if (!have_shuffle) - { +#ifndef H5_HAVE_FILTER_SHUFFLE return 0; - } +#endif break; case H5Z_FILTER_FLETCHER32: - if (!have_fletcher) - { +#ifndef H5_HAVE_FILTER_FLETCHER32 return 0; - } +#endif break; case H5Z_FILTER_NBIT: - if (!have_nbit) - { +#ifndef H5_HAVE_FILTER_NBIT return 0; - } +#endif break; case H5Z_FILTER_SCALEOFFSET: - if (!have_scaleoffset) - { +#ifndef H5_HAVE_FILTER_SCALEOFFSET return 0; - } +#endif break; }/*switch*/ diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in index a3d3e23..0b8ccb6 100644 --- a/tools/misc/Makefile.in +++ b/tools/misc/Makefile.in @@ -370,12 +370,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -969,7 +969,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -1040,7 +1040,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in index 28f0dee..c274f3f 100755 --- a/tools/misc/h5cc.in +++ b/tools/misc/h5cc.in @@ -38,6 +38,10 @@ HL="@HL@" ## ## ############################################################################ +# Constants definitions +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + host_os="@host_os@" prog_name="`basename $0`" @@ -95,7 +99,7 @@ usage() { echo " HDF5_USE_SHLIB=[yes|no] - use shared or static version of the HDF5 library" echo " [default: no]" echo " " - exit 1 + exit $EXIT_FAILURE } # Show the configuration summary of the library recorded in the @@ -107,7 +111,7 @@ showconfigure() } # Main -status=0 +status=$EXIT_SUCCESS if test "$#" = "0"; then # No parameters specified, issue usage statement and exit. diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c index 1452a64..a6fdc56 100644 --- a/tools/misc/h5mkgrp.c +++ b/tools/misc/h5mkgrp.c @@ -319,6 +319,6 @@ main(int argc, const char *argv[]) /* Shut down h5tools lib */ h5tools_close(); - return 0; + return EXIT_SUCCESS; } /* end main() */ diff --git a/tools/misc/h5redeploy.in b/tools/misc/h5redeploy.in index 6abca62..ae79b70 100755 --- a/tools/misc/h5redeploy.in +++ b/tools/misc/h5redeploy.in @@ -18,6 +18,10 @@ ## in a new location. ## For help page, use "h5redeploy -help" +# Constants definitions +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + # Function definitions # show help page @@ -34,7 +38,7 @@ usage() { echo " directory and writable. [default: $h5tools]" echo " -show Show the commands without executing them" echo " " - exit 1 + exit $EXIT_FAILURE } # display variable values @@ -96,7 +100,7 @@ for arg in $@ ; do *) ERROR "Unknown Option($arg)" usage - exit 1 + exit $EXIT_FAILURE ;; esac done @@ -104,7 +108,7 @@ done # Sanity checks if [ ! -d $prefix ]; then ERROR "prefix($prefix) is not an existing directory" - exit 1 + exit $EXIT_FAILURE fi for x in $h5tools; do @@ -112,14 +116,14 @@ for x in $h5tools; do foundtools="$foundtools $x" if [ ! -w $x ]; then ERROR "h5tool($x) is not writable" - exit 1 + exit $EXIT_FAILURE fi fi done if [ -z "$foundtools" ]; then ERROR "found no tools to modify" - exit 1 + exit $EXIT_FAILURE fi # Show actions to be taken and get consent @@ -131,7 +135,7 @@ if [ x-$fmode = x- ]; then ans=`echo $ansx | tr "[A-Z]" "[a-z]"` if [ x-$ans != x-yes ]; then echo ABORT. No tools changed. - exit 1 + exit $EXIT_FAILURE fi fi @@ -166,7 +170,7 @@ done # Cleanup rm -f $CMDFILE -exit 0 +exit $EXIT_SUCCESS # Some possible future features to add # CCBASE - Name of the alternative C compiler diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c index 91df7b6..d41dfc9 100644 --- a/tools/misc/h5repart.c +++ b/tools/misc/h5repart.c @@ -98,7 +98,7 @@ usage (const char *progname) "`k' for kB.\n"); fprintf(stderr, "File family names include an integer printf " "format such as `%%d'\n"); - exit (1); + exit (EXIT_FAILURE); } @@ -238,7 +238,7 @@ main (int argc, char *argv[]) } else if (!strcmp(argv[argno], "-V")) { printf("This is %s version %u.%u release %u\n", prog_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); - exit(0); + exit(EXIT_SUCCESS); } else if (!strcmp (argv[argno], "-family_to_sec2")) { family_to_sec2 = TRUE; argno++; @@ -262,12 +262,12 @@ main (int argc, char *argv[]) if ((src=HDopen(src_name, O_RDONLY,0))<0) { perror (src_name); - exit (1); + exit (EXIT_FAILURE); } if (HDfstat(src, &sb)<0) { perror ("fstat"); - exit (1); + exit (EXIT_FAILURE); } src_size = src_act_size = sb.st_size; if (verbose) fprintf (stderr, "< %s\n", src_name); @@ -282,7 +282,7 @@ main (int argc, char *argv[]) if ((dst=HDopen (dst_name, O_RDWR|O_CREAT|O_TRUNC, 0666))<0) { perror (dst_name); - exit (1); + exit (EXIT_FAILURE); } if (verbose) fprintf (stderr, "> %s\n", dst_name); @@ -308,10 +308,10 @@ main (int argc, char *argv[]) n = (size_t)MIN ((off_t)n, src_act_size-src_offset); if ((nio=HDread (src, buf, n))<0) { perror ("read"); - exit (1); + exit (EXIT_FAILURE); } else if ((size_t)nio!=n) { fprintf (stderr, "%s: short read\n", src_name); - exit (1); + exit (EXIT_FAILURE); } for (i=0; isrc_size) { @@ -391,26 +391,26 @@ main (int argc, char *argv[]) if (0==dst_membno) { if (HDlseek (dst, dst_size-1, SEEK_SET)<0) { perror ("HDHDlseek"); - exit (1); + exit (EXIT_FAILURE); } if (HDread (dst, buf, 1)<0) { perror ("read"); - exit (1); + exit (EXIT_FAILURE); } if (HDlseek (dst, dst_size-1, SEEK_SET)<0) { perror ("HDlseek"); - exit (1); + exit (EXIT_FAILURE); } if (HDwrite (dst, buf, 1)<0) { perror ("write"); - exit (1); + exit (EXIT_FAILURE); } } HDclose (dst); sprintf (dst_name, dst_gen_name, ++dst_membno); if ((dst=HDopen (dst_name, O_RDWR|O_CREAT|O_TRUNC, 0666))<0) { perror (dst_name); - exit (1); + exit (EXIT_FAILURE); } dst_offset = 0; need_seek = FALSE; @@ -426,19 +426,19 @@ main (int argc, char *argv[]) if (need_seek) { if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) { perror ("HDlseek"); - exit (1); + exit (EXIT_FAILURE); } if (HDread (dst, buf, 1)<0) { perror ("read"); - exit (1); + exit (EXIT_FAILURE); } if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) { perror ("HDlseek"); - exit (1); + exit (EXIT_FAILURE); } if (HDwrite (dst, buf, 1)<0) { perror ("write"); - exit (1); + exit (EXIT_FAILURE); } } HDclose (dst); @@ -447,7 +447,7 @@ main (int argc, char *argv[]) * These private properties are for this tool only. */ if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) { perror ("H5Pcreate"); - exit (1); + exit (EXIT_FAILURE); } if(family_to_sec2) { @@ -456,7 +456,7 @@ main (int argc, char *argv[]) * driver information saved in the superblock. */ if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SEC2_NAME, &family_to_sec2) < 0) { perror ("H5Pset"); - exit (1); + exit (EXIT_FAILURE); } } else { /* Modify family size saved in superblock through private property. It signals @@ -464,14 +464,14 @@ main (int argc, char *argv[]) * This private property is for this tool only. */ if(H5Pset_fapl_family(fapl, H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) { perror ("H5Pset_fapl_family"); - exit (1); + exit (EXIT_FAILURE); } /* Set the property of the new member size as hsize_t */ hdsize = dst_size; if(H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) { perror ("H5Pset"); - exit (1); + exit (EXIT_FAILURE); } } @@ -488,16 +488,16 @@ main (int argc, char *argv[]) if(file>=0) { if(H5Fclose(file)<0) { perror ("H5Fclose"); - exit (1); + exit (EXIT_FAILURE); } } if(H5Pclose(fapl)<0) { perror ("H5Pclose"); - exit (1); + exit (EXIT_FAILURE); } /* Free resources and return */ free (buf); - return 0; + return EXIT_SUCCESS; } diff --git a/tools/misc/h5repart_gentest.c b/tools/misc/h5repart_gentest.c index 9fcc9c8..8420da5 100644 --- a/tools/misc/h5repart_gentest.c +++ b/tools/misc/h5repart_gentest.c @@ -39,29 +39,29 @@ int main(void) /* Set property list and file name for FAMILY driver */ if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) { perror ("H5Pcreate"); - exit (1); + exit (EXIT_FAILURE); } if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) { perror ("H5Pset_fapl_family"); - exit (1); + exit (EXIT_FAILURE); } if((file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { perror("H5Fcreate"); - exit(1); + exit(EXIT_FAILURE); } /* Create and write dataset */ if((space = H5Screate_simple(2, dims, NULL)) < 0) { perror("H5Screate_simple"); - exit(1); + exit(EXIT_FAILURE); } if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { perror("H5Dcreate2"); - exit(1); + exit(EXIT_FAILURE); } @@ -71,28 +71,28 @@ int main(void) if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) { perror("H5Dwrite"); - exit(1); + exit(EXIT_FAILURE); } if(H5Sclose(space) < 0) { perror ("H5Sclose"); - exit (1); + exit (EXIT_FAILURE); } if(H5Dclose(dset) < 0) { perror ("H5Dclose"); - exit (1); + exit (EXIT_FAILURE); } if(H5Pclose(fapl) < 0) { perror ("H5Pclose"); - exit (1); + exit (EXIT_FAILURE); } if(H5Fclose(file) < 0) { perror ("H5Fclose"); - exit (1); + exit (EXIT_FAILURE); } puts(" PASSED"); fflush(stdout); diff --git a/tools/misc/testh5mkgrp.sh b/tools/misc/testh5mkgrp.sh index 50ac23b..e6cb96e 100644 --- a/tools/misc/testh5mkgrp.sh +++ b/tools/misc/testh5mkgrp.sh @@ -19,6 +19,10 @@ # Tuesday, February 13, 2007 # +TESTNAME=h5mkgrp +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + H5MKGRP=h5mkgrp # The tool name H5MKGRP_BIN=`pwd`/$H5MKGRP # The path of the tool binary H5LS=h5ls # The h5ls tool name @@ -182,8 +186,9 @@ RUNTEST h5mkgrp_nested_mult_latest.h5 "-lp" /one/two /three/four if test $nerrors -eq 0 ; then - echo "All h5mkgrp tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors - diff --git a/tools/misc/testh5repart.sh.in b/tools/misc/testh5repart.sh.in index 62c99d7..7d4e020 100644 --- a/tools/misc/testh5repart.sh.in +++ b/tools/misc/testh5repart.sh.in @@ -15,6 +15,10 @@ # # Tests for the h5repart tool +TESTNAME=h5repart +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + REPART=h5repart # The tool name REPART_BIN=`pwd`/$REPART # The path of the tool binary @@ -100,14 +104,16 @@ TOOLTEST -m 20000 -family_to_sec2 family_file%05d.h5 $actual_dir/family_to_sec2. OUTPUTTEST echo -if test $nerrors -eq 0 ; then - echo "All $REPART tests passed." -fi - # Clean up output file if test -z "$HDF5_NOCLEANUP"; then cd $actual_dir rm -f fst_family*.h5 scd_family*.h5 family_to_sec2.h5 fi -exit $nerrors +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE +fi diff --git a/vms/c++/test/make.com b/vms/c++/test/make.com index 47d9370..7e4b671 100644 --- a/vms/c++/test/make.com +++ b/vms/c++/test/make.com @@ -33,13 +33,14 @@ $ ccc testhdf5 $ ccc tfile $ ccc tfilter $ ccc th5s +$ ccc tlinks $ ccc trefer $ ccc ttypes $ ccc tvlstr $ type sys$input Creating testhdf5 $ cxxlink testhdf5, h5cpputil, tattr, tcompound, tfile, tfilter, th5s, - - trefer, ttypes, tvlstr, - + tlinks, trefer, ttypes, tvlstr, - [-.src]hdf5_cplus.olb/lib, [-.-.test]libh5test.olb/lib, - [-.-.src]hdf5.olb/lib,zlib_dir:libz.olb/lib $! diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index d08e5dd..75f5308 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.54-FA_a4" +#define H5_PACKAGE_STRING "HDF5 1.9.59-FA_a4" /* 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.54-FA_a4" +#define H5_PACKAGE_VERSION "1.9.59-FA_a4" /* 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.54-FA_a4" +#define H5_VERSION "1.9.59-FA_a4" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ diff --git a/windows/hdf5check.BAT b/windows/hdf5check.BAT index 2f14bfd..07319ca 100755 --- a/windows/hdf5check.BAT +++ b/windows/hdf5check.BAT @@ -20,7 +20,7 @@ rem 1. hdf5check -- HDF5 tools and c library tests rem 2. hdf5check enablecpp -- HDF5 tools and c/c++ library tests rem 3. hdf5check enablefortran -- HDF5 tools and c/fortran library tests rem 4. hdf5check enableall -- HDF5 tools and c/c++/fortran library tests -rem disabledebug -- can be added to any of the above to not test debug versions +rem nodebug -- can be added to any of the above to not test debug versions setlocal enabledelayedexpansion pushd %~dp0 @@ -50,10 +50,10 @@ if /i "%1" equ "enablecpp" ( ) else if /i "%1" equ "enableall" ( set build_cpp_conditional=true set build_fortran_conditional=true -) else if /i "%1" equ "disabledebug" ( +) else if /i "%1" equ "nodebug" ( set chkdebug= ) -if /i "%2" equ "disabledebug" ( +if /i "%2" equ "nodebug" ( set chkdebug= ) diff --git a/windows/proj/hdf5/hdf5.vcproj b/windows/proj/hdf5/hdf5.vcproj index 8c72991..b6da610 100644 --- a/windows/proj/hdf5/hdf5.vcproj +++ b/windows/proj/hdf5/hdf5.vcproj @@ -845,6 +845,10 @@ > + + diff --git a/windows/proj/hdf5dll/hdf5dll.vcproj b/windows/proj/hdf5dll/hdf5dll.vcproj index 68a8719..860d0d4 100644 --- a/windows/proj/hdf5dll/hdf5dll.vcproj +++ b/windows/proj/hdf5dll/hdf5dll.vcproj @@ -936,6 +936,10 @@ > + + diff --git a/windows/src/H5pubconf.h b/windows/src/H5pubconf.h index 9af80ec..f42c762 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.54-FA_a4" +#define H5_PACKAGE_STRING "HDF5 1.9.59-FA_a4" /* 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.54-FA_a4" +#define H5_PACKAGE_VERSION "1.9.59-FA_a4" /* 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.54-FA_a4" +#define H5_VERSION "1.9.59-FA_a4" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ -- cgit v0.12